@embedpdf/utils 1.3.11 → 1.3.13

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.
@@ -1,13 +1,12 @@
1
1
  import { Rect, Rotation } from '@embedpdf/models';
2
- import { ReactNode, CSSProperties, PointerEvent, TouchEvent } from '../../preact/adapter.ts';
2
+ import { ReactNode, CSSProperties } from '../../preact/adapter.ts';
3
3
  interface CounterRotateProps {
4
4
  rect: Rect;
5
5
  rotation: Rotation;
6
6
  }
7
7
  export interface MenuWrapperProps {
8
8
  style: CSSProperties;
9
- onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;
10
- onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;
9
+ ref: (el: HTMLDivElement | null) => void;
11
10
  }
12
11
  interface CounterRotateComponentProps extends CounterRotateProps {
13
12
  children: (props: {
@@ -1,13 +1,12 @@
1
1
  import { Rect, Rotation } from '@embedpdf/models';
2
- import { ReactNode, CSSProperties, PointerEvent, TouchEvent } from '../../react/adapter.ts';
2
+ import { ReactNode, CSSProperties } from '../../react/adapter.ts';
3
3
  interface CounterRotateProps {
4
4
  rect: Rect;
5
5
  rotation: Rotation;
6
6
  }
7
7
  export interface MenuWrapperProps {
8
8
  style: CSSProperties;
9
- onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;
10
- onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;
9
+ ref: (el: HTMLDivElement | null) => void;
11
10
  }
12
11
  interface CounterRotateComponentProps extends CounterRotateProps {
13
12
  children: (props: {
@@ -1 +1,3 @@
1
1
  export * from './use-drag-resize';
2
+ export * from './use-double-press-props';
3
+ export * from './use-interaction-handles';
@@ -0,0 +1,37 @@
1
+ type DoublePressOptions = {
2
+ delay?: number;
3
+ tolerancePx?: number;
4
+ };
5
+ type DoubleHandler = ((e: PointerEvent | MouseEvent) => void) | undefined;
6
+ type DoubleProps = {
7
+ onDblclick?: (e: MouseEvent) => void;
8
+ onPointerupCapture?: (e: PointerEvent) => void;
9
+ };
10
+ /**
11
+ * Vue composable for handling double-press/double-tap interactions.
12
+ *
13
+ * @param onDouble - Callback to invoke on double press/tap
14
+ * @param options - Configuration for delay and spatial tolerance
15
+ * @returns Event handler props to be spread on an element with v-bind
16
+ *
17
+ * @example
18
+ * ```vue
19
+ * <script setup>
20
+ * import { useDoublePressProps } from '@embedpdf/utils/vue';
21
+ *
22
+ * const handleDoubleClick = (e) => {
23
+ * console.log('Double clicked!');
24
+ * };
25
+ *
26
+ * const doubleProps = useDoublePressProps(handleDoubleClick);
27
+ * </script>
28
+ *
29
+ * <template>
30
+ * <div v-bind="doubleProps">
31
+ * Double click/tap me
32
+ * </div>
33
+ * </template>
34
+ * ```
35
+ */
36
+ export declare function useDoublePressProps(onDouble?: DoubleHandler, { delay, tolerancePx }?: DoublePressOptions): DoubleProps;
37
+ export {};
@@ -1,12 +1,20 @@
1
+ import { Position, Rect } from '@embedpdf/models';
1
2
  import { DragResizeConfig, InteractionEvent, ResizeHandle } from '../../shared-vue/plugin-interaction-primitives';
2
- export interface UseDragResizeOptions extends DragResizeConfig {
3
+ import { MaybeRef } from '../utils/interaction-normalize';
4
+ export interface UseDragResizeOptions {
5
+ element: MaybeRef<Rect>;
6
+ vertices?: MaybeRef<Position[]>;
7
+ constraints?: MaybeRef<DragResizeConfig['constraints']>;
8
+ maintainAspectRatio?: MaybeRef<boolean>;
9
+ pageRotation?: MaybeRef<number>;
10
+ scale?: MaybeRef<number>;
3
11
  onUpdate?: (event: InteractionEvent) => void;
4
- enabled?: boolean;
12
+ enabled?: MaybeRef<boolean>;
5
13
  }
6
14
  export declare function useDragResize(options: UseDragResizeOptions): {
7
15
  dragProps: import('vue').ComputedRef<{
8
16
  onPointerdown: (e: PointerEvent) => void;
9
- onPointermove: (e: PointerEvent) => void;
17
+ onPointermove: (e: PointerEvent) => void | undefined;
10
18
  onPointerup: (e: PointerEvent) => void;
11
19
  onPointercancel: (e: PointerEvent) => void;
12
20
  } | {
@@ -17,7 +25,13 @@ export declare function useDragResize(options: UseDragResizeOptions): {
17
25
  }>;
18
26
  createResizeProps: (handle: ResizeHandle) => {
19
27
  onPointerdown: (e: PointerEvent) => void;
20
- onPointermove: (e: PointerEvent) => void;
28
+ onPointermove: (e: PointerEvent) => void | undefined;
29
+ onPointerup: (e: PointerEvent) => void;
30
+ onPointercancel: (e: PointerEvent) => void;
31
+ };
32
+ createVertexProps: (vertexIndex: number) => {
33
+ onPointerdown: (e: PointerEvent) => void;
34
+ onPointermove: (e: PointerEvent) => void | undefined;
21
35
  onPointerup: (e: PointerEvent) => void;
22
36
  onPointercancel: (e: PointerEvent) => void;
23
37
  };
@@ -0,0 +1,34 @@
1
+ import { CSSProperties } from 'vue';
2
+ import { UseDragResizeOptions } from './use-drag-resize';
3
+ import { ResizeUI, VertexUI } from '../../shared-vue/plugin-interaction-primitives/utils';
4
+ export type HandleElementProps = {
5
+ key: string | number;
6
+ style: CSSProperties;
7
+ onPointerdown: (e: PointerEvent) => void;
8
+ onPointermove: (e: PointerEvent) => void;
9
+ onPointerup: (e: PointerEvent) => void;
10
+ onPointercancel: (e: PointerEvent) => void;
11
+ } & Record<string, any>;
12
+ export interface UseInteractionHandlesOptions {
13
+ controller: UseDragResizeOptions;
14
+ resizeUI?: ResizeUI;
15
+ vertexUI?: VertexUI;
16
+ includeVertices?: boolean;
17
+ handleAttrs?: (h: 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w') => Record<string, any> | void;
18
+ vertexAttrs?: (i: number) => Record<string, any> | void;
19
+ }
20
+ export declare function useInteractionHandles(opts: UseInteractionHandlesOptions): {
21
+ dragProps: import('vue').ComputedRef<{
22
+ onPointerdown: (e: PointerEvent) => void;
23
+ onPointermove: (e: PointerEvent) => void | undefined;
24
+ onPointerup: (e: PointerEvent) => void;
25
+ onPointercancel: (e: PointerEvent) => void;
26
+ } | {
27
+ onPointerdown?: undefined;
28
+ onPointermove?: undefined;
29
+ onPointerup?: undefined;
30
+ onPointercancel?: undefined;
31
+ }>;
32
+ resize: import('vue').ComputedRef<HandleElementProps[]>;
33
+ vertices: import('vue').ComputedRef<HandleElementProps[]>;
34
+ };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),e=require("@embedpdf/utils"),i=t.defineComponent({__name:"counter-rotate-container",props:{rect:{},rotation:{}},setup(i){const s=i,{matrix:n,width:a,height:r}=e.getCounterRotation(s.rect,s.rotation),o=t.computed((()=>({style:{position:"absolute",left:`${s.rect.origin.x}px`,top:`${s.rect.origin.y}px`,transform:n,transformOrigin:"0 0",width:`${a}px`,height:`${r}px`,pointerEvents:"none",zIndex:3},onPointerDown:t=>t.stopPropagation(),onTouchStart:t=>t.stopPropagation()}))),h=t.computed((()=>({origin:{x:s.rect.origin.x,y:s.rect.origin.y},size:{width:a,height:r}})));return(e,i)=>t.renderSlot(e.$slots,"default",{menuWrapperProps:o.value,matrix:t.unref(n),rect:h.value})}});class s{constructor(t,e){this.config=t,this.onUpdate=e,this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[],this.currentVertices=[],this.currentVertices=t.vertices||[]}updateConfig(t){this.config={...this.config,...t},this.currentVertices=t.vertices||[]}startDrag(t,e){this.state="dragging",this.startPoint={x:t,y:e},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"move",changes:{rect:this.startElement}}})}startResize(t,e,i){this.state="resizing",this.activeHandle=t,this.startPoint={x:e,y:i},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"resize",changes:{rect:this.startElement},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}startVertexEdit(t,e,i){this.currentVertices=[...this.config.vertices??this.currentVertices],t<0||t>=this.currentVertices.length||(this.state="vertex-editing",this.activeVertexIndex=t,this.startPoint={x:e,y:i},this.startVertices=[...this.currentVertices],this.onUpdate({state:"start",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:t}}}))}move(t,e){if("idle"!==this.state&&this.startPoint)if("dragging"===this.state&&this.startElement){const i=this.calculateDelta(t,e),s=this.calculateDragPosition(i);this.currentPosition=s,this.onUpdate({state:"move",transformData:{type:"move",changes:{rect:s}}})}else if("resizing"===this.state&&this.activeHandle&&this.startElement){const i=this.calculateDelta(t,e),s=this.calculateResizePosition(i,this.activeHandle);this.currentPosition=s,this.onUpdate({state:"move",transformData:{type:"resize",changes:{rect:s},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}else if("vertex-editing"===this.state&&null!==this.activeVertexIndex){const i=this.calculateVertexPosition(t,e);this.currentVertices=i,this.onUpdate({state:"move",transformData:{type:"vertex-edit",changes:{vertices:i},metadata:{vertexIndex:this.activeVertexIndex}}})}}end(){if("idle"===this.state)return;const t=this.state,e=this.activeHandle,i=this.activeVertexIndex;if("vertex-editing"===t)this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.currentVertices},metadata:{vertexIndex:i||void 0}}});else{const i=this.getCurrentPosition();this.onUpdate({state:"end",transformData:{type:"dragging"===t?"move":"resize",changes:{rect:i},metadata:"dragging"===t?void 0:{handle:e||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}})}this.reset()}cancel(){"idle"!==this.state&&("vertex-editing"===this.state?this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:this.activeVertexIndex||void 0}}}):this.startElement&&this.onUpdate({state:"end",transformData:{type:"dragging"===this.state?"move":"resize",changes:{rect:this.startElement},metadata:"dragging"===this.state?void 0:{handle:this.activeHandle||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}}),this.reset())}reset(){this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[]}getCurrentPosition(){return this.currentPosition||this.config.element}calculateDelta(t,e){if(!this.startPoint)return{x:0,y:0};const i={x:t-this.startPoint.x,y:e-this.startPoint.y};return this.transformDelta(i)}transformDelta(t){const{pageRotation:e=0,scale:i=1}=this.config,s=e*Math.PI/2,n=Math.cos(s),a=Math.sin(s),r=t.x/i,o=t.y/i;return{x:n*r+a*o,y:-a*r+n*o}}clampPoint(t){var e;const i=null==(e=this.config.constraints)?void 0:e.boundingBox;return i?{x:Math.max(0,Math.min(t.x,i.width)),y:Math.max(0,Math.min(t.y,i.height))}:t}calculateVertexPosition(t,e){if(null===this.activeVertexIndex)return this.startVertices;const i=this.calculateDelta(t,e),s=[...this.startVertices],n=s[this.activeVertexIndex],a={x:n.x+i.x,y:n.y+i.y};return s[this.activeVertexIndex]=this.clampPoint(a),s}calculateDragPosition(t){if(!this.startElement)return this.config.element;const e={origin:{x:this.startElement.origin.x+t.x,y:this.startElement.origin.y+t.y},size:{width:this.startElement.size.width,height:this.startElement.size.height}};return this.applyConstraints(e)}calculateResizePosition(t,e){var i;if(!this.startElement)return this.config.element;let{origin:{x:s,y:n},size:{width:a,height:r}}=this.startElement;switch(e){case"se":a+=t.x,r+=t.y;break;case"sw":s+=t.x,a-=t.x,r+=t.y;break;case"ne":a+=t.x,n+=t.y,r-=t.y;break;case"nw":s+=t.x,a-=t.x,n+=t.y,r-=t.y;break;case"n":n+=t.y,r-=t.y;break;case"s":r+=t.y;break;case"e":a+=t.x;break;case"w":s+=t.x,a-=t.x}if(this.config.maintainAspectRatio&&this.startElement){const t=this.startElement.size.width/this.startElement.size.height;if(["n","s","e","w"].includes(e))if("n"===e||"s"===e){const e=r*t,i=e-a;a=e,s-=i/2}else{const i=a/t,o=i-r;r=i,"w"===e&&(s=this.startElement.origin.x+this.startElement.size.width-a),n-=o/2}else{Math.abs(a-this.startElement.size.width)>Math.abs(r-this.startElement.size.height)?r=a/t:a=r*t,e.includes("w")&&(s=this.startElement.origin.x+this.startElement.size.width-a),e.includes("n")&&(n=this.startElement.origin.y+this.startElement.size.height-r)}}const o=null==(i=this.config.constraints)?void 0:i.boundingBox;if(o)switch(e){case"e":a=Math.min(a,o.width-s);break;case"s":r=Math.min(r,o.height-n);break;case"se":a=Math.min(a,o.width-s),r=Math.min(r,o.height-n);break;case"w":s<0&&(a+=s,s=0);break;case"n":n<0&&(r+=n,n=0);break;case"sw":s<0&&(a+=s,s=0),r=Math.min(r,o.height-n);break;case"nw":s<0&&(a+=s,s=0),n<0&&(r+=n,n=0);break;case"ne":a=Math.min(a,o.width-s),n<0&&(r+=n,n=0)}return this.applyConstraints({origin:{x:s,y:n},size:{width:a,height:r}})}applyConstraints(t){const{constraints:e}=this.config;if(!e)return t;let{origin:{x:i,y:s},size:{width:n,height:a}}=t;return n=Math.max(e.minWidth||1,n),a=Math.max(e.minHeight||1,a),e.maxWidth&&(n=Math.min(e.maxWidth,n)),e.maxHeight&&(a=Math.min(e.maxHeight,a)),e.boundingBox&&(i=Math.max(0,Math.min(i,e.boundingBox.width-n)),s=Math.max(0,Math.min(s,e.boundingBox.height-a))),{origin:{x:i,y:s},size:{width:n,height:a}}}}exports.CounterRotate=i,exports.useDragResize=function(e){const i=t.ref(null),{onUpdate:n,enabled:a=!0,...r}=e;i.value||(i.value=new s(r,(t=>null==n?void 0:n(t)))),t.watch((()=>({element:r.element,constraints:r.constraints,maintainAspectRatio:r.maintainAspectRatio,pageRotation:r.pageRotation,scale:r.scale})),(t=>{var e;null==(e=i.value)||e.updateConfig(t)}),{deep:!0}),t.onUnmounted((()=>{i.value=null}));const o=t=>{var e;a&&(t.preventDefault(),t.stopPropagation(),null==(e=i.value)||e.startDrag(t.clientX,t.clientY),t.currentTarget.setPointerCapture(t.pointerId))},h=t=>{var e;null==(e=i.value)||e.move(t.clientX,t.clientY)},c=t=>{var e,s,n;null==(e=i.value)||e.end(),null==(n=(s=t.currentTarget).releasePointerCapture)||n.call(s,t.pointerId)},l=t=>{var e,s,n;null==(e=i.value)||e.cancel(),null==(n=(s=t.currentTarget).releasePointerCapture)||n.call(s,t.pointerId)};return{dragProps:t.computed((()=>a?{onPointerdown:o,onPointermove:h,onPointerup:c,onPointercancel:l}:{})),createResizeProps:t=>({onPointerdown:e=>{var s;a&&(e.preventDefault(),e.stopPropagation(),null==(s=i.value)||s.startResize(t,e.clientX,e.clientY),e.currentTarget.setPointerCapture(e.pointerId))},onPointermove:h,onPointerup:c,onPointercancel:l})}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),e=require("@embedpdf/utils"),i=t.defineComponent({__name:"counter-rotate-container",props:{rect:{},rotation:{}},setup(i){const n=i,a=t.computed((()=>e.getCounterRotation(n.rect,n.rotation))),s=t.computed((()=>({style:{position:"absolute",left:`${n.rect.origin.x}px`,top:`${n.rect.origin.y}px`,transform:a.value.matrix,transformOrigin:"0 0",width:`${a.value.width}px`,height:`${a.value.height}px`,pointerEvents:"none",zIndex:3},onPointerdown:t=>{t.stopPropagation(),t.preventDefault()},onTouchstart:t=>{t.stopPropagation(),t.preventDefault()}}))),r=t.computed((()=>({origin:{x:n.rect.origin.x,y:n.rect.origin.y},size:{width:a.value.width,height:a.value.height}})));return(e,i)=>t.renderSlot(e.$slots,"default",{menuWrapperProps:s.value,matrix:a.value.matrix,rect:r.value})}});class n{constructor(t,e){this.config=t,this.onUpdate=e,this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[],this.currentVertices=[],this.currentVertices=t.vertices||[]}updateConfig(t){this.config={...this.config,...t},this.currentVertices=t.vertices||[]}startDrag(t,e){this.state="dragging",this.startPoint={x:t,y:e},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"move",changes:{rect:this.startElement}}})}startResize(t,e,i){this.state="resizing",this.activeHandle=t,this.startPoint={x:e,y:i},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"resize",changes:{rect:this.startElement},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}startVertexEdit(t,e,i){this.currentVertices=[...this.config.vertices??this.currentVertices],t<0||t>=this.currentVertices.length||(this.state="vertex-editing",this.activeVertexIndex=t,this.startPoint={x:e,y:i},this.startVertices=[...this.currentVertices],this.onUpdate({state:"start",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:t}}}))}move(t,e){if("idle"!==this.state&&this.startPoint)if("dragging"===this.state&&this.startElement){const i=this.calculateDelta(t,e),n=this.calculateDragPosition(i);this.currentPosition=n,this.onUpdate({state:"move",transformData:{type:"move",changes:{rect:n}}})}else if("resizing"===this.state&&this.activeHandle&&this.startElement){const i=this.calculateDelta(t,e),n=this.calculateResizePosition(i,this.activeHandle);this.currentPosition=n,this.onUpdate({state:"move",transformData:{type:"resize",changes:{rect:n},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}else if("vertex-editing"===this.state&&null!==this.activeVertexIndex){const i=this.calculateVertexPosition(t,e);this.currentVertices=i,this.onUpdate({state:"move",transformData:{type:"vertex-edit",changes:{vertices:i},metadata:{vertexIndex:this.activeVertexIndex}}})}}end(){if("idle"===this.state)return;const t=this.state,e=this.activeHandle,i=this.activeVertexIndex;if("vertex-editing"===t)this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.currentVertices},metadata:{vertexIndex:i||void 0}}});else{const i=this.getCurrentPosition();this.onUpdate({state:"end",transformData:{type:"dragging"===t?"move":"resize",changes:{rect:i},metadata:"dragging"===t?void 0:{handle:e||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}})}this.reset()}cancel(){"idle"!==this.state&&("vertex-editing"===this.state?this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:this.activeVertexIndex||void 0}}}):this.startElement&&this.onUpdate({state:"end",transformData:{type:"dragging"===this.state?"move":"resize",changes:{rect:this.startElement},metadata:"dragging"===this.state?void 0:{handle:this.activeHandle||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}}),this.reset())}reset(){this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[]}getCurrentPosition(){return this.currentPosition||this.config.element}calculateDelta(t,e){if(!this.startPoint)return{x:0,y:0};const i={x:t-this.startPoint.x,y:e-this.startPoint.y};return this.transformDelta(i)}transformDelta(t){const{pageRotation:e=0,scale:i=1}=this.config,n=e*Math.PI/2,a=Math.cos(n),s=Math.sin(n),r=t.x/i,o=t.y/i;return{x:a*r+s*o,y:-s*r+a*o}}clampPoint(t){var e;const i=null==(e=this.config.constraints)?void 0:e.boundingBox;return i?{x:Math.max(0,Math.min(t.x,i.width)),y:Math.max(0,Math.min(t.y,i.height))}:t}calculateVertexPosition(t,e){if(null===this.activeVertexIndex)return this.startVertices;const i=this.calculateDelta(t,e),n=[...this.startVertices],a=n[this.activeVertexIndex],s={x:a.x+i.x,y:a.y+i.y};return n[this.activeVertexIndex]=this.clampPoint(s),n}calculateDragPosition(t){if(!this.startElement)return this.config.element;const e={origin:{x:this.startElement.origin.x+t.x,y:this.startElement.origin.y+t.y},size:{width:this.startElement.size.width,height:this.startElement.size.height}};return this.applyConstraints(e)}calculateResizePosition(t,e){var i;if(!this.startElement)return this.config.element;let{origin:{x:n,y:a},size:{width:s,height:r}}=this.startElement;switch(e){case"se":s+=t.x,r+=t.y;break;case"sw":n+=t.x,s-=t.x,r+=t.y;break;case"ne":s+=t.x,a+=t.y,r-=t.y;break;case"nw":n+=t.x,s-=t.x,a+=t.y,r-=t.y;break;case"n":a+=t.y,r-=t.y;break;case"s":r+=t.y;break;case"e":s+=t.x;break;case"w":n+=t.x,s-=t.x}if(this.config.maintainAspectRatio&&this.startElement){const t=this.startElement.size.width/this.startElement.size.height;if(["n","s","e","w"].includes(e))if("n"===e||"s"===e){const e=r*t,i=e-s;s=e,n-=i/2}else{const i=s/t,o=i-r;r=i,"w"===e&&(n=this.startElement.origin.x+this.startElement.size.width-s),a-=o/2}else{Math.abs(s-this.startElement.size.width)>Math.abs(r-this.startElement.size.height)?r=s/t:s=r*t,e.includes("w")&&(n=this.startElement.origin.x+this.startElement.size.width-s),e.includes("n")&&(a=this.startElement.origin.y+this.startElement.size.height-r)}}const o=null==(i=this.config.constraints)?void 0:i.boundingBox;if(o)switch(e){case"e":s=Math.min(s,o.width-n);break;case"s":r=Math.min(r,o.height-a);break;case"se":s=Math.min(s,o.width-n),r=Math.min(r,o.height-a);break;case"w":n<0&&(s+=n,n=0);break;case"n":a<0&&(r+=a,a=0);break;case"sw":n<0&&(s+=n,n=0),r=Math.min(r,o.height-a);break;case"nw":n<0&&(s+=n,n=0),a<0&&(r+=a,a=0);break;case"ne":s=Math.min(s,o.width-n),a<0&&(r+=a,a=0)}return this.applyConstraints({origin:{x:n,y:a},size:{width:s,height:r}})}applyConstraints(t){const{constraints:e}=this.config;if(!e)return t;let{origin:{x:i,y:n},size:{width:a,height:s}}=t;return a=Math.max(e.minWidth||1,a),s=Math.max(e.minHeight||1,s),e.maxWidth&&(a=Math.min(e.maxWidth,a)),e.maxHeight&&(s=Math.min(e.maxHeight,s)),e.boundingBox&&(i=Math.max(0,Math.min(i,e.boundingBox.width-a)),n=Math.max(0,Math.min(n,e.boundingBox.height-s))),{origin:{x:i,y:n},size:{width:a,height:s}}}}function a(t,e){return"n"===t||"s"===t?"ns-resize":"e"===t||"w"===t?"ew-resize":e%2==0?{nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"}[t]:{nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"}[t]}function s(t,e,i){const n=-t/2;return"center"===i?n:"outside"===i?n-e:n+e}const r=e=>t.toRaw(t.isRef(e)?t.unref(e):e),o=(t,e=0)=>{const i=Number(t);return Number.isFinite(i)?i:e},l=t=>{var e,i,n,a;return{origin:{x:o(null==(e=null==t?void 0:t.origin)?void 0:e.x),y:o(null==(i=null==t?void 0:t.origin)?void 0:i.y)},size:{width:o(null==(n=null==t?void 0:t.size)?void 0:n.width),height:o(null==(a=null==t?void 0:t.size)?void 0:a.height)}}},c=(t=[])=>t.map((t=>({x:o(null==t?void 0:t.x),y:o(null==t?void 0:t.y)}))),h=t=>void 0===t?void 0:Boolean(t),d=t=>void 0===t?void 0:o(t),u=t=>t?r(t):void 0;function p(e){const i=t.ref(null),{onUpdate:a,element:s,vertices:o,constraints:p,maintainAspectRatio:v,pageRotation:m,scale:g,enabled:x}=e,f={element:l(r(s)),vertices:o?c(r(o)):void 0,constraints:u(p),maintainAspectRatio:h(void 0===x?void 0:r(v)),pageRotation:d(void 0===m?void 0:r(m)),scale:d(void 0===g?void 0:r(g))};i.value||(i.value=t.markRaw(new n(f,(t=>null==a?void 0:a(t))))),t.watch((()=>({element:s,vertices:o,constraints:p,maintainAspectRatio:v,pageRotation:m,scale:g})),(t=>{var e;null==(e=i.value)||e.updateConfig({element:l(r(t.element)),vertices:t.vertices?c(r(t.vertices)):void 0,constraints:u(t.constraints),maintainAspectRatio:h(void 0===t.maintainAspectRatio?void 0:r(t.maintainAspectRatio)),pageRotation:d(void 0===t.pageRotation?void 0:r(t.pageRotation)),scale:d(void 0===t.scale?void 0:r(t.scale))})}),{deep:!0}),t.onUnmounted((()=>{i.value=null}));const y=()=>Boolean(void 0===x||r(x)),P=t=>{var e,n,a;y()&&(t.preventDefault(),t.stopPropagation(),null==(e=i.value)||e.startDrag(t.clientX,t.clientY),null==(a=(n=t.currentTarget).setPointerCapture)||a.call(n,t.pointerId))},w=t=>{var e;return null==(e=i.value)?void 0:e.move(t.clientX,t.clientY)},z=t=>{var e,n,a;null==(e=i.value)||e.end(),null==(a=(n=t.currentTarget).releasePointerCapture)||a.call(n,t.pointerId)},R=t=>{var e,n,a;null==(e=i.value)||e.cancel(),null==(a=(n=t.currentTarget).releasePointerCapture)||a.call(n,t.pointerId)};return{dragProps:t.computed((()=>y()?{onPointerdown:P,onPointermove:w,onPointerup:z,onPointercancel:R}:{})),createResizeProps:t=>({onPointerdown:e=>{var n,a,s;y()&&(e.preventDefault(),e.stopPropagation(),null==(n=i.value)||n.startResize(t,e.clientX,e.clientY),null==(s=(a=e.currentTarget).setPointerCapture)||s.call(a,e.pointerId))},onPointermove:w,onPointerup:z,onPointercancel:R}),createVertexProps:t=>({onPointerdown:e=>{var n,a,s;y()&&(e.preventDefault(),e.stopPropagation(),null==(n=i.value)||n.startVertexEdit(t,e.clientX,e.clientY),null==(s=(a=e.currentTarget).setPointerCapture)||s.call(a,e.pointerId))},onPointermove:w,onPointerup:z,onPointercancel:R})}}exports.CounterRotate=i,exports.deepToRaw=function(e){const i=e=>Array.isArray(e)?e.map((t=>i(t))):t.isRef(e)||t.isReactive(e)||t.isProxy(e)?i(t.toRaw(e)):e&&"object"==typeof e?Object.keys(e).reduce(((t,n)=>(t[n]=i(e[n]),t)),{}):e;return i(e)},exports.useDoublePressProps=function(e,{delay:i=300,tolerancePx:n=18}={}){const a=t.ref({t:0,x:0,y:0});return e?{onDblclick:t=>{null==e||e(t)},onPointerupCapture:t=>{if(!e)return;if("mouse"===t.pointerType||!1===t.isPrimary)return;const s=performance.now(),r=t.clientX,o=t.clientY,l=s-a.value.t<=i,c=r-a.value.x,h=o-a.value.y;l&&c*c+h*h<=n*n&&(null==e||e(t)),a.value={t:s,x:r,y:o}}}:{}},exports.useDragResize=p,exports.useInteractionHandles=function(e){const{controller:i,resizeUI:n,vertexUI:o,includeVertices:h=!1,handleAttrs:d,vertexAttrs:u}=e,{dragProps:v,createResizeProps:m,createVertexProps:g}=p(i),x=t.computed((()=>l(r(i.element)))),f=t.computed((()=>i.vertices?c(r(i.vertices)):void 0)),y=t.computed((()=>Number(r(i.scale??1)))),P=t.computed((()=>Number(r(i.pageRotation??0)))),w=t.computed((()=>void 0===i.maintainAspectRatio?void 0:Boolean(r(i.maintainAspectRatio)))),z=t.computed((()=>r(i.constraints??void 0)));return{dragProps:v,resize:t.computed((()=>function(t,e={}){const{handleSize:i=8,spacing:n=1,offsetMode:r="outside",includeSides:o=!1,zIndex:l=3,rotationAwareCursor:c=!0}=e,h=(t.pageRotation??0)%4,d=t=>({[t]:s(i,n,r)+"px"});return[["nw",{...d("top"),...d("left")}],["ne",{...d("top"),...d("right")}],["sw",{...d("bottom"),...d("left")}],["se",{...d("bottom"),...d("right")}],...o?[["n",{...d("top"),left:`calc(50% - ${i/2}px)`}],["s",{...d("bottom"),left:`calc(50% - ${i/2}px)`}],["w",{...d("left"),top:`calc(50% - ${i/2}px)`}],["e",{...d("right"),top:`calc(50% - ${i/2}px)`}]]:[]].map((([t,e])=>({handle:t,style:{position:"absolute",width:i+"px",height:i+"px",borderRadius:"50%",zIndex:l,cursor:c?a(t,h):"default",touchAction:"none",...e},attrs:{"data-epdf-handle":t}})))}({element:x.value,scale:y.value,pageRotation:P.value,maintainAspectRatio:w.value,constraints:z.value},n).map((t=>{var e;return{key:(null==(e=t.attrs)?void 0:e["data-epdf-handle"])??t.handle,style:t.style,...m(t.handle),...t.attrs??{},...(null==d?void 0:d(t.handle))??{}}})))),vertices:t.computed((()=>{if(!h)return[];const t=f.value??[];return function(t,e={},i){const{vertexSize:n=12,zIndex:a=4}=e,s=t.element,r=t.scale??1;return(i??t.vertices??[]).map(((t,e)=>({handle:"nw",style:{position:"absolute",left:(t.x-s.origin.x)*r-n/2+"px",top:(t.y-s.origin.y)*r-n/2+"px",width:n+"px",height:n+"px",borderRadius:"50%",cursor:"pointer",zIndex:a,touchAction:"none"},attrs:{"data-epdf-vertex":e}})))}({element:x.value,scale:y.value,vertices:t},o,t).map(((t,e)=>({key:e,style:t.style,...g(e),...t.attrs??{},...(null==u?void 0:u(e))??{}})))}))}};
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/vue/components/counter-rotate-container.vue","../../src/shared/plugin-interaction-primitives/drag-resize-controller.ts","../../src/vue/hooks/use-drag-resize.ts"],"sourcesContent":["<template>\n <slot :menu-wrapper-props=\"menuWrapperProps\" :matrix=\"matrix\" :rect=\"adjustedRect\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, type CSSProperties } from 'vue';\nimport type { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nconst props = defineProps<CounterRotateProps>();\n\nconst { matrix, width, height } = getCounterRotation(props.rect, props.rotation);\n\nconst menuWrapperProps = computed(() => ({\n style: {\n position: 'absolute',\n left: `${props.rect.origin.x}px`,\n top: `${props.rect.origin.y}px`,\n transform: matrix,\n transformOrigin: '0 0',\n width: `${width}px`,\n height: `${height}px`,\n pointerEvents: 'none',\n zIndex: 3,\n } as CSSProperties,\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent) => e.stopPropagation(),\n}));\n\nconst adjustedRect = computed(() => ({\n origin: { x: props.rect.origin.x, y: props.rect.origin.y },\n size: { width, height },\n}));\n</script>\n","import { Position, Rect } from '@embedpdf/models';\n\nexport interface DragResizeConfig {\n element: Rect;\n vertices?: Position[];\n constraints?: {\n minWidth?: number;\n minHeight?: number;\n maxWidth?: number;\n maxHeight?: number;\n boundingBox?: { width: number; height: number }; // page bounds\n };\n maintainAspectRatio?: boolean;\n pageRotation?: number;\n scale?: number;\n}\n\nexport type InteractionState = 'idle' | 'dragging' | 'resizing' | 'vertex-editing';\nexport type ResizeHandle = 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w';\n\nexport interface TransformData {\n type: 'move' | 'resize' | 'vertex-edit';\n changes: {\n rect?: Rect;\n vertices?: Position[];\n };\n metadata?: {\n handle?: ResizeHandle;\n vertexIndex?: number;\n maintainAspectRatio?: boolean;\n };\n}\n\nexport interface InteractionEvent {\n state: 'start' | 'move' | 'end';\n transformData?: TransformData;\n}\n\n/**\n * Pure geometric controller that manages drag/resize/vertex-edit logic.\n */\nexport class DragResizeController {\n private state: InteractionState = 'idle';\n private startPoint: Position | null = null;\n private startElement: Rect | null = null;\n private activeHandle: ResizeHandle | null = null;\n private currentPosition: Rect | null = null;\n\n // Vertex editing state - pure geometric\n private activeVertexIndex: number | null = null;\n private startVertices: Position[] = [];\n private currentVertices: Position[] = [];\n\n constructor(\n private config: DragResizeConfig,\n private onUpdate: (event: InteractionEvent) => void,\n ) {\n this.currentVertices = config.vertices || [];\n }\n\n updateConfig(config: Partial<DragResizeConfig>) {\n this.config = { ...this.config, ...config };\n this.currentVertices = config.vertices || [];\n }\n\n startDrag(clientX: number, clientY: number) {\n this.state = 'dragging';\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'move',\n changes: {\n rect: this.startElement,\n },\n },\n });\n }\n\n startResize(handle: ResizeHandle, clientX: number, clientY: number) {\n this.state = 'resizing';\n this.activeHandle = handle;\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n startVertexEdit(vertexIndex: number, clientX: number, clientY: number) {\n // Refresh vertices from latest config before validating index\n this.currentVertices = [...(this.config.vertices ?? this.currentVertices)];\n if (vertexIndex < 0 || vertexIndex >= this.currentVertices.length) return;\n\n this.state = 'vertex-editing';\n this.activeVertexIndex = vertexIndex;\n this.startPoint = { x: clientX, y: clientY };\n this.startVertices = [...this.currentVertices];\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex,\n },\n },\n });\n }\n\n move(clientX: number, clientY: number) {\n if (this.state === 'idle' || !this.startPoint) return;\n\n if (this.state === 'dragging' && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateDragPosition(delta);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'move',\n changes: {\n rect: position,\n },\n },\n });\n } else if (this.state === 'resizing' && this.activeHandle && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateResizePosition(delta, this.activeHandle);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'resize',\n changes: {\n rect: position,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n } else if (this.state === 'vertex-editing' && this.activeVertexIndex !== null) {\n const vertices = this.calculateVertexPosition(clientX, clientY);\n this.currentVertices = vertices;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex,\n },\n },\n });\n }\n }\n\n end() {\n if (this.state === 'idle') return;\n\n const wasState = this.state;\n const handle = this.activeHandle;\n const vertexIndex = this.activeVertexIndex;\n\n if (wasState === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.currentVertices,\n },\n metadata: {\n vertexIndex: vertexIndex || undefined,\n },\n },\n });\n } else {\n const finalPosition = this.getCurrentPosition();\n this.onUpdate({\n state: 'end',\n transformData: {\n type: wasState === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: finalPosition,\n },\n metadata:\n wasState === 'dragging'\n ? undefined\n : {\n handle: handle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n cancel() {\n if (this.state === 'idle') return;\n\n if (this.state === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex || undefined,\n },\n },\n });\n } else if (this.startElement) {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: this.state === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata:\n this.state === 'dragging'\n ? undefined\n : {\n handle: this.activeHandle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n private reset() {\n this.state = 'idle';\n this.startPoint = null;\n this.startElement = null;\n this.activeHandle = null;\n this.currentPosition = null;\n this.activeVertexIndex = null;\n this.startVertices = [];\n }\n\n private getCurrentPosition() {\n return this.currentPosition || this.config.element;\n }\n\n private calculateDelta(clientX: number, clientY: number): Position {\n if (!this.startPoint) return { x: 0, y: 0 };\n\n const rawDelta: Position = {\n x: clientX - this.startPoint.x,\n y: clientY - this.startPoint.y,\n };\n\n return this.transformDelta(rawDelta);\n }\n\n private transformDelta(delta: Position): Position {\n const { pageRotation = 0, scale = 1 } = this.config;\n\n const rad = (pageRotation * Math.PI) / 2;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n\n const scaledX = delta.x / scale;\n const scaledY = delta.y / scale;\n\n return {\n x: cos * scaledX + sin * scaledY,\n y: -sin * scaledX + cos * scaledY,\n };\n }\n\n private clampPoint(p: Position): Position {\n const bbox = this.config.constraints?.boundingBox;\n if (!bbox) return p;\n return {\n x: Math.max(0, Math.min(p.x, bbox.width)),\n y: Math.max(0, Math.min(p.y, bbox.height)),\n };\n }\n\n private calculateVertexPosition(clientX: number, clientY: number): Position[] {\n if (this.activeVertexIndex === null) return this.startVertices;\n\n const delta = this.calculateDelta(clientX, clientY);\n const newVertices = [...this.startVertices];\n const currentVertex = newVertices[this.activeVertexIndex];\n\n const moved = {\n x: currentVertex.x + delta.x,\n y: currentVertex.y + delta.y,\n };\n newVertices[this.activeVertexIndex] = this.clampPoint(moved);\n\n return newVertices;\n }\n\n private calculateDragPosition(delta: Position): Rect {\n if (!this.startElement) return this.config.element;\n\n const position: Rect = {\n origin: {\n x: this.startElement.origin.x + delta.x,\n y: this.startElement.origin.y + delta.y,\n },\n size: {\n width: this.startElement.size.width,\n height: this.startElement.size.height,\n },\n };\n\n return this.applyConstraints(position);\n }\n\n private calculateResizePosition(delta: Position, handle: ResizeHandle): Rect {\n if (!this.startElement) return this.config.element;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = this.startElement;\n\n switch (handle) {\n case 'se':\n width += delta.x;\n height += delta.y;\n break;\n case 'sw':\n x += delta.x;\n width -= delta.x;\n height += delta.y;\n break;\n case 'ne':\n width += delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'nw':\n x += delta.x;\n width -= delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'n':\n y += delta.y;\n height -= delta.y;\n break;\n case 's':\n height += delta.y;\n break;\n case 'e':\n width += delta.x;\n break;\n case 'w':\n x += delta.x;\n width -= delta.x;\n break;\n }\n\n // Maintain aspect ratio if needed\n if (this.config.maintainAspectRatio && this.startElement) {\n const aspectRatio = this.startElement.size.width / this.startElement.size.height;\n\n if (['n', 's', 'e', 'w'].includes(handle)) {\n if (handle === 'n' || handle === 's') {\n const newWidth = height * aspectRatio;\n const widthDiff = newWidth - width;\n width = newWidth;\n x -= widthDiff / 2;\n } else {\n const newHeight = width / aspectRatio;\n const heightDiff = newHeight - height;\n height = newHeight;\n if (handle === 'w') {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n y -= heightDiff / 2;\n }\n } else {\n const widthChange = Math.abs(width - this.startElement.size.width);\n const heightChange = Math.abs(height - this.startElement.size.height);\n if (widthChange > heightChange) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n if (handle.includes('w')) {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n if (handle.includes('n')) {\n y = this.startElement.origin.y + this.startElement.size.height - height;\n }\n }\n }\n\n // Handle-aware bounding box clamping to avoid shifting opposite edge\n const bbox = this.config.constraints?.boundingBox;\n if (bbox) {\n switch (handle) {\n case 'e':\n width = Math.min(width, bbox.width - x);\n break;\n case 's':\n height = Math.min(height, bbox.height - y);\n break;\n case 'se':\n width = Math.min(width, bbox.width - x);\n height = Math.min(height, bbox.height - y);\n break;\n case 'w':\n if (x < 0) {\n width += x;\n x = 0;\n }\n break;\n case 'n':\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'sw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n height = Math.min(height, bbox.height - y);\n break;\n case 'nw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'ne':\n width = Math.min(width, bbox.width - x);\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n }\n }\n\n return this.applyConstraints({ origin: { x, y }, size: { width, height } });\n }\n\n private applyConstraints(position: Rect): Rect {\n const { constraints } = this.config;\n if (!constraints) return position;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = position;\n\n // Apply size constraints\n width = Math.max(constraints.minWidth || 1, width);\n height = Math.max(constraints.minHeight || 1, height);\n\n if (constraints.maxWidth) width = Math.min(constraints.maxWidth, width);\n if (constraints.maxHeight) height = Math.min(constraints.maxHeight, height);\n\n // Apply bounding box constraints\n if (constraints.boundingBox) {\n x = Math.max(0, Math.min(x, constraints.boundingBox.width - width));\n y = Math.max(0, Math.min(y, constraints.boundingBox.height - height));\n }\n\n return { origin: { x, y }, size: { width, height } };\n }\n}\n","import { ref, watch, computed, onUnmounted } from 'vue';\nimport {\n DragResizeController,\n DragResizeConfig,\n InteractionEvent,\n ResizeHandle,\n} from '../../shared/plugin-interaction-primitives';\n\nexport interface UseDragResizeOptions extends DragResizeConfig {\n onUpdate?: (event: InteractionEvent) => void;\n enabled?: boolean;\n}\n\nexport function useDragResize(options: UseDragResizeOptions) {\n const controller = ref<DragResizeController | null>(null);\n\n // Extract reactive options\n const { onUpdate, enabled = true, ...config } = options;\n\n // Initialize controller\n if (!controller.value) {\n controller.value = new DragResizeController(config, (event) => onUpdate?.(event));\n }\n\n // Watch for config changes\n watch(\n () => ({\n element: config.element,\n constraints: config.constraints,\n maintainAspectRatio: config.maintainAspectRatio,\n pageRotation: config.pageRotation,\n scale: config.scale,\n }),\n (newConfig) => {\n controller.value?.updateConfig(newConfig);\n },\n { deep: true },\n );\n\n // Cleanup on unmount\n onUnmounted(() => {\n controller.value = null;\n });\n\n // Drag handlers\n const handleDragStart = (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startDrag(e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n };\n\n const handleMove = (e: PointerEvent) => {\n controller.value?.move(e.clientX, e.clientY);\n };\n\n const handleEnd = (e: PointerEvent) => {\n controller.value?.end();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n const handleCancel = (e: PointerEvent) => {\n controller.value?.cancel();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n // Create resize handler factory\n const createResizeProps = (handle: ResizeHandle) => ({\n onPointerdown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startResize(handle, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n },\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n });\n\n // Computed drag props\n const dragProps = computed(() =>\n enabled\n ? {\n onPointerdown: handleDragStart,\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n }\n : {},\n );\n\n return {\n dragProps,\n createResizeProps,\n };\n}\n"],"names":["props","__props","matrix","width","height","getCounterRotation","rect","rotation","menuWrapperProps","computed","style","position","left","origin","x","top","y","transform","transformOrigin","pointerEvents","zIndex","onPointerDown","e","stopPropagation","onTouchStart","adjustedRect","size","_renderSlot","_ctx","$slots","value","_unref","DragResizeController","constructor","config","onUpdate","this","state","startPoint","startElement","activeHandle","currentPosition","activeVertexIndex","startVertices","currentVertices","vertices","updateConfig","startDrag","clientX","clientY","element","transformData","type","changes","startResize","handle","metadata","maintainAspectRatio","startVertexEdit","vertexIndex","length","move","delta","calculateDelta","calculateDragPosition","calculateResizePosition","calculateVertexPosition","end","wasState","finalPosition","getCurrentPosition","reset","cancel","rawDelta","transformDelta","pageRotation","scale","rad","Math","PI","cos","sin","scaledX","scaledY","clampPoint","p","bbox","_a","constraints","boundingBox","max","min","newVertices","currentVertex","moved","applyConstraints","aspectRatio","includes","newWidth","widthDiff","newHeight","heightDiff","abs","minWidth","minHeight","maxWidth","maxHeight","options","controller","ref","enabled","event","vue","watch","newConfig","deep","onUnmounted","handleDragStart","preventDefault","currentTarget","setPointerCapture","pointerId","handleMove","handleEnd","_c","_b","releasePointerCapture","call","handleCancel","dragProps","onPointerdown","onPointermove","onPointerup","onPointercancel","createResizeProps"],"mappings":"gOAcA,MAAMA,EAAQC,GAERC,OAAEA,EAAQC,MAAAA,EAAAC,OAAOA,GAAWC,EAAmBA,mBAAAL,EAAMM,KAAMN,EAAMO,UAEjEC,EAAmBC,EAAAA,UAAS,KAAO,CACvCC,MAAO,CACLC,SAAU,WACVC,KAAM,GAAGZ,EAAMM,KAAKO,OAAOC,MAC3BC,IAAK,GAAGf,EAAMM,KAAKO,OAAOG,MAC1BC,UAAWf,EACXgB,gBAAiB,MACjBf,MAAO,GAAGA,MACVC,OAAQ,GAAGA,MACXe,cAAe,OACfC,OAAQ,GAEVC,cAAgBC,GAAoBA,EAAEC,kBACtCC,aAAeF,GAAkBA,EAAEC,sBAG/BE,EAAehB,EAAAA,UAAS,KAAO,CACnCI,OAAQ,CAAEC,EAAGd,EAAMM,KAAKO,OAAOC,EAAGE,EAAGhB,EAAMM,KAAKO,OAAOG,GACvDU,KAAM,CAAEvB,QAAOC,2BAnCfuB,aAAqFC,EAAAC,OAAA,UAAA,CAA9ErB,iBAAoBA,EAAgBsB,MAAG5B,OAAQ6B,QAAM7B,GAAGI,KAAMmB,EAAYK,WCwC5E,MAAME,EAYX,WAAAC,CACUC,EACAC,GADAC,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{"version":3,"file":"index.cjs","sources":["../../src/vue/components/counter-rotate-container.vue","../../src/shared/plugin-interaction-primitives/drag-resize-controller.ts","../../src/shared/plugin-interaction-primitives/utils.ts","../../src/vue/utils/interaction-normalize.ts","../../src/vue/hooks/use-drag-resize.ts","../../src/vue/utils/deep-to-raw.ts","../../src/vue/hooks/use-double-press-props.ts","../../src/vue/hooks/use-interaction-handles.ts"],"sourcesContent":["<template>\n <slot\n :menu-wrapper-props=\"menuWrapperProps\"\n :matrix=\"counterRotation.matrix\"\n :rect=\"adjustedRect\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, type CSSProperties } from 'vue';\nimport type { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nconst props = defineProps<CounterRotateProps>();\n\nconst counterRotation = computed(() => getCounterRotation(props.rect, props.rotation));\n\nconst menuWrapperProps = computed(() => ({\n style: {\n position: 'absolute',\n left: `${props.rect.origin.x}px`,\n top: `${props.rect.origin.y}px`,\n transform: counterRotation.value.matrix,\n transformOrigin: '0 0',\n width: `${counterRotation.value.width}px`,\n height: `${counterRotation.value.height}px`,\n pointerEvents: 'none',\n zIndex: 3,\n } as CSSProperties,\n onPointerdown: (e: PointerEvent) => {\n e.stopPropagation();\n e.preventDefault();\n },\n onTouchstart: (e: TouchEvent) => {\n e.stopPropagation();\n e.preventDefault();\n },\n}));\n\nconst adjustedRect = computed(() => ({\n origin: { x: props.rect.origin.x, y: props.rect.origin.y },\n size: { width: counterRotation.value.width, height: counterRotation.value.height },\n}));\n</script>\n","import { Position, Rect } from '@embedpdf/models';\n\nexport interface DragResizeConfig {\n element: Rect;\n vertices?: Position[];\n constraints?: {\n minWidth?: number;\n minHeight?: number;\n maxWidth?: number;\n maxHeight?: number;\n boundingBox?: { width: number; height: number }; // page bounds\n };\n maintainAspectRatio?: boolean;\n pageRotation?: number;\n scale?: number;\n}\n\nexport type InteractionState = 'idle' | 'dragging' | 'resizing' | 'vertex-editing';\nexport type ResizeHandle = 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w';\n\nexport interface TransformData {\n type: 'move' | 'resize' | 'vertex-edit';\n changes: {\n rect?: Rect;\n vertices?: Position[];\n };\n metadata?: {\n handle?: ResizeHandle;\n vertexIndex?: number;\n maintainAspectRatio?: boolean;\n };\n}\n\nexport interface InteractionEvent {\n state: 'start' | 'move' | 'end';\n transformData?: TransformData;\n}\n\n/**\n * Pure geometric controller that manages drag/resize/vertex-edit logic.\n */\nexport class DragResizeController {\n private state: InteractionState = 'idle';\n private startPoint: Position | null = null;\n private startElement: Rect | null = null;\n private activeHandle: ResizeHandle | null = null;\n private currentPosition: Rect | null = null;\n\n // Vertex editing state - pure geometric\n private activeVertexIndex: number | null = null;\n private startVertices: Position[] = [];\n private currentVertices: Position[] = [];\n\n constructor(\n private config: DragResizeConfig,\n private onUpdate: (event: InteractionEvent) => void,\n ) {\n this.currentVertices = config.vertices || [];\n }\n\n updateConfig(config: Partial<DragResizeConfig>) {\n this.config = { ...this.config, ...config };\n this.currentVertices = config.vertices || [];\n }\n\n startDrag(clientX: number, clientY: number) {\n this.state = 'dragging';\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'move',\n changes: {\n rect: this.startElement,\n },\n },\n });\n }\n\n startResize(handle: ResizeHandle, clientX: number, clientY: number) {\n this.state = 'resizing';\n this.activeHandle = handle;\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n startVertexEdit(vertexIndex: number, clientX: number, clientY: number) {\n // Refresh vertices from latest config before validating index\n this.currentVertices = [...(this.config.vertices ?? this.currentVertices)];\n if (vertexIndex < 0 || vertexIndex >= this.currentVertices.length) return;\n\n this.state = 'vertex-editing';\n this.activeVertexIndex = vertexIndex;\n this.startPoint = { x: clientX, y: clientY };\n this.startVertices = [...this.currentVertices];\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex,\n },\n },\n });\n }\n\n move(clientX: number, clientY: number) {\n if (this.state === 'idle' || !this.startPoint) return;\n\n if (this.state === 'dragging' && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateDragPosition(delta);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'move',\n changes: {\n rect: position,\n },\n },\n });\n } else if (this.state === 'resizing' && this.activeHandle && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateResizePosition(delta, this.activeHandle);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'resize',\n changes: {\n rect: position,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n } else if (this.state === 'vertex-editing' && this.activeVertexIndex !== null) {\n const vertices = this.calculateVertexPosition(clientX, clientY);\n this.currentVertices = vertices;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex,\n },\n },\n });\n }\n }\n\n end() {\n if (this.state === 'idle') return;\n\n const wasState = this.state;\n const handle = this.activeHandle;\n const vertexIndex = this.activeVertexIndex;\n\n if (wasState === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.currentVertices,\n },\n metadata: {\n vertexIndex: vertexIndex || undefined,\n },\n },\n });\n } else {\n const finalPosition = this.getCurrentPosition();\n this.onUpdate({\n state: 'end',\n transformData: {\n type: wasState === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: finalPosition,\n },\n metadata:\n wasState === 'dragging'\n ? undefined\n : {\n handle: handle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n cancel() {\n if (this.state === 'idle') return;\n\n if (this.state === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex || undefined,\n },\n },\n });\n } else if (this.startElement) {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: this.state === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata:\n this.state === 'dragging'\n ? undefined\n : {\n handle: this.activeHandle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n private reset() {\n this.state = 'idle';\n this.startPoint = null;\n this.startElement = null;\n this.activeHandle = null;\n this.currentPosition = null;\n this.activeVertexIndex = null;\n this.startVertices = [];\n }\n\n private getCurrentPosition() {\n return this.currentPosition || this.config.element;\n }\n\n private calculateDelta(clientX: number, clientY: number): Position {\n if (!this.startPoint) return { x: 0, y: 0 };\n\n const rawDelta: Position = {\n x: clientX - this.startPoint.x,\n y: clientY - this.startPoint.y,\n };\n\n return this.transformDelta(rawDelta);\n }\n\n private transformDelta(delta: Position): Position {\n const { pageRotation = 0, scale = 1 } = this.config;\n\n const rad = (pageRotation * Math.PI) / 2;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n\n const scaledX = delta.x / scale;\n const scaledY = delta.y / scale;\n\n return {\n x: cos * scaledX + sin * scaledY,\n y: -sin * scaledX + cos * scaledY,\n };\n }\n\n private clampPoint(p: Position): Position {\n const bbox = this.config.constraints?.boundingBox;\n if (!bbox) return p;\n return {\n x: Math.max(0, Math.min(p.x, bbox.width)),\n y: Math.max(0, Math.min(p.y, bbox.height)),\n };\n }\n\n private calculateVertexPosition(clientX: number, clientY: number): Position[] {\n if (this.activeVertexIndex === null) return this.startVertices;\n\n const delta = this.calculateDelta(clientX, clientY);\n const newVertices = [...this.startVertices];\n const currentVertex = newVertices[this.activeVertexIndex];\n\n const moved = {\n x: currentVertex.x + delta.x,\n y: currentVertex.y + delta.y,\n };\n newVertices[this.activeVertexIndex] = this.clampPoint(moved);\n\n return newVertices;\n }\n\n private calculateDragPosition(delta: Position): Rect {\n if (!this.startElement) return this.config.element;\n\n const position: Rect = {\n origin: {\n x: this.startElement.origin.x + delta.x,\n y: this.startElement.origin.y + delta.y,\n },\n size: {\n width: this.startElement.size.width,\n height: this.startElement.size.height,\n },\n };\n\n return this.applyConstraints(position);\n }\n\n private calculateResizePosition(delta: Position, handle: ResizeHandle): Rect {\n if (!this.startElement) return this.config.element;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = this.startElement;\n\n switch (handle) {\n case 'se':\n width += delta.x;\n height += delta.y;\n break;\n case 'sw':\n x += delta.x;\n width -= delta.x;\n height += delta.y;\n break;\n case 'ne':\n width += delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'nw':\n x += delta.x;\n width -= delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'n':\n y += delta.y;\n height -= delta.y;\n break;\n case 's':\n height += delta.y;\n break;\n case 'e':\n width += delta.x;\n break;\n case 'w':\n x += delta.x;\n width -= delta.x;\n break;\n }\n\n // Maintain aspect ratio if needed\n if (this.config.maintainAspectRatio && this.startElement) {\n const aspectRatio = this.startElement.size.width / this.startElement.size.height;\n\n if (['n', 's', 'e', 'w'].includes(handle)) {\n if (handle === 'n' || handle === 's') {\n const newWidth = height * aspectRatio;\n const widthDiff = newWidth - width;\n width = newWidth;\n x -= widthDiff / 2;\n } else {\n const newHeight = width / aspectRatio;\n const heightDiff = newHeight - height;\n height = newHeight;\n if (handle === 'w') {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n y -= heightDiff / 2;\n }\n } else {\n const widthChange = Math.abs(width - this.startElement.size.width);\n const heightChange = Math.abs(height - this.startElement.size.height);\n if (widthChange > heightChange) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n if (handle.includes('w')) {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n if (handle.includes('n')) {\n y = this.startElement.origin.y + this.startElement.size.height - height;\n }\n }\n }\n\n // Handle-aware bounding box clamping to avoid shifting opposite edge\n const bbox = this.config.constraints?.boundingBox;\n if (bbox) {\n switch (handle) {\n case 'e':\n width = Math.min(width, bbox.width - x);\n break;\n case 's':\n height = Math.min(height, bbox.height - y);\n break;\n case 'se':\n width = Math.min(width, bbox.width - x);\n height = Math.min(height, bbox.height - y);\n break;\n case 'w':\n if (x < 0) {\n width += x;\n x = 0;\n }\n break;\n case 'n':\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'sw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n height = Math.min(height, bbox.height - y);\n break;\n case 'nw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'ne':\n width = Math.min(width, bbox.width - x);\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n }\n }\n\n return this.applyConstraints({ origin: { x, y }, size: { width, height } });\n }\n\n private applyConstraints(position: Rect): Rect {\n const { constraints } = this.config;\n if (!constraints) return position;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = position;\n\n // Apply size constraints\n width = Math.max(constraints.minWidth || 1, width);\n height = Math.max(constraints.minHeight || 1, height);\n\n if (constraints.maxWidth) width = Math.min(constraints.maxWidth, width);\n if (constraints.maxHeight) height = Math.min(constraints.maxHeight, height);\n\n // Apply bounding box constraints\n if (constraints.boundingBox) {\n x = Math.max(0, Math.min(x, constraints.boundingBox.width - width));\n y = Math.max(0, Math.min(y, constraints.boundingBox.height - height));\n }\n\n return { origin: { x, y }, size: { width, height } };\n }\n}\n","import type { Position, Rect } from '@embedpdf/models';\nimport type { ResizeHandle, DragResizeConfig } from './drag-resize-controller';\n\nexport type QuarterTurns = 0 | 1 | 2 | 3;\n\nexport interface ResizeUI {\n handleSize?: number; // px (default 8)\n spacing?: number; // px distance from the box edge (default 1)\n offsetMode?: 'outside' | 'inside' | 'center'; // default 'outside'\n includeSides?: boolean; // default false\n zIndex?: number; // default 3\n rotationAwareCursor?: boolean; // default true\n}\n\nexport interface VertexUI {\n vertexSize?: number; // px (default 12)\n zIndex?: number; // default 4\n}\n\nexport interface HandleDescriptor {\n handle: ResizeHandle;\n style: Record<string, number | string>;\n attrs?: Record<string, any>;\n}\n\nfunction diagonalCursor(handle: ResizeHandle, rot: QuarterTurns): string {\n // Standard cursors; diagonals flip on odd quarter-turns\n const diag0: Record<'nw' | 'ne' | 'sw' | 'se', string> = {\n nw: 'nwse-resize',\n ne: 'nesw-resize',\n sw: 'nesw-resize',\n se: 'nwse-resize',\n };\n if (handle === 'n' || handle === 's') return 'ns-resize';\n if (handle === 'e' || handle === 'w') return 'ew-resize';\n if (rot % 2 === 0) return diag0[handle as 'nw' | 'ne' | 'sw' | 'se'];\n return { nw: 'nesw-resize', ne: 'nwse-resize', sw: 'nwse-resize', se: 'nesw-resize' }[\n handle as 'nw' | 'ne' | 'sw' | 'se'\n ]!;\n}\n\nfunction edgeOffset(k: number, spacing: number, mode: 'outside' | 'inside' | 'center') {\n // Base puts the handle centered on the edge\n const base = -k / 2;\n if (mode === 'center') return base;\n // outside moves further out (more negative), inside moves in (less negative)\n return mode === 'outside' ? base - spacing : base + spacing;\n}\n\nexport function describeResizeFromConfig(\n cfg: DragResizeConfig,\n ui: ResizeUI = {},\n): HandleDescriptor[] {\n const {\n handleSize = 8,\n spacing = 1,\n offsetMode = 'outside',\n includeSides = false,\n zIndex = 3,\n rotationAwareCursor = true,\n } = ui;\n\n const rotation = ((cfg.pageRotation ?? 0) % 4) as QuarterTurns;\n\n const off = (edge: 'top' | 'right' | 'bottom' | 'left') => ({\n [edge]: edgeOffset(handleSize, spacing, offsetMode) + 'px',\n });\n\n const corners: Array<[ResizeHandle, Record<string, number | string>]> = [\n ['nw', { ...off('top'), ...off('left') }],\n ['ne', { ...off('top'), ...off('right') }],\n ['sw', { ...off('bottom'), ...off('left') }],\n ['se', { ...off('bottom'), ...off('right') }],\n ];\n const sides: Array<[ResizeHandle, Record<string, number | string>]> = includeSides\n ? [\n ['n', { ...off('top'), left: `calc(50% - ${handleSize / 2}px)` }],\n ['s', { ...off('bottom'), left: `calc(50% - ${handleSize / 2}px)` }],\n ['w', { ...off('left'), top: `calc(50% - ${handleSize / 2}px)` }],\n ['e', { ...off('right'), top: `calc(50% - ${handleSize / 2}px)` }],\n ]\n : [];\n\n const all = [...corners, ...sides];\n\n return all.map(([handle, pos]) => ({\n handle,\n style: {\n position: 'absolute',\n width: handleSize + 'px',\n height: handleSize + 'px',\n borderRadius: '50%',\n zIndex,\n cursor: rotationAwareCursor ? diagonalCursor(handle, rotation) : 'default',\n touchAction: 'none',\n ...(pos as any),\n },\n attrs: { 'data-epdf-handle': handle },\n }));\n}\n\nexport function describeVerticesFromConfig(\n cfg: DragResizeConfig,\n ui: VertexUI = {},\n liveVertices?: Position[],\n): HandleDescriptor[] {\n const { vertexSize = 12, zIndex = 4 } = ui;\n const rect: Rect = cfg.element;\n const scale = cfg.scale ?? 1;\n const verts = liveVertices ?? cfg.vertices ?? [];\n\n return verts.map((v, i) => {\n const left = (v.x - rect.origin.x) * scale - vertexSize / 2;\n const top = (v.y - rect.origin.y) * scale - vertexSize / 2;\n return {\n handle: 'nw', // not used; kept for type\n style: {\n position: 'absolute',\n left: left + 'px',\n top: top + 'px',\n width: vertexSize + 'px',\n height: vertexSize + 'px',\n borderRadius: '50%',\n cursor: 'pointer',\n zIndex,\n touchAction: 'none',\n },\n attrs: { 'data-epdf-vertex': i },\n };\n });\n}\n","import { isRef, unref, toRaw, type Ref } from 'vue';\nimport type { Rect, Position } from '@embedpdf/models';\nimport type { DragResizeConfig } from '../../shared/plugin-interaction-primitives';\n\nexport type MaybeRef<T> = T | Ref<T>;\n\nexport const norm = <T>(v: MaybeRef<T>): T => toRaw(isRef(v) ? unref(v) : (v as T));\n\nexport const toNum = (n: unknown, fallback = 0): number => {\n const v = Number(n);\n return Number.isFinite(v) ? v : fallback;\n};\n\nexport const rectDTO = (r: any): Rect => ({\n origin: { x: toNum(r?.origin?.x), y: toNum(r?.origin?.y) },\n size: { width: toNum(r?.size?.width), height: toNum(r?.size?.height) },\n});\n\nexport const vertsDTO = (arr: any[] = []): Position[] =>\n arr.map((p) => ({ x: toNum(p?.x), y: toNum(p?.y) }));\n\nexport const boolDTO = (b: unknown): boolean | undefined =>\n b === undefined ? undefined : Boolean(b);\n\nexport const numDTO = (n: unknown): number | undefined => (n === undefined ? undefined : toNum(n));\n\nexport const constraintsDTO = (\n c: MaybeRef<DragResizeConfig['constraints']> | undefined,\n): DragResizeConfig['constraints'] | undefined => (c ? norm(c) : undefined);\n","import { ref, watch, computed, onUnmounted, markRaw, type Ref } from 'vue';\nimport type { Position, Rect } from '@embedpdf/models';\nimport {\n DragResizeController,\n type DragResizeConfig,\n type InteractionEvent,\n type ResizeHandle,\n} from '../../shared/plugin-interaction-primitives';\nimport {\n norm,\n rectDTO,\n vertsDTO,\n constraintsDTO,\n boolDTO,\n numDTO,\n type MaybeRef,\n} from '../utils/interaction-normalize';\n\nexport interface UseDragResizeOptions {\n element: MaybeRef<Rect>;\n vertices?: MaybeRef<Position[]>;\n constraints?: MaybeRef<DragResizeConfig['constraints']>;\n maintainAspectRatio?: MaybeRef<boolean>;\n pageRotation?: MaybeRef<number>;\n scale?: MaybeRef<number>;\n onUpdate?: (event: InteractionEvent) => void;\n enabled?: MaybeRef<boolean>;\n}\n\nexport function useDragResize(options: UseDragResizeOptions) {\n const controller = ref<DragResizeController | null>(null);\n\n const {\n onUpdate,\n element,\n vertices,\n constraints,\n maintainAspectRatio,\n pageRotation,\n scale,\n enabled,\n } = options;\n\n // Build initial plain config\n const initialCfg: DragResizeConfig = {\n element: rectDTO(norm(element)),\n vertices: vertices ? vertsDTO(norm(vertices)) : undefined,\n constraints: constraintsDTO(constraints),\n maintainAspectRatio: boolDTO(enabled === undefined ? undefined : norm(maintainAspectRatio!)),\n pageRotation: numDTO(pageRotation === undefined ? undefined : norm(pageRotation!)),\n scale: numDTO(scale === undefined ? undefined : norm(scale!)),\n };\n\n if (!controller.value) {\n controller.value = markRaw(new DragResizeController(initialCfg, (ev) => onUpdate?.(ev)));\n }\n\n // Reactive updates → always normalize before passing to controller\n watch(\n () => ({\n element,\n vertices,\n constraints,\n maintainAspectRatio,\n pageRotation,\n scale,\n }),\n (nc) => {\n controller.value?.updateConfig({\n element: rectDTO(norm(nc.element)),\n vertices: nc.vertices ? vertsDTO(norm(nc.vertices)) : undefined,\n constraints: constraintsDTO(nc.constraints),\n maintainAspectRatio: boolDTO(\n nc.maintainAspectRatio === undefined ? undefined : norm(nc.maintainAspectRatio!),\n ),\n pageRotation: numDTO(nc.pageRotation === undefined ? undefined : norm(nc.pageRotation!)),\n scale: numDTO(nc.scale === undefined ? undefined : norm(nc.scale!)),\n });\n },\n { deep: true },\n );\n\n onUnmounted(() => {\n controller.value = null;\n });\n\n const isEnabled = () => Boolean(enabled === undefined ? true : norm(enabled));\n\n // Pointer handlers\n const handleDragStart = (e: PointerEvent) => {\n if (!isEnabled()) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startDrag(e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n };\n const handleMove = (e: PointerEvent) => controller.value?.move(e.clientX, e.clientY);\n const handleEnd = (e: PointerEvent) => {\n controller.value?.end();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n const handleCancel = (e: PointerEvent) => {\n controller.value?.cancel();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n const createResizeProps = (handle: ResizeHandle) => ({\n onPointerdown: (e: PointerEvent) => {\n if (!isEnabled()) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startResize(handle, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n },\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n });\n\n const createVertexProps = (vertexIndex: number) => ({\n onPointerdown: (e: PointerEvent) => {\n if (!isEnabled()) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startVertexEdit(vertexIndex, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n },\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n });\n\n const dragProps = computed(() =>\n isEnabled()\n ? {\n onPointerdown: handleDragStart,\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n }\n : {},\n );\n\n return { dragProps, createResizeProps, createVertexProps };\n}\n","import { toRaw, isRef, isReactive, isProxy } from 'vue';\n\nexport function deepToRaw<T extends Record<string, any>>(sourceObj: T): T {\n const objectIterator = (input: any): any => {\n if (Array.isArray(input)) {\n return input.map((item) => objectIterator(item));\n }\n if (isRef(input) || isReactive(input) || isProxy(input)) {\n return objectIterator(toRaw(input));\n }\n if (input && typeof input === 'object') {\n return Object.keys(input).reduce((acc, key) => {\n acc[key as keyof typeof acc] = objectIterator(input[key]);\n return acc;\n }, {} as T);\n }\n return input;\n };\n\n return objectIterator(sourceObj);\n}\n","import { ref } from 'vue';\n\ntype DoublePressOptions = {\n delay?: number; // ms between taps\n tolerancePx?: number; // spatial tolerance\n};\n\ntype DoubleHandler = ((e: PointerEvent | MouseEvent) => void) | undefined;\n\ntype DoubleProps = {\n onDblclick?: (e: MouseEvent) => void;\n onPointerupCapture?: (e: PointerEvent) => void;\n};\n\n/**\n * Vue composable for handling double-press/double-tap interactions.\n *\n * @param onDouble - Callback to invoke on double press/tap\n * @param options - Configuration for delay and spatial tolerance\n * @returns Event handler props to be spread on an element with v-bind\n *\n * @example\n * ```vue\n * <script setup>\n * import { useDoublePressProps } from '@embedpdf/utils/vue';\n *\n * const handleDoubleClick = (e) => {\n * console.log('Double clicked!');\n * };\n *\n * const doubleProps = useDoublePressProps(handleDoubleClick);\n * </script>\n *\n * <template>\n * <div v-bind=\"doubleProps\">\n * Double click/tap me\n * </div>\n * </template>\n * ```\n */\nexport function useDoublePressProps(\n onDouble?: DoubleHandler,\n { delay = 300, tolerancePx = 18 }: DoublePressOptions = {},\n): DoubleProps {\n const last = ref({ t: 0, x: 0, y: 0 });\n\n const handlePointerUp = (e: PointerEvent) => {\n if (!onDouble) return;\n\n // Ignore mouse (it will use native dblclick),\n // and ignore non-primary pointers (multi-touch, etc.)\n if (e.pointerType === 'mouse' || e.isPrimary === false) return;\n\n const now = performance.now();\n const x = e.clientX;\n const y = e.clientY;\n\n const withinTime = now - last.value.t <= delay;\n const dx = x - last.value.x;\n const dy = y - last.value.y;\n const withinDist = dx * dx + dy * dy <= tolerancePx * tolerancePx;\n\n if (withinTime && withinDist) {\n onDouble?.(e);\n }\n\n last.value = { t: now, x, y };\n };\n\n const handleDouble = (e: MouseEvent) => {\n onDouble?.(e);\n };\n\n return onDouble\n ? {\n // Vue uses lowercase 'c' in dblclick\n onDblclick: handleDouble,\n onPointerupCapture: handlePointerUp,\n }\n : {};\n}\n","import { computed, type CSSProperties } from 'vue';\nimport { useDragResize, type UseDragResizeOptions } from './use-drag-resize';\nimport {\n describeResizeFromConfig,\n describeVerticesFromConfig,\n type ResizeUI,\n type VertexUI,\n} from '../../shared/plugin-interaction-primitives/utils';\nimport type { Position, Rect } from '@embedpdf/models';\nimport { norm, rectDTO, vertsDTO } from '../utils/interaction-normalize';\n\nexport type HandleElementProps = {\n key: string | number;\n style: CSSProperties;\n onPointerdown: (e: PointerEvent) => void;\n onPointermove: (e: PointerEvent) => void;\n onPointerup: (e: PointerEvent) => void;\n onPointercancel: (e: PointerEvent) => void;\n} & Record<string, any>;\n\nexport interface UseInteractionHandlesOptions {\n controller: UseDragResizeOptions; // may contain refs\n resizeUI?: ResizeUI;\n vertexUI?: VertexUI;\n includeVertices?: boolean;\n handleAttrs?: (\n h: 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w',\n ) => Record<string, any> | void;\n vertexAttrs?: (i: number) => Record<string, any> | void;\n}\n\nexport function useInteractionHandles(opts: UseInteractionHandlesOptions) {\n const {\n controller,\n resizeUI,\n vertexUI,\n includeVertices = false,\n handleAttrs,\n vertexAttrs,\n } = opts;\n\n // Owns live interaction handlers\n const { dragProps, createResizeProps, createVertexProps } = useDragResize(controller);\n\n // Plain snapshots for the *descriptor* helpers\n const elementPlain = computed<Rect>(() => rectDTO(norm(controller.element)));\n const verticesPlain = computed<Position[] | undefined>(() =>\n controller.vertices ? vertsDTO(norm(controller.vertices)) : undefined,\n );\n const scalePlain = computed<number>(() => Number(norm(controller.scale ?? 1)));\n const rotationPlain = computed<number>(() => Number(norm(controller.pageRotation ?? 0)));\n const maintainPlain = computed<boolean | undefined>(() =>\n controller.maintainAspectRatio === undefined\n ? undefined\n : Boolean(norm(controller.maintainAspectRatio)),\n );\n const constraintsPlain = computed(() => norm(controller.constraints ?? undefined));\n\n const resize = computed<HandleElementProps[]>(() => {\n const desc = describeResizeFromConfig(\n {\n element: elementPlain.value,\n scale: scalePlain.value,\n pageRotation: rotationPlain.value,\n maintainAspectRatio: maintainPlain.value,\n constraints: constraintsPlain.value,\n },\n resizeUI,\n );\n return desc.map((d) => ({\n key: (d.attrs?.['data-epdf-handle'] as string) ?? d.handle,\n style: d.style as CSSProperties,\n ...createResizeProps(d.handle),\n ...(d.attrs ?? {}),\n ...(handleAttrs?.(d.handle) ?? {}),\n }));\n });\n\n const vertices = computed<HandleElementProps[]>(() => {\n if (!includeVertices) return [];\n const verts = verticesPlain.value ?? [];\n const desc = describeVerticesFromConfig(\n { element: elementPlain.value, scale: scalePlain.value, vertices: verts },\n vertexUI,\n verts,\n );\n return desc.map((d, i) => ({\n key: i,\n style: d.style as CSSProperties,\n ...createVertexProps(i),\n ...(d.attrs ?? {}),\n ...(vertexAttrs?.(i) ?? {}),\n }));\n });\n\n return { dragProps, resize, vertices };\n}\n"],"names":["props","__props","counterRotation","computed","getCounterRotation","rect","rotation","menuWrapperProps","style","position","left","origin","x","top","y","transform","value","matrix","transformOrigin","width","height","pointerEvents","zIndex","onPointerdown","e","stopPropagation","preventDefault","onTouchstart","adjustedRect","size","_renderSlot","_ctx","$slots","DragResizeController","constructor","config","onUpdate","this","state","startPoint","startElement","activeHandle","currentPosition","activeVertexIndex","startVertices","currentVertices","vertices","updateConfig","startDrag","clientX","clientY","element","transformData","type","changes","startResize","handle","metadata","maintainAspectRatio","startVertexEdit","vertexIndex","length","move","delta","calculateDelta","calculateDragPosition","calculateResizePosition","calculateVertexPosition","end","wasState","finalPosition","getCurrentPosition","reset","cancel","rawDelta","transformDelta","pageRotation","scale","rad","Math","PI","cos","sin","scaledX","scaledY","clampPoint","p","bbox","_a","constraints","boundingBox","max","min","newVertices","currentVertex","moved","applyConstraints","aspectRatio","includes","newWidth","widthDiff","newHeight","heightDiff","abs","minWidth","minHeight","maxWidth","maxHeight","diagonalCursor","rot","nw","ne","sw","se","edgeOffset","k","spacing","mode","base","norm","v","toRaw","isRef","unref","toNum","n","fallback","Number","isFinite","rectDTO","r","_b","_c","_d","vertsDTO","arr","map","boolDTO","b","Boolean","numDTO","constraintsDTO","c","useDragResize","options","controller","ref","enabled","initialCfg","markRaw","ev","vue","watch","nc","deep","onUnmounted","isEnabled","handleDragStart","currentTarget","setPointerCapture","call","pointerId","handleMove","handleEnd","releasePointerCapture","handleCancel","dragProps","onPointermove","onPointerup","onPointercancel","createResizeProps","createVertexProps","sourceObj","objectIterator","input","Array","isArray","item","isReactive","isProxy","Object","keys","reduce","acc","key","onDouble","delay","tolerancePx","last","t","onDblclick","onPointerupCapture","pointerType","isPrimary","now","performance","withinTime","dx","dy","opts","resizeUI","vertexUI","includeVertices","handleAttrs","vertexAttrs","elementPlain","verticesPlain","scalePlain","rotationPlain","maintainPlain","constraintsPlain","resize","cfg","ui","handleSize","offsetMode","includeSides","rotationAwareCursor","off","edge","pos","borderRadius","cursor","touchAction","attrs","describeResizeFromConfig","d","verts","liveVertices","vertexSize","i","describeVerticesFromConfig"],"mappings":"gOAkBA,MAAMA,EAAQC,EAERC,EAAkBC,YAAS,IAAMC,EAAAA,mBAAmBJ,EAAMK,KAAML,EAAMM,YAEtEC,EAAmBJ,EAAAA,UAAS,KAAO,CACvCK,MAAO,CACLC,SAAU,WACVC,KAAM,GAAGV,EAAMK,KAAKM,OAAOC,MAC3BC,IAAK,GAAGb,EAAMK,KAAKM,OAAOG,MAC1BC,UAAWb,EAAgBc,MAAMC,OACjCC,gBAAiB,MACjBC,MAAO,GAAGjB,EAAgBc,MAAMG,UAChCC,OAAQ,GAAGlB,EAAgBc,MAAMI,WACjCC,cAAe,OACfC,OAAQ,GAEVC,cAAgBC,IACdA,EAAEC,kBACFD,EAAEE,gBAAe,EAEnBC,aAAeH,IACbA,EAAEC,kBACFD,EAAEE,gBAAe,MAIfE,EAAezB,EAAAA,UAAS,KAAO,CACnCQ,OAAQ,CAAEC,EAAGZ,EAAMK,KAAKM,OAAOC,EAAGE,EAAGd,EAAMK,KAAKM,OAAOG,GACvDe,KAAM,CAAEV,MAAOjB,EAAgBc,MAAMG,MAAOC,OAAQlB,EAAgBc,MAAMI,yBA7C1EU,aAIEC,EAAAC,OAAA,UAAA,CAHCzB,iBAAoBA,EAAgBS,MACpCC,OAAQf,EAAec,MAACC,OACxBZ,KAAMuB,EAAYZ,WCqChB,MAAMiB,EAYX,WAAAC,CACUC,EACAC,GADAC,KAAAF,OAAAA,EACAE,KAAAD,SAAAA,EAbVC,KAAQC,MAA0B,OAClCD,KAAQE,WAA8B,KACtCF,KAAQG,aAA4B,KACpCH,KAAQI,aAAoC,KAC5CJ,KAAQK,gBAA+B,KAGvCL,KAAQM,kBAAmC,KAC3CN,KAAQO,cAA4B,GACpCP,KAAQQ,gBAA8B,G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