@annotorious/react 3.0.0-rc.18 → 3.0.0-rc.2
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/Annotorious.d.ts +26 -2
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/annotorious-react.css +1 -1
- package/dist/annotorious-react.es.js +34 -33
- package/dist/annotorious-react.es.js.map +1 -1
- package/dist/annotorious-react.es10.js +2 -36
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +8 -15
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +2 -6
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +3751 -7
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +28 -152
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +33 -18908
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +16 -32
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +4 -2
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +8 -599
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +152 -29
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +24 -24
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js +6 -2
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js +2 -2
- package/dist/annotorious-react.es22.js +33 -0
- package/dist/annotorious-react.es22.js.map +1 -0
- package/dist/annotorious-react.es23.js +602 -0
- package/dist/annotorious-react.es23.js.map +1 -0
- package/dist/annotorious-react.es24.js +20611 -0
- package/dist/annotorious-react.es24.js.map +1 -0
- package/dist/annotorious-react.es25.js +35 -0
- package/dist/annotorious-react.es25.js.map +1 -0
- package/dist/annotorious-react.es26.js +5 -0
- package/dist/annotorious-react.es26.js.map +1 -0
- package/dist/annotorious-react.es27.js +5 -0
- package/dist/annotorious-react.es27.js.map +1 -0
- package/dist/annotorious-react.es28.js +24 -0
- package/dist/annotorious-react.es28.js.map +1 -0
- package/dist/annotorious-react.es29.js +5 -0
- package/dist/annotorious-react.es29.js.map +1 -0
- package/dist/annotorious-react.es30.js +20 -0
- package/dist/annotorious-react.es30.js.map +1 -0
- package/dist/annotorious-react.es31.js +7 -0
- package/dist/annotorious-react.es31.js.map +1 -0
- package/dist/annotorious-react.es32.js +11 -0
- package/dist/annotorious-react.es32.js.map +1 -0
- package/dist/annotorious-react.es33.js +10 -0
- package/dist/annotorious-react.es33.js.map +1 -0
- package/dist/annotorious-react.es4.js +8 -8
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js +10 -10
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es6.js +4 -1
- package/dist/annotorious-react.es6.js.map +1 -1
- package/dist/annotorious-react.es7.js +4 -1
- package/dist/annotorious-react.es7.js.map +1 -1
- package/dist/annotorious-react.es8.js +7 -80
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +2 -31
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +12 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
- package/package.json +8 -17
package/dist/Annotorious.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Annotation, Annotator,
|
|
2
|
+
import { Annotation, Annotator, StoreChangeEvent } from '@annotorious/core';
|
|
3
3
|
interface Selection<T extends Annotation = Annotation> {
|
|
4
4
|
selected: {
|
|
5
5
|
annotation: T;
|
|
@@ -25,7 +25,31 @@ export declare const Annotorious: import("react").ForwardRefExoticComponent<{
|
|
|
25
25
|
children: ReactNode;
|
|
26
26
|
} & import("react").RefAttributes<Annotator<Annotation, Annotation>>>;
|
|
27
27
|
export declare const useAnnotator: <T extends Annotator<any, unknown>>() => T;
|
|
28
|
-
export declare const useAnnotationStore: <T extends
|
|
28
|
+
export declare const useAnnotationStore: <T extends {
|
|
29
|
+
addAnnotation: (annotation: Annotation, origin?: import("@annotorious/core").Origin) => void;
|
|
30
|
+
addBody: (body: import("@annotorious/core").AnnotationBody, origin?: import("@annotorious/core").Origin) => void;
|
|
31
|
+
all: () => Annotation[];
|
|
32
|
+
bulkAddAnnotation: (annotations: Annotation[], replace?: boolean, origin?: import("@annotorious/core").Origin) => void;
|
|
33
|
+
bulkDeleteAnnotation: (annotationsOrIds: (string | Annotation)[], origin?: import("@annotorious/core").Origin) => void;
|
|
34
|
+
bulkUpdateBodies: (bodies: import("@annotorious/core").AnnotationBody[], origin?: import("@annotorious/core").Origin) => void;
|
|
35
|
+
bulkUpdateTargets: (targets: import("@annotorious/core").AnnotationTarget[], origin?: import("@annotorious/core").Origin) => void;
|
|
36
|
+
clear: (origin?: import("@annotorious/core").Origin) => void;
|
|
37
|
+
deleteAnnotation: (annotationOrId: string | Annotation, origin?: import("@annotorious/core").Origin) => void;
|
|
38
|
+
deleteBody: (body: {
|
|
39
|
+
id: string;
|
|
40
|
+
annotation: string;
|
|
41
|
+
}, origin?: import("@annotorious/core").Origin) => void;
|
|
42
|
+
getAnnotation: (id: string) => Annotation;
|
|
43
|
+
getBody: (id: string) => import("@annotorious/core").AnnotationBody;
|
|
44
|
+
observe: (onChange: (event: StoreChangeEvent<Annotation>) => void, options?: import("@annotorious/core").StoreObserveOptions) => number;
|
|
45
|
+
unobserve: (onChange: (event: StoreChangeEvent<Annotation>) => void) => void;
|
|
46
|
+
updateAnnotation: (arg1: string | Annotation, arg2?: Annotation | import("@annotorious/core").Origin, arg3?: import("@annotorious/core").Origin) => void;
|
|
47
|
+
updateBody: (oldBodyId: {
|
|
48
|
+
id: string;
|
|
49
|
+
annotation: string;
|
|
50
|
+
}, newBody: import("@annotorious/core").AnnotationBody, origin?: import("@annotorious/core").Origin) => void;
|
|
51
|
+
updateTarget: (target: import("@annotorious/core").AnnotationTarget, origin?: import("@annotorious/core").Origin) => void;
|
|
52
|
+
}>() => T;
|
|
29
53
|
export declare const useAnnotations: <T extends Annotation>(debounce?: number) => T[];
|
|
30
54
|
export declare const useSelection: <T extends Annotation>() => Selection<T>;
|
|
31
55
|
export declare const useAnnotatorUser: () => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAS,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGnF,UAAU,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAEnD,QAAQ,EAAE;QAAE,UAAU,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAElD,YAAY,CAAC,EAAE,YAAY,CAAC;CAE7B;AAED,MAAM,WAAW,uBAAuB;IAEtC,IAAI,EAAE,SAAS,CAAC;IAEhB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEpD,WAAW,EAAE,UAAU,EAAE,CAAC;IAE1B,SAAS,EAAE,SAAS,CAAC;CAEtB;AAED,eAAO,MAAM,kBAAkB;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,WAAW;cAAqC,SAAS;qEAuEpE,CAAC;AAEH,eAAO,MAAM,YAAY,4CAGxB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;SAG9B,CAAA;AAYD,eAAO,MAAM,cAAc,oCAAqC,MAAM,QACE,CAAC;AAEzE,eAAO,MAAM,YAAY,0CAGxB,CAAA;AAED,eAAO,MAAM,gBAAgB,WAG5B,CAAA;AAmDD,eAAO,MAAM,gBAAgB,oCAAsC,MAAM,QACI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
canvas.a9s-gl-canvas{height:100%;left:0;position:absolute;top:0;width:100%}canvas.a9s-gl-canvas.hover{cursor:pointer!important}svg.svelte-190cqdf.svelte-190cqdf{pointer-events:none}svg.drawing.svelte-190cqdf.svelte-190cqdf{pointer-events:all}svg.svelte-190cqdf .svelte-190cqdf{pointer-events:all}text.svelte-1rehw2p{fill:#fff;font-family:Arial,Helvetica,sans-serif;font-weight:600}rect.svelte-1rehw2p{stroke-width:1.2;vector-effect:non-scaling-stroke}polygon.svelte-fgq4n0{stroke-width:1.2;vector-effect:non-scaling-stroke}rect.svelte-gze948{stroke-width:1.2;vector-effect:non-scaling-stroke}svg.svelte-1krwc4m{position:absolute;top:0;left:0;width:100%;height:100%;outline:none;pointer-events:none}.a9s-
|
|
1
|
+
canvas.a9s-gl-canvas{height:100%;left:0;position:absolute;top:0;width:100%}canvas.a9s-gl-canvas.hover{cursor:pointer!important}svg.svelte-190cqdf.svelte-190cqdf{pointer-events:none}svg.drawing.svelte-190cqdf.svelte-190cqdf{pointer-events:all}svg.svelte-190cqdf .svelte-190cqdf{pointer-events:all}text.svelte-1rehw2p{fill:#fff;font-family:Arial,Helvetica,sans-serif;font-weight:600}rect.svelte-1rehw2p{stroke-width:1.2;vector-effect:non-scaling-stroke}polygon.svelte-fgq4n0{stroke-width:1.2;vector-effect:non-scaling-stroke}rect.svelte-gze948{stroke-width:1.2;vector-effect:non-scaling-stroke}svg.svelte-1krwc4m{position:absolute;top:0;left:0;width:100%;height:100%;outline:none;pointer-events:none}.a9s-annotationlayer{box-sizing:border-box;height:100%;left:0;outline:none;position:absolute;top:0;touch-action:none;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.a9s-annotationlayer ellipse,.a9s-annotationlayer polygon,.a9s-annotationlayer rect{fill:transparent;shape-rendering:geometricPrecision;vector-effect:non-scaling-stroke}.a9s-edge-handle{fill:transparent;stroke:transparent;stroke-width:6px}.a9s-shape-handle,.a9s-corner-handle{cursor:move}.a9s-edge-handle-top{cursor:n-resize}.a9s-edge-handle-right{cursor:e-resize}.a9s-edge-handle-bottom{cursor:s-resize}.a9s-edge-handle-left{cursor:w-resize}.a9s-corner-handle.a9s-corner-handle-topleft{cursor:nw-resize}.a9s-corner-handle.a9s-corner-handle-topright{cursor:ne-resize}.a9s-corner-handle.a9s-corner-handle-bottomright{cursor:se-resize}.a9s-corner-handle.a9s-corner-handle-bottomleft{cursor:sw-resize}.a9s-annotationlayer .a9s-outer,div[data-theme=dark] .a9s-annotationlayer .a9s-outer{display:none}.a9s-annotationlayer .a9s-inner,div[data-theme=dark] .a9s-annotationlayer .a9s-inner{fill:#0000001f;stroke:#000;stroke-width:1px}rect.a9s-corner-handle,div[data-theme=dark] rect.a9s-corner-handle{fill:#000;rx:2px}rect.a9s-close-polygon-handle,div[data-theme=dark] rect.a9s-close-polygon-handle{fill:#000;rx:1px}.a9s-annotationlayer .a9s-outer,div[data-theme=light] .a9s-annotationlayer .a9s-outer{display:block;stroke:#00000040;stroke-width:3.5px}.a9s-annotationlayer .a9s-inner,div[data-theme=light] .a9s-annotationlayer .a9s-inner{fill:#ffffff26;stroke:#fff;stroke-width:1.5px}rect.a9s-corner-handle,div[data-theme=light] rect.a9s-corner-handle{fill:#fff;rx:1px;stroke:#00000073;stroke-width:1px}rect.a9s-close-polygon-handle,div[data-theme=light] rect.a9s-close-polygon-handle{fill:#fff;rx:1px;stroke:#00000073;stroke-width:1px}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { Annotorious as
|
|
2
|
-
import { AnnotoriousPlugin as
|
|
3
|
-
import { Draggable as
|
|
4
|
-
import { ImageAnnotator as
|
|
1
|
+
import { Annotorious as p, AnnotoriousContext as a, useAnnotationStore as i, useAnnotations as m, useAnnotator as f, useAnnotatorUser as u, useSelection as x, useViewportState as s } from "./annotorious-react.es2.js";
|
|
2
|
+
import { AnnotoriousPlugin as g } from "./annotorious-react.es3.js";
|
|
3
|
+
import { Draggable as d } from "./annotorious-react.es4.js";
|
|
4
|
+
import { ImageAnnotator as c } from "./annotorious-react.es5.js";
|
|
5
5
|
import "./annotorious-react.es6.js";
|
|
6
6
|
import "./annotorious-react.es7.js";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
7
|
+
import { defaultColorProvider as P } from "./annotorious-react.es8.js";
|
|
8
|
+
import "./annotorious-react.es9.js";
|
|
9
|
+
import { PointerSelectAction as C } from "./annotorious-react.es10.js";
|
|
10
|
+
import { createBody as y } from "./annotorious-react.es11.js";
|
|
11
|
+
import { Origin as b } from "./annotorious-react.es12.js";
|
|
12
|
+
import { ShapeType as v, W3CImageFormat as B } from "./annotorious-react.es13.js";
|
|
13
|
+
import { OpenSeadragonAnnotator as F, useViewer as T } from "./annotorious-react.es14.js";
|
|
14
|
+
import { OpenSeadragonPopup as W } from "./annotorious-react.es15.js";
|
|
15
|
+
import { OpenSeadragonViewer as k } from "./annotorious-react.es16.js";
|
|
13
16
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
x as
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
B as useViewer,
|
|
36
|
-
d as useViewportState
|
|
17
|
+
p as Annotorious,
|
|
18
|
+
a as AnnotoriousContext,
|
|
19
|
+
g as AnnotoriousPlugin,
|
|
20
|
+
d as Draggable,
|
|
21
|
+
c as ImageAnnotator,
|
|
22
|
+
F as OpenSeadragonAnnotator,
|
|
23
|
+
W as OpenSeadragonPopup,
|
|
24
|
+
k as OpenSeadragonViewer,
|
|
25
|
+
b as Origin,
|
|
26
|
+
C as PointerSelectAction,
|
|
27
|
+
v as ShapeType,
|
|
28
|
+
B as W3CImageFormat,
|
|
29
|
+
y as createBody,
|
|
30
|
+
P as defaultColorProvider,
|
|
31
|
+
i as useAnnotationStore,
|
|
32
|
+
m as useAnnotations,
|
|
33
|
+
f as useAnnotator,
|
|
34
|
+
u as useAnnotatorUser,
|
|
35
|
+
x as useSelection,
|
|
36
|
+
T as useViewer,
|
|
37
|
+
s as useViewportState
|
|
37
38
|
};
|
|
38
39
|
//# sourceMappingURL=annotorious-react.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es.js","sources":[
|
|
1
|
+
{"version":3,"file":"annotorious-react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { useRef as w, useState as d, useEffect as u } from "react";
|
|
3
|
-
import { Draggable as x } from "./annotorious-react.es4.js";
|
|
4
|
-
import { useViewer as S } from "./annotorious-react.es9.js";
|
|
5
|
-
import { useSelection as j } from "./annotorious-react.es2.js";
|
|
6
|
-
import { setPosition as D } from "./annotorious-react.es16.js";
|
|
7
|
-
const R = (c) => {
|
|
8
|
-
const n = w(null), o = S(), { selected: t } = j(), [l, m] = d([]), [s, i] = d(!1), f = () => i(!0), p = () => {
|
|
9
|
-
const e = t[0].annotation;
|
|
10
|
-
D(o, e, n.current);
|
|
11
|
-
}, g = (e, r) => e.every((a) => r.includes(a)) && r.every((a) => e.includes(a));
|
|
12
|
-
return u(() => {
|
|
13
|
-
const e = t.map(({ annotation: r }) => r.id);
|
|
14
|
-
g(l, e) || (i(!1), m(e));
|
|
15
|
-
}, [t]), u(() => {
|
|
16
|
-
if (!n.current)
|
|
17
|
-
return;
|
|
18
|
-
s || p();
|
|
19
|
-
const e = () => {
|
|
20
|
-
s || p();
|
|
21
|
-
};
|
|
22
|
-
return o.addHandler("update-viewport", e), () => {
|
|
23
|
-
o.removeHandler("update-viewport", e);
|
|
24
|
-
};
|
|
25
|
-
}, [t, s]), t.length > 0 ? /* @__PURE__ */ v.jsx(
|
|
26
|
-
x,
|
|
27
|
-
{
|
|
28
|
-
ref: n,
|
|
29
|
-
className: "a9s-popup a9s-osd-popup",
|
|
30
|
-
onDragStart: f,
|
|
31
|
-
children: c.popup({ viewer: o, selected: t })
|
|
32
|
-
},
|
|
33
|
-
t.map(({ annotation: e }) => e.id).join("-")
|
|
34
|
-
) : null;
|
|
35
|
-
};
|
|
1
|
+
var N = /* @__PURE__ */ ((E) => (E.EDIT = "EDIT", E.SELECT = "SELECT", E.NONE = "NONE", E))(N || {});
|
|
36
2
|
export {
|
|
37
|
-
|
|
3
|
+
N as PointerSelectAction
|
|
38
4
|
};
|
|
39
5
|
//# sourceMappingURL=annotorious-react.es10.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es10.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es10.js","sources":["../../annotorious-core/src/state/Selection.ts"],"sourcesContent":["import { writable } from 'svelte/store';\nimport type { Annotation } from '../model';\nimport type { Store } from './Store';\n \nexport type Selection = {\n\n selected: { id: string, editable?: boolean }[],\n\n pointerEvent?: PointerEvent;\n\n}\n\nexport type SelectionState<T extends Annotation> = ReturnType<typeof createSelectionState<T>>;\n\nexport enum PointerSelectAction {\n\n EDIT = 'EDIT', // Make annotation target(s) editable on pointer select\n \n SELECT = 'SELECT', // Just select, but don't make editable\n\n NONE = 'NONE' // Click won't select - annotation is completely inert\n\n}\n\nconst EMPTY: Selection = { selected: [] };\n\nexport const createSelectionState = <T extends Annotation>(\n store: Store<T>,\n selectAction: PointerSelectAction | ((a: Annotation) => PointerSelectAction) = PointerSelectAction.EDIT\n) => {\n const { subscribe, set } = writable<Selection>(EMPTY);\n\n let currentSelection: Selection = EMPTY;\n\n subscribe(updated => currentSelection = updated);\n\n const clear = () => set(EMPTY);\n\n const isEmpty = () => currentSelection.selected?.length === 0;\n\n const isSelected = (annotationOrId: T | string) => {\n if (currentSelection.selected.length === 0)\n return false;\n\n const id = typeof annotationOrId === 'string' ? annotationOrId : annotationOrId.id;\n return currentSelection.selected.some(i => i.id === id);\n }\n\n // TODO enable CTRL select\n const clickSelect = (id: string, pointerEvent: PointerEvent) => {\n const annotation = store.getAnnotation(id);\n if (annotation) {\n const action = onPointerSelect(annotation, selectAction);\n if (action === PointerSelectAction.EDIT)\n set({ selected: [{ id, editable: true }], pointerEvent }); \n else if (action === PointerSelectAction.SELECT)\n set({ selected: [{ id }], pointerEvent }); \n else\n set({ selected: [], pointerEvent });\n } else {\n console.warn('Invalid selection: ' + id);\n }\n }\n\n const setSelected = (idOrIds: string | string[], editable: boolean = true) => {\n const ids = Array.isArray(idOrIds) ? idOrIds : [idOrIds];\n\n // Remove invalid\n const annotations = \n ids.map(id => store.getAnnotation(id)).filter(a => a); \n\n set({ selected: annotations.map(({ id }) => ({ id, editable })) });\n \n if (annotations.length !== ids.length)\n console.warn('Invalid selection', idOrIds);\n }\n\n const removeFromSelection = (ids: string[]) => {\n if (currentSelection.selected.length === 0)\n return false;\n\n const { selected } = currentSelection;\n\n // Checks which of the given annotations are actually in the selection\n const toRemove = selected.filter(({ id }) => ids.includes(id))\n\n if (toRemove.length > 0)\n set({ selected: selected.filter(({ id }) => !ids.includes(id)) });\n }\n\n // Track store delete and update events\n store.observe(({ changes }) =>\n removeFromSelection(changes.deleted.map(a => a.id)));\n\n return { \n clear, \n clickSelect, \n get selected() { return currentSelection ? [...currentSelection.selected ] : null},\n get pointerEvent() { return currentSelection ? currentSelection.pointerEvent : null },\n isEmpty, \n isSelected, \n setSelected, \n subscribe \n };\n\n}\n\nexport const onPointerSelect = (\n annotation: Annotation, \n action?: PointerSelectAction | ((a: Annotation) => PointerSelectAction)\n): PointerSelectAction => (typeof action === 'function') ?\n (action(annotation) || PointerSelectAction.EDIT) : \n (action || PointerSelectAction.EDIT);\n"],"names":["PointerSelectAction"],"mappings":"AAcY,IAAAA,sBAAAA,OAEVA,EAAA,OAAO,QAEPA,EAAA,SAAS,UAETA,EAAA,OAAO,QANGA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (r.current) {
|
|
9
|
-
const o = l({ ...t, element: r.current });
|
|
10
|
-
return e && e(o), () => {
|
|
11
|
-
o.destroy(), e && e(void 0);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}, [JSON.stringify(t)]), d(s, () => f), /* @__PURE__ */ m.jsx("div", { className: i, ref: r });
|
|
1
|
+
import n from "./annotorious-react.es30.js";
|
|
2
|
+
const d = (t, e, o, a) => ({
|
|
3
|
+
id: n(),
|
|
4
|
+
annotation: t.id,
|
|
5
|
+
created: o || /* @__PURE__ */ new Date(),
|
|
6
|
+
creator: a,
|
|
7
|
+
...e
|
|
15
8
|
});
|
|
16
9
|
export {
|
|
17
|
-
|
|
10
|
+
d as createBody
|
|
18
11
|
};
|
|
19
12
|
//# sourceMappingURL=annotorious-react.es11.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es11.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es11.js","sources":["../../annotorious-core/src/utils/annotationUtils.ts"],"sourcesContent":["import { v4 as uuidv4 } from 'uuid';\nimport type { Annotation, AnnotationBody, User } from '../model';\n\n/**\n * Returns all users listed as creators or updaters in any parts of this\n * annotation.\n */\nexport const getContributors = (annotation: Annotation): User[] => {\n const { creator, updatedBy } = annotation.target;\n\n const bodyCollaborators = annotation.bodies.reduce((users, body) => (\n [...users, body.creator, body.updatedBy]\n ), [] as User[]);\n\n return [\n creator,\n updatedBy,\n ...bodyCollaborators\n ].filter(u => u); // Remove undefined\n}\n\nexport const createBody = (\n annotation: Annotation, \n payload: { [key: string]: any },\n created?: Date,\n creator?: User\n): AnnotationBody => ({\n id: uuidv4(),\n annotation: annotation.id,\n created: created || new Date(),\n creator,\n ...payload\n});"],"names":["createBody","annotation","payload","created","creator","uuidv4"],"mappings":";AAqBO,MAAMA,IAAa,CACxBC,GACAC,GACAC,GACAC,OACoB;AAAA,EACpB,IAAIC,EAAO;AAAA,EACX,YAAYJ,EAAW;AAAA,EACvB,SAASE,KAAW,oBAAI,KAAK;AAAA,EAC7B,SAAAC;AAAA,EACA,GAAGF;AACL;"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { __require as r } from "./annotorious-react.es18.js";
|
|
3
|
-
import { __require as o } from "./annotorious-react.es19.js";
|
|
4
|
-
process.env.NODE_ENV === "production" ? e.exports = o() : e.exports = r();
|
|
5
|
-
var m = e.exports;
|
|
1
|
+
var L = /* @__PURE__ */ ((E) => (E.LOCAL = "LOCAL", E.REMOTE = "REMOTE", E))(L || {});
|
|
6
2
|
export {
|
|
7
|
-
|
|
3
|
+
L as Origin
|
|
8
4
|
};
|
|
9
5
|
//# sourceMappingURL=annotorious-react.es12.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es12.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es12.js","sources":["../../annotorious-core/src/state/StoreObserver.ts"],"sourcesContent":["import type { Annotation, AnnotationBody, AnnotationTarget } from '../model';\n\n/** Interface for listening to changes in the annotation store **/\nexport interface StoreObserver<T extends Annotation> { \n\n onChange: { (event: StoreChangeEvent<T>): void };\n\n options: StoreObserveOptions;\n\n}\n\n/** A change event fired when the store state changes **/\nexport interface StoreChangeEvent<T extends Annotation> {\n\n origin: Origin;\n\n changes: ChangeSet<T>;\n\n state: T[];\n\n}\n\nexport interface ChangeSet<T extends Annotation> {\n\n created?: T[];\n\n deleted?: T[];\n\n updated?: Update<T>[];\n\n}\n\nexport interface Update<T extends Annotation> {\n\n oldValue: T;\n\n newValue: T;\n\n bodiesCreated?: AnnotationBody[];\n\n bodiesDeleted?: AnnotationBody[];\n\n bodiesUpdated?: Array<{ oldBody: AnnotationBody, newBody: AnnotationBody }>;\n\n targetUpdated?: { oldTarget: AnnotationTarget, newTarget: AnnotationTarget};\n\n}\n\n/** Options to control which events the observer wants to get notified about **/\nexport interface StoreObserveOptions {\n\n // Observe changes on targets, bodies or both?\n ignore?: Ignore;\n\n // Observe changes on one more specific annotations\n annotations?: string | string[];\n\n // Observer changes only for a specific origin\n origin?: Origin\n\n}\n\n/** Allows the observer to ignore certain event types **/\nexport enum Ignore { \n\n // Don't notify this observer for changes that involve bodies only\n BODY_ONLY = 'BODY_ONLY',\n\n // Don't notify for changes on targets only\n TARGET_ONLY = 'TARGET_ONLY'\n\n}\n\n/** Allows the observer to listen only for events that originated locally or from a remote source **/\nexport enum Origin { \n \n LOCAL = 'LOCAL', \n \n REMOTE = 'REMOTE' \n\n}\n\n/** Tests if this observer should be notified about this event **/\nexport const shouldNotify = <T extends Annotation>(observer: StoreObserver<T>, event: StoreChangeEvent<T>) => {\n const { changes, origin } = event;\n\n const isRelevantOrigin = \n !observer.options.origin || observer.options.origin === origin;\n\n if (!isRelevantOrigin)\n return false;\n\n if (observer.options.ignore) {\n const { ignore } = observer.options;\n\n // Shorthand\n const has = (arg: any[]) => arg?.length > 0;\n\n const hasAnnotationChanges =\n has(changes.created) || has(changes.deleted);\n\n if (!hasAnnotationChanges) {\n const hasBodyChanges =\n changes.updated?.some(u => has(u.bodiesCreated) || has(u.bodiesDeleted) || has(u.bodiesUpdated));\n \n const hasTargetChanges = \n changes.updated?.some(u => u.targetUpdated);\n\n if (ignore === Ignore.BODY_ONLY && hasBodyChanges && !hasTargetChanges)\n return false;\n\n if (ignore === Ignore.TARGET_ONLY && hasTargetChanges && !hasBodyChanges)\n return false;\n }\n }\n\n if (observer.options.annotations) {\n // This observer has a filter set on specific annotations - check affected\n const affectedAnnotations = new Set([\n ...changes.created.map(a => a.id),\n ...changes.deleted.map(a => a.id),\n ...changes.updated.map(({ oldValue }) => oldValue.id)\n ]);\n\n const observed = Array.isArray(observer.options.annotations) ?\n observer.options.annotations : [ observer.options.annotations ];\n\n return Boolean(observed.find(id => affectedAnnotations.has(id)));\n } else {\n return true;\n }\n\n}\n\nexport const mergeChanges = <T extends Annotation>(event: StoreChangeEvent<T>, toMerge: StoreChangeEvent<T>) => {\n if (event.origin !== toMerge.origin)\n throw 'Cannot merge events from different origins';\n\n return {\n origin: toMerge.origin,\n changes: {\n // TODO filter created that were deleted in the same go\n created: [...(event.changes.created || []), ...(toMerge.changes.created || []) ],\n deleted: [...(event.changes.deleted || []), ...(toMerge.changes.deleted || []) ] \n // TODO merge updates\n },\n state: toMerge.state\n }\n}"],"names":["Origin"],"mappings":"AA0EY,IAAAA,sBAAAA,OAEVA,EAAA,QAAQ,SAERA,EAAA,SAAS,UAJCA,IAAAA,KAAA,CAAA,CAAA;"}
|