@recogito/text-annotator 3.0.0-rc.18 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/SelectionHandler.d.ts +2 -1
- package/dist/src/TextAnnotator.d.ts +0 -1
- package/dist/src/TextAnnotatorOptions.d.ts +0 -1
- package/dist/src/api/scrollIntoView.d.ts +2 -2
- package/dist/src/highlight/HighlightPainter.d.ts +19 -8
- package/dist/src/highlight/highlightLayer.d.ts +10 -0
- package/dist/src/highlight/index.d.ts +2 -2
- package/dist/src/highlight/trackViewport.d.ts +3 -0
- package/dist/src/index.d.ts +3 -4
- package/dist/src/model/{core/TextAnnotation.d.ts → TextAnnotation.d.ts} +1 -1
- package/dist/src/model/index.d.ts +1 -2
- package/dist/src/presence/PresencePainter.d.ts +3 -3
- package/dist/src/state/TextAnnotationStore.d.ts +0 -1
- package/dist/src/state/index.d.ts +1 -0
- package/dist/src/state/reviveTarget.d.ts +9 -0
- package/dist/src/utils/index.d.ts +0 -9
- package/dist/text-annotator.css +1 -1
- package/dist/text-annotator.es.js +821 -1391
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +1 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +11 -16
- package/dist/src/highlight/HighlightStyle.d.ts +0 -9
- package/dist/src/highlight/canvas/highlightRenderer.d.ts +0 -11
- package/dist/src/highlight/canvas/index.d.ts +0 -1
- package/dist/src/highlight/css/highlightRenderer.d.ts +0 -11
- package/dist/src/highlight/css/highlights.d.ts +0 -10
- package/dist/src/highlight/css/index.d.ts +0 -1
- package/dist/src/highlight/viewport.d.ts +0 -12
- package/dist/src/model/core/index.d.ts +0 -1
- package/dist/src/model/w3c/W3CTextAnnotation.d.ts +0 -33
- package/dist/src/model/w3c/W3CTextFormatAdapter.d.ts +0 -12
- package/dist/src/model/w3c/index.d.ts +0 -2
- package/dist/src/utils/debounce.d.ts +0 -1
- package/dist/src/utils/getAnnotatableFragment.d.ts +0 -5
- package/dist/src/utils/getQuoteContext.d.ts +0 -4
- package/dist/src/utils/isRevived.d.ts +0 -2
- package/dist/src/utils/rangeToSelector.d.ts +0 -2
- package/dist/src/utils/reviveAnnotation.d.ts +0 -2
- package/dist/src/utils/reviveSelector.d.ts +0 -11
- package/dist/src/utils/reviveTarget.d.ts +0 -2
- package/dist/src/utils/splitAnnotatableRanges.d.ts +0 -6
- package/dist/test/model/w3c/W3CTextFormatAdapter.test.d.ts +0 -1
- package/dist/test/model/w3c/fixtures.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recogito/text-annotator",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.2",
|
|
4
4
|
"description": "A JavaScript text annotation library",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"start": "vite
|
|
9
|
+
"start": "vite",
|
|
10
10
|
"build": "vite build",
|
|
11
11
|
"preview": "vite preview",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "echo 'Skipping tests in @recogito/text-annotator package'"
|
|
13
13
|
},
|
|
14
14
|
"main": "./dist/text-annotator.umd.js",
|
|
15
15
|
"module": "./dist/text-annotator.es.js",
|
|
@@ -19,27 +19,22 @@
|
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/src/index.d.ts",
|
|
23
22
|
"import": "./dist/text-annotator.es.js",
|
|
24
23
|
"require": "./dist/text-annotator.umd.js"
|
|
25
24
|
},
|
|
26
25
|
"./dist/text-annotator.css": "./dist/text-annotator.css"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@types/
|
|
30
|
-
"@types/
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"vite": "^5.1.3",
|
|
36
|
-
"vite-plugin-dts": "^3.7.2",
|
|
37
|
-
"vitest": "^1.3.0"
|
|
28
|
+
"@types/rbush": "^3.0.0",
|
|
29
|
+
"@types/uuid": "^9.0.1",
|
|
30
|
+
"svelte": "^4.0.0",
|
|
31
|
+
"typescript": "^4.9.5",
|
|
32
|
+
"vite": "^4.2.1",
|
|
33
|
+
"vite-plugin-dts": "^2.3.0"
|
|
38
34
|
},
|
|
39
35
|
"dependencies": {
|
|
40
|
-
"@annotorious/core": "^3.0.0-rc.
|
|
41
|
-
"colord": "^2.9.3",
|
|
36
|
+
"@annotorious/core": "^3.0.0-rc.2",
|
|
42
37
|
"rbush": "^3.0.1",
|
|
43
|
-
"uuid": "^9.0.
|
|
38
|
+
"uuid": "^9.0.0"
|
|
44
39
|
}
|
|
45
40
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DrawingStyle } from '@annotorious/core';
|
|
2
|
-
export declare const DEFAULT_STYLE: DrawingStyle;
|
|
3
|
-
export declare const DEFAULT_SELECTED_STYLE: DrawingStyle;
|
|
4
|
-
export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity'> {
|
|
5
|
-
underlineStyle?: string;
|
|
6
|
-
underlineColor?: number;
|
|
7
|
-
underlineOffset?: number;
|
|
8
|
-
underlineThickness?: number;
|
|
9
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DrawingStyle, Filter, ViewportState } from '@annotorious/core';
|
|
2
|
-
import type { TextAnnotation } from '../../model';
|
|
3
|
-
import type { TextAnnotatorState } from '../../state';
|
|
4
|
-
import type { HighlightPainter } from '../HighlightPainter';
|
|
5
|
-
export declare const createCanvasHighlightRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => {
|
|
6
|
-
destroy: () => void;
|
|
7
|
-
refresh: () => number;
|
|
8
|
-
setDrawingStyle: (style: DrawingStyle | ((a: TextAnnotation, selected?: boolean) => DrawingStyle)) => void;
|
|
9
|
-
setFilter: (filter?: Filter) => void;
|
|
10
|
-
setPainter: (painter: HighlightPainter) => HighlightPainter;
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './highlightRenderer';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DrawingStyle, Filter, ViewportState } from '@annotorious/core';
|
|
2
|
-
import type { TextAnnotatorState } from '../../state';
|
|
3
|
-
import type { TextAnnotation } from '../../model';
|
|
4
|
-
import type { HighlightPainter } from '../HighlightPainter';
|
|
5
|
-
export declare const createCSSHighlightRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => {
|
|
6
|
-
destroy: () => void;
|
|
7
|
-
refresh: () => void;
|
|
8
|
-
setDrawingStyle: (style: DrawingStyle | ((a: TextAnnotation, selected?: boolean) => DrawingStyle)) => void;
|
|
9
|
-
setFilter: (filter?: Filter) => void;
|
|
10
|
-
setPainter: (painter: HighlightPainter) => void;
|
|
11
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DrawingStyle } from '@annotorious/core';
|
|
2
|
-
import type { TextAnnotation } from '../../model';
|
|
3
|
-
import type { HighlightPainter } from '../HighlightPainter';
|
|
4
|
-
import type { AnnotationRects } from 'src/state';
|
|
5
|
-
import type { ViewportBounds } from '../viewport';
|
|
6
|
-
export declare const createHighlights: () => {
|
|
7
|
-
destroy: () => void;
|
|
8
|
-
refresh: (highlights: AnnotationRects[], viewportBounds: ViewportBounds, selected: string[], currentStyle: DrawingStyle | ((annotation: TextAnnotation, selected: boolean) => DrawingStyle)) => void;
|
|
9
|
-
setPainter: (painter: HighlightPainter) => HighlightPainter;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './highlightRenderer';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ViewportState } from '@annotorious/core';
|
|
2
|
-
import type { TextAnnotation } from '../model';
|
|
3
|
-
export interface ViewportBounds {
|
|
4
|
-
top: number;
|
|
5
|
-
left: number;
|
|
6
|
-
minX: number;
|
|
7
|
-
minY: number;
|
|
8
|
-
maxX: number;
|
|
9
|
-
maxY: number;
|
|
10
|
-
}
|
|
11
|
-
export declare const getViewportBounds: (container: HTMLElement) => ViewportBounds;
|
|
12
|
-
export declare const trackViewport: (viewport: ViewportState) => (annotations: TextAnnotation[]) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TextAnnotation';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { W3CAnnotation, W3CAnnotationTarget } from '@annotorious/core';
|
|
2
|
-
export interface W3CTextAnnotation extends W3CAnnotation {
|
|
3
|
-
target: W3CTextAnnotationTarget | W3CTextAnnotationTarget[];
|
|
4
|
-
stylesheet?: W3CAnnotationStylesheet;
|
|
5
|
-
}
|
|
6
|
-
export interface W3CTextAnnotationTarget extends W3CAnnotationTarget {
|
|
7
|
-
selector: W3CTextSelector | W3CTextSelector[];
|
|
8
|
-
styleClass?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Matches the `Text Quote Selector` spec
|
|
12
|
-
* @see https://www.w3.org/TR/annotation-model/#text-quote-selector
|
|
13
|
-
*/
|
|
14
|
-
export interface W3CTextQuoteSelector {
|
|
15
|
-
type: 'TextQuoteSelector';
|
|
16
|
-
exact: string;
|
|
17
|
-
prefix?: string;
|
|
18
|
-
suffix?: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Matches the `Text Position Selector` spec
|
|
22
|
-
* @see https://www.w3.org/TR/annotation-model/#text-position-selector
|
|
23
|
-
*/
|
|
24
|
-
export interface W3CTextPositionSelector {
|
|
25
|
-
type: 'TextPositionSelector';
|
|
26
|
-
start: number;
|
|
27
|
-
end: number;
|
|
28
|
-
}
|
|
29
|
-
export type W3CTextSelector = W3CTextQuoteSelector | W3CTextPositionSelector;
|
|
30
|
-
export type W3CAnnotationStylesheet = string | {
|
|
31
|
-
type: 'CssStylesheet';
|
|
32
|
-
value: string;
|
|
33
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type FormatAdapter, ParseResult } from '@annotorious/core';
|
|
2
|
-
import type { TextAnnotation } from '../core';
|
|
3
|
-
import type { W3CTextAnnotation } from '../w3c';
|
|
4
|
-
export type W3CTextFormatAdapter = FormatAdapter<TextAnnotation, W3CTextAnnotation>;
|
|
5
|
-
/**
|
|
6
|
-
* @param source - the IRI of the annotated content
|
|
7
|
-
* @param container - the HTML container of the annotated content,
|
|
8
|
-
* Required to locate the content's `range` within the DOM
|
|
9
|
-
*/
|
|
10
|
-
export declare const W3CTextFormat: (source: string, container: HTMLElement) => W3CTextFormatAdapter;
|
|
11
|
-
export declare const parseW3CTextAnnotation: (annotation: W3CTextAnnotation, container: HTMLElement) => ParseResult<TextAnnotation>;
|
|
12
|
-
export declare const serializeW3CTextAnnotation: (annotation: TextAnnotation, source: string, container: HTMLElement) => W3CTextAnnotation;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const debounce: <T extends (...args: any[]) => void>(func: T, delay?: number) => T;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TextSelector } from '../model';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a new selector object with the revived DOM range from the given text annotation position
|
|
4
|
-
* Only the annotatable elements are processed and counted towards the range
|
|
5
|
-
*
|
|
6
|
-
* @param selector annotation selector with start and end positions
|
|
7
|
-
* @param container the HTML container of the annotated content
|
|
8
|
-
*
|
|
9
|
-
* @returns the revived selector
|
|
10
|
-
*/
|
|
11
|
-
export declare const reviveSelector: (selector: TextSelector, container: HTMLElement) => TextSelector;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const NOT_ANNOTATABLE_SELECTOR = ".not-annotatable";
|
|
2
|
-
/**
|
|
3
|
-
* Splits a DOM Range into one or more ranges that span annotatable content only.
|
|
4
|
-
*/
|
|
5
|
-
export declare const splitAnnotatableRanges: (range: Range) => Range[];
|
|
6
|
-
export declare const getRangeAnnotatableContents: (range: Range) => DocumentFragment;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|