@papyrus-sdk/ui-react-native 0.2.15 → 0.2.17

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.
@@ -78,6 +78,24 @@ var resolveClampedScrollOffset = (offset, contentLength, viewportLength) => {
78
78
  Math.max(0, safeContentLength - safeViewportLength)
79
79
  );
80
80
  };
81
+ var resolveDocumentSurfaceWidth = ({
82
+ viewportWidth,
83
+ contentWidth,
84
+ horizontalPadding
85
+ }) => {
86
+ const safeViewportWidth = Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;
87
+ const safeContentWidth = Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;
88
+ const safeHorizontalPadding = Number.isFinite(horizontalPadding) && horizontalPadding > 0 ? horizontalPadding : 0;
89
+ return Math.max(
90
+ safeViewportWidth,
91
+ safeContentWidth + safeHorizontalPadding * 2
92
+ );
93
+ };
94
+ var resolveGlobalHorizontalOffset = ({
95
+ offsetX,
96
+ surfaceWidth,
97
+ viewportWidth
98
+ }) => resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);
81
99
  var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowMs = PINCH_PRESS_SUPPRESSION_MS) => {
82
100
  if (typeof lastPinchEndedAt !== "number") return false;
83
101
  const elapsedMs = now - lastPinchEndedAt;
@@ -96,6 +114,8 @@ export {
96
114
  resolvePinchGestureZoom,
97
115
  resolveAnchoredViewportOffset,
98
116
  resolveClampedScrollOffset,
117
+ resolveDocumentSurfaceWidth,
118
+ resolveGlobalHorizontalOffset,
99
119
  shouldSuppressPressAfterPinch
100
120
  };
101
- //# sourceMappingURL=chunk-PE5U4ZWV.mjs.map
121
+ //# sourceMappingURL=chunk-3IPQ5HO7.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 type DocumentSurfaceWidthInput = {\n viewportWidth: number;\n contentWidth: number;\n horizontalPadding: number;\n};\n\nexport type GlobalHorizontalOffsetInput = {\n offsetX: number;\n surfaceWidth: number;\n viewportWidth: 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 resolveDocumentSurfaceWidth = ({\n viewportWidth,\n contentWidth,\n horizontalPadding,\n}: DocumentSurfaceWidthInput): number => {\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n const safeContentWidth =\n Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;\n const safeHorizontalPadding =\n Number.isFinite(horizontalPadding) && horizontalPadding > 0\n ? horizontalPadding\n : 0;\n\n return Math.max(\n safeViewportWidth,\n safeContentWidth + safeHorizontalPadding * 2\n );\n};\n\nexport const resolveGlobalHorizontalOffset = ({\n offsetX,\n surfaceWidth,\n viewportWidth,\n}: GlobalHorizontalOffsetInput): number =>\n resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);\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":";AAsCO,IAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AACX;AACO,IAAM,6BAA6B;AAE1C,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,mBAAmB,CAAC,YAAuC;AACtE,MAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,MAAM,IAAI;AACxB,SAAO,KAAK,MAAM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AAA,IACV;AAAA,IACA,mBAAmB,wBAAwB;AAAA,EAC7C;AACF;AAEO,IAAM,gCAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AACF,MACE,2BAA2B,SAAS,cAAc,aAAa;AAE1D,IAAM,gCAAgC,CAC3C,kBACA,MAAM,KAAK,IAAI,GACf,WAAW,+BACC;AACZ,MAAI,OAAO,qBAAqB,SAAU,QAAO;AACjD,QAAM,YAAY,MAAM;AACxB,SAAO,aAAa,KAAK,YAAY;AACvC;","names":[]}
@@ -20,6 +20,16 @@ type AnchoredViewportOffsetInput = {
20
20
  viewportLength: number;
21
21
  endContentLength: number;
22
22
  };
23
+ type DocumentSurfaceWidthInput = {
24
+ viewportWidth: number;
25
+ contentWidth: number;
26
+ horizontalPadding: number;
27
+ };
28
+ type GlobalHorizontalOffsetInput = {
29
+ offsetX: number;
30
+ surfaceWidth: number;
31
+ viewportWidth: number;
32
+ };
23
33
  declare const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds;
24
34
  declare const PINCH_PRESS_SUPPRESSION_MS = 120;
25
35
  declare const getTouchDistance: (touches: PinchTouchPoint[]) => number;
@@ -31,6 +41,8 @@ declare const sanitizePinchPreviewScale: (value: number) => number;
31
41
  declare const resolvePinchGestureZoom: (startZoom: number, scaleFactor: number, bounds?: PinchZoomBounds) => number;
32
42
  declare const resolveAnchoredViewportOffset: ({ viewportOffset, startScrollOffset, startItemOffset, startItemLength, endItemOffset, endItemLength, viewportLength, endContentLength, }: AnchoredViewportOffsetInput) => number;
33
43
  declare const resolveClampedScrollOffset: (offset: number, contentLength: number, viewportLength: number) => number;
44
+ declare const resolveDocumentSurfaceWidth: ({ viewportWidth, contentWidth, horizontalPadding, }: DocumentSurfaceWidthInput) => number;
45
+ declare const resolveGlobalHorizontalOffset: ({ offsetX, surfaceWidth, viewportWidth, }: GlobalHorizontalOffsetInput) => number;
34
46
  declare const shouldSuppressPressAfterPinch: (lastPinchEndedAt: number | null | undefined, now?: number, windowMs?: number) => boolean;
35
47
 
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 };
48
+ export { type AnchoredViewportOffsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, type DocumentSurfaceWidthInput, type GlobalHorizontalOffsetInput, PINCH_PRESS_SUPPRESSION_MS, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchSession, getTouchDistance, isPinchTouchList, resolveAnchoredViewportOffset, resolveClampedScrollOffset, resolveDocumentSurfaceWidth, resolveGlobalHorizontalOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch };
@@ -20,6 +20,16 @@ type AnchoredViewportOffsetInput = {
20
20
  viewportLength: number;
21
21
  endContentLength: number;
22
22
  };
