@papyrus-sdk/ui-react-native 0.2.11 → 0.2.13-beta.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 CHANGED
@@ -5,10 +5,20 @@ React Native UI components for Papyrus viewers.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @papyrus-sdk/ui-react-native @papyrus-sdk/engine-native @papyrus-sdk/core @papyrus-sdk/types
8
+ npm install @papyrus-sdk/ui-react-native @papyrus-sdk/engine-native @papyrus-sdk/core @papyrus-sdk/types react-native-gesture-handler
9
9
  ```
10
10
 
11
- `@papyrus-sdk/core` and `@papyrus-sdk/types` are required peer dependencies.
11
+ `@papyrus-sdk/core`, `@papyrus-sdk/types`, and `react-native-gesture-handler` are required peer dependencies.
12
+
13
+ Wrap the app root with `GestureHandlerRootView` before rendering Papyrus components:
14
+
15
+ ```tsx
16
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
17
+
18
+ <GestureHandlerRootView style={{ flex: 1 }}>
19
+ <App />
20
+ </GestureHandlerRootView>
21
+ ```
12
22
 
13
23
  For EPUB/TXT previews on mobile:
14
24
 
@@ -52,6 +62,14 @@ await engine.load({ type: 'pdf', source: { uri: 'https://example.com/book.pdf' }
52
62
  - `logo`: custom logo node (can be icon, image, or even a `Pressable`).
53
63
  - `onLogoPress`: optional callback to make the logo area act like a button.
54
64
 
65
+ ## Icon Guidelines
66
+
67
+ - UI icons for this package live in `packages/ui-react-native/icons.tsx`.
68
+ - Prefer inline SVG paths implemented with `react-native-svg` instead of adding a new icon runtime dependency.
69
+ - When a product icon does not already exist in the file, prefer using the outline SVG from [Tabler Icons](https://tabler.io/icons) as the visual baseline and adapt it to the local `IconProps` pattern.
70
+ - Keep icons stroke-based when possible, preserve `color`/`strokeWidth` as props, and simplify paths only when needed for better balance in mobile chrome.
71
+ - If an icon is intentionally derived from Tabler, keep that shape direction consistent for nearby controls so the toolbar/bottom-bar language stays coherent.
72
+
55
73
  ## Mobile Tuning Flags
56
74
 
57
75
  Performance tuning props are available on `Viewer` and `RightSheet`:
@@ -0,0 +1,63 @@
1
+ // gesture/selectionInteraction.ts
2
+ var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
3
+ var DRAG_SELECTION_TOOLS = /* @__PURE__ */ new Set([
4
+ "highlight",
5
+ "underline",
6
+ "squiggly",
7
+ "strikeout"
8
+ ]);
9
+ var resolveAxisAutoscroll = (coordinate, size, threshold, maxStep) => {
10
+ if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;
11
+ const startDistance = clamp(coordinate, 0, size);
12
+ if (startDistance < threshold) {
13
+ const intensity = 1 - startDistance / threshold;
14
+ return -Math.round(maxStep * intensity);
15
+ }
16
+ const endDistance = clamp(size - coordinate, 0, size);
17
+ if (endDistance < threshold) {
18
+ const intensity = 1 - endDistance / threshold;
19
+ return Math.round(maxStep * intensity);
20
+ }
21
+ return 0;
22
+ };
23
+ var shouldEnableViewerScroll = ({
24
+ selectionDragActive,
25
+ gestureScrollLockActive = false
26
+ }) => !selectionDragActive && !gestureScrollLockActive;
27
+ var shouldEnableSelectionDrag = ({
28
+ activeTool,
29
+ interactionMode
30
+ }) => DRAG_SELECTION_TOOLS.has(activeTool) || activeTool === "select" && interactionMode === "select";
31
+ var isToolDockToolSelected = ({
32
+ activeTool,
33
+ interactionMode,
34
+ toolId
35
+ }) => toolId === "select" ? activeTool === "select" && interactionMode === "select" : activeTool === toolId;
36
+ var getToolDockDismissState = ({
37
+ activeTool: _activeTool,
38
+ interactionMode: _interactionMode
39
+ }) => ({
40
+ toolDockOpen: false,
41
+ activeTool: "select",
42
+ interactionMode: "pan"
43
+ });
44
+ var getSelectionEdgeAutoscroll = ({
45
+ x,
46
+ y,
47
+ width,
48
+ height,
49
+ threshold,
50
+ maxStep
51
+ }) => ({
52
+ dx: resolveAxisAutoscroll(x, width, threshold, maxStep),
53
+ dy: resolveAxisAutoscroll(y, height, threshold, maxStep)
54
+ });
55
+
56
+ export {
57
+ shouldEnableViewerScroll,
58
+ shouldEnableSelectionDrag,
59
+ isToolDockToolSelected,
60
+ getToolDockDismissState,
61
+ getSelectionEdgeAutoscroll
62
+ };
63
+ //# sourceMappingURL=chunk-KXNP73MZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../gesture/selectionInteraction.ts"],"sourcesContent":["export type ViewerScrollState = {\n selectionDragActive: boolean;\n gestureScrollLockActive?: boolean;\n};\n\nexport type SelectionGestureTool =\n | \"select\"\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n\nexport type SelectionInteractionMode = \"pan\" | \"select\";\n\nexport type SelectionGestureActivationInput = {\n activeTool: SelectionGestureTool;\n interactionMode: SelectionInteractionMode;\n};\n\nexport type ToolDockSelectionState = SelectionGestureActivationInput & {\n toolId: SelectionGestureTool;\n};\n\nexport type ToolDockDismissState = SelectionGestureActivationInput & {\n toolDockOpen: boolean;\n};\n\nexport type SelectionEdgeAutoscrollInput = {\n x: number;\n y: number;\n width: number;\n height: number;\n threshold: number;\n maxStep: number;\n};\n\nexport type SelectionEdgeAutoscroll = {\n dx: number;\n dy: number;\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nconst DRAG_SELECTION_TOOLS = new Set<SelectionGestureTool>([\n \"highlight\",\n \"underline\",\n \"squiggly\",\n \"strikeout\",\n]);\n\nconst resolveAxisAutoscroll = (\n coordinate: number,\n size: number,\n threshold: number,\n maxStep: number\n) => {\n if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;\n\n const startDistance = clamp(coordinate, 0, size);\n if (startDistance < threshold) {\n const intensity = 1 - startDistance / threshold;\n return -Math.round(maxStep * intensity);\n }\n\n const endDistance = clamp(size - coordinate, 0, size);\n if (endDistance < threshold) {\n const intensity = 1 - endDistance / threshold;\n return Math.round(maxStep * intensity);\n }\n\n return 0;\n};\n\nexport const shouldEnableViewerScroll = ({\n selectionDragActive,\n gestureScrollLockActive = false,\n}: ViewerScrollState) => !selectionDragActive && !gestureScrollLockActive;\n\nexport const shouldEnableSelectionDrag = ({\n activeTool,\n interactionMode,\n}: SelectionGestureActivationInput) =>\n DRAG_SELECTION_TOOLS.has(activeTool) ||\n (activeTool === \"select\" && interactionMode === \"select\");\n\nexport const isToolDockToolSelected = ({\n activeTool,\n interactionMode,\n toolId,\n}: ToolDockSelectionState) =>\n toolId === \"select\"\n ? activeTool === \"select\" && interactionMode === \"select\"\n : activeTool === toolId;\n\nexport const getToolDockDismissState = ({\n activeTool: _activeTool,\n interactionMode: _interactionMode,\n}: SelectionGestureActivationInput): ToolDockDismissState => ({\n toolDockOpen: false,\n activeTool: \"select\",\n interactionMode: \"pan\",\n});\n\nexport const getSelectionEdgeAutoscroll = ({\n x,\n y,\n width,\n height,\n threshold,\n maxStep,\n}: SelectionEdgeAutoscrollInput): SelectionEdgeAutoscroll => ({\n dx: resolveAxisAutoscroll(x, width, threshold, maxStep),\n dy: resolveAxisAutoscroll(y, height, threshold, maxStep),\n});\n"],"mappings":";AA4CA,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAEpC,IAAM,uBAAuB,oBAAI,IAA0B;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAwB,CAC5B,YACA,MACA,WACA,YACG;AACH,MAAI,QAAQ,KAAK,aAAa,KAAK,WAAW,EAAG,QAAO;AAExD,QAAM,gBAAgB,MAAM,YAAY,GAAG,IAAI;AAC/C,MAAI,gBAAgB,WAAW;AAC7B,UAAM,YAAY,IAAI,gBAAgB;AACtC,WAAO,CAAC,KAAK,MAAM,UAAU,SAAS;AAAA,EACxC;AAEA,QAAM,cAAc,MAAM,OAAO,YAAY,GAAG,IAAI;AACpD,MAAI,cAAc,WAAW;AAC3B,UAAM,YAAY,IAAI,cAAc;AACpC,WAAO,KAAK,MAAM,UAAU,SAAS;AAAA,EACvC;AAEA,SAAO;AACT;AAEO,IAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA,0BAA0B;AAC5B,MAAyB,CAAC,uBAAuB,CAAC;AAE3C,IAAM,4BAA4B,CAAC;AAAA,EACxC;AAAA,EACA;AACF,MACE,qBAAqB,IAAI,UAAU,KAClC,eAAe,YAAY,oBAAoB;AAE3C,IAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,MACE,WAAW,WACP,eAAe,YAAY,oBAAoB,WAC/C,eAAe;AAEd,IAAM,0BAA0B,CAAC;AAAA,EACtC,YAAY;AAAA,EACZ,iBAAiB;AACnB,OAA8D;AAAA,EAC5D,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,iBAAiB;AACnB;AAEO,IAAM,6BAA6B,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,OAA8D;AAAA,EAC5D,IAAI,sBAAsB,GAAG,OAAO,WAAW,OAAO;AAAA,EACtD,IAAI,sBAAsB,GAAG,QAAQ,WAAW,OAAO;AACzD;","names":[]}
@@ -0,0 +1,101 @@
1
+ // gesture/pinchZoom.ts
2
+ var DEFAULT_PINCH_ZOOM_BOUNDS = {
3
+ minZoom: 0.5,
4
+ maxZoom: 4
5
+ };
6
+ var PINCH_PRESS_SUPPRESSION_MS = 120;
7
+ var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
8
+ var getTouchDistance = (touches) => {
9
+ if (touches.length < 2) return 0;
10
+ const [first, second] = touches;
11
+ return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);
12
+ };
13
+ var isPinchTouchList = (touches) => touches.length === 2 && getTouchDistance(touches) > 0;
14
+ var createPinchSession = (touches, zoom, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => ({
15
+ initialDistance: Math.max(1, getTouchDistance(touches)),
16
+ initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom)
17
+ });
18
+ var resolvePinchZoomChange = (session, touches, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => {
19
+ const distance = getTouchDistance(touches);
20
+ if (distance <= 0) {
21
+ return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);
22
+ }
23
+ return clamp(
24
+ session.initialZoom * (distance / session.initialDistance),
25
+ bounds.minZoom,
26
+ bounds.maxZoom
27
+ );
28
+ };
29
+ var resolvePinchPreviewScale = (startZoom, previewZoom) => {
30
+ const safeStartZoom = Math.max(1e-4, Math.abs(startZoom));
31
+ return previewZoom / safeStartZoom;
32
+ };
33
+ var sanitizePinchPreviewScale = (value) => {
34
+ if (!Number.isFinite(value) || value <= 0) {
35
+ return 1;
36
+ }
37
+ return value;
38
+ };
39
+ var resolvePinchGestureZoom = (startZoom, scaleFactor, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => clamp(
40
+ (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) * (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),
41
+ bounds.minZoom,
42
+ bounds.maxZoom
43
+ );
44
+ var resolveAnchoredViewportOffset = ({
45
+ viewportOffset,
46
+ startScrollOffset,
47
+ startItemOffset,
48
+ startItemLength,
49
+ endItemOffset,
50
+ endItemLength,
51
+ viewportLength,
52
+ endContentLength
53
+ }) => {
54
+ const safeViewportOffset = Number.isFinite(viewportOffset) ? viewportOffset : 0;
55
+ const safeStartScrollOffset = Number.isFinite(startScrollOffset) ? startScrollOffset : 0;
56
+ const safeStartItemOffset = Number.isFinite(startItemOffset) ? startItemOffset : 0;
57
+ const safeStartItemLength = Number.isFinite(startItemLength) && startItemLength > 0 ? startItemLength : 1;
58
+ const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;
59
+ const safeEndItemLength = Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;
60
+ const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
61
+ const safeEndContentLength = Number.isFinite(endContentLength) && endContentLength > 0 ? endContentLength : safeEndItemOffset + safeEndItemLength;
62
+ const contentPoint = safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;
63
+ const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);
64
+ const anchoredContentPoint = safeEndItemOffset + normalizedPoint * safeEndItemLength;
65
+ return clamp(
66
+ anchoredContentPoint - safeViewportOffset,
67
+ 0,
68
+ Math.max(0, safeEndContentLength - safeViewportLength)
69
+ );
70
+ };
71
+ var resolveClampedScrollOffset = (offset, contentLength, viewportLength) => {
72
+ const safeOffset = Number.isFinite(offset) ? offset : 0;
73
+ const safeContentLength = Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;
74
+ const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
75
+ return clamp(
76
+ safeOffset,
77
+ 0,
78
+ Math.max(0, safeContentLength - safeViewportLength)
79
+ );
80
+ };
81
+ var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowMs = PINCH_PRESS_SUPPRESSION_MS) => {
82
+ if (typeof lastPinchEndedAt !== "number") return false;
83
+ const elapsedMs = now - lastPinchEndedAt;
84
+ return elapsedMs >= 0 && elapsedMs < windowMs;
85
+ };
86
+
87
+ export {
88
+ DEFAULT_PINCH_ZOOM_BOUNDS,
89
+ PINCH_PRESS_SUPPRESSION_MS,
90
+ getTouchDistance,
91
+ isPinchTouchList,
92
+ createPinchSession,
93
+ resolvePinchZoomChange,
94
+ resolvePinchPreviewScale,
95
+ sanitizePinchPreviewScale,
96
+ resolvePinchGestureZoom,
97
+ resolveAnchoredViewportOffset,
98
+ resolveClampedScrollOffset,
99
+ shouldSuppressPressAfterPinch
100
+ };
101
+ //# sourceMappingURL=chunk-PE5U4ZWV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../gesture/pinchZoom.ts"],"sourcesContent":["export type PinchTouchPoint = {\n pageX: number;\n pageY: number;\n};\n\nexport type PinchSession = {\n initialDistance: number;\n initialZoom: number;\n};\n\nexport type PinchZoomBounds = {\n minZoom: number;\n maxZoom: number;\n};\n\nexport type AnchoredViewportOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startItemOffset: number;\n startItemLength: number;\n endItemOffset: number;\n endItemLength: number;\n viewportLength: number;\n endContentLength: number;\n};\n\nexport const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds = {\n minZoom: 0.5,\n maxZoom: 4,\n};\nexport const PINCH_PRESS_SUPPRESSION_MS = 120;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nexport const getTouchDistance = (touches: PinchTouchPoint[]): number => {\n if (touches.length < 2) return 0;\n const [first, second] = touches;\n return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);\n};\n\nexport const isPinchTouchList = (touches: PinchTouchPoint[]): boolean =>\n touches.length === 2 && getTouchDistance(touches) > 0;\n\nexport const createPinchSession = (\n touches: PinchTouchPoint[],\n zoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchSession => ({\n initialDistance: Math.max(1, getTouchDistance(touches)),\n initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom),\n});\n\nexport const resolvePinchZoomChange = (\n session: PinchSession,\n touches: PinchTouchPoint[],\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number => {\n const distance = getTouchDistance(touches);\n if (distance <= 0) {\n return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);\n }\n\n return clamp(\n session.initialZoom * (distance / session.initialDistance),\n bounds.minZoom,\n bounds.maxZoom\n );\n};\n\nexport const resolvePinchPreviewScale = (\n startZoom: number,\n previewZoom: number\n): number => {\n const safeStartZoom = Math.max(0.0001, Math.abs(startZoom));\n return previewZoom / safeStartZoom;\n};\n\nexport const sanitizePinchPreviewScale = (value: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n return 1;\n }\n return value;\n};\n\nexport const resolvePinchGestureZoom = (\n startZoom: number,\n scaleFactor: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number =>\n clamp(\n (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) *\n (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),\n bounds.minZoom,\n bounds.maxZoom\n );\n\nexport const resolveAnchoredViewportOffset = ({\n viewportOffset,\n startScrollOffset,\n startItemOffset,\n startItemLength,\n endItemOffset,\n endItemLength,\n viewportLength,\n endContentLength,\n}: AnchoredViewportOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartItemOffset = Number.isFinite(startItemOffset)\n ? startItemOffset\n : 0;\n const safeStartItemLength =\n Number.isFinite(startItemLength) && startItemLength > 0\n ? startItemLength\n : 1;\n const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;\n const safeEndItemLength =\n Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : safeEndItemOffset + safeEndItemLength;\n\n const contentPoint =\n safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;\n const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);\n const anchoredContentPoint =\n safeEndItemOffset + normalizedPoint * safeEndItemLength;\n return clamp(\n anchoredContentPoint - safeViewportOffset,\n 0,\n Math.max(0, safeEndContentLength - safeViewportLength)\n );\n};\n\nexport const resolveClampedScrollOffset = (\n offset: number,\n contentLength: number,\n viewportLength: number\n): number => {\n const safeOffset = Number.isFinite(offset) ? offset : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n return clamp(\n safeOffset,\n 0,\n Math.max(0, safeContentLength - safeViewportLength)\n );\n};\n\nexport const shouldSuppressPressAfterPinch = (\n lastPinchEndedAt: number | null | undefined,\n now = Date.now(),\n windowMs = PINCH_PRESS_SUPPRESSION_MS\n): boolean => {\n if (typeof lastPinchEndedAt !== \"number\") return false;\n const elapsedMs = now - lastPinchEndedAt;\n return elapsedMs >= 0 && elapsedMs < windowMs;\n};\n"],"mappings":"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","names":[]}
@@ -0,0 +1,9 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __commonJS = (cb, mod) => function __require() {
3
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
+ };
5
+
6
+ export {
7
+ __commonJS
8
+ };
9
+ //# sourceMappingURL=chunk-ZD7AOCMD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,36 @@
1
+ type PinchTouchPoint = {
2
+ pageX: number;
3
+ pageY: number;
4
+ };
5
+ type PinchSession = {
6
+ initialDistance: number;
7
+ initialZoom: number;
8
+ };
9
+ type PinchZoomBounds = {
10
+ minZoom: number;
11
+ maxZoom: number;
12
+ };
13
+ type AnchoredViewportOffsetInput = {
14
+ viewportOffset: number;
15
+ startScrollOffset: number;
16
+ startItemOffset: number;
17
+ startItemLength: number;
18
+ endItemOffset: number;
19
+ endItemLength: number;
20
+ viewportLength: number;
21
+ endContentLength: number;
22
+ };
23
+ declare const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds;
24
+ declare const PINCH_PRESS_SUPPRESSION_MS = 120;
25
+ declare const getTouchDistance: (touches: PinchTouchPoint[]) => number;
26
+ declare const isPinchTouchList: (touches: PinchTouchPoint[]) => boolean;
27
+ declare const createPinchSession: (touches: PinchTouchPoint[], zoom: number, bounds?: PinchZoomBounds) => PinchSession;
28
+ declare const resolvePinchZoomChange: (session: PinchSession, touches: PinchTouchPoint[], bounds?: PinchZoomBounds) => number;
29
+ declare const resolvePinchPreviewScale: (startZoom: number, previewZoom: number) => number;
30
+ declare const sanitizePinchPreviewScale: (value: number) => number;
31
+ declare const resolvePinchGestureZoom: (startZoom: number, scaleFactor: number, bounds?: PinchZoomBounds) => number;
32
+ declare const resolveAnchoredViewportOffset: ({ viewportOffset, startScrollOffset, startItemOffset, startItemLength, endItemOffset, endItemLength, viewportLength, endContentLength, }: AnchoredViewportOffsetInput) => number;
33
+ declare const resolveClampedScrollOffset: (offset: number, contentLength: number, viewportLength: number) => number;
34
+ declare const shouldSuppressPressAfterPinch: (lastPinchEndedAt: number | null | undefined, now?: number, windowMs?: number) => boolean;
35
+
36
+ export { type AnchoredViewportOffsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, PINCH_PRESS_SUPPRESSION_MS, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchSession, getTouchDistance, isPinchTouchList, resolveAnchoredViewportOffset, resolveClampedScrollOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch };
@@ -0,0 +1,36 @@
1
+ type PinchTouchPoint = {
2
+ pageX: number;
3
+ pageY: number;
4
+ };
5
+ type PinchSession = {
6
+ initialDistance: number;
7
+ initialZoom: number;
8
+ };
9
+ type PinchZoomBounds = {
10
+ minZoom: number;
11
+ maxZoom: number;
12
+ };
13
+ type AnchoredViewportOffsetInput = {
14
+ viewportOffset: number;
15
+ startScrollOffset: number;
16
+ startItemOffset: number;
17
+ startItemLength: number;
18
+ endItemOffset: number;
19
+ endItemLength: number;
20
+ viewportLength: number;
21
+ endContentLength: number;
22
+ };
23
+ declare const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds;
24
+ declare const PINCH_PRESS_SUPPRESSION_MS = 120;
25
+ declare const getTouchDistance: (touches: PinchTouchPoint[]) => number;
26
+ declare const isPinchTouchList: (touches: PinchTouchPoint[]) => boolean;
27
+ declare const createPinchSession: (touches: PinchTouchPoint[], zoom: number, bounds?: PinchZoomBounds) => PinchSession;
28
+ declare const resolvePinchZoomChange: (session: PinchSession, touches: PinchTouchPoint[], bounds?: PinchZoomBounds) => number;
29
+ declare const resolvePinchPreviewScale: (startZoom: number, previewZoom: number) => number;
30
+ declare const sanitizePinchPreviewScale: (value: number) => number;
31
+ declare const resolvePinchGestureZoom: (startZoom: number, scaleFactor: number, bounds?: PinchZoomBounds) => number;
32
+ declare const resolveAnchoredViewportOffset: ({ viewportOffset, startScrollOffset, startItemOffset, startItemLength, endItemOffset, endItemLength, viewportLength, endContentLength, }: AnchoredViewportOffsetInput) => number;
33
+ declare const resolveClampedScrollOffset: (offset: number, contentLength: number, viewportLength: number) => number;
34
+ declare const shouldSuppressPressAfterPinch: (lastPinchEndedAt: number | null | undefined, now?: number, windowMs?: number) => boolean;
35
+
36
+ export { type AnchoredViewportOffsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, PINCH_PRESS_SUPPRESSION_MS, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchSession, getTouchDistance, isPinchTouchList, resolveAnchoredViewportOffset, resolveClampedScrollOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch };
@@ -0,0 +1,135 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // gesture/pinchZoom.ts
20
+ var pinchZoom_exports = {};
21
+ __export(pinchZoom_exports, {
22
+ DEFAULT_PINCH_ZOOM_BOUNDS: () => DEFAULT_PINCH_ZOOM_BOUNDS,
23
+ PINCH_PRESS_SUPPRESSION_MS: () => PINCH_PRESS_SUPPRESSION_MS,
24
+ createPinchSession: () => createPinchSession,
25
+ getTouchDistance: () => getTouchDistance,
26
+ isPinchTouchList: () => isPinchTouchList,
27
+ resolveAnchoredViewportOffset: () => resolveAnchoredViewportOffset,
28
+ resolveClampedScrollOffset: () => resolveClampedScrollOffset,
29
+ resolvePinchGestureZoom: () => resolvePinchGestureZoom,
30
+ resolvePinchPreviewScale: () => resolvePinchPreviewScale,
31
+ resolvePinchZoomChange: () => resolvePinchZoomChange,
32
+ sanitizePinchPreviewScale: () => sanitizePinchPreviewScale,
33
+ shouldSuppressPressAfterPinch: () => shouldSuppressPressAfterPinch
34
+ });
35
+ module.exports = __toCommonJS(pinchZoom_exports);
36
+ var DEFAULT_PINCH_ZOOM_BOUNDS = {
37
+ minZoom: 0.5,
38
+ maxZoom: 4
39
+ };
40
+ var PINCH_PRESS_SUPPRESSION_MS = 120;
41
+ var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
42
+ var getTouchDistance = (touches) => {
43
+ if (touches.length < 2) return 0;
44
+ const [first, second] = touches;
45
+ return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);
46
+ };
47
+ var isPinchTouchList = (touches) => touches.length === 2 && getTouchDistance(touches) > 0;
48
+ var createPinchSession = (touches, zoom, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => ({
49
+ initialDistance: Math.max(1, getTouchDistance(touches)),
50
+ initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom)
51
+ });
52
+ var resolvePinchZoomChange = (session, touches, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => {
53
+ const distance = getTouchDistance(touches);
54
+ if (distance <= 0) {
55
+ return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);
56
+ }
57
+ return clamp(
58
+ session.initialZoom * (distance / session.initialDistance),
59
+ bounds.minZoom,
60
+ bounds.maxZoom
61
+ );
62
+ };
63
+ var resolvePinchPreviewScale = (startZoom, previewZoom) => {
64
+ const safeStartZoom = Math.max(1e-4, Math.abs(startZoom));
65
+ return previewZoom / safeStartZoom;
66
+ };
67
+ var sanitizePinchPreviewScale = (value) => {
68
+ if (!Number.isFinite(value) || value <= 0) {
69
+ return 1;
70
+ }
71
+ return value;
72
+ };
73
+ var resolvePinchGestureZoom = (startZoom, scaleFactor, bounds = DEFAULT_PINCH_ZOOM_BOUNDS) => clamp(
74
+ (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) * (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),
75
+ bounds.minZoom,
76
+ bounds.maxZoom
77
+ );
78
+ var resolveAnchoredViewportOffset = ({
79
+ viewportOffset,
80
+ startScrollOffset,
81
+ startItemOffset,
82
+ startItemLength,
83
+ endItemOffset,
84
+ endItemLength,
85
+ viewportLength,
86
+ endContentLength
87
+ }) => {
88
+ const safeViewportOffset = Number.isFinite(viewportOffset) ? viewportOffset : 0;
89
+ const safeStartScrollOffset = Number.isFinite(startScrollOffset) ? startScrollOffset : 0;
90
+ const safeStartItemOffset = Number.isFinite(startItemOffset) ? startItemOffset : 0;
91
+ const safeStartItemLength = Number.isFinite(startItemLength) && startItemLength > 0 ? startItemLength : 1;
92
+ const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;
93
+ const safeEndItemLength = Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;
94
+ const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
95
+ const safeEndContentLength = Number.isFinite(endContentLength) && endContentLength > 0 ? endContentLength : safeEndItemOffset + safeEndItemLength;
96
+ const contentPoint = safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;
97
+ const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);
98
+ const anchoredContentPoint = safeEndItemOffset + normalizedPoint * safeEndItemLength;
99
+ return clamp(
100
+ anchoredContentPoint - safeViewportOffset,
101
+ 0,
102
+ Math.max(0, safeEndContentLength - safeViewportLength)
103
+ );
104
+ };
105
+ var resolveClampedScrollOffset = (offset, contentLength, viewportLength) => {
106
+ const safeOffset = Number.isFinite(offset) ? offset : 0;
107
+ const safeContentLength = Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;
108
+ const safeViewportLength = Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;
109
+ return clamp(
110
+ safeOffset,
111
+ 0,
112
+ Math.max(0, safeContentLength - safeViewportLength)
113
+ );
114
+ };
115
+ var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowMs = PINCH_PRESS_SUPPRESSION_MS) => {
116
+ if (typeof lastPinchEndedAt !== "number") return false;
117
+ const elapsedMs = now - lastPinchEndedAt;
118
+ return elapsedMs >= 0 && elapsedMs < windowMs;
119
+ };
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ DEFAULT_PINCH_ZOOM_BOUNDS,
123
+ PINCH_PRESS_SUPPRESSION_MS,
124
+ createPinchSession,
125
+ getTouchDistance,
126
+ isPinchTouchList,
127
+ resolveAnchoredViewportOffset,
128
+ resolveClampedScrollOffset,
129
+ resolvePinchGestureZoom,
130
+ resolvePinchPreviewScale,
131
+ resolvePinchZoomChange,
132
+ sanitizePinchPreviewScale,
133
+ shouldSuppressPressAfterPinch
134
+ });
135
+ //# sourceMappingURL=pinchZoom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../gesture/pinchZoom.ts"],"sourcesContent":["export type PinchTouchPoint = {\n pageX: number;\n pageY: number;\n};\n\nexport type PinchSession = {\n initialDistance: number;\n initialZoom: number;\n};\n\nexport type PinchZoomBounds = {\n minZoom: number;\n maxZoom: number;\n};\n\nexport type AnchoredViewportOffsetInput = {\n viewportOffset: number;\n startScrollOffset: number;\n startItemOffset: number;\n startItemLength: number;\n endItemOffset: number;\n endItemLength: number;\n viewportLength: number;\n endContentLength: number;\n};\n\nexport const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds = {\n minZoom: 0.5,\n maxZoom: 4,\n};\nexport const PINCH_PRESS_SUPPRESSION_MS = 120;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nexport const getTouchDistance = (touches: PinchTouchPoint[]): number => {\n if (touches.length < 2) return 0;\n const [first, second] = touches;\n return Math.hypot(second.pageX - first.pageX, second.pageY - first.pageY);\n};\n\nexport const isPinchTouchList = (touches: PinchTouchPoint[]): boolean =>\n touches.length === 2 && getTouchDistance(touches) > 0;\n\nexport const createPinchSession = (\n touches: PinchTouchPoint[],\n zoom: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): PinchSession => ({\n initialDistance: Math.max(1, getTouchDistance(touches)),\n initialZoom: clamp(zoom, bounds.minZoom, bounds.maxZoom),\n});\n\nexport const resolvePinchZoomChange = (\n session: PinchSession,\n touches: PinchTouchPoint[],\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number => {\n const distance = getTouchDistance(touches);\n if (distance <= 0) {\n return clamp(session.initialZoom, bounds.minZoom, bounds.maxZoom);\n }\n\n return clamp(\n session.initialZoom * (distance / session.initialDistance),\n bounds.minZoom,\n bounds.maxZoom\n );\n};\n\nexport const resolvePinchPreviewScale = (\n startZoom: number,\n previewZoom: number\n): number => {\n const safeStartZoom = Math.max(0.0001, Math.abs(startZoom));\n return previewZoom / safeStartZoom;\n};\n\nexport const sanitizePinchPreviewScale = (value: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n return 1;\n }\n return value;\n};\n\nexport const resolvePinchGestureZoom = (\n startZoom: number,\n scaleFactor: number,\n bounds: PinchZoomBounds = DEFAULT_PINCH_ZOOM_BOUNDS\n): number =>\n clamp(\n (Number.isFinite(startZoom) && startZoom > 0 ? startZoom : 1) *\n (Number.isFinite(scaleFactor) && scaleFactor > 0 ? scaleFactor : 1),\n bounds.minZoom,\n bounds.maxZoom\n );\n\nexport const resolveAnchoredViewportOffset = ({\n viewportOffset,\n startScrollOffset,\n startItemOffset,\n startItemLength,\n endItemOffset,\n endItemLength,\n viewportLength,\n endContentLength,\n}: AnchoredViewportOffsetInput): number => {\n const safeViewportOffset = Number.isFinite(viewportOffset)\n ? viewportOffset\n : 0;\n const safeStartScrollOffset = Number.isFinite(startScrollOffset)\n ? startScrollOffset\n : 0;\n const safeStartItemOffset = Number.isFinite(startItemOffset)\n ? startItemOffset\n : 0;\n const safeStartItemLength =\n Number.isFinite(startItemLength) && startItemLength > 0\n ? startItemLength\n : 1;\n const safeEndItemOffset = Number.isFinite(endItemOffset) ? endItemOffset : 0;\n const safeEndItemLength =\n Number.isFinite(endItemLength) && endItemLength > 0 ? endItemLength : 1;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n const safeEndContentLength =\n Number.isFinite(endContentLength) && endContentLength > 0\n ? endContentLength\n : safeEndItemOffset + safeEndItemLength;\n\n const contentPoint =\n safeStartScrollOffset + safeViewportOffset - safeStartItemOffset;\n const normalizedPoint = clamp(contentPoint / safeStartItemLength, 0, 1);\n const anchoredContentPoint =\n safeEndItemOffset + normalizedPoint * safeEndItemLength;\n return clamp(\n anchoredContentPoint - safeViewportOffset,\n 0,\n Math.max(0, safeEndContentLength - safeViewportLength)\n );\n};\n\nexport const resolveClampedScrollOffset = (\n offset: number,\n contentLength: number,\n viewportLength: number\n): number => {\n const safeOffset = Number.isFinite(offset) ? offset : 0;\n const safeContentLength =\n Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;\n const safeViewportLength =\n Number.isFinite(viewportLength) && viewportLength > 0 ? viewportLength : 0;\n return clamp(\n safeOffset,\n 0,\n Math.max(0, safeContentLength - safeViewportLength)\n );\n};\n\nexport const shouldSuppressPressAfterPinch = (\n lastPinchEndedAt: number | null | undefined,\n now = Date.now(),\n windowMs = PINCH_PRESS_SUPPRESSION_MS\n): boolean => {\n if (typeof lastPinchEndedAt !== \"number\") return false;\n const elapsedMs = now - lastPinchEndedAt;\n return elapsedMs >= 0 && elapsedMs < windowMs;\n};\n"],"mappings":"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","names":[]}
@@ -0,0 +1,30 @@
1
+ import {
2
+ DEFAULT_PINCH_ZOOM_BOUNDS,
3
+ PINCH_PRESS_SUPPRESSION_MS,
4
+ createPinchSession,
5
+ getTouchDistance,
6
+ isPinchTouchList,
7
+ resolveAnchoredViewportOffset,
8
+ resolveClampedScrollOffset,
9
+ resolvePinchGestureZoom,
10
+ resolvePinchPreviewScale,
11
+ resolvePinchZoomChange,
12
+ sanitizePinchPreviewScale,
13
+ shouldSuppressPressAfterPinch
14
+ } from "../chunk-PE5U4ZWV.mjs";
15
+ import "../chunk-ZD7AOCMD.mjs";
16
+ export {
17
+ DEFAULT_PINCH_ZOOM_BOUNDS,
18
+ PINCH_PRESS_SUPPRESSION_MS,
19
+ createPinchSession,
20
+ getTouchDistance,
21
+ isPinchTouchList,
22
+ resolveAnchoredViewportOffset,
23
+ resolveClampedScrollOffset,
24
+ resolvePinchGestureZoom,
25
+ resolvePinchPreviewScale,
26
+ resolvePinchZoomChange,
27
+ sanitizePinchPreviewScale,
28
+ shouldSuppressPressAfterPinch
29
+ };
30
+ //# sourceMappingURL=pinchZoom.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,35 @@
1
+ type ViewerScrollState = {
2
+ selectionDragActive: boolean;
3
+ gestureScrollLockActive?: boolean;
4
+ };
5
+ type SelectionGestureTool = "select" | "highlight" | "underline" | "squiggly" | "strikeout" | "text" | "comment" | "ink";
6
+ type SelectionInteractionMode = "pan" | "select";
7
+ type SelectionGestureActivationInput = {
8
+ activeTool: SelectionGestureTool;
9
+ interactionMode: SelectionInteractionMode;
10
+ };
11
+ type ToolDockSelectionState = SelectionGestureActivationInput & {
12
+ toolId: SelectionGestureTool;
13
+ };
14
+ type ToolDockDismissState = SelectionGestureActivationInput & {
15
+ toolDockOpen: boolean;
16
+ };
17
+ type SelectionEdgeAutoscrollInput = {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ threshold: number;
23
+ maxStep: number;
24
+ };
25
+ type SelectionEdgeAutoscroll = {
26
+ dx: number;
27
+ dy: number;
28
+ };
29
+ declare const shouldEnableViewerScroll: ({ selectionDragActive, gestureScrollLockActive, }: ViewerScrollState) => boolean;
30
+ declare const shouldEnableSelectionDrag: ({ activeTool, interactionMode, }: SelectionGestureActivationInput) => boolean;
31
+ declare const isToolDockToolSelected: ({ activeTool, interactionMode, toolId, }: ToolDockSelectionState) => boolean;
32
+ declare const getToolDockDismissState: ({ activeTool: _activeTool, interactionMode: _interactionMode, }: SelectionGestureActivationInput) => ToolDockDismissState;
33
+ declare const getSelectionEdgeAutoscroll: ({ x, y, width, height, threshold, maxStep, }: SelectionEdgeAutoscrollInput) => SelectionEdgeAutoscroll;
34
+
35
+ export { type SelectionEdgeAutoscroll, type SelectionEdgeAutoscrollInput, type SelectionGestureActivationInput, type SelectionGestureTool, type SelectionInteractionMode, type ToolDockDismissState, type ToolDockSelectionState, type ViewerScrollState, getSelectionEdgeAutoscroll, getToolDockDismissState, isToolDockToolSelected, shouldEnableSelectionDrag, shouldEnableViewerScroll };
@@ -0,0 +1,35 @@
1
+ type ViewerScrollState = {
2
+ selectionDragActive: boolean;
3
+ gestureScrollLockActive?: boolean;
4
+ };
5
+ type SelectionGestureTool = "select" | "highlight" | "underline" | "squiggly" | "strikeout" | "text" | "comment" | "ink";
6
+ type SelectionInteractionMode = "pan" | "select";
7
+ type SelectionGestureActivationInput = {
8
+ activeTool: SelectionGestureTool;
9
+ interactionMode: SelectionInteractionMode;
10
+ };
11
+ type ToolDockSelectionState = SelectionGestureActivationInput & {
12
+ toolId: SelectionGestureTool;
13
+ };
14
+ type ToolDockDismissState = SelectionGestureActivationInput & {
15
+ toolDockOpen: boolean;
16
+ };
17
+ type SelectionEdgeAutoscrollInput = {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ threshold: number;
23
+ maxStep: number;
24
+ };
25
+ type SelectionEdgeAutoscroll = {
26
+ dx: number;
27
+ dy: number;
28
+ };
29
+ declare const shouldEnableViewerScroll: ({ selectionDragActive, gestureScrollLockActive, }: ViewerScrollState) => boolean;
30
+ declare const shouldEnableSelectionDrag: ({ activeTool, interactionMode, }: SelectionGestureActivationInput) => boolean;
31
+ declare const isToolDockToolSelected: ({ activeTool, interactionMode, toolId, }: ToolDockSelectionState) => boolean;
32
+ declare const getToolDockDismissState: ({ activeTool: _activeTool, interactionMode: _interactionMode, }: SelectionGestureActivationInput) => ToolDockDismissState;
33
+ declare const getSelectionEdgeAutoscroll: ({ x, y, width, height, threshold, maxStep, }: SelectionEdgeAutoscrollInput) => SelectionEdgeAutoscroll;
34
+
35
+ export { type SelectionEdgeAutoscroll, type SelectionEdgeAutoscrollInput, type SelectionGestureActivationInput, type SelectionGestureTool, type SelectionInteractionMode, type ToolDockDismissState, type ToolDockSelectionState, type ViewerScrollState, getSelectionEdgeAutoscroll, getToolDockDismissState, isToolDockToolSelected, shouldEnableSelectionDrag, shouldEnableViewerScroll };