@foldjs/svelte 0.3.1 โ 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**fold.js is an open-source JavaScript library that makes web apps work properly on foldable phones** such as the Samsung Galaxy Z Fold, Google Pixel Fold, Honor Magic V or Microsoft Surface Duo. It detects the hinge and the device posture (flat, book, tabletop), and gives you two-pane layouts that never put content under the hinge. It works with React, Vue, Svelte, Solid, Angular, Astro or plain HTML, weighs about 2 kB, and ships with a built-in foldable simulator so you can build without owning a device.
|
|
9
9
|
|
|
10
|
-
> ๐ **New study:** [94% of popular websites split a button across a foldable's hinge](https://christophe77.github.io/fold.js/study.html) (
|
|
10
|
+
> ๐ **New study:** [94% of popular websites split a button across a foldable's hinge](https://christophe77.github.io/fold.js/study.html) (77 sites audited on a Galaxy Z Fold, including Google, Amazon and Facebook, plus a run at the leaked iPhone Fold size: 86%).
|
|
11
11
|
|
|
12
12
|
### [โถ Try the live demo](https://christophe77.github.io/fold.js/) (works on desktop: the simulator is built in) ยท [See an existing site fixed in one line](https://christophe77.github.io/fold.js/legacy.html)
|
|
13
13
|
|
|
@@ -186,7 +186,7 @@ It opens the page in headless Chrome at the real inner-screen sizes of the Samsu
|
|
|
186
186
|
| `--posture` | `all` | `book`, `tabletop` or `all` |
|
|
187
187
|
| `--out` | `foldjs-report` | Report folder (`report.html` + `report.json`) |
|
|
188
188
|
| `--min-score` | | Exit with code 1 below this score, for CI |
|
|
189
|
-
| `--dismiss-consent` | | Close cookie banners (
|
|
189
|
+
| `--dismiss-consent` | | Close cookie banners (accepting, like most visitors) before the audit |
|
|
190
190
|
| `--json` | | Print the result as JSON |
|
|
191
191
|
| `--browser` | auto | Chrome, Edge or Chromium path (or `CHROME_PATH`). No browser is downloaded. |
|
|
192
192
|
|
|
@@ -213,13 +213,14 @@ On a foldable (and in the simulator), it applies safe, reversible fixes as inlin
|
|
|
213
213
|
| Fix | Automatic | Option |
|
|
214
214
|
|---|---|---|
|
|
215
215
|
| Open dialogs and modals move to a single screen (right screen in book, top half in tabletop) | โ
| `modals` |
|
|
216
|
+
| Cookie and consent banners move to a single screen (OneTrust, Didomi, Axeptio, Cookiebot, Quantcast, Usercentrics, Sourcepoint, tarteaucitron and homemade ones) | โ
| `consent` |
|
|
216
217
|
| Fixed tab bars and toolbars get an empty slot under the hinge, so no item is split | โ
| `bars` |
|
|
217
218
|
| Videos and iframes stay on one screen (top half in tabletop) | โ
| `media` |
|
|
218
219
|
| Text blocks flow into two columns around the hinge | add `data-fold-columns` | `columns` |
|
|
219
220
|
| Any element is pushed off the hinge (titles, call-to-action buttons) | add `data-fold-avoid` | `avoid` |
|
|
220
221
|
| An element and its children are never touched | add `data-fold-ignore` | |
|
|
221
222
|
|
|
222
|
-
Turn a fix off with `autoFix({ bars: false })` or `<script src="โฆ/auto.global.js" data-bars="false">`. [See it on a typical mobile site](https://christophe77.github.io/fold.js/legacy.html): the foldable score goes from
|
|
223
|
+
Turn a fix off with `autoFix({ bars: false })` or `<script src="โฆ/auto.global.js" data-bars="false">`. [See it on a typical mobile site](https://christophe77.github.io/fold.js/legacy.html): the foldable score goes from 76 to 100 in book posture, cookie banner included.
|
|
223
224
|
|
|
224
225
|
## iPhone Fold: the virtual fold
|
|
225
226
|
|
|
@@ -268,7 +269,7 @@ Writing an adapter for another framework? `subscribe` and `getFold` are all you
|
|
|
268
269
|
Run `npx foldjs audit https://your-site.com`. It tests the page on the Samsung Galaxy Z Fold and Google Pixel Fold in book and tabletop postures, gives a score out of 100 and an HTML report with screenshots of every element under the hinge. While developing, the fold.js simulator shows the same issues live.
|
|
269
270
|
|
|
270
271
|
### Can I make an existing mobile site foldable-friendly without rewriting it?
|
|
271
|
-
Yes. Add `<script src="https://unpkg.com/foldjs/dist/auto.global.js"></script>`. It moves modals, tab bars and videos off the hinge automatically, and you can mark text blocks with `data-fold-columns` or elements with `data-fold-avoid` for more. For new screens, `<TwoPane>` gives the best result.
|
|
272
|
+
Yes. Add `<script src="https://unpkg.com/foldjs/dist/auto.global.js"></script>`. It moves cookie banners, modals, tab bars and videos off the hinge automatically, and you can mark text blocks with `data-fold-columns` or elements with `data-fold-avoid` for more. For new screens, `<TwoPane>` gives the best result.
|
|
272
273
|
|
|
273
274
|
### How do I detect a foldable phone in JavaScript?
|
|
274
275
|
Call `getFold()` from `foldjs` (or `useFold()` in React and Vue). `isSpanned` tells you whether the viewport is split by a hinge, `posture` tells you how the device is held, and `hinge` gives the hinge rectangle in CSS pixels. Under the hood fold.js reads `window.viewport.segments` and `navigator.devicePosture`, with a fallback for older Edge builds.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldjs/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Svelte store and actions for foldable phones: $fold, use:twoPane, use:foldWhen and a built-in foldable simulator. Works with SvelteKit.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "christophe77",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"iphone-fold"
|
|
53
53
|
],
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"foldjs": "^0.
|
|
55
|
+
"foldjs": "^0.4.0",
|
|
56
56
|
"svelte": ">=4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|