23
+ type DocumentSurfaceWidthInput = {
24
+ viewportWidth: number;
25
+ contentWidth: number;
26
+ horizontalPadding: number;
27
+ };
28
+ type GlobalHorizontalOffsetInput = {
29
+ offsetX: number;
30
+ surfaceWidth: number;
31
+ viewportWidth: number;
32
+ };
23
33
  declare const DEFAULT_PINCH_ZOOM_BOUNDS: PinchZoomBounds;
24
34
  declare const PINCH_PRESS_SUPPRESSION_MS = 120;
25
35
  declare const getTouchDistance: (touches: PinchTouchPoint[]) => number;
@@ -31,6 +41,8 @@ declare const sanitizePinchPreviewScale: (value: number) => number;
31
41
  declare const resolvePinchGestureZoom: (startZoom: number, scaleFactor: number, bounds?: PinchZoomBounds) => number;
32
42
  declare const resolveAnchoredViewportOffset: ({ viewportOffset, startScrollOffset, startItemOffset, startItemLength, endItemOffset, endItemLength, viewportLength, endContentLength, }: AnchoredViewportOffsetInput) => number;
33
43
  declare const resolveClampedScrollOffset: (offset: number, contentLength: number, viewportLength: number) => number;
44
+ declare const resolveDocumentSurfaceWidth: ({ viewportWidth, contentWidth, horizontalPadding, }: DocumentSurfaceWidthInput) => number;
45
+ declare const resolveGlobalHorizontalOffset: ({ offsetX, surfaceWidth, viewportWidth, }: GlobalHorizontalOffsetInput) => number;
34
46
  declare const shouldSuppressPressAfterPinch: (lastPinchEndedAt: number | null | undefined, now?: number, windowMs?: number) => boolean;
