@embedpdf/utils 1.5.0 → 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 +13 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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/hooks/use-double-press-props.ts","../../src/vue/hooks/use-interaction-handles.ts","../../src/vue/utils/deep-to-raw.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 { 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","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"],"names":["_renderSlot"],"mappings":";;;;;;;;;AAkBA,UAAM,QAAQ;AAER,UAAA,kBAAkB,SAAS,MAAM,mBAAmB,MAAM,MAAM,MAAM,QAAQ,CAAC;AAE/E,UAAA,mBAAmB,SAAS,OAAO;AAAA,MACvC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC5B,KAAK,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC3B,WAAW,gBAAgB,MAAM;AAAA,QACjC,iBAAiB;AAAA,QACjB,OAAO,GAAG,gBAAgB,MAAM,KAAK;AAAA,QACrC,QAAQ,GAAG,gBAAgB,MAAM,MAAM;AAAA,QACvC,eAAe;AAAA,QACf,QAAQ;AAAA,MACV;AAAA,MACA,eAAe,CAAC,MAAoB;AAClC,UAAE,gBAAgB;AAClB,UAAE,eAAe;AAAA,MACnB;AAAA,MACA,cAAc,CAAC,MAAkB;AAC/B,UAAE,gBAAgB;AAClB,UAAE,eAAe;AAAA,MAAA;AAAA,IACnB,EACA;AAEI,UAAA,eAAe,SAAS,OAAO;AAAA,MACnC,QAAQ,EAAE,GAAG,MAAM,KAAK,OAAO,GAAG,GAAG,MAAM,KAAK,OAAO,EAAE;AAAA,MACzD,MAAM,EAAE,OAAO,gBAAgB,MAAM,OAAO,QAAQ,gBAAgB,MAA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AM,QAAQ,KAAK,GAAG;AACxB,aAAO,MAAM,IAAI,CAAC,SAAS,eAAe,IAAI,CAAC;AAAA,IAAA;AAE7C,QAAA,MAAM,KAAK,KAAK,WAAW,KAAK,KAAK,QAAQ,KAAK,GAAG;AAChD,aAAA,eAAe,MAAM,KAAK,CAAC;AAAA,IAAA;AAEhC,QAAA,SAAS,OAAO,UAAU,UAAU;AACtC,aAAO,OAAO,KAAK,KAAK,EAAE,OAAO,CAAC,KAAK,QAAQ;AAC7C,YAAI,GAAuB,IAAI,eAAe,MAAM,GAAG,CAAC;AACjD,eAAA;AAAA,MACT,GAAG,EAAO;AAAA,IAAA;AAEL,WAAA;AAAA,EACT;AAEA,SAAO,eAAe,SAAS;AACjC;"}
1
+ {"version":3,"file":"index.js","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/hooks/use-double-press-props.ts","../../src/vue/hooks/use-interaction-handles.ts","../../src/vue/utils/deep-to-raw.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 { 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","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"],"names":["_renderSlot"],"mappings":";;;;;;;;;AAkBA,UAAM,QAAQ;AAEd,UAAM,kBAAkB,SAAS,MAAM,mBAAmB,MAAM,MAAM,MAAM,QAAQ,CAAC;AAErF,UAAM,mBAAmB,SAAS,OAAO;AAAA,MACvC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC5B,KAAK,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC3B,WAAW,gBAAgB,MAAM;AAAA,QACjC,iBAAiB;AAAA,QACjB,OAAO,GAAG,gBAAgB,MAAM,KAAK;AAAA,QACrC,QAAQ,GAAG,gBAAgB,MAAM,MAAM;AAAA,QACvC,eAAe;AAAA,QACf,QAAQ;AAAA,MAAA;AAAA,MAEV,eAAe,CAAC,MAAoB;AAClC,UAAE,gBAAA;AACF,UAAE,eAAA;AAAA,MACJ;AAAA,MACA,cAAc,CAAC,MAAkB;AAC/B,UAAE,gBAAA;AACF,UAAE,eAAA;AAAA,MACJ;AAAA,IAAA,EACA;AAEF,UAAM,eAA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c,OAAM,CAAA;AAAA,IAAC,EACzB;AAAA,EACJ,CAAC;AAED,SAAO,EAAE,WAAW,QAAQ,SAAA;AAC9B;AC9FO,SAAS,UAAyC,WAAiB;AACxE,QAAM,iBAAiB,CAAC,UAAoB;AAC1C,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,aAAO,MAAM,IAAI,CAAC,SAAS,eAAe,IAAI,CAAC;AAAA,IACjD;AACA,QAAI,MAAM,KAAK,KAAK,WAAW,KAAK,KAAK,QAAQ,KAAK,GAAG;AACvD,aAAO,eAAe,MAAM,KAAK,CAAC;AAAA,IACpC;AACA,QAAI,SAAS,OAAO,UAAU,UAAU;AACtC,aAAO,OAAO,KAAK,KAAK,EAAE,OAAO,CAAC,KAAK,QAAQ;AAC7C,YAAI,GAAuB,IAAI,eAAe,MAAM,GAAG,CAAC;AACxD,eAAO;AAAA,MACT,GAAG,CAAA,CAAO;AAAA,IACZ;AACA,WAAO;AAAA,EACT;AAEA,SAAO,eAAe,SAAS;AACjC;"}
@@ -0,0 +1,25 @@
1
+ import { VNode } from 'vue';
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 };
6
+ export type { MenuWrapperProps };
7
+ /**
8
+ * Selection menu props - Vue version
9
+ */
10
+ export interface SelectionMenuPropsBase<TContext extends SelectionMenuContextBase = SelectionMenuContextBase> {
11
+ /** Bounding rect (already scaled to viewport) */
12
+ rect: Rect;
13
+ /** Props for the positioning wrapper div */
14
+ menuWrapperProps: MenuWrapperProps;
15
+ /** Whether the item is currently selected */
16
+ selected: boolean;
17
+ /** Placement hints for menu positioning */
18
+ placement: SelectionMenuPlacement;
19
+ /** Layer-specific context, discriminated by 'type' field */
20
+ context: TContext;
21
+ }
22
+ /**
23
+ * Render function type for selection menus - Vue version
24
+ */
25
+ export type SelectionMenuRenderFn<TContext extends SelectionMenuContextBase = SelectionMenuContextBase> = (props: SelectionMenuPropsBase<TContext>) => VNode | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/utils",
3
- "version": "1.5.0",
3
+ "version": "2.0.0-next.0",
4
4
  "private": false,
