@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type User } from '@annotorious/core';
|
|
2
2
|
import type { TextAnnotatorState } from './state';
|
|
3
|
+
import type { TextSelector } from './model';
|
|
4
|
+
export declare const rangeToSelector: (range: Range, container: HTMLElement, offsetReferenceSelector?: string) => TextSelector;
|
|
3
5
|
export declare const SelectionHandler: (container: HTMLElement, state: TextAnnotatorState, offsetReferenceSelector?: string) => {
|
|
4
|
-
destroy: () => void;
|
|
5
6
|
setUser: (user: User) => User;
|
|
6
7
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Annotator } from '@annotorious/core';
|
|
2
2
|
import type { TextAnnotation } from './model';
|
|
3
3
|
import type { TextAnnotatorOptions } from './TextAnnotatorOptions';
|
|
4
|
-
import './TextAnnotator.css';
|
|
5
4
|
export interface TextAnnotator<T extends unknown = TextAnnotation> extends Annotator<TextAnnotation, T> {
|
|
6
5
|
element: HTMLElement;
|
|
7
6
|
scrollIntoView(annotation: TextAnnotation): boolean;
|
|
@@ -3,7 +3,6 @@ import type { PresencePainterOptions } from './presence';
|
|
|
3
3
|
import type { TextAnnotation } from './model';
|
|
4
4
|
export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {
|
|
5
5
|
adapter?: FormatAdapter<TextAnnotation, T> | null;
|
|
6
|
-
experimentalCSSRenderer?: boolean;
|
|
7
6
|
offsetReferenceSelector?: string;
|
|
8
7
|
pointerAction?: PointerSelectAction | ((annotation: TextAnnotation) => PointerSelectAction);
|
|
9
8
|
presence?: PresencePainterOptions;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { TextAnnotationStore } from '
|
|
2
|
-
import type { TextAnnotation } from '../model';
|
|
1
|
+
import type { TextAnnotationStore } from 'src/state';
|
|
2
|
+
import type { TextAnnotation } from '../model/TextAnnotation';
|
|
3
3
|
export declare const scrollIntoView: (container: HTMLElement, store: TextAnnotationStore) => (annotation: TextAnnotation) => boolean;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { DrawingStyle } from '@annotorious/core';
|
|
2
|
+
import type { TextAnnotation } from '../model';
|
|
3
|
+
import type { Rect } from '../state';
|
|
4
|
+
/**
|
|
5
|
+
* A painter implements the actual CANVAS highlight drawing logic.
|
|
6
|
+
*/
|
|
7
|
+
export type HighlightPainter = {
|
|
8
|
+
paint(annotation: TextAnnotation, rects: Rect[], bg: CanvasRenderingContext2D, fg: CanvasRenderingContext2D, isSelected?: boolean, style?: DrawingStyle | ((annotation: TextAnnotation, selected?: boolean) => DrawingStyle)): void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The default painter.
|
|
12
|
+
*/
|
|
13
|
+
export declare const defaultPainter: HighlightPainter;
|
|
14
|
+
export interface HighlightStyle {
|
|
15
|
+
fill?: string;
|
|
16
|
+
fillOpacity?: number;
|
|
17
|
+
underline?: string;
|
|
18
|
+
underlineOpacity?: number;
|
|
19
|
+
underlineWidth?: number;
|
|
9
20
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 createHighlightLayer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => {
|
|
6
|
+
redraw: () => number;
|
|
7
|
+
setDrawingStyle: (style: DrawingStyle | ((a: TextAnnotation, selected?: boolean) => DrawingStyle)) => void;
|
|
8
|
+
setFilter: (filter?: Filter) => void;
|
|
9
|
+
setPainter: (painter: HighlightPainter) => HighlightPainter;
|
|
10
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './highlightLayer';
|
|
2
|
+
export * from './HighlightPainter';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from './highlight';
|
|
2
2
|
export * from './model';
|
|
3
3
|
export * from './state';
|
|
4
|
-
export * from './utils';
|
|
5
4
|
export * from './presence/PresencePainterOptions';
|
|
6
5
|
export * from './TextAnnotator';
|
|
7
6
|
export * from './TextAnnotatorOptions';
|
|
8
|
-
export
|
|
9
|
-
import { Origin as _Origin } from '@annotorious/core';
|
|
10
|
-
export
|
|
7
|
+
export * from '@annotorious/core/src/model';
|
|
8
|
+
import { Origin as _Origin } from '@annotorious/core/src/state';
|
|
9
|
+
export declare const Origin: typeof _Origin;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './w3c';
|
|
1
|
+
export * from './TextAnnotation';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PresenceProvider } from '@annotorious/core';
|
|
2
|
-
import type { HighlightPainter } from '../highlight
|
|
3
|
-
import type { PresencePainterOptions } from '
|
|
4
|
-
export declare const
|
|
2
|
+
import type { HighlightPainter } from '../highlight';
|
|
3
|
+
import type { PresencePainterOptions } from './PresencePainterOptions';
|
|
4
|
+
export declare const createPainter: (provider: PresenceProvider, opts?: PresencePainterOptions) => HighlightPainter;
|
|
@@ -3,7 +3,6 @@ import type { TextAnnotation } from '../model';
|
|
|
3
3
|
export interface TextAnnotationStore extends Omit<Store<TextAnnotation>, 'addAnnotation' | 'bulkAddAnnotation'> {
|
|
4
4
|
addAnnotation(annotation: TextAnnotation, origin: Origin): boolean;
|
|
5
5
|
bulkAddAnnotation(annotations: TextAnnotation[], replace: boolean, origin: Origin): TextAnnotation[];
|
|
6
|
-
bulkUpsertAnnotations(annotations: TextAnnotation[], origin: Origin): TextAnnotation[];
|
|
7
6
|
getAnnotationBounds(id: string, hintX?: number, hintY?: number, buffer?: number): DOMRect;
|
|
8
7
|
getAt(x: number, y: number): TextAnnotation | undefined;
|
|
9
8
|
getIntersecting(minX: number, minY: number, maxX: number, maxY: number): TextAnnotation[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextAnnotationTarget } from '../model';
|
|
2
|
+
/**
|
|
3
|
+
* Recalculates the DOM range from the given text annotation target.
|
|
4
|
+
*
|
|
5
|
+
* @param annotation the text annotation
|
|
6
|
+
* @param container the HTML container of the annotated content
|
|
7
|
+
* @returns the DOM range
|
|
8
|
+
*/
|
|
9
|
+
export declare const reviveTarget: (target: TextAnnotationTarget, container: HTMLElement) => TextAnnotationTarget;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export * from './debounce';
|
|
2
|
-
export * from './getAnnotatableFragment';
|
|
3
1
|
export * from './getClientRectsPonyfill';
|
|
4
|
-
export * from './getQuoteContext';
|
|
5
|
-
export * from './isRevived';
|
|
6
2
|
export * from './mergeClientRects';
|
|
7
|
-
export * from './rangeToSelector';
|
|
8
|
-
export * from './reviveAnnotation';
|
|
9
|
-
export * from './reviveSelector';
|
|
10
|
-
export * from './reviveTarget';
|
|
11
|
-
export * from './splitAnnotatableRanges';
|
|
12
3
|
export * from './trimRange';
|
package/dist/text-annotator.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
html,body{overscroll-behavior-y:none}.r6o-annotatable
|
|
1
|
+
html,body{overscroll-behavior-y:none}.r6o-annotatable,.r6o-annotatable *{position:relative}.r6o-annotatable.hovered{cursor:pointer}.r6o-highlight-layer{height:100vh;left:0;position:fixed;top:0;pointer-events:none;width:100vw}*::selection,::selection{background:rgba(0,128,255,.18)}::-moz-selection{background:rgba(0,128,255,.18)}
|