@recogito/text-annotator 3.0.0-rc.52 → 3.0.0-rc.54

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.
@@ -9,4 +9,4 @@ export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E exte
9
9
  scrollIntoView(annotationOrId: I | string): boolean;
10
10
  state: TextAnnotatorState<I, E>;
11
11
  }
12
- export declare const createTextAnnotator: <E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<TextAnnotation, E>) => TextAnnotator<TextAnnotation, E>;
12
+ export declare const createTextAnnotator: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<I, E>) => TextAnnotator<I, E>;
@@ -6,6 +6,6 @@ export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity
6
6
  underlineOffset?: number;
7
7
  underlineThickness?: number;
8
8
  }
9
- export type HighlightStyleExpression = HighlightStyle | ((annotation: TextAnnotation, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
9
+ export type HighlightStyleExpression = HighlightStyle | (<I extends TextAnnotation = TextAnnotation>(annotation: I, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
10
10
  export declare const DEFAULT_STYLE: HighlightStyle;
11
11
  export declare const DEFAULT_SELECTED_STYLE: HighlightStyle;
@@ -1,12 +1,12 @@
1
1
  import { FormatAdapter, ParseResult } from '@annotorious/core';
2
2
  import { TextAnnotation } from '../core';
3
3
  import { W3CTextAnnotation } from '../w3c';
4
- export type W3CTextFormatAdapter = FormatAdapter<TextAnnotation, W3CTextAnnotation>;
4
+ export type W3CTextFormatAdapter<I extends TextAnnotation = TextAnnotation, E extends W3CTextAnnotation = W3CTextAnnotation> = FormatAdapter<I, E>;
5
5
  /**
6
6
  * @param source - the IRI of the annotated content
7
7
  * @param container - the HTML container of the annotated content,
8
8
  * Required to locate the content's `range` within the DOM
9
9
  */
10
- export declare const W3CTextFormat: (source: string, container: HTMLElement) => W3CTextFormatAdapter;
11
- export declare const parseW3CTextAnnotation: (annotation: W3CTextAnnotation) => ParseResult<TextAnnotation>;
12
- export declare const serializeW3CTextAnnotation: (annotation: TextAnnotation, source: string, container: HTMLElement) => W3CTextAnnotation;
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;
@@ -4,7 +4,8 @@ export interface TextAnnotationStore<T extends TextAnnotation = TextAnnotation>
4
4
  addAnnotation(annotation: T, origin?: Origin): boolean;
5
5
  bulkAddAnnotation(annotations: T[], replace: boolean, origin?: Origin): T[];
6
6
  bulkUpsertAnnotations(annotations: T[], origin?: Origin): T[];
7
- getAnnotationBounds(id: string, hintX?: number, hintY?: number, buffer?: number): DOMRect;
7
+ getAnnotationRects(id: string): DOMRect[];
8
+ getAnnotationBounds(id: string): DOMRect | undefined;
8
9
  getAnnotationRects(id: string): DOMRect[];
9
10
  getAt(x: number, y: number, all: true, filter?: Filter): T[] | undefined;
10
11
  getAt(x: number, y: number, all: false, filter?: Filter): T | undefined;
@@ -1 +1,2 @@
1
1
  export declare const mergeClientRects: (rects: DOMRect[]) => DOMRect[];
2
+ export declare const toDomRectList: (rects: DOMRect[]) => DOMRectList;