@annotorious/react 3.6.8 → 3.6.10
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.
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as m, createContext as
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, createContext as A, useState as S, useContext as a, useImperativeHandle as w, useEffect as n } from "react";
|
|
3
3
|
import { createAnonymousGuest as g } from "@annotorious/core";
|
|
4
4
|
import { createOSDAnnotator as x } from "@annotorious/openseadragon";
|
|
5
|
-
import { AnnotoriousContext as
|
|
6
|
-
const s =
|
|
7
|
-
const { children:
|
|
8
|
-
return
|
|
9
|
-
if (
|
|
10
|
-
const l = x(
|
|
11
|
-
return
|
|
12
|
-
l.destroy(),
|
|
5
|
+
import { AnnotoriousContext as h } from "./annotorious-react.es2.js";
|
|
6
|
+
const s = A({ viewer: null, setViewer: null }), D = m((t, c) => {
|
|
7
|
+
const { children: v, tool: o, ...f } = t, [i, d] = S(), { anno: e, setAnno: r } = a(h);
|
|
8
|
+
return w(c, () => e, [e]), n(() => {
|
|
9
|
+
if (i != null && i.element) {
|
|
10
|
+
const l = x(i, f);
|
|
11
|
+
return r(l), () => {
|
|
12
|
+
l.destroy(), r(void 0);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
}, [
|
|
15
|
+
}, [i]), n(() => {
|
|
16
16
|
e && e.setDrawingEnabled(t.drawingEnabled);
|
|
17
17
|
}, [e, t.drawingEnabled]), n(() => {
|
|
18
18
|
e && e.setFilter(t.filter);
|
|
19
19
|
}, [e, t.filter]), n(() => {
|
|
20
|
+
e && e.setVisible(!t.hideAnnotations);
|
|
21
|
+
}, [e, t.hideAnnotations]), n(() => {
|
|
20
22
|
e && e.setStyle(t.style);
|
|
21
23
|
}, [e, t.style]), n(() => {
|
|
22
24
|
e && e.setDrawingTool(o || "rectangle");
|
|
@@ -26,14 +28,14 @@ const s = S({ viewer: null, setViewer: null }), O = m((t, c) => {
|
|
|
26
28
|
e && (t.user ? e.setUser(t.user) : e.setUser(g()));
|
|
27
29
|
}, [e, t.user]), n(() => {
|
|
28
30
|
e && e.setUserSelectAction(t.userSelectAction);
|
|
29
|
-
}, [e, t.userSelectAction]), /* @__PURE__ */
|
|
30
|
-
}),
|
|
31
|
+
}, [e, t.userSelectAction]), /* @__PURE__ */ u(s.Provider, { value: { viewer: i, setViewer: d }, children: t.children });
|
|
32
|
+
}), O = () => {
|
|
31
33
|
const { viewer: t } = a(s);
|
|
32
34
|
return t;
|
|
33
35
|
};
|
|
34
36
|
export {
|
|
35
|
-
|
|
37
|
+
D as OpenSeadragonAnnotator,
|
|
36
38
|
s as OpenSeadragonAnnotatorContext,
|
|
37
|
-
|
|
39
|
+
O as useViewer
|
|
38
40
|
};
|
|
39
41
|
//# sourceMappingURL=annotorious-react.es8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es8.js","sources":["../src/openseadragon/OpenSeadragonAnnotator.tsx"],"sourcesContent":["import { \n createContext, \n forwardRef, \n ReactNode, \n useContext, \n useEffect, \n useImperativeHandle, \n useState \n} from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { createAnonymousGuest } from '@annotorious/core';\nimport { AnnotoriousOSDOpts, createOSDAnnotator } from '@annotorious/openseadragon';\nimport { Annotation, DrawingStyle, Filter, User} from '@annotorious/annotorious';\nimport { AnnotoriousContext } from '../Annotorious';\nimport { AnnotoriousOpenSeadragonAnnotator } from '.';\n\nexport const OpenSeadragonAnnotatorContext = createContext<{ \n viewer: OpenSeadragon.Viewer,\n setViewer(viewer: OpenSeadragon.Viewer): void\n}>({ viewer: null, setViewer: null });\n\nexport type OpenSeadragonAnnotatorProps<I extends Annotation, E extends unknown> = AnnotoriousOSDOpts<I, E> & {\n\n children?: ReactNode;\n\n filter?: Filter<I>;\n\n style?: DrawingStyle | ((annotation: I) => DrawingStyle);\n\n tool?: string | null;\n\n user?: User;\n\n}\n\nexport const OpenSeadragonAnnotator = forwardRef(<I extends Annotation, E extends unknown>(\n props: OpenSeadragonAnnotatorProps<I, E>, \n ref: React.ForwardedRef<AnnotoriousOpenSeadragonAnnotator<I, E> | null>\n) => {\n const { children, tool, ...opts } = props;\n\n const [viewer, setViewer] = useState<OpenSeadragon.Viewer>();\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useImperativeHandle(ref, () => anno as AnnotoriousOpenSeadragonAnnotator<I, E> | null, [anno]);\n\n useEffect(() => {\n if (viewer?.element) {\n const anno = createOSDAnnotator<I, E>(viewer, opts as AnnotoriousOSDOpts<I, E>);\n setAnno(anno);\n\n return () => {\n anno.destroy();\n setAnno(undefined);\n }\n }\n }, [viewer]);\n\n useEffect(() => {\n if (anno) anno.setDrawingEnabled(props.drawingEnabled);\n }, [anno, props.drawingEnabled]);\n\n useEffect(() => {\n if (anno) anno.setFilter(props.filter);\n }, [anno, props.filter]);\n\n useEffect(() => {\n if (anno) anno.setStyle(props.style);\n }, [anno, props.style]);\n\n useEffect(() => {\n if (anno) anno.setDrawingTool(tool || 'rectangle');\n }, [anno, tool]);\n\n useEffect(() => {\n if (anno) anno.setModalSelect(props.modalSelect);\n }, [anno, props.modalSelect]);\n\n useEffect(() => {\n if (!anno) return;\n \n if (props.user)\n anno.setUser(props.user);\n else \n anno.setUser(createAnonymousGuest());\n }, [anno, props.user]);\n\n useEffect(() => {\n if (anno) anno.setUserSelectAction(props.userSelectAction);\n }, [anno, props.userSelectAction]);\n\n return (\n <OpenSeadragonAnnotatorContext.Provider value={{ viewer, setViewer }}>\n {props.children}\n </OpenSeadragonAnnotatorContext.Provider>\n )\n\n}) as <I extends Annotation, E extends unknown> (\n props: OpenSeadragonAnnotatorProps<I, E> & { ref?: React.ForwardedRef<AnnotoriousOpenSeadragonAnnotator<I, E> | null> }\n) => React.ReactElement;\n\nexport const useViewer = () => {\n const { viewer } = useContext(OpenSeadragonAnnotatorContext);\n return viewer;\n}"],"names":["OpenSeadragonAnnotatorContext","createContext","OpenSeadragonAnnotator","forwardRef","props","ref","children","tool","opts","viewer","setViewer","useState","anno","setAnno","useContext","AnnotoriousContext","useImperativeHandle","useEffect","createOSDAnnotator","createAnonymousGuest","jsx","useViewer"],"mappings":";;;;;AAgBO,MAAMA,IAAgCC,EAG1C,EAAE,QAAQ,MAAM,WAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"annotorious-react.es8.js","sources":["../src/openseadragon/OpenSeadragonAnnotator.tsx"],"sourcesContent":["import { \n createContext, \n forwardRef, \n ReactNode, \n useContext, \n useEffect, \n useImperativeHandle, \n useState \n} from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { createAnonymousGuest } from '@annotorious/core';\nimport { AnnotoriousOSDOpts, createOSDAnnotator } from '@annotorious/openseadragon';\nimport { Annotation, DrawingStyle, Filter, User} from '@annotorious/annotorious';\nimport { AnnotoriousContext } from '../Annotorious';\nimport { AnnotoriousOpenSeadragonAnnotator } from '.';\n\nexport const OpenSeadragonAnnotatorContext = createContext<{ \n viewer: OpenSeadragon.Viewer,\n setViewer(viewer: OpenSeadragon.Viewer): void\n}>({ viewer: null, setViewer: null });\n\nexport type OpenSeadragonAnnotatorProps<I extends Annotation, E extends unknown> = AnnotoriousOSDOpts<I, E> & {\n\n children?: ReactNode;\n\n filter?: Filter<I>;\n\n hideAnnotations?: boolean;\n\n style?: DrawingStyle | ((annotation: I) => DrawingStyle);\n\n tool?: string | null;\n\n user?: User;\n\n}\n\nexport const OpenSeadragonAnnotator = forwardRef(<I extends Annotation, E extends unknown>(\n props: OpenSeadragonAnnotatorProps<I, E>, \n ref: React.ForwardedRef<AnnotoriousOpenSeadragonAnnotator<I, E> | null>\n) => {\n const { children, tool, ...opts } = props;\n\n const [viewer, setViewer] = useState<OpenSeadragon.Viewer>();\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useImperativeHandle(ref, () => anno as AnnotoriousOpenSeadragonAnnotator<I, E> | null, [anno]);\n\n useEffect(() => {\n if (viewer?.element) {\n const anno = createOSDAnnotator<I, E>(viewer, opts as AnnotoriousOSDOpts<I, E>);\n setAnno(anno);\n\n return () => {\n anno.destroy();\n setAnno(undefined);\n }\n }\n }, [viewer]);\n\n useEffect(() => {\n if (anno) anno.setDrawingEnabled(props.drawingEnabled);\n }, [anno, props.drawingEnabled]);\n\n useEffect(() => {\n if (anno) anno.setFilter(props.filter);\n }, [anno, props.filter]);\n\n useEffect(() => {\n if (anno) anno.setVisible(!props.hideAnnotations);\n }, [anno, props.hideAnnotations]);\n\n useEffect(() => {\n if (anno) anno.setStyle(props.style);\n }, [anno, props.style]);\n\n useEffect(() => {\n if (anno) anno.setDrawingTool(tool || 'rectangle');\n }, [anno, tool]);\n\n useEffect(() => {\n if (anno) anno.setModalSelect(props.modalSelect);\n }, [anno, props.modalSelect]);\n\n useEffect(() => {\n if (!anno) return;\n \n if (props.user)\n anno.setUser(props.user);\n else \n anno.setUser(createAnonymousGuest());\n }, [anno, props.user]);\n\n useEffect(() => {\n if (anno) anno.setUserSelectAction(props.userSelectAction);\n }, [anno, props.userSelectAction]);\n\n return (\n <OpenSeadragonAnnotatorContext.Provider value={{ viewer, setViewer }}>\n {props.children}\n </OpenSeadragonAnnotatorContext.Provider>\n )\n\n}) as <I extends Annotation, E extends unknown> (\n props: OpenSeadragonAnnotatorProps<I, E> & { ref?: React.ForwardedRef<AnnotoriousOpenSeadragonAnnotator<I, E> | null> }\n) => React.ReactElement;\n\nexport const useViewer = () => {\n const { viewer } = useContext(OpenSeadragonAnnotatorContext);\n return viewer;\n}"],"names":["OpenSeadragonAnnotatorContext","createContext","OpenSeadragonAnnotator","forwardRef","props","ref","children","tool","opts","viewer","setViewer","useState","anno","setAnno","useContext","AnnotoriousContext","useImperativeHandle","useEffect","createOSDAnnotator","createAnonymousGuest","jsx","useViewer"],"mappings":";;;;;AAgBO,MAAMA,IAAgCC,EAG1C,EAAE,QAAQ,MAAM,WAA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AKL,MAEDR,EAAM,OACRQ,EAAK,QAAQR,EAAM,IAAI,IAEvBQ,EAAK,QAAQO,GAAsB;AAAA,EACvC,GAAG,CAACP,GAAMR,EAAM,IAAI,CAAC,GAErBa,EAAU,MAAM;AACd,IAAIL,KAAMA,EAAK,oBAAoBR,EAAM,gBAAgB;AAAA,EAC3D,GAAG,CAACQ,GAAMR,EAAM,gBAAgB,CAAC,GAG/B,gBAAAgB,EAACpB,EAA8B,UAA9B,EAAuC,OAAO,EAAE,QAAAS,GAAQ,WAAAC,KACtD,UAAAN,EAAM,SAAA,CACT;AAGJ,CAAC,GAIYiB,IAAY,MAAM;AAC7B,QAAM,EAAE,QAAAZ,EAAA,IAAWK,EAAWd,CAA6B;AAC3D,SAAOS;AACT;"}
|
|
@@ -10,6 +10,7 @@ export declare const OpenSeadragonAnnotatorContext: import('react').Context<{
|
|
|
10
10
|
export type OpenSeadragonAnnotatorProps<I extends Annotation, E extends unknown> = AnnotoriousOSDOpts<I, E> & {
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
filter?: Filter<I>;
|
|
13
|
+
hideAnnotations?: boolean;
|
|
13
14
|
style?: DrawingStyle | ((annotation: I) => DrawingStyle);
|
|
14
15
|
tool?: string | null;
|
|
15
16
|
user?: User;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenSeadragonAnnotator.d.ts","sourceRoot":"","sources":["../../src/openseadragon/OpenSeadragonAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,aAAa,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAsB,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAEjF,OAAO,EAAE,iCAAiC,EAAE,MAAM,GAAG,CAAC;AAEtD,eAAO,MAAM,6BAA6B;YAChC,aAAa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AAC;IAE1B,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC;IAEzD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,IAAI,CAAC,EAAE,IAAI,CAAC;CAEb,CAAA;AAED,eAAO,MAAM,sBAAsB,EAmE7B,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO,EAC5C,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,iCAAiC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;CAAE,KACpH,KAAK,CAAC,YAAY,CAAC;AAExB,eAAO,MAAM,SAAS,4BAGrB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annotorious/react",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.10",
|
|
4
4
|
"description": "Annotorious React bindings",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@types/react": "^19.1.9",
|
|
30
30
|
"@types/react-dom": "^19.1.7",
|
|
31
31
|
"@vitejs/plugin-react": "^4.7.0",
|
|
32
|
-
"typescript": "5.
|
|
32
|
+
"typescript": "^5.9.2",
|
|
33
33
|
"vite": "^5.4.19",
|
|
34
34
|
"vite-plugin-dts": "^4.5.4",
|
|
35
35
|
"vite-tsconfig-paths": "^5.1.4"
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@annotorious/annotorious": "3.6.
|
|
49
|
-
"@annotorious/core": "3.6.
|
|
50
|
-
"@annotorious/openseadragon": "3.6.
|
|
48
|
+
"@annotorious/annotorious": "3.6.10",
|
|
49
|
+
"@annotorious/core": "3.6.10",
|
|
50
|
+
"@annotorious/openseadragon": "3.6.10",
|
|
51
51
|
"@floating-ui/react": "^0.27.15",
|
|
52
52
|
"zustand": "^5.0.7"
|
|
53
53
|
},
|