5
5
  "description": "Shared utility helpers (geometry, tasks, logging, PDF primitives) that underpin every package in the EmbedPDF ecosystem.",
6
6
  "type": "module",
@@ -28,6 +28,12 @@
28
28
  "types": "./dist/vue/index.d.ts",
29
29
  "import": "./dist/vue/index.js",
30
30
  "require": "./dist/vue/index.cjs"
31
+ },
32
+ "./svelte": {
33
+ "types": "./dist/svelte/index.d.ts",
34
+ "svelte": "./dist/svelte/index.js",
35
+ "import": "./dist/svelte/index.js",
36
+ "require": "./dist/svelte/index.cjs"
31
37
  }
32
38
  },
33
39
  "files": [
@@ -47,14 +53,15 @@
47
53
  "devDependencies": {
48
54
  "typescript": "^5.0.0",
49
55
  "@types/react": "^18.2.0",
50
- "@embedpdf/models": "1.5.0",
51
- "@embedpdf/build": "1.1.0"
56
+ "@embedpdf/build": "1.1.0",
57
+ "@embedpdf/models": "2.0.0-next.0"
52
58
  },
53
59
  "peerDependencies": {
54
60
  "react": ">=16.8.0",
55
61
  "react-dom": ">=16.8.0",
56
62
  "preact": "^10.26.4",
57
- "vue": ">=3.2.0"
63
+ "vue": ">=3.2.0",
64
+ "svelte": ">=5 <6"
58
65
  },
59
66
  "publishConfig": {
60
67
  "access": "public"
@@ -64,7 +71,8 @@
64
71
  "build:react": "vite build --mode react",
65
72
  "build:preact": "vite build --mode preact",
66
73
  "build:vue": "vite build --mode vue",
67
- "build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\"",
74
+ "build:svelte": "vite build --mode svelte",
75
+ "build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue,svelte \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\" \"vite build --mode svelte\"",
68
76
  "clean": "rimraf dist",
69
77
  "lint": "eslint src --color",
70
78
  "lint:fix": "eslint src --color --fix"