@recogito/text-annotator 3.4.0 → 3.4.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.
@@ -4,6 +4,7 @@ import type { TextAnnotation } from './model';
4
4
  import type { HighlightStyleExpression } from './highlight';
5
5
  export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> {
6
6
  adapter?: FormatAdapter<I, E> | null;
7
+ allowModifierSelect?: boolean;
7
8
  annotatingEnabled?: boolean;
8
9
  /**
9
10
  * Determines whether an active selection should be dismissed
@@ -1,5 +1,7 @@
1
+ import type { Unsubscribe } from 'nanoevents';
1
2
  import type { Filter, Origin, Store } from '@annotorious/core';
2
3
  import type { TextAnnotation } from '../model';
4
+ import type { SpatialTreeEvents } from './spatialTree';
3
5
  export interface TextAnnotationStore<T extends TextAnnotation = TextAnnotation> extends Omit<Store<T>, 'addAnnotation' | 'bulkAddAnnotation'> {
4
6
  addAnnotation(annotation: T, origin?: Origin): boolean;
5
7
  bulkAddAnnotations(annotations: T[], replace: boolean, origin?: Origin): T[];
@@ -12,6 +14,7 @@ export interface TextAnnotationStore<T extends TextAnnotation = TextAnnotation>
12
14
  getAt(x: number, y: number, all?: boolean, filter?: Filter): T | T[] | undefined;
13
15
  getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
14
16
  recalculatePositions(): void;
17
+ onRecalculatePositions(callback: SpatialTreeEvents['recalculate']): Unsubscribe;
15
18
  }
16
19
  export interface AnnotationRects<T extends TextAnnotation = TextAnnotation> {
17
20
  annotation: T;
@@ -1,4 +1,5 @@
1
1
  import type { Store } from '@annotorious/core';
2
+ import { type Unsubscribe } from 'nanoevents';
2
3
  import type { TextAnnotation, TextAnnotationTarget } from '../model';
3
4
  import type { AnnotationRects } from './TextAnnotationStore';
4
5
  interface IndexedHighlightRect {
@@ -11,6 +12,9 @@ interface IndexedHighlightRect {
11
12
  rects: DOMRect[];
12
13
  };
13
14
  }
15
+ export interface SpatialTreeEvents {
16
+ recalculate(): void;
17
+ }
14
18
  export declare const createSpatialTree: <T extends TextAnnotation>(store: Store<T>, container: HTMLElement, hMergeTolerance?: number, vMergeTolerance?: number) => {
15
19
  all: () => IndexedHighlightRect[][];
16
20
  clear: () => void;
@@ -24,5 +28,6 @@ export declare const createSpatialTree: <T extends TextAnnotation>(store: Store<
24
28
  set: (targets: TextAnnotationTarget[], replace?: boolean) => void;
25
29
  size: () => number;
26
30
  update: (target: TextAnnotationTarget) => void;
31
+ on: <E extends keyof SpatialTreeEvents>(event: E, callback: SpatialTreeEvents[E]) => Unsubscribe;
27
32
  };
28
33
  export {};