@recogito/text-annotator 3.4.9 → 4.0.0-beta

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 (124) hide show
  1. package/dist/index.d.ts +409 -11
  2. package/dist/model/core/index.d.ts +1 -1
  3. package/dist/model/w3c/index.d.ts +2 -2
  4. package/dist/{src/model/w3c/W3CTextFormatAdapter.d.ts → model/w3c/w3c-text-format-adapter.d.ts} +2 -2
  5. package/dist/rendering/base-renderer.d.ts +31 -0
  6. package/dist/{src/highlight/HighlightStyle.d.ts → rendering/highlight-style.d.ts} +4 -1
  7. package/dist/{src/highlight/Highlight.d.ts → rendering/highlight.d.ts} +2 -1
  8. package/dist/rendering/index.d.ts +4 -0
  9. package/dist/rendering/renderer-css-highlight/css-highlight-renderer.d.ts +6 -0
  10. package/dist/rendering/renderer-css-highlight/index.d.ts +1 -0
  11. package/dist/rendering/renderer-inline-markup/index.d.ts +0 -0
  12. package/dist/rendering/renderer-spans/index.d.ts +1 -0
  13. package/dist/rendering/renderer-spans/spans-renderer.d.ts +2 -0
  14. package/dist/{SelectionHandler.d.ts → selection-handler.d.ts} +5 -5
  15. package/dist/src/index.d.ts +8 -7
  16. package/dist/state/index.d.ts +2 -2
  17. package/dist/state/{spatialTree.d.ts → spatial-tree.d.ts} +4 -4
  18. package/dist/{src/state/TextAnnotationStore.d.ts → state/text-annotation-store.d.ts} +3 -0
  19. package/dist/{src/state/TextAnnotatorState.d.ts → state/text-annotator-state.d.ts} +2 -2
  20. package/dist/{src/TextAnnotatorOptions.d.ts → text-annotator-options.d.ts} +4 -5
  21. package/dist/text-annotator.css +1 -1
  22. package/dist/{TextAnnotator.d.ts → text-annotator.d.ts} +7 -8
  23. package/dist/text-annotator.es.js +740 -825
  24. package/dist/text-annotator.es.js.map +1 -1
  25. package/dist/text-annotator.umd.js +2 -2
  26. package/dist/text-annotator.umd.js.map +1 -1
  27. package/dist/utils/annotation/index.d.ts +4 -0
  28. package/dist/{src/utils/rangeToSelector.d.ts → utils/annotation/range-to-selector.d.ts} +1 -1
  29. package/dist/{src/utils/reviveSelector.d.ts → utils/annotation/revive-annotation.d.ts} +4 -1
  30. package/dist/{api/scrollIntoView.d.ts → utils/annotation/scroll-into-view.d.ts} +2 -2
  31. package/dist/utils/dom/index.d.ts +7 -0
  32. package/dist/utils/events/index.d.ts +3 -0
  33. package/dist/utils/highlight/compute-z-index.d.ts +3 -0
  34. package/dist/utils/highlight/index.d.ts +4 -0
  35. package/package.json +2 -2
  36. package/dist/TextAnnotatorOptions.d.ts +0 -35
  37. package/dist/api/index.d.ts +0 -1
  38. package/dist/highlight/Highlight.d.ts +0 -5
  39. package/dist/highlight/HighlightPainter.d.ts +0 -11
  40. package/dist/highlight/HighlightStyle.d.ts +0 -11
  41. package/dist/highlight/Renderer.d.ts +0 -22
  42. package/dist/highlight/RendererImplementation.d.ts +0 -9
  43. package/dist/highlight/baseRenderer.d.ts +0 -22
  44. package/dist/highlight/canvas/canvasRenderer.d.ts +0 -5
  45. package/dist/highlight/canvas/index.d.ts +0 -1
  46. package/dist/highlight/color.d.ts +0 -2
  47. package/dist/highlight/highlights/highlightsRenderer.d.ts +0 -6
  48. package/dist/highlight/highlights/index.d.ts +0 -1
  49. package/dist/highlight/index.d.ts +0 -8
  50. package/dist/highlight/span/color.d.ts +0 -2
  51. package/dist/highlight/span/index.d.ts +0 -2
  52. package/dist/highlight/span/spansRenderer.d.ts +0 -3
  53. package/dist/highlight/viewport.d.ts +0 -12
  54. package/dist/model/core/TextAnnotation.d.ts +0 -15
  55. package/dist/model/w3c/W3CTextAnnotation.d.ts +0 -34
  56. package/dist/model/w3c/W3CTextFormatAdapter.d.ts +0 -12
  57. package/dist/presence/PresencePainter.d.ts +0 -5
  58. package/dist/presence/PresencePainterOptions.d.ts +0 -3
  59. package/dist/presence/index.d.ts +0 -2
  60. package/dist/src/SelectionHandler.d.ts +0 -9
  61. package/dist/src/TextAnnotator.d.ts +0 -12
  62. package/dist/src/api/index.d.ts +0 -1
  63. package/dist/src/api/scrollIntoView.d.ts +0 -3
  64. package/dist/src/highlight/HighlightPainter.d.ts +0 -11
  65. package/dist/src/highlight/baseRenderer.d.ts +0 -20
  66. package/dist/src/highlight/canvas/canvasRenderer.d.ts +0 -4
  67. package/dist/src/highlight/canvas/index.d.ts +0 -1
  68. package/dist/src/highlight/highlights/highlightsRenderer.d.ts +0 -6
  69. package/dist/src/highlight/highlights/index.d.ts +0 -1
  70. package/dist/src/highlight/index.d.ts +0 -6
  71. package/dist/src/highlight/span/color.d.ts +0 -2
  72. package/dist/src/highlight/span/index.d.ts +0 -1
  73. package/dist/src/highlight/span/spansRenderer.d.ts +0 -4
  74. package/dist/src/model/core/index.d.ts +0 -1
  75. package/dist/src/model/index.d.ts +0 -2
  76. package/dist/src/model/w3c/index.d.ts +0 -2
  77. package/dist/src/presence/PresencePainter.d.ts +0 -4
  78. package/dist/src/presence/PresencePainterOptions.d.ts +0 -3
  79. package/dist/src/presence/index.d.ts +0 -2
  80. package/dist/src/state/index.d.ts +0 -2
  81. package/dist/src/state/spatialTree.d.ts +0 -28
  82. package/dist/src/utils/index.d.ts +0 -17
  83. package/dist/src/utils/isRevived.d.ts +0 -2
  84. package/dist/src/utils/isWhitespaceOrEmpty.d.ts +0 -2
  85. package/dist/src/utils/reviveAnnotation.d.ts +0 -2
  86. package/dist/src/utils/reviveTarget.d.ts +0 -2
  87. package/dist/state/TextAnnotationStore.d.ts +0 -28
  88. package/dist/state/TextAnnotatorState.d.ts +0 -12
  89. package/dist/test/model/w3c/W3CTextFormatAdapter.test.d.ts +0 -1
  90. package/dist/test/model/w3c/fixtures.d.ts +0 -3
  91. package/dist/utils/cancelSingleClickEvents.d.ts +0 -6
  92. package/dist/utils/cloneEvents.d.ts +0 -11
  93. package/dist/utils/debounce.d.ts +0 -1
  94. package/dist/utils/device.d.ts +0 -1
  95. package/dist/utils/getHighlightClientRects.d.ts +0 -1
  96. package/dist/utils/getQuoteContext.d.ts +0 -4
  97. package/dist/utils/index.d.ts +0 -19
  98. package/dist/utils/isNotAnnotatable.d.ts +0 -4
  99. package/dist/utils/isRevived.d.ts +0 -2
  100. package/dist/utils/mergeClientRects.d.ts +0 -2
  101. package/dist/utils/programmaticallyFocusable.d.ts +0 -6
  102. package/dist/utils/rangeToSelector.d.ts +0 -2
  103. package/dist/utils/reviveAnnotation.d.ts +0 -2
  104. package/dist/utils/reviveSelector.d.ts +0 -11
  105. package/dist/utils/reviveTarget.d.ts +0 -2
  106. package/dist/utils/splitAnnotatableRanges.d.ts +0 -5
  107. package/dist/utils/trimRangeToContainer.d.ts +0 -1
  108. /package/dist/{src/model/core/TextAnnotation.d.ts → model/core/text-annotation.d.ts} +0 -0
  109. /package/dist/{src/model/w3c/W3CTextAnnotation.d.ts → model/w3c/w3c-text-annotation.d.ts} +0 -0
  110. /package/dist/{src/highlight → rendering}/viewport.d.ts +0 -0
  111. /package/dist/{src/utils/getQuoteContext.d.ts → utils/annotation/get-quote-context.d.ts} +0 -0
  112. /package/dist/{src/utils → utils/dom}/device.d.ts +0 -0
  113. /package/dist/{src/utils/isNotAnnotatable.d.ts → utils/dom/is-not-annotatable.d.ts} +0 -0
  114. /package/dist/utils/{isWhitespaceOrEmpty.d.ts → dom/is-whitespace-or-empty.d.ts} +0 -0
  115. /package/dist/utils/{mergeRanges.d.ts → dom/merge-ranges.d.ts} +0 -0
  116. /package/dist/{src/utils/programmaticallyFocusable.d.ts → utils/dom/programmatically-focusable.d.ts} +0 -0
  117. /package/dist/{src/utils/splitAnnotatableRanges.d.ts → utils/dom/split-annotatable-ranges.d.ts} +0 -0
  118. /package/dist/{src/utils/trimRangeToContainer.d.ts → utils/dom/trim-range-to-container.d.ts} +0 -0
  119. /package/dist/{src/utils/cancelSingleClickEvents.d.ts → utils/events/cancel-single-click-events.d.ts} +0 -0
  120. /package/dist/{src/utils/cloneEvents.d.ts → utils/events/clone-events.d.ts} +0 -0
  121. /package/dist/{src/utils → utils/events}/debounce.d.ts +0 -0
  122. /package/dist/{src/utils/getHighlightClientRects.d.ts → utils/highlight/get-highlight-client-rects.d.ts} +0 -0
  123. /package/dist/{src/utils/mergeClientRects.d.ts → utils/highlight/merge-client-rects.d.ts} +0 -0
  124. /package/dist/utils/{rectsToBounds.d.ts → highlight/rects-to-bounds.d.ts} +0 -0