35
47
 
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 };
48
+ export { type AnchoredViewportOffsetInput, DEFAULT_PINCH_ZOOM_BOUNDS, type DocumentSurfaceWidthInput, type GlobalHorizontalOffsetInput, PINCH_PRESS_SUPPRESSION_MS, type PinchSession, type PinchTouchPoint, type PinchZoomBounds, createPinchSession, getTouchDistance, isPinchTouchList, resolveAnchoredViewportOffset, resolveClampedScrollOffset, resolveDocumentSurfaceWidth, resolveGlobalHorizontalOffset, resolvePinchGestureZoom, resolvePinchPreviewScale, resolvePinchZoomChange, sanitizePinchPreviewScale, shouldSuppressPressAfterPinch };
@@ -26,6 +26,8 @@ __export(pinchZoom_exports, {
26
26
  isPinchTouchList: () => isPinchTouchList,
27
27
  resolveAnchoredViewportOffset: () => resolveAnchoredViewportOffset,
28
28
  resolveClampedScrollOffset: () => resolveClampedScrollOffset,
29
+ resolveDocumentSurfaceWidth: () => resolveDocumentSurfaceWidth,
30
+ resolveGlobalHorizontalOffset: () => resolveGlobalHorizontalOffset,
29
31
  resolvePinchGestureZoom: () => resolvePinchGestureZoom,
30
32
  resolvePinchPreviewScale: () => resolvePinchPreviewScale,
31
33
  resolvePinchZoomChange: () => resolvePinchZoomChange,
@@ -112,6 +114,24 @@ var resolveClampedScrollOffset = (offset, contentLength, viewportLength) => {
112
114
  Math.max(0, safeContentLength - safeViewportLength)
113
115
  );
114
116
  };
117
+ var resolveDocumentSurfaceWidth = ({
118
+ viewportWidth,
119
+ contentWidth,
120
+ horizontalPadding
121
+ }) => {
122
+ const safeViewportWidth = Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;
123
+ const safeContentWidth = Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;
124
+ const safeHorizontalPadding = Number.isFinite(horizontalPadding) && horizontalPadding > 0 ? horizontalPadding : 0;
125
+ return Math.max(
126
+ safeViewportWidth,
127
+ safeContentWidth + safeHorizontalPadding * 2
128
+ );
129
+ };
130
+ var resolveGlobalHorizontalOffset = ({
131
+ offsetX,
132
+ surfaceWidth,
133
+ viewportWidth
134
+ }) => resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);
115
135
  var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowMs = PINCH_PRESS_SUPPRESSION_MS) => {
116
136
  if (typeof lastPinchEndedAt !== "number") return false;
117
137
  const elapsedMs = now - lastPinchEndedAt;
@@ -126,6 +146,8 @@ var shouldSuppressPressAfterPinch = (lastPinchEndedAt, now = Date.now(), windowM
126
146
  isPinchTouchList,
127
147
  resolveAnchoredViewportOffset,
128
148
  resolveClampedScrollOffset,
149
+ resolveDocumentSurfaceWidth,
150
+ resolveGlobalHorizontalOffset,
129
151
  resolvePinchGestureZoom,
130
152
  resolvePinchPreviewScale,
131
153
  resolvePinchZoomChange,
@@ -1 +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":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BO,IAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AACX;AACO,IAAM,6BAA6B;AAE1C,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,mBAAmB,CAAC,YAAuC;AACtE,MAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,MAAM,IAAI;AACxB,SAAO,KAAK,MAAM,OAAO,QAAQ,MAAM,OAAO,OAAO,QAAQ,MAAM,KAAK;AAC1E;AAEO,IAAM,mBAAmB,CAAC,YAC/B,QAAQ,WAAW,KAAK,iBAAiB,OAAO,IAAI;AAE/C,IAAM,qBAAqB,CAChC,SACA,MACA,SAA0B,+BACR;AAAA,EAClB,iBAAiB,KAAK,IAAI,GAAG,iBAAiB,OAAO,CAAC;AAAA,EACtD,aAAa,MAAM,MAAM,OAAO,SAAS,OAAO,OAAO;AACzD;AAEO,IAAM,yBAAyB,CACpC,SACA,SACA,SAA0B,8BACf;AACX,QAAM,WAAW,iBAAiB,OAAO;AACzC,MAAI,YAAY,GAAG;AACjB,WAAO,MAAM,QAAQ,aAAa,OAAO,SAAS,OAAO,OAAO;AAAA,EAClE;AAEA,SAAO;AAAA,IACL,QAAQ,eAAe,WAAW,QAAQ;AAAA,IAC1C,OAAO;AAAA,IACP,OAA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,IACvB;AAAA,IACA,KAAK,IAAI,GAAG,uBAAuB,kBAAkB;AAAA,EACvD;AACF;AAEO,IAAM,6BAA6B,CACxC,QACA,eACA,mBACW;AACX,QAAM,aAAa,OAAO,SAAS,MAAM,IAAI,SAAS;AACtD,QAAM,oBACJ,OAAO,SAAS,aAAa,KAAK,gBAAgB,IAAI,gBAAgB;AACxE,QAAM,qBACJ,OAAO,SAAS,cAAc,KAAK,iBAAiB,IAAI,iBAAiB;AAC3E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,KAAK,IAAI,GAAG,oBAAoB,kBAAkB;AAAA,EACpD;AACF;AAEO,IAAM,gCAAgC,CAC3C,kBACA,MAAM,KAAK,IAAI,GACf,WAAW,+BACC;AACZ,MAAI,OAAO,qBAAqB,SAAU,QAAO;AACjD,QAAM,YAAY,MAAM;AACxB,SAAO,aAAa,KAAK,YAAY;AACvC;","names":[]}
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 type DocumentSurfaceWidthInput = {\n viewportWidth: number;\n contentWidth: number;\n horizontalPadding: number;\n};\n\nexport type GlobalHorizontalOffsetInput = {\n offsetX: number;\n surfaceWidth: number;\n viewportWidth: 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 resolveDocumentSurfaceWidth = ({\n viewportWidth,\n contentWidth,\n horizontalPadding,\n}: DocumentSurfaceWidthInput): number => {\n const safeViewportWidth =\n Number.isFinite(viewportWidth) && viewportWidth > 0 ? viewportWidth : 0;\n const safeContentWidth =\n Number.isFinite(contentWidth) && contentWidth > 0 ? contentWidth : 0;\n const safeHorizontalPadding =\n Number.isFinite(horizontalPadding) && horizontalPadding > 0\n ? horizontalPadding\n : 0;\n\n return Math.max(\n safeViewportWidth,\n safeContentWidth + safeHorizontalPadding * 2\n );\n};\n\nexport const resolveGlobalHorizontalOffset = ({\n offsetX,\n surfaceWidth,\n viewportWidth,\n}: GlobalHorizontalOffsetInput): number =>\n resolveClampedScrollOffset(offsetX, surfaceWidth, viewportWidth);\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":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsCO,IAAM,4BAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AACX;AACO,IAAM,6BAA6B;AAE1C,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAE7B,IAAM,mBAAmB,CAAC,YAAuC;AACtE,MAAI,QAAQ,SAAS,EAAG,QAAO;AAC/B,QAAM,CAAC,OAAO,MAAM,IAAI;AACxB,SAAO,KAAK,MAAM,OAAO,QAAQ,MAAM,OAAO,OAAO,QAAQ,MAAM,KAAK;AAC1E;AAEO,IAAM,mBAAmB,CAAC,YAC/B,QAAQ,WAAW,KAAK,iBAAiB,OAAO,IAAI;AAE/C,IAAM,qBAAqB,CAChC,SACA,MACA,SAA0B,+BACR;AAAA,EAClB,iBAAiB,KAAK,IAAI,GAAG,iBAAiB,OAAO,CAAC;AAAA,EACtD,aAAa,MAAM,MAAM,OAAO,SAAS,OAAO,OAAO;AACzD;AAEO,IAAM,yBAAyB,CACpC,SACA,SACA,SAA0B,8BACf;AACX,QAAM,WAAW,iBAAiB,OAAO;AACzC,MAAI,YAAY,GAAG;AACjB,WAAO,MAAM,QAAQ,aA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/C,QAAM,kBAAkB,MAAM,eAAe,qBAAqB,GAAG,CAAC;AACtE,QAAM,uBACJ,oBAAoB,kBAAkB;AACxC,SAAO;AAAA,IACL,uBAAuB;AAAA,IACvB;AAAA,IACA,KAAK,IAAI,GAAG,uBAAuB,kBAAkB;AAAA,EACvD;AACF;AAEO,IAAM,6BAA6B,CACxC,QACA,eACA,mBACW;AACX,QAAM,aAAa,OAAO,SAAS,MAAM,IAAI,SAAS;AACtD,QAAM,oBACJ,OAAO,SAAS,aAAa,KAAK,gBAAgB,IAAI,gBAAgB;AACxE,QAAM,qBACJ,OAAO,SAAS,cAAc,KAAK,iBAAiB,IAAI,iBAAiB;AAC3E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,KAAK,IAAI,GAAG,oBAAoB,kBAAkB;AAAA,EACpD;AACF;AAEO,IAAM,8BAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AACF,MAAyC;AACvC,QAAM,oBACJ,OAAO,SAAS,aAAa,KAAK,gBAAgB,IAAI,gBAAgB;AACxE,QAAM,mBACJ,OAAO,SAAS,YAAY,KAAK,eAAe,IAAI,eAAe;AACrE,QAAM,wBACJ,OAAO,SAAS,iBAAiB,KAAK,oBAAoB,IACtD,oBACA;AAEN,SAAO,KAAK;AAAA,IACV;AAAA,IACA,mBAAmB,wBAAwB;AAAA,EAC7C;AACF;AAEO,IAAM,gCAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AACF,MACE,2BAA2B,SAAS,cAAc,aAAa;AAE1D,IAAM,gCAAgC,CAC3C,kBACA,MAAM,KAAK,IAAI,GACf,WAAW,+BACC;AACZ,MAAI,OAAO,qBAAqB,SAAU,QAAO;AACjD,QAAM,YAAY,MAAM;AACxB,SAAO,aAAa,KAAK,YAAY;AACvC;","names":[]}
@@ -6,12 +6,14 @@ import {
6
6
  isPinchTouchList,
7
7
  resolveAnchoredViewportOffset,
8
8
  resolveClampedScrollOffset,
9
+ resolveDocumentSurfaceWidth,
10
+ resolveGlobalHorizontalOffset,
9
11
  resolvePinchGestureZoom,
10
12
  resolvePinchPreviewScale,
11
13
  resolvePinchZoomChange,
12
14
  sanitizePinchPreviewScale,
13
15
  shouldSuppressPressAfterPinch
14
- } from "../chunk-PE5U4ZWV.mjs";
16
+ } from "../chunk-3IPQ5HO7.mjs";
15
17
  import "../chunk-ZD7AOCMD.mjs";
