@recogito/text-annotator 3.0.0-rc.19 → 3.0.0-rc.3

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.
Files changed (49) hide show
  1. package/dist/src/SelectionHandler.d.ts +4 -4
  2. package/dist/src/TextAnnotator.d.ts +4 -7
  3. package/dist/src/TextAnnotatorOptions.d.ts +4 -8
  4. package/dist/src/api/scrollIntoView.d.ts +2 -3
  5. package/dist/src/highlight/HighlightPainter.d.ts +19 -11
  6. package/dist/src/highlight/highlightLayer.d.ts +10 -0
  7. package/dist/src/highlight/index.d.ts +2 -3
  8. package/dist/src/highlight/trackViewport.d.ts +3 -0
  9. package/dist/src/index.d.ts +3 -4
  10. package/dist/src/model/{core/TextAnnotation.d.ts → TextAnnotation.d.ts} +2 -4
  11. package/dist/src/model/index.d.ts +1 -2
  12. package/dist/src/presence/PresencePainter.d.ts +4 -5
  13. package/dist/src/state/TextAnnotationStore.d.ts +6 -7
  14. package/dist/src/state/TextAnnotatorState.d.ts +6 -6
  15. package/dist/src/state/index.d.ts +1 -0
  16. package/dist/src/state/reviveTarget.d.ts +9 -0
  17. package/dist/src/state/spatialTree.d.ts +6 -9
  18. package/dist/src/utils/index.d.ts +0 -9
  19. package/dist/text-annotator.css +1 -1
  20. package/dist/text-annotator.es.js +945 -1480
  21. package/dist/text-annotator.es.js.map +1 -1
  22. package/dist/text-annotator.umd.js +1 -2
  23. package/dist/text-annotator.umd.js.map +1 -1
  24. package/package.json +11 -17
  25. package/dist/src/highlight/Highlight.d.ts +0 -6
  26. package/dist/src/highlight/HighlightStyle.d.ts +0 -12
  27. package/dist/src/highlight/baseRenderer.d.ts +0 -21
  28. package/dist/src/highlight/canvas/canvasRenderer.d.ts +0 -4
  29. package/dist/src/highlight/canvas/index.d.ts +0 -1
  30. package/dist/src/highlight/highlights/highlightsRenderer.d.ts +0 -6
  31. package/dist/src/highlight/highlights/index.d.ts +0 -1
  32. package/dist/src/highlight/span/index.d.ts +0 -1
  33. package/dist/src/highlight/span/spansRenderer.d.ts +0 -4
  34. package/dist/src/highlight/viewport.d.ts +0 -13
  35. package/dist/src/model/core/index.d.ts +0 -1
  36. package/dist/src/model/w3c/W3CTextAnnotation.d.ts +0 -34
  37. package/dist/src/model/w3c/W3CTextFormatAdapter.d.ts +0 -13
  38. package/dist/src/model/w3c/index.d.ts +0 -2
  39. package/dist/src/utils/debounce.d.ts +0 -1
  40. package/dist/src/utils/getAnnotatableFragment.d.ts +0 -5
  41. package/dist/src/utils/getQuoteContext.d.ts +0 -4
  42. package/dist/src/utils/isRevived.d.ts +0 -3
  43. package/dist/src/utils/rangeToSelector.d.ts +0 -3
  44. package/dist/src/utils/reviveAnnotation.d.ts +0 -3
  45. package/dist/src/utils/reviveSelector.d.ts +0 -12
  46. package/dist/src/utils/reviveTarget.d.ts +0 -3
  47. package/dist/src/utils/splitAnnotatableRanges.d.ts +0 -6
  48. package/dist/test/model/w3c/W3CTextFormatAdapter.test.d.ts +0 -1
  49. package/dist/test/model/w3c/fixtures.d.ts +0 -4
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@recogito/text-annotator",
3
- "version": "3.0.0-rc.19",
3
+ "version": "3.0.0-rc.3",
4
4
  "description": "A JavaScript text annotation library",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
7
7
  "type": "module",
8
8
  "scripts": {
9
- "start": "vite --host",
9
+ "start": "vite",
10
10
  "build": "vite build",
11
11
  "preview": "vite preview",
12
- "test": "vitest"
12
+ "test": "echo 'Skipping tests in @recogito/text-annotator package'"
13
13
  },
14
14
  "main": "./dist/text-annotator.umd.js",
15
15
  "module": "./dist/text-annotator.es.js",
@@ -19,28 +19,22 @@
19
19
  ],
20
20
  "exports": {
21
21
  ".": {
22
- "types": "./dist/src/index.d.ts",
23
22
  "import": "./dist/text-annotator.es.js",
24
23
  "require": "./dist/text-annotator.umd.js"
25
24
  },
26
25
  "./dist/text-annotator.css": "./dist/text-annotator.css"
27
26
  },
