@recogito/text-annotator 3.4.8 → 3.4.10
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/text-annotator.css +1 -1
- package/dist/text-annotator.es.js +308 -302
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +2 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/package.json +8 -9
- package/dist/highlight/RendererImplementation.d.ts +0 -9
- package/dist/highlight/baseRenderer.d.ts +0 -22
- package/dist/highlight/color.d.ts +0 -2
- package/dist/src/SelectionHandler.d.ts +0 -9
- package/dist/src/TextAnnotator.d.ts +0 -12
- package/dist/src/TextAnnotatorOptions.d.ts +0 -34
- package/dist/src/api/index.d.ts +0 -1
- package/dist/src/api/scrollIntoView.d.ts +0 -3
- package/dist/src/highlight/Highlight.d.ts +0 -5
- package/dist/src/highlight/HighlightPainter.d.ts +0 -11
- package/dist/src/highlight/HighlightStyle.d.ts +0 -11
- package/dist/src/highlight/baseRenderer.d.ts +0 -20
- package/dist/src/highlight/canvas/canvasRenderer.d.ts +0 -4
- package/dist/src/highlight/canvas/index.d.ts +0 -1
- package/dist/src/highlight/highlights/highlightsRenderer.d.ts +0 -6
- package/dist/src/highlight/highlights/index.d.ts +0 -1
- package/dist/src/highlight/index.d.ts +0 -6
- package/dist/src/highlight/span/color.d.ts +0 -2
- package/dist/src/highlight/span/index.d.ts +0 -1
- package/dist/src/highlight/span/spansRenderer.d.ts +0 -4
- package/dist/src/highlight/viewport.d.ts +0 -12
- package/dist/src/index.d.ts +0 -11
- package/dist/src/model/core/TextAnnotation.d.ts +0 -15
- package/dist/src/model/core/index.d.ts +0 -1
- package/dist/src/model/index.d.ts +0 -2
- package/dist/src/model/w3c/W3CTextAnnotation.d.ts +0 -34
- package/dist/src/model/w3c/W3CTextFormatAdapter.d.ts +0 -12
- package/dist/src/model/w3c/index.d.ts +0 -2
- package/dist/src/presence/PresencePainter.d.ts +0 -4
- package/dist/src/presence/PresencePainterOptions.d.ts +0 -3
- package/dist/src/presence/index.d.ts +0 -2
- package/dist/src/state/TextAnnotationStore.d.ts +0 -25
- package/dist/src/state/TextAnnotatorState.d.ts +0 -11
- package/dist/src/state/index.d.ts +0 -2
- package/dist/src/state/spatialTree.d.ts +0 -28
- package/dist/src/utils/cancelSingleClickEvents.d.ts +0 -6
- package/dist/src/utils/cloneEvents.d.ts +0 -11
- package/dist/src/utils/device.d.ts +0 -1
- package/dist/src/utils/getHighlightClientRects.d.ts +0 -1
- package/dist/src/utils/getQuoteContext.d.ts +0 -4
- package/dist/src/utils/index.d.ts +0 -17
- package/dist/src/utils/isNotAnnotatable.d.ts +0 -4
- package/dist/src/utils/isRevived.d.ts +0 -2
- package/dist/src/utils/isWhitespaceOrEmpty.d.ts +0 -2
- package/dist/src/utils/mergeClientRects.d.ts +0 -2
- package/dist/src/utils/programmaticallyFocusable.d.ts +0 -6
- 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 -5
- package/dist/src/utils/trimRangeToContainer.d.ts +0 -1
- package/dist/test/model/w3c/W3CTextFormatAdapter.test.d.ts +0 -1
- package/dist/test/model/w3c/fixtures.d.ts +0 -3
- /package/dist/{src/utils → utils}/debounce.d.ts +0 -0
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recogito/text-annotator",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"description": "A JavaScript text annotation library",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"./text-annotator.css": "./dist/text-annotator.css"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/jsdom": "^
|
|
29
|
+
"@types/jsdom": "^28.0.1",
|
|
30
30
|
"@types/rbush": "^4.0.0",
|
|
31
|
-
"jsdom": "^
|
|
32
|
-
"typescript": "5.9.3",
|
|
33
|
-
"vite": "^7.
|
|
31
|
+
"jsdom": "^29.1.0",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
33
|
+
"vite": "^7.3.2",
|
|
34
34
|
"vite-plugin-externalize-deps": "^0.10.0",
|
|
35
|
-
"vitest": "^4.
|
|
35
|
+
"vitest": "^4.1.5"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@annotorious/core": "^3.
|
|
38
|
+
"@annotorious/core": "^3.8.1",
|
|
39
39
|
"colord": "^2.9.3",
|
|
40
40
|
"debounce": "^3.0.0",
|
|
41
41
|
"dequal": "^2.0.3",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"poll": "^3.2.2",
|
|
44
44
|
"nanoevents": "^9.1.0",
|
|
45
45
|
"rbush": "^4.0.1",
|
|
46
|
-
"
|
|
47
|
-
"uuid": "^13.0.0"
|
|
46
|
+
"uuid": "^14.0.0"
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Highlight } from './Highlight';
|
|
2
|
-
import type { HighlightPainter } from './HighlightPainter';
|
|
3
|
-
import type { HighlightStyleExpression } from './HighlightStyle';
|
|
4
|
-
import type { ViewportBounds } from './viewport';
|
|
5
|
-
export interface RendererImplementation {
|
|
6
|
-
destroy(): void;
|
|
7
|
-
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, painter?: HighlightPainter, lazy?: boolean): void;
|
|
8
|
-
setVisible(visible: boolean): void;
|
|
9
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Filter, type ViewportState } from '@annotorious/core';
|
|
2
|
-
import type { TextAnnotatorState } from '../state';
|
|
3
|
-
import { type ViewportBounds } from './viewport';
|
|
4
|
-
import type { HighlightPainter } from './HighlightPainter';
|
|
5
|
-
import type { Highlight } from './Highlight';
|
|
6
|
-
import type { HighlightStyleExpression } from './HighlightStyle';
|
|
7
|
-
import type { TextAnnotation } from 'src/model';
|
|
8
|
-
export interface RendererImplementation {
|
|
9
|
-
destroy(): void;
|
|
10
|
-
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, painter?: HighlightPainter, lazy?: boolean): void;
|
|
11
|
-
setVisible(visible: boolean): void;
|
|
12
|
-
}
|
|
13
|
-
export type RendererFactory = (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => Renderer;
|
|
14
|
-
export interface Renderer {
|
|
15
|
-
destroy(): void;
|
|
16
|
-
redraw(force?: boolean): void;
|
|
17
|
-
setStyle(style?: HighlightStyleExpression): void;
|
|
18
|
-
setFilter(filter?: Filter): void;
|
|
19
|
-
setPainter(painter?: HighlightPainter): void;
|
|
20
|
-
setVisible(visible: boolean): void;
|
|
21
|
-
}
|
|
22
|
-
export declare const createBaseRenderer: <T extends TextAnnotatorState = TextAnnotatorState>(container: HTMLElement, state: T, viewport: ViewportState, renderer: RendererImplementation) => Renderer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Filter, User } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotatorState } from './state';
|
|
3
|
-
import { TextAnnotation } from './model';
|
|
4
|
-
import { TextAnnotatorOptions } from './TextAnnotatorOptions';
|
|
5
|
-
export declare const SelectionHandler: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, options: TextAnnotatorOptions<TextAnnotation, unknown>) => {
|
|
6
|
-
destroy: () => void;
|
|
7
|
-
setFilter: (filter?: Filter) => Filter;
|
|
8
|
-
setUser: (user?: User) => User;
|
|
9
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Annotator } from '@annotorious/core';
|
|
2
|
-
import { HighlightStyleExpression } from './highlight';
|
|
3
|
-
import { TextAnnotatorState } from './state';
|
|
4
|
-
import { TextAnnotation } from './model';
|
|
5
|
-
import { TextAnnotatorOptions } from './TextAnnotatorOptions';
|
|
6
|
-
export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Annotator<I, E> {
|
|
7
|
-
element: HTMLElement;
|
|
8
|
-
setStyle(style: HighlightStyleExpression | undefined): void;
|
|
9
|
-
scrollIntoView(annotationOrId: I | string): boolean;
|
|
10
|
-
state: TextAnnotatorState<I, E>;
|
|
11
|
-
}
|
|
12
|
-
export declare const createTextAnnotator: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<I, E>) => TextAnnotator<I, E>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { FormatAdapter, UserSelectActionExpression, User } from '@annotorious/core';
|
|
2
|
-
import { PresencePainterOptions } from './presence';
|
|
3
|
-
import { TextAnnotation } from './model';
|
|
4
|
-
import { HighlightStyleExpression } from './highlight';
|
|
5
|
-
export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> {
|
|
6
|
-
adapter?: FormatAdapter<I, E> | null;
|
|
7
|
-
annotatingEnabled?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Determines whether an active selection should be dismissed
|
|
10
|
-
* when a user ends their interaction (click, selection)
|
|
11
|
-
* on a non-annotatable element.
|
|
12
|
-
* - NEVER - don't dismiss the selection, ignore the action.
|
|
13
|
-
* - ALWAYS - dismiss the selection.
|
|
14
|
-
* - function - a custom matcher that takes an event and container as arguments.
|
|
15
|
-
* Returns `true` if the selection should be dismissed.
|
|
16
|
-
*
|
|
17
|
-
* @defaut NEVER
|
|
18
|
-
*/
|
|
19
|
-
dismissOnNotAnnotatable?: DismissOnNotAnnotatableExpression;
|
|
20
|
-
mergeHighlights?: {
|
|
21
|
-
horizontalTolerance?: number;
|
|
22
|
-
verticalTolerance?: number;
|
|
23
|
-
};
|
|
24
|
-
offsetReferenceSelector?: string;
|
|
25
|
-
presence?: PresencePainterOptions;
|
|
26
|
-
renderer?: RendererType;
|
|
27
|
-
selectionMode?: 'shortest' | 'all';
|
|
28
|
-
style?: HighlightStyleExpression;
|
|
29
|
-
user?: User;
|
|
30
|
-
userSelectAction?: UserSelectActionExpression<E>;
|
|
31
|
-
}
|
|
32
|
-
export type RendererType = 'SPANS' | 'CANVAS' | 'CSS_HIGHLIGHTS';
|
|
33
|
-
export type DismissOnNotAnnotatableExpression = 'NEVER' | 'ALWAYS' | ((event: Event, container: HTMLElement) => boolean);
|
|
34
|
-
export declare const fillDefaults: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(opts: TextAnnotatorOptions<I, E>, defaults: TextAnnotatorOptions<I, E>) => TextAnnotatorOptions<I, E>;
|
package/dist/src/api/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './scrollIntoView';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Highlight } from './Highlight';
|
|
2
|
-
import { HighlightStyle, HighlightStyleExpression } from './HighlightStyle';
|
|
3
|
-
import { ViewportBounds } from './viewport';
|
|
4
|
-
export interface HighlightPainter {
|
|
5
|
-
clear(): void;
|
|
6
|
-
destroy(): void;
|
|
7
|
-
paint(highlight: Highlight, viewportBounds: ViewportBounds): HighlightStyle;
|
|
8
|
-
reset(): void;
|
|
9
|
-
}
|
|
10
|
-
/** Helper **/
|
|
11
|
-
export declare const paint: (highlight: Highlight, viewportBounds: ViewportBounds, style?: HighlightStyleExpression, painter?: HighlightPainter, zIndex?: number) => HighlightStyle;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AnnotationState, Color, DrawingStyle } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotation } from 'src/model';
|
|
3
|
-
export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity'> {
|
|
4
|
-
underlineStyle?: string;
|
|
5
|
-
underlineColor?: Color;
|
|
6
|
-
underlineOffset?: number;
|
|
7
|
-
underlineThickness?: number;
|
|
8
|
-
}
|
|
9
|
-
export type HighlightStyleExpression = HighlightStyle | (<I extends TextAnnotation = TextAnnotation>(annotation: I, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
|
|
10
|
-
export declare const DEFAULT_STYLE: HighlightStyle;
|
|
11
|
-
export declare const DEFAULT_SELECTED_STYLE: HighlightStyle;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Filter, ViewportState } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotatorState } from '../state';
|
|
3
|
-
import { ViewportBounds } from './viewport';
|
|
4
|
-
import { HighlightPainter } from './HighlightPainter';
|
|
5
|
-
import { Highlight } from './Highlight';
|
|
6
|
-
import { HighlightStyleExpression } from './HighlightStyle';
|
|
7
|
-
export interface RendererImplementation {
|
|
8
|
-
destroy(): void;
|
|
9
|
-
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, painter?: HighlightPainter, lazy?: boolean): void;
|
|
10
|
-
setVisible(visible: boolean): void;
|
|
11
|
-
}
|
|
12
|
-
export interface Renderer {
|
|
13
|
-
destroy(): void;
|
|
14
|
-
redraw(force?: boolean): void;
|
|
15
|
-
setStyle(style?: HighlightStyleExpression): void;
|
|
16
|
-
setFilter(filter?: Filter): void;
|
|
17
|
-
setPainter(painter?: HighlightPainter): void;
|
|
18
|
-
setVisible(visible: boolean): void;
|
|
19
|
-
}
|
|
20
|
-
export declare const createBaseRenderer: <T extends TextAnnotatorState = TextAnnotatorState>(container: HTMLElement, state: T, viewport: ViewportState, renderer: RendererImplementation) => Renderer;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ViewportState } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotatorState } from '../../state';
|
|
3
|
-
import { TextAnnotation } from 'src/model';
|
|
4
|
-
export declare const createCanvasRenderer: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './canvasRenderer';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ViewportState } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotatorState } from 'src/state';
|
|
3
|
-
import { RendererImplementation } from '../baseRenderer';
|
|
4
|
-
import { TextAnnotation } from 'src/model';
|
|
5
|
-
export declare const createRenderer: () => RendererImplementation;
|
|
6
|
-
export declare const createHighlightsRenderer: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './highlightsRenderer';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './spansRenderer';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ViewportState } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotatorState } from '../../state';
|
|
3
|
-
import { TextAnnotation } from 'src/model';
|
|
4
|
-
export declare const createSpansRenderer: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ViewportState } from '@annotorious/core';
|
|
2
|
-
import { 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;
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './api';
|
|
2
|
-
export * from './highlight';
|
|
3
|
-
export * from './model';
|
|
4
|
-
export * from './state';
|
|
5
|
-
export * from './utils';
|
|
6
|
-
export * from './presence';
|
|
7
|
-
export * from './SelectionHandler';
|
|
8
|
-
export * from './TextAnnotator';
|
|
9
|
-
export * from './TextAnnotatorOptions';
|
|
10
|
-
export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Color, Filter, FormatAdapter, HoverState, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, ParseResult, User, UserSelectActionExpression, ViewportState, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
|
|
11
|
-
export { createBody, Origin, UserSelectAction } from '@annotorious/core';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Annotation, AnnotationTarget } from '@annotorious/core';
|
|
2
|
-
export interface TextAnnotation extends Annotation {
|
|
3
|
-
target: TextAnnotationTarget;
|
|
4
|
-
}
|
|
5
|
-
export interface TextAnnotationTarget extends AnnotationTarget {
|
|
6
|
-
selector: TextSelector[];
|
|
7
|
-
}
|
|
8
|
-
export interface TextSelector {
|
|
9
|
-
id?: string;
|
|
10
|
-
quote: string;
|
|
11
|
-
start: number;
|
|
12
|
-
end: number;
|
|
13
|
-
range: Range;
|
|
14
|
-
offsetReference?: HTMLElement;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TextAnnotation';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { 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
|
-
scope?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Matches the `Text Quote Selector` spec
|
|
13
|
-
* @see https://www.w3.org/TR/annotation-model/#text-quote-selector
|
|
14
|
-
*/
|
|
15
|
-
export interface W3CTextQuoteSelector {
|
|
16
|
-
type: 'TextQuoteSelector';
|
|
17
|
-
exact: string;
|
|
18
|
-
prefix?: string;
|
|
19
|
-
suffix?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Matches the `Text Position Selector` spec
|
|
23
|
-
* @see https://www.w3.org/TR/annotation-model/#text-position-selector
|
|
24
|
-
*/
|
|
25
|
-
export interface W3CTextPositionSelector {
|
|
26
|
-
type: 'TextPositionSelector';
|
|
27
|
-
start: number;
|
|
28
|
-
end: number;
|
|
29
|
-
}
|
|
30
|
-
export type W3CTextSelector = W3CTextQuoteSelector | W3CTextPositionSelector;
|
|
31
|
-
export type W3CAnnotationStylesheet = string | {
|
|
32
|
-
type: 'CssStylesheet';
|
|
33
|
-
value: string;
|
|
34
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FormatAdapter, ParseResult } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotation } from '../core';
|
|
3
|
-
import { W3CTextAnnotation } from '../w3c';
|
|
4
|
-
export type W3CTextFormatAdapter<I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation> = FormatAdapter<I, E>;
|
|
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: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(source: string, container?: HTMLElement) => W3CTextFormatAdapter<I, E>;
|
|
11
|
-
export declare const parseW3CTextAnnotation: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(annotation: E) => ParseResult<I>;
|
|
12
|
-
export declare const serializeW3CTextAnnotation: <I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation>(annotation: I, source: string, container?: HTMLElement) => E;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PresenceProvider } from '@annotorious/core';
|
|
2
|
-
import { HighlightPainter } from '../highlight';
|
|
3
|
-
import { PresencePainterOptions } from '../presence';
|
|
4
|
-
export declare const createPresencePainter: (provider: PresenceProvider, opts?: PresencePainterOptions) => HighlightPainter;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Filter, Origin, Store } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotation } from '../model';
|
|
3
|
-
export interface TextAnnotationStore<T extends TextAnnotation = TextAnnotation> extends Omit<Store<T>, 'addAnnotation' | 'bulkAddAnnotation'> {
|
|
4
|
-
addAnnotation(annotation: T, origin?: Origin): boolean;
|
|
5
|
-
bulkAddAnnotations(annotations: T[], replace: boolean, origin?: Origin): T[];
|
|
6
|
-
bulkUpsertAnnotations(annotations: T[], origin?: Origin): T[];
|
|
7
|
-
getAnnotationRects(id: string): DOMRect[];
|
|
8
|
-
getAnnotationBounds(id: string): DOMRect | undefined;
|
|
9
|
-
getAnnotationRects(id: string): DOMRect[];
|
|
10
|
-
getAt(x: number, y: number, all: true, filter?: Filter): T[] | undefined;
|
|
11
|
-
getAt(x: number, y: number, all: false, filter?: Filter): T | undefined;
|
|
12
|
-
getAt(x: number, y: number, all?: boolean, filter?: Filter): T | T[] | undefined;
|
|
13
|
-
getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
|
|
14
|
-
recalculatePositions(): void;
|
|
15
|
-
}
|
|
16
|
-
export interface AnnotationRects<T extends TextAnnotation = TextAnnotation> {
|
|
17
|
-
annotation: T;
|
|
18
|
-
rects: Rect[];
|
|
19
|
-
}
|
|
20
|
-
export interface Rect {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
width: number;
|
|
24
|
-
height: number;
|
|
25
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ViewportState, AnnotatorState, SelectionState, HoverState } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotation } from '../model';
|
|
3
|
-
import { TextAnnotationStore } from './TextAnnotationStore';
|
|
4
|
-
import { TextAnnotatorOptions } from '../TextAnnotatorOptions';
|
|
5
|
-
export interface TextAnnotatorState<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends AnnotatorState<I, E> {
|
|
6
|
-
store: TextAnnotationStore<I>;
|
|
7
|
-
selection: SelectionState<I, E>;
|
|
8
|
-
hover: HoverState<I>;
|
|
9
|
-
viewport: ViewportState;
|
|
10
|
-
}
|
|
11
|
-
export declare const createTextAnnotatorState: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, opts: TextAnnotatorOptions<I, E>) => TextAnnotatorState<I, E>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Store } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotation, TextAnnotationTarget } from '../model';
|
|
3
|
-
import { AnnotationRects } from './TextAnnotationStore';
|
|
4
|
-
interface IndexedHighlightRect {
|
|
5
|
-
minX: number;
|
|
6
|
-
minY: number;
|
|
7
|
-
maxX: number;
|
|
8
|
-
maxY: number;
|
|
9
|
-
annotation: {
|
|
10
|
-
id: string;
|
|
11
|
-
rects: DOMRect[];
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare const createSpatialTree: <T extends TextAnnotation>(store: Store<T>, container: HTMLElement, hMergeTolerance?: number, vMergeTolerance?: number) => {
|
|
15
|
-
all: () => IndexedHighlightRect[][];
|
|
16
|
-
clear: () => void;
|
|
17
|
-
getAt: (x: number, y: number, all?: boolean) => string[];
|
|
18
|
-
getAnnotationBounds: (id: string) => DOMRect;
|
|
19
|
-
getAnnotationRects: (id: string) => DOMRect[];
|
|
20
|
-
getIntersecting: (minX: number, minY: number, maxX: number, maxY: number) => AnnotationRects<T>[];
|
|
21
|
-
insert: (target: TextAnnotationTarget) => void;
|
|
22
|
-
recalculate: () => void;
|
|
23
|
-
remove: (target: TextAnnotationTarget) => void;
|
|
24
|
-
set: (targets: TextAnnotationTarget[], replace?: boolean) => void;
|
|
25
|
-
size: () => number;
|
|
26
|
-
update: (target: TextAnnotationTarget) => void;
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calls .preventDefault() on click events in annotable areas, in order
|
|
3
|
-
* to prevent problematic default browser behavior. (Specifically: keep
|
|
4
|
-
* Chrome Android from triggering word selection on single click.)
|
|
5
|
-
*/
|
|
6
|
-
export declare const cancelSingleClickEvents: (container: HTMLElement) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Events need to be manually mapped into new objects:
|
|
3
|
-
* 1. It preserves the `target` and `currentTarget` properties.
|
|
4
|
-
* Otherwise, they will be `null` when the event is read beyond the handler.
|
|
5
|
-
* 2. Spread operator can copy only own enumerable properties, not inherited ones.
|
|
6
|
-
* Therefore, we need to manually copy the props we're interested in.
|
|
7
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
|
|
8
|
-
* @see https://github.com/recogito/text-annotator-js/commit/65d13f3108c429311cf8c2523f6babbbc946013d#r144041390
|
|
9
|
-
*/
|
|
10
|
-
export declare const clonePointerEvent: (event: PointerEvent) => PointerEvent;
|
|
11
|
-
export declare const cloneKeyboardEvent: (event: KeyboardEvent) => KeyboardEvent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isMac: boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getHighlightClientRects: (range: Range) => DOMRect[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './cancelSingleClickEvents';
|
|
2
|
-
export * from './cloneEvents';
|
|
3
|
-
export * from './device';
|
|
4
|
-
export * from './programmaticallyFocusable';
|
|
5
|
-
export * from './debounce';
|
|
6
|
-
export * from './getHighlightClientRects';
|
|
7
|
-
export * from './getQuoteContext';
|
|
8
|
-
export * from './isNotAnnotatable';
|
|
9
|
-
export * from './isRevived';
|
|
10
|
-
export * from './isWhitespaceOrEmpty';
|
|
11
|
-
export * from './mergeClientRects';
|
|
12
|
-
export * from './rangeToSelector';
|
|
13
|
-
export * from './reviveAnnotation';
|
|
14
|
-
export * from './reviveSelector';
|
|
15
|
-
export * from './reviveTarget';
|
|
16
|
-
export * from './splitAnnotatableRanges';
|
|
17
|
-
export * from './trimRangeToContainer';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const NOT_ANNOTATABLE_CLASS = "not-annotatable";
|
|
2
|
-
export declare const NOT_ANNOTATABLE_SELECTOR = ".not-annotatable";
|
|
3
|
-
export declare const isNotAnnotatable: (container: Node, node: Node) => boolean;
|
|
4
|
-
export declare const isRangeAnnotatable: (container: Node, range: Range) => boolean;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Makes an element programmatically focusable by adding a `tabindex="-1"` attribute.
|
|
3
|
-
* Or does nothing if the element is already focusable 🤷🏻
|
|
4
|
-
* It's required to process keyboard events on an element that is not natively focusable.
|
|
5
|
-
*/
|
|
6
|
-
export declare const programmaticallyFocusable: (container: HTMLElement) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { 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: <T extends TextSelector>(selector: T, container: HTMLElement) => T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const trimRangeToContainer: (range: Range, container: HTMLElement) => Range;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|