@soomo/text-annotator 3.0.0-staging.57 → 3.0.0-staging.59

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,6 +9,6 @@ export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E exte
9
9
  redraw(force?: boolean): void;
10
10
  scrollIntoView(annotation: I): boolean;
11
11
  setAnnotatingEnabled: (enabled: boolean) => void;
12
- state: TextAnnotatorState;
12
+ state: TextAnnotatorState<I>;
13
13
  }
14
14
  export declare const createTextAnnotator: <E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<TextAnnotation, E>) => TextAnnotator<TextAnnotation, E>;
@@ -9,7 +9,7 @@ export interface TextAnnotationStore<T extends TextAnnotation = TextAnnotation>
9
9
  getAnnotationRects(id: string): DOMRect[];
10
10
  getAnnotationBounds(id: string, hintX?: number, hintY?: number, buffer?: number): DOMRect | undefined;
11
11
  getAnnotationRects(id: string): DOMRect[];
12
- getAt(x: number, y: number, filter?: Filter): TextAnnotation | undefined;
12
+ getAt(x: number, y: number, filter?: Filter): T | undefined;
13
13
  getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
14
14
  recalculatePositions(): void;
15
15
  onRecalculatePositions(callback: SpatialTreeEvents['recalculate']): Unsubscribe;
@@ -3,8 +3,8 @@ import { TextAnnotation } from '../model';
3
3
  import { TextAnnotationStore } from './TextAnnotationStore';
4
4
  export interface TextAnnotatorState<T extends TextAnnotation = TextAnnotation> extends AnnotatorState<T> {
5
5
  store: TextAnnotationStore<T>;
6
- selection: SelectionState<TextAnnotation>;
7
- hover: HoverState<TextAnnotation>;
6
+ selection: SelectionState<T>;
7
+ hover: HoverState<T>;
8
8
  viewport: ViewportState;
9
9
  }
10
- export declare const createTextAnnotatorState: (container: HTMLElement, defaultUserSelectAction?: UserSelectActionExpression<TextAnnotation>) => TextAnnotatorState;
10
+ export declare const createTextAnnotatorState: <T extends TextAnnotation>(container: HTMLElement, defaultUserSelectAction?: UserSelectActionExpression<TextAnnotation>) => TextAnnotatorState<T>;
@@ -15,13 +15,13 @@ interface IndexedHighlightRect {
15
15
  export interface SpatialTreeEvents {
16
16
  recalculate(): void;
17
17
  }
18
- export declare const createSpatialTree: (store: Store<TextAnnotation>, container: HTMLElement) => {
18
+ export declare const createSpatialTree: <T extends TextAnnotation>(store: Store<T>, container: HTMLElement) => {
19
19
  all: () => IndexedHighlightRect[][];
20
20
  clear: () => void;
21
21
  getAt: (x: number, y: number, all?: boolean) => string[];
22
22
  getAnnotationBounds: (id: string) => DOMRect;
23
23
  getAnnotationRects: (id: string) => DOMRect[];
24
- getIntersecting: (minX: number, minY: number, maxX: number, maxY: number) => AnnotationRects[];
24
+ getIntersecting: (minX: number, minY: number, maxX: number, maxY: number) => AnnotationRects<T>[];
25
25
  insert: (target: TextAnnotationTarget) => void;
26
26
  recalculate: () => void;
27
27
  remove: (target: TextAnnotationTarget) => void;
@@ -1,6 +1,5 @@
1
1
  export * from './cancelSingleClickEvents';
2
2
  export * from './programmaticallyFocusable';
3
- export * from './debounce';
4
3
  export * from './getAnnotatableFragment';
5
4
  export * from './getQuoteContext';
6
5
  export * from './isWhitespaceOrEmpty';
@@ -1,2 +1,2 @@
1
1
  import { TextAnnotation } from '../model';
2
- export declare const reviveAnnotation: (annotation: TextAnnotation, container: HTMLElement) => TextAnnotation;
2
+ export declare const reviveAnnotation: <T extends TextAnnotation>(annotation: T, container: HTMLElement) => T;
@@ -8,4 +8,4 @@ import { TextSelector } from '../model';
8
8
  *
9
9
  * @returns the revived selector
10
10
  */
11
- export declare const reviveSelector: (selector: TextSelector, container: HTMLElement) => TextSelector;
11
+ export declare const reviveSelector: <T extends TextSelector>(selector: T, container: HTMLElement) => T;
@@ -1,2 +1,2 @@
1
1
  import { TextAnnotationTarget } from '../model';
2
- export declare const reviveTarget: (target: TextAnnotationTarget, container: HTMLElement) => TextAnnotationTarget;
2
+ export declare const reviveTarget: <T extends TextAnnotationTarget = TextAnnotationTarget>(target: T, container: HTMLElement) => T;