@embedpdf/utils 1.4.1 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.cjs.map +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/lib/index.d.ts +1 -0
  4. package/dist/lib/selection-menu.d.ts +14 -0
  5. package/dist/preact/index.cjs +1 -1
  6. package/dist/preact/index.cjs.map +1 -1
  7. package/dist/preact/index.js.map +1 -1
  8. package/dist/react/index.cjs +1 -1
  9. package/dist/react/index.cjs.map +1 -1
  10. package/dist/react/index.js.map +1 -1
  11. package/dist/shared/index.d.ts +1 -0
  12. package/dist/shared/types.d.ts +25 -0
  13. package/dist/shared-preact/index.d.ts +1 -0
  14. package/dist/shared-preact/types.d.ts +25 -0
  15. package/dist/shared-react/index.d.ts +1 -0
  16. package/dist/shared-react/types.d.ts +25 -0
  17. package/dist/shared-svelte/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
  18. package/dist/shared-svelte/plugin-interaction-primitives/index.d.ts +2 -0
  19. package/dist/shared-svelte/plugin-interaction-primitives/utils.d.ts +22 -0
  20. package/dist/svelte/actions/doublePress.d.ts +9 -0
  21. package/dist/svelte/actions/index.d.ts +1 -0
  22. package/dist/svelte/components/CounterRotateContainer.svelte.d.ts +18 -0
  23. package/dist/svelte/components/index.d.ts +2 -0
  24. package/dist/svelte/components/types.d.ts +4 -0
  25. package/dist/svelte/hooks/index.d.ts +2 -0
  26. package/dist/svelte/hooks/use-drag-resize.svelte.d.ts +26 -0
  27. package/dist/svelte/hooks/use-interaction-handles.svelte.d.ts +32 -0
  28. package/dist/svelte/index.cjs +2 -0
  29. package/dist/svelte/index.cjs.map +1 -0
  30. package/dist/svelte/index.d.ts +5 -0
  31. package/dist/svelte/index.js +757 -0
  32. package/dist/svelte/index.js.map +1 -0
  33. package/dist/svelte/types.d.ts +33 -0
  34. package/dist/svelte/utils/deep-to-raw.d.ts +9 -0
  35. package/dist/svelte/utils/index.d.ts +2 -0
  36. package/dist/svelte/utils/styles-to-string.d.ts +29 -0
  37. package/dist/vue/components/counter-rotate-container.vue.d.ts +3 -2
  38. package/dist/vue/index.cjs +1 -1
  39. package/dist/vue/index.cjs.map +1 -1
  40. package/dist/vue/index.d.ts +1 -0
  41. package/dist/vue/index.js.map +1 -1
  42. package/dist/vue/types.d.ts +25 -0
  43. package/package.json +12 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/shared/plugin-interaction-primitives/drag-resize-controller.ts","../../src/shared/plugin-interaction-primitives/utils.ts","../../src/svelte/hooks/use-drag-resize.svelte.ts","../../src/svelte/utils/styles-to-string.ts","../../src/svelte/hooks/use-interaction-handles.svelte.ts","../../src/svelte/actions/doublePress.ts","../../src/svelte/components/CounterRotateContainer.svelte","../../src/svelte/utils/deep-to-raw.ts"],"sourcesContent":["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 {\n type DragResizeConfig,\n DragResizeController,\n type InteractionEvent,\n type ResizeHandle,\n} from '../../shared/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(getOptions: () => UseDragResizeOptions) {\n // Use getter function to maintain reactivity\n const config = $derived.by(() => {\n const opts = getOptions();\n const { onUpdate, enabled, ...rest } = opts;\n return rest;\n });\n\n const enabled = $derived(getOptions().enabled ?? true);\n const onUpdate = $derived(getOptions().onUpdate);\n\n let controller = $state<DragResizeController | null>(null);\n\n // Initialize or update controller\n $effect(() => {\n if (!controller) {\n controller = new DragResizeController(config, (event) => onUpdate?.(event));\n } else {\n controller.updateConfig(config);\n }\n });\n\n const handleDragStart = (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller?.startDrag(e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n };\n\n const handleMove = (e: PointerEvent) => {\n e.preventDefault();\n e.stopPropagation();\n controller?.move(e.clientX, e.clientY);\n };\n\n const handleEnd = (e: PointerEvent) => {\n e.preventDefault();\n e.stopPropagation();\n controller?.end();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n const createResizeHandler = (handle: ResizeHandle): ResizeHandleEventProps => ({\n onpointerdown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller?.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\n const createVertexHandler = (vertexIndex: number): ResizeHandleEventProps => ({\n onpointerdown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller?.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\n const dragProps = $derived(\n enabled\n ? {\n onpointerdown: handleDragStart,\n onpointermove: handleMove,\n onpointerup: handleEnd,\n onpointercancel: handleEnd,\n }\n : {},\n );\n\n return {\n get dragProps() {\n return dragProps;\n },\n createResizeProps: createResizeHandler,\n createVertexProps: createVertexHandler,\n };\n}\n","/**\n * Converts a style object with camelCase properties to a CSS string with kebab-case properties.\n *\n * This is useful in Svelte 5 where spreading style objects doesn't work with the `style:` directive.\n * Instead, you can convert the entire style object to a string and apply it to the `style` attribute.\n *\n * @param style - An object containing CSS properties in camelCase format with string or number values\n * @returns A CSS string with kebab-case properties suitable for the HTML style attribute\n *\n * @example\n * ```ts\n * const styles = {\n * position: 'absolute',\n * zIndex: 10,\n * borderRadius: '50%',\n * backgroundColor: '#007ACC'\n * };\n *\n * const cssString = stylesToString(styles);\n * // Returns: \"position: absolute; z-index: 10; border-radius: 50%; background-color: #007ACC\"\n * ```\n *\n * @example\n * Usage in Svelte templates:\n * ```svelte\n * <div style=\"{stylesToString(myStyles)}; color: red;\"></div>\n * ```\n */\nexport function stylesToString(style: Record<string, string | number>): string {\n return Object.entries(style)\n .map(([key, value]) => {\n const cssKey = key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n return `${cssKey}: ${value}`;\n })\n .join('; ');\n}\n","import { useDragResize, type UseDragResizeOptions } from './use-drag-resize.svelte';\nimport {\n describeResizeFromConfig,\n describeVerticesFromConfig,\n type ResizeUI,\n type VertexUI,\n} from '../../shared/plugin-interaction-primitives';\nimport { stylesToString } from '../utils/styles-to-string';\n\nexport type HandleElementProps = {\n key: string | number;\n style: string;\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(\n getOpts: () => {\n controller: UseDragResizeOptions;\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) {\n // Use getter function and $derived to maintain reactivity\n const controller = $derived(getOpts().controller);\n const resizeUI = $derived(getOpts().resizeUI);\n const vertexUI = $derived(getOpts().vertexUI);\n const includeVertices = $derived(getOpts().includeVertices ?? false);\n const handleAttrs = $derived(getOpts().handleAttrs);\n const vertexAttrs = $derived(getOpts().vertexAttrs);\n\n const dragResize = useDragResize(() => controller);\n\n // Resize handles: computed from controller config\n const resize = $derived.by((): HandleElementProps[] => {\n const desc = describeResizeFromConfig(controller, resizeUI);\n return desc.map((d) => ({\n key: d.attrs?.['data-epdf-handle'] as string,\n style: stylesToString(d.style),\n ...dragResize.createResizeProps(d.handle),\n ...(d.attrs ?? {}),\n ...(handleAttrs?.(d.handle) ?? {}),\n }));\n });\n\n // Vertex handles: computed from controller config and vertices\n const vertices = $derived.by((): HandleElementProps[] => {\n if (!includeVertices) return [];\n const desc = describeVerticesFromConfig(controller, vertexUI, controller.vertices);\n return desc.map((d, i) => ({\n key: i,\n style: stylesToString(d.style),\n ...dragResize.createVertexProps(i),\n ...(d.attrs ?? {}),\n ...(vertexAttrs?.(i) ?? {}),\n }));\n });\n\n // Return getters to maintain reactivity when accessed from outside\n return {\n get dragProps() {\n return dragResize.dragProps;\n },\n get resize() {\n return resize;\n },\n get vertices() {\n return vertices;\n },\n };\n}\n","export type DoublePressOptions = {\n delay?: number; // ms between taps\n tolerancePx?: number; // spatial tolerance\n onDouble?: (e: PointerEvent | MouseEvent) => void;\n};\n\nexport function doublePress<T extends Element = Element>(\n node: T,\n options: DoublePressOptions = {},\n) {\n let { onDouble, delay = 300, tolerancePx = 18 } = options;\n\n // last pointerup (time & position)\n const last = { t: 0, x: 0, y: 0 };\n\n const handlePointerUp = (e: Event) => {\n const ev = e as PointerEvent;\n if (!onDouble) return;\n\n // ignore mouse (mouse uses native dblclick)\n // ignore non-primary pointers (multi-touch, etc.)\n if (ev.pointerType === 'mouse' || ev.isPrimary === false) return;\n\n const now = performance.now();\n const x = ev.clientX;\n const y = ev.clientY;\n\n const withinTime = now - last.t <= delay;\n const dx = x - last.x;\n const dy = y - last.y;\n const withinDist = dx * dx + dy * dy <= tolerancePx * tolerancePx;\n\n if (withinTime && withinDist) onDouble?.(ev);\n\n last.t = now;\n last.x = x;\n last.y = y;\n };\n\n const handleDblClick = (e: Event) => {\n onDouble?.(e as MouseEvent);\n };\n\n node.addEventListener('pointerup', handlePointerUp, { capture: true });\n node.addEventListener('dblclick', handleDblClick);\n\n return {\n update(next?: DoublePressOptions) {\n if (!next) return;\n onDouble = next.onDouble;\n // use nullish coalescing so 0 isn't swallowed accidentally (even though 0 isn't useful here)\n delay = next.delay ?? delay;\n tolerancePx = next.tolerancePx ?? tolerancePx;\n },\n destroy() {\n node.removeEventListener('pointerup', handlePointerUp, { capture: true } as any);\n node.removeEventListener('dblclick', handleDblClick);\n },\n };\n}\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { getCounterRotation } from '@embedpdf/utils';\n import type { Rect, Rotation } from '@embedpdf/models';\n import type { MenuWrapperProps } from './types';\n\n interface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n }\n\n interface CounterRotateChildrenProps {\n matrix: string;\n rect: Rect;\n menuWrapperProps: MenuWrapperProps;\n }\n\n interface Props extends CounterRotateProps {\n children?: Snippet<[CounterRotateChildrenProps]>;\n }\n\n let { rect, rotation, children }: Props = $props();\n const counterRotation = $derived(getCounterRotation(rect, rotation));\n let elementRef = $state<HTMLElement | null>(null);\n\n // Use native event listeners with capture phase to prevent event propagation\n $effect(() => {\n const element = elementRef;\n if (!element) return;\n\n const handlePointerDown = (e: Event) => {\n // Stop propagation to prevent underlying layers from receiving the event\n e.stopPropagation();\n // DO NOT use e.preventDefault() here - it breaks click events on mobile/tablet!\n // preventDefault() stops the browser from generating click events from touch,\n // which makes buttons inside this container non-functional on touch devices.\n };\n\n const handleTouchStart = (e: Event) => {\n // Stop propagation to prevent underlying layers from receiving the event\n e.stopPropagation();\n // DO NOT use e.preventDefault() here - it breaks click events on mobile/tablet!\n // preventDefault() stops the browser from generating click events from touch,\n // which makes buttons inside this container non-functional on touch devices.\n };\n\n // Use capture phase to intercept before synthetic events\n element.addEventListener('pointerdown', handlePointerDown, { capture: true });\n element.addEventListener('touchstart', handleTouchStart, { capture: true });\n\n return () => {\n element.removeEventListener('pointerdown', handlePointerDown, { capture: true });\n element.removeEventListener('touchstart', handleTouchStart, { capture: true });\n };\n });\n\n const menuWrapperStyle = $derived(\n `position: absolute; ` +\n `left: ${rect.origin.x}px; ` +\n `top: ${rect.origin.y}px; ` +\n `transform: ${counterRotation.matrix}; ` +\n `transform-origin: 0 0; ` +\n `width: ${counterRotation.width}px; ` +\n `height: ${counterRotation.height}px; ` +\n `pointer-events: none; ` +\n `z-index: 3`,\n );\n\n const menuWrapperProps: MenuWrapperProps = $derived({\n style: menuWrapperStyle,\n ref: (el: HTMLElement | null) => {\n elementRef = el;\n },\n });\n</script>\n\n{#if children}\n {@render children({\n menuWrapperProps,\n matrix: counterRotation.matrix,\n rect: {\n origin: { x: rect.origin.x, y: rect.origin.y },\n size: { width: counterRotation.width, height: counterRotation.height },\n },\n })}\n{/if}\n","/**\n * Converts Svelte proxy objects to plain JavaScript objects.\n * This is useful when passing data to Web Workers or other contexts\n * that cannot handle Svelte's reactive proxies.\n *\n * Inspired by the Vue implementation, this recursively traverses the object\n * and handles primitives, arrays, and plain objects while stripping reactive proxies.\n */\nexport function deepToRaw<T extends Record<string, any>>(sourceObj: T): T {\n const objectIterator = (input: any): any => {\n // Handle null and undefined\n if (input === null || input === undefined) {\n return input;\n }\n\n // Handle primitives (string, number, boolean, bigint, symbol)\n if (typeof input !== 'object') {\n return input;\n }\n\n // Handle Arrays\n if (Array.isArray(input)) {\n return input.map((item) => objectIterator(item));\n }\n\n // Handle Date objects\n if (input instanceof Date) {\n return new Date(input.getTime());\n }\n\n // Handle RegExp\n if (input instanceof RegExp) {\n return new RegExp(input.source, input.flags);\n }\n\n // Handle plain objects (including Svelte proxies)\n // For Svelte proxies, we recursively extract plain values\n if (Object.prototype.toString.call(input) === '[object Object]') {\n return Object.keys(input).reduce((acc, key) => {\n // Skip non-enumerable properties and functions\n const value = input[key];\n if (typeof value !== 'function') {\n acc[key as keyof typeof acc] = objectIterator(value);\n }\n return acc;\n }, {} as T);\n }\n\n // For other object types (Map, Set, etc.), use JSON roundtrip as fallback\n // This will convert them to plain objects/arrays\n try {\n return JSON.parse(JSON.stringify(input));\n } catch {\n // If JSON serialization fails, return undefined\n return undefined;\n }\n };\n\n return objectIterator(sourceObj);\n}\n"],"names":["onUpdate","enabled"],"mappings":";;;AAyCO,MAAM,qBAAqB;AAAA,EAYhC,YACU,QACA,UACR;AAFQ,SAAA,SAAA;AACA,SAAA,WAAA;AAbV,SAAQ,QAA0B;AAClC,SAAQ,aAA8B;AACtC,SAAQ,eAA4B;AACpC,SAAQ,eAAoC;AAC5C,SAAQ,kBAA+B;AAGvC,SAAQ,oBAAmC;AAC3C,SAAQ,gBAA4B,CAAA;AACpC,SAAQ,kBAA8B,CAAA;AAMpC,SAAK,kBAAkB,OAAO,YAAY,CAAA;AAAA,EAC5C;AAAA,EAEA,aAAa,QAAmC;AAC9C,SAAK,SAAS,EAAE,GAAG,KAAK,QAAQ,GAAG,OAAA;AACnC,SAAK,kBAAkB,OAAO,YAAY,CAAA;AAAA,EAC5C;AAAA,EAEA,UAAU,SAAiB,SAAiB;AAC1C,SAAK,QAAQ;AACb,SAAK,aAAa,EAAE,GAAG,SAAS,GAAG,QAAA;AACnC,SAAK,eAAe,EAAE,GAAG,KAAK,OAAO,QAAA;AACrC,SAAK,kBAAkB,EAAE,GAAG,KAAK,OAAO,QAAA;AAExC,SAAK,SAAS;AAAA,MACZ,OAAO;AAAA,MACP,eAAe;AAAA,QACb,MAAM;AAAA,QACN,SAAS;AAAA,UACP,MAAM,KAAK;AAAA,QAAA;AAAA,MACb;AAAA,IACF,CACD;AAAA,EACH;AAAA,EAEA,YAAY,QAAsB,SAAiB,SAAiB;AAClE,SAAK,QAAQ;AACb,SAAK,eAAe;AACpB,SAAK,aAAa,EAAE,GAAG,SAAS,GAAG,QAAA;AACnC,SAAK,eAAe,EAAE,GAAG,KAAK,OAAO,QAAA;AACrC,SAAK,kBAAkB,EAAE,GAAG,KAAK,OAAO,QAAA;AAExC,SAAK,SAAS;AAAA,MACZ,OAAO;AAAA,MACP,eAAe;AAAA,QACb,MAAM;AAAA,QAC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IAAI,eAAe,KAAK;AAAA,QACrD;AACA,eAAO;AAAA,MACT,GAAG,CAAA,CAAO;AAAA,IACZ;AAIA,QAAI;AACF,aAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AAAA,IACzC,QAAQ;AAEN,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,eAAe,SAAS;AACjC;"}
@@ -0,0 +1,33 @@
1
+ import { Component } from 'svelte';
2
+ import { Rect } from '@embedpdf/models';
3
+ import { SelectionMenuPlacement, SelectionMenuContextBase } from '../lib/index.ts';
4
+ import { MenuWrapperProps } from './components/types';
5
+ export type { SelectionMenuPlacement, SelectionMenuContextBase, MenuWrapperProps };
6
+ /**
7
+ * Selection menu props - Svelte version
8
+ */
9
+ export interface SelectionMenuPropsBase<TContext extends SelectionMenuContextBase = SelectionMenuContextBase> {
10
+ rect: Rect;
11
+ menuWrapperProps: MenuWrapperProps;
12
+ selected: boolean;
13
+ placement: SelectionMenuPlacement;
14
+ context: TContext;
15
+ }
16
+ /**
17
+ * Result of a selection menu render function
18
+ * Contains the component to render and its props
19
+ */
20
+ export interface SelectionMenuRenderResult {
21
+ component: Component<any>;
22
+ props: Record<string, unknown>;
23
+ }
24
+ /**
25
+ * Render function type for selection menus - Svelte version
26
+ * Returns a component + props object, or null/undefined to skip rendering
27
+ */
28
+ export type SelectionMenuRenderFn<TContext extends SelectionMenuContextBase = SelectionMenuContextBase> = (props: SelectionMenuPropsBase<TContext>) => SelectionMenuRenderResult | null | undefined;
29
+ /**
30
+ * Component type for selection menus - Svelte version
31
+ * Alternative to render function, pass a component directly
32
+ */
33
+ export type SelectionMenuComponent<TContext extends SelectionMenuContextBase = SelectionMenuContextBase> = Component<SelectionMenuPropsBase<TContext>>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts Svelte proxy objects to plain JavaScript objects.
3
+ * This is useful when passing data to Web Workers or other contexts
4
+ * that cannot handle Svelte's reactive proxies.
5
+ *
6
+ * Inspired by the Vue implementation, this recursively traverses the object
7
+ * and handles primitives, arrays, and plain objects while stripping reactive proxies.
8
+ */
9
+ export declare function deepToRaw<T extends Record<string, any>>(sourceObj: T): T;
@@ -0,0 +1,2 @@
1
+ export * from './deep-to-raw';
2
+ export * from './styles-to-string';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Converts a style object with camelCase properties to a CSS string with kebab-case properties.
3
+ *
4
+ * This is useful in Svelte 5 where spreading style objects doesn't work with the `style:` directive.
5
+ * Instead, you can convert the entire style object to a string and apply it to the `style` attribute.
6
+ *
7
+ * @param style - An object containing CSS properties in camelCase format with string or number values
8
+ * @returns A CSS string with kebab-case properties suitable for the HTML style attribute
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const styles = {
13
+ * position: 'absolute',
14
+ * zIndex: 10,
15
+ * borderRadius: '50%',
16
+ * backgroundColor: '#007ACC'
17
+ * };
18
+ *
19
+ * const cssString = stylesToString(styles);
20
+ * // Returns: "position: absolute; z-index: 10; border-radius: 50%; background-color: #007ACC"
21
+ * ```
22
+ *
23
+ * @example
24
+ * Usage in Svelte templates:
25
+ * ```svelte
26
+ * <div style="{stylesToString(myStyles)}; color: red;"></div>
27
+ * ```
28
+ */
29
+ export declare function stylesToString(style: Record<string, string | number>): string;
@@ -11,8 +11,9 @@ declare var __VLS_1: {
11
11
  type __VLS_Slots = {} & {
12
12
  default?: (props: typeof __VLS_1) => any;
13
13
  };
14
- declare const __VLS_component: import('vue').DefineComponent<CounterRotateProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CounterRotateProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
14
+ declare const __VLS_base: import('vue').DefineComponent<CounterRotateProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<CounterRotateProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
16
+ declare const _default: typeof __VLS_export;
16
17
  export default _default;
17
18
  type __VLS_WithSlots<T, S> = T & {
18
19
  new (): {
@@ -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 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))??{}})))}))}};
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/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,EAAE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,EAAItK,UAAY,IAEjC0F,KAAI,CAAChB,EAAG8G,KAGZ,CACL9K,OAAQ,KACRhD,MAAO,CACLC,SAAU,WACVC,MANU8G,EAAE5G,EAAIP,EAAKM,OAAOC,GAAKiE,EAAQwJ,EAAa,EAMzC,KACbxN,KANS2G,EAAE1G,EAAIT,EAAKM,OAAOG,GAAK+D,EAAQwJ,EAAa,EAM1C,KACXlN,MAAOkN,EAAa,KACpBjN,OAAQiN,EAAa,KACrBR,aAAc,MACdC,OAAQ,UACRxM,SACAyM,YAAa,QAEfC,MAAO,CAAE,mBAAoBM,MAGnC,CKjDiBC,CACX,CAAEpL,QAAS0J,EAAa7L,MAAO6D,MAAOkI,EAAW/L,MAAO8B,SAAUqL,GAClE1B,EACA0B,GAEU3F,KAAI,CAAC0F,EAAGI,KAAO,CACzB9C,IAAK8C,EACL9N,MAAO0N,EAAE1N,SACNmK,EAAkB2D,MACjBJ,EAAEF,OAAS,CAAC,MACE,MAAdpB,OAAc,EAAAA,EAAA0B,KAAM,CAAA,KACxB,IAIN"}
1
+ {"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","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,EAAAA,SAAS,IAAMC,EAAAA,mBAAmBJ,EAAMK,KAAML,EAAMM,WAEtEC,EAAmBJ,EAAAA,SAAS,KAAA,CAChCK,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,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UAAY,IAEjC0F,IAAI,CAAChB,EAAG6G,KAGZ,CACL7K,OAAQ,KACRhD,MAAO,CACLC,SAAU,WACVC,MANU8G,EAAE5G,EAAIP,EAAKM,OAAOC,GAAKiE,EAAQuJ,EAAa,EAMzC,KACbvN,KANS2G,EAAE1G,EAAIT,EAAKM,OAAOG,GAAK+D,EAAQuJ,EAAa,EAM1C,KACXjN,MAAOiN,EAAa,KACpBhN,OAAQgN,EAAa,KACrBR,aAAc,MACdC,OAAQ,UACRvM,SACAwM,YAAa,QAEfC,MAAO,CAAE,mBAAoBM,KAGnC,CKjDiBC,CACX,CAAEnL,QAASyJ,EAAa5L,MAAO6D,MAAOiI,EAAW9L,MAAO8B,SAAUoL,GAClE1B,EACA0B,GAEU1F,IAAI,CAACyF,EAAGI,KAAA,CAClB9C,IAAK8C,EACL7N,MAAOyN,EAAEzN,SACNkK,EAAkB2D,MACjBJ,EAAEF,OAAS,CAAA,MACX,MAAApB,OAAA,EAAAA,EAAc0B,KAAM,CAAA,OAK9B"}
@@ -1,3 +1,4 @@
1
1
  export * from './components';
2
2
  export * from './hooks';
3
3
  export * from './utils/deep-to-raw';
4
+ export * from './types';