@annotorious/react 3.0.0-rc.20 → 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.
- package/dist/Annotorious.d.ts +28 -3
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/AnnotoriousPlugin.d.ts +6 -7
- package/dist/AnnotoriousPlugin.d.ts.map +1 -1
- package/dist/ImageAnnotator.d.ts.map +1 -1
- package/dist/annotorious-react.css +1 -1
- package/dist/annotorious-react.es.js +50 -33
- package/dist/annotorious-react.es.js.map +1 -1
- package/dist/annotorious-react.es10.js +3 -29
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +27 -36
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +20 -16
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +54 -6
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +17 -8
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +21 -152
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +2 -27436
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +2 -32
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +3859 -2
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +29 -30
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +32 -32
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js +35 -598
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js +16 -2
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es22.js +4 -2
- package/dist/annotorious-react.es22.js.map +1 -1
- package/dist/annotorious-react.es23.js +11 -0
- package/dist/annotorious-react.es23.js.map +1 -0
- package/dist/annotorious-react.es24.js +156 -0
- package/dist/annotorious-react.es24.js.map +1 -0
- package/dist/annotorious-react.es25.js +9 -0
- package/dist/annotorious-react.es25.js.map +1 -0
- package/dist/annotorious-react.es26.js +20665 -0
- package/dist/annotorious-react.es26.js.map +1 -0
- package/dist/annotorious-react.es27.js +35 -0
- package/dist/annotorious-react.es27.js.map +1 -0
- package/dist/annotorious-react.es28.js +5 -0
- package/dist/annotorious-react.es28.js.map +1 -0
- package/dist/annotorious-react.es29.js +33 -0
- package/dist/annotorious-react.es29.js.map +1 -0
- package/dist/annotorious-react.es3.js +7 -7
- package/dist/annotorious-react.es3.js.map +1 -1
- package/dist/annotorious-react.es30.js +602 -0
- package/dist/annotorious-react.es30.js.map +1 -0
- package/dist/annotorious-react.es31.js +5 -0
- package/dist/annotorious-react.es31.js.map +1 -0
- package/dist/annotorious-react.es32.js +5 -0
- package/dist/annotorious-react.es32.js.map +1 -0
- package/dist/annotorious-react.es33.js +20 -0
- package/dist/annotorious-react.es33.js.map +1 -0
- package/dist/annotorious-react.es34.js +30 -0
- package/dist/annotorious-react.es34.js.map +1 -0
- package/dist/annotorious-react.es35.js +19 -0
- package/dist/annotorious-react.es35.js.map +1 -0
- package/dist/annotorious-react.es36.js +24 -0
- package/dist/annotorious-react.es36.js.map +1 -0
- package/dist/annotorious-react.es37.js +19 -0
- package/dist/annotorious-react.es37.js.map +1 -0
- package/dist/annotorious-react.es38.js +7 -0
- package/dist/annotorious-react.es38.js.map +1 -0
- package/dist/annotorious-react.es39.js +11 -0
- package/dist/annotorious-react.es39.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.es40.js +10 -0
- package/dist/annotorious-react.es40.js.map +1 -0
- 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 +46 -85
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +10 -4237
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +10 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
- package/dist/openseadragon/setPosition.d.ts.map +1 -1
- package/package.json +8 -16
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;
|
|
@@ -24,8 +24,33 @@ export declare const AnnotoriousContext: import("react").Context<{
|
|
|
24
24
|
export declare const Annotorious: import("react").ForwardRefExoticComponent<{
|
|
25
25
|
children: ReactNode;
|
|
26
26
|
} & import("react").RefAttributes<Annotator<Annotation, Annotation>>>;
|
|
27
|
-
export declare const useAnnotator: <T extends
|
|
28
|
-
export declare const useAnnotationStore: <T extends
|
|
27
|
+
export declare const useAnnotator: <T extends Annotator<any, unknown>>() => T;
|
|
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
|
+
bulkUpdateAnnotation: (annotations: Annotation[], origin?: import("@annotorious/core").Origin) => void;
|
|
35
|
+
bulkUpdateBodies: (bodies: import("@annotorious/core").AnnotationBody[], origin?: import("@annotorious/core").Origin) => void;
|
|
36
|
+
bulkUpdateTargets: (targets: import("@annotorious/core").AnnotationTarget[], origin?: import("@annotorious/core").Origin) => void;
|
|
37
|
+
clear: (origin?: import("@annotorious/core").Origin) => void;
|
|
38
|
+
deleteAnnotation: (annotationOrId: string | Annotation, origin?: import("@annotorious/core").Origin) => void;
|
|
39
|
+
deleteBody: (body: {
|
|
40
|
+
id: string;
|
|
41
|
+
annotation: string;
|
|
42
|
+
}, origin?: import("@annotorious/core").Origin) => void;
|
|
43
|
+
getAnnotation: (id: string) => Annotation;
|
|
44
|
+
getBody: (id: string) => import("@annotorious/core").AnnotationBody;
|
|
45
|
+
observe: (onChange: (event: StoreChangeEvent<Annotation>) => void, options?: import("@annotorious/core").StoreObserveOptions) => number;
|
|
46
|
+
unobserve: (onChange: (event: StoreChangeEvent<Annotation>) => void) => void;
|
|
47
|
+
updateAnnotation: (arg1: string | Annotation, arg2?: Annotation | import("@annotorious/core").Origin, arg3?: import("@annotorious/core").Origin) => void;
|
|
48
|
+
updateBody: (oldBodyId: {
|
|
49
|
+
id: string;
|
|
50
|
+
annotation: string;
|
|
51
|
+
}, newBody: import("@annotorious/core").AnnotationBody, origin?: import("@annotorious/core").Origin) => void;
|
|
52
|
+
updateTarget: (target: import("@annotorious/core").AnnotationTarget, origin?: import("@annotorious/core").Origin) => void;
|
|
53
|
+
}>() => T;
|
|
29
54
|
export declare const useAnnotations: <T extends Annotation>(debounce?: number) => T[];
|
|
30
55
|
export declare const useSelection: <T extends Annotation>() => Selection<T>;
|
|
31
56
|
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,10 +1,9 @@
|
|
|
1
|
-
import { Annotator } from '@annotorious/annotorious';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
plugin: AnnotatorPlugin<T>;
|
|
1
|
+
import { Annotation, Annotator } from '@annotorious/annotorious';
|
|
2
|
+
export interface AnnotoriousPluginProps<I extends Annotation, E extends unknown> {
|
|
3
|
+
plugin: (anno: Annotator<I, E>, opts?: Object) => ({
|
|
4
|
+
unmount?: () => void;
|
|
5
|
+
}) | void;
|
|
7
6
|
opts?: Object;
|
|
8
7
|
}
|
|
9
|
-
export declare const AnnotoriousPlugin: <
|
|
8
|
+
export declare const AnnotoriousPlugin: <I extends Annotation = Annotation, E extends unknown = unknown>(props: AnnotoriousPluginProps<I, E>) => any;
|
|
10
9
|
//# sourceMappingURL=AnnotoriousPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotoriousPlugin.d.ts","sourceRoot":"","sources":["../src/AnnotoriousPlugin.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"AnnotoriousPlugin.d.ts","sourceRoot":"","sources":["../src/AnnotoriousPlugin.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,WAAW,sBAAsB,CAAE,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO;IAE9E,MAAM,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAEpF,IAAI,CAAC,EAAE,MAAM,CAAC;CAEf;AAED,eAAO,MAAM,iBAAiB,8GAkB7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageAnnotator.d.ts","sourceRoot":"","sources":["../src/ImageAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAuC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGnG,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;IAEjG,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAEzC,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAEjC,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,UAAU,EAAE,eAAe,KAAK,YAAY,CAAC,CAAC;IAEvE,IAAI,CAAC,EAAE,WAAW,CAAA;CAEnB;AAED,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"ImageAnnotator.d.ts","sourceRoot":"","sources":["../src/ImageAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAuC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGnG,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;IAEjG,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAEzC,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAEjC,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,UAAU,EAAE,eAAe,KAAK,YAAY,CAAC,CAAC;IAEvE,IAAI,CAAC,EAAE,WAAW,CAAA;CAEnB;AAED,eAAO,MAAM,cAAc,+FA+B1B,CAAA"}
|
|
@@ -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,55 @@
|
|
|
1
|
-
import { Annotorious as
|
|
2
|
-
import { AnnotoriousPlugin as
|
|
3
|
-
import { Draggable as
|
|
4
|
-
import { ImageAnnotator as
|
|
1
|
+
import { Annotorious as n, AnnotoriousContext as a, useAnnotationStore as p, useAnnotations as i, useAnnotator as m, useAnnotatorUser as s, useSelection as f, useViewportState as x } from "./annotorious-react.es2.js";
|
|
2
|
+
import { AnnotoriousPlugin as A } from "./annotorious-react.es3.js";
|
|
3
|
+
import { Draggable as c } from "./annotorious-react.es4.js";
|
|
4
|
+
import { ImageAnnotator as g } 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 { createBaseAnnotator as C } from "./annotorious-react.es8.js";
|
|
8
|
+
import { parseAll as B, serializeAll as E } from "./annotorious-react.es9.js";
|
|
9
|
+
import { createAnonymousGuest as w } from "./annotorious-react.es10.js";
|
|
10
|
+
import { parseW3CBodies as V, serializeW3CBodies as W } from "./annotorious-react.es11.js";
|
|
11
|
+
import { createDefaultAppearenceProvider as v, defaultColorProvider as z } from "./annotorious-react.es12.js";
|
|
12
|
+
import { PRESENCE_KEY as I, createPresenceState as h } from "./annotorious-react.es13.js";
|
|
13
|
+
import { createBody as G, getContributors as K } from "./annotorious-react.es14.js";
|
|
14
|
+
import { diffAnnotations as R } from "./annotorious-react.es15.js";
|
|
15
|
+
import { PointerSelectAction as U } from "./annotorious-react.es16.js";
|
|
16
|
+
import { Origin as _ } from "./annotorious-react.es17.js";
|
|
17
|
+
import { ShapeType as k, W3CImageFormat as q } from "./annotorious-react.es18.js";
|
|
18
|
+
import { OpenSeadragonAnnotator as J, useViewer as L } from "./annotorious-react.es19.js";
|
|
19
|
+
import { OpenSeadragonPopup as Q } from "./annotorious-react.es20.js";
|
|
20
|
+
import { OpenSeadragonViewer as Z } from "./annotorious-react.es21.js";
|
|
13
21
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
n as Annotorious,
|
|
23
|
+
a as AnnotoriousContext,
|
|
24
|
+
A as AnnotoriousPlugin,
|
|
25
|
+
c as Draggable,
|
|
26
|
+
g as ImageAnnotator,
|
|
27
|
+
J as OpenSeadragonAnnotator,
|
|
28
|
+
Q as OpenSeadragonPopup,
|
|
29
|
+
Z as OpenSeadragonViewer,
|
|
30
|
+
_ as Origin,
|
|
31
|
+
I as PRESENCE_KEY,
|
|
32
|
+
U as PointerSelectAction,
|
|
33
|
+
k as ShapeType,
|
|
34
|
+
q as W3CImageFormat,
|
|
35
|
+
w as createAnonymousGuest,
|
|
36
|
+
C as createBaseAnnotator,
|
|
37
|
+
G as createBody,
|
|
38
|
+
v as createDefaultAppearenceProvider,
|
|
39
|
+
h as createPresenceState,
|
|
40
|
+
z as defaultColorProvider,
|
|
41
|
+
R as diffAnnotations,
|
|
42
|
+
K as getContributors,
|
|
43
|
+
B as parseAll,
|
|
44
|
+
V as parseW3CBodies,
|
|
45
|
+
E as serializeAll,
|
|
46
|
+
W as serializeW3CBodies,
|
|
47
|
+
p as useAnnotationStore,
|
|
48
|
+
i as useAnnotations,
|
|
49
|
+
m as useAnnotator,
|
|
50
|
+
s as useAnnotatorUser,
|
|
51
|
+
f as useSelection,
|
|
52
|
+
L as useViewer,
|
|
53
|
+
x as useViewportState
|
|
37
54
|
};
|
|
38
55
|
//# 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,32 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { createOSDAnnotator as g } from "./annotorious-react.es16.js";
|
|
4
|
-
import { AnnotoriousContext as m } from "./annotorious-react.es2.js";
|
|
5
|
-
const s = w({ viewer: null, setViewer: null }), S = (e) => {
|
|
6
|
-
const { children: E, tool: r, ...d } = e, [o, f] = u(), { anno: t, setAnno: l } = a(m);
|
|
7
|
-
return i(() => {
|
|
8
|
-
if (o) {
|
|
9
|
-
const n = g(o, d);
|
|
10
|
-
return e.drawingEnabled !== void 0 && n.setDrawingEnabled(e.drawingEnabled), e.filter && n.setFilter(e.filter), e.style && n.setStyle(e.style), e.tool && n.setDrawingTool(e.tool), l(n), () => {
|
|
11
|
-
n.destroy(), l(void 0);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}, [o]), i(() => {
|
|
15
|
-
t && t.setDrawingEnabled(e.drawingEnabled);
|
|
16
|
-
}, [e.drawingEnabled]), i(() => {
|
|
17
|
-
t && t.setFilter(e.filter);
|
|
18
|
-
}, [e.filter]), i(() => {
|
|
19
|
-
t && t.setStyle(e.style);
|
|
20
|
-
}, [e.style]), i(() => {
|
|
21
|
-
t && t.setDrawingTool(r);
|
|
22
|
-
}, [r]), /* @__PURE__ */ c.jsx(s.Provider, { value: { viewer: o, setViewer: f }, children: e.children });
|
|
23
|
-
}, A = () => {
|
|
24
|
-
const { viewer: e } = a(s);
|
|
25
|
-
return e;
|
|
26
|
-
};
|
|
1
|
+
import { customAlphabet as t } from "./annotorious-react.es35.js";
|
|
2
|
+
const e = () => ({ isGuest: !0, id: t("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() });
|
|
27
3
|
export {
|
|
28
|
-
|
|
29
|
-
s as OpenSeadragonAnnotatorContext,
|
|
30
|
-
A as useViewer
|
|
4
|
+
e as createAnonymousGuest
|
|
31
5
|
};
|
|
32
6
|
//# 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/model/User.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid';\n\nexport interface User {\n\n id: string;\n\n isGuest?: boolean;\n\n name?: string;\n\n avatar?: string;\n\n}\n\nexport const createAnonymousGuest = () => {\n const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_', 20);\n \n return { isGuest: true, id: nanoid() }\n}"],"names":["createAnonymousGuest","customAlphabet"],"mappings":";AAcO,MAAMA,IAAuB,OAG3B,EAAE,SAAS,IAAM,IAFTC,EAAe,mEAAmE,EAAE,EAE9D,EAAA;"}
|
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
s
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
const d = (r) => {
|
|
2
|
+
const o = JSON.stringify(r);
|
|
3
|
+
let t = 0;
|
|
4
|
+
for (let e = 0, a = o.length; e < a; e++) {
|
|
5
|
+
let n = o.charCodeAt(e);
|
|
6
|
+
t = (t << 5) - t + n, t |= 0;
|
|
7
|
+
}
|
|
8
|
+
return `${t}`;
|
|
9
|
+
}, l = (r, o) => (Array.isArray(r) ? r : [r]).map((t) => {
|
|
10
|
+
const { id: e, type: a, purpose: n, value: i, created: c, creator: s, ...p } = t;
|
|
11
|
+
return {
|
|
12
|
+
id: e || `temp-${d(t)}`,
|
|
13
|
+
annotation: o,
|
|
14
|
+
type: a,
|
|
15
|
+
purpose: n,
|
|
16
|
+
value: i,
|
|
17
|
+
created: c,
|
|
18
|
+
creator: s ? typeof s == "object" ? { ...s } : s : void 0,
|
|
19
|
+
...p
|
|
20
|
+
};
|
|
21
|
+
}), h = (r) => r.map((o) => {
|
|
22
|
+
var e;
|
|
23
|
+
const t = { ...o };
|
|
24
|
+
return delete t.annotation, (e = t.id) != null && e.startsWith("temp-") && delete t.id, t;
|
|
25
|
+
});
|
|
36
26
|
export {
|
|
37
|
-
|
|
27
|
+
l as parseW3CBodies,
|
|
28
|
+
h as serializeW3CBodies
|
|
38
29
|
};
|
|
39
30
|
//# 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/model/W3CAnnotation.ts"],"sourcesContent":["import type { AnnotationBody } from './Annotation';\n\nexport interface W3CAnnotation {\n\n '@context': 'http://www.w3.org/ns/anno.jsonld';\n\n type: 'Annotation';\n\n id: string;\n\n body: W3CAnnotationBody | W3CAnnotationBody[]\n\n target: W3CAnnotationTarget | W3CAnnotationTarget[];\n\n [key: string]: any;\n\n}\n\nexport interface W3CAnnotationBody {\n\n id?: string;\n\n type?: string;\n\n purpose?: string;\n\n value?: string;\n\n source?: string;\n\n created?: Date;\n\n creator?: {\n\n type?: string;\n\n id: string;\n\n name?: string;\n\n };\n\n}\n\nexport interface W3CAnnotationTarget {\n\n source: string;\n\n selector?: W3CSelector | W3CSelector[];\n\n}\n\nexport interface W3CSelector {\n\n type: string;\n\n conformsTo?: string;\n\n value: string;\n}\n\n// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript\nconst hashCode = (obj: Object): string => {\n const str = JSON.stringify(obj);\n\n let hash = 0;\n\n for (let i = 0, len = str.length; i < len; i++) {\n let chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n\n return `${hash}`;\n}\n\n/**\n * Helper to crosswalk the W3C annotation body to a list of core AnnotationBody objects.\n */\nexport const parseW3CBodies = (\n body: W3CAnnotationBody | W3CAnnotationBody[], \n annotationId: string\n): AnnotationBody[] => (Array.isArray(body) ? body : [body]).map(body => {\n\n // Exctract properties that conform to the internal model, but keep custom props\n const { id, type, purpose, value, created, creator, ...rest } = body;\n\n // The internal model strictly requires IDs. (Because multi-user scenarios\n // will have problems without them.) In the W3C model, bodys *may* have IDs.\n // We'll create ad-hoc IDs for bodies without IDs, but want to make sure that\n // generating the ID is idempotent: the same body should always get the same ID.\n // This will avoid unexpected results when checking for equality. \n return {\n id: id || `temp-${hashCode(body)}`,\n annotation: annotationId,\n type,\n purpose,\n value,\n created,\n creator: creator ? \n typeof creator === 'object' ? { ...creator }: creator :\n undefined,\n ...rest\n }\n\n});\n\n/** Serialization helper to remove core-specific fields from the annotation body **/\nexport const serializeW3CBodies = (bodies: AnnotationBody[]): W3CAnnotationBody[] => \n bodies.map(b => {\n const w3c = { ...b };\n delete w3c.annotation;\n\n if (w3c.id?.startsWith('temp-'))\n delete w3c.id;\n \n return w3c;\n });"],"names":["hashCode","obj","str","hash","i","len","chr","parseW3CBodies","body","annotationId","id","type","purpose","value","created","creator","rest","serializeW3CBodies","bodies","b","_a","w3c"],"mappings":"AA8DA,MAAMA,IAAW,CAACC,MAAwB;AAClC,QAAAC,IAAM,KAAK,UAAUD,CAAG;AAE9B,MAAIE,IAAO;AAEX,WAASC,IAAI,GAAGC,IAAMH,EAAI,QAAQE,IAAIC,GAAKD,KAAK;AACxC,QAAAE,IAAMJ,EAAI,WAAWE,CAAC;AAClB,IAAAD,KAAAA,KAAQ,KAAKA,IAAOG,GACpBH,KAAA;AAAA,EACZ;AAEA,SAAO,GAAGA,CAAI;AAChB,GAKaI,IAAiB,CAC5BC,GACAC,OACsB,MAAM,QAAQD,CAAI,IAAIA,IAAO,CAACA,CAAI,GAAG,IAAI,CAAAA,MAAQ;AAGjE,QAAA,EAAE,IAAAE,GAAI,MAAAC,GAAM,SAAAC,GAAS,OAAAC,GAAO,SAAAC,GAAS,SAAAC,GAAS,GAAGC,EAASR,IAAAA;AAOzD,SAAA;AAAA,IACL,IAAIE,KAAM,QAAQV,EAASQ,CAAI,CAAC;AAAA,IAChC,YAAYC;AAAA,IACZ,MAAAE;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAASC,IACP,OAAOA,KAAY,WAAW,EAAE,GAAGA,EAAQ,IAAGA,IAC9C;AAAA,IACF,GAAGC;AAAA,EAAA;AAGP,CAAC,GAGYC,IAAqB,CAACC,MACjCA,EAAO,IAAI,CAAKC,MAAA;AA/ClB,MAAAC;AAgDU,QAAAC,IAAM,EAAE,GAAGF;AACjB,gBAAOE,EAAI,aAEPD,IAAAC,EAAI,OAAJ,QAAAD,EAAQ,WAAW,YACrB,OAAOC,EAAI,IAENA;AACT,CAAC;"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { DEFAULT_PALETTE as t } from "./annotorious-react.es36.js";
|
|
2
|
+
const l = () => {
|
|
3
|
+
const o = [...t];
|
|
4
|
+
return { assignRandomColor: () => {
|
|
5
|
+
const r = Math.floor(Math.random() * o.length), e = o[r];
|
|
6
|
+
return o.splice(r, 1), e;
|
|
7
|
+
}, releaseColor: (r) => o.push(r) };
|
|
8
|
+
}, d = () => {
|
|
9
|
+
const o = l();
|
|
10
|
+
return { addUser: (r, e) => {
|
|
11
|
+
const s = o.assignRandomColor();
|
|
12
|
+
return {
|
|
13
|
+
label: e.name || e.id,
|
|
14
|
+
avatar: e.avatar,
|
|
15
|
+
color: s
|
|
16
|
+
};
|
|
17
|
+
}, removeUser: (r) => o.releaseColor(r.appearance.color) };
|
|
18
|
+
};
|
|
16
19
|
export {
|
|
17
|
-
|
|
20
|
+
d as createDefaultAppearenceProvider,
|
|
21
|
+
l as defaultColorProvider
|
|
18
22
|
};
|
|
19
23
|
//# 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/presence/AppearanceProvider.ts"],"sourcesContent":["import type { User } from '../model';\nimport type { Appearance } from './Appearance';\nimport type { PresentUser } from './PresentUser';\nimport { DEFAULT_PALETTE } from './ColorPalette';\n\nexport interface AppearanceProvider {\n\n addUser(presenceKey: string, user: User): Appearance;\n\n removeUser(user: PresentUser): void;\n\n}\n\nexport const defaultColorProvider = () => {\n\n const unassignedColors = [...DEFAULT_PALETTE];\n\n const assignRandomColor = () => {\n const rnd = Math.floor(Math.random() * unassignedColors.length);\n const color = unassignedColors[rnd];\n\n unassignedColors.splice(rnd, 1);\n\n return color;\n }\n\n const releaseColor = (color: string) =>\n unassignedColors.push(color);\n\n return { assignRandomColor, releaseColor };\n\n}\n\nexport const createDefaultAppearenceProvider = () => {\n\n const colorProvider = defaultColorProvider();\n\n const addUser = (presenceKey: string, user: User): Appearance => {\n const color = colorProvider.assignRandomColor();\n\n return {\n label: user.name || user.id,\n avatar: user.avatar,\n color\n };\n }\n\n const removeUser = (user: PresentUser) =>\n colorProvider.releaseColor(user.appearance.color);\n\n return { addUser, removeUser }\n \n}"],"names":["defaultColorProvider","unassignedColors","DEFAULT_PALETTE","rnd","color","createDefaultAppearenceProvider","colorProvider","presenceKey","user"],"mappings":";AAaO,MAAMA,IAAuB,MAAM;AAElC,QAAAC,IAAmB,CAAC,GAAGC,CAAe;AAcrC,SAAA,EAAE,mBAZiB,MAAM;AAC9B,UAAMC,IAAM,KAAK,MAAM,KAAK,WAAWF,EAAiB,MAAM,GACxDG,IAAQH,EAAiBE,CAAG;AAEjB,WAAAF,EAAA,OAAOE,GAAK,CAAC,GAEvBC;AAAA,EAAA,GAMmB,cAHP,CAACA,MACpBH,EAAiB,KAAKG,CAAK;AAI/B,GAEaC,IAAkC,MAAM;AAEnD,QAAMC,IAAgBN;AAef,SAAA,EAAE,SAbO,CAACO,GAAqBC,MAA2B;AACzD,UAAAJ,IAAQE,EAAc;AAErB,WAAA;AAAA,MACL,OAAOE,EAAK,QAAQA,EAAK;AAAA,MACzB,QAAQA,EAAK;AAAA,MACb,OAAAJ;AAAA,IAAA;AAAA,EACF,GAMgB,YAHC,CAACI,MAClBF,EAAc,aAAaE,EAAK,WAAW,KAAK;AAIpD;"}
|
|
@@ -1,9 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { nanoid as v } from "./annotorious-react.es35.js";
|
|
2
|
+
import { createNanoEvents as p } from "./annotorious-react.es37.js";
|
|
3
|
+
import { createDefaultAppearenceProvider as E } from "./annotorious-react.es12.js";
|
|
4
|
+
const w = (c, r) => c.every((o) => c.includes(o)) && r.every((o) => c.includes(o)), P = v(), y = (c = E()) => {
|
|
5
|
+
const r = p(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), m = (t, e) => {
|
|
6
|
+
if (o.has(t)) {
|
|
7
|
+
console.warn("Attempt to add user that is already present", t, e);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const n = c.addUser(t, e);
|
|
11
|
+
o.set(t, {
|
|
12
|
+
...e,
|
|
13
|
+
presenceKey: t,
|
|
14
|
+
appearance: n
|
|
15
|
+
});
|
|
16
|
+
}, u = (t) => {
|
|
17
|
+
const e = o.get(t);
|
|
18
|
+
if (!e) {
|
|
19
|
+
console.warn("Attempt to remove user that is not present", t);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
c.removeUser(e), o.delete(t);
|
|
23
|
+
}, h = (t) => {
|
|
24
|
+
const e = new Set(t.map((s) => s.presenceKey)), n = t.filter(({ presenceKey: s }) => !o.has(s)), i = Array.from(o.values()).filter((s) => !e.has(s.presenceKey));
|
|
25
|
+
n.forEach(({ presenceKey: s, user: f }) => m(s, f)), i.forEach((s) => {
|
|
26
|
+
const { presenceKey: f } = s;
|
|
27
|
+
a.has(f) && r.emit("selectionChange", s, null), u(f);
|
|
28
|
+
}), (n.length > 0 || i.length > 0) && r.emit("presence", l());
|
|
29
|
+
}, d = (t, e) => {
|
|
30
|
+
const n = o.get(t);
|
|
31
|
+
if (!n) {
|
|
32
|
+
console.warn("Activity notification from user that is not present");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const i = a.get(t);
|
|
36
|
+
(!i || !w(i, e)) && (a.set(t, e), r.emit("selectionChange", n, e));
|
|
37
|
+
}, g = (t, e) => {
|
|
38
|
+
const n = o.get(t);
|
|
39
|
+
if (!n) {
|
|
40
|
+
console.warn("Selection change for user that is not present", t);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
e ? a.set(t, e) : a.delete(t), r.emit("selectionChange", n, e);
|
|
44
|
+
}, l = () => [...Array.from(o.values())];
|
|
45
|
+
return {
|
|
46
|
+
getPresentUsers: l,
|
|
47
|
+
notifyActivity: d,
|
|
48
|
+
on: (t, e) => r.on(t, e),
|
|
49
|
+
syncUsers: h,
|
|
50
|
+
updateSelection: g
|
|
51
|
+
};
|
|
52
|
+
};
|
|
6
53
|
export {
|
|
7
|
-
|
|
54
|
+
P as PRESENCE_KEY,
|
|
55
|
+
y as createPresenceState
|
|
8
56
|
};
|
|
9
57
|
//# sourceMappingURL=annotorious-react.es13.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es13.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es13.js","sources":["../../annotorious-core/src/presence/PresenceState.ts"],"sourcesContent":["import { nanoid } from 'nanoid';\nimport { createNanoEvents, type Unsubscribe } from 'nanoevents';\nimport type { User } from '../model';\nimport type { PresentUser } from './PresentUser';\nimport type { PresenceEvents } from './PresenceEvents';\nimport { createDefaultAppearenceProvider } from './AppearanceProvider';\nimport type { AppearanceProvider } from './AppearanceProvider';\n\nexport interface PresenceState {\n\n // Get users currently present to this room\n getPresentUsers(): PresentUser[];\n\n // Notify of a given present user's activity on the given annotations\n notifyActivity(presenceKey: string, annotationIds: string[]): void;\n\n // Add a listener for the given presence event\n on<E extends keyof PresenceEvents>(event: E, callback: PresenceEvents[E]): Unsubscribe;\n\n // Initial sync - which users are present under which keys\n syncUsers(state: { presenceKey: string, user: User }[]): void;\n\n // Update the selection state for the given prresent user\n updateSelection(presenceKey: string, selection: string[] | null): void;\n\n}\n\nconst isListEqual = (listA: any[], listB: any[]) => \n listA.every(a => listA.includes(a)) && listB.every(b => listA.includes(b));\n\n// This client's presence key\nexport const PRESENCE_KEY = nanoid();\n\nexport const createPresenceState = (\n appearanceProvider: AppearanceProvider = createDefaultAppearenceProvider()\n): PresenceState => {\n\n const emitter = createNanoEvents<PresenceEvents>();\n\n const presentUsers = new Map<string, PresentUser>();\n\n const selectionStates = new Map<string, string[]>();\n\n const addUser = (presenceKey: string, user: User) => {\n if (presentUsers.has(presenceKey)) {\n console.warn('Attempt to add user that is already present', presenceKey, user);\n return; \n }\n\n const appearance = appearanceProvider.addUser(presenceKey, user);\n\n presentUsers.set(presenceKey, { \n ...user,\n presenceKey,\n appearance\n });\n }\n\n const removeUser = (presenceKey: string) => {\n const user = presentUsers.get(presenceKey);\n if (!user) {\n console.warn('Attempt to remove user that is not present', presenceKey);\n return;\n }\n\n appearanceProvider.removeUser(user);\n\n presentUsers.delete(presenceKey);\n }\n\n const syncUsers = (state: { presenceKey: string, user: User }[]) => {\n // const keys = new Set(others.map(s => s.presenceKey));\n const keys = new Set(state.map(s => s.presenceKey));\n\n // These users need to be added to the presentUsers list\n // const toAdd = others.filter(({ presenceKey }) => !presentUsers.has(presenceKey));\n const toAdd = state.filter(({ presenceKey }) => !presentUsers.has(presenceKey));\n\n // These users need to be dropped from the list\n const toRemove = Array.from(presentUsers.values()).filter(presentUser =>\n !keys.has(presentUser.presenceKey));\n\n toAdd.forEach(({ presenceKey, user }) => addUser(presenceKey, user));\n\n toRemove.forEach(user => {\n const { presenceKey } = user;\n\n // If this user has a selection, fire deselect event\n if (selectionStates.has(presenceKey))\n emitter.emit('selectionChange', user, null);\n\n removeUser(presenceKey)\n });\n\n if (toAdd.length > 0 || toRemove.length > 0)\n emitter.emit('presence', getPresentUsers());\n }\n\n const notifyActivity = (presenceKey: string, annotationIds: string[]) => { \n const user = presentUsers.get(presenceKey);\n \n if (!user) {\n console.warn('Activity notification from user that is not present');\n return;\n }\n\n const currentSelection = selectionStates.get(presenceKey);\n\n // Was there a selection change we might have missed?\n if (!currentSelection || !isListEqual(currentSelection, annotationIds)) {\n selectionStates.set(presenceKey, annotationIds);\n emitter.emit('selectionChange', user, annotationIds);\n }\n }\n\n const updateSelection = (presenceKey: string, selection: string[] | null) => {\n const from = presentUsers.get(presenceKey);\n if (!from) {\n console.warn('Selection change for user that is not present', presenceKey);\n return;\n }\n\n if (selection)\n selectionStates.set(presenceKey, selection);\n else \n selectionStates.delete(presenceKey);\n\n emitter.emit('selectionChange', from, selection);\n }\n\n const getPresentUsers = () =>\n [...Array.from(presentUsers.values())];\n \n const on = <E extends keyof PresenceEvents>(event: E, callback: PresenceEvents[E]) =>\n emitter.on(event, callback);\n\n return {\n getPresentUsers,\n notifyActivity,\n on,\n syncUsers,\n updateSelection\n }\n\n}"],"names":["isListEqual","listA","listB","a","b","PRESENCE_KEY","nanoid","createPresenceState","appearanceProvider","createDefaultAppearenceProvider","emitter","createNanoEvents","presentUsers","selectionStates","addUser","presenceKey","user","appearance","removeUser","syncUsers","state","keys","toAdd","toRemove","presentUser","getPresentUsers","notifyActivity","annotationIds","currentSelection","updateSelection","selection","from","event","callback"],"mappings":";;;AA2BA,MAAMA,IAAc,CAACC,GAAcC,MACjCD,EAAM,MAAM,OAAKA,EAAM,SAASE,CAAC,CAAC,KAAKD,EAAM,MAAM,OAAKD,EAAM,SAASG,CAAC,CAAC,GAG9DC,IAAeC,EAAO,GAEtBC,IAAsB,CACjCC,IAAyCC,QACvB;AAElB,QAAMC,IAAUC,KAEVC,wBAAmB,OAEnBC,wBAAsB,OAEtBC,IAAU,CAACC,GAAqBC,MAAe;AAC/C,QAAAJ,EAAa,IAAIG,CAAW,GAAG;AACzB,cAAA,KAAK,+CAA+CA,GAAaC,CAAI;AAC7E;AAAA,IACF;AAEA,UAAMC,IAAaT,EAAmB,QAAQO,GAAaC,CAAI;AAE/D,IAAAJ,EAAa,IAAIG,GAAa;AAAA,MAC5B,GAAGC;AAAA,MACH,aAAAD;AAAA,MACA,YAAAE;AAAA,IAAA,CACD;AAAA,EAAA,GAGGC,IAAa,CAACH,MAAwB;AACpC,UAAAC,IAAOJ,EAAa,IAAIG,CAAW;AACzC,QAAI,CAACC,GAAM;AACD,cAAA,KAAK,8CAA8CD,CAAW;AACtE;AAAA,IACF;AAEA,IAAAP,EAAmB,WAAWQ,CAAI,GAElCJ,EAAa,OAAOG,CAAW;AAAA,EAAA,GAG3BI,IAAY,CAACC,MAAiD;AAE5D,UAAAC,IAAO,IAAI,IAAID,EAAM,IAAI,CAAK,MAAA,EAAE,WAAW,CAAC,GAI5CE,IAAQF,EAAM,OAAO,CAAC,EAAE,aAAAL,QAAkB,CAACH,EAAa,IAAIG,CAAW,CAAC,GAGxEQ,IAAW,MAAM,KAAKX,EAAa,OAAQ,CAAA,EAAE,OAAO,CAAAY,MACxD,CAACH,EAAK,IAAIG,EAAY,WAAW,CAAC;AAE9B,IAAAF,EAAA,QAAQ,CAAC,EAAE,aAAAP,GAAa,MAAAC,EAAW,MAAAF,EAAQC,GAAaC,CAAI,CAAC,GAEnEO,EAAS,QAAQ,CAAQP,MAAA;AACjB,YAAA,EAAE,aAAAD,EAAgB,IAAAC;AAGpB,MAAAH,EAAgB,IAAIE,CAAW,KACzBL,EAAA,KAAK,mBAAmBM,GAAM,IAAI,GAE5CE,EAAWH,CAAW;AAAA,IAAA,CACvB,IAEGO,EAAM,SAAS,KAAKC,EAAS,SAAS,MAChCb,EAAA,KAAK,YAAYe,EAAiB,CAAA;AAAA,EAAA,GAGxCC,IAAiB,CAACX,GAAqBY,MAA4B;AACjE,UAAAX,IAAOJ,EAAa,IAAIG,CAAW;AAEzC,QAAI,CAACC,GAAM;AACT,cAAQ,KAAK,qDAAqD;AAClE;AAAA,IACF;AAEM,UAAAY,IAAmBf,EAAgB,IAAIE,CAAW;AAGxD,KAAI,CAACa,KAAoB,CAAC5B,EAAY4B,GAAkBD,CAAa,OACnDd,EAAA,IAAIE,GAAaY,CAAa,GACtCjB,EAAA,KAAK,mBAAmBM,GAAMW,CAAa;AAAA,EACrD,GAGIE,IAAkB,CAACd,GAAqBe,MAA+B;AACrE,UAAAC,IAAOnB,EAAa,IAAIG,CAAW;AACzC,QAAI,CAACgB,GAAM;AACD,cAAA,KAAK,iDAAiDhB,CAAW;AACzE;AAAA,IACF;AAEI,IAAAe,IACcjB,EAAA,IAAIE,GAAae,CAAS,IAE1CjB,EAAgB,OAAOE,CAAW,GAE5BL,EAAA,KAAK,mBAAmBqB,GAAMD,CAAS;AAAA,EAAA,GAG3CL,IAAkB,MACtB,CAAC,GAAG,MAAM,KAAKb,EAAa,OAAQ,CAAA,CAAC;AAKhC,SAAA;AAAA,IACL,iBAAAa;AAAA,IACA,gBAAAC;AAAA,IACA,IANS,CAAiCM,GAAUC,MACpDvB,EAAQ,GAAGsB,GAAOC,CAAQ;AAAA,IAM1B,WAAAd;AAAA,IACA,iBAAAU;AAAA,EAAA;AAGJ;"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import c from "./annotorious-react.es33.js";
|
|
2
|
+
const s = (t) => {
|
|
3
|
+
const { creator: e, updatedBy: r } = t.target, o = t.bodies.reduce((a, d) => [...a, d.creator, d.updatedBy], []);
|
|
4
|
+
return [
|
|
5
|
+
e,
|
|
6
|
+
r,
|
|
7
|
+
...o
|
|
8
|
+
].filter((a) => a);
|
|
9
|
+
}, i = (t, e, r, o) => ({
|
|
10
|
+
id: c(),
|
|
11
|
+
annotation: t.id,
|
|
12
|
+
created: r || /* @__PURE__ */ new Date(),
|
|
13
|
+
creator: o,
|
|
14
|
+
...e
|
|
15
|
+
});
|
|
8
16
|
export {
|
|
9
|
-
|
|
17
|
+
i as createBody,
|
|
18
|
+
s as getContributors
|
|
10
19
|
};
|
|
11
20
|
//# sourceMappingURL=annotorious-react.es14.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es14.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es14.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":["getContributors","annotation","creator","updatedBy","bodyCollaborators","users","body","u","createBody","payload","created","uuidv4"],"mappings":";AAOa,MAAAA,IAAkB,CAACC,MAAmC;AACjE,QAAM,EAAE,SAAAC,GAAS,WAAAC,MAAcF,EAAW,QAEpCG,IAAoBH,EAAW,OAAO,OAAO,CAACI,GAAOC,MACzD,CAAC,GAAGD,GAAOC,EAAK,SAASA,EAAK,SAAS,GACtC,CAAA,CAAY;AAER,SAAA;AAAA,IACLJ;AAAA,IACAC;AAAA,IACA,GAAGC;AAAA,EACL,EAAE,OAAO,CAAAG,MAAKA,CAAC;AACjB,GAEaC,IAAa,CACxBP,GACAQ,GACAC,GACAR,OACoB;AAAA,EACpB,IAAIS,EAAO;AAAA,EACX,YAAYV,EAAW;AAAA,EACvB,SAASS,KAAW,oBAAI,KAAK;AAAA,EAC7B,SAAAR;AAAA,EACA,GAAGO;AACL;"}
|