@soomo/text-annotator 3.0.0-staging.52 → 3.0.0-staging.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.
@@ -3,12 +3,12 @@ import { HighlightStyleExpression } from './highlight';
3
3
  import { TextAnnotatorState } from './state';
4
4
  import { TextAnnotation } from './model';
5
5
  import { TextAnnotatorOptions } from './TextAnnotatorOptions';
6
- export interface TextAnnotator<E extends unknown = TextAnnotation> extends Annotator<TextAnnotation, E> {
6
+ export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Annotator<TextAnnotation, E> {
7
7
  element: HTMLElement;
8
8
  setStyle(style: HighlightStyleExpression | undefined): void;
9
9
  redraw(force?: boolean): void;
10
- scrollIntoView(annotation: TextAnnotation): boolean;
10
+ scrollIntoView(annotation: I): boolean;
11
11
  setAnnotatingEnabled: (enabled: boolean) => void;
12
12
  state: TextAnnotatorState;
13
13
  }
14
- export declare const createTextAnnotator: <E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<E>) => TextAnnotator<E>;
14
+ export declare const createTextAnnotator: <E extends unknown = TextAnnotation>(container: HTMLElement, options?: TextAnnotatorOptions<TextAnnotation, E>) => TextAnnotator<TextAnnotation, E>;
@@ -2,8 +2,8 @@ import { FormatAdapter, UserSelectActionExpression, User } from '@annotorious/co
2
2
  import { PresencePainterOptions } from './presence';
3
3
  import { TextAnnotation } from './model';
4
4
  import { HighlightStyleExpression } from './highlight';
