@erkamyaman/capacitor-foldable 8.3.3 → 8.4.1
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 +4 -2
- package/dist/esm/definitions.d.ts +12 -0
- package/dist/esm/definitions.js.map +1 -1
- 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/Foldable.swift +4 -0
- package/ios/Sources/FoldablePlugin/RuntimeFoldSource.swift +104 -0
- package/package.json +11 -1
- package/skills/capacitor-foldable/references/ionic.md +13 -0
- package/skills/capacitor-foldable/references/iphone-duo.md +1 -1
- package/skills/capacitor-foldable/references/testing.md +2 -2
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ const { state, hingeOrientation } = await Foldable.getFoldState();
|
|
|
38
38
|
| Platform | Status | Minimum |
|
|
39
39
|
| -------- | ------ | ------- |
|
|
40
40
|
| Android | Supported | API 24, `compileSdk` 36 |
|
|
41
|
-
| iOS | Size classes everywhere; fold, hinge and bar placement on iPhone Duo with Capacitor 8.5
|
|
41
|
+
| iOS | Size classes everywhere; fold, hinge and bar placement on iPhone Duo with Capacitor 8.5+ and iOS 27.1+, built with any Xcode | iOS 15 |
|
|
42
42
|
| Web | Stub, returns `flat` | |
|
|
43
43
|
|
|
44
44
|
## Do you need this plugin?
|
|
@@ -129,7 +129,7 @@ Using Ionic's `ion-tabs`? `import '@erkamyaman/capacitor-foldable/ionic-tabs.css
|
|
|
129
129
|
|
|
130
130
|
The plugin is built to give store review nothing to object to.
|
|
131
131
|
|
|
132
|
-
**iOS.** Public APIs only, UIKit and Capacitor, with no
|
|
132
|
+
**iOS.** Public APIs only, UIKit and Capacitor, with no private symbols. An app built against an SDK older than 27.1 reaches the iOS 27.1 APIs through the Objective-C runtime, since the compiler cannot see them, and they are the same public APIs either way. 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`. Any Xcode that Capacitor 8 supports builds fine, and reports the fold on a 27.1 device either way.
|
|
133
133
|
|
|
134
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
135
|
|
|
@@ -145,6 +145,8 @@ npx skills add erkamyaman/capacitor-foldable@capacitor-foldable
|
|
|
145
145
|
|
|
146
146
|
It is one skill with the platform detail split out: laying out around the crease in CSS, the full API, Ionic specifics, iPhone Duo, Android foldables, and how to test on both. It is beta, so tell me if any of it steers you wrong. It also ships inside the npm package under [`skills/`](skills/capacitor-foldable), so an agent working in a project that depends on the plugin can find it in `node_modules`.
|
|
147
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
|
+
|
|
148
150
|
## Guides
|
|
149
151
|
|
|
150
152
|
- [Examples](docs/examples.md)
|
|
@@ -203,6 +203,18 @@ export interface BarPlacement {
|
|
|
203
203
|
*/
|
|
204
204
|
inset: number;
|
|
205
205
|
}
|
|
206
|
+
type ThemeConsumedFoldState = {
|
|
207
|
+
state: 'flat' | 'half-opened' | 'closed';
|
|
208
|
+
hingeBounds?: {
|
|
209
|
+
x: number;
|
|
210
|
+
y: number;
|
|
211
|
+
width: number;
|
|
212
|
+
height: number;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
type StaysAssignableTo<Shape, T extends Shape> = T;
|
|
216
|
+
type FoldStateStaysThemeCompatible = StaysAssignableTo<ThemeConsumedFoldState, FoldState>;
|
|
217
|
+
export type { FoldStateStaysThemeCompatible };
|
|
206
218
|
export interface FoldablePolyfillOptions {
|
|
207
219
|
/**
|
|
208
220
|
* Take over hiding Ionic's tab bar while the keyboard is open. iPhone Duo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface FoldState {\n /**\n * Posture of the fold. `'closed'` is never reported today: a device shut on\n * its cover display reports `'flat'`.\n *\n * @since 7.0.0\n */\n state: 'flat' | 'half-opened' | 'closed';\n\n /**\n * Whether the fold splits the web view into two areas: `true` when\n * half-opened, or when the hinge has a physical gap.\n *\n * @since 7.0.0\n */\n isSeparating: boolean;\n\n /**\n * How the device is held: `'tabletop'` when half-opened with a horizontal\n * hinge, like a laptop, `'book'` when half-opened with a vertical hinge, and\n * `'flat'` otherwise.\n *\n * @since 7.0.0\n */\n posture: 'flat' | 'tabletop' | 'book';\n\n /**\n * Direction of the hinge relative to the window, so it flips when the device\n * rotates. Omitted when there is no fold.\n *\n * @since 7.0.0\n */\n hingeOrientation?: 'horizontal' | 'vertical';\n\n /**\n * Position of the fold in CSS pixels, relative to the web view. Zero wide (or\n * zero tall) on a seamless fold. Omitted when there is no fold.\n *\n * @since 7.0.0\n */\n hingeBounds?: { x: number; y: number; width: number; height: number };\n\n /**\n * Area of the web view the hinge covers, in CSS pixels. Only present on\n * devices with a physical gap.\n *\n * @since 7.0.0\n */\n occludedBounds?: { x: number; y: number; width: number; height: number };\n\n /**\n * Which display is showing the app, on a device with an inner and an outer\n * display such as iPhone Duo. Reported on iPhone Duo (iOS 27.1 or later) and\n * omitted elsewhere.\n *\n * @since 7.0.0\n */\n activeDisplay?: 'inner' | 'outer';\n\n /**\n * Areas of the web view something covers, in CSS pixels. On Android these are\n * the display cutouts. On iPhone Duo these are the active occlusion regions:\n * the camera in use, and the strip the system keeps for the vertical status\n * bar. Use `getReservedRegions()` when you need to tell them apart. Omitted\n * when there are none.\n *\n * @since 7.0.0\n */\n cameraBounds?: { x: number; y: number; width: number; height: number }[];\n\n /**\n * Space the system asks you to keep clear around the fold, in CSS pixels.\n * `hingeBounds` covers the crease plus these margins, so the crease itself is\n * `hingeBounds` shrunk by them. iPhone Duo reports 20 on each side of a\n * vertical fold. Omitted on Android and where there is no fold.\n *\n * @since 8.2.0\n */\n hingeMargins?: { top: number; right: number; bottom: number; left: number };\n}\n\nexport interface ReservedRegion {\n /**\n * `'division'` is the fold itself. `'occlusion'` is something covering the\n * display, such as a camera or the vertical status bar area.\n *\n * @since 8.2.0\n */\n kind: 'division' | 'occlusion';\n\n /**\n * Whether the region applies right now. An inactive division is a flat fold,\n * and an inactive occlusion is a camera that is not in use.\n *\n * @since 8.2.0\n */\n isActive: boolean;\n\n x: number;\n y: number;\n width: number;\n height: number;\n\n /**\n * Space to keep clear around the region, in CSS pixels.\n *\n * @since 8.2.0\n */\n margins: { top: number; right: number; bottom: number; left: number };\n}\n\n/**\n * How far open the hinge is, as the system sees it. Note that it can lag the\n * angle: iOS keeps reporting `'closed'` for a moment after the phone opens.\n *\n * @since 8.2.0\n */\nexport type HingeStatus = 'closed' | 'partiallyOpen' | 'fullyOpen';\n\nexport interface SizeClass {\n /**\n * Width size class of the window: `'compact'` on a phone and on the outer\n * display of a foldable, `'regular'` on the inner display, tablets and wide\n * windows. On Android and web `'regular'` starts at 600 CSS pixels.\n *\n * @since 7.0.0\n */\n horizontal: 'compact' | 'regular';\n\n /**\n * Height size class of the window: `'compact'` on a phone in landscape. On\n * Android and web `'regular'` starts at 480 CSS pixels.\n *\n * @since 7.0.0\n */\n vertical: 'compact' | 'regular';\n\n /**\n * Material window width class, from the window width in CSS pixels:\n * `'compact'` below 600, `'medium'` below 840, `'expanded'` below 1200,\n * `'large'` below 1600 and `'extraLarge'` from 1600.\n *\n * @since 7.0.0\n */\n widthClass: 'compact' | 'medium' | 'expanded' | 'large' | 'extraLarge';\n\n /**\n * Material window height class, from the window height in CSS pixels:\n * `'compact'` below 480, `'medium'` below 900 and `'expanded'` from 900.\n *\n * @since 7.0.0\n */\n heightClass: 'compact' | 'medium' | 'expanded';\n}\n\nexport type DisplayModeStatus = 'unsupported' | 'unavailable' | 'available' | 'active';\n\nexport interface DisplayModes {\n /**\n * Rear display mode moves the app to the outer display, so people can frame a\n * photo with the rear cameras. Only on Android foldables that offer it.\n *\n * @since 7.0.0\n */\n rearDisplay: DisplayModeStatus;\n\n /**\n * Dual-screen mode shows a second page on the outer display while the app\n * stays on the inner one. Only on Android foldables that offer it.\n *\n * @since 7.0.0\n */\n dualScreen: DisplayModeStatus;\n}\n\nexport interface BarPlacement {\n /**\n * The edge iPhone Duo moves tab bars and toolbars to when it lays them out\n * vertically: `'leading'` or `'trailing'` in the reading direction, so\n * `'leading'` is the left edge in left-to-right languages. `null` when bars\n * stay horizontal, and always on Android, web and iOS before 27.1. An app\n * built with an older Xcode still gets the edge: it is inferred from the\n * safe-area inset the bar leaves, since the trait that names it is missing.\n *\n * @since 7.0.0\n */\n verticalBarEdge: 'leading' | 'trailing' | null;\n\n /**\n * How much room the vertical bar takes on its edge, in points, rounded to\n * whole points. It is the same value the web view reports as a safe-area\n * inset, so `env(safe-area-inset-*)` already covers simple layouts. Read it\n * when you place your own chrome and need the number itself, and do not\n * assume it stays at 84: it differs when the bar is disabled, and Apple can\n * change it. `0` when no vertical bar is reported, and always on Android and\n * web.\n *\n * @since 8.3.3\n */\n inset: number;\n}\n\nexport interface FoldablePolyfillOptions {\n /**\n * Take over hiding Ionic's tab bar while the keyboard is open. iPhone Duo\n * reports a keyboard on every fold, and Ionic waits for the window to return\n * to the height it had when the keyboard first opened, so its tab bar can\n * disappear until the device is folded back. With this on, the keyboard events\n * never reach Ionic, and a `foldable-keyboard-open` class on `<html>` marks\n * when a text field really has the keyboard. `ionic-tabs.css` hides the tab\n * bar with it.\n *\n * @default false\n * @since 8.0.2\n */\n ionicKeyboard?: boolean;\n}\n\nexport interface FoldablePlugin {\n /**\n * Whether the device has a fold at all, and whether it can be propped half\n * open like a laptop. Both `false` on web, and on iOS except on iPhone Duo\n * (iOS 27.1 or later).\n *\n * @since 7.0.0\n */\n isDeviceFoldable(): Promise<{ foldable: boolean; supportsTabletop: boolean }>;\n\n /**\n * Read the current fold state. Resolves to\n * `{ state: 'flat', isSeparating: false, posture: 'flat' }` when there is no\n * fold information.\n *\n * @since 7.0.0\n */\n getFoldState(): Promise<FoldState>;\n\n /**\n * Read the angle between the two halves of the device, in degrees: `0` when\n * closed, `180` when flat. Resolves to `{ angle: null }` on devices without a\n * hinge angle sensor, on web, and on iOS before 27.1.\n *\n * @since 7.0.0\n */\n getHingeAngle(): Promise<{ angle: number | null; status: HingeStatus | null }>;\n\n /**\n * Read every region the system reserves on this display: the fold and\n * anything covering the screen, active or not. iPhone Duo reports the fold,\n * the vertical status bar area and the under-display camera. Resolves to an\n * empty list on Android, on web and on iOS before 27.1.\n *\n * @since 8.2.0\n */\n getReservedRegions(): Promise<{ regions: ReservedRegion[] }>;\n\n /**\n * Choose whether iPhone Duo may move this app's bars to the side of the\n * display. `'disabled'` keeps everything horizontal, including the status\n * bar. Resolves to `{ applied: false }` when the app does not use\n * `FoldableBridgeViewController`, on Android, on web and on iOS before 27.1.\n * See the iPhone Duo guide for the one-line storyboard change.\n *\n * @since 8.2.0\n */\n setVerticalBarBehavior(options: { behavior: 'automatic' | 'disabled' }): Promise<{ applied: boolean }>;\n\n /**\n * Read the window's size classes: Apple's compact and regular, the signal its\n * iPhone Duo guidelines recommend for telling the outer display from the inner\n * one, and Material's width and height classes. On iOS `horizontal` and\n * `vertical` are UIKit's size classes; everything else comes from the window\n * size.\n *\n * @since 7.0.0\n */\n getSizeClass(): Promise<SizeClass>;\n\n /**\n * Read which of the foldable display modes the device offers right now. Both\n * are `'unsupported'` on iOS and web.\n *\n * @since 7.0.0\n */\n getDisplayModes(): Promise<DisplayModes>;\n\n /**\n * Read where native bars go. Native tab bars and toolbars move to the side of\n * the display on iPhone Duo, but HTML ones stay put, so use this to move your\n * own tab bar too.\n *\n * @since 7.0.0\n */\n getBarPlacement(): Promise<BarPlacement>;\n\n /**\n * Move the app to the outer display. Android asks the user to confirm first,\n * and the promise resolves once the app has moved. Rejects when rear display\n * mode is not `'available'`. Only on Android.\n *\n * @since 7.0.0\n */\n startRearDisplay(): Promise<void>;\n\n /**\n * Move the app back to the inner display.\n *\n * @since 7.0.0\n */\n stopRearDisplay(): Promise<void>;\n\n /**\n * Show a page on the outer display while the app stays on the inner one. A\n * relative `url` resolves against the app's own URL, so `'cover.html'` loads a\n * page bundled with the app. The page runs in its own web view without access\n * to Capacitor plugins. Calling this again while dual-screen mode is active\n * replaces the page. Only on Android.\n *\n * @since 7.0.0\n */\n startDualScreen(options: { url: string }): Promise<void>;\n\n /**\n * Close the page on the outer display.\n *\n * @since 7.0.0\n */\n stopDualScreen(): Promise<void>;\n\n /**\n * Listen for fold state changes. On a foldable this also fires when the\n * device rotates, because `hingeOrientation` and `hingeBounds` rotate with\n * the window.\n *\n * @since 7.0.0\n */\n addListener(eventName: 'foldStateChange', listenerFunc: (state: FoldState) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for hinge angle changes. On Android the hinge sensor only runs while\n * at least one of these listeners is registered. On iOS it fires on iPhone\n * Duo (iOS 27.1 or later). Never fires on web.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'hingeAngleChange',\n listenerFunc: (event: { angle: number }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for size class changes, such as unfolding the device, rotating it or\n * resizing the window. On iOS this fires when UIKit's size classes change\n * (iOS 17 or later) or the device rotates, so a resize that keeps the same\n * size classes may not update `widthClass` and `heightClass` until then.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'sizeClassChange',\n listenerFunc: (sizeClass: SizeClass) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for changes to the display modes, including a mode ending because\n * the user folded or unfolded the device. Never fires on iOS and web.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'displayModeChange',\n listenerFunc: (modes: DisplayModes) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for the device being folded or unfolded. `folding` turns `true` as\n * soon as the hinge starts moving and `false` about half a second after it\n * stops, so an app can pause animations or heavy work while the screen is in\n * motion. Only fires where a hinge angle is available: Android foldables with\n * a hinge sensor, and iPhone Duo on iOS 27.1 or later.\n *\n * @since 8.2.0\n */\n addListener(\n eventName: 'foldingChange',\n listenerFunc: (event: { folding: boolean }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for bar placement changes, such as opening or rotating iPhone Duo.\n * Only fires on iOS 27.1 or later.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'barPlacementChange',\n listenerFunc: (placement: BarPlacement) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface FoldState {\n /**\n * Posture of the fold. `'closed'` is never reported today: a device shut on\n * its cover display reports `'flat'`.\n *\n * @since 7.0.0\n */\n state: 'flat' | 'half-opened' | 'closed';\n\n /**\n * Whether the fold splits the web view into two areas: `true` when\n * half-opened, or when the hinge has a physical gap.\n *\n * @since 7.0.0\n */\n isSeparating: boolean;\n\n /**\n * How the device is held: `'tabletop'` when half-opened with a horizontal\n * hinge, like a laptop, `'book'` when half-opened with a vertical hinge, and\n * `'flat'` otherwise.\n *\n * @since 7.0.0\n */\n posture: 'flat' | 'tabletop' | 'book';\n\n /**\n * Direction of the hinge relative to the window, so it flips when the device\n * rotates. Omitted when there is no fold.\n *\n * @since 7.0.0\n */\n hingeOrientation?: 'horizontal' | 'vertical';\n\n /**\n * Position of the fold in CSS pixels, relative to the web view. Zero wide (or\n * zero tall) on a seamless fold. Omitted when there is no fold.\n *\n * @since 7.0.0\n */\n hingeBounds?: { x: number; y: number; width: number; height: number };\n\n /**\n * Area of the web view the hinge covers, in CSS pixels. Only present on\n * devices with a physical gap.\n *\n * @since 7.0.0\n */\n occludedBounds?: { x: number; y: number; width: number; height: number };\n\n /**\n * Which display is showing the app, on a device with an inner and an outer\n * display such as iPhone Duo. Reported on iPhone Duo (iOS 27.1 or later) and\n * omitted elsewhere.\n *\n * @since 7.0.0\n */\n activeDisplay?: 'inner' | 'outer';\n\n /**\n * Areas of the web view something covers, in CSS pixels. On Android these are\n * the display cutouts. On iPhone Duo these are the active occlusion regions:\n * the camera in use, and the strip the system keeps for the vertical status\n * bar. Use `getReservedRegions()` when you need to tell them apart. Omitted\n * when there are none.\n *\n * @since 7.0.0\n */\n cameraBounds?: { x: number; y: number; width: number; height: number }[];\n\n /**\n * Space the system asks you to keep clear around the fold, in CSS pixels.\n * `hingeBounds` covers the crease plus these margins, so the crease itself is\n * `hingeBounds` shrunk by them. iPhone Duo reports 20 on each side of a\n * vertical fold. Omitted on Android and where there is no fold.\n *\n * @since 8.2.0\n */\n hingeMargins?: { top: number; right: number; bottom: number; left: number };\n}\n\nexport interface ReservedRegion {\n /**\n * `'division'` is the fold itself. `'occlusion'` is something covering the\n * display, such as a camera or the vertical status bar area.\n *\n * @since 8.2.0\n */\n kind: 'division' | 'occlusion';\n\n /**\n * Whether the region applies right now. An inactive division is a flat fold,\n * and an inactive occlusion is a camera that is not in use.\n *\n * @since 8.2.0\n */\n isActive: boolean;\n\n x: number;\n y: number;\n width: number;\n height: number;\n\n /**\n * Space to keep clear around the region, in CSS pixels.\n *\n * @since 8.2.0\n */\n margins: { top: number; right: number; bottom: number; left: number };\n}\n\n/**\n * How far open the hinge is, as the system sees it. Note that it can lag the\n * angle: iOS keeps reporting `'closed'` for a moment after the phone opens.\n *\n * @since 8.2.0\n */\nexport type HingeStatus = 'closed' | 'partiallyOpen' | 'fullyOpen';\n\nexport interface SizeClass {\n /**\n * Width size class of the window: `'compact'` on a phone and on the outer\n * display of a foldable, `'regular'` on the inner display, tablets and wide\n * windows. On Android and web `'regular'` starts at 600 CSS pixels.\n *\n * @since 7.0.0\n */\n horizontal: 'compact' | 'regular';\n\n /**\n * Height size class of the window: `'compact'` on a phone in landscape. On\n * Android and web `'regular'` starts at 480 CSS pixels.\n *\n * @since 7.0.0\n */\n vertical: 'compact' | 'regular';\n\n /**\n * Material window width class, from the window width in CSS pixels:\n * `'compact'` below 600, `'medium'` below 840, `'expanded'` below 1200,\n * `'large'` below 1600 and `'extraLarge'` from 1600.\n *\n * @since 7.0.0\n */\n widthClass: 'compact' | 'medium' | 'expanded' | 'large' | 'extraLarge';\n\n /**\n * Material window height class, from the window height in CSS pixels:\n * `'compact'` below 480, `'medium'` below 900 and `'expanded'` from 900.\n *\n * @since 7.0.0\n */\n heightClass: 'compact' | 'medium' | 'expanded';\n}\n\nexport type DisplayModeStatus = 'unsupported' | 'unavailable' | 'available' | 'active';\n\nexport interface DisplayModes {\n /**\n * Rear display mode moves the app to the outer display, so people can frame a\n * photo with the rear cameras. Only on Android foldables that offer it.\n *\n * @since 7.0.0\n */\n rearDisplay: DisplayModeStatus;\n\n /**\n * Dual-screen mode shows a second page on the outer display while the app\n * stays on the inner one. Only on Android foldables that offer it.\n *\n * @since 7.0.0\n */\n dualScreen: DisplayModeStatus;\n}\n\nexport interface BarPlacement {\n /**\n * The edge iPhone Duo moves tab bars and toolbars to when it lays them out\n * vertically: `'leading'` or `'trailing'` in the reading direction, so\n * `'leading'` is the left edge in left-to-right languages. `null` when bars\n * stay horizontal, and always on Android, web and iOS before 27.1. An app\n * built with an older Xcode still gets the edge: it is inferred from the\n * safe-area inset the bar leaves, since the trait that names it is missing.\n *\n * @since 7.0.0\n */\n verticalBarEdge: 'leading' | 'trailing' | null;\n\n /**\n * How much room the vertical bar takes on its edge, in points, rounded to\n * whole points. It is the same value the web view reports as a safe-area\n * inset, so `env(safe-area-inset-*)` already covers simple layouts. Read it\n * when you place your own chrome and need the number itself, and do not\n * assume it stays at 84: it differs when the bar is disabled, and Apple can\n * change it. `0` when no vertical bar is reported, and always on Android and\n * web.\n *\n * @since 8.3.3\n */\n inset: number;\n}\n\ntype ThemeConsumedFoldState = {\n state: 'flat' | 'half-opened' | 'closed';\n hingeBounds?: { x: number; y: number; width: number; height: number };\n};\n\ntype StaysAssignableTo<Shape, T extends Shape> = T;\n\ntype FoldStateStaysThemeCompatible = StaysAssignableTo<ThemeConsumedFoldState, FoldState>;\n\nexport type { FoldStateStaysThemeCompatible };\n\nexport interface FoldablePolyfillOptions {\n /**\n * Take over hiding Ionic's tab bar while the keyboard is open. iPhone Duo\n * reports a keyboard on every fold, and Ionic waits for the window to return\n * to the height it had when the keyboard first opened, so its tab bar can\n * disappear until the device is folded back. With this on, the keyboard events\n * never reach Ionic, and a `foldable-keyboard-open` class on `<html>` marks\n * when a text field really has the keyboard. `ionic-tabs.css` hides the tab\n * bar with it.\n *\n * @default false\n * @since 8.0.2\n */\n ionicKeyboard?: boolean;\n}\n\nexport interface FoldablePlugin {\n /**\n * Whether the device has a fold at all, and whether it can be propped half\n * open like a laptop. Both `false` on web, and on iOS except on iPhone Duo\n * (iOS 27.1 or later).\n *\n * @since 7.0.0\n */\n isDeviceFoldable(): Promise<{ foldable: boolean; supportsTabletop: boolean }>;\n\n /**\n * Read the current fold state. Resolves to\n * `{ state: 'flat', isSeparating: false, posture: 'flat' }` when there is no\n * fold information.\n *\n * @since 7.0.0\n */\n getFoldState(): Promise<FoldState>;\n\n /**\n * Read the angle between the two halves of the device, in degrees: `0` when\n * closed, `180` when flat. Resolves to `{ angle: null }` on devices without a\n * hinge angle sensor, on web, and on iOS before 27.1.\n *\n * @since 7.0.0\n */\n getHingeAngle(): Promise<{ angle: number | null; status: HingeStatus | null }>;\n\n /**\n * Read every region the system reserves on this display: the fold and\n * anything covering the screen, active or not. iPhone Duo reports the fold,\n * the vertical status bar area and the under-display camera. Resolves to an\n * empty list on Android, on web and on iOS before 27.1.\n *\n * @since 8.2.0\n */\n getReservedRegions(): Promise<{ regions: ReservedRegion[] }>;\n\n /**\n * Choose whether iPhone Duo may move this app's bars to the side of the\n * display. `'disabled'` keeps everything horizontal, including the status\n * bar. Resolves to `{ applied: false }` when the app does not use\n * `FoldableBridgeViewController`, on Android, on web and on iOS before 27.1.\n * See the iPhone Duo guide for the one-line storyboard change.\n *\n * @since 8.2.0\n */\n setVerticalBarBehavior(options: { behavior: 'automatic' | 'disabled' }): Promise<{ applied: boolean }>;\n\n /**\n * Read the window's size classes: Apple's compact and regular, the signal its\n * iPhone Duo guidelines recommend for telling the outer display from the inner\n * one, and Material's width and height classes. On iOS `horizontal` and\n * `vertical` are UIKit's size classes; everything else comes from the window\n * size.\n *\n * @since 7.0.0\n */\n getSizeClass(): Promise<SizeClass>;\n\n /**\n * Read which of the foldable display modes the device offers right now. Both\n * are `'unsupported'` on iOS and web.\n *\n * @since 7.0.0\n */\n getDisplayModes(): Promise<DisplayModes>;\n\n /**\n * Read where native bars go. Native tab bars and toolbars move to the side of\n * the display on iPhone Duo, but HTML ones stay put, so use this to move your\n * own tab bar too.\n *\n * @since 7.0.0\n */\n getBarPlacement(): Promise<BarPlacement>;\n\n /**\n * Move the app to the outer display. Android asks the user to confirm first,\n * and the promise resolves once the app has moved. Rejects when rear display\n * mode is not `'available'`. Only on Android.\n *\n * @since 7.0.0\n */\n startRearDisplay(): Promise<void>;\n\n /**\n * Move the app back to the inner display.\n *\n * @since 7.0.0\n */\n stopRearDisplay(): Promise<void>;\n\n /**\n * Show a page on the outer display while the app stays on the inner one. A\n * relative `url` resolves against the app's own URL, so `'cover.html'` loads a\n * page bundled with the app. The page runs in its own web view without access\n * to Capacitor plugins. Calling this again while dual-screen mode is active\n * replaces the page. Only on Android.\n *\n * @since 7.0.0\n */\n startDualScreen(options: { url: string }): Promise<void>;\n\n /**\n * Close the page on the outer display.\n *\n * @since 7.0.0\n */\n stopDualScreen(): Promise<void>;\n\n /**\n * Listen for fold state changes. On a foldable this also fires when the\n * device rotates, because `hingeOrientation` and `hingeBounds` rotate with\n * the window.\n *\n * @since 7.0.0\n */\n addListener(eventName: 'foldStateChange', listenerFunc: (state: FoldState) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for hinge angle changes. On Android the hinge sensor only runs while\n * at least one of these listeners is registered. On iOS it fires on iPhone\n * Duo (iOS 27.1 or later). Never fires on web.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'hingeAngleChange',\n listenerFunc: (event: { angle: number }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for size class changes, such as unfolding the device, rotating it or\n * resizing the window. On iOS this fires when UIKit's size classes change\n * (iOS 17 or later) or the device rotates, so a resize that keeps the same\n * size classes may not update `widthClass` and `heightClass` until then.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'sizeClassChange',\n listenerFunc: (sizeClass: SizeClass) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for changes to the display modes, including a mode ending because\n * the user folded or unfolded the device. Never fires on iOS and web.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'displayModeChange',\n listenerFunc: (modes: DisplayModes) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for the device being folded or unfolded. `folding` turns `true` as\n * soon as the hinge starts moving and `false` about half a second after it\n * stops, so an app can pause animations or heavy work while the screen is in\n * motion. Only fires where a hinge angle is available: Android foldables with\n * a hinge sensor, and iPhone Duo on iOS 27.1 or later.\n *\n * @since 8.2.0\n */\n addListener(\n eventName: 'foldingChange',\n listenerFunc: (event: { folding: boolean }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for bar placement changes, such as opening or rotating iPhone Duo.\n * Only fires on iOS 27.1 or later.\n *\n * @since 7.0.0\n */\n addListener(\n eventName: 'barPlacementChange',\n listenerFunc: (placement: BarPlacement) => void,\n ): Promise<PluginListenerHandle>;\n}\n"]}
|
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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AI,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,mBA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AE,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;AAC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,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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AC,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,gBAA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ReservedRegionFoldProvider(source: UIKitFoldSource())
|
|
60
60
|
}
|
|
61
|
+
#elseif !targetEnvironment(macCatalyst)
|
|
62
|
+
if #available(iOS 27.1, *) {
|
|
63
|
+
return MainActor.assumeIsolated { ReservedRegionFoldProvider(source: RuntimeFoldSource()) }
|
|
64
|
+
}
|
|
61
65
|
#endif
|
|
62
66
|
return UnsupportedFoldProvider()
|
|
63
67
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import ObjectiveC
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
#if !canImport(UIKit, _underlyingVersion: 9127.0.85) && !targetEnvironment(macCatalyst)
|
|
5
|
+
@MainActor
|
|
6
|
+
final class RuntimeFoldSource: @preconcurrency FoldSource {
|
|
7
|
+
private weak var view: UIView?
|
|
8
|
+
private var interaction: NSObject?
|
|
9
|
+
private var status: Int?
|
|
10
|
+
private var radians: Double?
|
|
11
|
+
|
|
12
|
+
private let divisionKind: AnyObject?
|
|
13
|
+
private let occlusionKind: AnyObject?
|
|
14
|
+
private let available: Bool
|
|
15
|
+
|
|
16
|
+
nonisolated init() {
|
|
17
|
+
let respondsToRegions = UIView.instancesRespond(to: Selector(("reservedRegionsOfKind:options:")))
|
|
18
|
+
let kindClass: AnyClass? = NSClassFromString("UIViewReservedRegionKind")
|
|
19
|
+
let interactionClass: AnyClass? = NSClassFromString("UIHingeInteraction")
|
|
20
|
+
|
|
21
|
+
available = respondsToRegions && kindClass != nil && interactionClass != nil
|
|
22
|
+
divisionKind = kindClass.flatMap { RuntimeFoldSource.kind($0, "divisionRegionKind") }
|
|
23
|
+
occlusionKind = kindClass.flatMap { RuntimeFoldSource.kind($0, "occlusionRegionKind") }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var hasFold: Bool {
|
|
27
|
+
guard available else { return false }
|
|
28
|
+
if let status = status, status != 0 { return true }
|
|
29
|
+
guard let view = view else { return false }
|
|
30
|
+
return !regions(kind: divisionKind, in: view).isEmpty
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var hingeStatus: HingeStatus? {
|
|
34
|
+
switch status {
|
|
35
|
+
case 1: return .closed
|
|
36
|
+
case 2: return .partiallyOpen
|
|
37
|
+
case 3: return .fullyOpen
|
|
38
|
+
default: return nil
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var hingeAngle: Double? {
|
|
43
|
+
guard let radians = radians, status != nil, status != 0 else { return nil }
|
|
44
|
+
return radians * 180 / .pi
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
func reservedRegions(in view: UIView) -> [ReservedRegion] {
|
|
48
|
+
return regions(kind: divisionKind, in: view).map { read($0, as: .division) }
|
|
49
|
+
+ regions(kind: occlusionKind, in: view).map { read($0, as: .occlusion) }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
func observe(_ view: UIView, onChange: @escaping () -> Void) {
|
|
53
|
+
self.view = view
|
|
54
|
+
guard available, let interactionClass = NSClassFromString("UIHingeInteraction") as? NSObject.Type else { return }
|
|
55
|
+
|
|
56
|
+
let handler: @convention(block) (AnyObject?, AnyObject?) -> Void = { [weak self] _, update in
|
|
57
|
+
MainActor.assumeIsolated {
|
|
58
|
+
self?.read(update)
|
|
59
|
+
onChange()
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
let allocated = interactionClass.perform(Selector(("alloc")))?.takeUnretainedValue() as? NSObject
|
|
63
|
+
let interaction = allocated?
|
|
64
|
+
.perform(Selector(("initWithUpdateHandler:")), with: handler)?
|
|
65
|
+
.takeUnretainedValue() as? NSObject
|
|
66
|
+
guard let interaction = interaction else { return }
|
|
67
|
+
|
|
68
|
+
view.perform(Selector(("addInteraction:")), with: interaction)
|
|
69
|
+
self.interaction = interaction
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private func read(_ update: AnyObject?) {
|
|
73
|
+
guard let hinge = update?.value(forKey: "hinge") as AnyObject? else {
|
|
74
|
+
status = nil
|
|
75
|
+
radians = nil
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
status = (hinge.value(forKey: "status") as? NSNumber)?.intValue
|
|
79
|
+
radians = (hinge.value(forKey: "angle") as? NSNumber)?.doubleValue
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private func regions(kind: AnyObject?, in view: UIView) -> [AnyObject] {
|
|
83
|
+
guard available, let kind = kind else { return [] }
|
|
84
|
+
let selector = Selector(("reservedRegionsOfKind:options:"))
|
|
85
|
+
typealias Call = @convention(c) (AnyObject, Selector, AnyObject, UInt) -> AnyObject?
|
|
86
|
+
guard let method = view.method(for: selector) else { return [] }
|
|
87
|
+
let call = unsafeBitCast(method, to: Call.self)
|
|
88
|
+
return call(view, selector, kind, 1) as? [AnyObject] ?? []
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private func read(_ region: AnyObject, as kind: ReservedRegion.Kind) -> ReservedRegion {
|
|
92
|
+
let frame = (region.value(forKey: "frame") as? NSValue)?.cgRectValue ?? .zero
|
|
93
|
+
let margins = (region.value(forKey: "margins") as? NSValue)?.uiEdgeInsetsValue ?? .zero
|
|
94
|
+
let isActive = (region.value(forKey: "isActive") as? NSNumber)?.boolValue ?? false
|
|
95
|
+
return ReservedRegion(kind: kind, frame: frame, margins: margins, isActive: isActive)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
nonisolated private static func kind(_ owner: AnyClass, _ name: String) -> AnyObject? {
|
|
99
|
+
let selector = Selector((name))
|
|
100
|
+
guard owner.responds(to: selector) else { return nil }
|
|
101
|
+
return (owner as AnyObject).perform(selector)?.takeUnretainedValue()
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
#endif
|
package/package.json
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erkamyaman/capacitor-foldable",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
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",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/esm/index.d.ts",
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/plugin.cjs.js"
|
|
13
|
+
},
|
|
14
|
+
"./ionic-tabs.css": "./ionic-tabs.css",
|
|
15
|
+
"./ionic-tabs-ios26.css": "./ionic-tabs-ios26.css",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
8
18
|
"unpkg": "dist/plugin.js",
|
|
9
19
|
"files": [
|
|
10
20
|
"android/build.gradle",
|
|
@@ -21,6 +21,19 @@ That turns `ion-tabs` into a side pill exactly where native bars go, and only wh
|
|
|
21
21
|
|
|
22
22
|
React and Vue import it from the entry file as usual, since their bundlers ship type shims for CSS.
|
|
23
23
|
|
|
24
|
+
## Projecting Ionic controls into native UI
|
|
25
|
+
|
|
26
|
+
Moving the tab bar with CSS is one answer. The other is [`@rdlabo/ionic-theme-ios27`](https://github.com/rdlabo-dev/ionic-theme-ios27), which brings SwiftUI-like UI rearrangement to Ionic apps: it repositions existing `ion-back-button`, `ion-buttons`, `ion-button` and `ion-tab-bar` controls, then projects them into native UI. An app can adopt its Vertical Bars while keeping its existing theme.
|
|
27
|
+
|
|
28
|
+
The split is clean: this plugin provides device state, the theme handles rearrangement and rendering. The app passes what it reads here into the theme, and the theme decides what to draw.
|
|
29
|
+
|
|
30
|
+
For setup, send the reader to the theme's own documentation rather than duplicating it here:
|
|
31
|
+
|
|
32
|
+
- [iPhone Duo with your existing theme](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/iphone-duo-with-original-theme)
|
|
33
|
+
- [Vertical Bars reference](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/vertical-bars)
|
|
34
|
+
|
|
35
|
+
Use the CSS stylesheet above when you want Ionic's own tab bar moved, and the theme when you want the controls rendered natively.
|
|
36
|
+
|
|
24
37
|
## A fold fires a keyboard event
|
|
25
38
|
|
|
26
39
|
iPhone Duo sends a keyboard event when the device folds. Ionic's keyboard controller measures the app container's height the first time the keyboard opens and caches it, then waits for that exact height before showing the tab bar again. After a fold the height no longer matches, so the bar never comes back. Opt in to the fix:
|
|
@@ -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
|
|