@soomo/text-annotator 4.1.2-staging.0 → 4.1.3-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/model/w3c/w3c-text-annotation.d.ts +2 -0
- package/dist/rendering/base-renderer.d.ts +8 -8
- package/dist/rendering/highlight-style.d.ts +2 -2
- package/dist/rendering/highlight.d.ts +2 -2
- package/dist/rendering/renderer-spans/spans-renderer.d.ts +2 -2
- package/dist/rendering/viewport.d.ts +2 -2
- package/dist/text-annotator-options.d.ts +1 -1
- package/dist/text-annotator.d.ts +3 -3
- package/dist/text-annotator.es.js +420 -417
- 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/package.json +1 -1
|
@@ -7,6 +7,8 @@ export interface W3CTextAnnotationTarget extends W3CAnnotationTarget {
|
|
|
7
7
|
selector: W3CTextSelector | W3CTextSelector[];
|
|
8
8
|
styleClass?: string;
|
|
9
9
|
scope?: string;
|
|
10
|
+
outdated?: boolean;
|
|
11
|
+
migrationPending?: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Matches the `Text Quote Selector` spec
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { type Unsubscribe } from 'nanoevents';
|
|
2
|
-
import { type
|
|
3
|
-
import type {
|
|
2
|
+
import { type Filter, type ViewportState } from '@annotorious/core';
|
|
3
|
+
import type { TextAnnotationLike } from '../model';
|
|
4
4
|
import type { TextAnnotatorState } from '../state';
|
|
5
5
|
import { type Highlight, type HighlightStyleExpression, type ViewportBounds } from './';
|
|
6
6
|
/**
|
|
7
7
|
* The renderer runtime interface.
|
|
8
8
|
*/
|
|
9
|
-
export interface Renderer
|
|
9
|
+
export interface Renderer {
|
|
10
10
|
destroy(): void;
|
|
11
11
|
on: <E extends keyof RendererEvents>(event: E, callback: RendererEvents[E]) => Unsubscribe;
|
|
12
12
|
redraw(force?: boolean): void;
|
|
13
|
-
setStyle(style?: HighlightStyleExpression
|
|
13
|
+
setStyle(style?: HighlightStyleExpression, id?: string): void;
|
|
14
14
|
setFilter(filter?: Filter<any>): void;
|
|
15
15
|
setVisible(visible: boolean): void;
|
|
16
16
|
}
|
|
17
17
|
export interface RendererEvents {
|
|
18
18
|
onRedraw(): void;
|
|
19
19
|
}
|
|
20
|
-
export type RendererFactory<T extends TextAnnotationLike> = (container: HTMLElement, state:
|
|
20
|
+
export type RendererFactory<T extends TextAnnotationLike> = (container: HTMLElement, state: TextAnnotatorState<T, any>, viewport: ViewportState) => Renderer;
|
|
21
21
|
/**
|
|
22
22
|
* A utility interface. Instead of implementing a Renderer from scratch,
|
|
23
23
|
* implementers can simply implement a painter, and wrap it in the
|
|
24
24
|
* BaseRenderer, which will handle common concerns.
|
|
25
25
|
*/
|
|
26
|
-
export interface Painter
|
|
26
|
+
export interface Painter {
|
|
27
27
|
destroy(): void;
|
|
28
|
-
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression
|
|
28
|
+
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, styleOverrides?: Map<string, HighlightStyleExpression>, force?: boolean): void;
|
|
29
29
|
setVisible(visible: boolean): void;
|
|
30
30
|
}
|
|
31
|
-
export declare const createRenderer: <T extends TextAnnotatorState
|
|
31
|
+
export declare const createRenderer: <T extends TextAnnotatorState<TextAnnotationLike, any>>(painter: Painter, container: HTMLElement, state: T, viewport: ViewportState) => Renderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnnotationState, Color, DrawingStyle } from '@annotorious/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextAnnotationLike } from '../model';
|
|
3
3
|
import type { Highlight } from './';
|
|
4
4
|
export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity'> {
|
|
5
5
|
underlineStyle?: string;
|
|
@@ -7,7 +7,7 @@ export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity
|
|
|
7
7
|
underlineOffset?: number;
|
|
8
8
|
underlineThickness?: number;
|
|
9
9
|
}
|
|
10
|
-
export type HighlightStyleExpression<I extends TextAnnotationLike =
|
|
10
|
+
export type HighlightStyleExpression = HighlightStyle | (<I extends TextAnnotationLike = TextAnnotationLike>(annotation: I, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
|
|
11
11
|
export declare const DEFAULT_STYLE: HighlightStyle;
|
|
12
12
|
export declare const DEFAULT_SELECTED_STYLE: HighlightStyle;
|
|
13
13
|
export declare const getBackgroundColor: (style?: HighlightStyle) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnnotationState } from '@annotorious/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextAnnotationLike } from '../model';
|
|
3
3
|
import type { AnnotationRects } from '../state';
|
|
4
|
-
export interface Highlight extends AnnotationRects<
|
|
4
|
+
export interface Highlight extends AnnotationRects<TextAnnotationLike> {
|
|
5
5
|
state: AnnotationState;
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextAnnotationLike } from '../../model';
|
|
2
2
|
import { type RendererFactory } from '../';
|
|
3
3
|
import './spans-renderer.css';
|
|
4
|
-
export declare const createSpansRenderer: RendererFactory<
|
|
4
|
+
export declare const createSpansRenderer: RendererFactory<TextAnnotationLike>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewportState } from '@annotorious/core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextAnnotationLike } from '../model';
|
|
3
3
|
export interface ViewportBounds {
|
|
4
4
|
top: number;
|
|
5
5
|
left: number;
|
|
@@ -9,4 +9,4 @@ export interface ViewportBounds {
|
|
|
9
9
|
maxY: number;
|
|
10
10
|
}
|
|
11
11
|
export declare const getViewportBounds: (container: HTMLElement) => ViewportBounds;
|
|
12
|
-
export declare const trackViewport: (viewport: ViewportState) => (annotations:
|
|
12
|
+
export declare const trackViewport: (viewport: ViewportState) => (annotations: TextAnnotationLike[]) => void;
|
|
@@ -24,7 +24,7 @@ export interface TextAnnotatorOptions<I extends TextAnnotationLike = TextAnnotat
|
|
|
24
24
|
offsetReferenceSelector?: string;
|
|
25
25
|
renderer?: RendererType | RendererFactory<I>;
|
|
26
26
|
selectionMode?: 'shortest' | 'all';
|
|
27
|
-
style?: HighlightStyleExpression
|
|
27
|
+
style?: HighlightStyleExpression;
|
|
28
28
|
user?: User;
|
|
29
29
|
userSelectAction?: UserSelectActionExpression<E>;
|
|
30
30
|
}
|
package/dist/text-annotator.d.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { type TextAnnotatorOptions } from './text-annotator-options';
|
|
|
6
6
|
import './text-annotator.css';
|
|
7
7
|
export interface TextAnnotator<I extends TextAnnotationLike = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<Annotator<I, E>, 'setStyle' | 'state'> {
|
|
8
8
|
element: HTMLElement;
|
|
9
|
-
renderer: Renderer
|
|
10
|
-
setStyle(style?: HighlightStyleExpression
|
|
9
|
+
renderer: Renderer;
|
|
10
|
+
setStyle(style?: HighlightStyleExpression, id?: string): void;
|
|
11
11
|
scrollIntoView(annotationOrId: I | string, scrollParentOrId?: string | Element): boolean;
|
|
12
12
|
setAnnotatingEnabled(enabled?: boolean): void;
|
|
13
13
|
setAnnotatingMode(mode?: AnnotatingMode): void;
|
|
14
14
|
state: TextAnnotatorState<I, E>;
|
|
15
15
|
}
|
|
16
16
|
export type AnnotatingMode = 'CREATE_NEW' | 'ADD_TO_CURRENT' | 'REPLACE_CURRENT';
|
|
17
|
-
export declare const createTextAnnotator: <I extends TextAnnotationLike =
|
|
17
|
+
export declare const createTextAnnotator: <I extends TextAnnotationLike = TextAnnotationLike, E extends unknown = TextAnnotationLike>(container: HTMLElement, options?: TextAnnotatorOptions<I, E>) => TextAnnotator<I, E>;
|