16
18
  export {
17
19
  DEFAULT_PINCH_ZOOM_BOUNDS,
@@ -21,6 +23,8 @@ export {
21
23
  isPinchTouchList,
22
24
  resolveAnchoredViewportOffset,
23
25
  resolveClampedScrollOffset,
26
+ resolveDocumentSurfaceWidth,
27
+ resolveGlobalHorizontalOffset,
24
28
  resolvePinchGestureZoom,
25
29
  resolvePinchPreviewScale,
26
30
  resolvePinchZoomChange,
package/dist/index.d.mts CHANGED
@@ -20,16 +20,12 @@ interface PageRendererProps {
20
20
  pageAspectRatio?: number;
21
21
  PageViewComponent?: PageViewComponentType;
22
22
  availableWidth?: number;
23
+ pageViewportWidth?: number;
23
24
  horizontalPadding?: number;
24
25
  spacing?: number;
25
26
  onSelectionDragActiveChange?: (active: boolean) => void;
26
27
  gestureScrollLockActive?: boolean;
27
28
  lastPinchEndedAt?: number | null;
28
- onHorizontalScrollOffsetChange?: (pageIndex: number, offsetX: number) => void;
29
- horizontalScrollRestore?: {
30
- requestId: number;
31
- offsetX: number;
32
- } | null;
33
29
  requestSelectionVerticalAutoscroll?: (absoluteY: number) => number;
34
30
  }
35
31
  declare const _default: React.NamedExoticComponent<PageRendererProps>;
package/dist/index.d.ts CHANGED
@@ -20,16 +20,12 @@ interface PageRendererProps {
20
20
  pageAspectRatio?: number;
21
21
  PageViewComponent?: PageViewComponentType;
22
22
  availableWidth?: number;
23
+ pageViewportWidth?: number;
23
24
  horizontalPadding?: number;
24
25
  spacing?: number;
25
26
  onSelectionDragActiveChange?: (active: boolean) => void;
26
27
  gestureScrollLockActive?: boolean;
27
28
  lastPinchEndedAt?: number | null;
28
- onHorizontalScrollOffsetChange?: (pageIndex: number, offsetX: number) => void;
29
- horizontalScrollRestore?: {
30
- requestId: number;
31
- offsetX: number;
32
- } | null;
33
29
  requestSelectionVerticalAutoscroll?: (absoluteY: number) => number;
34
30
  }
35
31
  declare const _default: React.NamedExoticComponent<PageRendererProps>;