@erkamyaman/capacitor-foldable 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/esm/css.d.ts +1 -0
- package/dist/esm/css.js +9 -0
- package/dist/esm/css.js.map +1 -1
- package/dist/esm/definitions.d.ts +15 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/keyboard.d.ts +9 -0
- package/dist/esm/keyboard.js +16 -0
- package/dist/esm/keyboard.js.map +1 -0
- package/dist/esm/polyfill.d.ts +2 -2
- package/dist/esm/polyfill.js +9 -4
- package/dist/esm/polyfill.js.map +1 -1
- package/dist/plugin.cjs.js +33 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +33 -4
- package/dist/plugin.js.map +1 -1
- package/ionic-tabs-ios26.css +54 -0
- package/ionic-tabs.css +86 -0
- package/package.json +16 -4
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Web views already resize with the window, so a responsive layout that pads with
|
|
|
49
49
|
- **How the device is held**: flat, tabletop or book.
|
|
50
50
|
- **The hinge angle**, for effects and interactions.
|
|
51
51
|
- **Outer or inner display**, and Material window size classes.
|
|
52
|
-
- **Where iPhone Duo puts native bars**, so your HTML tab bar can follow.
|
|
52
|
+
- **Where iPhone Duo puts native bars**, so your HTML tab bar can follow. For Ionic's `ion-tabs` there's a ready-made stylesheet, plus a fix for the tab bar disappearing when you fold.
|
|
53
53
|
- **The outer display on Android foldables**: rear display and dual screen.
|
|
54
54
|
|
|
55
55
|
## Installation
|
|
@@ -96,6 +96,8 @@ window.viewport.segments; // two DOMRects when the fold splits the web view
|
|
|
96
96
|
| `env(viewport-segment-width 0 0)` | `var(--viewport-segment-width-0-0)` |
|
|
97
97
|
| Native bars moved to the side (iPhone Duo) | `.vertical-bars-leading`, `.vertical-bars-trailing` |
|
|
98
98
|
|
|
99
|
+
Using Ionic's `ion-tabs`? `import '@erkamyaman/capacitor-foldable/ionic-tabs.css'` moves it to the side the way native tab bars do on iPhone Duo. See [Ionic tabs](docs/iphone-duo.md#ionic-tabs).
|
|
100
|
+
|
|
99
101
|
## Guides
|
|
100
102
|
|
|
101
103
|
- [Examples](docs/examples.md)
|
package/dist/esm/css.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SegmentRect } from './segments';
|
|
|
2
2
|
export declare const CSS_CLASSES: string[];
|
|
3
3
|
export declare const BAR_CLASSES: string[];
|
|
4
4
|
export declare function barClassFor(edge: 'leading' | 'trailing' | null): string | null;
|
|
5
|
+
export declare function verticalTabBarBottom(cameras: SegmentRect[], viewportHeight: number): number;
|
|
5
6
|
export declare function cssFor(segments: SegmentRect[], posture: 'continuous' | 'folded'): {
|
|
6
7
|
variables: Record<string, string>;
|
|
7
8
|
classes: string[];
|
package/dist/esm/css.js
CHANGED
|
@@ -8,6 +8,15 @@ export const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];
|
|
|
8
8
|
export function barClassFor(edge) {
|
|
9
9
|
return edge ? `vertical-bars-${edge}` : null;
|
|
10
10
|
}
|
|
11
|
+
const TAB_BAR_MARGIN = 24;
|
|
12
|
+
const CAMERA_GAP = 15;
|
|
13
|
+
export function verticalTabBarBottom(cameras, viewportHeight) {
|
|
14
|
+
const below = cameras.filter((camera) => camera.y > viewportHeight / 2);
|
|
15
|
+
const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];
|
|
16
|
+
if (!camera)
|
|
17
|
+
return TAB_BAR_MARGIN;
|
|
18
|
+
return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));
|
|
19
|
+
}
|
|
11
20
|
export function cssFor(segments, posture) {
|
|
12
21
|
const stacked = segments.length > 1 && segments[1].y > segments[0].y;
|
|
13
22
|
const variables = {};
|
package/dist/esm/css.js.map
CHANGED
|
@@ -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4BAA4B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC;QACvE,SAAS,CAAC,6BAA6B,MAAM,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;IAC9C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import type { SegmentRect } from './segments';\n\nexport const CSS_CLASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\n\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\n\nexport function barClassFor(edge: 'leading' | 'trailing' | null): string | null {\n return edge ? `vertical-bars-${edge}` : null;\n}\n\nexport function cssFor(\n segments: SegmentRect[],\n posture: 'continuous' | 'folded',\n): { variables: Record<string, string>; classes: string[] } {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables: Record<string, string> = {};\n\n segments.forEach((segment, index) => {\n const suffix = stacked ? `0-${index}` : `${index}-0`;\n variables[`--viewport-segment-top-${suffix}`] = `${segment.y}px`;\n variables[`--viewport-segment-left-${suffix}`] = `${segment.x}px`;\n variables[`--viewport-segment-bottom-${suffix}`] = `${segment.y + segment.height}px`;\n variables[`--viewport-segment-right-${suffix}`] = `${segment.x + segment.width}px`;\n variables[`--viewport-segment-width-${suffix}`] = `${segment.width}px`;\n variables[`--viewport-segment-height-${suffix}`] = `${segment.height}px`;\n });\n\n const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n\n return { variables, classes };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/css.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,gCAAgC;IAChC,8BAA8B;IAC9B,2BAA2B;IAC3B,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC;AAE/E,MAAM,UAAU,WAAW,CAAC,IAAmC;IAC7D,OAAO,IAAI,CAAC,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,UAAU,oBAAoB,CAAC,OAAsB,EAAE,cAAsB;IACjF,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,IAAI,CAAC,MAAM;QAAE,OAAO,cAAc,CAAC;IACnC,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,QAAuB,EACvB,OAAgC;IAEhC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,IAA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ASSES = [\n 'horizontal-viewport-segments-2',\n 'vertical-viewport-segments-2',\n 'device-posture-continuous',\n 'device-posture-folded',\n];\n\nexport const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];\n\nexport function barClassFor(edge: 'leading' | 'trailing' | null): string | null {\n return edge ? `vertical-bars-${edge}` : null;\n}\n\nconst TAB_BAR_MARGIN = 24;\nconst CAMERA_GAP = 15;\n\nexport function verticalTabBarBottom(cameras: SegmentRect[], viewportHeight: number): number {\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) return TAB_BAR_MARGIN;\n return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));\n}\n\nexport function cssFor(\n segments: SegmentRect[],\n posture: 'continuous' | 'folded',\n): { variables: Record<string, string>; classes: string[] } {\n const stacked = segments.length > 1 && segments[1].y > segments[0].y;\n const variables: Record<string, string> = {};\n\n segments.forEach((segment, index) => {\n const suffix = stacked ? `0-${index}` : `${index}-0`;\n variables[`--viewport-segment-top-${suffix}`] = `${segment.y}px`;\n variables[`--viewport-segment-left-${suffix}`] = `${segment.x}px`;\n variables[`--viewport-segment-bottom-${suffix}`] = `${segment.y + segment.height}px`;\n variables[`--viewport-segment-right-${suffix}`] = `${segment.x + segment.width}px`;\n variables[`--viewport-segment-width-${suffix}`] = `${segment.width}px`;\n variables[`--viewport-segment-height-${suffix}`] = `${segment.height}px`;\n });\n\n const classes = [`device-posture-${posture}`];\n if (segments.length > 1) {\n classes.push(stacked ? 'vertical-viewport-segments-2' : 'horizontal-viewport-segments-2');\n }\n\n return { variables, classes };\n}\n"]}
|
|
@@ -136,6 +136,21 @@ export interface BarPlacement {
|
|
|
136
136
|
*/
|
|
137
137
|
verticalBarEdge: 'leading' | 'trailing' | null;
|
|
138
138
|
}
|
|
139
|
+
export interface FoldablePolyfillOptions {
|
|
140
|
+
/**
|
|
141
|
+
* Take over hiding Ionic's tab bar while the keyboard is open. iPhone Duo
|
|
142
|
+
* reports a keyboard on every fold, and Ionic waits for the window to return
|
|
143
|
+
* to the height it had when the keyboard first opened, so its tab bar can
|
|
144
|
+
* disappear until the device is folded back. With this on, the keyboard events
|
|
145
|
+
* never reach Ionic, and a `foldable-keyboard-open` class on `<html>` marks
|
|
146
|
+
* when a text field really has the keyboard. `ionic-tabs.css` hides the tab
|
|
147
|
+
* bar with it.
|
|
148
|
+
*
|
|
149
|
+
* @default false
|
|
150
|
+
* @since 8.0.2
|
|
151
|
+
*/
|
|
152
|
+
ionicKeyboard?: boolean;
|
|
153
|
+
}
|
|
139
154
|
export interface FoldablePlugin {
|
|
140
155
|
/**
|
|
141
156
|
* Whether the device has a fold at all, and whether it can be propped half
|
|
@@ -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 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 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"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FoldablePlugin } from './definitions';
|
|
1
|
+
import type { FoldablePlugin, FoldablePolyfillOptions } from './definitions';
|
|
2
2
|
declare const Foldable: FoldablePlugin;
|
|
3
|
-
declare const installFoldablePolyfill: () => Promise<void>;
|
|
3
|
+
declare const installFoldablePolyfill: (options?: FoldablePolyfillOptions) => Promise<void>;
|
|
4
4
|
export * from './definitions';
|
|
5
5
|
export { Foldable, installFoldablePolyfill };
|
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { install } from './polyfill';
|
|
|
3
3
|
const Foldable = registerPlugin('Foldable', {
|
|
4
4
|
web: () => import('./web').then((m) => new m.FoldableWeb()),
|
|
5
5
|
});
|
|
6
|
-
const installFoldablePolyfill = () => install(Foldable);
|
|
6
|
+
const installFoldablePolyfill = (options) => install(Foldable, options);
|
|
7
7
|
export * from './definitions';
|
|
8
8
|
export { Foldable, installFoldablePolyfill };
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,QAAQ,GAAG,cAAc,CAAiB,UAAU,EAAE;IAC1D,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,QAAQ,GAAG,cAAc,CAAiB,UAAU,EAAE;IAC1D,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,OAAiC,EAAiB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEjH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { FoldablePlugin, FoldablePolyfillOptions } from './definitions';\nimport { install } from './polyfill';\n\nconst Foldable = registerPlugin<FoldablePlugin>('Foldable', {\n web: () => import('./web').then((m) => new m.FoldableWeb()),\n});\n\nconst installFoldablePolyfill = (options?: FoldablePolyfillOptions): Promise<void> => install(Foldable, options);\n\nexport * from './definitions';\nexport { Foldable, installFoldablePolyfill };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const KEYBOARD_CLASS = "foldable-keyboard-open";
|
|
2
|
+
interface KeyboardDocument {
|
|
3
|
+
readonly activeElement: Element | null;
|
|
4
|
+
readonly documentElement: {
|
|
5
|
+
readonly classList: DOMTokenList;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare function takeOverKeyboard(target: EventTarget, doc: KeyboardDocument): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const KEYBOARD_CLASS = 'foldable-keyboard-open';
|
|
2
|
+
const SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];
|
|
3
|
+
const isEditing = (element) => !!element &&
|
|
4
|
+
(element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));
|
|
5
|
+
export function takeOverKeyboard(target, doc) {
|
|
6
|
+
const classes = doc.documentElement.classList;
|
|
7
|
+
for (const name of SHOW_EVENTS) {
|
|
8
|
+
target.addEventListener(name, (event) => {
|
|
9
|
+
event.stopImmediatePropagation();
|
|
10
|
+
if (isEditing(doc.activeElement))
|
|
11
|
+
classes.add(KEYBOARD_CLASS);
|
|
12
|
+
}, true);
|
|
13
|
+
}
|
|
14
|
+
target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=keyboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../src/keyboard.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD,MAAM,WAAW,GAAG,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;AAOlF,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAW,EAAE,CACrD,CAAC,CAAC,OAAO;IACT,CAAE,OAAuB,CAAC,iBAAiB,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAE5G,MAAM,UAAU,gBAAgB,CAAC,MAAmB,EAAE,GAAqB;IACzE,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC;IAE9C,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,CAAC,gBAAgB,CACrB,IAAI,EACJ,CAAC,KAAK,EAAE,EAAE;YACR,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,IAAI,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAChE,CAAC,EACD,IAAI,CACL,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["export const KEYBOARD_CLASS = 'foldable-keyboard-open';\n\nconst SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];\n\ninterface KeyboardDocument {\n readonly activeElement: Element | null;\n readonly documentElement: { readonly classList: DOMTokenList };\n}\n\nconst isEditing = (element: Element | null): boolean =>\n !!element &&\n ((element as HTMLElement).isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));\n\nexport function takeOverKeyboard(target: EventTarget, doc: KeyboardDocument): void {\n const classes = doc.documentElement.classList;\n\n for (const name of SHOW_EVENTS) {\n target.addEventListener(\n name,\n (event) => {\n event.stopImmediatePropagation();\n if (isEditing(doc.activeElement)) classes.add(KEYBOARD_CLASS);\n },\n true,\n );\n }\n\n target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);\n}\n"]}
|
package/dist/esm/polyfill.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FoldablePlugin } from './definitions';
|
|
1
|
+
import type { FoldablePlugin, FoldablePolyfillOptions } from './definitions';
|
|
2
2
|
type DevicePostureType = 'continuous' | 'folded';
|
|
3
3
|
declare global {
|
|
4
4
|
interface DevicePosture extends EventTarget {
|
|
@@ -15,5 +15,5 @@ declare global {
|
|
|
15
15
|
readonly viewport: Viewport;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export declare function install(plugin: FoldablePlugin): Promise<void>;
|
|
18
|
+
export declare function install(plugin: FoldablePlugin, options?: FoldablePolyfillOptions): Promise<void>;
|
|
19
19
|
export {};
|
package/dist/esm/polyfill.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Capacitor } from '@capacitor/core';
|
|
2
|
-
import { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor } from './css';
|
|
2
|
+
import { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor, verticalTabBarBottom } from './css';
|
|
3
|
+
import { takeOverKeyboard } from './keyboard';
|
|
3
4
|
import { splitViewport } from './segments';
|
|
4
5
|
class DevicePosturePolyfill extends EventTarget {
|
|
5
6
|
constructor() {
|
|
@@ -22,13 +23,15 @@ class DevicePosturePolyfill extends EventTarget {
|
|
|
22
23
|
}
|
|
23
24
|
const postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';
|
|
24
25
|
let installation = null;
|
|
25
|
-
export function install(plugin) {
|
|
26
|
+
export function install(plugin, options = {}) {
|
|
26
27
|
if (!Capacitor.isNativePlatform())
|
|
27
28
|
return Promise.resolve();
|
|
28
|
-
installation !== null && installation !== void 0 ? installation : (installation = run(plugin));
|
|
29
|
+
installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));
|
|
29
30
|
return installation;
|
|
30
31
|
}
|
|
31
|
-
async function run(plugin) {
|
|
32
|
+
async function run(plugin, options) {
|
|
33
|
+
if (options.ionicKeyboard)
|
|
34
|
+
takeOverKeyboard(window, document);
|
|
32
35
|
let fold = null;
|
|
33
36
|
const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);
|
|
34
37
|
if (!('Viewport' in window)) {
|
|
@@ -48,6 +51,7 @@ async function run(plugin) {
|
|
|
48
51
|
const root = document.documentElement;
|
|
49
52
|
let variables = [];
|
|
50
53
|
const applyCss = () => {
|
|
54
|
+
var _a;
|
|
51
55
|
const css = cssFor(currentSegments(), postureOf(fold));
|
|
52
56
|
for (const name of variables)
|
|
53
57
|
root.style.removeProperty(name);
|
|
@@ -56,6 +60,7 @@ async function run(plugin) {
|
|
|
56
60
|
root.style.setProperty(name, css.variables[name]);
|
|
57
61
|
for (const name of CSS_CLASSES)
|
|
58
62
|
root.classList.toggle(name, css.classes.includes(name));
|
|
63
|
+
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`);
|
|
59
64
|
};
|
|
60
65
|
const apply = (next) => {
|
|
61
66
|
fold = next;
|
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,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAuB3C,MAAM,qBAAsB,SAAQ,WAAW;IAA/C;;QACE,aAAQ,GAA4D,IAAI,CAAC;QAEjE,YAAO,GAAsB,YAAY,CAAC;IAcpD,CAAC;IAZC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,IAAuB;;QAC5B,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO;YAAE,OAAO;QAElC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,aA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AG,CAAC,IAAe,EAAE,EAAE;QAChC,IAAI,GAAG,IAAI,CAAC;QACZ,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACjC,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,EAAE,eAAe,EAAgB,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;QAC5C,KAAK,MAAM,IAAI,IAAI,WAAW;YAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC;IAC/E,CAAC,CAAC;IAEF,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 { BAR_CLASSES, barClassFor, CSS_CLASSES, cssFor, verticalTabBarBottom } 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 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\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 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/plugin.cjs.js
CHANGED
|
@@ -12,6 +12,15 @@ const BAR_CLASSES = ['vertical-bars-leading', 'vertical-bars-trailing'];
|
|
|
12
12
|
function barClassFor(edge) {
|
|
13
13
|
return edge ? `vertical-bars-${edge}` : null;
|
|
14
14
|
}
|
|
15
|
+
const TAB_BAR_MARGIN = 24;
|
|
16
|
+
const CAMERA_GAP = 15;
|
|
17
|
+
function verticalTabBarBottom(cameras, viewportHeight) {
|
|
18
|
+
const below = cameras.filter((camera) => camera.y > viewportHeight / 2);
|
|
19
|
+
const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];
|
|
20
|
+
if (!camera)
|
|
21
|
+
return TAB_BAR_MARGIN;
|
|
22
|
+
return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));
|
|
23
|
+
}
|
|
15
24
|
function cssFor(segments, posture) {
|
|
16
25
|
const stacked = segments.length > 1 && segments[1].y > segments[0].y;
|
|
17
26
|
const variables = {};
|
|
@@ -31,6 +40,22 @@ function cssFor(segments, posture) {
|
|
|
31
40
|
return { variables, classes };
|
|
32
41
|
}
|
|
33
42
|
|
|
43
|
+
const KEYBOARD_CLASS = 'foldable-keyboard-open';
|
|
44
|
+
const SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];
|
|
45
|
+
const isEditing = (element) => !!element &&
|
|
46
|
+
(element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));
|
|
47
|
+
function takeOverKeyboard(target, doc) {
|
|
48
|
+
const classes = doc.documentElement.classList;
|
|
49
|
+
for (const name of SHOW_EVENTS) {
|
|
50
|
+
target.addEventListener(name, (event) => {
|
|
51
|
+
event.stopImmediatePropagation();
|
|
52
|
+
if (isEditing(doc.activeElement))
|
|
53
|
+
classes.add(KEYBOARD_CLASS);
|
|
54
|
+
}, true);
|
|
55
|
+
}
|
|
56
|
+
target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);
|
|
57
|
+
}
|
|
58
|
+
|
|
34
59
|
const EDGE_TOLERANCE = 1;
|
|
35
60
|
function splitViewport(fold, width, height) {
|
|
36
61
|
const whole = [{ x: 0, y: 0, width, height }];
|
|
@@ -78,13 +103,15 @@ class DevicePosturePolyfill extends EventTarget {
|
|
|
78
103
|
}
|
|
79
104
|
const postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';
|
|
80
105
|
let installation = null;
|
|
81
|
-
function install(plugin) {
|
|
106
|
+
function install(plugin, options = {}) {
|
|
82
107
|
if (!core.Capacitor.isNativePlatform())
|
|
83
108
|
return Promise.resolve();
|
|
84
|
-
installation !== null && installation !== void 0 ? installation : (installation = run(plugin));
|
|
109
|
+
installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));
|
|
85
110
|
return installation;
|
|
86
111
|
}
|
|
87
|
-
async function run(plugin) {
|
|
112
|
+
async function run(plugin, options) {
|
|
113
|
+
if (options.ionicKeyboard)
|
|
114
|
+
takeOverKeyboard(window, document);
|
|
88
115
|
let fold = null;
|
|
89
116
|
const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);
|
|
90
117
|
if (!('Viewport' in window)) {
|
|
@@ -104,6 +131,7 @@ async function run(plugin) {
|
|
|
104
131
|
const root = document.documentElement;
|
|
105
132
|
let variables = [];
|
|
106
133
|
const applyCss = () => {
|
|
134
|
+
var _a;
|
|
107
135
|
const css = cssFor(currentSegments(), postureOf(fold));
|
|
108
136
|
for (const name of variables)
|
|
109
137
|
root.style.removeProperty(name);
|
|
@@ -112,6 +140,7 @@ async function run(plugin) {
|
|
|
112
140
|
root.style.setProperty(name, css.variables[name]);
|
|
113
141
|
for (const name of CSS_CLASSES)
|
|
114
142
|
root.classList.toggle(name, css.classes.includes(name));
|
|
143
|
+
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`);
|
|
115
144
|
};
|
|
116
145
|
const apply = (next) => {
|
|
117
146
|
fold = next;
|
|
@@ -133,7 +162,7 @@ async function run(plugin) {
|
|
|
133
162
|
const Foldable = core.registerPlugin('Foldable', {
|
|
134
163
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.FoldableWeb()),
|
|
135
164
|
});
|
|
136
|
-
const installFoldablePolyfill = () => install(Foldable);
|
|
165
|
+
const installFoldablePolyfill = (options) => install(Foldable, options);
|
|
137
166
|
|
|
138
167
|
const MEDIUM_WIDTH = 600;
|
|
139
168
|
const EXPANDED_WIDTH = 840;
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/css.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 function barClassFor(edge) {\n return edge ? `vertical-bars-${edge}` : null;\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","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 } from './css';\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) {\n if (!Capacitor.isNativePlatform())\n return Promise.resolve();\n installation !== null && installation !== void 0 ? installation : (installation = run(plugin));\n return installation;\n}\nasync function run(plugin) {\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 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 };\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 = () => install(Foldable);\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() {\n return Promise.resolve();\n }\n}\n//# sourceMappingURL=web.js.map"],"names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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 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, 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 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() {\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,SAAS,WAAW,CAAC,IAAI,EAAE;AAClC,IAAI,OAAO,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI;AAChD;AACA,MAAM,cAAc,GAAG,EAAE;AACzB,MAAM,UAAU,GAAG,EAAE;AACd,SAAS,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE;AAC9D,IAAI,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,GAAG,cAAc,GAAG,CAAC,CAAC;AAC3E,IAAI,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC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C,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;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -11,6 +11,15 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
11
11
|
function barClassFor(edge) {
|
|
12
12
|
return edge ? `vertical-bars-${edge}` : null;
|
|
13
13
|
}
|
|
14
|
+
const TAB_BAR_MARGIN = 24;
|
|
15
|
+
const CAMERA_GAP = 15;
|
|
16
|
+
function verticalTabBarBottom(cameras, viewportHeight) {
|
|
17
|
+
const below = cameras.filter((camera) => camera.y > viewportHeight / 2);
|
|
18
|
+
const camera = below.sort((a, b) => a.width * a.height - b.width * b.height)[0];
|
|
19
|
+
if (!camera)
|
|
20
|
+
return TAB_BAR_MARGIN;
|
|
21
|
+
return Math.max(TAB_BAR_MARGIN, Math.round(viewportHeight - camera.y + CAMERA_GAP));
|
|
22
|
+
}
|
|
14
23
|
function cssFor(segments, posture) {
|
|
15
24
|
const stacked = segments.length > 1 && segments[1].y > segments[0].y;
|
|
16
25
|
const variables = {};
|
|
@@ -30,6 +39,22 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
30
39
|
return { variables, classes };
|
|
31
40
|
}
|
|
32
41
|
|
|
42
|
+
const KEYBOARD_CLASS = 'foldable-keyboard-open';
|
|
43
|
+
const SHOW_EVENTS = ['keyboardWillShow', 'keyboardDidShow', 'ionKeyboardDidShow'];
|
|
44
|
+
const isEditing = (element) => !!element &&
|
|
45
|
+
(element.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName));
|
|
46
|
+
function takeOverKeyboard(target, doc) {
|
|
47
|
+
const classes = doc.documentElement.classList;
|
|
48
|
+
for (const name of SHOW_EVENTS) {
|
|
49
|
+
target.addEventListener(name, (event) => {
|
|
50
|
+
event.stopImmediatePropagation();
|
|
51
|
+
if (isEditing(doc.activeElement))
|
|
52
|
+
classes.add(KEYBOARD_CLASS);
|
|
53
|
+
}, true);
|
|
54
|
+
}
|
|
55
|
+
target.addEventListener('keyboardWillHide', () => classes.remove(KEYBOARD_CLASS), true);
|
|
56
|
+
}
|
|
57
|
+
|
|
33
58
|
const EDGE_TOLERANCE = 1;
|
|
34
59
|
function splitViewport(fold, width, height) {
|
|
35
60
|
const whole = [{ x: 0, y: 0, width, height }];
|
|
@@ -77,13 +102,15 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
77
102
|
}
|
|
78
103
|
const postureOf = (fold) => (fold === null || fold === void 0 ? void 0 : fold.state) === 'half-opened' ? 'folded' : 'continuous';
|
|
79
104
|
let installation = null;
|
|
80
|
-
function install(plugin) {
|
|
105
|
+
function install(plugin, options = {}) {
|
|
81
106
|
if (!core.Capacitor.isNativePlatform())
|
|
82
107
|
return Promise.resolve();
|
|
83
|
-
installation !== null && installation !== void 0 ? installation : (installation = run(plugin));
|
|
108
|
+
installation !== null && installation !== void 0 ? installation : (installation = run(plugin, options));
|
|
84
109
|
return installation;
|
|
85
110
|
}
|
|
86
|
-
async function run(plugin) {
|
|
111
|
+
async function run(plugin, options) {
|
|
112
|
+
if (options.ionicKeyboard)
|
|
113
|
+
takeOverKeyboard(window, document);
|
|
87
114
|
let fold = null;
|
|
88
115
|
const currentSegments = () => splitViewport(fold, window.innerWidth, window.innerHeight);
|
|
89
116
|
if (!('Viewport' in window)) {
|
|
@@ -103,6 +130,7 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
103
130
|
const root = document.documentElement;
|
|
104
131
|
let variables = [];
|
|
105
132
|
const applyCss = () => {
|
|
133
|
+
var _a;
|
|
106
134
|
const css = cssFor(currentSegments(), postureOf(fold));
|
|
107
135
|
for (const name of variables)
|
|
108
136
|
root.style.removeProperty(name);
|
|
@@ -111,6 +139,7 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
111
139
|
root.style.setProperty(name, css.variables[name]);
|
|
112
140
|
for (const name of CSS_CLASSES)
|
|
113
141
|
root.classList.toggle(name, css.classes.includes(name));
|
|
142
|
+
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`);
|
|
114
143
|
};
|
|
115
144
|
const apply = (next) => {
|
|
116
145
|
fold = next;
|
|
@@ -132,7 +161,7 @@ var capacitorFoldable = (function (exports, core) {
|
|
|
132
161
|
const Foldable = core.registerPlugin('Foldable', {
|
|
133
162
|
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.FoldableWeb()),
|
|
134
163
|
});
|
|
135
|
-
const installFoldablePolyfill = () => install(Foldable);
|
|
164
|
+
const installFoldablePolyfill = (options) => install(Foldable, options);
|
|
136
165
|
|
|
137
166
|
const MEDIUM_WIDTH = 600;
|
|
138
167
|
const EXPANDED_WIDTH = 840;
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/css.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 function barClassFor(edge) {\n return edge ? `vertical-bars-${edge}` : null;\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","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 } from './css';\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) {\n if (!Capacitor.isNativePlatform())\n return Promise.resolve();\n installation !== null && installation !== void 0 ? installation : (installation = run(plugin));\n return installation;\n}\nasync function run(plugin) {\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 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 };\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 = () => install(Foldable);\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() {\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,SAAS,WAAW,CAAC,IAAI,EAAE;IAClC,IAAI,OAAO,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI;IAChD;IACO,SAAS,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE;IAC1C,IAAI,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,IAAI,MAAM,SAAS,GAAG,EAAE;IACxB,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,KAAK;IACzC,QAAQ,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5D,QAAQ,SAAS,CAAC,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,QAAQ,SAAS,CAAC,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,QAAQ,SAAS,CAAC,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Aa,EAAE,UAAU,EAAE,aAAa,EAAE;IACxE,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,CAAC,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 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, 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 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() {\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,SAAS,WAAW,CAAC,IAAI,EAAE;IAClC,IAAI,OAAO,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI;IAChD;IACA,MAAM,cAAc,GAAG,EAAE;IACzB,MAAM,UAAU,GAAG,EAAE;IACd,SAAS,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE;IAC9D,IAAI,MA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,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE;IACxE,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE;IACxC,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,CAAC,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;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
html.ios:not(.vertical-bars-leading):not(.vertical-bars-trailing) ion-tab-bar {
|
|
2
|
+
position: absolute;
|
|
3
|
+
bottom: 21px;
|
|
4
|
+
left: 50%;
|
|
5
|
+
z-index: 10;
|
|
6
|
+
width: auto;
|
|
7
|
+
height: 54px;
|
|
8
|
+
padding: 4px;
|
|
9
|
+
border: none;
|
|
10
|
+
border-radius: 31px;
|
|
11
|
+
contain: none;
|
|
12
|
+
transform: translateX(-50%);
|
|
13
|
+
background: rgba(255, 255, 255, 0.78);
|
|
14
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%);
|
|
15
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
16
|
+
box-shadow:
|
|
17
|
+
inset 0 0 0 0.5px rgba(0, 0, 0, 0.2),
|
|
18
|
+
inset 0 0 8px rgba(0, 0, 0, 0.04),
|
|
19
|
+
0 2px 10px rgba(0, 0, 0, 0.05);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
html.ios:not(.vertical-bars-leading):not(.vertical-bars-trailing) ion-tab-button {
|
|
23
|
+
--background: transparent;
|
|
24
|
+
--background-focused: transparent;
|
|
25
|
+
--color: #111;
|
|
26
|
+
--color-selected: #0088ff;
|
|
27
|
+
flex: 0 0 auto;
|
|
28
|
+
width: 88px;
|
|
29
|
+
max-width: none;
|
|
30
|
+
height: 54px;
|
|
31
|
+
border-radius: 27px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
html.ios:not(.vertical-bars-leading):not(.vertical-bars-trailing) ion-tab-button.tab-selected {
|
|
35
|
+
background: rgba(0, 0, 0, 0.08);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-color-scheme: dark) {
|
|
39
|
+
html.ios:not(.vertical-bars-leading):not(.vertical-bars-trailing) ion-tab-bar {
|
|
40
|
+
background: rgba(40, 40, 40, 0.78);
|
|
41
|
+
box-shadow:
|
|
42
|
+
inset 0 0 0 0.5px rgba(255, 255, 255, 0.18),
|
|
43
|
+
inset 0 0 8px rgba(255, 255, 255, 0.04),
|
|
44
|
+
0 2px 10px rgba(0, 0, 0, 0.3);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
html.ios:not(.vertical-bars-leading):not(.vertical-bars-trailing) ion-tab-button {
|
|
48
|
+
--color: #f2f2f2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
html.ios:not(.vertical-bars-leading):not(.vertical-bars-trailing) ion-tab-button.tab-selected {
|
|
52
|
+
background: rgba(255, 255, 255, 0.1);
|
|
53
|
+
}
|
|
54
|
+
}
|
package/ionic-tabs.css
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.vertical-bars-leading ion-tab-bar,
|
|
2
|
+
.vertical-bars-trailing ion-tab-bar {
|
|
3
|
+
position: absolute;
|
|
4
|
+
bottom: var(--vertical-tab-bar-bottom, 24px);
|
|
5
|
+
z-index: 10;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
width: 45px;
|
|
8
|
+
height: auto;
|
|
9
|
+
padding: 3px 2px;
|
|
10
|
+
border: none;
|
|
11
|
+
border-radius: 24.5px;
|
|
12
|
+
contain: none;
|
|
13
|
+
background: rgba(255, 255, 255, 0.78);
|
|
14
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%);
|
|
15
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
16
|
+
box-shadow:
|
|
17
|
+
inset 0 0 0 0.5px rgba(0, 0, 0, 0.2),
|
|
18
|
+
inset 0 0 8px rgba(0, 0, 0, 0.04),
|
|
19
|
+
0 2px 10px rgba(0, 0, 0, 0.05);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.vertical-bars-leading ion-tab-bar {
|
|
23
|
+
left: 24px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vertical-bars-trailing ion-tab-bar {
|
|
27
|
+
right: 24px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vertical-bars-leading ion-tab-button,
|
|
31
|
+
.vertical-bars-trailing ion-tab-button {
|
|
32
|
+
--background: transparent;
|
|
33
|
+
--background-focused: transparent;
|
|
34
|
+
--color: #111;
|
|
35
|
+
--color-selected: #0088ff;
|
|
36
|
+
--padding-start: 0;
|
|
37
|
+
--padding-end: 0;
|
|
38
|
+
flex: 0 0 auto;
|
|
39
|
+
width: 100%;
|
|
40
|
+
max-width: none;
|
|
41
|
+
height: 54px;
|
|
42
|
+
border-radius: 22px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.vertical-bars-leading ion-tab-button ion-label,
|
|
46
|
+
.vertical-bars-trailing ion-tab-button ion-label {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.vertical-bars-leading ion-tab-button.tab-selected,
|
|
51
|
+
.vertical-bars-trailing ion-tab-button.tab-selected {
|
|
52
|
+
background: rgba(0, 0, 0, 0.08);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.vertical-bars-leading ion-content {
|
|
56
|
+
--padding-start: env(safe-area-inset-left);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.vertical-bars-trailing ion-content {
|
|
60
|
+
--padding-end: env(safe-area-inset-right);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.foldable-keyboard-open ion-tab-bar {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (prefers-color-scheme: dark) {
|
|
68
|
+
.vertical-bars-leading ion-tab-bar,
|
|
69
|
+
.vertical-bars-trailing ion-tab-bar {
|
|
70
|
+
background: rgba(40, 40, 40, 0.78);
|
|
71
|
+
box-shadow:
|
|
72
|
+
inset 0 0 0 0.5px rgba(255, 255, 255, 0.18),
|
|
73
|
+
inset 0 0 8px rgba(255, 255, 255, 0.04),
|
|
74
|
+
0 2px 10px rgba(0, 0, 0, 0.3);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.vertical-bars-leading ion-tab-button,
|
|
78
|
+
.vertical-bars-trailing ion-tab-button {
|
|
79
|
+
--color: #f2f2f2;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.vertical-bars-leading ion-tab-button.tab-selected,
|
|
83
|
+
.vertical-bars-trailing ion-tab-button.tab-selected {
|
|
84
|
+
background: rgba(255, 255, 255, 0.1);
|
|
85
|
+
}
|
|
86
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erkamyaman/capacitor-foldable",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Fold-state and dual-display APIs for foldable devices in Capacitor apps",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"unpkg": "dist/plugin.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"ErkamyamanCapacitorFoldable.podspec",
|
|
11
|
+
"ionic-tabs-ios26.css",
|
|
12
|
+
"ionic-tabs.css",
|
|
11
13
|
"LICENSE",
|
|
12
14
|
"Package.swift",
|
|
13
15
|
"android/build.gradle",
|
|
@@ -18,6 +20,10 @@
|
|
|
18
20
|
],
|
|
19
21
|
"author": "Erkam Yaman <erkamyaman35@gmail.com>",
|
|
20
22
|
"license": "MIT",
|
|
23
|
+
"funding": {
|
|
24
|
+
"type": "github",
|
|
25
|
+
"url": "https://github.com/sponsors/erkamyaman"
|
|
26
|
+
},
|
|
21
27
|
"repository": {
|
|
22
28
|
"type": "git",
|
|
23
29
|
"url": "git+https://github.com/erkamyaman/capacitor-foldable.git"
|
|
@@ -27,18 +33,24 @@
|
|
|
27
33
|
},
|
|
28
34
|
"keywords": [
|
|
29
35
|
"capacitor",
|
|
36
|
+
"capacitor-plugin",
|
|
37
|
+
"ionic",
|
|
30
38
|
"plugin",
|
|
31
|
-
"native",
|
|
32
39
|
"foldable",
|
|
33
|
-
"fold",
|
|
34
40
|
"foldables",
|
|
41
|
+
"fold",
|
|
35
42
|
"hinge",
|
|
36
|
-
"dual-screen",
|
|
37
43
|
"posture",
|
|
44
|
+
"device-posture",
|
|
45
|
+
"viewport-segments",
|
|
46
|
+
"polyfill",
|
|
47
|
+
"dual-screen",
|
|
38
48
|
"large-screen",
|
|
39
49
|
"android",
|
|
40
50
|
"ios",
|
|
41
51
|
"pixel-fold",
|
|
52
|
+
"galaxy-fold",
|
|
53
|
+
"jetpack-windowmanager",
|
|
42
54
|
"iphone-duo"
|
|
43
55
|
],
|
|
44
56
|
"scripts": {
|