@embedpdf/plugin-zoom 2.0.0-next.3 → 2.0.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/dist/preact/adapter.d.ts +1 -1
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +217 -71
- package/dist/preact/index.js.map +1 -1
- package/dist/preact/viewport.d.ts +1 -0
- package/dist/react/adapter.d.ts +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +217 -71
- package/dist/react/index.js.map +1 -1
- package/dist/react/viewport.d.ts +1 -0
- package/dist/shared/components/index.d.ts +1 -1
- package/dist/shared/components/zoom-gesture-wrapper.d.ts +12 -0
- package/dist/shared/hooks/index.d.ts +1 -1
- package/dist/shared/hooks/use-pinch-zoom.d.ts +3 -1
- package/dist/shared/hooks/use-zoom-gesture.d.ts +5 -0
- package/dist/shared/utils/pinch-zoom-logic.d.ts +11 -2
- package/dist/shared/utils/zoom-gesture-logic.d.ts +18 -0
- package/dist/shared-preact/components/index.d.ts +1 -1
- package/dist/shared-preact/components/zoom-gesture-wrapper.d.ts +12 -0
- package/dist/shared-preact/hooks/index.d.ts +1 -1
- package/dist/shared-preact/hooks/use-pinch-zoom.d.ts +3 -1
- package/dist/shared-preact/hooks/use-zoom-gesture.d.ts +5 -0
- package/dist/shared-preact/utils/pinch-zoom-logic.d.ts +11 -2
- package/dist/shared-preact/utils/zoom-gesture-logic.d.ts +18 -0
- package/dist/shared-react/components/index.d.ts +1 -1
- package/dist/shared-react/components/zoom-gesture-wrapper.d.ts +12 -0
- package/dist/shared-react/hooks/index.d.ts +1 -1
- package/dist/shared-react/hooks/use-pinch-zoom.d.ts +3 -1
- package/dist/shared-react/hooks/use-zoom-gesture.d.ts +5 -0
- package/dist/shared-react/utils/pinch-zoom-logic.d.ts +11 -2
- package/dist/shared-react/utils/zoom-gesture-logic.d.ts +18 -0
- package/dist/shared-svelte/utils/zoom-gesture-logic.d.ts +18 -0
- package/dist/shared-vue/utils/zoom-gesture-logic.d.ts +18 -0
- package/dist/svelte/components/ZoomGestureWrapper.svelte.d.ts +14 -0
- package/dist/svelte/components/index.d.ts +1 -1
- package/dist/svelte/hooks/index.d.ts +1 -1
- package/dist/svelte/hooks/use-pinch-zoom.svelte.d.ts +11 -2
- package/dist/svelte/hooks/use-zoom-gesture.svelte.d.ts +16 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +214 -71
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/index.d.ts +1 -1
- package/dist/vue/components/{pinch-wrapper.vue.d.ts → zoom-gesture-wrapper.vue.d.ts} +8 -1
- package/dist/vue/hooks/index.d.ts +1 -1
- package/dist/vue/hooks/use-zoom-gesture.d.ts +17 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +211 -72
- package/dist/vue/index.js.map +1 -1
- package/package.json +10 -12
- package/dist/hammer-DhVzwxwy.cjs +0 -7
- package/dist/hammer-DhVzwxwy.cjs.map +0 -1
- package/dist/hammer-e1aXHboh.js +0 -1810
- package/dist/hammer-e1aXHboh.js.map +0 -1
- package/dist/shared/components/pinch-wrapper.d.ts +0 -8
- package/dist/shared-preact/components/pinch-wrapper.d.ts +0 -8
- package/dist/shared-react/components/pinch-wrapper.d.ts +0 -8
- package/dist/shared-svelte/utils/pinch-zoom-logic.d.ts +0 -9
- package/dist/shared-vue/utils/pinch-zoom-logic.d.ts +0 -9
- package/dist/svelte/components/PinchWrapper.svelte.d.ts +0 -10
- package/dist/vue/hooks/use-pinch-zoom.d.ts +0 -8
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ZoomGestureOptions } from '../utils/pinch-zoom-logic';
|
|
2
|
+
export type { ZoomGestureOptions };
|
|
3
|
+
export declare function useZoomGesture(documentId: string, options?: ZoomGestureOptions): {
|
|
2
4
|
elementRef: import('preact').RefObject<HTMLDivElement>;
|
|
3
5
|
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { ViewportCapability } from '@embedpdf/plugin-viewport';
|
|
2
2
|
import { ZoomCapability } from '../../lib/index.ts';
|
|
3
|
-
export interface
|
|
3
|
+
export interface ZoomGestureOptions {
|
|
4
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
5
|
+
enablePinch?: boolean;
|
|
6
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
7
|
+
enableWheel?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ZoomGestureDeps {
|
|
4
10
|
element: HTMLDivElement;
|
|
11
|
+
/** Optional viewport container element for attaching events (from context) */
|
|
12
|
+
container?: HTMLElement;
|
|
5
13
|
documentId: string;
|
|
6
14
|
viewportProvides: ViewportCapability;
|
|
7
15
|
zoomProvides: ZoomCapability;
|
|
16
|
+
options?: ZoomGestureOptions;
|
|
8
17
|
}
|
|
9
|
-
export declare function
|
|
18
|
+
export declare function setupZoomGestures({ element, container, documentId, viewportProvides, zoomProvides, options, }: ZoomGestureDeps): () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZoomCapability } from '../../lib/index.ts';
|
|
2
|
+
export interface ZoomGestureOptions {
|
|
3
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
4
|
+
enablePinch?: boolean;
|
|
5
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
6
|
+
enableWheel?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ZoomGestureDeps {
|
|
9
|
+
element: HTMLDivElement;
|
|
10
|
+
/** Viewport container element for attaching events */
|
|
11
|
+
container: HTMLElement;
|
|
12
|
+
documentId: string;
|
|
13
|
+
zoomProvides: ZoomCapability;
|
|
14
|
+
/** Viewport gap in pixels (default: 0) */
|
|
15
|
+
viewportGap?: number;
|
|
16
|
+
options?: ZoomGestureOptions;
|
|
17
|
+
}
|
|
18
|
+
export declare function setupZoomGestures({ element, container, documentId, zoomProvides, viewportGap, options, }: ZoomGestureDeps): () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './zoom-gesture-wrapper';
|
|
2
2
|
export * from './marquee-zoom';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
|
|
2
|
+
type ZoomGestureWrapperProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
documentId: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
7
|
+
enablePinch?: boolean;
|
|
8
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
9
|
+
enableWheel?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function ZoomGestureWrapper({ children, documentId, style, enablePinch, enableWheel, ...props }: ZoomGestureWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './use-zoom';
|
|
2
|
-
export * from './use-
|
|
2
|
+
export * from './use-zoom-gesture';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ZoomGestureOptions } from '../utils/pinch-zoom-logic';
|
|
2
|
+
export type { ZoomGestureOptions };
|
|
3
|
+
export declare function useZoomGesture(documentId: string, options?: ZoomGestureOptions): {
|
|
2
4
|
elementRef: import('react').RefObject<HTMLDivElement>;
|
|
3
5
|
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { ViewportCapability } from '@embedpdf/plugin-viewport';
|
|
2
2
|
import { ZoomCapability } from '../../lib/index.ts';
|
|
3
|
-
export interface
|
|
3
|
+
export interface ZoomGestureOptions {
|
|
4
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
5
|
+
enablePinch?: boolean;
|
|
6
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
7
|
+
enableWheel?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ZoomGestureDeps {
|
|
4
10
|
element: HTMLDivElement;
|
|
11
|
+
/** Optional viewport container element for attaching events (from context) */
|
|
12
|
+
container?: HTMLElement;
|
|
5
13
|
documentId: string;
|
|
6
14
|
viewportProvides: ViewportCapability;
|
|
7
15
|
zoomProvides: ZoomCapability;
|
|
16
|
+
options?: ZoomGestureOptions;
|
|
8
17
|
}
|
|
9
|
-
export declare function
|
|
18
|
+
export declare function setupZoomGestures({ element, container, documentId, viewportProvides, zoomProvides, options, }: ZoomGestureDeps): () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZoomCapability } from '../../lib/index.ts';
|
|
2
|
+
export interface ZoomGestureOptions {
|
|
3
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
4
|
+
enablePinch?: boolean;
|
|
5
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
6
|
+
enableWheel?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ZoomGestureDeps {
|
|
9
|
+
element: HTMLDivElement;
|
|
10
|
+
/** Viewport container element for attaching events */
|
|
11
|
+
container: HTMLElement;
|
|
12
|
+
documentId: string;
|
|
13
|
+
zoomProvides: ZoomCapability;
|
|
14
|
+
/** Viewport gap in pixels (default: 0) */
|
|
15
|
+
viewportGap?: number;
|
|
16
|
+
options?: ZoomGestureOptions;
|
|
17
|
+
}
|
|
18
|
+
export declare function setupZoomGestures({ element, container, documentId, zoomProvides, viewportGap, options, }: ZoomGestureDeps): () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZoomCapability } from '../../lib/index.ts';
|
|
2
|
+
export interface ZoomGestureOptions {
|
|
3
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
4
|
+
enablePinch?: boolean;
|
|
5
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
6
|
+
enableWheel?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ZoomGestureDeps {
|
|
9
|
+
element: HTMLDivElement;
|
|
10
|
+
/** Viewport container element for attaching events */
|
|
11
|
+
container: HTMLElement;
|
|
12
|
+
documentId: string;
|
|
13
|
+
zoomProvides: ZoomCapability;
|
|
14
|
+
/** Viewport gap in pixels (default: 0) */
|
|
15
|
+
viewportGap?: number;
|
|
16
|
+
options?: ZoomGestureOptions;
|
|
17
|
+
}
|
|
18
|
+
export declare function setupZoomGestures({ element, container, documentId, zoomProvides, viewportGap, options, }: ZoomGestureDeps): () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZoomCapability } from '../../lib/index.ts';
|
|
2
|
+
export interface ZoomGestureOptions {
|
|
3
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
4
|
+
enablePinch?: boolean;
|
|
5
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
6
|
+
enableWheel?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ZoomGestureDeps {
|
|
9
|
+
element: HTMLDivElement;
|
|
10
|
+
/** Viewport container element for attaching events */
|
|
11
|
+
container: HTMLElement;
|
|
12
|
+
documentId: string;
|
|
13
|
+
zoomProvides: ZoomCapability;
|
|
14
|
+
/** Viewport gap in pixels (default: 0) */
|
|
15
|
+
viewportGap?: number;
|
|
16
|
+
options?: ZoomGestureOptions;
|
|
17
|
+
}
|
|
18
|
+
export declare function setupZoomGestures({ element, container, documentId, zoomProvides, viewportGap, options, }: ZoomGestureDeps): () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Snippet } from 'svelte';
|
|
2
|
+
import { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type ZoomGestureWrapperProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
|
+
documentId: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
8
|
+
enablePinch?: boolean;
|
|
9
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
10
|
+
enableWheel?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const ZoomGestureWrapper: import('svelte', { with: { "resolution-mode": "import" } }).Component<ZoomGestureWrapperProps, {}, "">;
|
|
13
|
+
type ZoomGestureWrapper = ReturnType<typeof ZoomGestureWrapper>;
|
|
14
|
+
export default ZoomGestureWrapper;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as MarqueeZoom } from './MarqueeZoom.svelte';
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as ZoomGestureWrapper } from './ZoomGestureWrapper.svelte';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './use-zoom.svelte';
|
|
2
|
-
export * from './use-
|
|
2
|
+
export * from './use-zoom-gesture.svelte';
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { ZoomGestureOptions } from '../../shared-svelte/utils/pinch-zoom-logic';
|
|
2
|
+
export type { ZoomGestureOptions };
|
|
3
|
+
export interface UseZoomGestureOptions {
|
|
4
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
5
|
+
enablePinch?: () => boolean;
|
|
6
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
7
|
+
enableWheel?: () => boolean;
|
|
8
|
+
}
|
|
1
9
|
/**
|
|
2
|
-
* Hook for setting up
|
|
10
|
+
* Hook for setting up zoom gesture functionality (pinch and wheel zoom) on an element
|
|
3
11
|
* @param getDocumentId Function that returns the document ID
|
|
12
|
+
* @param options Optional configuration for enabling/disabling gestures
|
|
4
13
|
*/
|
|
5
|
-
export declare function
|
|
14
|
+
export declare function useZoomGesture(getDocumentId: () => string | null, options?: UseZoomGestureOptions): {
|
|
6
15
|
elementRef: HTMLDivElement | null;
|
|
7
16
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ZoomGestureOptions } from '../../shared-svelte/utils/zoom-gesture-logic';
|
|
2
|
+
export type { ZoomGestureOptions };
|
|
3
|
+
export interface UseZoomGestureOptions {
|
|
4
|
+
/** Enable pinch-to-zoom gesture (default: true) */
|
|
5
|
+
enablePinch?: () => boolean;
|
|
6
|
+
/** Enable wheel zoom with ctrl/cmd key (default: true) */
|
|
7
|
+
enableWheel?: () => boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook for setting up zoom gesture functionality (pinch and wheel zoom) on an element
|
|
11
|
+
* @param getDocumentId Function that returns the document ID
|
|
12
|
+
* @param options Optional configuration for enabling/disabling gestures
|
|
13
|
+
*/
|
|
14
|
+
export declare function useZoomGesture(getDocumentId: () => string | null, options?: UseZoomGestureOptions): {
|
|
15
|
+
elementRef: HTMLDivElement | null;
|
|
16
|
+
};
|
package/dist/svelte/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("svelte/internal/client"),t=require("@embedpdf/core/svelte"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("svelte/internal/client"),t=require("@embedpdf/core/svelte"),n=require("@embedpdf/plugin-zoom"),o=require("svelte");function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}require("svelte/internal/disclose-version");const i=r(e),l=()=>t.useCapability(n.ZoomPlugin.id);function s(e){const[t,n]=[e[0],e[1]],o=n.clientX-t.clientX,r=n.clientY-t.clientY;return Math.hypot(o,r)}function c(e,n={}){const r=t.useCapability("viewport"),c=l(),a=o.getContext("viewport-element");let u,d=i.state(null);const p=i.derived(e),v=i.derived(()=>{var e;return(null==(e=n.enablePinch)?void 0:e.call(n))??!0}),f=i.derived(()=>{var e;return(null==(e=n.enableWheel)?void 0:e.call(n))??!0});return i.user_effect(()=>{const e=i.get(d),t=null==a?void 0:a.current,n=r.provides,o=c.provides,l=i.get(p),h=i.get(v),m=i.get(f);if(u&&(u(),u=void 0),e&&t&&o&&l)return u=function({element:e,container:t,documentId:n,zoomProvides:o,viewportGap:r=0,options:i={}}){const{enablePinch:l=!0,enableWheel:c=!0}=i;if("undefined"==typeof window)return()=>{};const a=o.forDocument(n),u=()=>a.getState();let d=0,p=1,v=!1,f=0,h=null,m=1,g=0,b=0,x=0,y=0,P=0,w=0,L=0,O=0,E=0,M=0,S=0,W=0,_=0;const Z=(e,t,n)=>Math.min(Math.max(e,t),n),$=()=>{const n=t.clientWidth-2*r,o=e.offsetWidth,i=o<n?(n-o)/2:0;e.style.marginLeft=`${i}px`},D=e=>{const t=g*e,n=b*e;let o=E*(1-e);const r=O-t/2-x,i=M-_*e-x,l=Math.max(0,t-L),s=.3*L,c=Math.min(1,l/s);let a=r+(i-r)*c;return n>w-2*W&&(o=Z(y+o,w-W-n,W)-y),t>P-2*W&&(a=Z(x+a,P-W-t,W)-x),{tx:a,ty:o,blend:c,finalWidth:t}},z=t=>{p=t;const{tx:n,ty:o}=D(t);e.style.transformOrigin="0 0",e.style.transform=`translate(${n}px, ${o}px) scale(${t})`},I=()=>{e.style.transform="none",e.style.transformOrigin="0 0",p=1},j=()=>{const{tx:e,finalWidth:t}=D(p),n=(p-1)*d;let o,r=S;if(t<=L)o=O;else{const t=1-p;o=Math.abs(t)>.001?x+e/t:M}a.requestZoomBy(n,{vx:o,vy:r}),I(),d=0},q=(n,o)=>{const i=t.getBoundingClientRect(),l=e.getBoundingClientRect();W=r,g=l.width,b=l.height,x=l.left-i.left,y=l.top-i.top,P=i.width,w=i.height,L=t.clientWidth,O=t.clientLeft+L/2;const s=n-l.left;E=o-l.top,M=n-i.left,S=o-i.top,_=g<L?M*g/L:s},C=e=>{if(2!==e.touches.length)return;v=!0,d=u().currentZoomLevel,f=s(e.touches);const t=function(e){const[t,n]=[e[0],e[1]];return{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}(e.touches);q(t.x,t.y),e.preventDefault()},R=e=>{if(!v||2!==e.touches.length)return;const t=s(e.touches);z(t/f),e.preventDefault()},Y=e=>{v&&(e.touches.length>=2||(v=!1,j()))},T=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),null===h?(d=u().currentZoomLevel,m=1,q(e.clientX,e.clientY)):clearTimeout(h);const t=1-.01*e.deltaY;m*=t,m=Math.max(.1,Math.min(10,m)),z(m),h=setTimeout(()=>{h=null,j(),m=1},150)},k=a.onStateChange(()=>$()),G=new ResizeObserver(()=>$());return G.observe(e),G.observe(t),$(),l&&(t.addEventListener("touchstart",C,{passive:!1}),t.addEventListener("touchmove",R,{passive:!1}),t.addEventListener("touchend",Y),t.addEventListener("touchcancel",Y)),c&&t.addEventListener("wheel",T,{passive:!1}),()=>{l&&(t.removeEventListener("touchstart",C),t.removeEventListener("touchmove",R),t.removeEventListener("touchend",Y),t.removeEventListener("touchcancel",Y)),c&&t.removeEventListener("wheel",T),h&&clearTimeout(h),k(),G.disconnect(),I(),e.style.marginLeft=""}}({element:e,container:t,documentId:l,zoomProvides:o,viewportGap:(null==n?void 0:n.getViewportGap())||0,options:{enablePinch:h,enableWheel:m}}),()=>{u&&(u(),u=void 0)}}),{get elementRef(){return i.get(d)},set elementRef(e){i.set(d,e,!0)}}}var a=i.from_html("<div></div>");var u=i.from_html("<div><!></div>");exports.MarqueeZoom=function(e,n){i.push(n,!0);let o=i.prop(n,"stroke",3,"rgba(33,150,243,0.8)"),r=i.prop(n,"fill",3,"rgba(33,150,243,0.15)");const s=l(),c=t.useDocumentState(()=>n.documentId);let u=i.state(null);const d=i.derived(()=>{var e;return void 0!==n.scale?n.scale:(null==(e=c.current)?void 0:e.scale)??1});i.user_effect(()=>{if(i.set(u,null),s.provides)return s.provides.registerMarqueeOnPage({documentId:n.documentId,pageIndex:n.pageIndex,scale:i.get(d),callback:{onPreview:e=>{i.set(u,e,!0)}}})});var p=i.comment(),v=i.first_child(p),f=e=>{var t=a();let l;i.template_effect(()=>{i.set_class(t,1,i.clsx(n.class)),l=i.set_style(t,"",l,{position:"absolute","pointer-events":"none",left:i.get(u).origin.x*i.get(d)+"px",top:i.get(u).origin.y*i.get(d)+"px",width:i.get(u).size.width*i.get(d)+"px",height:i.get(u).size.height*i.get(d)+"px",border:`1px solid ${o()}`,background:r(),"box-sizing":"border-box"})}),i.append(e,t)};i.if(v,e=>{i.get(u)&&e(f)}),i.append(e,p),i.pop()},exports.ZoomGestureWrapper=function(e,t){i.push(t,!0);let n=i.prop(t,"enablePinch",3,!0),o=i.prop(t,"enableWheel",3,!0),r=i.rest_props(t,["$$slots","$$events","$$legacy","documentId","children","class","enablePinch","enableWheel"]);const l=c(()=>t.documentId,{enablePinch:()=>n(),enableWheel:()=>o()});var s=u();i.attribute_effect(s,()=>({...r,class:t.class,[i.STYLE]:{display:"inline-block",overflow:"visible","box-sizing":"border-box"}}));var a=i.child(s);i.snippet(a,()=>t.children),i.reset(s),i.bind_this(s,e=>l.elementRef=e,()=>null==l?void 0:l.elementRef),i.append(e,s),i.pop()},exports.useZoom=e=>{const t=l();let o=i.state(i.proxy(n.initialDocumentState));const r=i.derived(e),s=i.derived(()=>t.provides&&i.get(r)?t.provides.forDocument(i.get(r)):null);return i.user_effect(()=>{const e=t.provides,l=i.get(r);if(!e||!l)return void i.set(o,n.initialDocumentState,!0);const s=e.forDocument(l);return i.set(o,s.getState(),!0),s.onStateChange(e=>{i.set(o,e,!0)})}),{get provides(){return i.get(s)},get state(){return i.get(o)}}},exports.useZoomCapability=l,exports.useZoomGesture=c,exports.useZoomPlugin=()=>t.usePlugin(n.ZoomPlugin.id),Object.keys(n).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-zoom.svelte.ts","../../src/shared/utils/pinch-zoom-logic.ts","../../src/svelte/hooks/use-pinch-zoom.svelte.ts","../../src/svelte/components/MarqueeZoom.svelte","../../src/svelte/components/PinchWrapper.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport {\n initialDocumentState,\n ZoomDocumentState,\n ZoomPlugin,\n ZoomScope,\n} from '@embedpdf/plugin-zoom';\n\nexport const useZoomCapability = () => useCapability<ZoomPlugin>(ZoomPlugin.id);\nexport const useZoomPlugin = () => usePlugin<ZoomPlugin>(ZoomPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseZoomReturn {\n provides: ZoomScope | null;\n state: ZoomDocumentState;\n}\n\n/**\n * Hook for zoom state for a specific document\n * @param getDocumentId Function that returns the document ID\n */\nexport const useZoom = (getDocumentId: () => string | null): UseZoomReturn => {\n const capability = useZoomCapability();\n\n let state = $state<ZoomDocumentState>(initialDocumentState);\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state = initialDocumentState;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Get initial state\n state = scope.getState();\n\n // Subscribe to state changes for this document\n return scope.onStateChange((newState) => {\n state = newState;\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","import type { ViewportCapability } from '@embedpdf/plugin-viewport';\nimport type { ZoomCapability } from '@embedpdf/plugin-zoom';\n\nexport interface PinchZoomDeps {\n element: HTMLDivElement;\n documentId: string;\n viewportProvides: ViewportCapability;\n zoomProvides: ZoomCapability;\n}\n\nexport function setupPinchZoom({\n element,\n documentId,\n viewportProvides,\n zoomProvides,\n}: PinchZoomDeps) {\n if (typeof window === 'undefined') {\n return () => {};\n }\n\n let hammer: any | undefined;\n let initialZoom = 0;\n let lastCenter = { x: 0, y: 0 };\n\n const viewportScope = viewportProvides.forDocument(documentId);\n const zoomScope = zoomProvides.forDocument(documentId);\n\n const getState = () => zoomScope.getState();\n\n const updateTransform = (scale: number) => {\n element.style.transform = `scale(${scale})`;\n };\n\n const resetTransform = () => {\n element.style.transform = 'none';\n element.style.transformOrigin = '0 0';\n };\n\n const pinchStart = (e: HammerInput) => {\n initialZoom = getState().currentZoomLevel;\n\n const contRect = viewportScope.getBoundingRect();\n\n lastCenter = {\n x: e.center.x - contRect.origin.x,\n y: e.center.y - contRect.origin.y,\n };\n\n const innerRect = element.getBoundingClientRect();\n element.style.transformOrigin = `${e.center.x - innerRect.left}px ${e.center.y - innerRect.top}px`;\n\n if (e.srcEvent?.cancelable) {\n e.srcEvent.preventDefault();\n e.srcEvent.stopPropagation();\n }\n };\n\n const pinchMove = (e: HammerInput) => {\n updateTransform(e.scale);\n if (e.srcEvent?.cancelable) {\n e.srcEvent.preventDefault();\n e.srcEvent.stopPropagation();\n }\n };\n\n const pinchEnd = (e: HammerInput) => {\n const delta = (e.scale - 1) * initialZoom;\n zoomScope.requestZoomBy(delta, { vx: lastCenter.x, vy: lastCenter.y });\n\n resetTransform();\n initialZoom = 0;\n };\n\n const setupHammer = async () => {\n try {\n const Hammer = (await import('hammerjs')).default;\n\n const inputClass = (() => {\n const MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n const SUPPORT_TOUCH = 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n const SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n if (SUPPORT_ONLY_TOUCH) return Hammer.TouchInput;\n if (!SUPPORT_TOUCH) return Hammer.MouseInput;\n return Hammer.TouchMouseInput;\n })();\n\n hammer = new Hammer(element, {\n touchAction: 'pan-x pan-y',\n inputClass,\n });\n\n hammer.get('pinch').set({ enable: true, pointers: 2, threshold: 0.1 });\n\n hammer.on('pinchstart', pinchStart);\n hammer.on('pinchmove', pinchMove);\n hammer.on('pinchend', pinchEnd);\n } catch (error) {\n console.warn('Failed to load HammerJS:', error);\n }\n };\n\n setupHammer();\n\n return () => {\n hammer?.destroy();\n resetTransform();\n };\n}\n","import { useCapability } from '@embedpdf/core/svelte';\nimport type { ViewportPlugin } from '@embedpdf/plugin-viewport';\nimport { setupPinchZoom } from '../../shared/utils/pinch-zoom-logic';\nimport { useZoomCapability } from './use-zoom.svelte';\n\n/**\n * Hook for setting up pinch-to-zoom functionality on an element\n * @param getDocumentId Function that returns the document ID\n */\nexport function usePinch(getDocumentId: () => string | null) {\n const viewportCapability = useCapability<ViewportPlugin>('viewport');\n const zoomCapability = useZoomCapability();\n\n let elementRef = $state<HTMLDivElement | null>(null);\n let cleanup: (() => void) | undefined;\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n $effect(() => {\n const element = elementRef;\n const viewport = viewportCapability.provides;\n const zoom = zoomCapability.provides;\n const docId = documentId;\n\n // Clean up previous setup\n if (cleanup) {\n cleanup();\n cleanup = undefined;\n }\n\n // Setup new pinch zoom if all dependencies are available\n if (!element || !viewport || !zoom || !docId) {\n return;\n }\n\n cleanup = setupPinchZoom({\n element,\n documentId: docId,\n viewportProvides: viewport,\n zoomProvides: zoom,\n });\n\n return () => {\n if (cleanup) {\n cleanup();\n cleanup = undefined;\n }\n };\n });\n\n return {\n get elementRef() {\n return elementRef;\n },\n set elementRef(value: HTMLDivElement | null) {\n elementRef = value;\n },\n };\n}\n","<script lang=\"ts\">\n import type { Rect } from '@embedpdf/models';\n import { useDocumentState } from '@embedpdf/core/svelte';\n import { useZoomCapability } from '../hooks/use-zoom.svelte';\n\n interface MarqueeZoomProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n class?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n }\n\n let {\n documentId,\n pageIndex,\n scale: scaleOverride,\n class: propsClass,\n stroke = 'rgba(33,150,243,0.8)',\n fill = 'rgba(33,150,243,0.15)',\n }: MarqueeZoomProps = $props();\n\n const zoomCapability = useZoomCapability();\n const documentState = useDocumentState(() => documentId);\n\n let rect = $state<Rect | null>(null);\n\n const actualScale = $derived(\n scaleOverride !== undefined ? scaleOverride : (documentState.current?.scale ?? 1),\n );\n\n $effect(() => {\n rect = null;\n\n if (!zoomCapability.provides) {\n return;\n }\n\n return zoomCapability.provides.registerMarqueeOnPage({\n documentId,\n pageIndex,\n scale: actualScale,\n callback: {\n onPreview: (newRect) => {\n rect = newRect;\n },\n },\n });\n });\n</script>\n\n{#if rect}\n <div\n style:position=\"absolute\"\n style:pointer-events=\"none\"\n style:left={`${rect.origin.x * actualScale}px`}\n style:top={`${rect.origin.y * actualScale}px`}\n style:width={`${rect.size.width * actualScale}px`}\n style:height={`${rect.size.height * actualScale}px`}\n style:border={`1px solid ${stroke}`}\n style:background={fill}\n style:box-sizing=\"border-box\"\n class={propsClass}\n ></div>\n{/if}\n","<script lang=\"ts\">\n import { usePinch } from '../hooks';\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n\n type PinchWrapperProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n documentId: string;\n children: Snippet;\n class?: string;\n };\n\n let { documentId, children, class: propsClass, ...restProps }: PinchWrapperProps = $props();\n const pinch = usePinch(() => documentId);\n</script>\n\n<div\n bind:this={pinch.elementRef}\n {...restProps}\n style:display=\"block\"\n style:width=\"fit-content\"\n style:overflow=\"visible\"\n style:box-sizing=\"border-box\"\n style:margin=\"0px auto\"\n class={propsClass}\n>\n {@render children()}\n</div>\n"],"names":["useZoomCapability","useCapability","ZoomPlugin","id","setupPinchZoom","element","documentId","viewportProvides","zoomProvides","window","hammer","initialZoom","lastCenter","x","y","viewportScope","forDocument","zoomScope","resetTransform","style","transform","transformOrigin","pinchStart","e","getState","currentZoomLevel","contRect","getBoundingRect","center","origin","innerRect","getBoundingClientRect","left","top","_a","srcEvent","cancelable","preventDefault","stopPropagation","pinchMove","scale","pinchEnd","delta","requestZoomBy","vx","vy","async","Hammer","Promise","resolve","then","require","n","default","inputClass","SUPPORT_TOUCH","navigator","maxTouchPoints","test","userAgent","TouchInput","TouchMouseInput","MouseInput","touchAction","get","set","enable","pointers","threshold","on","error","console","warn","setupHammer","destroy","usePinch","getDocumentId","viewportCapability","zoomCapability","cleanup","elementRef","$","user_effect","viewport","provides","zoom","docId","value","stroke","fill","documentState","useDocumentState","$$props","rect","actualScale","derived","current","registerMarqueeOnPage","pageIndex","callback","onPreview","newRect","width","size","height","consequent","restProps","rest_props","pinch","bind_this","div","$$value","capability","state","initialDocumentState","scopedProvides","scope","onStateChange","newState","usePlugin"],"mappings":"ogBAQaA,EAAA,IAA0BC,gBAA0BC,EAAAA,WAAWC,ICErE,SAASC,GAAeC,QAC7BA,EAAAC,WACAA,EAAAC,iBACAA,EAAAC,aACAA,IAEA,GAAsB,oBAAXC,OACT,MAAO,OAGT,IAAIC,EACAC,EAAc,EACdC,EAAa,CAAEC,EAAG,EAAGC,EAAG,GAE5B,MAAMC,EAAgBR,EAAiBS,YAAYV,GAC7CW,EAAYT,EAAaQ,YAAYV,GAQrCY,EAAiB,KACrBb,EAAQc,MAAMC,UAAY,OAC1Bf,EAAQc,MAAME,gBAAkB,OAG5BC,EAAcC,UAClBZ,EAZqBM,EAAUO,WAYNC,iBAEzB,MAAMC,EAAWX,EAAcY,kBAE/Bf,EAAa,CACXC,EAAGU,EAAEK,OAAOf,EAAIa,EAASG,OAAOhB,EAChCC,EAAGS,EAAEK,OAAOd,EAAIY,EAASG,OAAOf,GAGlC,MAAMgB,EAAYzB,EAAQ0B,wBAC1B1B,EAAQc,MAAME,gBAAkB,GAAGE,EAAEK,OAAOf,EAAIiB,EAAUE,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AA,EAAM5B,iCAHnB,qCJQwBJ,IAChB,MAAAoC,EAAahH,IAEf,IAAAiH,kBAAkCC,EAAAA,uBAGhC,MAAA5G,YAAsBsE,GAGtBuC,EAAAlC,EAAAc,QAAA,IACJiB,EAAW5B,gBAAY9E,GAAa0G,EAAW5B,SAASpE,kBAAYV,IAAc,aAGpF2E,EAAAC,uBACQE,EAAW4B,EAAW5B,SACtBE,QAAQhF,OAET8E,IAAaE,cAChBL,EAAAhB,IAAAgD,EAAQC,EAAAA,sBAAA,GAIJ,MAAAE,EAAQhC,EAASpE,YAAYsE,GAM5B,aAHP2B,EAAQG,EAAM5F,YAAA,GAGP4F,EAAMC,cAAeC,IAC1BrC,EAAAhB,IAAAgD,EAAQK,GAAA,QAKN,YAAAlC,gBACK+B,EACT,EACI,SAAAF,gBACKA,EACT,sDAnDS,IAAsBM,YAAsBrH,EAAAA,WAAWC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/svelte/hooks/use-zoom.svelte.ts","../../src/shared/utils/zoom-gesture-logic.ts","../../src/svelte/hooks/use-zoom-gesture.svelte.ts","../../src/svelte/components/MarqueeZoom.svelte","../../src/svelte/components/ZoomGestureWrapper.svelte"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/svelte';\nimport {\n initialDocumentState,\n ZoomDocumentState,\n ZoomPlugin,\n ZoomScope,\n} from '@embedpdf/plugin-zoom';\n\nexport const useZoomCapability = () => useCapability<ZoomPlugin>(ZoomPlugin.id);\nexport const useZoomPlugin = () => usePlugin<ZoomPlugin>(ZoomPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseZoomReturn {\n provides: ZoomScope | null;\n state: ZoomDocumentState;\n}\n\n/**\n * Hook for zoom state for a specific document\n * @param getDocumentId Function that returns the document ID\n */\nexport const useZoom = (getDocumentId: () => string | null): UseZoomReturn => {\n const capability = useZoomCapability();\n\n let state = $state<ZoomDocumentState>(initialDocumentState);\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state = initialDocumentState;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Get initial state\n state = scope.getState();\n\n // Subscribe to state changes for this document\n return scope.onStateChange((newState) => {\n state = newState;\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","import type { ZoomCapability } from '@embedpdf/plugin-zoom';\n\nexport interface ZoomGestureOptions {\n /** Enable pinch-to-zoom gesture (default: true) */\n enablePinch?: boolean;\n /** Enable wheel zoom with ctrl/cmd key (default: true) */\n enableWheel?: boolean;\n}\n\nexport interface ZoomGestureDeps {\n element: HTMLDivElement;\n /** Viewport container element for attaching events */\n container: HTMLElement;\n documentId: string;\n zoomProvides: ZoomCapability;\n /** Viewport gap in pixels (default: 0) */\n viewportGap?: number;\n options?: ZoomGestureOptions;\n}\n\nfunction getTouchDistance(touches: TouchList): number {\n const [t1, t2] = [touches[0], touches[1]];\n const dx = t2.clientX - t1.clientX;\n const dy = t2.clientY - t1.clientY;\n return Math.hypot(dx, dy);\n}\n\nfunction getTouchCenter(touches: TouchList): { x: number; y: number } {\n const [t1, t2] = [touches[0], touches[1]];\n return {\n x: (t1.clientX + t2.clientX) / 2,\n y: (t1.clientY + t2.clientY) / 2,\n };\n}\n\nexport function setupZoomGestures({\n element,\n container,\n documentId,\n zoomProvides,\n viewportGap = 0,\n options = {},\n}: ZoomGestureDeps) {\n const { enablePinch = true, enableWheel = true } = options;\n if (typeof window === 'undefined') {\n return () => {};\n }\n\n const zoomScope = zoomProvides.forDocument(documentId);\n const getState = () => zoomScope.getState();\n\n // Shared state\n let initialZoom = 0;\n let currentScale = 1;\n let isPinching = false;\n let initialDistance = 0;\n\n // Wheel state\n let wheelZoomTimeout: ReturnType<typeof setTimeout> | null = null;\n let accumulatedWheelScale = 1;\n\n // Gesture state\n let initialElementWidth = 0;\n let initialElementHeight = 0;\n let initialElementLeft = 0;\n let initialElementTop = 0;\n\n // Container Dimensions (Bounding Box)\n let containerRectWidth = 0;\n let containerRectHeight = 0;\n\n // Layout Dimensions (Client Box from Metrics)\n let layoutWidth = 0;\n let layoutCenterX = 0;\n\n let pointerLocalY = 0;\n let pointerContainerX = 0;\n let pointerContainerY = 0;\n\n let currentGap = 0;\n let pivotLocalX = 0;\n\n const clamp = (val: number, min: number, max: number) => Math.min(Math.max(val, min), max);\n\n // --- Margin calculation ---\n const updateMargin = () => {\n const availableWidth = container.clientWidth - 2 * viewportGap;\n const elementWidth = element.offsetWidth;\n\n const newMargin = elementWidth < availableWidth ? (availableWidth - elementWidth) / 2 : 0;\n element.style.marginLeft = `${newMargin}px`;\n };\n\n const calculateTransform = (scale: number) => {\n const finalWidth = initialElementWidth * scale;\n const finalHeight = initialElementHeight * scale;\n\n let ty = pointerLocalY * (1 - scale);\n\n const targetX = layoutCenterX - finalWidth / 2;\n const txCenter = targetX - initialElementLeft;\n const txMouse = pointerContainerX - pivotLocalX * scale - initialElementLeft;\n\n const overflow = Math.max(0, finalWidth - layoutWidth);\n const blendRange = layoutWidth * 0.3;\n const blend = Math.min(1, overflow / blendRange);\n\n let tx = txCenter + (txMouse - txCenter) * blend;\n\n const safeHeight = containerRectHeight - currentGap * 2;\n if (finalHeight > safeHeight) {\n const currentTop = initialElementTop + ty;\n const maxTop = currentGap;\n const minTop = containerRectHeight - currentGap - finalHeight;\n const constrainedTop = clamp(currentTop, minTop, maxTop);\n ty = constrainedTop - initialElementTop;\n }\n\n const safeWidth = containerRectWidth - currentGap * 2;\n if (finalWidth > safeWidth) {\n const currentLeft = initialElementLeft + tx;\n const maxLeft = currentGap;\n const minLeft = containerRectWidth - currentGap - finalWidth;\n const constrainedLeft = clamp(currentLeft, minLeft, maxLeft);\n tx = constrainedLeft - initialElementLeft;\n }\n\n return { tx, ty, blend, finalWidth };\n };\n\n const updateTransform = (scale: number) => {\n currentScale = scale;\n const { tx, ty } = calculateTransform(scale);\n element.style.transformOrigin = '0 0';\n element.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`;\n };\n\n const resetTransform = () => {\n element.style.transform = 'none';\n element.style.transformOrigin = '0 0';\n currentScale = 1;\n };\n\n const commitZoom = () => {\n const { tx, finalWidth } = calculateTransform(currentScale);\n const delta = (currentScale - 1) * initialZoom;\n\n let anchorX: number;\n let anchorY: number = pointerContainerY;\n\n if (finalWidth <= layoutWidth) {\n anchorX = layoutCenterX;\n } else {\n const scaleDiff = 1 - currentScale;\n anchorX =\n Math.abs(scaleDiff) > 0.001 ? initialElementLeft + tx / scaleDiff : pointerContainerX;\n }\n\n zoomScope.requestZoomBy(delta, { vx: anchorX, vy: anchorY });\n resetTransform();\n initialZoom = 0;\n };\n\n const initializeGestureState = (clientX: number, clientY: number) => {\n const containerRect = container.getBoundingClientRect();\n const innerRect = element.getBoundingClientRect();\n\n currentGap = viewportGap;\n initialElementWidth = innerRect.width;\n initialElementHeight = innerRect.height;\n initialElementLeft = innerRect.left - containerRect.left;\n initialElementTop = innerRect.top - containerRect.top;\n\n containerRectWidth = containerRect.width;\n containerRectHeight = containerRect.height;\n\n // Layout dimensions from container's client area\n layoutWidth = container.clientWidth;\n layoutCenterX = container.clientLeft + layoutWidth / 2;\n\n const rawPointerLocalX = clientX - innerRect.left;\n pointerLocalY = clientY - innerRect.top;\n pointerContainerX = clientX - containerRect.left;\n pointerContainerY = clientY - containerRect.top;\n\n if (initialElementWidth < layoutWidth) {\n pivotLocalX = (pointerContainerX * initialElementWidth) / layoutWidth;\n } else {\n pivotLocalX = rawPointerLocalX;\n }\n };\n\n // --- Handlers ---\n const handleTouchStart = (e: TouchEvent) => {\n if (e.touches.length !== 2) return;\n isPinching = true;\n initialZoom = getState().currentZoomLevel;\n initialDistance = getTouchDistance(e.touches);\n const center = getTouchCenter(e.touches);\n initializeGestureState(center.x, center.y);\n e.preventDefault();\n };\n\n const handleTouchMove = (e: TouchEvent) => {\n if (!isPinching || e.touches.length !== 2) return;\n const currentDistance = getTouchDistance(e.touches);\n const scale = currentDistance / initialDistance;\n updateTransform(scale);\n e.preventDefault();\n };\n\n const handleTouchEnd = (e: TouchEvent) => {\n if (!isPinching) return;\n if (e.touches.length >= 2) return;\n isPinching = false;\n commitZoom();\n };\n\n const handleWheel = (e: WheelEvent) => {\n if (!e.ctrlKey && !e.metaKey) return;\n e.preventDefault();\n\n if (wheelZoomTimeout === null) {\n initialZoom = getState().currentZoomLevel;\n accumulatedWheelScale = 1;\n initializeGestureState(e.clientX, e.clientY);\n } else {\n clearTimeout(wheelZoomTimeout);\n }\n\n const zoomFactor = 1 - e.deltaY * 0.01;\n accumulatedWheelScale *= zoomFactor;\n accumulatedWheelScale = Math.max(0.1, Math.min(10, accumulatedWheelScale));\n updateTransform(accumulatedWheelScale);\n\n wheelZoomTimeout = setTimeout(() => {\n wheelZoomTimeout = null;\n commitZoom();\n accumulatedWheelScale = 1;\n }, 150);\n };\n\n // Subscribe to zoom changes to update margin\n const unsubZoom = zoomScope.onStateChange(() => updateMargin());\n\n // Use ResizeObserver to update margin when element or container size changes\n const resizeObserver = new ResizeObserver(() => updateMargin());\n resizeObserver.observe(element);\n resizeObserver.observe(container);\n\n // Initial margin calculation\n updateMargin();\n\n // Attach events to the viewport container for better UX\n // (gestures work anywhere in viewport, not just on the PDF)\n if (enablePinch) {\n container.addEventListener('touchstart', handleTouchStart, { passive: false });\n container.addEventListener('touchmove', handleTouchMove, { passive: false });\n container.addEventListener('touchend', handleTouchEnd);\n container.addEventListener('touchcancel', handleTouchEnd);\n }\n if (enableWheel) {\n container.addEventListener('wheel', handleWheel, { passive: false });\n }\n\n return () => {\n if (enablePinch) {\n container.removeEventListener('touchstart', handleTouchStart);\n container.removeEventListener('touchmove', handleTouchMove);\n container.removeEventListener('touchend', handleTouchEnd);\n container.removeEventListener('touchcancel', handleTouchEnd);\n }\n if (enableWheel) {\n container.removeEventListener('wheel', handleWheel);\n }\n if (wheelZoomTimeout) {\n clearTimeout(wheelZoomTimeout);\n }\n unsubZoom();\n resizeObserver.disconnect();\n resetTransform();\n element.style.marginLeft = '';\n };\n}\n","import { getContext } from 'svelte';\nimport { useCapability } from '@embedpdf/core/svelte';\nimport type { ViewportPlugin } from '@embedpdf/plugin-viewport';\nimport { setupZoomGestures, type ZoomGestureOptions } from '../../shared/utils/zoom-gesture-logic';\nimport { useZoomCapability } from './use-zoom.svelte';\n\nexport type { ZoomGestureOptions };\n\n/** Context type for viewport element */\ntype ViewportElementContext = { readonly current: HTMLDivElement | null };\n\nexport interface UseZoomGestureOptions {\n /** Enable pinch-to-zoom gesture (default: true) */\n enablePinch?: () => boolean;\n /** Enable wheel zoom with ctrl/cmd key (default: true) */\n enableWheel?: () => boolean;\n}\n\n/**\n * Hook for setting up zoom gesture functionality (pinch and wheel zoom) on an element\n * @param getDocumentId Function that returns the document ID\n * @param options Optional configuration for enabling/disabling gestures\n */\nexport function useZoomGesture(\n getDocumentId: () => string | null,\n options: UseZoomGestureOptions = {},\n) {\n const viewportCapability = useCapability<ViewportPlugin>('viewport');\n const zoomCapability = useZoomCapability();\n const viewportElementCtx = getContext<ViewportElementContext | undefined>('viewport-element');\n\n let elementRef = $state<HTMLDivElement | null>(null);\n let cleanup: (() => void) | undefined;\n\n // Reactive documentId and options\n const documentId = $derived(getDocumentId());\n const enablePinch = $derived(options.enablePinch?.() ?? true);\n const enableWheel = $derived(options.enableWheel?.() ?? true);\n\n $effect(() => {\n const element = elementRef;\n const container = viewportElementCtx?.current;\n const viewport = viewportCapability.provides;\n const zoom = zoomCapability.provides;\n const docId = documentId;\n const pinchEnabled = enablePinch;\n const wheelEnabled = enableWheel;\n\n // Clean up previous setup\n if (cleanup) {\n cleanup();\n cleanup = undefined;\n }\n\n // Setup new zoom gestures if all dependencies are available\n if (!element || !container || !zoom || !docId) {\n return;\n }\n\n cleanup = setupZoomGestures({\n element,\n container,\n documentId: docId,\n zoomProvides: zoom,\n viewportGap: viewport?.getViewportGap() || 0,\n options: { enablePinch: pinchEnabled, enableWheel: wheelEnabled },\n });\n\n return () => {\n if (cleanup) {\n cleanup();\n cleanup = undefined;\n }\n };\n });\n\n return {\n get elementRef() {\n return elementRef;\n },\n set elementRef(value: HTMLDivElement | null) {\n elementRef = value;\n },\n };\n}\n","<script lang=\"ts\">\n import type { Rect } from '@embedpdf/models';\n import { useDocumentState } from '@embedpdf/core/svelte';\n import { useZoomCapability } from '../hooks/use-zoom.svelte';\n\n interface MarqueeZoomProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n class?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n }\n\n let {\n documentId,\n pageIndex,\n scale: scaleOverride,\n class: propsClass,\n stroke = 'rgba(33,150,243,0.8)',\n fill = 'rgba(33,150,243,0.15)',\n }: MarqueeZoomProps = $props();\n\n const zoomCapability = useZoomCapability();\n const documentState = useDocumentState(() => documentId);\n\n let rect = $state<Rect | null>(null);\n\n const actualScale = $derived(\n scaleOverride !== undefined ? scaleOverride : (documentState.current?.scale ?? 1),\n );\n\n $effect(() => {\n rect = null;\n\n if (!zoomCapability.provides) {\n return;\n }\n\n return zoomCapability.provides.registerMarqueeOnPage({\n documentId,\n pageIndex,\n scale: actualScale,\n callback: {\n onPreview: (newRect) => {\n rect = newRect;\n },\n },\n });\n });\n</script>\n\n{#if rect}\n <div\n style:position=\"absolute\"\n style:pointer-events=\"none\"\n style:left={`${rect.origin.x * actualScale}px`}\n style:top={`${rect.origin.y * actualScale}px`}\n style:width={`${rect.size.width * actualScale}px`}\n style:height={`${rect.size.height * actualScale}px`}\n style:border={`1px solid ${stroke}`}\n style:background={fill}\n style:box-sizing=\"border-box\"\n class={propsClass}\n ></div>\n{/if}\n","<script lang=\"ts\">\n import { useZoomGesture } from '../hooks';\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n\n type ZoomGestureWrapperProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n documentId: string;\n children: Snippet;\n class?: string;\n /** Enable pinch-to-zoom gesture (default: true) */\n enablePinch?: boolean;\n /** Enable wheel zoom with ctrl/cmd key (default: true) */\n enableWheel?: boolean;\n };\n\n let {\n documentId,\n children,\n class: propsClass,\n enablePinch = true,\n enableWheel = true,\n ...restProps\n }: ZoomGestureWrapperProps = $props();\n\n const zoomGesture = useZoomGesture(() => documentId, {\n enablePinch: () => enablePinch,\n enableWheel: () => enableWheel,\n });\n</script>\n\n<div\n bind:this={zoomGesture.elementRef}\n {...restProps}\n style:display=\"inline-block\"\n style:overflow=\"visible\"\n style:box-sizing=\"border-box\"\n class={propsClass}\n>\n {@render children()}\n</div>\n"],"names":["useZoomCapability","useCapability","ZoomPlugin","id","getTouchDistance","touches","t1","t2","dx","clientX","dy","clientY","Math","hypot","useZoomGesture","getDocumentId","options","viewportCapability","zoomCapability","viewportElementCtx","getContext","cleanup","elementRef","documentId","enablePinch","$","derived","_a","call","enableWheel","user_effect","element","container","current","viewport","provides","zoom","docId","pinchEnabled","wheelEnabled","zoomProvides","viewportGap","window","zoomScope","forDocument","getState","initialZoom","currentScale","isPinching","initialDistance","wheelZoomTimeout","accumulatedWheelScale","initialElementWidth","initialElementHeight","initialElementLeft","initialElementTop","containerRectWidth","containerRectHeight","layoutWidth","layoutCenterX","pointerLocalY","pointerContainerX","pointerContainerY","currentGap","pivotLocalX","clamp","val","min","max","updateMargin","availableWidth","clientWidth","elementWidth","offsetWidth","newMargin","style","marginLeft","calculateTransform","scale","finalWidth","finalHeight","ty","txCenter","txMouse","overflow","blendRange","blend","tx","updateTransform","transformOrigin","transform","resetTransform","commitZoom","delta","anchorX","anchorY","scaleDiff","abs","requestZoomBy","vx","vy","initializeGestureState","containerRect","getBoundingClientRect","innerRect","width","height","left","top","clientLeft","rawPointerLocalX","handleTouchStart","e","length","currentZoomLevel","center","x","y","getTouchCenter","preventDefault","handleTouchMove","currentDistance","handleTouchEnd","handleWheel","ctrlKey","metaKey","clearTimeout","zoomFactor","deltaY","setTimeout","unsubZoom","onStateChange","resizeObserver","ResizeObserver","observe","addEventListener","passive","removeEventListener","disconnect","setupZoomGestures","getViewportGap","value","set","stroke","fill","documentState","useDocumentState","$$props","rect","actualScale","registerMarqueeOnPage","pageIndex","callback","onPreview","newRect","get","origin","size","consequent","restProps","rest_props","zoomGesture","bind_this","div","$$value","capability","state","initialDocumentState","scopedProvides","scope","newState","usePlugin"],"mappings":"whBAQaA,EAAA,IAA0BC,gBAA0BC,EAAAA,WAAWC,ICY5E,SAASC,EAAiBC,GACxB,MAAOC,EAAIC,GAAM,CAACF,EAAQ,GAAIA,EAAQ,IAChCG,EAAKD,EAAGE,QAAUH,EAAGG,QACrBC,EAAKH,EAAGI,QAAUL,EAAGK,QAC3B,OAAOC,KAAKC,MAAML,EAAIE,EACxB,CCFgB,SAAAI,EACdC,EACAC,YAEMC,EAAqBhB,EAAAA,cAA8B,YACnDiB,EAAiBlB,IACjBmB,EAAqBC,EAAAA,WAA+C,oBAEtE,IACAC,EADAC,UAA2C,MAIzC,MAAAC,YAAsBR,GACtBS,EAAAC,EAAAC,QAAA,WAAuB,OAAA,OAAAC,EAAAX,EAAQQ,kBAAR,EAAAG,EAAAC,KAAAZ,MAA2B,IAClDa,EAAAJ,EAAAC,QAAA,WAAuB,OAAA,OAAAC,EAAAX,EAAQa,kBAAR,EAAAF,EAAAC,KAAAZ,MAA2B,WAExDS,EAAAK,iBACQ,MAAAC,QAAUT,GACVU,EAAY,MAAAb,OAAA,EAAAA,EAAoBc,QAChCC,EAAWjB,EAAmBkB,SAC9BC,EAAOlB,EAAeiB,SACtBE,QAAQd,GACRe,QAAed,GACfe,QAAeV,GAShB,GANDR,IACFA,IACAA,UAIGU,GAAYC,GAAcI,GAASC,SAIxChB,EDxBG,UAA2BU,QAChCA,EAAAC,UACAA,EAA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