@@ -1,6 +0,0 @@
1
- /**
2
- * Calls .preventDefault() on click events in annotable areas, in order
3
- * to prevent problematic default browser behavior. (Specifically: keep
4
- * Chrome Android from triggering word selection on single click.)
5
- */
6
- export declare const cancelSingleClickEvents: (container: HTMLElement) => void;
@@ -1,11 +0,0 @@
1
- /**
2
- * Events need to be manually mapped into new objects:
3
- * 1. It preserves the `target` and `currentTarget` properties.
4
- * Otherwise, they will be `null` when the event is read beyond the handler.
5
- * 2. Spread operator can copy only own enumerable properties, not inherited ones.
6
- * Therefore, we need to manually copy the props we're interested in.
7
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
8
- * @see https://github.com/recogito/text-annotator-js/commit/65d13f3108c429311cf8c2523f6babbbc946013d#r144041390
9
- */
10
- export declare const clonePointerEvent: (event: PointerEvent) => PointerEvent;
11
- export declare const cloneKeyboardEvent: (event: KeyboardEvent) => KeyboardEvent;
@@ -1 +0,0 @@
1
- export declare const debounce: <T extends (...args: any[]) => void>(func: T, delay?: number) => T;
@@ -1 +0,0 @@
1
- export declare const isMac: boolean;
@@ -1 +0,0 @@
1
- export declare const getHighlightClientRects: (range: Range) => DOMRect[];
@@ -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,19 +0,0 @@
1
- export * from './cancelSingleClickEvents';
2
- export * from './cloneEvents';
3
- export * from './debounce';
4
- export * from './device';
5
- export * from './programmaticallyFocusable';
6
- export * from './getHighlightClientRects';
7
- export * from './getQuoteContext';
8
- export * from './isNotAnnotatable';
9
- export * from './isRevived';
10
- export * from './isWhitespaceOrEmpty';
11
- export * from './mergeClientRects';
12
- export * from './mergeRanges';
13
- export * from './rangeToSelector';
14
- export * from './rectsToBounds';
15
- export * from './reviveAnnotation';
16
- export * from './reviveSelector';
17
- export * from './reviveTarget';
18
- export * from './splitAnnotatableRanges';
19
- export * from './trimRangeToContainer';
@@ -1,4 +0,0 @@
1
- export declare const NOT_ANNOTATABLE_CLASS = "not-annotatable";
2
- export declare const NOT_ANNOTATABLE_SELECTOR = ".not-annotatable";
3
- export declare const isNotAnnotatable: (container: Node, node: Node) => boolean;
4
- export declare const isRangeAnnotatable: (container: Node, range: Range) => boolean;
@@ -1,2 +0,0 @@
1
- import type { TextSelector } from '../model';
2
- export declare const isRevived: (selector: TextSelector[]) => boolean;
@@ -1,2 +0,0 @@
1
- export declare const mergeClientRects: (rects: DOMRect[], hTolerance?: number, vTolerance?: number) => DOMRect[];
2
- export declare const toDomRectList: (rects: DOMRect[]) => DOMRectList;
@@ -1,6 +0,0 @@
1
- /**
2
- * Makes an element programmatically focusable by adding a `tabindex="-1"` attribute.
3
- * Or does nothing if the element is already focusable 🤷🏻
4
- * It's required to process keyboard events on an element that is not natively focusable.
5
- */
6
- export declare const programmaticallyFocusable: (container: HTMLElement) => void;
@@ -1,2 +0,0 @@
1
- import type { TextSelector } from '../model';
2
- export declare const rangeToSelector: (range: Range, container: HTMLElement, offsetReferenceSelector?: string) => TextSelector;
@@ -1,2 +0,0 @@
1
- import type { TextAnnotation } from '../model';
2
- export declare const reviveAnnotation: <T extends TextAnnotation>(annotation: T, container: HTMLElement) => T;
@@ -1,11 +0,0 @@
1
- import type { TextSelector } from '../model';
2
- /**
3
- * Creates a new selector object with the revived DOM range from the given text annotation position
4
- * Only the annotatable elements are processed and counted towards the range
5
- *
6
- * @param selector annotation selector with start and end positions
7
- * @param container the HTML container of the annotated content
8
- *
9
- * @returns the revived selector
10
- */
11
- export declare const reviveSelector: <T extends TextSelector>(selector: T, container: HTMLElement) => T;
@@ -1,2 +0,0 @@
1
- import type { TextAnnotationTarget } from '../model';
2
- export declare const reviveTarget: <T extends TextAnnotationTarget = TextAnnotationTarget>(target: T, container: HTMLElement) => T;
@@ -1,5 +0,0 @@
1
- /**
2
- * Splits a DOM Range into one or more ranges that span annotatable content only.
3
- */
4
- export declare const splitAnnotatableRanges: (container: Node, range: Range) => Range[];
5
- export declare const getRangeAnnotatableContents: (range: Range) => DocumentFragment;
@@ -1 +0,0 @@
1
- export declare const trimRangeToContainer: (range: Range, container: HTMLElement) => Range;
File without changes
File without changes
File without changes