@recogito/text-annotator 3.0.0-rc.51 → 3.0.0-rc.53

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,7 +1,8 @@
1
1
  import { Filter, User } from '@annotorious/core';
2
2
  import { TextAnnotatorState } from './state';
3
3
  import { TextAnnotation } from './model';
4
- export declare const SelectionHandler: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, annotatingEnabled: boolean, offsetReferenceSelector?: string) => {
4
+ import { TextAnnotatorOptions } from './TextAnnotatorOptions';
5
+ export declare const SelectionHandler: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, options: TextAnnotatorOptions<TextAnnotation, unknown>) => {
5
6
  destroy: () => void;
6
7
  setFilter: (filter?: Filter) => Filter;
7
8
  setUser: (user?: User) => User;
@@ -9,6 +9,7 @@ export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation,
9
9
  offsetReferenceSelector?: string;
10
10
  userSelectAction?: UserSelectActionExpression<E>;
11
11
  presence?: PresencePainterOptions;
12
+ selectionMode?: 'shortest' | 'all';
12
13
  style?: HighlightStyleExpression;
13
14
  user?: User;
14
15
  }
@@ -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;
10
+ export declare const W3CTextFormat: <E extends W3CTextAnnotation = W3CTextAnnotation>(source: string, container: HTMLElement) => W3CTextFormatAdapter<TextAnnotation, E>;
11
11
  export declare const parseW3CTextAnnotation: (annotation: W3CTextAnnotation) => ParseResult<TextAnnotation>;
12
- export declare const serializeW3CTextAnnotation: (annotation: TextAnnotation, source: string, container: HTMLElement) => W3CTextAnnotation;
12
+ export declare const serializeW3CTextAnnotation: <E extends W3CTextAnnotation = W3CTextAnnotation>(annotation: TextAnnotation, source: string, container: HTMLElement) => E;
@@ -4,9 +4,12 @@ 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;
8
7
  getAnnotationRects(id: string): DOMRect[];
9
- getAt(x: number, y: number, filter?: Filter): T | undefined;
8
+ getAnnotationBounds(id: string): DOMRect | undefined;
9
+ getAnnotationRects(id: string): DOMRect[];
10
+ getAt(x: number, y: number, all: true, filter?: Filter): T[] | undefined;
11
+ getAt(x: number, y: number, all: false, filter?: Filter): T | undefined;
12
+ getAt(x: number, y: number, all?: boolean, filter?: Filter): T | T[] | undefined;
10
13
  getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
11
14
  recalculatePositions(): void;
12
15
  }
@@ -1 +1,2 @@
1
1
  export declare const mergeClientRects: (rects: DOMRect[]) => DOMRect[];
2
+ export declare const toDomRectList: (rects: DOMRect[]) => DOMRectList;