28
27
  "devDependencies": {
29
- "@types/jsdom": "^21.1.6",
30
- "@types/rbush": "^3.0.3",
31
- "@types/uuid": "^9.0.8",
32
- "jsdom": "^24.0.0",
33
- "svelte": "^4.2.12",
34
- "typescript": "^5.4.3",
35
- "vite": "^5.2.6",
36
- "vite-plugin-dts": "^3.8.0",
37
- "vitest": "^1.4.0"
28
+ "@types/rbush": "^3.0.0",
29
+ "@types/uuid": "^9.0.1",
30
+ "svelte": "^4.0.0",
31
+ "typescript": "^4.9.5",
32
+ "vite": "^4.2.1",
33
+ "vite-plugin-dts": "^2.3.0"
38
34
  },
39
35
  "dependencies": {
40
- "@annotorious/core": "^3.0.0-rc.22",
41
- "colord": "^2.9.3",
42
- "dequal": "^2.0.3",
36
+ "@annotorious/core": "^3.0.0-rc.4",
43
37
  "rbush": "^3.0.1",
44
- "uuid": "^9.0.1"
38
+ "uuid": "^9.0.0"
45
39
  }
46
40
  }
@@ -1,6 +0,0 @@
1
- import { AnnotationRects } from '../state';
2
- import { AnnotationState } from '@annotorious/core';
3
-
4
- export interface Highlight extends AnnotationRects {
5
- state: AnnotationState;
6
- }
@@ -1,12 +0,0 @@
1
- import { TextAnnotation } from 'src/model';
2
- import { AnnotationState, Color, DrawingStyle } from '@annotorious/core';
3
-
4
- export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity'> {
5
- underlineStyle?: string;
6
- underlineColor?: Color;
7
- underlineOffset?: number;
8
- underlineThickness?: number;
9
- }
10
- export type HighlightStyleExpression = HighlightStyle | ((annotation: TextAnnotation, state: AnnotationState, zIndex?: number) => HighlightStyle);
11
- export declare const DEFAULT_STYLE: HighlightStyle;
12
- export declare const DEFAULT_SELECTED_STYLE: HighlightStyle;
@@ -1,21 +0,0 @@
1
- import { HighlightStyleExpression } from './HighlightStyle';
2
- import { Highlight } from './Highlight';
3
- import { HighlightPainter } from './HighlightPainter';
4
- import { ViewportBounds } from './viewport';
5
- import { TextAnnotatorState } from '../state';
6
- import { Filter, ViewportState } from '@annotorious/core';
7
-
8
- export interface RendererImplementation {
9
- destroy(): void;
10
- redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, painter?: HighlightPainter, force?: boolean): void;
11
- setVisible(visible: boolean): void;
12
- }
13
- export interface Renderer {
14
- destroy(): void;
15
- redraw(force?: boolean): void;
16
- setStyle(style?: HighlightStyleExpression): void;
17
- setFilter(filter?: Filter): void;
18
- setPainter(painter?: HighlightPainter): void;
19
- setVisible(visible: boolean): void;
20
- }
21
- export declare const createBaseRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState, renderer: RendererImplementation) => Renderer;
@@ -1,4 +0,0 @@
1
- import { ViewportState } from '@annotorious/core';
2
- import { TextAnnotatorState } from 'src/state';
3
-
4
- export declare const createCanvasRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => import('../baseRenderer').Renderer;
@@ -1 +0,0 @@
1
- export * from './canvasRenderer';
@@ -1,6 +0,0 @@
1
- import { RendererImplementation } from '../baseRenderer';
2
- import { TextAnnotatorState } from 'src/state';
3
- import { ViewportState } from '@annotorious/core';
4
-
5
- export declare const createRenderer: () => RendererImplementation;
6
- export declare const createHighlightsRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => import('../baseRenderer').Renderer;
@@ -1 +0,0 @@
1
- export * from './highlightsRenderer';
@@ -1 +0,0 @@
1
- export * from './spansRenderer';
@@ -1,4 +0,0 @@
1
- import { TextAnnotatorState } from '../../state';
2
- import { ViewportState } from '@annotorious/core';
3
-
4
- export declare const createSpansRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => import('../baseRenderer').Renderer;
@@ -1,13 +0,0 @@
1
- import { TextAnnotation } from '../model';
2
- import { ViewportState } from '@annotorious/core';
3
-
4
- export interface ViewportBounds {
5
- top: number;
6
- left: number;
7
- minX: number;
8
- minY: number;
9
- maxX: number;
10
- maxY: number;
11
- }
12
- export declare const getViewportBounds: (container: HTMLElement) => ViewportBounds;
13
- export declare const trackViewport: (viewport: ViewportState) => (annotations: TextAnnotation[]) => void;
@@ -1 +0,0 @@
1
- export * from './TextAnnotation';
@@ -1,34 +0,0 @@
1
- import { W3CAnnotation, W3CAnnotationTarget } from '@annotorious/core';
2
-
3
- export interface W3CTextAnnotation extends W3CAnnotation {
4
- target: W3CTextAnnotationTarget | W3CTextAnnotationTarget[];
5
- stylesheet?: W3CAnnotationStylesheet;
6
- }
7
- export interface W3CTextAnnotationTarget extends W3CAnnotationTarget {
8
- selector: W3CTextSelector | W3CTextSelector[];
9
- styleClass?: string;
10
- }
11
- /**
12
- * Matches the `Text Quote Selector` spec
13
- * @see https://www.w3.org/TR/annotation-model/#text-quote-selector
14
- */
15
- export interface W3CTextQuoteSelector {
16
- type: 'TextQuoteSelector';
17
- exact: string;
18
- prefix?: string;
19
- suffix?: string;
20
- }
21
- /**
22
- * Matches the `Text Position Selector` spec
23
- * @see https://www.w3.org/TR/annotation-model/#text-position-selector
24
- */
25
- export interface W3CTextPositionSelector {
26
- type: 'TextPositionSelector';
27
- start: number;
28
- end: number;
29
- }
30
- export type W3CTextSelector = W3CTextQuoteSelector | W3CTextPositionSelector;
31
- export type W3CAnnotationStylesheet = string | {
32
- type: 'CssStylesheet';
33
- value: string;
34
- };
@@ -1,13 +0,0 @@
1
- import { W3CTextAnnotation } from '../w3c';
2
- import { TextAnnotation } from '../core';
3
- import { FormatAdapter, ParseResult } from '@annotorious/core';
4
-
5
- export type W3CTextFormatAdapter = FormatAdapter<TextAnnotation, W3CTextAnnotation>;
6
- /**
7
- * @param source - the IRI of the annotated content
8
- * @param container - the HTML container of the annotated content,
9
- * Required to locate the content's `range` within the DOM
10
- */
11
- export declare const W3CTextFormat: (source: string, container: HTMLElement) => W3CTextFormatAdapter;
12
- export declare const parseW3CTextAnnotation: (annotation: W3CTextAnnotation) => ParseResult<TextAnnotation>;
13
- export declare const serializeW3CTextAnnotation: (annotation: TextAnnotation, source: string, container: HTMLElement) => W3CTextAnnotation;
@@ -1,2 +0,0 @@
1
- export * from './W3CTextAnnotation';
2
- export * from './W3CTextFormatAdapter';
@@ -1 +0,0 @@
1
- export declare const debounce: <T extends (...args: any[]) => void>(func: T, delay?: number) => T;
@@ -1,5 +0,0 @@
1
- /**
2
- * Returns a DocumentFragment consisting of ONLY the annotatable content
3
- * in the given DOM Range.
4
- */
5
- export declare const getAnnotatableFragment: (range: Range) => DocumentFragment;
@@ -1,4 +0,0 @@
1
- export declare const getQuoteContext: (range: Range, container: HTMLElement, length?: number, offsetReferenceSelector?: string) => {
2
- prefix: string;
3
- suffix: string;
4
- };
@@ -1,3 +0,0 @@
1
- import { TextSelector } from '../model';
2
-
3
- export declare const isRevived: (selector: TextSelector[]) => boolean;
@@ -1,3 +0,0 @@
1
- import { TextSelector } from '../model';
2
-
3
- export declare const rangeToSelector: (range: Range, container: HTMLElement, offsetReferenceSelector?: string) => TextSelector;
@@ -1,3 +0,0 @@
1
- import { TextAnnotation } from '../model';
2
-
3
- export declare const reviveAnnotation: (annotation: TextAnnotation, container: HTMLElement) => TextAnnotation;
@@ -1,12 +0,0 @@
1
- import { TextSelector } from '../model';
2
-
3
- /**
4
- * Creates a new selector object with the revived DOM range from the given text annotation position
5
- * Only the annotatable elements are processed and counted towards the range
6
- *
7
- * @param selector annotation selector with start and end positions
8
- * @param container the HTML container of the annotated content
9
- *
10
- * @returns the revived selector
11
- */
12
- export declare const reviveSelector: (selector: TextSelector, container: HTMLElement) => TextSelector;
@@ -1,3 +0,0 @@
1
- import { TextAnnotationTarget } from '../model';
2
-
3
- export declare const reviveTarget: (target: TextAnnotationTarget, container: HTMLElement) => TextAnnotationTarget;
@@ -1,6 +0,0 @@
1
- export declare const NOT_ANNOTATABLE_SELECTOR = ".not-annotatable";
2
- /**
3
- * Splits a DOM Range into one or more ranges that span annotatable content only.
4
- */
5
- export declare const splitAnnotatableRanges: (range: Range) => Range[];
6
- export declare const getRangeAnnotatableContents: (range: Range) => DocumentFragment;
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { W3CTextAnnotation } from '../../../src';
2
-
3
- export declare const textAnnotation: W3CTextAnnotation;
4
- export declare const incompleteTextAnnotation: W3CTextAnnotation;