From aa3a0a0b6259dcc9f0f8e7abaa2a688d24bc293c Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Tue, 3 Sep 2024 12:33:14 +0200 Subject: [PATCH 1/8] Cleanup --- packages/text-annotator/src/TextAnnotator.ts | 2 +- packages/text-annotator/src/presence/PresencePainter.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/text-annotator/src/TextAnnotator.ts b/packages/text-annotator/src/TextAnnotator.ts index 5e86b82d..510c94d0 100644 --- a/packages/text-annotator/src/TextAnnotator.ts +++ b/packages/text-annotator/src/TextAnnotator.ts @@ -98,7 +98,7 @@ export const createTextAnnotator = ( const setPresenceProvider = (provider: PresenceProvider) => { if (provider) { - highlightRenderer.setPainter(createPresencePainter(container, provider, opts.presence)); + highlightRenderer.setPainter(createPresencePainter(provider, opts.presence)); provider.on('selectionChange', () => highlightRenderer.redraw()); } } diff --git a/packages/text-annotator/src/presence/PresencePainter.ts b/packages/text-annotator/src/presence/PresencePainter.ts index 541d189d..c192b4db 100644 --- a/packages/text-annotator/src/presence/PresencePainter.ts +++ b/packages/text-annotator/src/presence/PresencePainter.ts @@ -22,7 +22,6 @@ const createCanvas = () => { } export const createPresencePainter = ( - container: HTMLElement, provider: PresenceProvider, opts: PresencePainterOptions = {} ): HighlightPainter => { From 6fe556ca560a6e91ec252a4087a1d9e07ea3a1f0 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Tue, 3 Sep 2024 12:34:15 +0200 Subject: [PATCH 2/8] Re-exported PresencePainter --- packages/text-annotator/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/text-annotator/src/index.ts b/packages/text-annotator/src/index.ts index 8cfb3b69..ef9215b9 100644 --- a/packages/text-annotator/src/index.ts +++ b/packages/text-annotator/src/index.ts @@ -2,7 +2,7 @@ export * from './highlight'; export * from './model'; export * from './state'; export * from './utils'; -export * from './presence/PresencePainterOptions'; +export * from './presence'; export * from './SelectionHandler'; export * from './TextAnnotator'; export * from './TextAnnotatorOptions'; From 682af04e5df8d2da5013a14dbed2d988fc99ece0 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Tue, 3 Sep 2024 13:23:39 +0200 Subject: [PATCH 3/8] Re-export --- packages/text-annotator/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/text-annotator/src/index.ts b/packages/text-annotator/src/index.ts index ef9215b9..b28a4f41 100644 --- a/packages/text-annotator/src/index.ts +++ b/packages/text-annotator/src/index.ts @@ -1,3 +1,4 @@ +export * from './api'; export * from './highlight'; export * from './model'; export * from './state'; From 4abc32dc469f19e101e69d13c038690de5584f37 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Wed, 4 Sep 2024 08:06:44 +0200 Subject: [PATCH 4/8] TS tweaks to TextAnnotatorState --- package-lock.json | 6 ++--- packages/text-annotator/src/TextAnnotator.ts | 2 +- .../src/state/TextAnnotationStore.ts | 4 ++-- .../src/state/TextAnnotatorState.ts | 22 +++++++++---------- .../text-annotator/src/state/spatialTree.ts | 4 ++-- .../src/utils/reviveAnnotation.ts | 2 +- .../src/utils/reviveSelector.ts | 2 +- .../text-annotator/src/utils/reviveTarget.ts | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32b09b26..73647864 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3557,9 +3557,9 @@ } }, "node_modules/openseadragon": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/openseadragon/-/openseadragon-5.0.0.tgz", - "integrity": "sha512-S9aabSjmJg7Jfow1UItR5aXiKQLtkDWyRR5fxLeqT4vSYMvfscXUDfVS9snUN3JuIrHaSPJAlR4H2DYSn5DWRg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/openseadragon/-/openseadragon-4.1.1.tgz", + "integrity": "sha512-owU9gsasAcobLN+LM8lN58Xc2VDSDotY9mkrwS/NB6g9KX/PcusV4RZvhHng2RF/Q0pMziwldf62glwXoGnuzg==", "license": "BSD-3-Clause", "peer": true, "funding": { diff --git a/packages/text-annotator/src/TextAnnotator.ts b/packages/text-annotator/src/TextAnnotator.ts index 510c94d0..1e234e35 100644 --- a/packages/text-annotator/src/TextAnnotator.ts +++ b/packages/text-annotator/src/TextAnnotator.ts @@ -22,7 +22,7 @@ export interface TextAnnotator; } diff --git a/packages/text-annotator/src/state/TextAnnotationStore.ts b/packages/text-annotator/src/state/TextAnnotationStore.ts index e64fb0f2..7b81e2b1 100644 --- a/packages/text-annotator/src/state/TextAnnotationStore.ts +++ b/packages/text-annotator/src/state/TextAnnotationStore.ts @@ -15,7 +15,7 @@ export interface TextAnnotationStore getAnnotationRects(id: string): DOMRect[]; - getAt(x: number, y: number, filter?: Filter): TextAnnotation | undefined; + getAt(x: number, y: number, filter?: Filter): T | undefined; getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects[]; @@ -23,7 +23,7 @@ export interface TextAnnotationStore } -export interface AnnotationRects { +export interface AnnotationRects { annotation: T; diff --git a/packages/text-annotator/src/state/TextAnnotatorState.ts b/packages/text-annotator/src/state/TextAnnotatorState.ts index e2a889a2..8accd298 100644 --- a/packages/text-annotator/src/state/TextAnnotatorState.ts +++ b/packages/text-annotator/src/state/TextAnnotatorState.ts @@ -18,20 +18,20 @@ export interface TextAnnotatorState e store: TextAnnotationStore; - selection: SelectionState; + selection: SelectionState; - hover: HoverState; + hover: HoverState; viewport: ViewportState; } -export const createTextAnnotatorState = ( +export const createTextAnnotatorState = ( container: HTMLElement, defaultUserSelectAction?: UserSelectActionExpression -): TextAnnotatorState => { +): TextAnnotatorState => { - const store: Store = createStore(); + const store: Store = createStore(); const tree = createSpatialTree(store, container); @@ -44,7 +44,7 @@ export const createTextAnnotatorState = ( const viewport = createViewportState(); // Wrap store interface to intercept annotations and revive DOM ranges, if needed - const addAnnotation = (annotation: TextAnnotation, origin = Origin.LOCAL): boolean => { + const addAnnotation = (annotation: T, origin = Origin.LOCAL): boolean => { const revived = reviveAnnotation(annotation, container); const isValid = isRevived(revived.target.selector); @@ -55,10 +55,10 @@ export const createTextAnnotatorState = ( } const bulkAddAnnotation = ( - annotations: TextAnnotation[], + annotations: T[], replace = true, origin = Origin.LOCAL - ): TextAnnotation[] => { + ): T[] => { const revived = annotations.map(a => reviveAnnotation(a, container)); // Initial page load might take some time. Retry for more robustness. @@ -79,9 +79,9 @@ export const createTextAnnotatorState = ( } const bulkUpsertAnnotations = ( - annotations: TextAnnotation[], + annotations: T[], origin = Origin.LOCAL - ): TextAnnotation[] => { + ): T[] => { const revived = annotations.map(a => reviveAnnotation(a, container)); // Initial page load might take some time. Retry for more robustness. @@ -109,7 +109,7 @@ export const createTextAnnotatorState = ( store.bulkUpdateTargets(revived, origin); } - const getAt = (x: number, y: number, filter?: Filter): TextAnnotation | undefined => { + const getAt = (x: number, y: number, filter?: Filter): T | undefined => { const annotations = tree.getAt(x, y, Boolean(filter)).map(id => store.getAnnotation(id)); const filtered = filter ? annotations.filter(filter) : annotations; return filtered.length > 0 ? filtered[0] : undefined; diff --git a/packages/text-annotator/src/state/spatialTree.ts b/packages/text-annotator/src/state/spatialTree.ts index 4becefe4..25e7582d 100644 --- a/packages/text-annotator/src/state/spatialTree.ts +++ b/packages/text-annotator/src/state/spatialTree.ts @@ -25,7 +25,7 @@ interface IndexedHighlightRect { } -export const createSpatialTree = (store: Store, container: HTMLElement) => { +export const createSpatialTree = (store: Store, container: HTMLElement) => { const tree = new RBush(); @@ -159,7 +159,7 @@ export const createSpatialTree = (store: Store, container: HTMLE minY: number, maxX: number, maxY: number, - ): AnnotationRects[] => { + ): AnnotationRects[] => { // All rects in this area, regardless of annotation const rects = tree.search({ minX, minY, maxX, maxY }); diff --git a/packages/text-annotator/src/utils/reviveAnnotation.ts b/packages/text-annotator/src/utils/reviveAnnotation.ts index 71a6d750..bf3fe79d 100644 --- a/packages/text-annotator/src/utils/reviveAnnotation.ts +++ b/packages/text-annotator/src/utils/reviveAnnotation.ts @@ -2,7 +2,7 @@ import type { TextAnnotation } from '../model'; import { isRevived } from './isRevived'; import { reviveTarget } from './reviveTarget'; -export const reviveAnnotation = (annotation: TextAnnotation, container: HTMLElement): TextAnnotation => +export const reviveAnnotation = (annotation: T, container: HTMLElement): T => isRevived(annotation.target.selector) ? annotation : ({ ...annotation, target: reviveTarget(annotation.target, container) }); \ No newline at end of file diff --git a/packages/text-annotator/src/utils/reviveSelector.ts b/packages/text-annotator/src/utils/reviveSelector.ts index c7e601b1..b3990053 100644 --- a/packages/text-annotator/src/utils/reviveSelector.ts +++ b/packages/text-annotator/src/utils/reviveSelector.ts @@ -10,7 +10,7 @@ import { NOT_ANNOTATABLE_SELECTOR } from './splitAnnotatableRanges'; * * @returns the revived selector */ -export const reviveSelector = (selector: TextSelector, container: HTMLElement): TextSelector => { +export const reviveSelector = (selector: T, container: HTMLElement): T => { const { start, end } = selector; diff --git a/packages/text-annotator/src/utils/reviveTarget.ts b/packages/text-annotator/src/utils/reviveTarget.ts index 3c51ec0f..0777bf8e 100644 --- a/packages/text-annotator/src/utils/reviveTarget.ts +++ b/packages/text-annotator/src/utils/reviveTarget.ts @@ -2,7 +2,7 @@ import type { TextAnnotationTarget } from '../model'; import { isRevived } from './isRevived'; import { reviveSelector } from './reviveSelector'; -export const reviveTarget = (target: TextAnnotationTarget, container: HTMLElement): TextAnnotationTarget => +export const reviveTarget = (target: T, container: HTMLElement): T => isRevived(target.selector) ? target : ({ From 9d322987488b40acfd0966fcf0c11fbd198101a3 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Fri, 6 Sep 2024 12:51:01 +0200 Subject: [PATCH 5/8] Updated to latest Annotorious packages --- package-lock.json | 152 ++++++++++----------- packages/extension-tei/package.json | 6 +- packages/text-annotator-react/package.json | 8 +- packages/text-annotator/package.json | 4 +- 4 files changed, 85 insertions(+), 85 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73647864..64ca5018 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,20 +29,20 @@ } }, "node_modules/@annotorious/annotorious": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@annotorious/annotorious/-/annotorious-3.0.3.tgz", - "integrity": "sha512-jp0LLQxrBLRYVzrc9V4eTCjuDIF9WnwMJDkKUEthQAqsd8K1i3iXVfqxPQNH6uIay4cNenMAS8DhArKVXqkGyA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@annotorious/annotorious/-/annotorious-3.0.5.tgz", + "integrity": "sha512-0ocmtyYSZFvZ7YFujtcY8rR1An2B9MvRpPfw4DJZ8hX9aZtDjDmyAdbEqmQeyf2MysFkdu8lXkUFil1u7H6YWQ==", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/core": "3.0.3", + "@annotorious/core": "3.0.5", "rbush": "^4.0.1", "uuid": "^10.0.0" } }, "node_modules/@annotorious/core": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@annotorious/core/-/core-3.0.3.tgz", - "integrity": "sha512-D1mvTtlnmSco17X3PTZ92xKC9baxbcT9WDbtXIOotcFvTPq2Hpib36Jwz/DLXbVbCG6I3LScqtNcx/3JOElPhg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@annotorious/core/-/core-3.0.5.tgz", + "integrity": "sha512-WUXlu08WfdCgnjbOxyuTSd8bywOh2lsH56JVu50763ojEUSvMsgAvV355vZUpT4jM+5jwRYlsluiLEYw5myxNw==", "license": "BSD-3-Clause", "dependencies": { "dequal": "^2.0.3", @@ -52,13 +52,13 @@ } }, "node_modules/@annotorious/openseadragon": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@annotorious/openseadragon/-/openseadragon-3.0.3.tgz", - "integrity": "sha512-B2pG/jj1aVOIo51jU9GJEUQEzBYB/YtIYJuwoe0m1KrXKtbx0VfeixHiY6YXrQpRLG3iwfT1ztTVEgpOsLMtLw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@annotorious/openseadragon/-/openseadragon-3.0.5.tgz", + "integrity": "sha512-velDd7PlHndQO5npiFGkqkZJJfDJwaFsbk7XwMJfo0IQRZ2+8LE6yjtZi6RK8JXMtdKOvKVleTv61cUYjeBB8A==", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/annotorious": "3.0.3", - "@annotorious/core": "3.0.3", + "@annotorious/annotorious": "3.0.5", + "@annotorious/core": "3.0.5", "pixi.js": "^7.4.2", "uuid": "^10.0.0" }, @@ -67,14 +67,14 @@ } }, "node_modules/@annotorious/react": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@annotorious/react/-/react-3.0.3.tgz", - "integrity": "sha512-ijPbtW5FcFWMeVxCVcwoMuXuxMaCGnzjsrwYx4Xe/mnlNw5wWzfXAFIv4GK9IZUi+YKdmIsZ9yHmyUGUVwtabA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@annotorious/react/-/react-3.0.5.tgz", + "integrity": "sha512-SJ8OjjgOvDcAf2wImvTt95uOEwvmfZj3FlYGtj/jbf/0bjT3eE5GLtHFOGx9F3igXLW0wWqCbJNw3+uPUpuEVw==", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/annotorious": "3.0.3", - "@annotorious/core": "3.0.3", - "@annotorious/openseadragon": "3.0.3", + "@annotorious/annotorious": "3.0.5", + "@annotorious/core": "3.0.5", + "@annotorious/openseadragon": "3.0.5", "@floating-ui/react": "^0.26.23" }, "peerDependencies": { @@ -1872,9 +1872,9 @@ } }, "node_modules/@types/node": { - "version": "22.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.2.tgz", - "integrity": "sha512-acJsPTEqYqulZS/Yp/S3GgeE6GZ0qYODUR8aVr/DkhHQ8l9nd4j5x1/ZJy9/gHrRlFMqkO6i0I3E27Alu4jjPg==", + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", "dev": true, "license": "MIT", "dependencies": { @@ -2038,43 +2038,43 @@ } }, "node_modules/@volar/language-core": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.1.tgz", - "integrity": "sha512-9AKhC7Qn2mQYxj7Dz3bVxeOk7gGJladhWixUYKef/o0o7Bm4an+A3XvmcTHVqZ8stE6lBVH++g050tBtJ4TZPQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.2.tgz", + "integrity": "sha512-sONt5RLvLL1SlBdhyUSthZzuKePbJ7DwFFB9zT0eyWpDl+v7GXGh/RkPxxWaR22bIhYtTzp4Ka1MWatl/53Riw==", "dev": true, "license": "MIT", "dependencies": { - "@volar/source-map": "2.4.1" + "@volar/source-map": "2.4.2" } }, "node_modules/@volar/source-map": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.1.tgz", - "integrity": "sha512-Xq6ep3OZg9xUqN90jEgB9ztX5SsTz1yiV8wiQbcYNjWkek+Ie3dc8l7AVt3EhDm9mSIR58oWczHkzM2H6HIsmQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.2.tgz", + "integrity": "sha512-qiGfGgeZ5DEarPX3S+HcFktFCjfDrFPCXKeXNbrlB7v8cvtPRm8YVwoXOdGG1NhaL5rMlv5BZPVQyu4EdWWIvA==", "dev": true, "license": "MIT" }, "node_modules/@volar/typescript": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.1.tgz", - "integrity": "sha512-UoRzC0PXcwajFQTu8XxKSYNsWNBtVja6Y9gC8eLv7kYm+UEKJCcZ8g7dialsOYA0HKs3Vpg57MeCsawFLC6m9Q==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.2.tgz", + "integrity": "sha512-m2uZduhaHO1SZuagi30OsjI/X1gwkaEAC+9wT/nCNAtJ5FqXEkKvUncHmffG7ESDZPlFFUBK4vJ0D9Hfr+f2EA==", "dev": true, "license": "MIT", "dependencies": { - "@volar/language-core": "2.4.1", + "@volar/language-core": "2.4.2", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "node_modules/@vue/compiler-core": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.38.tgz", - "integrity": "sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.3.tgz", + "integrity": "sha512-adAfy9boPkP233NTyvLbGEqVuIfK/R0ZsBsIOW4BZNfb4BRpRW41Do1u+ozJpsb+mdoy80O20IzAsHaihRb5qA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.38", + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.3", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" @@ -2088,14 +2088,14 @@ "license": "MIT" }, "node_modules/@vue/compiler-dom": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.38.tgz", - "integrity": "sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.3.tgz", + "integrity": "sha512-wnzFArg9zpvk/811CDOZOadJRugf1Bgl/TQ3RfV4nKfSPok4hi0w10ziYUQR6LnnBAUlEXYLUfZ71Oj9ds/+QA==", "dev": true, "license": "MIT", "dependencies": { - "@vue/compiler-core": "3.4.38", - "@vue/shared": "3.4.38" + "@vue/compiler-core": "3.5.3", + "@vue/shared": "3.5.3" } }, "node_modules/@vue/compiler-vue2": { @@ -2161,9 +2161,9 @@ } }, "node_modules/@vue/shared": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.38.tgz", - "integrity": "sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.3.tgz", + "integrity": "sha512-Jp2v8nylKBT+PlOUjun2Wp/f++TfJVFjshLzNtJDdmFJabJa7noGMncqXRM1vXGX+Yo2V7WykQFNxusSim8SCA==", "dev": true, "license": "MIT" }, @@ -2384,9 +2384,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001655", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz", - "integrity": "sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==", + "version": "1.0.30001658", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001658.tgz", + "integrity": "sha512-N2YVqWbJELVdrnsW5p+apoQyYt51aBMSsBZki1XZEfeBCexcM/sf4xiAHcXQBkuOwJBXtWF7aW1sYX6tKebPHw==", "dev": true, "funding": [ { @@ -2615,13 +2615,13 @@ "license": "MIT" }, "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -2692,9 +2692,9 @@ "license": "ISC" }, "node_modules/electron-to-chromium": { - "version": "1.5.13", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz", - "integrity": "sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==", + "version": "1.5.16", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.16.tgz", + "integrity": "sha512-2gQpi2WYobXmz2q23FrOBYTLcI1O/P4heW3eqX+ldmPVDQELRqhiebV380EhlGG12NtnX1qbK/FHpN0ba+7bLA==", "dev": true, "license": "ISC" }, @@ -3445,9 +3445,9 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, "license": "MIT" }, @@ -3557,9 +3557,9 @@ } }, "node_modules/openseadragon": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/openseadragon/-/openseadragon-4.1.1.tgz", - "integrity": "sha512-owU9gsasAcobLN+LM8lN58Xc2VDSDotY9mkrwS/NB6g9KX/PcusV4RZvhHng2RF/Q0pMziwldf62glwXoGnuzg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/openseadragon/-/openseadragon-5.0.0.tgz", + "integrity": "sha512-S9aabSjmJg7Jfow1UItR5aXiKQLtkDWyRR5fxLeqT4vSYMvfscXUDfVS9snUN3JuIrHaSPJAlR4H2DYSn5DWRg==", "license": "BSD-3-Clause", "peer": true, "funding": { @@ -3707,9 +3707,9 @@ } }, "node_modules/postcss": { - "version": "8.4.44", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.44.tgz", - "integrity": "sha512-Aweb9unOEpQ3ezu4Q00DPvvM2ZTUitJdNKeP/+uQgr1IBIqu574IaZoURId7BKtWMREwzKa9OgzPzezWGPWFQw==", + "version": "8.4.45", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.45.tgz", + "integrity": "sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==", "dev": true, "funding": [ { @@ -4400,14 +4400,14 @@ } }, "node_modules/vite": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.2.tgz", - "integrity": "sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.3.tgz", + "integrity": "sha512-IH+nl64eq9lJjFqU+/yrRnrHPVTlgy42/+IzbOdaFDVlyLgI/wDlf+FCobXLX1cT0X5+7LMyH1mIy2xJdLfo8Q==", "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.41", + "postcss": "^8.4.43", "rollup": "^4.20.0" }, "bin": { @@ -4782,11 +4782,11 @@ "devDependencies": { "CETEIcean": "^1.9.3", "typescript": "5.5.4", - "vite": "^5.4.2", + "vite": "^5.4.3", "vite-plugin-dts": "^4.1.0" }, "peerDependencies": { - "@annotorious/core": "^3.0.3", + "@annotorious/core": "^3.0.5", "@recogito/text-annotator": "3.0.0-rc.44" } }, @@ -4795,7 +4795,7 @@ "version": "3.0.0-rc.44", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/core": "^3.0.3", + "@annotorious/core": "^3.0.5", "colord": "^2.9.3", "dequal": "^2.0.3", "rbush": "^4.0.1", @@ -4808,7 +4808,7 @@ "jsdom": "^25.0.0", "svelte": "^4.2.19", "typescript": "5.5.4", - "vite": "^5.4.2", + "vite": "^5.4.3", "vite-plugin-dts": "^4.1.0", "vitest": "^2.0.5" } @@ -4818,8 +4818,8 @@ "version": "3.0.0-rc.44", "license": "BSD-3-Clause", "dependencies": { - "@annotorious/core": "^3.0.3", - "@annotorious/react": "^3.0.3", + "@annotorious/core": "^3.0.5", + "@annotorious/react": "^3.0.5", "@floating-ui/react": "^0.26.23", "@recogito/text-annotator": "3.0.0-rc.44", "@recogito/text-annotator-tei": "3.0.0-rc.44", @@ -4831,12 +4831,12 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "5.5.4", - "vite": "^5.4.2", + "vite": "^5.4.3", "vite-plugin-dts": "^4.1.0", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { - "openseadragon": "^3.0.0 || ^4.0.0", + "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0", "react": "16.8.0 || >=17.x || >=18.x", "react-dom": "16.8.0 || >=17.x || >=18.x" }, diff --git a/packages/extension-tei/package.json b/packages/extension-tei/package.json index 02c979f8..56522358 100644 --- a/packages/extension-tei/package.json +++ b/packages/extension-tei/package.json @@ -6,7 +6,7 @@ "license": "BSD-3-Clause", "type": "module", "scripts": { - "start": "vite", + "start": "vite --host", "build": "vite build", "preview": "vite preview", "test": "echo 'Skipping tests in @recogito/text-annotator package'" @@ -28,11 +28,11 @@ "devDependencies": { "CETEIcean": "^1.9.3", "typescript": "5.5.4", - "vite": "^5.4.2", + "vite": "^5.4.3", "vite-plugin-dts": "^4.1.0" }, "peerDependencies": { - "@annotorious/core": "^3.0.3", + "@annotorious/core": "^3.0.5", "@recogito/text-annotator": "3.0.0-rc.44" } } \ No newline at end of file diff --git a/packages/text-annotator-react/package.json b/packages/text-annotator-react/package.json index 3c27fb19..c432b528 100644 --- a/packages/text-annotator-react/package.json +++ b/packages/text-annotator-react/package.json @@ -29,12 +29,12 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "5.5.4", - "vite": "^5.4.2", + "vite": "^5.4.3", "vite-plugin-dts": "^4.1.0", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { - "openseadragon": "^3.0.0 || ^4.0.0", + "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0", "react": "16.8.0 || >=17.x || >=18.x", "react-dom": "16.8.0 || >=17.x || >=18.x" }, @@ -44,8 +44,8 @@ } }, "dependencies": { - "@annotorious/core": "^3.0.3", - "@annotorious/react": "^3.0.3", + "@annotorious/core": "^3.0.5", + "@annotorious/react": "^3.0.5", "@floating-ui/react": "^0.26.23", "@recogito/text-annotator": "3.0.0-rc.44", "@recogito/text-annotator-tei": "3.0.0-rc.44", diff --git a/packages/text-annotator/package.json b/packages/text-annotator/package.json index b2591081..3ae7ef0f 100644 --- a/packages/text-annotator/package.json +++ b/packages/text-annotator/package.json @@ -32,12 +32,12 @@ "jsdom": "^25.0.0", "svelte": "^4.2.19", "typescript": "5.5.4", - "vite": "^5.4.2", + "vite": "^5.4.3", "vite-plugin-dts": "^4.1.0", "vitest": "^2.0.5" }, "dependencies": { - "@annotorious/core": "^3.0.3", + "@annotorious/core": "^3.0.5", "colord": "^2.9.3", "dequal": "^2.0.3", "rbush": "^4.0.1", From bb6902e00baf23274cec50e903cbac1b0617d09f Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Fri, 6 Sep 2024 12:53:12 +0200 Subject: [PATCH 6/8] Re-enabled highlight sorting, after update to fixed Annotorious --- .../src/highlight/span/spansRenderer.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/text-annotator/src/highlight/span/spansRenderer.ts b/packages/text-annotator/src/highlight/span/spansRenderer.ts index 4bfaff2c..a25159f2 100644 --- a/packages/text-annotator/src/highlight/span/spansRenderer.ts +++ b/packages/text-annotator/src/highlight/span/spansRenderer.ts @@ -63,22 +63,13 @@ const createRenderer = (container: HTMLElement): RendererImplementation => { * By default, we should expect that the newer highlight * will be rendered over the older one */ - - /** - * Note that I need to disable temporarily. Turns out annotation loading WITHOUT - * an adapter does not yet revive dates, causing this to fail. Needs to be - * fixed directly in the Annotorious Annotator. - * - const highlightsByCreation = [...highlights].sort((highlightA, highlightB) => { + const sorted = [...highlights].sort((highlightA, highlightB) => { const { annotation: { target: { created: createdA } } } = highlightA; const { annotation: { target: { created: createdB } } } = highlightB; - console.log(highlightA.annotation); - console.log(highlightB.annotation); return createdA && createdB ? createdA.getTime() - createdB.getTime() : 0; }); - */ - [...highlights]/*highlightsByCreation*/.forEach(highlight => { + sorted.forEach(highlight => { highlight.rects.map(rect => { const zIndex = computeZIndex(rect, highlights); const style = paint(highlight, viewportBounds, currentStyle, painter, zIndex); From 0db91365385215833cb231a77656fd4dba9ef123 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Fri, 6 Sep 2024 12:56:42 +0200 Subject: [PATCH 7/8] v3.0.0-rc.45 --- package-lock.json | 16 ++++++++-------- package.json | 2 +- packages/extension-tei/package.json | 4 ++-- packages/text-annotator-react/package.json | 6 +++--- packages/text-annotator/package.json | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 64ca5018..1fee9b6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@recogito/text-annotator-monorepo", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@recogito/text-annotator-monorepo", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "license": "BSD-3-Clause", "workspaces": [ "./packages/text-annotator", @@ -4777,7 +4777,7 @@ }, "packages/extension-tei": { "name": "@recogito/text-annotator-tei", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "license": "BSD-3-Clause", "devDependencies": { "CETEIcean": "^1.9.3", @@ -4787,12 +4787,12 @@ }, "peerDependencies": { "@annotorious/core": "^3.0.5", - "@recogito/text-annotator": "3.0.0-rc.44" + "@recogito/text-annotator": "3.0.0-rc.45" } }, "packages/text-annotator": { "name": "@recogito/text-annotator", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "license": "BSD-3-Clause", "dependencies": { "@annotorious/core": "^3.0.5", @@ -4815,14 +4815,14 @@ }, "packages/text-annotator-react": { "name": "@recogito/react-text-annotator", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "license": "BSD-3-Clause", "dependencies": { "@annotorious/core": "^3.0.5", "@annotorious/react": "^3.0.5", "@floating-ui/react": "^0.26.23", - "@recogito/text-annotator": "3.0.0-rc.44", - "@recogito/text-annotator-tei": "3.0.0-rc.44", + "@recogito/text-annotator": "3.0.0-rc.45", + "@recogito/text-annotator-tei": "3.0.0-rc.45", "CETEIcean": "^1.9.3" }, "devDependencies": { diff --git a/package.json b/package.json index a5867b69..eb4f41f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@recogito/text-annotator-monorepo", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "description": "Recogito Text Annotator monorepo", "author": "Rainer Simon", "repository": { diff --git a/packages/extension-tei/package.json b/packages/extension-tei/package.json index 56522358..8787778b 100644 --- a/packages/extension-tei/package.json +++ b/packages/extension-tei/package.json @@ -1,6 +1,6 @@ { "name": "@recogito/text-annotator-tei", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "description": "Recogito Text Annotator TEI extension", "author": "Rainer Simon", "license": "BSD-3-Clause", @@ -33,6 +33,6 @@ }, "peerDependencies": { "@annotorious/core": "^3.0.5", - "@recogito/text-annotator": "3.0.0-rc.44" + "@recogito/text-annotator": "3.0.0-rc.45" } } \ No newline at end of file diff --git a/packages/text-annotator-react/package.json b/packages/text-annotator-react/package.json index c432b528..c1a9175e 100644 --- a/packages/text-annotator-react/package.json +++ b/packages/text-annotator-react/package.json @@ -1,6 +1,6 @@ { "name": "@recogito/react-text-annotator", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "description": "Recogito Text Annotator React bindings", "author": "Rainer Simon", "license": "BSD-3-Clause", @@ -47,8 +47,8 @@ "@annotorious/core": "^3.0.5", "@annotorious/react": "^3.0.5", "@floating-ui/react": "^0.26.23", - "@recogito/text-annotator": "3.0.0-rc.44", - "@recogito/text-annotator-tei": "3.0.0-rc.44", + "@recogito/text-annotator": "3.0.0-rc.45", + "@recogito/text-annotator-tei": "3.0.0-rc.45", "CETEIcean": "^1.9.3" } } \ No newline at end of file diff --git a/packages/text-annotator/package.json b/packages/text-annotator/package.json index 3ae7ef0f..9277042f 100644 --- a/packages/text-annotator/package.json +++ b/packages/text-annotator/package.json @@ -1,6 +1,6 @@ { "name": "@recogito/text-annotator", - "version": "3.0.0-rc.44", + "version": "3.0.0-rc.45", "description": "A JavaScript text annotation library", "author": "Rainer Simon", "license": "BSD-3-Clause", From 7a6b6ab441f61603f80e1594ab72ebf1c6b04c12 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Mon, 9 Sep 2024 09:06:24 +0200 Subject: [PATCH 8/8] Cleanup --- packages/text-annotator-react/test/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/text-annotator-react/test/App.tsx b/packages/text-annotator-react/test/App.tsx index 33555c72..4679b7ce 100644 --- a/packages/text-annotator-react/test/App.tsx +++ b/packages/text-annotator-react/test/App.tsx @@ -18,7 +18,7 @@ const TestPopup = (props: TextAnnotationPopupContentProps) => { }; const onClick = () => { - store.addBody(body); + store!.addBody(body); anno.cancelSelected(); };