@embedpdf/utils 1.1.1 → 1.2.1
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 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +683 -2
- package/dist/preact/index.js.map +1 -1
- package/dist/react/adapter.d.ts +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +683 -2
- package/dist/react/index.js.map +1 -1
- package/dist/shared-preact/hooks/index.d.ts +3 -0
- package/dist/shared-preact/hooks/use-double-press-props.d.ts +11 -0
- package/dist/shared-preact/hooks/use-drag-resize.d.ts +27 -0
- package/dist/shared-preact/hooks/use-interaction-handles.d.ts +33 -0
- package/dist/shared-preact/index.d.ts +1 -0
- package/dist/shared-preact/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
- package/dist/shared-preact/plugin-interaction-primitives/index.d.ts +2 -0
- package/dist/shared-preact/plugin-interaction-primitives/utils.d.ts +22 -0
- package/dist/shared-react/hooks/index.d.ts +3 -0
- package/dist/shared-react/hooks/use-double-press-props.d.ts +11 -0
- package/dist/shared-react/hooks/use-drag-resize.d.ts +27 -0
- package/dist/shared-react/hooks/use-interaction-handles.d.ts +33 -0
- package/dist/shared-react/index.d.ts +1 -0
- package/dist/shared-react/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
- package/dist/shared-react/plugin-interaction-primitives/index.d.ts +2 -0
- package/dist/shared-react/plugin-interaction-primitives/utils.d.ts +22 -0
- package/dist/shared-vue/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
- package/dist/shared-vue/plugin-interaction-primitives/index.d.ts +2 -0
- package/dist/shared-vue/plugin-interaction-primitives/utils.d.ts +22 -0
- package/dist/vue/hooks/index.d.ts +1 -0
- package/dist/vue/hooks/use-drag-resize.d.ts +24 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +478 -2
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
package/dist/preact/adapter.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export type PointerEvent<T = Element> = JSX.TargetedPointerEvent<T extends Event
|
|
|
9
9
|
export type ChangeEvent<T = Element> = JSX.TargetedInputEvent<T extends EventTarget ? T : never>;
|
|
10
10
|
export type TouchEvent<T = Element> = JSX.TargetedTouchEvent<T extends EventTarget ? T : never>;
|
|
11
11
|
export type ComponentType = FunctionComponent;
|
|
12
|
+
export declare const dblClickProp: "onDblClick";
|
package/dist/preact/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("preact/jsx-runtime"),r=require("@embedpdf/utils"),e=require("preact");require("preact/hooks"),exports.CounterRotate=function({children:o,...i}){const{rect:n,rotation:a}=i,{matrix:s,width:p,height:u}=r.getCounterRotation(n,a),g={style:{position:"absolute",left:n.origin.x,top:n.origin.y,transform:s,transformOrigin:"0 0",width:p,height:u,pointerEvents:"none",zIndex:3},onPointerDown:t=>t.stopPropagation(),onTouchStart:t=>t.stopPropagation()};return t.jsx(e.Fragment,{children:o({menuWrapperProps:g,matrix:s,rect:{origin:{x:n.origin.x,y:n.origin.y},size:{width:p,height:u}}})})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("preact/jsx-runtime"),e=require("@embedpdf/utils"),i=require("preact"),n=require("preact/hooks"),s="onDblClick";class r{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,s=Math.cos(n),r=Math.sin(n),a=t.x/i,o=t.y/i;return{x:s*a+r*o,y:-r*a+s*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],s=n[this.activeVertexIndex],r={x:s.x+i.x,y:s.y+i.y};return n[this.activeVertexIndex]=this.clampPoint(r),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:s},size:{width:r,height:a}}=this.startElement;switch(e){case"se":r+=t.x,a+=t.y;break;case"sw":n+=t.x,r-=t.x,a+=t.y;break;case"ne":r+=t.x,s+=t.y,a-=t.y;break;case"nw":n+=t.x,r-=t.x,s+=t.y,a-=t.y;break;case"n":s+=t.y,a-=t.y;break;case"s":a+=t.y;break;case"e":r+=t.x;break;case"w":n+=t.x,r-=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=a*t,i=e-r;r=e,n-=i/2}else{const i=r/t,o=i-a;a=i,"w"===e&&(n=this.startElement.origin.x+this.startElement.size.width-r),s-=o/2}else{Math.abs(r-this.startElement.size.width)>Math.abs(a-this.startElement.size.height)?a=r/t:r=a*t,e.includes("w")&&(n=this.startElement.origin.x+this.startElement.size.width-r),e.includes("n")&&(s=this.startElement.origin.y+this.startElement.size.height-a)}}const o=null==(i=this.config.constraints)?void 0:i.boundingBox;if(o)switch(e){case"e":r=Math.min(r,o.width-n);break;case"s":a=Math.min(a,o.height-s);break;case"se":r=Math.min(r,o.width-n),a=Math.min(a,o.height-s);break;case"w":n<0&&(r+=n,n=0);break;case"n":s<0&&(a+=s,s=0);break;case"sw":n<0&&(r+=n,n=0),a=Math.min(a,o.height-s);break;case"nw":n<0&&(r+=n,n=0),s<0&&(a+=s,s=0);break;case"ne":r=Math.min(r,o.width-n),s<0&&(a+=s,s=0)}return this.applyConstraints({origin:{x:n,y:s},size:{width:r,height:a}})}applyConstraints(t){const{constraints:e}=this.config;if(!e)return t;let{origin:{x:i,y:n},size:{width:s,height:r}}=t;return s=Math.max(e.minWidth||1,s),r=Math.max(e.minHeight||1,r),e.maxWidth&&(s=Math.min(e.maxWidth,s)),e.maxHeight&&(r=Math.min(e.maxHeight,r)),e.boundingBox&&(i=Math.max(0,Math.min(i,e.boundingBox.width-s)),n=Math.max(0,Math.min(n,e.boundingBox.height-r))),{origin:{x:i,y:n},size:{width:s,height:r}}}}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 o(t,e,i){const n=-t/2;return"center"===i?n:"outside"===i?n-e:n+e}function c(t){const{onUpdate:e,enabled:i=!0,...s}=t,a=n.useRef(null),o=n.useRef(e);n.useEffect((()=>{o.current=e}),[e]),n.useEffect((()=>{a.current?a.current.updateConfig(s):a.current=new r(s,(t=>{var e;return null==(e=o.current)?void 0:e.call(o,t)}))}),[s.element,s.constraints,s.maintainAspectRatio,s.pageRotation,s.scale,s.vertices]);const c=n.useCallback((t=>{var e;i&&(t.preventDefault(),t.stopPropagation(),null==(e=a.current)||e.startDrag(t.clientX,t.clientY),t.currentTarget.setPointerCapture(t.pointerId))}),[i]),l=n.useCallback((t=>{var e;t.preventDefault(),t.stopPropagation(),null==(e=a.current)||e.move(t.clientX,t.clientY)}),[]),h=n.useCallback((t=>{var e,i,n;t.preventDefault(),t.stopPropagation(),null==(e=a.current)||e.end(),null==(n=(i=t.currentTarget).releasePointerCapture)||n.call(i,t.pointerId)}),[]),u=n.useCallback((t=>({onPointerDown:e=>{var n;i&&(e.preventDefault(),e.stopPropagation(),null==(n=a.current)||n.startResize(t,e.clientX,e.clientY),e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:l,onPointerUp:h,onPointerCancel:h})),[i,l,h]),d=n.useCallback((t=>({onPointerDown:e=>{var n;i&&(e.preventDefault(),e.stopPropagation(),null==(n=a.current)||n.startVertexEdit(t,e.clientX,e.clientY),e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:l,onPointerUp:h,onPointerCancel:h})),[i,l,h]);return{dragProps:i?{onPointerDown:c,onPointerMove:l,onPointerUp:h,onPointerCancel:h}:{},createResizeProps:u,createVertexProps:d}}exports.CounterRotate=function({children:n,...s}){const{rect:r,rotation:a}=s,{matrix:o,width:c,height:l}=e.getCounterRotation(r,a),h={style:{position:"absolute",left:r.origin.x,top:r.origin.y,transform:o,transformOrigin:"0 0",width:c,height:l,pointerEvents:"none",zIndex:3},onPointerDown:t=>t.stopPropagation(),onTouchStart:t=>t.stopPropagation()};return t.jsx(i.Fragment,{children:n({menuWrapperProps:h,matrix:o,rect:{origin:{x:r.origin.x,y:r.origin.y},size:{width:c,height:l}}})})},exports.useDoublePressProps=function(t,{delay:e=300,tolerancePx:i=18}={}){const r=n.useRef({t:0,x:0,y:0}),a=n.useCallback((n=>{if(!t)return;if("mouse"===n.pointerType||!1===n.isPrimary)return;const s=performance.now(),a=n.clientX,o=n.clientY,c=s-r.current.t<=e,l=a-r.current.x,h=o-r.current.y;c&&l*l+h*h<=i*i&&(null==t||t(n)),r.current={t:s,x:a,y:o}}),[t,e,i]),o=n.useCallback((e=>{null==t||t(e)}),[t]);return t?{[s]:o,onPointerUpCapture:a}:{}},exports.useDragResize=c,exports.useInteractionHandles=function(t){const{controller:e,resizeUI:i,vertexUI:s,includeVertices:r=!1,handleAttrs:l,vertexAttrs:h}=t,{dragProps:u,createResizeProps:d,createVertexProps:g}=c(e);return{dragProps:u,resize:n.useMemo((()=>function(t,e={}){const{handleSize:i=8,spacing:n=1,offsetMode:s="outside",includeSides:r=!1,zIndex:c=3,rotationAwareCursor:l=!0}=e,h=(t.pageRotation??0)%4,u=t=>({[t]:o(i,n,s)});return[["nw",{...u("top"),...u("left")}],["ne",{...u("top"),...u("right")}],["sw",{...u("bottom"),...u("left")}],["se",{...u("bottom"),...u("right")}],...r?[["n",{...u("top"),left:`calc(50% - ${i/2}px)`}],["s",{...u("bottom"),left:`calc(50% - ${i/2}px)`}],["w",{...u("left"),top:`calc(50% - ${i/2}px)`}],["e",{...u("right"),top:`calc(50% - ${i/2}px)`}]]:[]].map((([t,e])=>({handle:t,style:{position:"absolute",width:i,height:i,borderRadius:"50%",zIndex:c,cursor:l?a(t,h):"default",touchAction:"none",...e},attrs:{"data-epdf-handle":t}})))}(e,i).map((t=>{var e;return{key:null==(e=t.attrs)?void 0:e["data-epdf-handle"],style:t.style,...d(t.handle),...t.attrs??{},...(null==l?void 0:l(t.handle))??{}}}))),[e.element.origin.x,e.element.origin.y,e.element.size.width,e.element.size.height,e.scale,e.pageRotation,e.maintainAspectRatio,null==i?void 0:i.handleSize,null==i?void 0:i.spacing,null==i?void 0:i.offsetMode,null==i?void 0:i.includeSides,null==i?void 0:i.zIndex,null==i?void 0:i.rotationAwareCursor,d,l]),vertices:n.useMemo((()=>{if(!r)return[];return function(t,e={},i){const{vertexSize:n=12,zIndex:s=4}=e,r=t.element,a=t.scale??1;return(i??t.vertices??[]).map(((t,e)=>({handle:"nw",style:{position:"absolute",left:(t.x-r.origin.x)*a-n/2,top:(t.y-r.origin.y)*a-n/2,width:n,height:n,borderRadius:"50%",cursor:"pointer",zIndex:s,touchAction:"none"},attrs:{"data-epdf-vertex":e}})))}(e,s,e.vertices).map(((t,e)=>({key:e,style:t.style,...g(e),...t.attrs??{},...(null==h?void 0:h(e))??{}})))}),[r,e.element.origin.x,e.element.origin.y,e.element.size.width,e.element.size.height,e.scale,e.vertices,null==s?void 0:s.vertexSize,null==s?void 0:s.zIndex,g,h])}};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/shared/components/counter-rotate-container.tsx"],"sourcesContent":["import { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\nimport { ReactNode, CSSProperties, PointerEvent, Fragment, TouchEvent } from '@framework';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nexport interface MenuWrapperProps {\n style: CSSProperties;\n onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;\n onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;\n}\n\ninterface CounterRotateComponentProps extends CounterRotateProps {\n children: (props: {\n matrix: string;\n rect: Rect;\n menuWrapperProps: MenuWrapperProps;\n }) => ReactNode;\n}\n\nexport function CounterRotate({ children, ...props }: CounterRotateComponentProps) {\n const { rect, rotation } = props;\n const { matrix, width, height } = getCounterRotation(rect, rotation);\n\n const menuWrapperStyle: CSSProperties = {\n position: 'absolute',\n left: rect.origin.x,\n top: rect.origin.y,\n transform: matrix,\n transformOrigin: '0 0',\n width: width,\n height: height,\n pointerEvents: 'none',\n zIndex: 3,\n };\n\n const menuWrapperProps = {\n style: menuWrapperStyle,\n onPointerDown: (e: PointerEvent<HTMLDivElement>) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent<HTMLDivElement>) => e.stopPropagation(),\n };\n\n return (\n <Fragment>\n {children({\n menuWrapperProps,\n matrix,\n rect: {\n origin: { x: rect.origin.x, y: rect.origin.y },\n size: { width: width, height: height },\n },\n })}\n </Fragment>\n );\n}\n"],"names":["children","props","rect","rotation","matrix","width","height","getCounterRotation","menuWrapperProps","style","position","left","origin","x","top","y","transform","transformOrigin","pointerEvents","zIndex","onPointerDown","e","stopPropagation","onTouchStart","Fragment","size"],"mappings":"qNAuBO,UAAuBA,SAAEA,KAAaC,IACrC,MAAAC,KAAEA,EAAMC,SAAAA,GAAaF,GACrBG,OAAEA,QAAQC,EAAOC,OAAAA,GAAWC,EAAAA,mBAAmBL,EAAMC,GAcrDK,EAAmB,CACvBC,MAbsC,CACtCC,SAAU,WACVC,KAAMT,EAAKU,OAAOC,EAClBC,IAAKZ,EAAKU,OAAOG,EACjBC,UAAWZ,EACXa,gBAAiB,MACjBZ,QACAC,SACAY,cAAe,OACfC,OAAQ,GAKRC,cAAgBC,GAAoCA,EAAEC,kBACtDC,aAAeF,GAAkCA,EAAEC,mBAInD,aAACE,EAAAA,UACExB,SAASA,EAAA,CACRQ,mBACAJ,SACAF,KAAM,CACJU,OAAQ,CAAEC,EAAGX,EAAKU,OAAOC,EAAGE,EAAGb,EAAKU,OAAOG,GAC3CU,KAAM,CAAEpB,QAAcC,cAKhC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/preact/adapter.ts","../../src/shared/plugin-interaction-primitives/drag-resize-controller.ts","../../src/shared/plugin-interaction-primitives/utils.ts","../../src/shared/hooks/use-drag-resize.ts","../../src/shared/components/counter-rotate-container.tsx","../../src/shared/hooks/use-double-press-props.ts","../../src/shared/hooks/use-interaction-handles.ts"],"sourcesContent":["import { createContext, JSX, Fragment, FunctionComponent } from 'preact';\nexport { useEffect, useRef, useState, useCallback, useMemo, useContext } from 'preact/hooks';\nexport type { ComponentChildren as ReactNode, JSX } from 'preact';\n\nexport { createContext, Fragment };\n\nexport type CSSProperties = import('preact').JSX.CSSProperties;\nexport type HTMLAttributes<T = any> = import('preact').JSX.HTMLAttributes<\n T extends EventTarget ? T : never\n>;\n\nexport type MouseEvent<T = Element> = JSX.TargetedMouseEvent<T extends EventTarget ? T : never>;\nexport type PointerEvent<T = Element> = JSX.TargetedPointerEvent<T extends EventTarget ? T : never>;\nexport type ChangeEvent<T = Element> = JSX.TargetedInputEvent<T extends EventTarget ? T : never>;\nexport type TouchEvent<T = Element> = JSX.TargetedTouchEvent<T extends EventTarget ? T : never>;\nexport type ComponentType = FunctionComponent;\n\nexport const dblClickProp = 'onDblClick' as const;\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),\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,\n height: handleSize,\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,\n top,\n width: vertexSize,\n height: vertexSize,\n borderRadius: '50%',\n cursor: 'pointer',\n zIndex,\n touchAction: 'none',\n },\n attrs: { 'data-epdf-vertex': i },\n };\n });\n}\n","import { useRef, useCallback, useEffect, PointerEvent } from '@framework';\nimport {\n DragResizeController,\n DragResizeConfig,\n InteractionEvent,\n ResizeHandle,\n} from '../plugin-interaction-primitives';\n\nexport interface UseDragResizeOptions extends DragResizeConfig {\n onUpdate?: (event: InteractionEvent) => void;\n enabled?: boolean;\n}\n\nexport interface ResizeHandleEventProps {\n onPointerDown: (e: PointerEvent) => void;\n onPointerMove: (e: PointerEvent) => void;\n onPointerUp: (e: PointerEvent) => void;\n onPointerCancel: (e: PointerEvent) => void;\n}\n\nexport function useDragResize(options: UseDragResizeOptions) {\n const { onUpdate, enabled = true, ...config } = options;\n const controllerRef = useRef<DragResizeController | null>(null);\n const onUpdateRef = useRef<typeof onUpdate>(onUpdate);\n\n useEffect(() => {\n onUpdateRef.current = onUpdate;\n }, [onUpdate]);\n\n // Initialize or update controller\n useEffect(() => {\n if (!controllerRef.current) {\n controllerRef.current = new DragResizeController(config, (event) =>\n onUpdateRef.current?.(event),\n );\n } else {\n controllerRef.current.updateConfig(config);\n }\n }, [\n config.element,\n config.constraints,\n config.maintainAspectRatio,\n config.pageRotation,\n config.scale,\n config.vertices,\n ]);\n\n const handleDragStart = useCallback(\n (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controllerRef.current?.startDrag(e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n },\n [enabled],\n );\n\n const handleMove = useCallback((e: PointerEvent) => {\n e.preventDefault();\n e.stopPropagation();\n controllerRef.current?.move(e.clientX, e.clientY);\n }, []);\n\n const handleEnd = useCallback((e: PointerEvent) => {\n e.preventDefault();\n e.stopPropagation();\n controllerRef.current?.end();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n }, []);\n\n const createResizeHandler = useCallback(\n (handle: ResizeHandle): ResizeHandleEventProps => ({\n onPointerDown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controllerRef.current?.startResize(handle, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n },\n onPointerMove: handleMove,\n onPointerUp: handleEnd,\n onPointerCancel: handleEnd,\n }),\n [enabled, handleMove, handleEnd],\n );\n\n const createVertexHandler = useCallback(\n (vertexIndex: number): ResizeHandleEventProps => ({\n onPointerDown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controllerRef.current?.startVertexEdit(vertexIndex, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n },\n onPointerMove: handleMove,\n onPointerUp: handleEnd,\n onPointerCancel: handleEnd,\n }),\n [enabled, handleMove, handleEnd],\n );\n\n return {\n dragProps: enabled\n ? {\n onPointerDown: handleDragStart,\n onPointerMove: handleMove,\n onPointerUp: handleEnd,\n onPointerCancel: handleEnd,\n }\n : {},\n createResizeProps: createResizeHandler,\n createVertexProps: createVertexHandler,\n };\n}\n","import { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\nimport { ReactNode, CSSProperties, PointerEvent, Fragment, TouchEvent } from '@framework';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nexport interface MenuWrapperProps {\n style: CSSProperties;\n onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;\n onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;\n}\n\ninterface CounterRotateComponentProps extends CounterRotateProps {\n children: (props: {\n matrix: string;\n rect: Rect;\n menuWrapperProps: MenuWrapperProps;\n }) => ReactNode;\n}\n\nexport function CounterRotate({ children, ...props }: CounterRotateComponentProps) {\n const { rect, rotation } = props;\n const { matrix, width, height } = getCounterRotation(rect, rotation);\n\n const menuWrapperStyle: CSSProperties = {\n position: 'absolute',\n left: rect.origin.x,\n top: rect.origin.y,\n transform: matrix,\n transformOrigin: '0 0',\n width: width,\n height: height,\n pointerEvents: 'none',\n zIndex: 3,\n };\n\n const menuWrapperProps = {\n style: menuWrapperStyle,\n onPointerDown: (e: PointerEvent<HTMLDivElement>) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent<HTMLDivElement>) => e.stopPropagation(),\n };\n\n return (\n <Fragment>\n {children({\n menuWrapperProps,\n matrix,\n rect: {\n origin: { x: rect.origin.x, y: rect.origin.y },\n size: { width: width, height: height },\n },\n })}\n </Fragment>\n );\n}\n","import { useRef, useCallback, dblClickProp } from '@framework';\nimport type { PointerEvent } from '@framework';\n\ntype DoublePressOptions = {\n delay?: number; // ms between taps\n tolerancePx?: number; // spatial tolerance\n};\n\ntype DoubleHandler<T extends Element> = ((e: PointerEvent<T> | MouseEvent) => void) | undefined;\n\ntype DoubleProps<K extends string> = Partial<Record<K, (e: any) => void>> & {\n onPointerUp?: (e: any) => void;\n};\n\nexport function useDoublePressProps<\n T extends Element = Element,\n K extends string = typeof dblClickProp,\n>(\n onDouble?: DoubleHandler<T>,\n { delay = 300, tolerancePx = 18 }: DoublePressOptions = {},\n): DoubleProps<K> {\n const last = useRef({ t: 0, x: 0, y: 0 });\n\n const handlePointerUp = useCallback(\n (e: any) => {\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 as number;\n const y = e.clientY as number;\n\n const withinTime = now - last.current.t <= delay;\n const dx = x - last.current.x;\n const dy = y - last.current.y;\n const withinDist = dx * dx + dy * dy <= tolerancePx * tolerancePx;\n\n if (withinTime && withinDist) onDouble?.(e as PointerEvent<T>);\n\n last.current = { t: now, x, y };\n },\n [onDouble, delay, tolerancePx],\n );\n\n const handleDouble = useCallback(\n (e: any) => {\n onDouble?.(e);\n },\n [onDouble],\n );\n\n return onDouble\n ? ({\n // Computed property uses the framework’s name ('onDoubleClick' or 'onDblClick')\n [dblClickProp]: handleDouble,\n onPointerUpCapture: handlePointerUp,\n } as DoubleProps<K>)\n : {};\n}\n","import { useMemo, PointerEvent } from '@framework';\nimport type { CSSProperties } from '@framework';\nimport { useDragResize, UseDragResizeOptions } from './use-drag-resize';\nimport {\n describeResizeFromConfig,\n describeVerticesFromConfig,\n type ResizeUI,\n type VertexUI,\n} from '../plugin-interaction-primitives/utils';\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 function useInteractionHandles(opts: {\n controller: UseDragResizeOptions; // SINGLE config (rect/scale/rotation/vertices/…)\n resizeUI?: ResizeUI; // purely visual knobs\n vertexUI?: VertexUI; // purely visual knobs\n includeVertices?: boolean; // default false\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 const {\n controller,\n resizeUI,\n vertexUI,\n includeVertices = false,\n handleAttrs,\n vertexAttrs,\n } = opts;\n\n const { dragProps, createResizeProps, createVertexProps } = useDragResize(controller);\n\n // Resize handles: only uses data from the SAME controller config.\n const resize: HandleElementProps[] = useMemo(() => {\n const desc = describeResizeFromConfig(controller, resizeUI);\n return desc.map((d) => ({\n key: d.attrs?.['data-epdf-handle'] as string,\n style: d.style as CSSProperties,\n ...createResizeProps(d.handle),\n ...(d.attrs ?? {}),\n ...(handleAttrs?.(d.handle) ?? {}),\n }));\n // deps: controller geometry knobs + UI knobs + handler factory\n }, [\n controller.element.origin.x,\n controller.element.origin.y,\n controller.element.size.width,\n controller.element.size.height,\n controller.scale,\n controller.pageRotation,\n controller.maintainAspectRatio,\n resizeUI?.handleSize,\n resizeUI?.spacing,\n resizeUI?.offsetMode,\n resizeUI?.includeSides,\n resizeUI?.zIndex,\n resizeUI?.rotationAwareCursor,\n createResizeProps,\n handleAttrs,\n ]);\n\n // Vertex handles: same source; prefer live vertices if parent rerenders with updated cfg.vertices\n const vertices: HandleElementProps[] = useMemo(() => {\n if (!includeVertices) return [];\n const desc = describeVerticesFromConfig(controller, vertexUI, controller.vertices);\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 includeVertices,\n controller.element.origin.x,\n controller.element.origin.y,\n controller.element.size.width,\n controller.element.size.height,\n controller.scale,\n controller.vertices, // identity/content drives recalculation\n vertexUI?.vertexSize,\n vertexUI?.zIndex,\n createVertexProps,\n vertexAttrs,\n ]);\n\n return { dragProps, resize, vertices };\n}\n"],"names":["dblClickProp","DragResizeController","constructor","config","onUpdate","this","state","startPoint","startElement","activeHandle","currentPosition","activeVertexIndex","startVertices","currentVertices","vertices","updateConfig","startDrag","clientX","clientY","x","y","element","transformData","type","changes","rect","startResize","handle","metadata","maintainAspectRatio","startVertexEdit","vertexIndex","length","move","delta","calculateDelta","position","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","width","height","newVertices","currentVertex","moved","origin","size","applyConstraints","aspectRatio","includes","newWidth","widthDiff","newHeight","heightDiff","abs","minWidth","minHeight","maxWidth","maxHeight","diagonalCursor","rot","nw","ne","sw","se","edgeOffset","k","spacing","mode","base","useDragResize","options","enabled","controllerRef","useRef","onUpdateRef","useEffect","current","event","call","handleDragStart","useCallback","e","preventDefault","stopPropagation","currentTarget","setPointerCapture","pointerId","handleMove","handleEnd","_c","_b","releasePointerCapture","createResizeHandler","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","createVertexHandler","dragProps","createResizeProps","createVertexProps","children","props","rotation","matrix","getCounterRotation","menuWrapperProps","style","left","top","transform","transformOrigin","pointerEvents","zIndex","onTouchStart","Fragment","onDouble","delay","tolerancePx","last","t","handlePointerUp","pointerType","isPrimary","now","performance","withinTime","dx","dy","handleDouble","onPointerUpCapture","opts","controller","resizeUI","vertexUI","includeVertices","handleAttrs","vertexAttrs","resize","useMemo","cfg","ui","handleSize","offsetMode","includeSides","rotationAwareCursor","off","edge","map","pos","borderRadius","cursor","touchAction","attrs","describeResizeFromConfig","d","key","liveVertices","vertexSize","v","i","describeVerticesFromConfig"],"mappings":"iMAiBaA,EAAe,aCwBrB,MAAMC,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,K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