@soomo/text-annotator 3.4.14-staging.0 → 4.1.0-staging.0
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/index.d.ts +8 -7
- package/dist/model/core/index.d.ts +1 -1
- package/dist/model/core/text-annotation.d.ts +27 -0
- package/dist/model/w3c/index.d.ts +2 -2
- package/dist/model/w3c/w3c-text-annotation.d.ts +36 -0
- package/dist/model/w3c/w3c-text-format-adapter.d.ts +12 -0
- package/dist/rendering/base-renderer.d.ts +31 -0
- package/dist/rendering/highlight-style.d.ts +14 -0
- package/dist/rendering/highlight.d.ts +6 -0
- package/dist/rendering/index.d.ts +5 -0
- package/dist/rendering/renderer-css-highlight/css-highlight-renderer.d.ts +7 -0
- package/dist/rendering/renderer-css-highlight/index.d.ts +1 -0
- package/dist/rendering/renderer-inline-markup/index.d.ts +0 -0
- package/dist/rendering/renderer-spans/index.d.ts +1 -0
- package/dist/rendering/renderer-spans/spans-renderer.d.ts +4 -0
- package/dist/rendering/viewport.d.ts +12 -0
- package/dist/selection-handler.d.ts +12 -0
- package/dist/state/index.d.ts +2 -2
- package/dist/state/spatial-tree.d.ts +33 -0
- package/dist/state/text-annotation-store.d.ts +28 -0
- package/dist/state/text-annotator-state.d.ts +12 -0
- package/dist/text-annotator-options.d.ts +33 -0
- package/dist/text-annotator.css +1 -1
- package/dist/text-annotator.d.ts +17 -0
- package/dist/text-annotator.es.js +768 -826
- 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/annotation/get-quote-context.d.ts +4 -0
- package/dist/utils/annotation/index.d.ts +4 -0
- package/dist/utils/annotation/range-to-selector.d.ts +2 -0
- package/dist/utils/annotation/revive-annotation.d.ts +14 -0
- package/dist/utils/annotation/scroll-into-view.d.ts +3 -0
- package/dist/utils/dom/device.d.ts +1 -0
- package/dist/utils/dom/index.d.ts +7 -0
- package/dist/utils/dom/is-not-annotatable.d.ts +4 -0
- package/dist/utils/dom/is-whitespace-or-empty.d.ts +3 -0
- package/dist/utils/dom/merge-ranges.d.ts +1 -0
- package/dist/utils/dom/programmatically-focusable.d.ts +6 -0
- package/dist/utils/dom/split-annotatable-ranges.d.ts +5 -0
- package/dist/utils/dom/trim-range-to-container.d.ts +1 -0
- package/dist/utils/events/cancel-single-click-events.d.ts +6 -0
- package/dist/utils/events/clone-events.d.ts +11 -0
- package/dist/utils/events/debounce.d.ts +1 -0
- package/dist/utils/events/index.d.ts +3 -0
- package/dist/utils/highlight/compute-z-index.d.ts +3 -0
- package/dist/utils/highlight/get-highlight-client-rects.d.ts +1 -0
- package/dist/utils/highlight/index.d.ts +4 -0
- package/dist/utils/highlight/merge-client-rects.d.ts +2 -0
- package/dist/utils/highlight/rects-to-bounds.d.ts +8 -0
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from './api';
|
|
2
|
-
export * from './highlight';
|
|
3
1
|
export * from './model';
|
|
4
|
-
export * from './
|
|
2
|
+
export * from './rendering';
|
|
5
3
|
export * from './state';
|
|
6
|
-
export * from './utils';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
4
|
+
export * from './utils/annotation';
|
|
5
|
+
export * from './utils/dom';
|
|
6
|
+
export * from './utils/events';
|
|
7
|
+
export * from './utils/highlight';
|
|
8
|
+
export * from './selection-handler';
|
|
9
|
+
export * from './text-annotator';
|
|
10
|
+
export * from './text-annotator-options';
|
|
10
11
|
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
12
|
export { createBody, Origin, UserSelectAction } from '@annotorious/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './text-annotation';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { 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
|
+
}
|
|
16
|
+
export interface TextAnnotationLike extends Annotation {
|
|
17
|
+
target: TextAnnotationTargetLike;
|
|
18
|
+
}
|
|
19
|
+
export interface TextAnnotationTargetLike extends AnnotationTarget {
|
|
20
|
+
selector: TextSelectorLike[];
|
|
21
|
+
}
|
|
22
|
+
export interface TextSelectorLike {
|
|
23
|
+
id?: string;
|
|
24
|
+
quote: string;
|
|
25
|
+
range: Range;
|
|
26
|
+
offsetReference?: HTMLElement;
|
|
27
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './w3c-text-annotation';
|
|
2
|
+
export * from './w3c-text-format-adapter';
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
scope?: string;
|
|
10
|
+
outdated?: boolean;
|
|
11
|
+
migrationPending?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Matches the `Text Quote Selector` spec
|
|
15
|
+
* @see https://www.w3.org/TR/annotation-model/#text-quote-selector
|
|
16
|
+
*/
|
|
17
|
+
export interface W3CTextQuoteSelector {
|
|
18
|
+
type: 'TextQuoteSelector';
|
|
19
|
+
exact: string;
|
|
20
|
+
prefix?: string;
|
|
21
|
+
suffix?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Matches the `Text Position Selector` spec
|
|
25
|
+
* @see https://www.w3.org/TR/annotation-model/#text-position-selector
|
|
26
|
+
*/
|
|
27
|
+
export interface W3CTextPositionSelector {
|
|
28
|
+
type: 'TextPositionSelector';
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
}
|
|
32
|
+
export type W3CTextSelector = W3CTextQuoteSelector | W3CTextPositionSelector;
|
|
33
|
+
export type W3CAnnotationStylesheet = string | {
|
|
34
|
+
type: 'CssStylesheet';
|
|
35
|
+
value: string;
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextAnnotation } from '../core';
|
|
2
|
+
import type { W3CTextAnnotation } from './';
|
|
3
|
+
import { type FormatAdapter, type ParseResult } from '@annotorious/core';
|
|
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;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Unsubscribe } from 'nanoevents';
|
|
2
|
+
import { type Annotation, type AnnotatorState, type Filter, type ViewportState } from '@annotorious/core';
|
|
3
|
+
import type { TextAnnotation } from '../model';
|
|
4
|
+
import type { TextAnnotatorState } from '../state';
|
|
5
|
+
import { type Highlight, type HighlightStyleExpression, type ViewportBounds } from './';
|
|
6
|
+
/**
|
|
7
|
+
* The renderer runtime interface.
|
|
8
|
+
*/
|
|
9
|
+
export interface Renderer {
|
|
10
|
+
destroy(): void;
|
|
11
|
+
on: <E extends keyof RendererEvents>(event: E, callback: RendererEvents[E]) => Unsubscribe;
|
|
12
|
+
redraw(force?: boolean): void;
|
|
13
|
+
setStyle(style?: HighlightStyleExpression, id?: string): void;
|
|
14
|
+
setFilter(filter?: Filter<any>): void;
|
|
15
|
+
setVisible(visible: boolean): void;
|
|
16
|
+
}
|
|
17
|
+
export interface RendererEvents {
|
|
18
|
+
onRedraw(): void;
|
|
19
|
+
}
|
|
20
|
+
export type RendererFactory<T extends Annotation> = (container: HTMLElement, state: AnnotatorState<T, any>, viewport: ViewportState) => Renderer;
|
|
21
|
+
/**
|
|
22
|
+
* A utility interface. Instead of implementing a Renderer from scratch,
|
|
23
|
+
* implementers can simply implement a painter, and wrap it in the
|
|
24
|
+
* BaseRenderer, which will handle common concerns.
|
|
25
|
+
*/
|
|
26
|
+
export interface Painter {
|
|
27
|
+
destroy(): void;
|
|
28
|
+
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, styleOverrides?: Map<string, HighlightStyleExpression>, force?: boolean): void;
|
|
29
|
+
setVisible(visible: boolean): void;
|
|
30
|
+
}
|
|
31
|
+
export declare const createRenderer: <T extends TextAnnotatorState = TextAnnotatorState<TextAnnotation, any>>(painter: Painter, container: HTMLElement, state: T, viewport: ViewportState) => Renderer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AnnotationState, Color, DrawingStyle } from '@annotorious/core';
|
|
2
|
+
import type { TextAnnotation } from '../model';
|
|
3
|
+
import type { Highlight } from './';
|
|
4
|
+
export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity'> {
|
|
5
|
+
underlineStyle?: string;
|
|
6
|
+
underlineColor?: Color;
|
|
7
|
+
underlineOffset?: number;
|
|
8
|
+
underlineThickness?: number;
|
|
9
|
+
}
|
|
10
|
+
export type HighlightStyleExpression = HighlightStyle | (<I extends TextAnnotation = TextAnnotation>(annotation: I, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
|
|
11
|
+
export declare const DEFAULT_STYLE: HighlightStyle;
|
|
12
|
+
export declare const DEFAULT_SELECTED_STYLE: HighlightStyle;
|
|
13
|
+
export declare const getBackgroundColor: (style?: HighlightStyle) => string;
|
|
14
|
+
export declare const computeStyle: (highlight: Highlight, style?: HighlightStyleExpression, z?: number) => HighlightStyle;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TextAnnotation } from '../../model';
|
|
2
|
+
import { type Painter, type RendererFactory } from '../';
|
|
3
|
+
/**
|
|
4
|
+
* EXPERIMENTAL!
|
|
5
|
+
*/
|
|
6
|
+
export declare const createCSSHighlightPainter: () => Painter;
|
|
7
|
+
export declare const createCSSHighlightRenderer: RendererFactory<TextAnnotation>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './css-highlight-renderer';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spans-renderer';
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Filter, Lifecycle, User } from '@annotorious/core';
|
|
2
|
+
import type { TextAnnotatorState } from './state';
|
|
3
|
+
import type { TextAnnotation } from './model';
|
|
4
|
+
import type { AnnotatingMode } from './text-annotator';
|
|
5
|
+
import type { TextAnnotatorOptions } from './text-annotator-options';
|
|
6
|
+
export declare const createSelectionHandler: <T extends TextAnnotation>(container: HTMLElement, state: TextAnnotatorState<TextAnnotation, any>, lifecycle: Lifecycle<TextAnnotation, any>, options: TextAnnotatorOptions<TextAnnotation, any>) => {
|
|
7
|
+
destroy: () => void;
|
|
8
|
+
setFilter: (filter?: Filter<any>) => Filter<any>;
|
|
9
|
+
setUser: (user?: User) => User;
|
|
10
|
+
setAnnotatingEnabled: (enabled: boolean) => void;
|
|
11
|
+
setAnnotatingMode: (mode?: AnnotatingMode) => AnnotatingMode;
|
|
12
|
+
};
|
package/dist/state/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './text-annotation-store';
|
|
2
|
+
export * from './text-annotator-state';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Store } from '@annotorious/core';
|
|
2
|
+
import { type Unsubscribe } from 'nanoevents';
|
|
3
|
+
import type { TextAnnotationLike, TextAnnotationTarget } from '../model';
|
|
4
|
+
import type { AnnotationRects } from '../state/text-annotation-store';
|
|
5
|
+
interface IndexedHighlightRect {
|
|
6
|
+
minX: number;
|
|
7
|
+
minY: number;
|
|
8
|
+
maxX: number;
|
|
9
|
+
maxY: number;
|
|
10
|
+
annotation: {
|
|
11
|
+
id: string;
|
|
12
|
+
rects: DOMRect[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface SpatialTreeEvents {
|
|
16
|
+
recalculate(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const createSpatialTree: <T extends TextAnnotationLike>(store: Store<T>, container: HTMLElement, hMergeTolerance?: number, vMergeTolerance?: number) => {
|
|
19
|
+
all: () => IndexedHighlightRect[][];
|
|
20
|
+
clear: () => void;
|
|
21
|
+
getAt: (x: number, y: number, all?: boolean) => string[];
|
|
22
|
+
getAnnotationBounds: (id: string) => DOMRect | undefined;
|
|
23
|
+
getAnnotationRects: (id: string) => DOMRect[];
|
|
24
|
+
getIntersecting: (minX: number, minY: number, maxX: number, maxY: number) => AnnotationRects<T>[];
|
|
25
|
+
insert: (target: TextAnnotationTarget) => void;
|
|
26
|
+
recalculate: () => void;
|
|
27
|
+
remove: (target: TextAnnotationTarget) => void;
|
|
28
|
+
set: (targets: TextAnnotationTarget[], replace?: boolean) => void;
|
|
29
|
+
size: () => number;
|
|
30
|
+
update: (target: TextAnnotationTarget) => void;
|
|
31
|
+
on: <E extends keyof SpatialTreeEvents>(event: E, callback: SpatialTreeEvents[E]) => Unsubscribe;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Unsubscribe } from 'nanoevents';
|
|
2
|
+
import type { Filter, Origin, Store } from '@annotorious/core';
|
|
3
|
+
import type { TextAnnotation, TextAnnotationLike } from '../model';
|
|
4
|
+
import type { SpatialTreeEvents } from '../state/spatial-tree';
|
|
5
|
+
export interface TextAnnotationStore<T extends TextAnnotationLike = TextAnnotation> extends Omit<Store<T>, 'addAnnotation' | 'bulkAddAnnotations' | 'bulkUpsertAnnotations'> {
|
|
6
|
+
addAnnotation(annotation: T, origin?: Origin): boolean;
|
|
7
|
+
bulkAddAnnotations(annotations: T[], replace: boolean, origin?: Origin): T[];
|
|
8
|
+
bulkUpsertAnnotations(annotations: T[], origin?: Origin): T[];
|
|
9
|
+
getAnnotationRects(id: string): DOMRect[];
|
|
10
|
+
getAnnotationBounds(id: string): DOMRect | undefined;
|
|
11
|
+
getAnnotationRects(id: string): DOMRect[];
|
|
12
|
+
getAt(x: number, y: number, all: true, filter?: Filter): T[] | undefined;
|
|
13
|
+
getAt(x: number, y: number, all: false, filter?: Filter): T | undefined;
|
|
14
|
+
getAt(x: number, y: number, all?: boolean, filter?: Filter): T | T[] | undefined;
|
|
15
|
+
getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
|
|
16
|
+
recalculatePositions(): void;
|
|
17
|
+
onRecalculatePositions(callback: SpatialTreeEvents['recalculate']): Unsubscribe;
|
|
18
|
+
}
|
|
19
|
+
export interface AnnotationRects<T extends TextAnnotationLike = TextAnnotation> {
|
|
20
|
+
annotation: T;
|
|
21
|
+
rects: Rect[];
|
|
22
|
+
}
|
|
23
|
+
export interface Rect {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViewportState } from '@annotorious/core';
|
|
2
|
+
import type { AnnotatorState, SelectionState, HoverState } from '@annotorious/core';
|
|
3
|
+
import type { TextAnnotation, TextAnnotationLike } from '../model';
|
|
4
|
+
import type { TextAnnotationStore } from '../state/text-annotation-store';
|
|
5
|
+
import type { TextAnnotatorOptions } from '../text-annotator-options';
|
|
6
|
+
export interface TextAnnotatorState<I extends TextAnnotationLike = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<AnnotatorState<I, E>, 'store'> {
|
|
7
|
+
store: TextAnnotationStore<I>;
|
|
8
|
+
selection: SelectionState<I, E>;
|
|
9
|
+
hover: HoverState<I>;
|
|
10
|
+
viewport: ViewportState;
|
|
11
|
+
}
|
|
12
|
+
export declare const createTextAnnotatorState: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, opts: TextAnnotatorOptions<I, E>) => TextAnnotatorState<I, E>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FormatAdapter, UserSelectActionExpression, User } from '@annotorious/core';
|
|
2
|
+
import type { HighlightStyleExpression, RendererFactory } from './rendering';
|
|
3
|
+
import type { TextAnnotation, TextAnnotationLike } from './model';
|
|
4
|
+
export interface TextAnnotatorOptions<I extends TextAnnotationLike = TextAnnotation, E extends unknown = TextAnnotation> {
|
|
5
|
+
adapter?: FormatAdapter<I, E>;
|
|
6
|
+
allowModifierSelect?: boolean;
|
|
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
|
+
renderer?: RendererType | RendererFactory<I>;
|
|
26
|
+
selectionMode?: 'shortest' | 'all';
|
|
27
|
+
style?: HighlightStyleExpression;
|
|
28
|
+
user?: User;
|
|
29
|
+
userSelectAction?: UserSelectActionExpression<E>;
|
|
30
|
+
}
|
|
31
|
+
export type RendererType = 'SPANS' | 'CSS_HIGHLIGHTS';
|
|
32
|
+
export type DismissOnNotAnnotatableExpression = 'NEVER' | 'ALWAYS' | ((event: Event, container: HTMLElement) => boolean);
|
|
33
|
+
export declare const fillDefaults: <I extends TextAnnotationLike = TextAnnotation, E extends unknown = TextAnnotation>(opts: TextAnnotatorOptions<I, E>, defaults: TextAnnotatorOptions<I, E>) => TextAnnotatorOptions<I, E>;
|
package/dist/text-annotator.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.r6o-
|
|
1
|
+
.r6o-annotatable .r6o-span-highlight-layer{position:absolute;top:0;left:0;width:100%;height:100%;mix-blend-mode:multiply;pointer-events:none;overflow:hidden;user-select:none;-webkit-user-select:none;z-index:1}.r6o-annotatable .r6o-span-highlight-layer.hidden{display:none}.r6o-annotatable .r6o-span-highlight-layer .r6o-annotation{position:absolute;display:block;border-style:solid;border-width:0;box-sizing:content-box}html,body{overscroll-behavior-y:none}.r6o-annotatable{position:relative;-webkit-tap-highlight-color:transparent}.r6o-annotatable.no-focus-outline{outline:none}.hovered *{cursor:pointer}*::selection,::selection{background:#0080ff2e}::-moz-selection{background:#0080ff2e}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Annotator } from '@annotorious/core';
|
|
2
|
+
import type { HighlightStyleExpression, Renderer } from './rendering';
|
|
3
|
+
import type { TextAnnotation, TextAnnotationLike } from './model';
|
|
4
|
+
import { type TextAnnotatorState } from './state';
|
|
5
|
+
import { type TextAnnotatorOptions } from './text-annotator-options';
|
|
6
|
+
import './text-annotator.css';
|
|
7
|
+
export interface TextAnnotator<I extends TextAnnotationLike = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<Annotator<I, E>, 'setStyle' | 'state'> {
|
|
8
|
+
element: HTMLElement;
|
|
9
|
+
renderer: Renderer;
|
|
10
|
+
setStyle(style?: HighlightStyleExpression, id?: string): void;
|
|
11
|
+
scrollIntoView(annotationOrId: I | string, scrollParentOrId?: string | Element): boolean;
|
|
12
|
+
setAnnotatingEnabled(enabled?: boolean): void;
|
|
13
|
+
setAnnotatingMode(mode?: AnnotatingMode): void;
|
|
14
|
+
state: TextAnnotatorState<I, E>;
|
|
15
|
+
}
|
|
16
|
+
export type AnnotatingMode = 'CREATE_NEW' | 'ADD_TO_CURRENT' | 'REPLACE_CURRENT';
|
|
17
|
+
export declare const createTextAnnotator: <I extends TextAnnotationLike = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<I, E>) => TextAnnotator<I, E>;
|