From c244edf8b7cd6f99d165650eab51e99e73a1523f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Sz=C3=BCcs?= <127139797+balazs-szucs@users.noreply.github.com> Date: Sun, 1 Mar 2026 16:45:44 +0100 Subject: [PATCH] feat(annotation): add moveAnnotation API for efficient repositioning of annotations, and bump embed to 2.7.0 (#5809) --- frontend/package-lock.json | 324 +++++++++--------- frontend/package.json | 46 +-- .../components/viewer/AnnotationAPIBridge.tsx | 26 +- .../components/viewer/SignatureAPIBridge.tsx | 9 +- .../src/core/components/viewer/viewerTypes.ts | 12 + 5 files changed, 222 insertions(+), 195 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 8f04217e9..b35c05363 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -12,29 +12,29 @@ "@atlaskit/pragmatic-drag-and-drop": "^1.7.7", "@cantoo/pdf-lib": "^2.5.3", "@dnd-kit/core": "^6.3.1", - "@embedpdf/core": "^2.6.2", - "@embedpdf/engines": "^2.6.2", - "@embedpdf/models": "^2.6.2", - "@embedpdf/plugin-annotation": "^2.6.2", - "@embedpdf/plugin-attachment": "^2.6.2", - "@embedpdf/plugin-bookmark": "^2.6.2", - "@embedpdf/plugin-document-manager": "^2.6.2", - "@embedpdf/plugin-export": "^2.6.2", - "@embedpdf/plugin-history": "^2.6.2", - "@embedpdf/plugin-interaction-manager": "^2.6.2", - "@embedpdf/plugin-pan": "^2.6.2", - "@embedpdf/plugin-print": "^2.6.2", - "@embedpdf/plugin-redaction": "^2.6.2", - "@embedpdf/plugin-render": "^2.6.2", - "@embedpdf/plugin-rotate": "^2.6.2", - "@embedpdf/plugin-scroll": "^2.6.2", - "@embedpdf/plugin-search": "^2.6.2", - "@embedpdf/plugin-selection": "^2.6.2", - "@embedpdf/plugin-spread": "^2.6.2", - "@embedpdf/plugin-thumbnail": "^2.6.2", - "@embedpdf/plugin-tiling": "^2.6.2", - "@embedpdf/plugin-viewport": "^2.6.2", - "@embedpdf/plugin-zoom": "^2.6.2", + "@embedpdf/core": "^2.7.0", + "@embedpdf/engines": "^2.7.0", + "@embedpdf/models": "^2.7.0", + "@embedpdf/plugin-annotation": "^2.7.0", + "@embedpdf/plugin-attachment": "^2.7.0", + "@embedpdf/plugin-bookmark": "^2.7.0", + "@embedpdf/plugin-document-manager": "^2.7.0", + "@embedpdf/plugin-export": "^2.7.0", + "@embedpdf/plugin-history": "^2.7.0", + "@embedpdf/plugin-interaction-manager": "^2.7.0", + "@embedpdf/plugin-pan": "^2.7.0", + "@embedpdf/plugin-print": "^2.7.0", + "@embedpdf/plugin-redaction": "^2.7.0", + "@embedpdf/plugin-render": "^2.7.0", + "@embedpdf/plugin-rotate": "^2.7.0", + "@embedpdf/plugin-scroll": "^2.7.0", + "@embedpdf/plugin-search": "^2.7.0", + "@embedpdf/plugin-selection": "^2.7.0", + "@embedpdf/plugin-spread": "^2.7.0", + "@embedpdf/plugin-thumbnail": "^2.7.0", + "@embedpdf/plugin-tiling": "^2.7.0", + "@embedpdf/plugin-viewport": "^2.7.0", + "@embedpdf/plugin-zoom": "^2.7.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", "@iconify/react": "^6.0.2", @@ -565,13 +565,13 @@ } }, "node_modules/@embedpdf/core": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/core/-/core-2.6.2.tgz", - "integrity": "sha512-HTy2B7Q5hlNqtYo6lIudwycekG4x/iTESq05uYqENkvTclcZkzebnNirPPPPRcf3oT/u6Qvfj4mkx3z7wTSNUA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/core/-/core-2.7.0.tgz", + "integrity": "sha512-dJ9pCWXVJxh6uSJP4sKuJP4v67+6Vlmw4WqJcv+CKJSUPdX9LhOSTIgTjwKLZ5zXo0c3DihNvrUupovb/DrhgQ==", "license": "MIT", "dependencies": { - "@embedpdf/engines": "2.6.2", - "@embedpdf/models": "2.6.2" + "@embedpdf/engines": "2.7.0", + "@embedpdf/models": "2.7.0" }, "peerDependencies": { "preact": "^10.26.4", @@ -582,9 +582,9 @@ } }, "node_modules/@embedpdf/engines": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/engines/-/engines-2.6.2.tgz", - "integrity": "sha512-ZyyMVqZ8bnTNmgAziLhNywKhafVFbtLuC5AGcQqlAOQfyZqOWd240FdDGViQXAq4sfSp/NopirvIUtAKHoIrtg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/engines/-/engines-2.7.0.tgz", + "integrity": "sha512-9BW/0f1EhMtklOXzpq+TtAELpXrvWcgCioFX9tSvPXBwWw/xva9c3UFx8NKehfrAkmcLGNz2c2Kqe8hDlKp9Rw==", "license": "MIT", "dependencies": { "@embedpdf/fonts-arabic": "1.0.0", @@ -594,8 +594,8 @@ "@embedpdf/fonts-latin": "1.0.0", "@embedpdf/fonts-sc": "1.0.0", "@embedpdf/fonts-tc": "1.0.0", - "@embedpdf/models": "2.6.2", - "@embedpdf/pdfium": "2.6.2" + "@embedpdf/models": "2.7.0", + "@embedpdf/pdfium": "2.7.0" }, "peerDependencies": { "preact": "^10.26.4", @@ -648,31 +648,31 @@ "license": "OFL-1.1" }, "node_modules/@embedpdf/models": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/models/-/models-2.6.2.tgz", - "integrity": "sha512-4mr1PIS5qR+HLKroUn9iU8qj+s/vptj82non94Ei0P6/yGG6GHv/E1lfALvd8rZ3FfHuF6V7Pa4SxS2WFDecYg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/models/-/models-2.7.0.tgz", + "integrity": "sha512-SRtDqYUn6Qw677ECIyipg0qqZR0+iLUU1mGI/X70ad4/qhw+TAOF5/aWddoFdPAw5XviEYVw5zR0oTz+MLBUbw==", "license": "MIT" }, "node_modules/@embedpdf/pdfium": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/pdfium/-/pdfium-2.6.2.tgz", - "integrity": "sha512-LXqS+fSCQT1226X+XdrT6p0V2WR2cTDO3JzUix2v+9kl8IvlVfTWjkT5LVrOyS1poCsuySzd2GHz8jEweETgoQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/pdfium/-/pdfium-2.7.0.tgz", + "integrity": "sha512-PW6JnbBERvRKVrBzeCH/iGorQ8OTTRwr8rciyv2Kstqf3IdIFHjjNWvl6exK1/3K5wbbxYnHSNpRotl0OcsFJA==", "license": "MIT" }, "node_modules/@embedpdf/plugin-annotation": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-annotation/-/plugin-annotation-2.6.2.tgz", - "integrity": "sha512-3rOqty+jTzJu3fUvNPsaM2SmeV6K2J/DkzdgBZNVV3neahEl9v1DTJEkAxCgLI/fj6wBXEkJrKmmtDGoDlvVAg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-annotation/-/plugin-annotation-2.7.0.tgz", + "integrity": "sha512-bkn9+91XfcFoKgwZ0kiJLbnvWNyrorhcbX5grsvUw2gJ8mL0RtwHSnCjZVT3WOPleQVwnNkBZUHefJhNT+LEKw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2", - "@embedpdf/utils": "2.6.2" + "@embedpdf/models": "2.7.0", + "@embedpdf/utils": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-history": "2.6.2", - "@embedpdf/plugin-interaction-manager": "2.6.2", - "@embedpdf/plugin-selection": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-history": "2.7.0", + "@embedpdf/plugin-interaction-manager": "2.7.0", + "@embedpdf/plugin-selection": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -681,15 +681,15 @@ } }, "node_modules/@embedpdf/plugin-attachment": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-attachment/-/plugin-attachment-2.6.2.tgz", - "integrity": "sha512-L14Gmo550Un5csOmWCe5tAjcv+11DlGVF6Rt2qRd3XtA4q4IehW4DpEpVf8viywBieI/WKcNqwpfUcWDhnDa9Q==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-attachment/-/plugin-attachment-2.7.0.tgz", + "integrity": "sha512-APH9Y/P4KyawckS68bouQ5aGsmQurgkdBG0oRq9kirDM+yIVGonS2P+gzwu9otgNKve880S5mBImC3FndJL4Tg==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -698,15 +698,15 @@ } }, "node_modules/@embedpdf/plugin-bookmark": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-bookmark/-/plugin-bookmark-2.6.2.tgz", - "integrity": "sha512-kPfEoBiacsooUVxh5t4hSKl6O6woysfN75uXngHa2OkcyymzOgVNDe7UxTJxsvX8KikJ+dhRuuA1rJHsrsE7ig==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-bookmark/-/plugin-bookmark-2.7.0.tgz", + "integrity": "sha512-um+naqyEAhBp4uFIis6K+V0t3dY4Dgry/vW17SwK9lFyMPQNCUT8PZMb7ysvj88vBXaDbzqCbtnlV6AyBEqxEQ==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -715,15 +715,15 @@ } }, "node_modules/@embedpdf/plugin-document-manager": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-document-manager/-/plugin-document-manager-2.6.2.tgz", - "integrity": "sha512-5oEDv4qXelyvCy9vOtNUZkMlS/sh5RtrSTG968T+km2/UijQ37AZO/h/Py5X5S0JOqZVkRhX5tXeXVn2K5NiHg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-document-manager/-/plugin-document-manager-2.7.0.tgz", + "integrity": "sha512-eKM0MEUCPZmNkOkz5n6QWBcKN7m1c3RBZlfXB7faHBaScPyO3f+xgfipAht86UvfYwxT9BWk9ozbAtm2UPBHcQ==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -732,15 +732,15 @@ } }, "node_modules/@embedpdf/plugin-export": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-export/-/plugin-export-2.6.2.tgz", - "integrity": "sha512-lgbVVkHgSMwsUCn+1hpu1Ic6KQvfQlEwdHovAXzyrjvk2oqbQytRJbXL3bQsZWFFg6nqsIUb/4jwJwn/+n/yig==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-export/-/plugin-export-2.7.0.tgz", + "integrity": "sha512-wlP/ZdWPLCnJpsQWNCyZAlicvNiapbo7Dc95HMWHg2YgmkCjDe26z4C1QoubUanNSerGWJCK0qKXxJ/PVkJSnw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -749,15 +749,15 @@ } }, "node_modules/@embedpdf/plugin-history": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-history/-/plugin-history-2.6.2.tgz", - "integrity": "sha512-MpTrxtNXjpdjUlmV+HnmPe9Abb/DX3k42JfFLwPhCXlF0BBuJnu300lb0qtZ02WXj8380/uL17Wb7ebSoVqIjA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-history/-/plugin-history-2.7.0.tgz", + "integrity": "sha512-k2c5M2Nwey+j6EtZyf5Sw+cuyNT4MTWdqPQGR9NbmZUiNnkSrg/TmPWZCyaXZKGRjLmoJocc0qRdyaZnaaTpqw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -766,15 +766,15 @@ } }, "node_modules/@embedpdf/plugin-interaction-manager": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-interaction-manager/-/plugin-interaction-manager-2.6.2.tgz", - "integrity": "sha512-7LP7rMDDRWqojQb4E9/S1tWPp+fRfqTvHbb4kgMo14umTK26XWw/xazwf1UxchAruOTC5qjhraH4Bug0MoVyyQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-interaction-manager/-/plugin-interaction-manager-2.7.0.tgz", + "integrity": "sha512-IfJiugr2k9VD8/gryMb22wC5yk4EQwSS3/Co0EdOhzkmkGSgUHA/KcG83WBu8wPEtj5Gwy473xe41fYKsGMlsA==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -783,17 +783,17 @@ } }, "node_modules/@embedpdf/plugin-pan": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-pan/-/plugin-pan-2.6.2.tgz", - "integrity": "sha512-bqzGdr7fSuN0SPDKeaTr2MX24tB2rtoNyrGWZ2kOjuMUMQnNwcrBjK8XbWRjL7tcPLObGOR8vXwzt+hbSfZ3ig==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-pan/-/plugin-pan-2.7.0.tgz", + "integrity": "sha512-/jUyM4K42gd7eoVsKFDSfN4t8CHIf6ZX7kU4BHBBFvOcNB7bToOvibPiznC4oPrHmOuzcs4e+VOfu+yHKn6DrA==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-interaction-manager": "2.6.2", - "@embedpdf/plugin-viewport": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-interaction-manager": "2.7.0", + "@embedpdf/plugin-viewport": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -802,15 +802,15 @@ } }, "node_modules/@embedpdf/plugin-print": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-print/-/plugin-print-2.6.2.tgz", - "integrity": "sha512-PaHl3h2eqMfzo6eviLvZuEGhAaZH877iF1RDTq1HAxpFgWeNKaJV3YcODDkSZwDzJW44jczTVstcEdN5Hk1b/w==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-print/-/plugin-print-2.7.0.tgz", + "integrity": "sha512-sQqRSCN+r59EjKibQ3yMt1lKyHMxO1UqhZ6iI+w5hUBm9yTIHvkQRTVbawbkCfty8QNldjMQEwN3iYkf8LNHsg==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=18.0.0", "react-dom": ">=18.0.0", @@ -819,20 +819,20 @@ } }, "node_modules/@embedpdf/plugin-redaction": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-redaction/-/plugin-redaction-2.6.2.tgz", - "integrity": "sha512-ASQdGAlAbpUY8kSvmSIRXpBRasjBEZXnPGhMsjHtYJgrLGeWeGfd18StH54TVaykYScu8gwI8XdzZJEnfM89GQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-redaction/-/plugin-redaction-2.7.0.tgz", + "integrity": "sha512-N6LD9k35ZCkpHPDW5I6pW6g/YTDXGuNp/kWTHU4bcRGfTwinu6i0PaFJQKus1t1pkVprhmjJgCXbkM2xmIKXAg==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2", - "@embedpdf/utils": "2.6.2" + "@embedpdf/models": "2.7.0", + "@embedpdf/utils": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-annotation": "2.6.2", - "@embedpdf/plugin-history": "2.6.2", - "@embedpdf/plugin-interaction-manager": "2.6.2", - "@embedpdf/plugin-selection": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-annotation": "2.7.0", + "@embedpdf/plugin-history": "2.7.0", + "@embedpdf/plugin-interaction-manager": "2.7.0", + "@embedpdf/plugin-selection": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -841,15 +841,15 @@ } }, "node_modules/@embedpdf/plugin-render": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-render/-/plugin-render-2.6.2.tgz", - "integrity": "sha512-6WK8kCNBxTHrjRPbLHQaou9ZrpaFW2f56Uu+zKbqXCD+tV7d8T9WAVQuqDJrWxjrUXUjWy1RC+KEBMGCftIHWA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-render/-/plugin-render-2.7.0.tgz", + "integrity": "sha512-qJcBxl2Kgqbw/Yb4qiX3qNsBKmzI8ijAKix3PoYL+nlhX6iFbcCkUbJgF0rPCBbhIy59Bpp7eJL+RyY5DhQvUg==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -858,15 +858,15 @@ } }, "node_modules/@embedpdf/plugin-rotate": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-rotate/-/plugin-rotate-2.6.2.tgz", - "integrity": "sha512-g9JUMbIEm91igKIVe8tmccHDI0jBtcYzaaHupyL2bQBByU+Zyz12k2FKbVn+sx0ppk8tYAbyAxeNkB/jNpQh2w==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-rotate/-/plugin-rotate-2.7.0.tgz", + "integrity": "sha512-ggqhQzpJB7ydfx9fDcuUrlGS9wxfsLG+rQwf1MMmUMMdEK1NPsHw5abSuQBerAm1vrpZ3Dyz0v2TxPVejvIhjA==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -875,16 +875,16 @@ } }, "node_modules/@embedpdf/plugin-scroll": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-scroll/-/plugin-scroll-2.6.2.tgz", - "integrity": "sha512-jshTwq69zvotGWMTDdxY+EYR/FBxPfu15fVo6YgYTSjUFm6IJL2z4XIvCB5pdHHHwXV1gTpi8W4FV3/2LXCjnA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-scroll/-/plugin-scroll-2.7.0.tgz", + "integrity": "sha512-uEs5XdHZ3XqH3OWnM8E2eHen+7+MxK9SrlBnfM8ZcPkzHR9n7hT/Aqy05BiLKxKem585HvtbRgFzNQZqmNIGHw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-viewport": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-viewport": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -893,15 +893,15 @@ } }, "node_modules/@embedpdf/plugin-search": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-search/-/plugin-search-2.6.2.tgz", - "integrity": "sha512-o4vYsqjGctDjiwP6+wrRndQoU728wW7Xyxr7mvAIQXlg0/AFBewKXbrX64bhGvVPOTPLpwPFcGBVK073OnaVCQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-search/-/plugin-search-2.7.0.tgz", + "integrity": "sha512-TeUMvlp6j4NXkkbPURSkg7fd6l/X8wUnN+ImFiM01VM+YBLQWTPXcP7AAyFzoI5iAh2m5+ZZEB/uGb5qm3Vamg==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -910,17 +910,17 @@ } }, "node_modules/@embedpdf/plugin-selection": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-selection/-/plugin-selection-2.6.2.tgz", - "integrity": "sha512-btTRcaq+smbkqvcYmBa7+hK50eGoDOaepUma6Og2KCEIS90ZOEAChKY+KJq6axKHDg153/9kUwB1HJ6jTUUz4w==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-selection/-/plugin-selection-2.7.0.tgz", + "integrity": "sha512-MhTUHZ5jBh1jQU66xrtkx2jEtcreCfHy4zpmMY7iCoZtWUxrML+zf4jYNrR/ZP93O4i5HNBSnJNTG+RmRJ5KPw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2", - "@embedpdf/utils": "2.6.2" + "@embedpdf/models": "2.7.0", + "@embedpdf/utils": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-interaction-manager": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-interaction-manager": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -929,15 +929,15 @@ } }, "node_modules/@embedpdf/plugin-spread": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-spread/-/plugin-spread-2.6.2.tgz", - "integrity": "sha512-JmMhUsHrZ7zeVbpk6xQQlD7BEpvkGWMZG1CC50Il4l7hFTlG+5InqhOpdr5aa2dQRKWv9w0UB7G/wqyB8UciuA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-spread/-/plugin-spread-2.7.0.tgz", + "integrity": "sha512-FMW6nXlyZhjQKrj8l4gduu0+IWI/H8Sda9iiKKYOGLrDWcIsSo3Gt3mSJgUsjUxA2YS+l0m48VeuSESa7Ab8oA==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -946,16 +946,16 @@ } }, "node_modules/@embedpdf/plugin-thumbnail": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-thumbnail/-/plugin-thumbnail-2.6.2.tgz", - "integrity": "sha512-V5Ae9EBnVvhuNzQZzAUcoQGpA2G6nKe1gdAxzVUYhSYzpvW+Ld2dKG2ktEMBE4gZ5sXKV/tlHfON/HiP3hDm1g==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-thumbnail/-/plugin-thumbnail-2.7.0.tgz", + "integrity": "sha512-ZnXt9ebtExFQUMUbWApUK8yC1eXYjDMEzS9631QpbLm0BhW9jYu9cs6U37Sww+zhYi7IFih4zb38lgAsbDgOcA==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-render": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-render": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -964,18 +964,18 @@ } }, "node_modules/@embedpdf/plugin-tiling": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-tiling/-/plugin-tiling-2.6.2.tgz", - "integrity": "sha512-F0sqBp7noczTFpy7yCOiAoJf0ndW7cfyfXXyYXuMLL9916QFzobZi1AsXfqRamSYReJTNCF/Yor57j8jvm90MA==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-tiling/-/plugin-tiling-2.7.0.tgz", + "integrity": "sha512-/Cd7dR0kA5/Y1gykYLYS3gecStycc4m5Jjm+a0mFzO/7yQ6BLb0g4zkM95YloBAsFoP5GPXKKhBw3pi32pTObw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-render": "2.6.2", - "@embedpdf/plugin-scroll": "2.6.2", - "@embedpdf/plugin-viewport": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-render": "2.7.0", + "@embedpdf/plugin-scroll": "2.7.0", + "@embedpdf/plugin-viewport": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -984,15 +984,15 @@ } }, "node_modules/@embedpdf/plugin-viewport": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-viewport/-/plugin-viewport-2.6.2.tgz", - "integrity": "sha512-uHLeKQqyKpUAJcbpsJ8P/c2qU6dTKYAC9l/xviURSABqKLw0IC3DLw6aTPZtzCFEsKiIVFZDwjz/LUt+DZaNHQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-viewport/-/plugin-viewport-2.7.0.tgz", + "integrity": "sha512-nVDoU86CgHme7f2r7OFhziqHz1Yg8vdE2K+bXzRCmtZaubH+qVo5C+77at9brYCSinA67znQn1yy6zbfxs4FwA==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", + "@embedpdf/core": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -1001,17 +1001,17 @@ } }, "node_modules/@embedpdf/plugin-zoom": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/plugin-zoom/-/plugin-zoom-2.6.2.tgz", - "integrity": "sha512-lw4JG+gDLeIJYyFzsmsNZcN1kwm+5qAvOPMWQ+CA6zMaNDKV5BwE3c4JRDGwqWF+syK0yvuDh9sjT50h+LSwwg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/plugin-zoom/-/plugin-zoom-2.7.0.tgz", + "integrity": "sha512-5u2cQcahHkbOfa5Ug5hxXwtIOz4TzrQSgvmXvO7+jV0jXKOp1vFVB9tU26SKwwwW9OL6e4L/P6roKJRPbOnWyw==", "license": "MIT", "dependencies": { - "@embedpdf/models": "2.6.2" + "@embedpdf/models": "2.7.0" }, "peerDependencies": { - "@embedpdf/core": "2.6.2", - "@embedpdf/plugin-scroll": "2.6.2", - "@embedpdf/plugin-viewport": "2.6.2", + "@embedpdf/core": "2.7.0", + "@embedpdf/plugin-scroll": "2.7.0", + "@embedpdf/plugin-viewport": "2.7.0", "preact": "^10.26.4", "react": ">=16.8.0", "react-dom": ">=16.8.0", @@ -1020,9 +1020,9 @@ } }, "node_modules/@embedpdf/utils": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/@embedpdf/utils/-/utils-2.6.2.tgz", - "integrity": "sha512-+sY221n1rb1Q3JzFe8tZ+TISvjVzOt5kdnZbd6vEWFaUpS577x65T1Uk9ngb3GZt7o9DmC7Of5XdMqZiray2ow==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@embedpdf/utils/-/utils-2.7.0.tgz", + "integrity": "sha512-QtHOChToxkemBbJSwBTbgUqQbUO+obRj5HBaA/8KGv1ESCjtrdwjfAHMCBYdRuyvMVvrQGe1bHuSbKpb2JVS5w==", "license": "MIT", "peerDependencies": { "preact": "^10.26.4", diff --git a/frontend/package.json b/frontend/package.json index 2cec377c7..211704e4a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,29 +8,29 @@ "@atlaskit/pragmatic-drag-and-drop": "^1.7.7", "@cantoo/pdf-lib": "^2.5.3", "@dnd-kit/core": "^6.3.1", - "@embedpdf/core": "^2.6.2", - "@embedpdf/engines": "^2.6.2", - "@embedpdf/models": "^2.6.2", - "@embedpdf/plugin-annotation": "^2.6.2", - "@embedpdf/plugin-attachment": "^2.6.2", - "@embedpdf/plugin-bookmark": "^2.6.2", - "@embedpdf/plugin-document-manager": "^2.6.2", - "@embedpdf/plugin-export": "^2.6.2", - "@embedpdf/plugin-history": "^2.6.2", - "@embedpdf/plugin-interaction-manager": "^2.6.2", - "@embedpdf/plugin-pan": "^2.6.2", - "@embedpdf/plugin-print": "^2.6.2", - "@embedpdf/plugin-redaction": "^2.6.2", - "@embedpdf/plugin-render": "^2.6.2", - "@embedpdf/plugin-rotate": "^2.6.2", - "@embedpdf/plugin-scroll": "^2.6.2", - "@embedpdf/plugin-search": "^2.6.2", - "@embedpdf/plugin-selection": "^2.6.2", - "@embedpdf/plugin-spread": "^2.6.2", - "@embedpdf/plugin-thumbnail": "^2.6.2", - "@embedpdf/plugin-tiling": "^2.6.2", - "@embedpdf/plugin-viewport": "^2.6.2", - "@embedpdf/plugin-zoom": "^2.6.2", + "@embedpdf/core": "^2.7.0", + "@embedpdf/engines": "^2.7.0", + "@embedpdf/models": "^2.7.0", + "@embedpdf/plugin-annotation": "^2.7.0", + "@embedpdf/plugin-attachment": "^2.7.0", + "@embedpdf/plugin-bookmark": "^2.7.0", + "@embedpdf/plugin-document-manager": "^2.7.0", + "@embedpdf/plugin-export": "^2.7.0", + "@embedpdf/plugin-history": "^2.7.0", + "@embedpdf/plugin-interaction-manager": "^2.7.0", + "@embedpdf/plugin-pan": "^2.7.0", + "@embedpdf/plugin-print": "^2.7.0", + "@embedpdf/plugin-redaction": "^2.7.0", + "@embedpdf/plugin-render": "^2.7.0", + "@embedpdf/plugin-rotate": "^2.7.0", + "@embedpdf/plugin-scroll": "^2.7.0", + "@embedpdf/plugin-search": "^2.7.0", + "@embedpdf/plugin-selection": "^2.7.0", + "@embedpdf/plugin-spread": "^2.7.0", + "@embedpdf/plugin-thumbnail": "^2.7.0", + "@embedpdf/plugin-tiling": "^2.7.0", + "@embedpdf/plugin-viewport": "^2.7.0", + "@embedpdf/plugin-zoom": "^2.7.0", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", "@iconify/react": "^6.0.2", diff --git a/frontend/src/core/components/viewer/AnnotationAPIBridge.tsx b/frontend/src/core/components/viewer/AnnotationAPIBridge.tsx index 8ac6b3542..997d1b002 100644 --- a/frontend/src/core/components/viewer/AnnotationAPIBridge.tsx +++ b/frontend/src/core/components/viewer/AnnotationAPIBridge.tsx @@ -7,6 +7,7 @@ import type { AnnotationAPI, AnnotationEvent, AnnotationPatch, + AnnotationRect, } from '@app/components/viewer/viewerTypes'; import { useDocumentReady } from '@app/components/viewer/hooks/useDocumentReady'; @@ -90,6 +91,8 @@ type AnnotationApiSurface = { updateAnnotation?: (pageIndex: number, annotationId: string, patch: AnnotationPatch) => void; onAnnotationEvent?: (listener: (event: AnnotationEvent) => void) => void | (() => void); purgeAnnotation?: (pageIndex: number, annotationId: string) => void; + /** v2.7.0: move annotation without regenerating its appearance stream */ + moveAnnotation?: (pageIndex: number, annotationId: string, newRect: AnnotationRect) => void; }; type ToolDefaultsBuilder = (options?: AnnotationToolOptions) => AnnotationDefaults; @@ -301,7 +304,7 @@ export const AnnotationAPIBridge = forwardRef(function Annotation const configureAnnotationTool = useCallback( (toolId: AnnotationToolId, options?: AnnotationToolOptions) => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; if (!api?.setActiveTool) return; const defaults = buildAnnotationDefaults(toolId, options); @@ -328,13 +331,13 @@ export const AnnotationAPIBridge = forwardRef(function Annotation isReady: () => !!annotationApi && documentReady, setAnnotationStyle: (toolId: AnnotationToolId, options?: AnnotationToolOptions) => { const defaults = buildAnnotationDefaults(toolId, options); - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; if (defaults && api?.setToolDefaults) { api.setToolDefaults(toolId, defaults); } }, getSelectedAnnotation: () => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; if (!api?.getSelectedAnnotation) { return null; } @@ -354,33 +357,38 @@ export const AnnotationAPIBridge = forwardRef(function Annotation } }, deselectAnnotation: () => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; api?.deselectAnnotation?.(); }, updateAnnotation: (pageIndex: number, annotationId: string, patch: AnnotationPatch) => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; api?.updateAnnotation?.(pageIndex, annotationId, patch); }, deactivateTools: () => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; api?.setActiveTool?.(null); }, onAnnotationEvent: (listener: (event: AnnotationEvent) => void) => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; if (api?.onAnnotationEvent) { return api.onAnnotationEvent(listener); } return undefined; }, getActiveTool: () => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; return api?.getActiveTool?.() ?? null; }, purgeAnnotation: (pageIndex: number, annotationId: string) => { - const api = annotationApi as AnnotationApiSurface | undefined; + const api = annotationApi as unknown as AnnotationApiSurface | undefined; api?.purgeAnnotation?.(pageIndex, annotationId); }, + + moveAnnotation: (pageIndex: number, annotationId: string, newRect: AnnotationRect) => { + const api = annotationApi as unknown as AnnotationApiSurface | undefined; + api?.moveAnnotation?.(pageIndex, annotationId, newRect); + }, }), [annotationApi, configureAnnotationTool, buildAnnotationDefaults] ); diff --git a/frontend/src/core/components/viewer/SignatureAPIBridge.tsx b/frontend/src/core/components/viewer/SignatureAPIBridge.tsx index 1c38ceb73..72e834117 100644 --- a/frontend/src/core/components/viewer/SignatureAPIBridge.tsx +++ b/frontend/src/core/components/viewer/SignatureAPIBridge.tsx @@ -2,7 +2,7 @@ import { useImperativeHandle, forwardRef, useEffect, useCallback, useRef, useSta import { useAnnotationCapability } from '@embedpdf/plugin-annotation/react'; import { PdfAnnotationSubtype, uuidV4 } from '@embedpdf/models'; import { useSignature } from '@app/contexts/SignatureContext'; -import type { SignatureAPI } from '@app/components/viewer/viewerTypes'; +import type { SignatureAPI, AnnotationRect } from '@app/components/viewer/viewerTypes'; import type { SignParameters } from '@app/hooks/tools/sign/useSignParameters'; import { useViewer } from '@app/contexts/ViewerContext'; import { useDocumentReady } from '@app/components/viewer/hooks/useDocumentReady'; @@ -394,6 +394,13 @@ export const SignatureAPIBridge = forwardRef(function SignatureAPI return []; } }, + + moveAnnotation: (pageIndex: number, annotationId: string, newRect: AnnotationRect) => { + if (!annotationApi) return; + // v2.7.0: move signature stamp to newRect without regenerating the AP stream, + // preserving the original appearance (image data stays intact). + (annotationApi as any).moveAnnotation?.(pageIndex, annotationId, newRect); + }, }), [annotationApi, signatureConfig, placementPreviewSize, applyStampDefaults]); useEffect(() => { diff --git a/frontend/src/core/components/viewer/viewerTypes.ts b/frontend/src/core/components/viewer/viewerTypes.ts index 6901b66d2..c7cecfec2 100644 --- a/frontend/src/core/components/viewer/viewerTypes.ts +++ b/frontend/src/core/components/viewer/viewerTypes.ts @@ -1,3 +1,8 @@ +export interface AnnotationRect { + origin: { x: number; y: number }; + size: { width: number; height: number }; +} + export interface SignatureAPI { addImageSignature: ( signatureData: string, @@ -14,6 +19,7 @@ export interface SignatureAPI { updateDrawSettings: (color: string, size: number) => void; deactivateTools: () => void; getPageAnnotations: (pageIndex: number) => Promise; + moveAnnotation?: (pageIndex: number, annotationId: string, newRect: AnnotationRect) => void; } export interface AnnotationAPI { @@ -26,6 +32,12 @@ export interface AnnotationAPI { onAnnotationEvent?: (listener: (event: AnnotationEvent) => void) => void | (() => void); getActiveTool?: () => { id: AnnotationToolId } | null; purgeAnnotation?: (pageIndex: number, annotationId: string) => void; + /** + * Move an annotation to a new position without regenerating its appearance stream. + * Uses the embedPDF v2.7.0 moveAnnotation API for efficient repositioning of annotations + * that have existing AP streams (e.g. stamps, signatures). + */ + moveAnnotation?: (pageIndex: number, annotationId: string, newRect: AnnotationRect) => void; } export interface HistoryAPI {