@soomo/text-annotator 3.0.0-staging.32 → 3.0.0-staging.34

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,8 +1,9 @@
1
1
  import { Filter, User } from '@annotorious/core';
2
2
  import { TextAnnotatorState } from './state';
3
3
 
4
- export declare const SelectionHandler: (container: HTMLElement, state: TextAnnotatorState, annotatingEnabled: boolean, offsetReferenceSelector?: string) => {
4
+ export declare const createSelectionHandler: (container: HTMLElement, state: TextAnnotatorState, offsetReferenceSelector?: string) => {
5
5
  destroy: () => void;
6
6
  setFilter: (filter?: Filter) => Filter;
7
7
  setUser: (user?: User) => User;
8
+ setAnnotatingEnabled: (enabled: boolean) => boolean;
8
9
  };
@@ -9,6 +9,7 @@ export interface TextAnnotator<E extends unknown = TextAnnotation> extends Annot
9
9
  setStyle(style: HighlightStyleExpression | undefined): void;
10
10
  redraw(force?: boolean): void;
11
11
  scrollIntoView(annotation: TextAnnotation): boolean;
12
+ setAnnotatingEnabled: (enabled: boolean) => void;
12
13
  state: TextAnnotatorState;
13
14
  }
14
15
  export declare const createTextAnnotator: <E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<E>) => TextAnnotator<E>;
@@ -8,7 +8,7 @@ export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {
8
8
  annotatingEnabled?: boolean;
9
9
  renderer?: RendererType;
10
10
  offsetReferenceSelector?: string;
11
- userAction?: UserSelectActionExpression<TextAnnotation>;
11
+ userSelectAction?: UserSelectActionExpression<TextAnnotation>;
12
12
  presence?: PresencePainterOptions;
13
13
  style?: HighlightStyleExpression;
14
14
  user?: User;
@@ -1,5 +1,7 @@
1
+ import { Unsubscribe } from 'nanoevents';
1
2
  import { Filter, Origin, Store } from '@annotorious/core';
2
3
  import { TextAnnotation } from '../model';
4
+ import { SpatialTreeEvents } from './spatialTree';
3
5
 
4
6
  export interface TextAnnotationStore extends Omit<Store<TextAnnotation>, 'addAnnotation' | 'bulkAddAnnotation'> {
5
7
  addAnnotation(annotation: TextAnnotation, origin?: Origin): boolean;
@@ -10,6 +12,7 @@ export interface TextAnnotationStore extends Omit<Store<TextAnnotation>, 'addAnn
10
12
  getAt(x: number, y: number, filter?: Filter): TextAnnotation | undefined;
11
13
  getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects[];
12
14
  recalculatePositions(): void;
15
+ onRecalculatePositions(callback: SpatialTreeEvents['recalculate']): Unsubscribe;
13
16
  }
14
17
  export interface AnnotationRects {
15
18
  annotation: TextAnnotation;
@@ -8,4 +8,4 @@ export interface TextAnnotatorState extends AnnotatorState<TextAnnotation> {
8
8
  hover: HoverState<TextAnnotation>;
9
9
  viewport: ViewportState;
10
10
  }
11
- export declare const createTextAnnotatorState: (container: HTMLElement, defaultUserAction?: UserSelectActionExpression<TextAnnotation>) => TextAnnotatorState;
11
+ export declare const createTextAnnotatorState: (container: HTMLElement, defaultUserSelectAction?: UserSelectActionExpression<TextAnnotation>) => TextAnnotatorState;
@@ -1,4 +1,5 @@
1
1
  import { Store } from '@annotorious/core';
2
+ import { Unsubscribe } from 'nanoevents';
2
3
  import { TextAnnotation, TextAnnotationTarget } from '../model';
3
4
  import { AnnotationRects } from './TextAnnotationStore';
4
5
 
@@ -12,6 +13,9 @@ interface IndexedHighlightRect {
12
13
  rects: DOMRect[];
13
14
  };
14
15
  }
16
+ export interface SpatialTreeEvents {
17
+ recalculate(): void;
18
+ }
15
19
  export declare const createSpatialTree: (store: Store<TextAnnotation>, container: HTMLElement) => {
16
20
  all: () => IndexedHighlightRect[][];
17
21
  clear: () => void;
@@ -25,5 +29,6 @@ export declare const createSpatialTree: (store: Store<TextAnnotation>, container
25
29
  set: (targets: TextAnnotationTarget[], replace?: boolean) => void;
26
30
  size: () => number;
27
31
  update: (target: TextAnnotationTarget) => void;
32
+ on: <E extends keyof SpatialTreeEvents>(event: E, callback: SpatialTreeEvents[E]) => Unsubscribe;
28
33
  };
29
34
  export {};