diff --git a/package-lock.json b/package-lock.json index 6459a70b..1ce4a268 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,70 +29,44 @@ } }, "node_modules/@annotorious/annotorious": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@annotorious/annotorious/-/annotorious-3.0.11.tgz", - "integrity": "sha512-5w8ES2hTJU/WVwzlqzxX6McouC9bR/P9zoOxF1SHa+D4Z4E8RbygyE4XfVy7fuDNHUEQAlq3DQdvW2S4TyZ4Qw==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@annotorious/annotorious/-/annotorious-3.0.12.tgz", + "integrity": "sha512-Wkb7hqETWaWGWNwJ2muQUNrv5ePzHyZOGty5Xtsjrc47tDGl4ZwH/9jt1666bB5ttqANq/eYdy8Jch8UcUIJmg==", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/core": "3.0.11", + "@annotorious/core": "3.0.12", "rbush": "^4.0.1", - "uuid": "^10.0.0" + "uuid": "^11.0.3" }, "funding": { "url": "https://steadyhq.com/rainer-simon" } }, - "node_modules/@annotorious/annotorious/node_modules/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/@annotorious/core": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@annotorious/core/-/core-3.0.11.tgz", - "integrity": "sha512-PZuQyyux1WgJEjZQwDvGwxlWeZEycUj7zJuJL5v02p+AVNeflUGIKGHBhphCdJhz7LpawWfCbrhlhYO8jit8Hw==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@annotorious/core/-/core-3.0.12.tgz", + "integrity": "sha512-QKLHqeKa5YieuWog/6fsyrA5851zncQGE8NpK1s90+Ckr/eZ/b9TsK+vEssA7vBH0AcEFrsE3HsEZ2S4jlJ6LA==", "license": "BSD-3-Clause", "dependencies": { "dequal": "^2.0.3", - "nanoevents": "^9.0.0", - "nanoid": "^5.0.7", - "uuid": "^10.0.0" + "nanoevents": "^9.1.0", + "nanoid": "^5.0.8", + "uuid": "^11.0.3" }, "funding": { "url": "https://steadyhq.com/rainer-simon" } }, - "node_modules/@annotorious/core/node_modules/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/@annotorious/openseadragon": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@annotorious/openseadragon/-/openseadragon-3.0.11.tgz", - "integrity": "sha512-AkSBy0r6HNxS6NXyfP94RyXOhb4yatjFph49ZPcBMyO7zKXPEJWT/t4HyFbg5QpJ8/xTY3wFaXThRcU0yYxB8A==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@annotorious/openseadragon/-/openseadragon-3.0.12.tgz", + "integrity": "sha512-vXFbvgTNfZHKK/jUyOnooX5k52zHpiYk5ehIEEWCy+hY0/3HOLR1R3+mE9PnVh2DwsYXMlR2qJ55qCV5loVv4Q==", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/annotorious": "3.0.11", - "@annotorious/core": "3.0.11", + "@annotorious/annotorious": "3.0.12", + "@annotorious/core": "3.0.12", "pixi.js": "^7.4.2", - "uuid": "^10.0.0" + "uuid": "^11.0.3" }, "funding": { "url": "https://steadyhq.com/rainer-simon" @@ -101,29 +75,17 @@ "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0" } }, - "node_modules/@annotorious/openseadragon/node_modules/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/@annotorious/react": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@annotorious/react/-/react-3.0.11.tgz", - "integrity": "sha512-auhoOgZhRKnSiXadw+jrZpddJujv6KxPNsG/D5L2pEk6EznBRuuX/e5wlCbcK609Q1guUMskx1GEl1AuR5kl5g==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/@annotorious/react/-/react-3.0.12.tgz", + "integrity": "sha512-HLk8NXOMCPadQ1kBqyD6h87VA9IlBv5LAGZn3yfONXnKfrPuBuZE/DWeOgi0E725HmAZWtHvJZarV5WQHgMTow==", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/annotorious": "3.0.11", - "@annotorious/core": "3.0.11", - "@annotorious/openseadragon": "3.0.11", - "@floating-ui/react": "^0.26.24" + "@annotorious/annotorious": "3.0.12", + "@annotorious/core": "3.0.12", + "@annotorious/openseadragon": "3.0.12", + "@floating-ui/react": "^0.26.27", + "zustand": "^5.0.1" }, "funding": { "url": "https://steadyhq.com/rainer-simon" @@ -1432,9 +1394,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.4.tgz", - "integrity": "sha512-jfUJrFct/hTA0XDM5p/htWKoNNTbDLY0KRwEt6pyOA6k2fmk0WVwl65PdUdJZgzGEHWx+49LilkcSaumQRyNQw==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.25.0.tgz", + "integrity": "sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA==", "cpu": [ "arm" ], @@ -1446,9 +1408,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.4.tgz", - "integrity": "sha512-j4nrEO6nHU1nZUuCfRKoCcvh7PIywQPUCBa2UsootTHvTHIoIu2BzueInGJhhvQO/2FTRdNYpf63xsgEqH9IhA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.25.0.tgz", + "integrity": "sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg==", "cpu": [ "arm64" ], @@ -1460,9 +1422,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.4.tgz", - "integrity": "sha512-GmU/QgGtBTeraKyldC7cDVVvAJEOr3dFLKneez/n7BvX57UdhOqDsVwzU7UOnYA7AAOt+Xb26lk79PldDHgMIQ==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.25.0.tgz", + "integrity": "sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg==", "cpu": [ "arm64" ], @@ -1474,9 +1436,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.4.tgz", - "integrity": "sha512-N6oDBiZCBKlwYcsEPXGDE4g9RoxZLK6vT98M8111cW7VsVJFpNEqvJeIPfsCzbf0XEakPslh72X0gnlMi4Ddgg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.25.0.tgz", + "integrity": "sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA==", "cpu": [ "x64" ], @@ -1488,9 +1450,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.24.4.tgz", - "integrity": "sha512-py5oNShCCjCyjWXCZNrRGRpjWsF0ic8f4ieBNra5buQz0O/U6mMXCpC1LvrHuhJsNPgRt36tSYMidGzZiJF6mw==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.25.0.tgz", + "integrity": "sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g==", "cpu": [ "arm64" ], @@ -1502,9 +1464,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.24.4.tgz", - "integrity": "sha512-L7VVVW9FCnTTp4i7KrmHeDsDvjB4++KOBENYtNYAiYl96jeBThFfhP6HVxL74v4SiZEVDH/1ILscR5U9S4ms4g==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.25.0.tgz", + "integrity": "sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw==", "cpu": [ "x64" ], @@ -1516,9 +1478,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.4.tgz", - "integrity": "sha512-10ICosOwYChROdQoQo589N5idQIisxjaFE/PAnX2i0Zr84mY0k9zul1ArH0rnJ/fpgiqfu13TFZR5A5YJLOYZA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.25.0.tgz", + "integrity": "sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA==", "cpu": [ "arm" ], @@ -1530,9 +1492,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.4.tgz", - "integrity": "sha512-ySAfWs69LYC7QhRDZNKqNhz2UKN8LDfbKSMAEtoEI0jitwfAG2iZwVqGACJT+kfYvvz3/JgsLlcBP+WWoKCLcw==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.25.0.tgz", + "integrity": "sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ==", "cpu": [ "arm" ], @@ -1544,9 +1506,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.4.tgz", - "integrity": "sha512-uHYJ0HNOI6pGEeZ/5mgm5arNVTI0nLlmrbdph+pGXpC9tFHFDQmDMOEqkmUObRfosJqpU8RliYoGz06qSdtcjg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.25.0.tgz", + "integrity": "sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A==", "cpu": [ "arm64" ], @@ -1558,9 +1520,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.4.tgz", - "integrity": "sha512-38yiWLemQf7aLHDgTg85fh3hW9stJ0Muk7+s6tIkSUOMmi4Xbv5pH/5Bofnsb6spIwD5FJiR+jg71f0CH5OzoA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.25.0.tgz", + "integrity": "sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw==", "cpu": [ "arm64" ], @@ -1572,9 +1534,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.4.tgz", - "integrity": "sha512-q73XUPnkwt9ZNF2xRS4fvneSuaHw2BXuV5rI4cw0fWYVIWIBeDZX7c7FWhFQPNTnE24172K30I+dViWRVD9TwA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.25.0.tgz", + "integrity": "sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA==", "cpu": [ "ppc64" ], @@ -1586,9 +1548,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.4.tgz", - "integrity": "sha512-Aie/TbmQi6UXokJqDZdmTJuZBCU3QBDA8oTKRGtd4ABi/nHgXICulfg1KI6n9/koDsiDbvHAiQO3YAUNa/7BCw==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.25.0.tgz", + "integrity": "sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA==", "cpu": [ "riscv64" ], @@ -1600,9 +1562,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.4.tgz", - "integrity": "sha512-P8MPErVO/y8ohWSP9JY7lLQ8+YMHfTI4bAdtCi3pC2hTeqFJco2jYspzOzTUB8hwUWIIu1xwOrJE11nP+0JFAQ==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.25.0.tgz", + "integrity": "sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ==", "cpu": [ "s390x" ], @@ -1614,9 +1576,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.4.tgz", - "integrity": "sha512-K03TljaaoPK5FOyNMZAAEmhlyO49LaE4qCsr0lYHUKyb6QacTNF9pnfPpXnFlFD3TXuFbFbz7tJ51FujUXkXYA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.25.0.tgz", + "integrity": "sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig==", "cpu": [ "x64" ], @@ -1628,9 +1590,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.4.tgz", - "integrity": "sha512-VJYl4xSl/wqG2D5xTYncVWW+26ICV4wubwN9Gs5NrqhJtayikwCXzPL8GDsLnaLU3WwhQ8W02IinYSFJfyo34Q==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.25.0.tgz", + "integrity": "sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ==", "cpu": [ "x64" ], @@ -1642,9 +1604,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.4.tgz", - "integrity": "sha512-ku2GvtPwQfCqoPFIJCqZ8o7bJcj+Y54cZSr43hHca6jLwAiCbZdBUOrqE6y29QFajNAzzpIOwsckaTFmN6/8TA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.25.0.tgz", + "integrity": "sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww==", "cpu": [ "arm64" ], @@ -1656,9 +1618,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.4.tgz", - "integrity": "sha512-V3nCe+eTt/W6UYNr/wGvO1fLpHUrnlirlypZfKCT1fG6hWfqhPgQV/K/mRBXBpxc0eKLIF18pIOFVPh0mqHjlg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.25.0.tgz", + "integrity": "sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg==", "cpu": [ "ia32" ], @@ -1670,9 +1632,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.4.tgz", - "integrity": "sha512-LTw1Dfd0mBIEqUVCxbvTE/LLo+9ZxVC9k99v1v4ahg9Aak6FpqOfNu5kRkeTAn0wphoC4JU7No1/rL+bBCEwhg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.25.0.tgz", + "integrity": "sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg==", "cpu": [ "x64" ], @@ -1901,7 +1863,7 @@ "version": "15.7.13", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", "integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@types/rbush": { @@ -1915,7 +1877,7 @@ "version": "18.3.12", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.12.tgz", "integrity": "sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -2389,9 +2351,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001678", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001678.tgz", - "integrity": "sha512-RR+4U/05gNtps58PEBDZcPWTgEO2MBeoPZ96aQcjmfkBWRIDfN451fW2qyDA9/+HohLLIL5GqiMwA+IB1pWarw==", + "version": "1.0.30001680", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz", + "integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==", "dev": true, "funding": [ { @@ -2513,7 +2475,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/data-urls": { @@ -3295,9 +3257,9 @@ "license": "MIT" }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", + "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -3435,9 +3397,9 @@ } }, "node_modules/postcss": { - "version": "8.4.47", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", - "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "version": "8.4.48", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.48.tgz", + "integrity": "sha512-GCRK8F6+Dl7xYniR5a4FYbpBzU8XnZVeowqsQFYdcXuSbChgiks7qybSkbvnaeqv0G0B+dd9/jJgH8kkLDQeEA==", "dev": true, "funding": [ { @@ -3456,7 +3418,7 @@ "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.1.0", + "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, "engines": { @@ -3582,9 +3544,9 @@ } }, "node_modules/rollup": { - "version": "4.24.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.4.tgz", - "integrity": "sha512-vGorVWIsWfX3xbcyAS+I047kFKapHYivmkaT63Smj77XwvLSJos6M1xGqZnBPFQFBRZDOcG1QnYEIxAvTr/HjA==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.25.0.tgz", + "integrity": "sha512-uVbClXmR6wvx5R1M3Od4utyLUxrmOcEm3pAtMphn73Apq19PDtHpgZoEvqH2YnnaNUuvKmg2DgRd2Sqv+odyqg==", "dev": true, "license": "MIT", "dependencies": { @@ -3598,24 +3560,24 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.24.4", - "@rollup/rollup-android-arm64": "4.24.4", - "@rollup/rollup-darwin-arm64": "4.24.4", - "@rollup/rollup-darwin-x64": "4.24.4", - "@rollup/rollup-freebsd-arm64": "4.24.4", - "@rollup/rollup-freebsd-x64": "4.24.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.24.4", - "@rollup/rollup-linux-arm-musleabihf": "4.24.4", - "@rollup/rollup-linux-arm64-gnu": "4.24.4", - "@rollup/rollup-linux-arm64-musl": "4.24.4", - "@rollup/rollup-linux-powerpc64le-gnu": "4.24.4", - "@rollup/rollup-linux-riscv64-gnu": "4.24.4", - "@rollup/rollup-linux-s390x-gnu": "4.24.4", - "@rollup/rollup-linux-x64-gnu": "4.24.4", - "@rollup/rollup-linux-x64-musl": "4.24.4", - "@rollup/rollup-win32-arm64-msvc": "4.24.4", - "@rollup/rollup-win32-ia32-msvc": "4.24.4", - "@rollup/rollup-win32-x64-msvc": "4.24.4", + "@rollup/rollup-android-arm-eabi": "4.25.0", + "@rollup/rollup-android-arm64": "4.25.0", + "@rollup/rollup-darwin-arm64": "4.25.0", + "@rollup/rollup-darwin-x64": "4.25.0", + "@rollup/rollup-freebsd-arm64": "4.25.0", + "@rollup/rollup-freebsd-x64": "4.25.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.25.0", + "@rollup/rollup-linux-arm-musleabihf": "4.25.0", + "@rollup/rollup-linux-arm64-gnu": "4.25.0", + "@rollup/rollup-linux-arm64-musl": "4.25.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.25.0", + "@rollup/rollup-linux-riscv64-gnu": "4.25.0", + "@rollup/rollup-linux-s390x-gnu": "4.25.0", + "@rollup/rollup-linux-x64-gnu": "4.25.0", + "@rollup/rollup-linux-x64-musl": "4.25.0", + "@rollup/rollup-win32-arm64-msvc": "4.25.0", + "@rollup/rollup-win32-ia32-msvc": "4.25.0", + "@rollup/rollup-win32-x64-msvc": "4.25.0", "fsevents": "~2.3.2" } }, @@ -3742,9 +3704,9 @@ "license": "MIT" }, "node_modules/std-env": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", - "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", + "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", "dev": true, "license": "MIT" }, @@ -3858,22 +3820,22 @@ } }, "node_modules/tldts": { - "version": "6.1.59", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.59.tgz", - "integrity": "sha512-472ilPxsRuqBBpn+KuRBHJvZhk6tTo4yTVsmODrLBNLwRYJPkDfMEHivgNwp5iEl+cbrZzzRtLKRxZs7+QKkRg==", + "version": "6.1.60", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.60.tgz", + "integrity": "sha512-TYVHm7G9NCnhgqOsFalbX6MG1Po5F4efF+tLfoeiOGQq48Oqgwcgz8upY2R1BHWa4aDrj28RYx0dkYJ63qCFMg==", "dev": true, "license": "MIT", "dependencies": { - "tldts-core": "^6.1.59" + "tldts-core": "^6.1.60" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { - "version": "6.1.59", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.59.tgz", - "integrity": "sha512-EiYgNf275AQyVORl8HQYYe7rTVnmLb4hkWK7wAk/12Ksy5EiHpmUmTICa4GojookBPC8qkLMBKKwCmzNA47ZPQ==", + "version": "6.1.60", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.60.tgz", + "integrity": "sha512-XHjoxak8SFQnHnmYHb3PcnW5TZ+9ErLZemZei3azuIRhQLw4IExsVbL3VZJdHcLeNaXq6NqawgpDPpjBOg4B5g==", "dev": true, "license": "MIT" }, @@ -4037,9 +3999,9 @@ } }, "node_modules/uuid": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.2.tgz", - "integrity": "sha512-14FfcOJmqdjbBPdDjFQyk/SdT4NySW4eM0zcG+HqbHP5jzuH56xO3J1DGhgs/cEMCfwYi3HQI1gnTO62iaG+tQ==", + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.3.tgz", + "integrity": "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" @@ -4050,9 +4012,9 @@ } }, "node_modules/vite": { - "version": "5.4.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.10.tgz", - "integrity": "sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==", + "version": "5.4.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", + "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", "dev": true, "license": "MIT", "dependencies": { @@ -4162,9 +4124,9 @@ } }, "node_modules/vite-tsconfig-paths": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.0.tgz", - "integrity": "sha512-Y1PLGHCJfAq1Zf4YIGEsmuU/NCX1epoZx9zwSr32Gjn3aalwQHRKr5aUmbo6r0JHeHkqmWpmDg7WOynhYXw1og==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.2.tgz", + "integrity": "sha512-gEIbKfJzSEv0yR3XS2QEocKetONoWkbROj6hGx0FHM18qKUojhvcokQsxQx5nMkelZq2n37zbSGCJn+FSODSjA==", "dev": true, "license": "MIT", "dependencies": { @@ -4377,6 +4339,35 @@ "dev": true, "license": "ISC" }, + "node_modules/zustand": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.1.tgz", + "integrity": "sha512-pRET7Lao2z+n5R/HduXMio35TncTlSW68WsYBq2Lg1ASspsNGjpwLAsij3RpouyV6+kHMwwwzP0bZPD70/Jx/w==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } + }, "packages/extension-tei": { "name": "@recogito/text-annotator-tei", "version": "3.0.0-rc.51", @@ -4384,11 +4375,11 @@ "devDependencies": { "CETEIcean": "^1.9.3", "typescript": "5.6.3", - "vite": "^5.4.10", + "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0" }, "peerDependencies": { - "@annotorious/core": "^3.0.11", + "@annotorious/core": "^3.0.12", "@recogito/text-annotator": "3.0.0-rc.51" } }, @@ -4397,19 +4388,19 @@ "version": "3.0.0-rc.51", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/core": "^3.0.11", + "@annotorious/core": "^3.0.12", "colord": "^2.9.3", "dequal": "^2.0.3", "hotkeys-js": "^3.13.7", "rbush": "^4.0.1", - "uuid": "^11.0.2" + "uuid": "^11.0.3" }, "devDependencies": { "@types/jsdom": "^21.1.7", "@types/rbush": "^4.0.0", "jsdom": "^25.0.1", "typescript": "5.6.3", - "vite": "^5.4.10", + "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0", "vitest": "^2.1.4" } @@ -4419,8 +4410,8 @@ "version": "3.0.0-rc.51", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/core": "^3.0.11", - "@annotorious/react": "^3.0.11", + "@annotorious/core": "^3.0.12", + "@annotorious/react": "^3.0.12", "@floating-ui/react": "^0.26.27", "@recogito/text-annotator": "3.0.0-rc.51", "@recogito/text-annotator-tei": "3.0.0-rc.51", @@ -4432,9 +4423,9 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "5.6.3", - "vite": "^5.4.10", + "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0", - "vite-tsconfig-paths": "^5.1.0" + "vite-tsconfig-paths": "^5.1.2" }, "peerDependencies": { "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0", diff --git a/packages/extension-tei/package.json b/packages/extension-tei/package.json index 984f8531..7d909828 100644 --- a/packages/extension-tei/package.json +++ b/packages/extension-tei/package.json @@ -28,11 +28,11 @@ "devDependencies": { "CETEIcean": "^1.9.3", "typescript": "5.6.3", - "vite": "^5.4.10", + "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0" }, "peerDependencies": { - "@annotorious/core": "^3.0.11", + "@annotorious/core": "^3.0.12", "@recogito/text-annotator": "3.0.0-rc.51" } } \ No newline at end of file diff --git a/packages/text-annotator-react/package.json b/packages/text-annotator-react/package.json index ec0e4042..21300e9f 100644 --- a/packages/text-annotator-react/package.json +++ b/packages/text-annotator-react/package.json @@ -29,9 +29,9 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "5.6.3", - "vite": "^5.4.10", + "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0", - "vite-tsconfig-paths": "^5.1.0" + "vite-tsconfig-paths": "^5.1.2" }, "peerDependencies": { "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0", @@ -44,8 +44,8 @@ } }, "dependencies": { - "@annotorious/core": "^3.0.11", - "@annotorious/react": "^3.0.11", + "@annotorious/core": "^3.0.12", + "@annotorious/react": "^3.0.12", "@floating-ui/react": "^0.26.27", "@recogito/text-annotator": "3.0.0-rc.51", "@recogito/text-annotator-tei": "3.0.0-rc.51", diff --git a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.css b/packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.css similarity index 100% rename from packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.css rename to packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.css diff --git a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx b/packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx similarity index 91% rename from packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx rename to packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx index 12d4adc4..7f62e990 100644 --- a/packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx +++ b/packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx @@ -19,7 +19,7 @@ import { useRole } from '@floating-ui/react'; -import './TextAnnotatorPopup.css'; +import './TextAnnotationPopup.css'; interface TextAnnotationPopupProps { @@ -39,11 +39,11 @@ export interface TextAnnotationPopupContentProps { editable?: boolean; - event?: PointerEvent; + event?: PointerEvent | KeyboardEvent; } -export const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => { +export const TextAnnotationPopup = (props: TextAnnotationPopupProps) => { const r = useAnnotator(); @@ -177,3 +177,14 @@ const getStopEventsPropagationProps = () => onMouseDown: (event: React.MouseEvent) => event.stopPropagation(), onMouseUp: (event: React.MouseEvent) => event.stopPropagation() }); + +/** For backwards compatibility **/ +/** @deprecated Use TextAnnotationPopup instead */ +export const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => { + + useEffect(() => { + console.warn('TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.'); + }, []); + + return ; +}; diff --git a/packages/text-annotator-react/src/TextAnnotationPopup/index.ts b/packages/text-annotator-react/src/TextAnnotationPopup/index.ts new file mode 100644 index 00000000..0f8139ae --- /dev/null +++ b/packages/text-annotator-react/src/TextAnnotationPopup/index.ts @@ -0,0 +1 @@ +export * from './TextAnnotationPopup'; diff --git a/packages/text-annotator-react/src/TextAnnotatorPopup/isMobile.ts b/packages/text-annotator-react/src/TextAnnotationPopup/isMobile.ts similarity index 100% rename from packages/text-annotator-react/src/TextAnnotatorPopup/isMobile.ts rename to packages/text-annotator-react/src/TextAnnotationPopup/isMobile.ts diff --git a/packages/text-annotator-react/src/TextAnnotatorPopup/index.ts b/packages/text-annotator-react/src/TextAnnotatorPopup/index.ts deleted file mode 100644 index 259f9b65..00000000 --- a/packages/text-annotator-react/src/TextAnnotatorPopup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './TextAnnotatorPopup'; diff --git a/packages/text-annotator/package.json b/packages/text-annotator/package.json index 1b019b2b..390defb9 100644 --- a/packages/text-annotator/package.json +++ b/packages/text-annotator/package.json @@ -30,16 +30,16 @@ "@types/rbush": "^4.0.0", "jsdom": "^25.0.1", "typescript": "5.6.3", - "vite": "^5.4.10", + "vite": "^5.4.11", "vite-plugin-dts": "^4.3.0", "vitest": "^2.1.4" }, "dependencies": { - "@annotorious/core": "^3.0.11", + "@annotorious/core": "^3.0.12", "colord": "^2.9.3", "dequal": "^2.0.3", "hotkeys-js": "^3.13.7", "rbush": "^4.0.1", - "uuid": "^11.0.2" + "uuid": "^11.0.3" } } \ No newline at end of file diff --git a/packages/text-annotator/src/SelectionHandler.ts b/packages/text-annotator/src/SelectionHandler.ts index 510932bd..626a74a8 100644 --- a/packages/text-annotator/src/SelectionHandler.ts +++ b/packages/text-annotator/src/SelectionHandler.ts @@ -15,6 +15,7 @@ import { trimRangeToContainer, isNotAnnotatable } from './utils'; +import type { TextAnnotatorOptions } from './TextAnnotatorOptions'; const CLICK_TIMEOUT = 300; @@ -30,12 +31,13 @@ const SELECTION_KEYS = [ export const SelectionHandler = ( container: HTMLElement, state: TextAnnotatorState, - annotatingEnabled: boolean, - offsetReferenceSelector?: string + options: TextAnnotatorOptions ) => { let currentUser: User | undefined; + const { annotatingEnabled, offsetReferenceSelector, selectionMode } = options; + const setUser = (user?: User) => currentUser = user; let currentFilter: Filter | undefined; @@ -179,14 +181,20 @@ export const SelectionHandler = ( const hovered = evt.target instanceof Node && container.contains(evt.target) && - store.getAt(evt.clientX - x, evt.clientY - y, currentFilter); + store.getAt(evt.clientX - x, evt.clientY - y, selectionMode === 'all', currentFilter); if (hovered) { const { selected } = selection; - if (selected.length !== 1 || selected[0].id !== hovered.id) { - selection.userSelect(hovered.id, evt); - } + const currentIds = new Set(selected.map(s => s.id)); + const nextIds = Array.isArray(hovered) ? hovered.map(a => a.id) : [hovered.id]; + + const hasChanged = + currentIds.size !== nextIds.length || + !nextIds.every(id => currentIds.has(id)); + + if (hasChanged) + selection.userSelect(nextIds, evt); } else { selection.clear(); } diff --git a/packages/text-annotator/src/TextAnnotator.ts b/packages/text-annotator/src/TextAnnotator.ts index a6995347..81a604a5 100644 --- a/packages/text-annotator/src/TextAnnotator.ts +++ b/packages/text-annotator/src/TextAnnotator.ts @@ -76,7 +76,7 @@ export const createTextAnnotator = ( if (opts.style) highlightRenderer.setStyle(opts.style); - const selectionHandler = SelectionHandler(container, state, opts.annotatingEnabled, opts.offsetReferenceSelector); + const selectionHandler = SelectionHandler(container, state, opts); selectionHandler.setUser(currentUser); /*************************/ diff --git a/packages/text-annotator/src/TextAnnotatorOptions.ts b/packages/text-annotator/src/TextAnnotatorOptions.ts index d31eace6..bd9ced93 100644 --- a/packages/text-annotator/src/TextAnnotatorOptions.ts +++ b/packages/text-annotator/src/TextAnnotatorOptions.ts @@ -17,6 +17,8 @@ export interface TextAnnotatorOptions { const {x, y} = container.getBoundingClientRect(); - const hit = store.getAt(event.clientX - x, event.clientY - y, currentFilter); + const hit = store.getAt(event.clientX - x, event.clientY - y, false, currentFilter); if (hit) { if (hover.current !== hit.id) { container.classList.add('hovered'); diff --git a/packages/text-annotator/src/state/TextAnnotationStore.ts b/packages/text-annotator/src/state/TextAnnotationStore.ts index 7b81e2b1..8e277ecc 100644 --- a/packages/text-annotator/src/state/TextAnnotationStore.ts +++ b/packages/text-annotator/src/state/TextAnnotationStore.ts @@ -15,7 +15,9 @@ export interface TextAnnotationStore getAnnotationRects(id: string): DOMRect[]; - getAt(x: number, y: number, filter?: Filter): T | undefined; + getAt(x: number, y: number, all: true, filter?: Filter): T[] | undefined; + getAt(x: number, y: number, all: false, filter?: Filter): T | undefined; + getAt(x: number, y: number, all?: boolean, filter?: Filter): T | T[] | undefined; getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects[]; diff --git a/packages/text-annotator/src/state/TextAnnotatorState.ts b/packages/text-annotator/src/state/TextAnnotatorState.ts index 7942f202..f5662303 100644 --- a/packages/text-annotator/src/state/TextAnnotatorState.ts +++ b/packages/text-annotator/src/state/TextAnnotatorState.ts @@ -1,4 +1,4 @@ -import type { Filter, Store, ViewportState, UserSelectActionExpression, Annotation } from '@annotorious/core'; +import type { Filter, Store, ViewportState, UserSelectActionExpression } from '@annotorious/core'; import { createHoverState, createSelectionState, @@ -99,10 +99,19 @@ export const createTextAnnotatorState = { - const annotations = tree.getAt(x, y, Boolean(filter)).map(id => store.getAnnotation(id)); + function getAt(x: number, y: number, all: true, filter?: Filter): I[] | undefined; + function getAt(x: number, y: number, all: false, filter?: Filter): I | undefined; + function getAt(x: number, y: number, all?: boolean, filter?: Filter): I | I[] | undefined { + const getAll = all || Boolean(filter); + + const annotations = tree.getAt(x, y, getAll).map(id => store.getAnnotation(id)); + const filtered = filter ? annotations.filter(filter) : annotations; - return filtered.length > 0 ? filtered[0] : undefined; + + if (filtered.length === 0) + return undefined; + + return all ? filtered : filtered[0]; } const getAnnotationBounds = (id: string, x?: number, y?: number, buffer = 5): DOMRect => { diff --git a/packages/text-annotator/test/index.html b/packages/text-annotator/test/index.html index 04aea80b..4f17b699 100644 --- a/packages/text-annotator/test/index.html +++ b/packages/text-annotator/test/index.html @@ -304,6 +304,7 @@

Not annotatable block!

adapter: W3CTextFormat('https://www.gutenberg.org', contentContainer), renderer: 'SPANS', // annotatingEnabled: false, + // selectionMode: 'all', style });