@unisim/sdk 0.202.0 → 0.203.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 +82 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +32 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/phone/BottomSheet.d.ts +40 -0
- package/dist/phone/BottomSheet.d.ts.map +1 -0
- package/dist/phone/BottomSheet.js +51 -0
- package/dist/phone/BottomSheet.js.map +1 -0
- package/dist/phone/PhonePage.d.ts +46 -0
- package/dist/phone/PhonePage.d.ts.map +1 -0
- package/dist/phone/PhonePage.js +52 -0
- package/dist/phone/PhonePage.js.map +1 -0
- package/dist/phone/dialogs.d.ts +43 -0
- package/dist/phone/dialogs.d.ts.map +1 -0
- package/dist/phone/dialogs.js +128 -0
- package/dist/phone/dialogs.js.map +1 -0
- package/dist/phone/edgeSwipe.d.ts +18 -0
- package/dist/phone/edgeSwipe.d.ts.map +1 -0
- package/dist/phone/edgeSwipe.js +190 -0
- package/dist/phone/edgeSwipe.js.map +1 -0
- package/dist/phone/gestures.d.ts +60 -0
- package/dist/phone/gestures.d.ts.map +1 -0
- package/dist/phone/gestures.js +329 -0
- package/dist/phone/gestures.js.map +1 -0
- package/dist/phone/index.d.ts +16 -0
- package/dist/phone/index.d.ts.map +1 -0
- package/dist/phone/index.js +15 -0
- package/dist/phone/index.js.map +1 -0
- package/dist/phone/layers.d.ts +44 -0
- package/dist/phone/layers.d.ts.map +1 -0
- package/dist/phone/layers.js +225 -0
- package/dist/phone/layers.js.map +1 -0
- package/dist/phone/scrollHint.d.ts +22 -0
- package/dist/phone/scrollHint.d.ts.map +1 -0
- package/dist/phone/scrollHint.js +81 -0
- package/dist/phone/scrollHint.js.map +1 -0
- package/dist/phone/shared.d.ts +24 -0
- package/dist/phone/shared.d.ts.map +1 -0
- package/dist/phone/shared.js +59 -0
- package/dist/phone/shared.js.map +1 -0
- package/dist/phone/styles.d.ts +11 -0
- package/dist/phone/styles.d.ts.map +1 -0
- package/dist/phone/styles.js +139 -0
- package/dist/phone/styles.js.map +1 -0
- package/dist/phone/text.d.ts +6 -0
- package/dist/phone/text.d.ts.map +1 -0
- package/dist/phone/text.js +15 -0
- package/dist/phone/text.js.map +1 -0
- package/dist/revealOnExpand.d.ts.map +1 -1
- package/dist/revealOnExpand.js +28 -1
- package/dist/revealOnExpand.js.map +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type HTMLAttributes, type RefObject } from 'react';
|
|
2
|
+
/** The attribute every page and sheet root carries. */
|
|
3
|
+
export declare const PHONE_LAYER_ATTR = "data-phone-layer";
|
|
4
|
+
/**
|
|
5
|
+
* Where a pull down must not be taken over: a box being typed in, a slider, a
|
|
6
|
+
* sideways swiper, anything drawn on (a signature's downward stroke is not a
|
|
7
|
+
* pull), and the grip, which has its own drag.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PULL_EXEMPT = "input, textarea, select, canvas, [contenteditable=\"true\"], [contenteditable=\"\"], [data-swipe-x], [data-sheet-grip]";
|
|
10
|
+
/** The boxes a pull down puts the finger in: one-line text and the like. */
|
|
11
|
+
export declare const TYPE_BOX = "input:not([type]), input[type=\"text\"], input[type=\"search\"], input[type=\"url\"], input[type=\"email\"], input[type=\"tel\"], input[type=\"number\"], input[type=\"password\"], textarea";
|
|
12
|
+
/**
|
|
13
|
+
* The first visible, usable text box inside `root`, in reading order — not
|
|
14
|
+
* counting one inside another layer nested in it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function firstTypeBox(root: HTMLElement | null): HTMLInputElement | HTMLTextAreaElement | null;
|
|
17
|
+
export type GripProps = Pick<HTMLAttributes<HTMLDivElement>, 'onPointerDown' | 'onPointerMove' | 'onPointerUp' | 'onPointerCancel'>;
|
|
18
|
+
/**
|
|
19
|
+
* The grip brings the sheet down with the finger (James, 2026-10-19: "taking
|
|
20
|
+
* the drawer handle you should be able to drag it down and it takes the drawer
|
|
21
|
+
* with it"). Let go past a third of its height (140px at most), or flick it,
|
|
22
|
+
* and it slides the rest of the way and closes; short of that it settles back.
|
|
23
|
+
* The transform is written straight to the element, so a drag does not
|
|
24
|
+
* re-render what is in the sheet. Spread the result onto the grip strip.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useSheetPull(ref: RefObject<HTMLElement | null>, onClose: () => void): GripProps;
|
|
27
|
+
/** A big pull: 40% of the sheet's height (180px at most), or a hard flick. */
|
|
28
|
+
export declare const SHEET_CLOSE_SHARE = 0.4;
|
|
29
|
+
export declare const SHEET_CLOSE_MAX_PX = 180;
|
|
30
|
+
/** A shorter pull than that, past this, puts the finger in the sheet's text box. */
|
|
31
|
+
export declare const SHEET_TYPE_PX = 36;
|
|
32
|
+
/** A pull on a page past this puts the finger in its text box. */
|
|
33
|
+
export declare const PAGE_TYPE_PX = 50;
|
|
34
|
+
/**
|
|
35
|
+
* A pull down anywhere on a sheet, not just its grip (James, 2026-10-22):
|
|
36
|
+
*
|
|
37
|
+
* • A big swipe down closes it ("allow a big swipe down to close drawers
|
|
38
|
+
* without having to use the handle"). The sheet follows the finger; let go
|
|
39
|
+
* far enough, or flick hard, and it goes.
|
|
40
|
+
* • A shorter pull puts the finger in its first text box, keyboard up ("on a
|
|
41
|
+
* swipe down, focus on the input"). The focus is made in the touch's
|
|
42
|
+
* release, the only place iOS raises the keyboard for it.
|
|
43
|
+
*
|
|
44
|
+
* Only from the top of the sheet's own scroll (`bodyRef`), only a mostly
|
|
45
|
+
* downward pull, and never one that starts on a slider, a box being typed in,
|
|
46
|
+
* a canvas or a swiper. Touch events, not pointer ones, so the sheet's own
|
|
47
|
+
* scrolling is untouched until the pull is decided.
|
|
48
|
+
*/
|
|
49
|
+
export declare function useSheetBodyPull(sheetRef: RefObject<HTMLElement | null>, bodyRef: RefObject<HTMLElement | null>, onClose: () => void, enabled?: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* A pull down on a page puts the finger in its text box, keyboard up (James,
|
|
52
|
+
* 2026-10-22: "on the QR pop-up … if you scroll down, it should focus on the
|
|
53
|
+
* input and allow you to use the keyboard"). So a page never focuses a box on
|
|
54
|
+
* arrival: the keyboard comes up only when asked for. Only from the top of the
|
|
55
|
+
* page's scroll, only a mostly downward pull, and only on a page that has a
|
|
56
|
+
* box; the page gives a little with the finger (a third of it, 48px at most)
|
|
57
|
+
* so the pull is felt.
|
|
58
|
+
*/
|
|
59
|
+
export declare function usePagePullToType(ref: RefObject<HTMLElement | null>, enabled?: boolean): void;
|
|
60
|
+
//# sourceMappingURL=gestures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../src/phone/gestures.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAG9E,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAIlD;;;;GAIG;AACH,eAAO,MAAM,WAAW,2HAC8F,CAAA;AAEtH,4EAA4E;AAC5E,eAAO,MAAM,QAAQ,iMAC6J,CAAA;AAMlL;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,IAAI,CAUpG;AAQD,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,cAAc,CAAC,cAAc,CAAC,EAC9B,eAAe,GAAG,eAAe,GAAG,aAAa,GAAG,iBAAiB,CACtE,CAAA;AAqCD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,SAAS,CAsC/F;AAED,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,kBAAkB,MAAM,CAAA;AACrC,oFAAoF;AACpF,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,kEAAkE;AAClE,eAAO,MAAM,YAAY,KAAK,CAAA;AAE9B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACvC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACtC,OAAO,EAAE,MAAM,IAAI,EACnB,OAAO,UAAO,GACb,IAAI,CAkEN;AAWD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,UAAO,GAAG,IAAI,CAsD1F"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// The pulls: a sheet's grip, a pull down anywhere on a sheet, and a pull down
|
|
3
|
+
// on a page (BRANDING.md ▸ "A big swipe down closes a drawer; a short pull
|
|
4
|
+
// puts you in its box", owner rules 2026-10-22).
|
|
5
|
+
//
|
|
6
|
+
// Moved here from Universal PDF's `src/native/parts.tsx` (the original) and
|
|
7
|
+
// its copies in Universal Images, Converter, Compress, BlackBook
|
|
8
|
+
// (`gestures.ts`) and Family (`Layers.tsx`). The thresholds are PDF's,
|
|
9
|
+
// unchanged. What the copies added, kept:
|
|
10
|
+
// - Family: a touch that starts inside ANOTHER layer rendered within this one
|
|
11
|
+
// (`[data-phone-layer]`, a sheet opened from a page and rendered in place)
|
|
12
|
+
// is that layer's, not this one's; and the first text box is looked for in
|
|
13
|
+
// this layer only, never in one nested inside it.
|
|
14
|
+
// - Family: a sheet whose close was refused does not stay off the bottom of
|
|
15
|
+
// the screen — it comes back up.
|
|
16
|
+
// - PDF: a password box counts as a text box (a locked file's sheet); the
|
|
17
|
+
// copies had dropped it.
|
|
18
|
+
// New here: under reduced motion nothing slides away on release; it closes
|
|
19
|
+
// (or settles) at once.
|
|
20
|
+
import { useEffect, useRef } from 'react';
|
|
21
|
+
import { prefersReducedMotion } from '../PullDrawer.js';
|
|
22
|
+
/** The attribute every page and sheet root carries. */
|
|
23
|
+
export const PHONE_LAYER_ATTR = 'data-phone-layer';
|
|
24
|
+
const EASE = 'transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1)';
|
|
25
|
+
/**
|
|
26
|
+
* Where a pull down must not be taken over: a box being typed in, a slider, a
|
|
27
|
+
* sideways swiper, anything drawn on (a signature's downward stroke is not a
|
|
28
|
+
* pull), and the grip, which has its own drag.
|
|
29
|
+
*/
|
|
30
|
+
export const PULL_EXEMPT = 'input, textarea, select, canvas, [contenteditable="true"], [contenteditable=""], [data-swipe-x], [data-sheet-grip]';
|
|
31
|
+
/** The boxes a pull down puts the finger in: one-line text and the like. */
|
|
32
|
+
export const TYPE_BOX = 'input:not([type]), input[type="text"], input[type="search"], input[type="url"], input[type="email"], input[type="tel"], input[type="number"], input[type="password"], textarea';
|
|
33
|
+
function layerOf(el) {
|
|
34
|
+
return el?.closest?.(`[${PHONE_LAYER_ATTR}]`) ?? null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The first visible, usable text box inside `root`, in reading order — not
|
|
38
|
+
* counting one inside another layer nested in it.
|
|
39
|
+
*/
|
|
40
|
+
export function firstTypeBox(root) {
|
|
41
|
+
if (!root)
|
|
42
|
+
return null;
|
|
43
|
+
const home = layerOf(root);
|
|
44
|
+
for (const el of root.querySelectorAll(TYPE_BOX)) {
|
|
45
|
+
if (el.disabled || el.readOnly)
|
|
46
|
+
continue;
|
|
47
|
+
if (layerOf(el) !== home)
|
|
48
|
+
continue;
|
|
49
|
+
if (el.getClientRects().length === 0)
|
|
50
|
+
continue;
|
|
51
|
+
return el;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/** The touch starts in a layer other than the one `own` belongs to. */
|
|
56
|
+
function inOtherLayer(target, own) {
|
|
57
|
+
const l = layerOf(target);
|
|
58
|
+
return l !== null && l !== layerOf(own) && l !== own;
|
|
59
|
+
}
|
|
60
|
+
/** Slide `el` off the bottom, then close; if it is still on screen after, bring it back. */
|
|
61
|
+
function slideAwayThenClose(el, close) {
|
|
62
|
+
const back = () => {
|
|
63
|
+
if (!el.isConnected)
|
|
64
|
+
return;
|
|
65
|
+
el.style.transition = prefersReducedMotion() ? 'none' : EASE;
|
|
66
|
+
el.style.transform = '';
|
|
67
|
+
};
|
|
68
|
+
if (prefersReducedMotion()) {
|
|
69
|
+
el.style.transition = 'none';
|
|
70
|
+
el.style.transform = '';
|
|
71
|
+
close();
|
|
72
|
+
window.setTimeout(back, 0);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
el.style.transition = EASE;
|
|
76
|
+
el.style.transform = `translateY(${el.offsetHeight + 24}px)`;
|
|
77
|
+
window.setTimeout(() => {
|
|
78
|
+
close();
|
|
79
|
+
// Refused (closable={false}, or the app asked first): back up it comes.
|
|
80
|
+
window.setTimeout(back, 30);
|
|
81
|
+
}, 160);
|
|
82
|
+
}
|
|
83
|
+
function settle(el) {
|
|
84
|
+
el.style.transition = prefersReducedMotion() ? 'none' : EASE;
|
|
85
|
+
el.style.transform = '';
|
|
86
|
+
}
|
|
87
|
+
/** Stop the rise-in (or any animation) holding the transform while a finger has it. */
|
|
88
|
+
function takeHold(el) {
|
|
89
|
+
el.getAnimations?.().forEach((a) => a.cancel());
|
|
90
|
+
el.style.animation = 'none';
|
|
91
|
+
el.style.transition = 'none';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The grip brings the sheet down with the finger (James, 2026-10-19: "taking
|
|
95
|
+
* the drawer handle you should be able to drag it down and it takes the drawer
|
|
96
|
+
* with it"). Let go past a third of its height (140px at most), or flick it,
|
|
97
|
+
* and it slides the rest of the way and closes; short of that it settles back.
|
|
98
|
+
* The transform is written straight to the element, so a drag does not
|
|
99
|
+
* re-render what is in the sheet. Spread the result onto the grip strip.
|
|
100
|
+
*/
|
|
101
|
+
export function useSheetPull(ref, onClose) {
|
|
102
|
+
const drag = useRef(null);
|
|
103
|
+
const close = useRef(onClose);
|
|
104
|
+
close.current = onClose;
|
|
105
|
+
function finish(cancelled) {
|
|
106
|
+
const d = drag.current;
|
|
107
|
+
drag.current = null;
|
|
108
|
+
const el = ref.current;
|
|
109
|
+
if (!d || !el)
|
|
110
|
+
return;
|
|
111
|
+
const away = !cancelled && (d.dy > Math.min(140, el.offsetHeight / 3) || (d.v > 0.5 && d.dy > 16));
|
|
112
|
+
if (away)
|
|
113
|
+
slideAwayThenClose(el, () => close.current());
|
|
114
|
+
else
|
|
115
|
+
settle(el);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
onPointerDown(e) {
|
|
119
|
+
const el = ref.current;
|
|
120
|
+
if (!el)
|
|
121
|
+
return;
|
|
122
|
+
drag.current = { y: e.clientY, dy: 0, t: e.timeStamp, v: 0 };
|
|
123
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
124
|
+
takeHold(el);
|
|
125
|
+
},
|
|
126
|
+
onPointerMove(e) {
|
|
127
|
+
const d = drag.current;
|
|
128
|
+
const el = ref.current;
|
|
129
|
+
if (!d || !el)
|
|
130
|
+
return;
|
|
131
|
+
// Down only: pulled up, it stays put.
|
|
132
|
+
const dy = Math.max(0, e.clientY - d.y);
|
|
133
|
+
const dt = e.timeStamp - d.t;
|
|
134
|
+
if (dt > 0)
|
|
135
|
+
d.v = (dy - d.dy) / dt;
|
|
136
|
+
d.dy = dy;
|
|
137
|
+
d.t = e.timeStamp;
|
|
138
|
+
el.style.transform = dy ? `translateY(${dy}px)` : '';
|
|
139
|
+
},
|
|
140
|
+
onPointerUp: () => finish(false),
|
|
141
|
+
onPointerCancel: () => finish(true),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** A big pull: 40% of the sheet's height (180px at most), or a hard flick. */
|
|
145
|
+
export const SHEET_CLOSE_SHARE = 0.4;
|
|
146
|
+
export const SHEET_CLOSE_MAX_PX = 180;
|
|
147
|
+
/** A shorter pull than that, past this, puts the finger in the sheet's text box. */
|
|
148
|
+
export const SHEET_TYPE_PX = 36;
|
|
149
|
+
/** A pull on a page past this puts the finger in its text box. */
|
|
150
|
+
export const PAGE_TYPE_PX = 50;
|
|
151
|
+
/**
|
|
152
|
+
* A pull down anywhere on a sheet, not just its grip (James, 2026-10-22):
|
|
153
|
+
*
|
|
154
|
+
* • A big swipe down closes it ("allow a big swipe down to close drawers
|
|
155
|
+
* without having to use the handle"). The sheet follows the finger; let go
|
|
156
|
+
* far enough, or flick hard, and it goes.
|
|
157
|
+
* • A shorter pull puts the finger in its first text box, keyboard up ("on a
|
|
158
|
+
* swipe down, focus on the input"). The focus is made in the touch's
|
|
159
|
+
* release, the only place iOS raises the keyboard for it.
|
|
160
|
+
*
|
|
161
|
+
* Only from the top of the sheet's own scroll (`bodyRef`), only a mostly
|
|
162
|
+
* downward pull, and never one that starts on a slider, a box being typed in,
|
|
163
|
+
* a canvas or a swiper. Touch events, not pointer ones, so the sheet's own
|
|
164
|
+
* scrolling is untouched until the pull is decided.
|
|
165
|
+
*/
|
|
166
|
+
export function useSheetBodyPull(sheetRef, bodyRef, onClose, enabled = true) {
|
|
167
|
+
const close = useRef(onClose);
|
|
168
|
+
close.current = onClose;
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
const sheet = sheetRef.current;
|
|
171
|
+
const body = bodyRef.current;
|
|
172
|
+
if (!sheet || !body || !enabled)
|
|
173
|
+
return;
|
|
174
|
+
let g = null;
|
|
175
|
+
const onStart = (e) => {
|
|
176
|
+
g = null;
|
|
177
|
+
if (e.touches.length !== 1)
|
|
178
|
+
return;
|
|
179
|
+
const target = e.target;
|
|
180
|
+
if (target?.closest?.(PULL_EXEMPT))
|
|
181
|
+
return;
|
|
182
|
+
if (inOtherLayer(target, sheet))
|
|
183
|
+
return;
|
|
184
|
+
if (body.scrollTop > 0)
|
|
185
|
+
return;
|
|
186
|
+
const tt = e.touches[0];
|
|
187
|
+
g = { x: tt.clientX, y: tt.clientY, dy: 0, t: e.timeStamp, v: 0, pull: null };
|
|
188
|
+
};
|
|
189
|
+
const onMove = (e) => {
|
|
190
|
+
if (!g)
|
|
191
|
+
return;
|
|
192
|
+
const tt = e.touches[0];
|
|
193
|
+
if (!tt)
|
|
194
|
+
return;
|
|
195
|
+
const dx = tt.clientX - g.x;
|
|
196
|
+
const dy = tt.clientY - g.y;
|
|
197
|
+
if (g.pull === null) {
|
|
198
|
+
if (Math.abs(dx) < 8 && Math.abs(dy) < 8)
|
|
199
|
+
return;
|
|
200
|
+
g.pull = dy > 0 && dy > Math.abs(dx) * 1.2 && body.scrollTop <= 0;
|
|
201
|
+
if (!g.pull) {
|
|
202
|
+
g = null;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
takeHold(sheet);
|
|
206
|
+
}
|
|
207
|
+
if (e.cancelable)
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
const d = Math.max(0, dy);
|
|
210
|
+
const dt = e.timeStamp - g.t;
|
|
211
|
+
if (dt > 0)
|
|
212
|
+
g.v = (d - g.dy) / dt;
|
|
213
|
+
g.dy = d;
|
|
214
|
+
g.t = e.timeStamp;
|
|
215
|
+
sheet.style.transform = d ? `translateY(${d}px)` : '';
|
|
216
|
+
};
|
|
217
|
+
const onEnd = (e) => {
|
|
218
|
+
const d = g;
|
|
219
|
+
g = null;
|
|
220
|
+
if (!d?.pull)
|
|
221
|
+
return;
|
|
222
|
+
const big = e.type === 'touchend' &&
|
|
223
|
+
(d.dy > Math.min(SHEET_CLOSE_MAX_PX, sheet.offsetHeight * SHEET_CLOSE_SHARE) || (d.v > 0.8 && d.dy > 90));
|
|
224
|
+
if (big) {
|
|
225
|
+
slideAwayThenClose(sheet, () => close.current());
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
settle(sheet);
|
|
229
|
+
if (e.type === 'touchend' && d.dy > SHEET_TYPE_PX)
|
|
230
|
+
firstTypeBox(body)?.focus();
|
|
231
|
+
};
|
|
232
|
+
sheet.addEventListener('touchstart', onStart, { passive: true });
|
|
233
|
+
sheet.addEventListener('touchmove', onMove, { passive: false });
|
|
234
|
+
sheet.addEventListener('touchend', onEnd);
|
|
235
|
+
sheet.addEventListener('touchcancel', onEnd);
|
|
236
|
+
return () => {
|
|
237
|
+
sheet.removeEventListener('touchstart', onStart);
|
|
238
|
+
sheet.removeEventListener('touchmove', onMove);
|
|
239
|
+
sheet.removeEventListener('touchend', onEnd);
|
|
240
|
+
sheet.removeEventListener('touchcancel', onEnd);
|
|
241
|
+
};
|
|
242
|
+
}, [sheetRef, bodyRef, enabled]);
|
|
243
|
+
}
|
|
244
|
+
/** The nearest scrolling box between `el` and `root`, or `root`. */
|
|
245
|
+
function scrollerOf(el, root) {
|
|
246
|
+
for (let n = el; n && n !== root; n = n.parentElement) {
|
|
247
|
+
const oy = getComputedStyle(n).overflowY;
|
|
248
|
+
if ((oy === 'auto' || oy === 'scroll') && n.scrollHeight > n.clientHeight)
|
|
249
|
+
return n;
|
|
250
|
+
}
|
|
251
|
+
return root;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A pull down on a page puts the finger in its text box, keyboard up (James,
|
|
255
|
+
* 2026-10-22: "on the QR pop-up … if you scroll down, it should focus on the
|
|
256
|
+
* input and allow you to use the keyboard"). So a page never focuses a box on
|
|
257
|
+
* arrival: the keyboard comes up only when asked for. Only from the top of the
|
|
258
|
+
* page's scroll, only a mostly downward pull, and only on a page that has a
|
|
259
|
+
* box; the page gives a little with the finger (a third of it, 48px at most)
|
|
260
|
+
* so the pull is felt.
|
|
261
|
+
*/
|
|
262
|
+
export function usePagePullToType(ref, enabled = true) {
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
const page = ref.current;
|
|
265
|
+
if (!page || !enabled)
|
|
266
|
+
return;
|
|
267
|
+
let g = null;
|
|
268
|
+
const onStart = (e) => {
|
|
269
|
+
g = null;
|
|
270
|
+
if (e.touches.length !== 1)
|
|
271
|
+
return;
|
|
272
|
+
const target = e.target;
|
|
273
|
+
if (target?.closest?.(PULL_EXEMPT))
|
|
274
|
+
return;
|
|
275
|
+
if (inOtherLayer(target, page))
|
|
276
|
+
return;
|
|
277
|
+
if (!firstTypeBox(page))
|
|
278
|
+
return;
|
|
279
|
+
const scroller = scrollerOf(target, page);
|
|
280
|
+
if (scroller.scrollTop > 0)
|
|
281
|
+
return;
|
|
282
|
+
const tt = e.touches[0];
|
|
283
|
+
g = { x: tt.clientX, y: tt.clientY, dy: 0, scroller, pull: null };
|
|
284
|
+
};
|
|
285
|
+
const onMove = (e) => {
|
|
286
|
+
if (!g)
|
|
287
|
+
return;
|
|
288
|
+
const tt = e.touches[0];
|
|
289
|
+
if (!tt)
|
|
290
|
+
return;
|
|
291
|
+
const dx = tt.clientX - g.x;
|
|
292
|
+
const dy = tt.clientY - g.y;
|
|
293
|
+
if (g.pull === null) {
|
|
294
|
+
if (Math.abs(dx) < 8 && Math.abs(dy) < 8)
|
|
295
|
+
return;
|
|
296
|
+
g.pull = dy > 0 && dy > Math.abs(dx) * 1.2 && g.scroller.scrollTop <= 0;
|
|
297
|
+
if (!g.pull) {
|
|
298
|
+
g = null;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
page.style.transition = 'none';
|
|
302
|
+
}
|
|
303
|
+
if (e.cancelable)
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
g.dy = Math.max(0, dy);
|
|
306
|
+
page.style.transform = `translateY(${Math.min(48, g.dy * 0.35)}px)`;
|
|
307
|
+
};
|
|
308
|
+
const onEnd = (e) => {
|
|
309
|
+
const d = g;
|
|
310
|
+
g = null;
|
|
311
|
+
if (!d?.pull)
|
|
312
|
+
return;
|
|
313
|
+
settle(page);
|
|
314
|
+
if (e.type === 'touchend' && d.dy > PAGE_TYPE_PX)
|
|
315
|
+
firstTypeBox(page)?.focus();
|
|
316
|
+
};
|
|
317
|
+
page.addEventListener('touchstart', onStart, { passive: true });
|
|
318
|
+
page.addEventListener('touchmove', onMove, { passive: false });
|
|
319
|
+
page.addEventListener('touchend', onEnd);
|
|
320
|
+
page.addEventListener('touchcancel', onEnd);
|
|
321
|
+
return () => {
|
|
322
|
+
page.removeEventListener('touchstart', onStart);
|
|
323
|
+
page.removeEventListener('touchmove', onMove);
|
|
324
|
+
page.removeEventListener('touchend', onEnd);
|
|
325
|
+
page.removeEventListener('touchcancel', onEnd);
|
|
326
|
+
};
|
|
327
|
+
}, [ref, enabled]);
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=gestures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../src/phone/gestures.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,8EAA8E;AAC9E,2EAA2E;AAC3E,iDAAiD;AACjD,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,uEAAuE;AACvE,0CAA0C;AAC1C,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,qDAAqD;AACrD,6EAA6E;AAC7E,oCAAoC;AACpC,2EAA2E;AAC3E,4BAA4B;AAC5B,2EAA2E;AAC3E,wBAAwB;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAuC,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAElD,MAAM,IAAI,GAAG,gDAAgD,CAAA;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,oHAAoH,CAAA;AAEtH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,QAAQ,GACnB,gLAAgL,CAAA;AAElL,SAAS,OAAO,CAAC,EAAkB;IACjC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,gBAAgB,GA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|
+
export type { BottomSheetProps } from './BottomSheet.js';
|
|
5
|
+
export { PhoneDialogHost, phoneAlert, phoneConfirm, phonePrompt, hasPhoneDialogHost } from './dialogs.js';
|
|
6
|
+
export type { PhoneAlertOptions, PhoneConfirmOptions, PhonePromptOptions } from './dialogs.js';
|
|
7
|
+
export { usePhoneLayer, usePhoneLayerCount, useAnyPhoneLayerOpen, closeTopPhoneLayer, configurePhoneLayers, phoneLayerDebug, } from './layers.js';
|
|
8
|
+
export type { PhoneLayerKind, PhoneLayerOptions, PhoneLayerState } from './layers.js';
|
|
9
|
+
export { useEdgeSwipeBack, EDGE_SWIPE_START_PX, EDGE_SWIPE_PAST } from './edgeSwipe.js';
|
|
10
|
+
export { useSheetPull, useSheetBodyPull, usePagePullToType, firstTypeBox, PHONE_LAYER_ATTR, PULL_EXEMPT, TYPE_BOX, SHEET_CLOSE_SHARE, SHEET_CLOSE_MAX_PX, SHEET_TYPE_PX, PAGE_TYPE_PX, } from './gestures.js';
|
|
11
|
+
export type { GripProps } from './gestures.js';
|
|
12
|
+
export { useScrollHint, SCROLL_HINT_FADE_PX } from './scrollHint.js';
|
|
13
|
+
export type { ScrollHint } from './scrollHint.js';
|
|
14
|
+
export { injectPhoneStyles, PHONE_STYLE_ID } from './styles.js';
|
|
15
|
+
export type { PhoneTheme } from './styles.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/phone/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACzG,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC9F,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACrF,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACpE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The phone kit: the pages, bottom sheets and gestures every phone app in the
|
|
2
|
+
// suite builds its chrome from (BRANDING.md's phone rules; store-listings
|
|
3
|
+
// README §7, "no website popups"). Moved here in 0.203.0 from Universal PDF's
|
|
4
|
+
// `src/native/parts.tsx` + `edgeSwipe.ts` and the copies of them in Images,
|
|
5
|
+
// Converter, Compress, BlackBook and Family. README ▸ "Phone pages, sheets and
|
|
6
|
+
// gestures".
|
|
7
|
+
export { PhonePage } from './PhonePage.js';
|
|
8
|
+
export { BottomSheet, PhoneSheetGrip } from './BottomSheet.js';
|
|
9
|
+
export { PhoneDialogHost, phoneAlert, phoneConfirm, phonePrompt, hasPhoneDialogHost } from './dialogs.js';
|
|
10
|
+
export { usePhoneLayer, usePhoneLayerCount, useAnyPhoneLayerOpen, closeTopPhoneLayer, configurePhoneLayers, phoneLayerDebug, } from './layers.js';
|
|
11
|
+
export { useEdgeSwipeBack, EDGE_SWIPE_START_PX, EDGE_SWIPE_PAST } from './edgeSwipe.js';
|
|
12
|
+
export { useSheetPull, useSheetBodyPull, usePagePullToType, firstTypeBox, PHONE_LAYER_ATTR, PULL_EXEMPT, TYPE_BOX, SHEET_CLOSE_SHARE, SHEET_CLOSE_MAX_PX, SHEET_TYPE_PX, PAGE_TYPE_PX, } from './gestures.js';
|
|
13
|
+
export { useScrollHint, SCROLL_HINT_FADE_PX } from './scrollHint.js';
|
|
14
|
+
export { injectPhoneStyles, PHONE_STYLE_ID } from './styles.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/phone/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,aAAa;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE9D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEzG,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEpE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type PhoneLayerKind = 'page' | 'sheet';
|
|
2
|
+
export interface PhoneLayerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Keep a history entry per open layer, so Android's back gesture (and the
|
|
5
|
+
* browser's Back) closes the top one. Default true. Turn it off only in an
|
|
6
|
+
* app that keeps its own history for its layers.
|
|
7
|
+
*/
|
|
8
|
+
history?: boolean;
|
|
9
|
+
/** The z-index of the first layer; each one above it is 2 higher. Default 1200 (over the SDK navbar and the website's dialogs). */
|
|
10
|
+
baseZ?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Set the stack's options. Call once, before the first layer opens. */
|
|
13
|
+
export declare function configurePhoneLayers(options: PhoneLayerOptions): void;
|
|
14
|
+
export interface PhoneLayerState {
|
|
15
|
+
/** Its place in the stack, 0 for the first one open. */
|
|
16
|
+
index: number;
|
|
17
|
+
/** Nothing is open over it. */
|
|
18
|
+
isTop: boolean;
|
|
19
|
+
/** Its z-index. */
|
|
20
|
+
zIndex: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Put a page or sheet on the stack for as long as `open` (default true) and
|
|
24
|
+
* it is mounted. Back (Android's gesture, the browser's) calls `close` on the
|
|
25
|
+
* top layer; answer `false` to stay. Pages and sheets from this kit call it
|
|
26
|
+
* themselves — use it for a layer of your own (a non-modal tool sheet, a page
|
|
27
|
+
* whose chrome is the app's).
|
|
28
|
+
*/
|
|
29
|
+
export declare function usePhoneLayer(kind: PhoneLayerKind, close: () => boolean | void, options?: {
|
|
30
|
+
open?: boolean;
|
|
31
|
+
lockScroll?: boolean;
|
|
32
|
+
}): PhoneLayerState;
|
|
33
|
+
/** How many pages and sheets are open (re-renders when it changes). */
|
|
34
|
+
export declare function usePhoneLayerCount(): number;
|
|
35
|
+
/** Is any page or sheet open? For an app that must stand still under one (a tab bar's search request). */
|
|
36
|
+
export declare function useAnyPhoneLayerOpen(): boolean;
|
|
37
|
+
/** Close the top layer, as Back would. Answers false when nothing is open or it refused. */
|
|
38
|
+
export declare function closeTopPhoneLayer(): boolean;
|
|
39
|
+
/** For tests and diagnostics: the open layers' kinds, bottom first, and our history entries. */
|
|
40
|
+
export declare function phoneLayerDebug(): {
|
|
41
|
+
kinds: PhoneLayerKind[];
|
|
42
|
+
pushed: number;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../../src/phone/layers.ts"],"names":[],"mappings":"AAoCA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAA;AAE7C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,mIAAmI;IACnI,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAoCD,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAGrE;AAoGD,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,KAAK,EAAE,OAAO,CAAA;IACd,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,OAAO,GAAG,IAAI,EAC3B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrD,eAAe,CA2BjB;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,0GAA0G;AAC1G,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED,gGAAgG;AAChG,wBAAgB,eAAe,IAAI;IAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAE7E"}
|