@unisim/sdk 0.201.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 +149 -0
- package/dist/defaultView.d.ts +3 -2
- package/dist/defaultView.d.ts.map +1 -1
- package/dist/defaultView.js +7 -2
- package/dist/defaultView.js.map +1 -1
- 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 +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -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/provider.d.ts +6 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -0
- package/dist/provider.js.map +1 -1
- package/dist/revealOnExpand.d.ts.map +1 -1
- package/dist/revealOnExpand.js +28 -1
- package/dist/revealOnExpand.js.map +1 -1
- package/dist/whatsNew.d.ts +104 -0
- package/dist/whatsNew.d.ts.map +1 -0
- package/dist/whatsNew.js +495 -0
- package/dist/whatsNew.js.map +1 -0
- package/dist/whatsNewCopy.d.ts +15 -0
- package/dist/whatsNewCopy.d.ts.map +1 -0
- package/dist/whatsNewCopy.js +70 -0
- package/dist/whatsNewCopy.js.map +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// A swipe in from the left edge goes back a page, as everywhere else on an
|
|
3
|
+
// iPhone (BRANDING.md ▸ "A swipe from the left edge goes back", owner rule
|
|
4
|
+
// 2026-10-19: "Side swipe should go back a page, I am on send and it doesn't
|
|
5
|
+
// do anything"). The web view's own back/forward swipe stays off: it would
|
|
6
|
+
// walk the browser history, which here is the stack of layers (layers.ts),
|
|
7
|
+
// not pages anyone would recognise — so the gesture is ours, on the page.
|
|
8
|
+
//
|
|
9
|
+
// Moved here from Universal PDF's `src/native/edgeSwipe.ts` (the original;
|
|
10
|
+
// Images, Converter and Compress carried it unchanged), with Universal
|
|
11
|
+
// Family's one addition: a touch inside another layer rendered within this
|
|
12
|
+
// one (`[data-phone-layer]`, a sheet opened in place) is that layer's.
|
|
13
|
+
//
|
|
14
|
+
// Touch events rather than pointer events: a pointer drag that the browser
|
|
15
|
+
// also reads as a pan is taken over by the scroll (pointercancel) unless
|
|
16
|
+
// touch-action forbids it, and a touch-action on the page would cost the
|
|
17
|
+
// pages their sideways rows. A non-passive touchmove can say no to the scroll
|
|
18
|
+
// one gesture at a time instead, and only once the gesture is ours.
|
|
19
|
+
import { useEffect, useRef } from 'react';
|
|
20
|
+
import { prefersReducedMotion } from '../PullDrawer.js';
|
|
21
|
+
import { PHONE_LAYER_ATTR } from './gestures.js';
|
|
22
|
+
/** How close to the left edge a swipe has to start, as on iOS. */
|
|
23
|
+
export const EDGE_SWIPE_START_PX = 24;
|
|
24
|
+
/** Movement before the swipe's direction is read. */
|
|
25
|
+
const SLOP = 6;
|
|
26
|
+
/** Let go past this share of the width (or flick) and the page goes. */
|
|
27
|
+
export const EDGE_SWIPE_PAST = 1 / 3;
|
|
28
|
+
/** A flick, in px per ms. */
|
|
29
|
+
const FLICK = 0.5;
|
|
30
|
+
/**
|
|
31
|
+
* While `enabled`, a swipe from the left edge of `ref`'s element drags the
|
|
32
|
+
* page across with the finger and, let go far enough (or flicked), finishes
|
|
33
|
+
* the slide and calls `onBack` — the same as the page's back link; short of
|
|
34
|
+
* that it settles back.
|
|
35
|
+
*
|
|
36
|
+
* What slides is the last `[data-edge-page]` inside the element (a page that
|
|
37
|
+
* stands over another inside one screen, like an article over its list), else
|
|
38
|
+
* the element itself. A `[data-edge-under]` beside it is shown for the length
|
|
39
|
+
* of the drag, so the list is what the article reveals.
|
|
40
|
+
*/
|
|
41
|
+
export function useEdgeSwipeBack(ref, enabled, onBack) {
|
|
42
|
+
const back = useRef(onBack);
|
|
43
|
+
back.current = onBack;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const root = ref.current;
|
|
46
|
+
if (!enabled || !root)
|
|
47
|
+
return;
|
|
48
|
+
const host = root;
|
|
49
|
+
let swipe = null;
|
|
50
|
+
function onStart(e) {
|
|
51
|
+
if (swipe || e.touches.length !== 1) {
|
|
52
|
+
if (swipe?.ours)
|
|
53
|
+
settle(false);
|
|
54
|
+
swipe = null;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const touch = e.touches[0];
|
|
58
|
+
if (touch.clientX - host.getBoundingClientRect().left > EDGE_SWIPE_START_PX)
|
|
59
|
+
return;
|
|
60
|
+
if (!(e.target instanceof Element) || ownsTheGesture(e.target, host))
|
|
61
|
+
return;
|
|
62
|
+
// A page or sheet open inside this one takes its own touches.
|
|
63
|
+
const layer = e.target.closest(`[${PHONE_LAYER_ATTR}]`);
|
|
64
|
+
if (layer && layer !== host && host.contains(layer))
|
|
65
|
+
return;
|
|
66
|
+
const pages = host.querySelectorAll('[data-edge-page]');
|
|
67
|
+
const page = pages.length ? pages[pages.length - 1] : host;
|
|
68
|
+
const under = page === host ? null : host.querySelector('[data-edge-under]');
|
|
69
|
+
swipe = { id: touch.identifier, x: touch.clientX, y: touch.clientY, ours: null, dx: 0, t: e.timeStamp, v: 0, page, under, hidden: under?.style.visibility ?? '' };
|
|
70
|
+
}
|
|
71
|
+
function onMove(e) {
|
|
72
|
+
const s = swipe;
|
|
73
|
+
if (!s)
|
|
74
|
+
return;
|
|
75
|
+
const touch = find(e.touches, s.id);
|
|
76
|
+
if (!touch)
|
|
77
|
+
return;
|
|
78
|
+
const dx = touch.clientX - s.x;
|
|
79
|
+
const dy = touch.clientY - s.y;
|
|
80
|
+
if (s.ours === null) {
|
|
81
|
+
if (Math.hypot(dx, dy) < SLOP)
|
|
82
|
+
return;
|
|
83
|
+
// Mostly sideways and rightwards, or it's the page's own scroll.
|
|
84
|
+
if (dx <= 0 || Math.abs(dx) < Math.abs(dy) * 1.2) {
|
|
85
|
+
swipe = null;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
s.ours = true;
|
|
89
|
+
begin(s.page, s.under);
|
|
90
|
+
}
|
|
91
|
+
if (e.cancelable)
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
const x = Math.max(0, dx);
|
|
94
|
+
const dt = e.timeStamp - s.t;
|
|
95
|
+
if (dt > 0)
|
|
96
|
+
s.v = (x - s.dx) / dt;
|
|
97
|
+
s.dx = x;
|
|
98
|
+
s.t = e.timeStamp;
|
|
99
|
+
s.page.style.transform = x ? `translateX(${x}px)` : '';
|
|
100
|
+
}
|
|
101
|
+
function onEnd(e) {
|
|
102
|
+
const s = swipe;
|
|
103
|
+
if (!s || !find(e.changedTouches, s.id))
|
|
104
|
+
return;
|
|
105
|
+
if (s.ours)
|
|
106
|
+
settle(e.type === 'touchend');
|
|
107
|
+
swipe = null;
|
|
108
|
+
}
|
|
109
|
+
/** Let go: finish the slide and go back, or settle where it was. */
|
|
110
|
+
function settle(released) {
|
|
111
|
+
const s = swipe;
|
|
112
|
+
if (!s)
|
|
113
|
+
return;
|
|
114
|
+
const width = host.offsetWidth || window.innerWidth;
|
|
115
|
+
const away = released && (s.dx > width * EDGE_SWIPE_PAST || (s.v > FLICK && s.dx > 16));
|
|
116
|
+
const { page, under, hidden } = s;
|
|
117
|
+
// Tidied before going back, not after: the page underneath re-renders
|
|
118
|
+
// with its own visibility once it's the top one. A page that refuses to
|
|
119
|
+
// go (it asks first) is then simply back in place.
|
|
120
|
+
const tidy = () => {
|
|
121
|
+
page.style.transition = '';
|
|
122
|
+
page.style.transform = '';
|
|
123
|
+
page.style.boxShadow = '';
|
|
124
|
+
if (under)
|
|
125
|
+
under.style.visibility = hidden;
|
|
126
|
+
};
|
|
127
|
+
if (prefersReducedMotion()) {
|
|
128
|
+
tidy();
|
|
129
|
+
if (away)
|
|
130
|
+
back.current();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
page.style.transition = 'transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1)';
|
|
134
|
+
if (away) {
|
|
135
|
+
page.style.transform = `translateX(${width + 16}px)`;
|
|
136
|
+
window.setTimeout(() => {
|
|
137
|
+
tidy();
|
|
138
|
+
back.current();
|
|
139
|
+
}, 170);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
page.style.transform = '';
|
|
143
|
+
window.setTimeout(tidy, 190);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
host.addEventListener('touchstart', onStart, { passive: true, capture: true });
|
|
147
|
+
host.addEventListener('touchmove', onMove, { passive: false, capture: true });
|
|
148
|
+
host.addEventListener('touchend', onEnd, { capture: true });
|
|
149
|
+
host.addEventListener('touchcancel', onEnd, { capture: true });
|
|
150
|
+
return () => {
|
|
151
|
+
host.removeEventListener('touchstart', onStart, { capture: true });
|
|
152
|
+
host.removeEventListener('touchmove', onMove, { capture: true });
|
|
153
|
+
host.removeEventListener('touchend', onEnd, { capture: true });
|
|
154
|
+
host.removeEventListener('touchcancel', onEnd, { capture: true });
|
|
155
|
+
};
|
|
156
|
+
}, [ref, enabled]);
|
|
157
|
+
}
|
|
158
|
+
function begin(page, under) {
|
|
159
|
+
// The page's slide-in would otherwise hold the transform while it runs.
|
|
160
|
+
page.getAnimations?.().forEach((a) => a.cancel());
|
|
161
|
+
page.style.transition = 'none';
|
|
162
|
+
page.style.boxShadow = '-8px 0 24px rgba(0,0,0,0.12)';
|
|
163
|
+
if (under)
|
|
164
|
+
under.style.visibility = 'visible';
|
|
165
|
+
}
|
|
166
|
+
function find(list, id) {
|
|
167
|
+
for (let i = 0; i < list.length; i++)
|
|
168
|
+
if (list[i].identifier === id)
|
|
169
|
+
return list[i];
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Something under the finger that does its own dragging keeps it: a drawing
|
|
174
|
+
* pad or anything else that has turned the browser's panning off, a slider,
|
|
175
|
+
* or a sideways row that has been scrolled along (a swipe right there scrolls
|
|
176
|
+
* it back, as on iOS; one at its start has nothing to scroll back to).
|
|
177
|
+
*/
|
|
178
|
+
function ownsTheGesture(target, host) {
|
|
179
|
+
for (let el = target; el && el !== host; el = el.parentElement) {
|
|
180
|
+
if (el instanceof HTMLInputElement && el.type === 'range')
|
|
181
|
+
return true;
|
|
182
|
+
const cs = getComputedStyle(el);
|
|
183
|
+
if (cs.touchAction === 'none' || cs.touchAction === 'pan-y')
|
|
184
|
+
return true;
|
|
185
|
+
if (/(auto|scroll)/.test(cs.overflowX) && el.scrollLeft > 0)
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=edgeSwipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edgeSwipe.js","sourceRoot":"","sources":["../../src/phone/edgeSwipe.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,2EAA2E;AAC3E,uEAAuE;AACvE,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,8EAA8E;AAC9E,oEAAoE;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,kEAAkE;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AACrC,qDAAqD;AACrD,MAAM,IAAI,GAAG,CAAC,CAAA;AACd,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,CAAA;AACpC,6BAA6B;AAC7B,MAAM,KAAK,GAAG,GAAG,CAAA;AAEjB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAkC,EAAE,OAAgB,EAAE,MAAkB;IACvG,MAAM,IAAI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/C,CAAC;AAED,SAAS,IAAI,CAAC,IAAe,EAAE,EAAU;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,IAAI,CAAC,CAAC,CAAE,CAAC,UAAU,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC,CAAC,CAAE,CAAA;IACrF,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CAAC,MAAe,EAAE,IAAiB;IACxD,KAAK,IAAI,EAAE,GAAmB,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC;QAC/E,IAAI,EAAE,YAAY,gBAAgB,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAA;QACtE,MAAM,EAAE,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAA;QAC/B,IAAI,EAAE,CAAC,WAAW,KAAK,MAAM,IAAI,EAAE,CAAC,WAAW,KAAK,OAAO;YAAE,OAAO,IAAI,CAAA;QACxE,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,UAAU,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;IAC1E,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -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;AA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C,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;YAC/C,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;YAC7C,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;YAC3C,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAChD,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { PhonePage } from './PhonePage.js';
|
|
2
|
+
export type { PhonePageProps } from './PhonePage.js';
|
|
3
|
+
export { BottomSheet, PhoneSheetGrip } from './BottomSheet.js';
|
|
4
|
+
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
|