@recogito/text-annotator 4.1.0 → 4.1.1

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.
@@ -1,6 +1,6 @@
1
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';
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
  /**
@@ -17,7 +17,7 @@ export interface Renderer {
17
17
  export interface RendererEvents {
18
18
  onRedraw(): void;
19
19
  }
20
- export type RendererFactory<T extends Annotation> = (container: HTMLElement, state: AnnotatorState<T, any>, viewport: ViewportState) => Renderer;
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
@@ -28,4 +28,4 @@ export interface Painter {
28
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 = TextAnnotatorState<TextAnnotation, any>>(painter: Painter, container: HTMLElement, state: T, viewport: ViewportState) => Renderer;
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 { TextAnnotation } from '../model';
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 = HighlightStyle | (<I extends TextAnnotation = TextAnnotation>(annotation: I, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
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 { TextAnnotation } from '../model';
2
+ import type { TextAnnotationLike } from '../model';
3
3
  import type { AnnotationRects } from '../state';
4
- export interface Highlight extends AnnotationRects<TextAnnotation> {
4
+ export interface Highlight extends AnnotationRects<TextAnnotationLike> {
5
5
  state: AnnotationState;
6
6
  }
@@ -1,4 +1,4 @@
1
- import type { TextAnnotation } from '../../model';
1
+ import type { TextAnnotationLike } from '../../model';
2
2
  import { type RendererFactory } from '../';
3
3
  import './spans-renderer.css';
4
- export declare const createSpansRenderer: RendererFactory<TextAnnotation>;
4
+ export declare const createSpansRenderer: RendererFactory<TextAnnotationLike>;
@@ -1,5 +1,5 @@
1
1
  import type { ViewportState } from '@annotorious/core';
2
- import type { TextAnnotation } from '../model';
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: TextAnnotation[]) => void;
12
+ export declare const trackViewport: (viewport: ViewportState) => (annotations: TextAnnotationLike[]) => void;
@@ -14,4 +14,4 @@ export interface TextAnnotator<I extends TextAnnotationLike = TextAnnotation, E
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 = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<I, E>) => TextAnnotator<I, E>;
17
+ export declare const createTextAnnotator: <I extends TextAnnotationLike = TextAnnotationLike, E extends unknown = TextAnnotationLike>(container: HTMLElement, options?: TextAnnotatorOptions<I, E>) => TextAnnotator<I, E>;