@erkamyaman/capacitor-foldable 8.1.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ErkamyamanCapacitorFoldable.podspec +1 -0
- package/Package.swift +2 -1
- package/README.md +131 -12
- package/android/src/main/kotlin/io/github/erkamyaman/foldable/FoldablePlugin.kt +31 -1
- package/dist/docs.json +176 -4
- package/dist/esm/css.d.ts +6 -1
- package/dist/esm/css.js +16 -2
- package/dist/esm/css.js.map +1 -1
- package/dist/esm/definitions.d.ts +95 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/polyfill.js +6 -1
- package/dist/esm/polyfill.js.map +1 -1
- package/dist/esm/web.d.ts +7 -0
- package/dist/esm/web.js +7 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +29 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +29 -4
- package/dist/plugin.js.map +1 -1
- package/ionic-tabs.css +2 -1
- package/ios/Sources/FoldablePlugin/Foldable.swift +41 -1
- package/ios/Sources/FoldablePlugin/FoldableBridgeViewController.swift +41 -0
- package/ios/Sources/FoldablePlugin/FoldablePlugin.swift +41 -0
- package/ios/Sources/FoldablePlugin/ReservedRegionFoldProvider.swift +41 -11
- package/ios/Sources/FoldablePlugin/Resources/PrivacyInfo.xcprivacy +14 -0
- package/ios/Sources/FoldablePlugin/UIKitFoldSource.swift +3 -3
- package/ios/Tests/FoldablePluginTests/FoldableTests.swift +4 -0
- package/ios/Tests/FoldablePluginTests/ReservedRegionFoldProviderTests.swift +18 -0
- package/package.json +7 -6
- package/skills/capacitor-foldable/SKILL.md +87 -0
- package/skills/capacitor-foldable/references/android.md +52 -0
- package/skills/capacitor-foldable/references/api.md +112 -0
- package/skills/capacitor-foldable/references/css-layout.md +127 -0
- package/skills/capacitor-foldable/references/ionic.md +50 -0
- package/skills/capacitor-foldable/references/iphone-duo.md +54 -0
- package/skills/capacitor-foldable/references/testing.md +53 -0
|
@@ -62,10 +62,11 @@ export interface FoldState {
|
|
|
62
62
|
*/
|
|
63
63
|
activeDisplay?: 'inner' | 'outer';
|
|
64
64
|
/**
|
|
65
|
-
* Areas of the web view
|
|
66
|
-
*
|
|
67
|
-
* camera and the
|
|
68
|
-
*
|
|
65
|
+
* Areas of the web view something covers, in CSS pixels. On Android these are
|
|
66
|
+
* the display cutouts. On iPhone Duo these are the active occlusion regions:
|
|
67
|
+
* the camera in use, and the strip the system keeps for the vertical status
|
|
68
|
+
* bar. Use `getReservedRegions()` when you need to tell them apart. Omitted
|
|
69
|
+
* when there are none.
|
|
69
70
|
*
|
|
70
71
|
* @since 7.0.0
|
|
71
72
|
*/
|
|
@@ -75,7 +76,59 @@ export interface FoldState {
|
|
|
75
76
|
width: number;
|
|
76
77
|
height: number;
|
|
77
78
|
}[];
|
|
79
|
+
/**
|
|
80
|
+
* Space the system asks you to keep clear around the fold, in CSS pixels.
|
|
81
|
+
* `hingeBounds` covers the crease plus these margins, so the crease itself is
|
|
82
|
+
* `hingeBounds` shrunk by them. iPhone Duo reports 20 on each side of a
|
|
83
|
+
* vertical fold. Omitted on Android and where there is no fold.
|
|
84
|
+
*
|
|
85
|
+
* @since 8.2.0
|
|
86
|
+
*/
|
|
87
|
+
hingeMargins?: {
|
|
88
|
+
top: number;
|
|
89
|
+
right: number;
|
|
90
|
+
bottom: number;
|
|
91
|
+
left: number;
|
|
92
|
+
};
|
|
78
93
|
}
|
|
94
|
+
export interface ReservedRegion {
|
|
95
|
+
/**
|
|
96
|
+
* `'division'` is the fold itself. `'occlusion'` is something covering the
|
|
97
|
+
* display, such as a camera or the vertical status bar area.
|
|
98
|
+
*
|
|
99
|
+
* @since 8.2.0
|
|
100
|
+
*/
|
|
101
|
+
kind: 'division' | 'occlusion';
|
|
102
|
+
/**
|
|
103
|
+
* Whether the region applies right now. An inactive division is a flat fold,
|
|
104
|
+
* and an inactive occlusion is a camera that is not in use.
|
|
105
|
+
*
|
|
106
|
+
* @since 8.2.0
|
|
107
|
+
*/
|
|
108
|
+
isActive: boolean;
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
/**
|
|
114
|
+
* Space to keep clear around the region, in CSS pixels.
|
|
115
|
+
*
|
|
116
|
+
* @since 8.2.0
|
|
117
|
+
*/
|
|
118
|
+
margins: {
|
|
119
|
+
top: number;
|
|
120
|
+
right: number;
|
|
121
|
+
bottom: number;
|
|
122
|
+
left: number;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* How far open the hinge is, as the system sees it. Note that it can lag the
|
|
127
|
+
* angle: iOS keeps reporting `'closed'` for a moment after the phone opens.
|
|
128
|
+
*
|
|
129
|
+
* @since 8.2.0
|
|
130
|
+
*/
|
|
131
|
+
export type HingeStatus = 'closed' | 'partiallyOpen' | 'fullyOpen';
|
|
79
132
|
export interface SizeClass {
|
|
80
133
|
/**
|
|
81
134
|
* Width size class of the window: `'compact'` on a phone and on the outer
|
|
@@ -180,6 +233,32 @@ export interface FoldablePlugin {
|
|
|
180
233
|
*/
|
|
181
234
|
getHingeAngle(): Promise<{
|
|
182
235
|
angle: number | null;
|
|
236
|
+
status: HingeStatus | null;
|
|
237
|
+
}>;
|
|
238
|
+
/**
|
|
239
|
+
* Read every region the system reserves on this display: the fold and
|
|
240
|
+
* anything covering the screen, active or not. iPhone Duo reports the fold,
|
|
241
|
+
* the vertical status bar area and the under-display camera. Resolves to an
|
|
242
|
+
* empty list on Android, on web and on iOS before 27.1.
|
|
243
|
+
*
|
|
244
|
+
* @since 8.2.0
|
|
245
|
+
*/
|
|
246
|
+
getReservedRegions(): Promise<{
|
|
247
|
+
regions: ReservedRegion[];
|
|
248
|
+
}>;
|
|
249
|
+
/**
|
|
250
|
+
* Choose whether iPhone Duo may move this app's bars to the side of the
|
|
251
|
+
* display. `'disabled'` keeps everything horizontal, including the status
|
|
252
|
+
* bar. Resolves to `{ applied: false }` when the app does not use
|
|
253
|
+
* `FoldableBridgeViewController`, on Android, on web and on iOS before 27.1.
|
|
254
|
+
* See the iPhone Duo guide for the one-line storyboard change.
|
|
255
|
+
*
|
|
256
|
+
* @since 8.2.0
|
|
257
|
+
*/
|
|
258
|
+
setVerticalBarBehavior(options: {
|
|
259
|
+
behavior: 'automatic' | 'disabled';
|
|
260
|
+
}): Promise<{
|
|
261
|
+
applied: boolean;
|
|
183
262
|
}>;
|
|
184
263
|
/**
|
|
185
264
|
* Read the window's size classes: Apple's compact and regular, the signal its
|
|
@@ -272,6 +351,18 @@ export interface FoldablePlugin {
|
|
|
272
351
|
* @since 7.0.0
|
|
273
352
|
*/
|
|
274
353
|
addListener(eventName: 'displayModeChange', listenerFunc: (modes: DisplayModes) => void): Promise<PluginListenerHandle>;
|
|
354
|
+
/**
|
|
355
|
+
* Listen for the device being folded or unfolded. `folding` turns `true` as
|
|
356
|
+
* soon as the hinge starts moving and `false` about half a second after it
|
|
357
|
+
* stops, so an app can pause animations or heavy work while the screen is in
|
|
358
|
+
* motion. Only fires where a hinge angle is available: Android foldables with
|
|
359
|
+
* a hinge sensor, and iPhone Duo on iOS 27.1 or later.
|
|
360
|
+
*
|
|
361
|
+
* @since 8.2.0
|
|
362
|
+
*/
|
|
363
|
+
addListener(eventName: 'foldingChange', listenerFunc: (event: {
|
|
364
|
+
folding: boolean;
|
|
365
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
275
366
|
/**
|
|
276
367
|
* Listen for bar placement changes, such as opening or rotating iPhone Duo.
|
|
277
368
|
* Only fires on iOS 27.1 or later.
|
|
@@ -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 covered by a front-facing camera, in CSS pixels. On\n * Android these are the display cutouts. On iPhone Duo they are the outer\n * camera and the under-display inner camera while it is in use. Omitted when\n * there are none.\n *\n * @since 7.0.0\n */\n cameraBounds?: { x: number; y: number; width: number; height: number }[];\n}\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.\n *\n * @since 7.0.0\n */\n verticalBarEdge: 'leading' | 'trailing' | null;\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 }>;\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 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.\n *\n * @since 7.0.0\n */\n verticalBarEdge: 'leading' | 'trailing' | null;\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"]}
|
package/dist/esm/polyfill.js
CHANGED
|
@@ -60,7 +60,7 @@ async function run(plugin, options) {
|
|
|
60
60
|
root.style.setProperty(name, css.variables[name]);
|
|
61
61
|
for (const name of CSS_CLASSES)
|
|
62
62
|
root.classList.toggle(name, css.classes.includes(name));
|
|
63
|
-
const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation);
|
|
63
|
+
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);
|
|
64
64
|
for (const name of FOLD_VARIABLES) {
|
|
65
65
|
if (foldCss.variables[name])
|
|
66
66
|
root.style.setProperty(name, foldCss.variables[name]);
|
|
@@ -75,12 +75,17 @@ async function run(plugin, options) {
|
|
|
75
75
|
fold = next;
|
|
76
76
|
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(next));
|
|
77
77
|
applyCss();
|
|
78
|
+
// The web view can report the previous window size for a moment after the
|
|
79
|
+
// app moves between displays, so measure again once it has settled.
|
|
80
|
+
requestAnimationFrame(applyCss);
|
|
81
|
+
setTimeout(applyCss, 300);
|
|
78
82
|
};
|
|
79
83
|
const applyBars = ({ verticalBarEdge }) => {
|
|
80
84
|
const active = barClassFor(verticalBarEdge);
|
|
81
85
|
for (const name of BAR_CLASSES)
|
|
82
86
|
root.classList.toggle(name, name === active);
|
|
83
87
|
};
|
|
88
|
+
await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));
|
|
84
89
|
window.addEventListener('resize', applyCss);
|
|
85
90
|
await plugin.addListener('foldStateChange', apply);
|
|
86
91
|
await plugin.addListener('barPlacementChange', applyBars);
|
package/dist/esm/polyfill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,MAAM,EACN,YAAY,EACZ,cAAc,EACd,UAAU,EACV,oBAAoB,GACrB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAA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AC,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,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;\n posture?.update(postureOf(next));\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 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"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -8,8 +8,15 @@ export declare class FoldableWeb extends WebPlugin implements FoldablePlugin {
|
|
|
8
8
|
supportsTabletop: boolean;
|
|
9
9
|
}>;
|
|
10
10
|
getFoldState(): Promise<FoldState>;
|
|
11
|
+
setVerticalBarBehavior(): Promise<{
|
|
12
|
+
applied: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
getReservedRegions(): Promise<{
|
|
15
|
+
regions: [];
|
|
16
|
+
}>;
|
|
11
17
|
getHingeAngle(): Promise<{
|
|
12
18
|
angle: number | null;
|
|
19
|
+
status: null;
|
|
13
20
|
}>;
|
|
14
21
|
getSizeClass(): Promise<SizeClass>;
|
|
15
22
|
getDisplayModes(): Promise<DisplayModes>;
|
package/dist/esm/web.js
CHANGED
|
@@ -18,8 +18,14 @@ export class FoldableWeb extends WebPlugin {
|
|
|
18
18
|
async getFoldState() {
|
|
19
19
|
return { state: 'flat', isSeparating: false, posture: 'flat' };
|
|
20
20
|
}
|
|
21
|
+
async setVerticalBarBehavior() {
|
|
22
|
+
return { applied: false };
|
|
23
|
+
}
|
|
24
|
+
async getReservedRegions() {
|
|
25
|
+
return { regions: [] };
|
|
26
|
+
}
|
|
21
27
|
async getHingeAngle() {
|
|
22
|
-
return { angle: null };
|
|
28
|
+
return { angle: null, status: null };
|
|
23
29
|
}
|
|
24
30
|
async getSizeClass() {
|
|
25
31
|
return sizeClassOf(window.innerWidth, window.innerHeight);
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,WAAY,SAAQ,SAAS;IAGxC;QACE,KAAK,EAAE,CAAC;QAHF,cAAS,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAIrE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;YACrC,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;YAChE,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;gBAAE,OAAO;YAEpE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,WAAY,SAA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,UAAU,EAAE,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,WAAW,CAAC,iDAAiD,CAAC,CAAC;IAC5E,CAAC;IAED,eAAe;QACb,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,WAAW,CAAC,gDAAgD,CAAC,CAAC;IAC3E,CAAC;IAED,cAAc;QACZ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { BarPlacement, DisplayModes, FoldablePlugin, FoldState, SizeClass } from './definitions';\nimport { sizeClassOf } from './size-class';\n\nexport class FoldableWeb extends WebPlugin implements FoldablePlugin {\n private sizeClass = sizeClassOf(window.innerWidth, window.innerHeight);\n\n constructor() {\n super();\n window.addEventListener('resize', () => {\n const next = sizeClassOf(window.innerWidth, window.innerHeight);\n if (JSON.stringify(next) === JSON.stringify(this.sizeClass)) return;\n\n this.sizeClass = next;\n this.notifyListeners('sizeClassChange', next);\n });\n }\n\n async isDeviceFoldable(): Promise<{ foldable: boolean; supportsTabletop: boolean }> {\n return { foldable: false, supportsTabletop: false };\n }\n\n async getFoldState(): Promise<FoldState> {\n return { state: 'flat', isSeparating: false, posture: 'flat' };\n }\n\n async setVerticalBarBehavior(): Promise<{ applied: boolean }> {\n return { applied: false };\n }\n\n async getReservedRegions(): Promise<{ regions: [] }> {\n return { regions: [] };\n }\n\n async getHingeAngle(): Promise<{ angle: number | null; status: null }> {\n return { angle: null, status: null };\n }\n\n async getSizeClass(): Promise<SizeClass> {\n return sizeClassOf(window.innerWidth, window.innerHeight);\n }\n\n async getDisplayModes(): Promise<DisplayModes> {\n return { rearDisplay: 'unsupported', dualScreen: 'unsupported' };\n }\n\n async getBarPlacement(): Promise<BarPlacement> {\n return { verticalBarEdge: null };\n }\n\n async startRearDisplay(): Promise<void> {\n throw this.unavailable('Rear display mode is only available on Android.');\n }\n\n stopRearDisplay(): Promise<void> {\n return Promise.resolve();\n }\n\n async startDualScreen(): Promise<void> {\n throw this.unavailable('Dual-screen mode is only available on Android.');\n }\n\n stopDualScreen(): Promise<void> {\n return Promise.resolve();\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -10,16 +10,30 @@ const CSS_CLASSES = [
|
|
|
10
10
|
];
|
|
11
11
|
const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];
|
|
12
12
|
const FOLD_CLASSES = ['fold-vertical', 'fold-horizontal'];
|
|
13
|
-
const FOLD_VARIABLES = [
|
|
14
|
-
|
|
13
|
+
const FOLD_VARIABLES = [
|
|
14
|
+
'--fold-left',
|
|
15
|
+
'--fold-top',
|
|
16
|
+
'--fold-width',
|
|
17
|
+
'--fold-height',
|
|
18
|
+
'--fold-margin-top',
|
|
19
|
+
'--fold-margin-right',
|
|
20
|
+
'--fold-margin-bottom',
|
|
21
|
+
'--fold-margin-left',
|
|
22
|
+
];
|
|
23
|
+
function foldCssFor(hingeBounds, hingeOrientation, hingeMargins) {
|
|
15
24
|
if (!hingeBounds || !hingeOrientation)
|
|
16
25
|
return { variables: {}, className: null };
|
|
26
|
+
const margins = hingeMargins !== null && hingeMargins !== void 0 ? hingeMargins : { top: 0, right: 0, bottom: 0, left: 0 };
|
|
17
27
|
return {
|
|
18
28
|
variables: {
|
|
19
29
|
'--fold-left': `${hingeBounds.x}px`,
|
|
20
30
|
'--fold-top': `${hingeBounds.y}px`,
|
|
21
31
|
'--fold-width': `${hingeBounds.width}px`,
|
|
22
32
|
'--fold-height': `${hingeBounds.height}px`,
|
|
33
|
+
'--fold-margin-top': `${margins.top}px`,
|
|
34
|
+
'--fold-margin-right': `${margins.right}px`,
|
|
35
|
+
'--fold-margin-bottom': `${margins.bottom}px`,
|
|
36
|
+
'--fold-margin-left': `${margins.left}px`,
|
|
23
37
|
},
|
|
24
38
|
className: `fold-${hingeOrientation}`,
|
|
25
39
|
};
|
|
@@ -155,7 +169,7 @@ async function run(plugin, options) {
|
|
|
155
169
|
root.style.setProperty(name, css.variables[name]);
|
|
156
170
|
for (const name of CSS_CLASSES)
|
|
157
171
|
root.classList.toggle(name, css.classes.includes(name));
|
|
158
|
-
const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation);
|
|
172
|
+
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);
|
|
159
173
|
for (const name of FOLD_VARIABLES) {
|
|
160
174
|
if (foldCss.variables[name])
|
|
161
175
|
root.style.setProperty(name, foldCss.variables[name]);
|
|
@@ -170,12 +184,17 @@ async function run(plugin, options) {
|
|
|
170
184
|
fold = next;
|
|
171
185
|
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(next));
|
|
172
186
|
applyCss();
|
|
187
|
+
// The web view can report the previous window size for a moment after the
|
|
188
|
+
// app moves between displays, so measure again once it has settled.
|
|
189
|
+
requestAnimationFrame(applyCss);
|
|
190
|
+
setTimeout(applyCss, 300);
|
|
173
191
|
};
|
|
174
192
|
const applyBars = ({ verticalBarEdge }) => {
|
|
175
193
|
const active = barClassFor(verticalBarEdge);
|
|
176
194
|
for (const name of BAR_CLASSES)
|
|
177
195
|
root.classList.toggle(name, name === active);
|
|
178
196
|
};
|
|
197
|
+
await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));
|
|
179
198
|
window.addEventListener('resize', applyCss);
|
|
180
199
|
await plugin.addListener('foldStateChange', apply);
|
|
181
200
|
await plugin.addListener('barPlacementChange', applyBars);
|
|
@@ -239,8 +258,14 @@ class FoldableWeb extends core.WebPlugin {
|
|
|
239
258
|
async getFoldState() {
|
|
240
259
|
return { state: 'flat', isSeparating: false, posture: 'flat' };
|
|
241
260
|
}
|
|
261
|
+
async setVerticalBarBehavior() {
|
|
262
|
+
return { applied: false };
|
|
263
|
+
}
|
|
264
|
+
async getReservedRegions() {
|
|
265
|
+
return { regions: [] };
|
|
266
|
+
}
|
|
242
267
|
async getHingeAngle() {
|
|
243
|
-
return { angle: null };
|
|
268
|
+
return { angle: null, status: null };
|
|
244
269
|
}
|
|
245
270
|
async getSizeClass() {
|
|
246
271
|
return sizeClassOf(window.innerWidth, window.innerHeight);
|
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 = ['--fold-left', '--fold-top', '--fold-width', '--fold-height'];\nexport function foldCssFor(hingeBounds, hingeOrientation) {\n if (!hingeBounds || !hingeOrientation)\n return { variables: {}, className: null };\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 },\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);\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 };\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 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 getHingeAngle() {\n return { angle: 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 };\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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;;;;;;;"}
|
|
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 };\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,mBAAmB;AACvB,IAAI,qBAAqB;AACzB,IAAI,sBAAsB;AAC1B,IAAI,oBAAoB;AACxB,CAAC;AACM,SAAS,UAAU,CAAC,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE;AACxE,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,gBAAgB;AACzC,QAAQ,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;AACjD,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,CAAC,EAAE;AAC9H,IAAI,OAAO;AACX,QAAQ,SAAS,EAAE;AACnB,YAAY,aAAa,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/C,YAAY,YAAY,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9C,YAAY,cAAc,EAAE,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,EA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;AAChC,IAAI;AACJ;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -9,16 +9,30 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
9
9
|
];
|
|
10
10
|
const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];
|
|
11
11
|
const FOLD_CLASSES = ['fold-vertical', 'fold-horizontal'];
|
|
12
|
-
const FOLD_VARIABLES = [
|
|
13
|
-
|
|
12
|
+
const FOLD_VARIABLES = [
|
|
13
|
+
'--fold-left',
|
|
14
|
+
'--fold-top',
|
|
15
|
+
'--fold-width',
|
|
16
|
+
'--fold-height',
|
|
17
|
+
'--fold-margin-top',
|
|
18
|
+
'--fold-margin-right',
|
|
19
|
+
'--fold-margin-bottom',
|
|
20
|
+
'--fold-margin-left',
|
|
21
|
+
];
|
|
22
|
+
function foldCssFor(hingeBounds, hingeOrientation, hingeMargins) {
|
|
14
23
|
if (!hingeBounds || !hingeOrientation)
|
|
15
24
|
return { variables: {}, className: null };
|
|
25
|
+
const margins = hingeMargins !== null && hingeMargins !== void 0 ? hingeMargins : { top: 0, right: 0, bottom: 0, left: 0 };
|
|
16
26
|
return {
|
|
17
27
|
variables: {
|
|
18
28
|
'--fold-left': `${hingeBounds.x}px`,
|
|
19
29
|
'--fold-top': `${hingeBounds.y}px`,
|
|
20
30
|
'--fold-width': `${hingeBounds.width}px`,
|
|
21
31
|
'--fold-height': `${hingeBounds.height}px`,
|
|
32
|
+
'--fold-margin-top': `${margins.top}px`,
|
|
33
|
+
'--fold-margin-right': `${margins.right}px`,
|
|
34
|
+
'--fold-margin-bottom': `${margins.bottom}px`,
|
|
35
|
+
'--fold-margin-left': `${margins.left}px`,
|
|
22
36
|
},
|
|
23
37
|
className: `fold-${hingeOrientation}`,
|
|
24
38
|
};
|
|
@@ -154,7 +168,7 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
154
168
|
root.style.setProperty(name, css.variables[name]);
|
|
155
169
|
for (const name of CSS_CLASSES)
|
|
156
170
|
root.classList.toggle(name, css.classes.includes(name));
|
|
157
|
-
const foldCss = foldCssFor(fold === null || fold === void 0 ? void 0 : fold.hingeBounds, fold === null || fold === void 0 ? void 0 : fold.hingeOrientation);
|
|
171
|
+
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);
|
|
158
172
|
for (const name of FOLD_VARIABLES) {
|
|
159
173
|
if (foldCss.variables[name])
|
|
160
174
|
root.style.setProperty(name, foldCss.variables[name]);
|
|
@@ -169,12 +183,17 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
169
183
|
fold = next;
|
|
170
184
|
posture === null || posture === void 0 ? void 0 : posture.update(postureOf(next));
|
|
171
185
|
applyCss();
|
|
186
|
+
// The web view can report the previous window size for a moment after the
|
|
187
|
+
// app moves between displays, so measure again once it has settled.
|
|
188
|
+
requestAnimationFrame(applyCss);
|
|
189
|
+
setTimeout(applyCss, 300);
|
|
172
190
|
};
|
|
173
191
|
const applyBars = ({ verticalBarEdge }) => {
|
|
174
192
|
const active = barClassFor(verticalBarEdge);
|
|
175
193
|
for (const name of BAR_CLASSES)
|
|
176
194
|
root.classList.toggle(name, name === active);
|
|
177
195
|
};
|
|
196
|
+
await plugin.addListener('foldingChange', ({ folding }) => root.classList.toggle('folding', folding));
|
|
178
197
|
window.addEventListener('resize', applyCss);
|
|
179
198
|
await plugin.addListener('foldStateChange', apply);
|
|
180
199
|
await plugin.addListener('barPlacementChange', applyBars);
|
|
@@ -238,8 +257,14 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
238
257
|
async getFoldState() {
|
|
239
258
|
return { state: 'flat', isSeparating: false, posture: 'flat' };
|
|
240
259
|
}
|
|
260
|
+
async setVerticalBarBehavior() {
|
|
261
|
+
return { applied: false };
|
|
262
|
+
}
|
|
263
|
+
async getReservedRegions() {
|
|
264
|
+
return { regions: [] };
|
|
265
|
+
}
|
|
241
266
|
async getHingeAngle() {
|
|
242
|
-
return { angle: null };
|
|
267
|
+
return { angle: null, status: null };
|
|
243
268
|
}
|
|
244
269
|
async getSizeClass() {
|
|
245
270
|
return sizeClassOf(window.innerWidth, window.innerHeight);
|