@soomo/text-annotator 3.0.0-staging.8 → 3.1.0-staging.0
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.
- package/dist/src/SelectionHandler.d.ts +6 -4
- package/dist/src/TextAnnotator.d.ts +10 -9
- package/dist/src/TextAnnotatorOptions.d.ts +9 -9
- package/dist/src/api/scrollIntoView.d.ts +2 -3
- package/dist/src/highlight/Highlight.d.ts +1 -2
- package/dist/src/highlight/HighlightPainter.d.ts +2 -3
- package/dist/src/highlight/HighlightStyle.d.ts +2 -3
- package/dist/src/highlight/baseRenderer.d.ts +6 -7
- package/dist/src/highlight/canvas/canvasRenderer.d.ts +3 -3
- package/dist/src/highlight/highlights/highlightsRenderer.d.ts +4 -4
- package/dist/src/highlight/span/spansRenderer.d.ts +3 -3
- package/dist/src/highlight/viewport.d.ts +1 -2
- package/dist/src/index.d.ts +5 -3
- package/dist/src/model/core/TextAnnotation.d.ts +0 -1
- package/dist/src/model/w3c/W3CTextAnnotation.d.ts +0 -1
- package/dist/src/model/w3c/W3CTextFormatAdapter.d.ts +2 -3
- package/dist/src/presence/PresencePainter.d.ts +3 -4
- package/dist/src/state/TextAnnotationStore.d.ts +15 -11
- package/dist/src/state/TextAnnotatorState.d.ts +7 -8
- package/dist/src/state/spatialTree.d.ts +10 -6
- package/dist/src/utils/cancelSingleClickEvents.d.ts +6 -0
- package/dist/src/utils/cloneEvents.d.ts +11 -0
- package/dist/src/utils/device.d.ts +1 -0
- package/dist/src/utils/index.d.ts +6 -2
- package/dist/src/utils/isRevived.d.ts +0 -1
- package/dist/src/utils/mergeClientRects.d.ts +1 -0
- package/dist/src/utils/normalizeRects.d.ts +2 -0
- package/dist/src/utils/programmaticallyFocusable.d.ts +6 -0
- package/dist/src/utils/rangeToSelector.d.ts +0 -1
- package/dist/src/utils/reviveAnnotation.d.ts +1 -2
- package/dist/src/utils/reviveSelector.d.ts +1 -2
- package/dist/src/utils/reviveTarget.d.ts +1 -2
- package/dist/src/utils/trimRangeToContainer.d.ts +1 -0
- package/dist/test/model/w3c/fixtures.d.ts +0 -1
- package/dist/text-annotator.css +1 -1
- package/dist/text-annotator.es.js +1708 -1201
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +2 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +16 -13
- package/dist/src/utils/debounce.d.ts +0 -1
- package/dist/src/utils/getClientRectsPonyfill.d.ts +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Filter, User } from '@annotorious/core';
|
|
1
2
|
import { TextAnnotatorState } from './state';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const SelectionHandler: (container: HTMLElement, state: TextAnnotatorState, annotationEnabled: boolean, offsetReferenceSelector?: string) => {
|
|
3
|
+
import { TextAnnotation } from './model';
|
|
4
|
+
export declare const createSelectionHandler: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, offsetReferenceSelector?: string) => {
|
|
5
5
|
destroy: () => void;
|
|
6
|
-
|
|
6
|
+
setFilter: (filter?: Filter) => Filter;
|
|
7
|
+
setUser: (user?: User) => User;
|
|
8
|
+
setAnnotatingEnabled: (enabled: boolean) => void;
|
|
7
9
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { TextAnnotatorOptions } from './TextAnnotatorOptions';
|
|
2
|
-
import { TextAnnotation } from './model';
|
|
3
|
-
import { TextAnnotatorState } from './state';
|
|
4
|
-
import { HighlightStyleExpression } from './highlight';
|
|
5
1
|
import { Annotator } from '@annotorious/core';
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { HighlightStyleExpression } from './highlight';
|
|
3
|
+
import { TextAnnotatorState } from './state';
|
|
4
|
+
import { TextAnnotation } from './model';
|
|
5
|
+
import { TextAnnotatorOptions } from './TextAnnotatorOptions';
|
|
6
|
+
export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Annotator<I, E> {
|
|
8
7
|
element: HTMLElement;
|
|
9
8
|
setStyle(style: HighlightStyleExpression | undefined): void;
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
redraw(force?: boolean): void;
|
|
10
|
+
scrollIntoView(annotationOrId: I | string): boolean;
|
|
11
|
+
setAnnotatingEnabled: (enabled: boolean) => void;
|
|
12
|
+
state: TextAnnotatorState<I, E>;
|
|
12
13
|
}
|
|
13
|
-
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>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TextAnnotation } from './model';
|
|
1
|
+
import { FormatAdapter, UserSelectActionExpression, User } from '@annotorious/core';
|
|
3
2
|
import { PresencePainterOptions } from './presence';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export interface TextAnnotatorOptions<
|
|
7
|
-
adapter?: FormatAdapter<
|
|
8
|
-
|
|
3
|
+
import { TextAnnotation } from './model';
|
|
4
|
+
import { HighlightStyleExpression } from './highlight';
|
|
5
|
+
export interface TextAnnotatorOptions<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> {
|
|
6
|
+
adapter?: FormatAdapter<I, E> | null;
|
|
7
|
+
annotatingEnabled?: boolean;
|
|
9
8
|
renderer?: RendererType;
|
|
10
9
|
offsetReferenceSelector?: string;
|
|
11
|
-
|
|
10
|
+
userSelectAction?: UserSelectActionExpression<E>;
|
|
12
11
|
presence?: PresencePainterOptions;
|
|
13
12
|
style?: HighlightStyleExpression;
|
|
13
|
+
user?: User;
|
|
14
14
|
}
|
|
15
15
|
export type RendererType = 'SPANS' | 'CANVAS' | 'CSS_HIGHLIGHTS';
|
|
16
|
-
export declare const fillDefaults: <
|
|
16
|
+
export declare const fillDefaults: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(opts: TextAnnotatorOptions<I, E>, defaults: TextAnnotatorOptions<I, E>) => TextAnnotatorOptions<I, E>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TextAnnotation } from '../model';
|
|
2
1
|
import { TextAnnotationStore } from '../state';
|
|
3
|
-
|
|
4
|
-
export declare const scrollIntoView: (container: HTMLElement, store: TextAnnotationStore) => (
|
|
2
|
+
import { TextAnnotation } from '../model';
|
|
3
|
+
export declare const scrollIntoView: (container: HTMLElement, store: TextAnnotationStore) => (annotationOrId: string | TextAnnotation) => boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ViewportBounds } from './viewport';
|
|
2
|
-
import { HighlightStyle, HighlightStyleExpression } from './HighlightStyle';
|
|
3
1
|
import { Highlight } from './Highlight';
|
|
4
|
-
|
|
2
|
+
import { HighlightStyle, HighlightStyleExpression } from './HighlightStyle';
|
|
3
|
+
import { ViewportBounds } from './viewport';
|
|
5
4
|
export interface HighlightPainter {
|
|
6
5
|
clear(): void;
|
|
7
6
|
destroy(): void;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { TextAnnotation } from 'src/model';
|
|
2
1
|
import { AnnotationState, Color, DrawingStyle } from '@annotorious/core';
|
|
3
|
-
|
|
2
|
+
import { TextAnnotation } from 'src/model';
|
|
4
3
|
export interface HighlightStyle extends Pick<DrawingStyle, 'fill' | 'fillOpacity'> {
|
|
5
4
|
underlineStyle?: string;
|
|
6
5
|
underlineColor?: Color;
|
|
7
6
|
underlineOffset?: number;
|
|
8
7
|
underlineThickness?: number;
|
|
9
8
|
}
|
|
10
|
-
export type HighlightStyleExpression = HighlightStyle | ((annotation: TextAnnotation, state: AnnotationState, zIndex?: number) => HighlightStyle);
|
|
9
|
+
export type HighlightStyleExpression = HighlightStyle | ((annotation: TextAnnotation, state: AnnotationState, zIndex?: number) => HighlightStyle | undefined);
|
|
11
10
|
export declare const DEFAULT_STYLE: HighlightStyle;
|
|
12
11
|
export declare const DEFAULT_SELECTED_STYLE: HighlightStyle;
|
|
@@ -1,10 +1,9 @@
|
|
|
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
1
|
import { Filter, ViewportState } from '@annotorious/core';
|
|
7
|
-
|
|
2
|
+
import { TextAnnotatorState } from '../state';
|
|
3
|
+
import { ViewportBounds } from './viewport';
|
|
4
|
+
import { HighlightPainter } from './HighlightPainter';
|
|
5
|
+
import { Highlight } from './Highlight';
|
|
6
|
+
import { HighlightStyleExpression } from './HighlightStyle';
|
|
8
7
|
export interface RendererImplementation {
|
|
9
8
|
destroy(): void;
|
|
10
9
|
redraw(highlights: Highlight[], bounds: ViewportBounds, style?: HighlightStyleExpression, painter?: HighlightPainter, lazy?: boolean): void;
|
|
@@ -18,4 +17,4 @@ export interface Renderer {
|
|
|
18
17
|
setPainter(painter?: HighlightPainter): void;
|
|
19
18
|
setVisible(visible: boolean): void;
|
|
20
19
|
}
|
|
21
|
-
export declare const createBaseRenderer: (container: HTMLElement, state:
|
|
20
|
+
export declare const createBaseRenderer: <T extends TextAnnotatorState = TextAnnotatorState<import('..').TextAnnotation, import('..').TextAnnotation>>(container: HTMLElement, state: T, viewport: ViewportState, renderer: RendererImplementation) => Renderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ViewportState } from '@annotorious/core';
|
|
2
|
-
import { TextAnnotatorState } from '
|
|
3
|
-
|
|
4
|
-
export declare const createCanvasRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
2
|
+
import { TextAnnotatorState } from '../../state';
|
|
3
|
+
import { TextAnnotation } from 'src/model';
|
|
4
|
+
export declare const createCanvasRenderer: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RendererImplementation } from '../baseRenderer';
|
|
2
|
-
import { TextAnnotatorState } from 'src/state';
|
|
3
1
|
import { ViewportState } from '@annotorious/core';
|
|
4
|
-
|
|
2
|
+
import { TextAnnotatorState } from 'src/state';
|
|
3
|
+
import { RendererImplementation } from '../baseRenderer';
|
|
4
|
+
import { TextAnnotation } from 'src/model';
|
|
5
5
|
export declare const createRenderer: () => RendererImplementation;
|
|
6
|
-
export declare const createHighlightsRenderer: (container: HTMLElement, state: TextAnnotatorState, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
6
|
+
export declare const createHighlightsRenderer: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextAnnotatorState } from '../../state';
|
|
2
1
|
import { ViewportState } from '@annotorious/core';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { TextAnnotatorState } from '../../state';
|
|
3
|
+
import { TextAnnotation } from 'src/model';
|
|
4
|
+
export declare const createSpansRenderer: (container: HTMLElement, state: TextAnnotatorState<TextAnnotation, unknown>, viewport: ViewportState) => import('../baseRenderer').Renderer;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export * from './api';
|
|
1
2
|
export * from './highlight';
|
|
2
3
|
export * from './model';
|
|
3
4
|
export * from './state';
|
|
4
5
|
export * from './utils';
|
|
5
|
-
export * from './presence
|
|
6
|
+
export * from './presence';
|
|
7
|
+
export * from './SelectionHandler';
|
|
6
8
|
export * from './TextAnnotator';
|
|
7
9
|
export * from './TextAnnotatorOptions';
|
|
8
|
-
export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Color, Filter, FormatAdapter, HoverState, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, ParseResult, User, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
|
|
9
|
-
export { createBody, Origin,
|
|
10
|
+
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';
|
|
11
|
+
export { createBody, Origin, UserSelectAction } from '@annotorious/core';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { W3CTextAnnotation } from '../w3c';
|
|
2
|
-
import { TextAnnotation } from '../core';
|
|
3
1
|
import { FormatAdapter, ParseResult } from '@annotorious/core';
|
|
4
|
-
|
|
2
|
+
import { TextAnnotation } from '../core';
|
|
3
|
+
import { W3CTextAnnotation } from '../w3c';
|
|
5
4
|
export type W3CTextFormatAdapter = FormatAdapter<TextAnnotation, W3CTextAnnotation>;
|
|
6
5
|
/**
|
|
7
6
|
* @param source - the IRI of the annotated content
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PresencePainterOptions } from 'src/presence';
|
|
2
|
-
import { HighlightPainter } from '../highlight';
|
|
3
1
|
import { PresenceProvider } from '@annotorious/core';
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { HighlightPainter } from '../highlight';
|
|
3
|
+
import { PresencePainterOptions } from '../presence';
|
|
4
|
+
export declare const createPresencePainter: (provider: PresenceProvider, opts?: PresencePainterOptions) => HighlightPainter;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { Unsubscribe } from 'nanoevents';
|
|
2
|
+
import { Filter, Origin, Store } from '@annotorious/core';
|
|
1
3
|
import { TextAnnotation } from '../model';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
getAnnotationBounds(id: string, hintX?: number, hintY?: number, buffer?: number): DOMRect;
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { SpatialTreeEvents } from './spatialTree';
|
|
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
|
+
getAnnotationRects(id: string): DOMRect[];
|
|
10
|
+
getAnnotationBounds(id: string, hintX?: number, hintY?: number, buffer?: number): DOMRect | undefined;
|
|
11
|
+
getAnnotationRects(id: string): DOMRect[];
|
|
12
|
+
getAt(x: number, y: number, filter?: Filter): T | undefined;
|
|
13
|
+
getIntersecting(minX: number, minY: number, maxX: number, maxY: number): AnnotationRects<T>[];
|
|
11
14
|
recalculatePositions(): void;
|
|
15
|
+
onRecalculatePositions(callback: SpatialTreeEvents['recalculate']): Unsubscribe;
|
|
12
16
|
}
|
|
13
|
-
export interface AnnotationRects {
|
|
14
|
-
annotation:
|
|
17
|
+
export interface AnnotationRects<T extends TextAnnotation = TextAnnotation> {
|
|
18
|
+
annotation: T;
|
|
15
19
|
rects: Rect[];
|
|
16
20
|
}
|
|
17
21
|
export interface Rect {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ViewportState, UserSelectActionExpression, AnnotatorState, SelectionState, HoverState } from '@annotorious/core';
|
|
2
2
|
import { TextAnnotation } from '../model';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
hover: HoverState<TextAnnotation>;
|
|
3
|
+
import { TextAnnotationStore } from './TextAnnotationStore';
|
|
4
|
+
export interface TextAnnotatorState<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends AnnotatorState<I, E> {
|
|
5
|
+
store: TextAnnotationStore<I>;
|
|
6
|
+
selection: SelectionState<I, E>;
|
|
7
|
+
hover: HoverState<I>;
|
|
9
8
|
viewport: ViewportState;
|
|
10
9
|
}
|
|
11
|
-
export declare const createTextAnnotatorState:
|
|
10
|
+
export declare const createTextAnnotatorState: <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(container: HTMLElement, defaultUserSelectAction?: UserSelectActionExpression<E>) => TextAnnotatorState<I, E>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AnnotationRects } from './TextAnnotationStore';
|
|
2
|
-
import { TextAnnotation, TextAnnotationTarget } from '../model';
|
|
3
1
|
import { Store } from '@annotorious/core';
|
|
4
|
-
|
|
2
|
+
import { Unsubscribe } from 'nanoevents';
|
|
3
|
+
import { TextAnnotation, TextAnnotationTarget } from '../model';
|
|
4
|
+
import { AnnotationRects } from './TextAnnotationStore';
|
|
5
5
|
interface IndexedHighlightRect {
|
|
6
6
|
minX: number;
|
|
7
7
|
minY: number;
|
|
@@ -12,18 +12,22 @@ interface IndexedHighlightRect {
|
|
|
12
12
|
rects: DOMRect[];
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export interface SpatialTreeEvents {
|
|
16
|
+
recalculate(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const createSpatialTree: <T extends TextAnnotation>(store: Store<T>, container: HTMLElement) => {
|
|
16
19
|
all: () => IndexedHighlightRect[][];
|
|
17
20
|
clear: () => void;
|
|
18
|
-
getAt: (x: number, y: number) => string
|
|
21
|
+
getAt: (x: number, y: number, all?: boolean) => string[];
|
|
19
22
|
getAnnotationBounds: (id: string) => DOMRect;
|
|
20
23
|
getAnnotationRects: (id: string) => DOMRect[];
|
|
21
|
-
getIntersecting: (minX: number, minY: number, maxX: number, maxY: number) => AnnotationRects[];
|
|
24
|
+
getIntersecting: (minX: number, minY: number, maxX: number, maxY: number) => AnnotationRects<T>[];
|
|
22
25
|
insert: (target: TextAnnotationTarget) => void;
|
|
23
26
|
recalculate: () => void;
|
|
24
27
|
remove: (target: TextAnnotationTarget) => void;
|
|
25
28
|
set: (targets: TextAnnotationTarget[], replace?: boolean) => void;
|
|
26
29
|
size: () => number;
|
|
27
30
|
update: (target: TextAnnotationTarget) => void;
|
|
31
|
+
on: <E extends keyof SpatialTreeEvents>(event: E, callback: SpatialTreeEvents[E]) => Unsubscribe;
|
|
28
32
|
};
|
|
29
33
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isMac: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './cancelSingleClickEvents';
|
|
2
|
+
export * from './device';
|
|
3
|
+
export * from './programmaticallyFocusable';
|
|
2
4
|
export * from './getAnnotatableFragment';
|
|
3
|
-
export * from './getClientRectsPonyfill';
|
|
4
5
|
export * from './getQuoteContext';
|
|
5
6
|
export * from './isWhitespaceOrEmpty';
|
|
6
7
|
export * from './isRevived';
|
|
@@ -10,3 +11,6 @@ export * from './reviveAnnotation';
|
|
|
10
11
|
export * from './reviveSelector';
|
|
11
12
|
export * from './reviveTarget';
|
|
12
13
|
export * from './splitAnnotatableRanges';
|
|
14
|
+
export * from './trimRangeToContainer';
|
|
15
|
+
export * from './cloneEvents';
|
|
16
|
+
export * from './normalizeRects';
|
|
@@ -0,0 +1,6 @@
|
|
|
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,5 +1,4 @@
|
|
|
1
1
|
import { TextSelector } from '../model';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Creates a new selector object with the revived DOM range from the given text annotation position
|
|
5
4
|
* Only the annotatable elements are processed and counted towards the range
|
|
@@ -9,4 +8,4 @@ import { TextSelector } from '../model';
|
|
|
9
8
|
*
|
|
10
9
|
* @returns the revived selector
|
|
11
10
|
*/
|
|
12
|
-
export declare const reviveSelector: (selector:
|
|
11
|
+
export declare const reviveSelector: <T extends TextSelector>(selector: T, container: HTMLElement) => T;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { TextAnnotationTarget } from '../model';
|
|
2
|
-
|
|
3
|
-
export declare const reviveTarget: (target: TextAnnotationTarget, container: HTMLElement) => TextAnnotationTarget;
|
|
2
|
+
export declare const reviveTarget: <T extends TextAnnotationTarget = TextAnnotationTarget>(target: T, container: HTMLElement) => T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const trimRangeToContainer: (range: Range, container: HTMLElement) => Range;
|
package/dist/text-annotator.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.r6o-
|
|
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}
|