@recogito/text-annotator 3.0.0-rc.10 → 3.0.0-rc.11

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,3 +1,3 @@
1
1
  import { type TextAnnotationStore } from '../state';
2
- import type { TextAnnotation } from '../model/TextAnnotation';
2
+ import type { TextAnnotation } from '../model';
3
3
  export declare const scrollIntoView: (container: HTMLElement, store: TextAnnotationStore) => (annotation: TextAnnotation) => boolean;
@@ -3,6 +3,7 @@ import type { TextAnnotation } from '../model';
3
3
  import type { TextAnnotatorState } from '../state';
4
4
  import { type HighlightPainter } from './HighlightPainter';
5
5
  export declare const createHighlightLayer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => {
6
+ destroy: () => void;
6
7
  redraw: () => number;
7
8
  setDrawingStyle: (style: DrawingStyle | ((a: TextAnnotation, selected?: boolean) => DrawingStyle)) => void;
8
9
  setFilter: (filter?: Filter) => void;
@@ -0,0 +1 @@
1
+ export * from './TextAnnotation';
@@ -1 +1,2 @@
1
- export * from './TextAnnotation';
1
+ export * from './core';
2
+ export * from './w3c';
@@ -0,0 +1,33 @@
1
+ import type { W3CAnnotation, W3CAnnotationTarget } from '@annotorious/core';
2
+ export interface W3CTextAnnotation extends W3CAnnotation {
3
+ target: W3CTextAnnotationTarget | W3CTextAnnotationTarget[];
4
+ stylesheet?: W3CAnnotationStylesheet;
5
+ }
6
+ export interface W3CTextAnnotationTarget extends W3CAnnotationTarget {
7
+ selector: W3CTextSelector | W3CTextSelector[];
8
+ styleClass?: string;
9
+ }
10
+ /**
11
+ * Matches the `Text Quote Selector` spec
12
+ * @see https://www.w3.org/TR/annotation-model/#text-quote-selector
13
+ */
14
+ export interface W3CTextQuoteSelector {
15
+ type: 'TextQuoteSelector';
16
+ exact: string;
17
+ prefix?: string;
18
+ suffix?: string;
19
+ }
20
+ /**
21
+ * Matches the `Text Position Selector` spec
22
+ * @see https://www.w3.org/TR/annotation-model/#text-position-selector
23
+ */
24
+ export interface W3CTextPositionSelector {
25
+ type: 'TextPositionSelector';
26
+ start: number;
27
+ end: number;
28
+ }
29
+ export type W3CTextSelector = W3CTextQuoteSelector | W3CTextPositionSelector;
30
+ export type W3CAnnotationStylesheet = string | {
31
+ type: 'CssStylesheet';
32
+ value: string;
33
+ };
@@ -0,0 +1,12 @@
1
+ import { type FormatAdapter, ParseResult } from '@annotorious/core';
2
+ import type { TextAnnotation } from '../core';
3
+ import type { W3CTextAnnotation } from '../w3c';
4
+ export type W3CTextFormatAdapter = FormatAdapter<TextAnnotation, W3CTextAnnotation>;
5
+ /**
6
+ * @param source - the IRI of the annotated content
7
+ * @param container - the HTML container of the annotated content,
8
+ * Required to locate the content's `range` within the DOM
9
+ */
10
+ export declare const W3CTextFormat: (source: string, container: HTMLElement) => W3CTextFormatAdapter;
11
+ export declare const parseW3CTextAnnotation: (annotation: W3CTextAnnotation, container: HTMLElement) => ParseResult<TextAnnotation>;
12
+ export declare const serializeW3CTextAnnotation: (annotation: TextAnnotation, source: string, container: HTMLElement) => W3CTextAnnotation;
@@ -0,0 +1,2 @@
1
+ export * from './W3CTextAnnotation';
2
+ export * from './W3CTextFormatAdapter';
@@ -0,0 +1,4 @@
1
+ export declare const getQuoteContext: (range: Range, container: HTMLElement, length?: number, offsetReferenceSelector?: string) => {
2
+ prefix: string;
3
+ suffix: string;
4
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './getClientRectsPonyfill';
2
+ export * from './getQuoteContext';
2
3
  export * from './mergeClientRects';
3
4
  export * from './trimRange';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { W3CTextAnnotation } from '../../../src';
2
+ export declare const textAnnotation: W3CTextAnnotation;
3
+ export declare const incompleteTextAnnotation: W3CTextAnnotation;