5
- export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {
6
- adapter?: FormatAdapter<TextAnnotation, T> | null;
5
+ export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> {
6
+ adapter?: FormatAdapter<I, E> | null;
7
7
  annotatingEnabled?: boolean;
8
8
  renderer?: RendererType;
9
9
  offsetReferenceSelector?: string;
@@ -13,4 +13,4 @@ export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {
13
13
  user?: User;
14
14
  }
15
15
  export type RendererType = 'SPANS' | 'CANVAS' | 'CSS_HIGHLIGHTS';
16
- export declare const fillDefaults: <T extends unknown = TextAnnotation>(opts: TextAnnotatorOptions<T>, defaults: TextAnnotatorOptions<T>) => TextAnnotatorOptions<T>;
16
+ export declare const fillDefaults: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(opts: TextAnnotatorOptions<I, E>, defaults: TextAnnotatorOptions<I, E>) => TextAnnotatorOptions<I, E>;
@@ -17,4 +17,4 @@ export interface Renderer {
17
17
  setPainter(painter?: HighlightPainter): void;
18
18
  setVisible(visible: boolean): void;
19
19
  }
20
- export declare const createBaseRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState, renderer: RendererImplementation) => Renderer;
20
+ export declare const createBaseRenderer: <T extends TextAnnotatorState = TextAnnotatorState<import('..').TextAnnotation>>(container: HTMLElement, state: T, viewport: ViewportState, renderer: RendererImplementation) => Renderer;
@@ -1,3 +1,3 @@
1
1
  import { ViewportState } from '@annotorious/core';
2
2
  import { TextAnnotatorState } from '../../state';
3
- export declare const createSpansRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => import('../baseRenderer').Renderer;
3
+ export declare const createSpansRenderer: <T extends TextAnnotatorState = TextAnnotatorState<import('../..').TextAnnotation>>(container: HTMLElement, state: T, viewport: ViewportState) => import('../baseRenderer').Renderer;
@@ -3,7 +3,8 @@ export * from './model';
3
3
  export * from './state';
4
4
  export * from './utils';
5
5
  export * from './presence/PresencePainterOptions';
6
+ export * from './SelectionHandler';
6
7
  export * from './TextAnnotator';
7
8
  export * from './TextAnnotatorOptions';
8
- export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Color, Filter, FormatAdapter, HoverState, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, ParseResult, User, UserSelectActionExpression, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
9
+ export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Color, Filter, FormatAdapter, HoverState, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, ParseResult, User, UserSelectActionExpression, ViewportState, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
9
10
  export { createBody, Origin, UserSelectAction } from '@annotorious/core';
@@ -2,19 +2,20 @@ import { Unsubscribe } from 'nanoevents';
2
2
  import { Filter, Origin, Store } from '@annotorious/core';
3
3
  import { TextAnnotation } from '../model';
4
4
  import { SpatialTreeEvents } from './spatialTree';
5
- export interface TextAnnotationStore extends Omit<Store<TextAnnotation>, 'addAnnotation' | 'bulkAddAnnotation'> {
6
- addAnnotation(annotation: TextAnnotation, origin?: Origin): boolean;
7
- bulkAddAnnotation(annotations: TextAnnotation[], replace: boolean, origin?: Origin): TextAnnotation[];
8
- bulkUpsertAnnotations(annotations: TextAnnotation[], origin?: Origin): TextAnnotation[];
5
+ export interface TextAnnotationStore<T extends TextAnnotation = TextAnnotation> extends Omit<Store<T>, 'addAnnotation' | 'bulkAddAnnotation'> {
6
+ addAnnotation(annotation: T, origin?: Origin): boolean;
7
+ bulkAddAnnotation(annotations: T[], replace: boolean, origin?: Origin): T[];
8
+ bulkUpsertAnnotations(annotations: T[], origin?: Origin): T[];
9
9
  getAnnotationRects(id: string): DOMRect[];
10
10
  getAnnotationBounds(id: string, hintX?: number, hintY?: number, buffer?: number): DOMRect | undefined;
11
+ getAnnotationRects(id: string): DOMRect[];
11
12
  getAt(x: number, y: number, filter?: Filter): TextAnnotation | undefined;
12
- getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects[];
13
+ getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
13
14
  recalculatePositions(): void;
14
15
  onRecalculatePositions(callback: SpatialTreeEvents['recalculate']): Unsubscribe;
15
16
  }
16
- export interface AnnotationRects {
17
- annotation: TextAnnotation;
17
+ export interface AnnotationRects<T extends TextAnnotation = TextAnnotation> {
18
+ annotation: T;
18
19
  rects: Rect[];
19
20
  }
20
21
  export interface Rect {
@@ -1,8 +1,8 @@
1
1
  import { ViewportState, UserSelectActionExpression, AnnotatorState, SelectionState, HoverState } from '@annotorious/core';
2
2
  import { TextAnnotation } from '../model';
3
3
  import { TextAnnotationStore } from './TextAnnotationStore';
4
- export interface TextAnnotatorState extends AnnotatorState<TextAnnotation> {
5
- store: TextAnnotationStore;
4
+ export interface TextAnnotatorState<T extends TextAnnotation = TextAnnotation> extends AnnotatorState<T> {
5
+ store: TextAnnotationStore<T>;
6
6
  selection: SelectionState<TextAnnotation>;
7
7
  hover: HoverState<TextAnnotation>;
8
8
  viewport: ViewportState;
@@ -1,7 +1,7 @@
1
1
  export * from './cancelSingleClickEvents';
2
2
  export * from './programmaticallyFocusable';
3
+ export * from './debounce';
3
4
  export * from './getAnnotatableFragment';
4
- export * from './getClientRectsPonyfill';
5
5
  export * from './getQuoteContext';
6
6
  export * from './isWhitespaceOrEmpty';
7
7
  export * from './isRevived';
@@ -12,6 +12,5 @@ export * from './reviveSelector';
12
12
  export * from './reviveTarget';
13
13
  export * from './splitAnnotatableRanges';
14
14
  export * from './trimRangeToContainer';
15
- export * from './debounce';
16
15
  export * from './normalizeRects';
17
16
  export * from './cloneEvents';
@@ -1 +1 @@
1
- .r6o-canvas-highlight-layer{position:fixed;top:0;bottom:0;left:0;width:100vw;height:100vh;pointer-events:none}.r6o-canvas-highlight-layer.bg{mix-blend-mode:multiply;z-index:1}.r6o-annotatable .r6o-span-highlight-layer{position:absolute;top:0;left:0;width:100%;height:100%;mix-blend-mode:multiply;pointer-events:none;z-index:1}.r6o-annotatable .r6o-span-highlight-layer.hidden{display:none}.r6o-annotatable .r6o-span-highlight-layer .r6o-annotation{border-style:solid;border-width:0;box-sizing:content-box;display:block;position:absolute}.r6o-annotation{box-sizing:content-box}.r6o-presence-layer{left:0;position:fixed;top:0;bottom:0;width:100vw;pointer-events:none}html,body{overscroll-behavior-y:none}.r6o-annotatable{position:relative;-webkit-tap-highlight-color:transparent}.r6o-annotatable.no-focus-outline{outline:none}.hovered *{cursor:pointer}*::selection,::selection{background:#0080ff2e}::-moz-selection{background:#0080ff2e}
1
+ .r6o-canvas-highlight-layer{position:fixed;top:0;bottom:0;left:0;width:100vw;height:100vh;pointer-events:none}.r6o-canvas-highlight-layer.bg{mix-blend-mode:multiply;z-index:1}.r6o-annotatable .r6o-span-highlight-layer{position:absolute;top:0;left:0;width:100%;height:100%;mix-blend-mode:multiply;pointer-events:none;z-index:1}.r6o-annotatable .r6o-span-highlight-layer.hidden{display:none}.r6o-annotatable .r6o-span-highlight-layer .r6o-annotation{position:absolute;display:block;border-style:solid;border-width:0;box-sizing:content-box}.r6o-presence-layer{left:0;position:fixed;top:0;bottom:0;width:100vw;pointer-events:none}html,body{overscroll-behavior-y:none}.r6o-annotatable{position:relative;-webkit-tap-highlight-color:transparent}.r6o-annotatable.no-focus-outline{outline:none}.hovered *{cursor:pointer}*::selection,::selection{background:#0080ff2e}::-moz-selection{background:#0080ff2e}