@annotorious/react-manifold 0.9.0 → 0.11.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.
Files changed (42) hide show
  1. package/dist/annotorious-react-manifold.es10.js +8 -599
  2. package/dist/annotorious-react-manifold.es10.js.map +1 -1
  3. package/dist/annotorious-react-manifold.es11.js +8 -2
  4. package/dist/annotorious-react-manifold.es11.js.map +1 -1
  5. package/dist/annotorious-react-manifold.es12.js +16 -2
  6. package/dist/annotorious-react-manifold.es12.js.map +1 -1
  7. package/dist/annotorious-react-manifold.es13.js +5 -0
  8. package/dist/annotorious-react-manifold.es13.js.map +1 -0
  9. package/dist/annotorious-react-manifold.es14.js +33 -0
  10. package/dist/annotorious-react-manifold.es14.js.map +1 -0
  11. package/dist/annotorious-react-manifold.es15.js +602 -0
  12. package/dist/annotorious-react-manifold.es15.js.map +1 -0
  13. package/dist/annotorious-react-manifold.es16.js +5 -0
  14. package/dist/annotorious-react-manifold.es16.js.map +1 -0
  15. package/dist/annotorious-react-manifold.es17.js +5 -0
  16. package/dist/annotorious-react-manifold.es17.js.map +1 -0
  17. package/dist/annotorious-react-manifold.es18.js +7 -0
  18. package/dist/annotorious-react-manifold.es18.js.map +1 -0
  19. package/dist/annotorious-react-manifold.es19.js +9 -0
  20. package/dist/annotorious-react-manifold.es19.js.map +1 -0
  21. package/dist/annotorious-react-manifold.es2.js +7 -6
  22. package/dist/annotorious-react-manifold.es2.js.map +1 -1
  23. package/dist/annotorious-react-manifold.es20.js +5 -0
  24. package/dist/annotorious-react-manifold.es20.js.map +1 -0
  25. package/dist/annotorious-react-manifold.es21.js +33 -0
  26. package/dist/annotorious-react-manifold.es21.js.map +1 -0
  27. package/dist/annotorious-react-manifold.es22.js +602 -0
  28. package/dist/annotorious-react-manifold.es22.js.map +1 -0
  29. package/dist/annotorious-react-manifold.es23.js +5 -0
  30. package/dist/annotorious-react-manifold.es23.js.map +1 -0
  31. package/dist/annotorious-react-manifold.es24.js +5 -0
  32. package/dist/annotorious-react-manifold.es24.js.map +1 -0
  33. package/dist/annotorious-react-manifold.es4.js +4 -3
  34. package/dist/annotorious-react-manifold.es4.js.map +1 -1
  35. package/dist/annotorious-react-manifold.es5.js +16 -14
  36. package/dist/annotorious-react-manifold.es5.js.map +1 -1
  37. package/dist/annotorious-react-manifold.es7.js +3 -3
  38. package/dist/annotorious-react-manifold.es8.js +46 -2
  39. package/dist/annotorious-react-manifold.es8.js.map +1 -1
  40. package/dist/annotorious-react-manifold.es9.js +1116 -29
  41. package/dist/annotorious-react-manifold.es9.js.map +1 -1
  42. package/package.json +7 -4
@@ -0,0 +1,5 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
5
+ //# sourceMappingURL=annotorious-react-manifold.es23.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotorious-react-manifold.es23.js","sources":["../node_modules/@annotorious/react/dist/annotorious-react.es21.js"],"sourcesContent":["var r = {};\nexport {\n r as __exports\n};\n//# sourceMappingURL=annotorious-react.es21.js.map\n"],"names":[],"mappings":"AAAG,IAAC,IAAI,CAAA;","x_google_ignoreList":[0]}
@@ -0,0 +1,5 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
5
+ //# sourceMappingURL=annotorious-react-manifold.es24.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotorious-react-manifold.es24.js","sources":["../node_modules/@annotorious/react/dist/annotorious-react.es22.js"],"sourcesContent":["var e = {};\nexport {\n e as __exports\n};\n//# sourceMappingURL=annotorious-react.es22.js.map\n"],"names":[],"mappings":"AAAG,IAAC,IAAI,CAAA;","x_google_ignoreList":[0]}
@@ -1,5 +1,6 @@
1
- import { Origin as c } from "@annotorious/react";
2
- const B = (r) => {
1
+ import { Origin as c } from "./annotorious-react-manifold.es10.js";
2
+ import "./annotorious-react-manifold.es9.js";
3
+ const C = (r) => {
3
4
  const e = (t) => Array.from(r.entries()).reduce((o, [n, s]) => {
4
5
  if (o)
5
6
  return o;
@@ -47,6 +48,6 @@ const B = (r) => {
47
48
  };
48
49
  };
49
50
  export {
50
- B as createManifoldInstance
51
+ C as createManifoldInstance
51
52
  };
52
53
  //# sourceMappingURL=annotorious-react-manifold.es4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es4.js","sources":["../src/AnnotoriousManifoldInstance.ts"],"sourcesContent":["import { Origin } from '@annotorious/react';\nimport type {\n Annotation, \n AnnotationBody, \n Annotator\n} from '@annotorious/react';\n\nexport interface AnnotoriousManifoldInstance<I extends Annotation = Annotation, E extends { id: string } = Annotation> {\n\n annotators: Annotator<I, E>[];\n\n sources: string[];\n\n addBody(body: AnnotationBody, origin?: Origin): void;\n\n clear(origin: Origin): void;\n\n deleteAnnotation(id: string, origin?: Origin): I | undefined;\n\n deleteBody(body: AnnotationBody, origin?: Origin): void;\n\n destroy(): void;\n\n findAnnotator(annotationId: string): Annotator<I, E> | undefined;\n\n findSource(annotationId: string): string | undefined;\n\n getAnnotation(id: string): I | undefined;\n \n getAnnotations(): I[];\n\n getAnnotator(id: string): Annotator<I, E> | undefined;\n \n setSelected(annotationId: string): void;\n\n updateAnnotation(arg1: string | I, arg2?: I | Origin, arg3?: Origin): void;\n\n}\n\nexport const createManifoldInstance = <I extends Annotation = Annotation, E extends { id: string } = Annotation>(\n annotators: Map<string, Annotator<I, E>>\n): AnnotoriousManifoldInstance<I, E> => {\n\n const find = (annotationId: string): { annotation?: I, source?: string, annotator?: Annotator<I, E> } =>\n Array.from(annotators.entries()).reduce((found, [source, annotator]) => {\n if (found)\n return found;\n\n const annotation = annotator.state.store.getAnnotation(annotationId);\n if (annotation) \n return { annotation, annotator, source };\n }, undefined as { annotation: I, annotator: Annotator<I, E> } | undefined ) || \n\n { annotation: undefined, annotator: undefined, source: undefined };\n\n /*********/\n /** API **/\n /*********/\n\n const addBody = (body: AnnotationBody, origin = Origin.LOCAL) => {\n const { annotator } = find(body.annotation);\n if (annotator)\n annotator.state.store.addBody(body, origin);\n }\n\n const clear = (origin = Origin.LOCAL) =>\n Array.from(annotators.values()).forEach(a => a.state.store.clear(origin));\n\n const deleteAnnotation = (id: string, origin = Origin.LOCAL) => {\n const { annotation, annotator } = find(id);\n\n if (annotator) {\n annotator.state.store.deleteAnnotation(id, origin);\n return annotation;\n }\n }\n\n const deleteBody = (body: AnnotationBody, origin = Origin.LOCAL) => {\n const { annotator } = find(body.annotation);\n if (annotator)\n annotator.state.store.deleteBody(body, origin);\n }\n\n const destroy = () =>\n Array.from(annotators.values()).forEach(a => a.destroy());\n\n const findAnnotator = (annotationId: string) => {\n const { annotator } = find(annotationId);\n return annotator;\n }\n\n const findSource = (annotationId: string) => {\n const { source } = find(annotationId);\n return source;\n }\n\n const getAnnotation = (annotationId: string) => \n find(annotationId).annotation;\n\n const getAnnotations = () => \n Array.from(annotators.values()).reduce((all, annotator) =>\n [...all, ...annotator.state.store.all()], [] as I[]);\n\n const getAnnotator = (id: string) => annotators.get(id);\n\n const updateAnnotation = (arg1: string | I, arg2?: I | Origin, arg3?: Origin) => {\n const oldId: string = typeof arg1 === 'string' ? arg1 : arg1.id;\n\n const { annotator } = find(oldId);\n if (annotator)\n annotator.state.store.updateAnnotation(arg1, arg2, arg3);\n }\n\n const setSelected = (id: string) => {\n const { annotator } = find(id);\n if (annotator)\n annotator.setSelected(id);\n }\n\n return {\n annotators: [...annotators.values()],\n sources: [...annotators.keys()],\n addBody,\n clear,\n deleteAnnotation,\n deleteBody,\n destroy,\n findAnnotator,\n findSource,\n getAnnotation,\n getAnnotations,\n getAnnotator,\n setSelected,\n updateAnnotation\n }\n\n}"],"names":["createManifoldInstance","annotators","find","annotationId","found","source","annotator","annotation","addBody","body","origin","Origin","clear","a","deleteAnnotation","id","deleteBody","destroy","findAnnotator","findSource","getAnnotation","getAnnotations","all","getAnnotator","updateAnnotation","arg1","arg2","arg3","oldId","setSelected"],"mappings":";AAuCa,MAAAA,IAAyB,CACpCC,MACsC;AAEtC,QAAMC,IAAO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UAAM,EAAE,QAAAE,EAAA,IAAWH,EAAKC,CAAY;AAC7B,WAAAE;AAAA,EAAA,GAGHe,IAAgB,CAACjB,MACrBD,EAAKC,CAAY,EAAE,YAEfkB,IAAiB,MACrB,MAAM,KAAKpB,EAAW,OAAQ,CAAA,EAAE,OAAO,CAACqB,GAAKhB,MAC3C,CAAC,GAAGgB,GAAK,GAAGhB,EAAU,MAAM,MAAM,IAAI,CAAC,GAAG,CAAA,CAAS,GAEjDiB,IAAe,CAACR,MAAed,EAAW,IAAIc,CAAE,GAEhDS,IAAmB,CAACC,GAAkBC,GAAmBC,MAAkB;AAC/E,UAAMC,IAAgB,OAAOH,KAAS,WAAWA,IAAOA,EAAK,IAEvD,EAAE,WAAAnB,EAAA,IAAcJ,EAAK0B,CAAK;AAC5B,IAAAtB,KACFA,EAAU,MAAM,MAAM,iBAAiBmB,GAAMC,GAAMC,CAAI;AAAA,EAAA,GAGrDE,IAAc,CAACd,MAAe;AAClC,UAAM,EAAE,WAAAT,EAAA,IAAcJ,EAAKa,CAAE;AACzB,IAAAT,KACFA,EAAU,YAAYS,CAAE;AAAA,EAAA;AAGrB,SAAA;AAAA,IACL,YAAY,CAAC,GAAGd,EAAW,QAAQ;AAAA,IACnC,SAAS,CAAC,GAAGA,EAAW,MAAM;AAAA,IAC9B,SAAAO;AAAA,IACA,OAAAI;AAAA,IACA,kBAAAE;AAAA,IACA,YAAAE;AAAA,IACA,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAE;AAAA,IACA,aAAAM;AAAA,IACA,kBAAAL;AAAA,EAAA;AAGJ;"}
1
+ {"version":3,"file":"annotorious-react-manifold.es4.js","sources":["../src/AnnotoriousManifoldInstance.ts"],"sourcesContent":["import { Origin } from '@annotorious/react';\nimport type {\n Annotation, \n AnnotationBody, \n Annotator\n} from '@annotorious/react';\n\nexport interface AnnotoriousManifoldInstance<I extends Annotation = Annotation, E extends { id: string } = Annotation> {\n\n annotators: Annotator<I, E>[];\n\n sources: string[];\n\n addBody(body: AnnotationBody, origin?: Origin): void;\n\n clear(origin: Origin): void;\n\n deleteAnnotation(id: string, origin?: Origin): I | undefined;\n\n deleteBody(body: AnnotationBody, origin?: Origin): void;\n\n destroy(): void;\n\n findAnnotator(annotationId: string): Annotator<I, E> | undefined;\n\n findSource(annotationId: string): string | undefined;\n\n getAnnotation(id: string): I | undefined;\n \n getAnnotations(): I[];\n\n getAnnotator(id: string): Annotator<I, E> | undefined;\n \n setSelected(annotationId: string): void;\n\n updateAnnotation(arg1: string | I, arg2?: I | Origin, arg3?: Origin): void;\n\n}\n\nexport const createManifoldInstance = <I extends Annotation = Annotation, E extends { id: string } = Annotation>(\n annotators: Map<string, Annotator<I, E>>\n): AnnotoriousManifoldInstance<I, E> => {\n\n const find = (annotationId: string): { annotation?: I, source?: string, annotator?: Annotator<I, E> } =>\n Array.from(annotators.entries()).reduce((found, [source, annotator]) => {\n if (found)\n return found;\n\n const annotation = annotator.state.store.getAnnotation(annotationId);\n if (annotation) \n return { annotation, annotator, source };\n }, undefined as { annotation: I, annotator: Annotator<I, E> } | undefined ) || \n\n { annotation: undefined, annotator: undefined, source: undefined };\n\n /*********/\n /** API **/\n /*********/\n\n const addBody = (body: AnnotationBody, origin = Origin.LOCAL) => {\n const { annotator } = find(body.annotation);\n if (annotator)\n annotator.state.store.addBody(body, origin);\n }\n\n const clear = (origin = Origin.LOCAL) =>\n Array.from(annotators.values()).forEach(a => a.state.store.clear(origin));\n\n const deleteAnnotation = (id: string, origin = Origin.LOCAL) => {\n const { annotation, annotator } = find(id);\n\n if (annotator) {\n annotator.state.store.deleteAnnotation(id, origin);\n return annotation;\n }\n }\n\n const deleteBody = (body: AnnotationBody, origin = Origin.LOCAL) => {\n const { annotator } = find(body.annotation);\n if (annotator)\n annotator.state.store.deleteBody(body, origin);\n }\n\n const destroy = () =>\n Array.from(annotators.values()).forEach(a => a.destroy());\n\n const findAnnotator = (annotationId: string) => {\n const { annotator } = find(annotationId);\n return annotator;\n }\n\n const findSource = (annotationId: string) => {\n const { source } = find(annotationId);\n return source;\n }\n\n const getAnnotation = (annotationId: string) => \n find(annotationId).annotation;\n\n const getAnnotations = () => \n Array.from(annotators.values()).reduce((all, annotator) =>\n [...all, ...annotator.state.store.all()], [] as I[]);\n\n const getAnnotator = (id: string) => annotators.get(id);\n\n const updateAnnotation = (arg1: string | I, arg2?: I | Origin, arg3?: Origin) => {\n const oldId: string = typeof arg1 === 'string' ? arg1 : arg1.id;\n\n const { annotator } = find(oldId);\n if (annotator)\n annotator.state.store.updateAnnotation(arg1, arg2, arg3);\n }\n\n const setSelected = (id: string) => {\n const { annotator } = find(id);\n if (annotator)\n annotator.setSelected(id);\n }\n\n return {\n annotators: [...annotators.values()],\n sources: [...annotators.keys()],\n addBody,\n clear,\n deleteAnnotation,\n deleteBody,\n destroy,\n findAnnotator,\n findSource,\n getAnnotation,\n getAnnotations,\n getAnnotator,\n setSelected,\n updateAnnotation\n }\n\n}"],"names":["createManifoldInstance","annotators","find","annotationId","found","source","annotator","annotation","addBody","body","origin","Origin","clear","a","deleteAnnotation","id","deleteBody","destroy","findAnnotator","findSource","getAnnotation","getAnnotations","all","getAnnotator","updateAnnotation","arg1","arg2","arg3","oldId","setSelected"],"mappings":";;AAuCa,MAAAA,IAAyB,CACpCC,MACsC;AAEtC,QAAMC,IAAO,CAACC,MACZ,MAAM,KAAKF,EAAW,SAAS,EAAE,OAAO,CAACG,GAAO,CAACC,GAAQC,CAAS,MAAM;AAClE,QAAAF;AACK,aAAAA;AAET,UAAMG,IAAaD,EAAU,MAAM,MAAM,cAAcH,CAAY;AAC/D,QAAAI;AACK,aAAA,EAAE,YAAAA,GAAY,WAAAD,GAAW,QAAAD;EACpC,GAAG,MAAuE,KAE1E,EAAE,YAAY,QAAW,WAAW,QAAW,QAAQ,OAAU,GAM7DG,IAAU,CAACC,GAAsBC,IAASC,EAAO,UAAU;AAC/D,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ACC,GAAkBC,GAAmBC,MAAkB;AAC/E,UAAMC,IAAgB,OAAOH,KAAS,WAAWA,IAAOA,EAAK,IAEvD,EAAE,WAAAnB,EAAA,IAAcJ,EAAK0B,CAAK;AAC5B,IAAAtB,KACFA,EAAU,MAAM,MAAM,iBAAiBmB,GAAMC,GAAMC,CAAI;AAAA,EAAA,GAGrDE,IAAc,CAACd,MAAe;AAClC,UAAM,EAAE,WAAAT,EAAA,IAAcJ,EAAKa,CAAE;AACzB,IAAAT,KACFA,EAAU,YAAYS,CAAE;AAAA,EAAA;AAGrB,SAAA;AAAA,IACL,YAAY,CAAC,GAAGd,EAAW,QAAQ;AAAA,IACnC,SAAS,CAAC,GAAGA,EAAW,MAAM;AAAA,IAC9B,SAAAO;AAAA,IACA,OAAAI;AAAA,IACA,kBAAAE;AAAA,IACA,YAAAE;AAAA,IACA,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAE;AAAA,IACA,aAAAM;AAAA,IACA,kBAAAL;AAAA,EAAA;AAGJ;"}
@@ -1,20 +1,22 @@
1
1
  import { j as r } from "./annotorious-react-manifold.es7.js";
2
- import { useContext as s, useEffect as a } from "react";
3
- import { OSDViewerContext as m } from "./annotorious-react-manifold.es6.js";
4
- import { OpenSeadragonViewer as w, useViewer as d } from "@annotorious/react";
5
- const f = (e) => {
6
- const n = d(), { setViewers: i } = s(m);
7
- return a(() => {
8
- if (n)
9
- return i((t) => new Map(t.entries()).set(e.id, n)), () => {
10
- i((t) => new Map(Array.from(t.entries()).filter(([o, p]) => o !== e.id)));
2
+ import { useContext as s, useEffect as m } from "react";
3
+ import { OSDViewerContext as a } from "./annotorious-react-manifold.es6.js";
4
+ import "./annotorious-react-manifold.es9.js";
5
+ import { useViewer as f } from "./annotorious-react-manifold.es11.js";
6
+ import { OpenSeadragonViewer as p } from "./annotorious-react-manifold.es12.js";
7
+ const w = (e) => {
8
+ const t = f(), { setViewers: i } = s(a);
9
+ return m(() => {
10
+ if (t)
11
+ return i((n) => new Map(n.entries()).set(e.id, t)), () => {
12
+ i((n) => new Map(Array.from(n.entries()).filter(([o, d]) => o !== e.id)));
11
13
  };
12
- }, [n]), null;
13
- }, S = (e) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
14
- /* @__PURE__ */ r.jsx(w, { ...e }),
15
- /* @__PURE__ */ r.jsx(f, { id: e.id })
14
+ }, [t]), null;
15
+ }, O = (e) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
16
+ /* @__PURE__ */ r.jsx(p, { ...e }),
17
+ /* @__PURE__ */ r.jsx(w, { id: e.id })
16
18
  ] });
17
19
  export {
18
- S as OpenSeadragonViewer
20
+ O as OpenSeadragonViewer
19
21
  };
20
22
  //# sourceMappingURL=annotorious-react-manifold.es5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es5.js","sources":["../src/openseadragon/OpenSeadragonViewer.tsx"],"sourcesContent":["import { useContext, useEffect } from 'react';\nimport { OSDViewerContext } from './OpenSeadragonViewerManifold';\nimport { \n OpenSeadragonViewer as OpenSeadragonViewerInstance, \n OpenSeadragonViewerProps as OpenSeadragonViewerInstanceProps, \n useViewer \n} from '@annotorious/react';\n\n/** Passes the OSD viewer instance upwards to the manifold **/\nconst OpenSeadragonViewerInstanceShim = (props: { id: string }) => {\n\n const viewer = useViewer();\n\n const { setViewers } = useContext(OSDViewerContext);\n\n useEffect(() => {\n if (viewer) {\n setViewers(m => new Map(m.entries()).set(props.id, viewer));\n\n return () => {\n setViewers(m => new Map(Array.from(m.entries()).filter(([key, _]) => key !== props.id)));\n }\n }\n }, [viewer]);\n\n return null;\n\n}\n\ntype OpenSeadragonViewerProps = OpenSeadragonViewerInstanceProps & {\n\n id: string\n\n};\n\n/**\n * An alternative <OpenSeadragonViewer /> component that mimicks the original\n * from @annotorious/react, but injects a shim component that connects\n * the Viewer to the ViewerManifold.\n */\nexport const OpenSeadragonViewer = (props: OpenSeadragonViewerProps) => {\n\n return (\n <>\n <OpenSeadragonViewerInstance {...props} />\n <OpenSeadragonViewerInstanceShim id={props.id} />\n </>\n )\n\n}"],"names":["OpenSeadragonViewerInstanceShim","props","viewer","useViewer","setViewers","useContext","OSDViewerContext","useEffect","m","key","_","OpenSeadragonViewer","jsxs","Fragment","jsx","OpenSeadragonViewerInstance"],"mappings":";;;;AASA,MAAMA,IAAkC,CAACC,MAA0B;AAEjE,QAAMC,IAASC,KAET,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAgB;AAElD,SAAAC,EAAU,MAAM;AACd,QAAIL;AACS,aAAAE,EAAA,CAAAI,MAAK,IAAI,IAAIA,EAAE,SAAS,EAAE,IAAIP,EAAM,IAAIC,CAAM,CAAC,GAEnD,MAAM;AACX,QAAAE,EAAW,OAAK,IAAI,IAAI,MAAM,KAAKI,EAAE,QAAS,CAAA,EAAE,OAAO,CAAC,CAACC,GAAKC,CAAC,MAAMD,MAAQR,EAAM,EAAE,CAAC,CAAC;AAAA,MAAA;AAAA,EAE3F,GACC,CAACC,CAAM,CAAC,GAEJ;AAET,GAaaS,IAAsB,CAACV,MAI9BW,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,EAACC,gBAAAA,EAAAA,IAAAC,GAAA,EAA6B,GAAGd,GAAO;AAAA,EACvCa,gBAAAA,EAAAA,IAAAd,GAAA,EAAgC,IAAIC,EAAM,GAAI,CAAA;AACjD,EAAA,CAAA;"}
1
+ {"version":3,"file":"annotorious-react-manifold.es5.js","sources":["../src/openseadragon/OpenSeadragonViewer.tsx"],"sourcesContent":["import { useContext, useEffect } from 'react';\nimport { OSDViewerContext } from './OpenSeadragonViewerManifold';\nimport { \n OpenSeadragonViewer as OpenSeadragonViewerInstance, \n OpenSeadragonViewerProps as OpenSeadragonViewerInstanceProps, \n useViewer \n} from '@annotorious/react';\n\n/** Passes the OSD viewer instance upwards to the manifold **/\nconst OpenSeadragonViewerInstanceShim = (props: { id: string }) => {\n\n const viewer = useViewer();\n\n const { setViewers } = useContext(OSDViewerContext);\n\n useEffect(() => {\n if (viewer) {\n setViewers(m => new Map(m.entries()).set(props.id, viewer));\n\n return () => {\n setViewers(m => new Map(Array.from(m.entries()).filter(([key, _]) => key !== props.id)));\n }\n }\n }, [viewer]);\n\n return null;\n\n}\n\ntype OpenSeadragonViewerProps = OpenSeadragonViewerInstanceProps & {\n\n id: string\n\n};\n\n/**\n * An alternative <OpenSeadragonViewer /> component that mimicks the original\n * from @annotorious/react, but injects a shim component that connects\n * the Viewer to the ViewerManifold.\n */\nexport const OpenSeadragonViewer = (props: OpenSeadragonViewerProps) => {\n\n return (\n <>\n <OpenSeadragonViewerInstance {...props} />\n <OpenSeadragonViewerInstanceShim id={props.id} />\n </>\n )\n\n}"],"names":["OpenSeadragonViewerInstanceShim","props","viewer","useViewer","setViewers","useContext","OSDViewerContext","useEffect","m","key","_","OpenSeadragonViewer","jsxs","Fragment","jsx","OpenSeadragonViewerInstance"],"mappings":";;;;;;AASA,MAAMA,IAAkC,CAACC,MAA0B;AAEjE,QAAMC,IAASC,KAET,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAgB;AAElD,SAAAC,EAAU,MAAM;AACd,QAAIL;AACS,aAAAE,EAAA,CAAAI,MAAK,IAAI,IAAIA,EAAE,SAAS,EAAE,IAAIP,EAAM,IAAIC,CAAM,CAAC,GAEnD,MAAM;AACX,QAAAE,EAAW,OAAK,IAAI,IAAI,MAAM,KAAKI,EAAE,QAAS,CAAA,EAAE,OAAO,CAAC,CAACC,GAAKC,CAAC,MAAMD,MAAQR,EAAM,EAAE,CAAC,CAAC;AAAA,MAAA;AAAA,EAE3F,GACC,CAACC,CAAM,CAAC,GAEJ;AAET,GAaaS,IAAsB,CAACV,MAI9BW,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,EAACC,gBAAAA,EAAAA,IAAAC,GAAA,EAA6B,GAAGd,GAAO;AAAA,EACvCa,gBAAAA,EAAAA,IAAAd,GAAA,EAAgC,IAAIC,EAAM,GAAI,CAAA;AACjD,EAAA,CAAA;"}
@@ -1,6 +1,6 @@
1
- import { __module as e } from "./annotorious-react-manifold.es8.js";
2
- import { __require as r } from "./annotorious-react-manifold.es9.js";
3
- import { __require as o } from "./annotorious-react-manifold.es10.js";
1
+ import { __module as e } from "./annotorious-react-manifold.es13.js";
2
+ import { __require as r } from "./annotorious-react-manifold.es14.js";
3
+ import { __require as o } from "./annotorious-react-manifold.es15.js";
4
4
  process.env.NODE_ENV === "production" ? e.exports = r() : e.exports = o();
5
5
  var m = e.exports;
6
6
  export {
@@ -1,5 +1,49 @@
1
- var e = { exports: {} };
1
+ import { jsx as j } from "./annotorious-react-manifold.es18.js";
2
+ import { createContext as B, forwardRef as D, useState as r, useImperativeHandle as G, useEffect as H, useContext as I } from "react";
3
+ const p = B({
4
+ anno: void 0,
5
+ setAnno: void 0,
6
+ annotations: [],
7
+ selection: { selected: [] }
8
+ }), V = D((a, m) => {
9
+ const [t, f] = r(null), [A, l] = r([]), [x, d] = r({ selected: [] });
10
+ return G(m, () => t), H(() => {
11
+ if (t) {
12
+ const { selection: h, store: e } = t.state;
13
+ e.all().length > 0 && l(e.all());
14
+ const c = (s) => l(() => e.all());
15
+ e.observe(c);
16
+ let o;
17
+ const C = h.subscribe(({ selected: s, pointerEvent: E }) => {
18
+ o && e.unobserve(o);
19
+ const g = (s || []).map(({ id: n, editable: i }) => ({ annotation: e.getAnnotation(n), editable: i }));
20
+ d({ selected: g, pointerEvent: E }), o = (n) => {
21
+ const { updated: i } = n.changes;
22
+ d(({ selected: w }) => ({
23
+ selected: w.map(({ annotation: u, editable: b }) => {
24
+ const v = i.find((S) => S.oldValue.id === u.id);
25
+ return v ? { annotation: v.newValue, editable: b } : { annotation: u, editable: b };
26
+ })
27
+ }));
28
+ }, e.observe(o, { annotations: s.map(({ id: n }) => n) });
29
+ });
30
+ return () => {
31
+ e.unobserve(c), C();
32
+ };
33
+ }
34
+ }, [t]), /* @__PURE__ */ j(p.Provider, { value: {
35
+ anno: t,
36
+ setAnno: f,
37
+ annotations: A,
38
+ selection: x
39
+ }, children: a.children });
40
+ }), k = () => {
41
+ const { anno: a } = I(p);
42
+ return a;
43
+ };
2
44
  export {
3
- e as __module
45
+ V as Annotorious,
46
+ p as AnnotoriousContext,
47
+ k as useAnnotator
4
48
  };
5
49
  //# sourceMappingURL=annotorious-react-manifold.es8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es8.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"annotorious-react-manifold.es8.js","sources":["../node_modules/@annotorious/react/dist/annotorious-react.es2.js"],"sourcesContent":["import { jsx as U } from \"./annotorious-react.es12.js\";\nimport { createContext as j, forwardRef as E, useState as f, useImperativeHandle as H, useEffect as h, useContext as s } from \"react\";\nimport { useDebounce as C } from \"./annotorious-react.es13.js\";\nconst n = j({\n anno: void 0,\n setAnno: void 0,\n annotations: [],\n selection: { selected: [] }\n}), B = E((t, r) => {\n const [o, u] = f(null), [p, c] = f([]), [A, l] = f({ selected: [] });\n return H(r, () => o), h(() => {\n if (o) {\n const { selection: m, store: e } = o.state;\n e.all().length > 0 && c(e.all());\n const v = (a) => c(() => e.all());\n e.observe(v);\n let i;\n const b = m.subscribe(({ selected: a, pointerEvent: w }) => {\n i && e.unobserve(i);\n const D = (a || []).map(({ id: d, editable: S }) => ({ annotation: e.getAnnotation(d), editable: S }));\n l({ selected: D, pointerEvent: w }), i = (d) => {\n const { updated: S } = d.changes;\n l(({ selected: I }) => ({\n selected: I.map(({ annotation: V, editable: g }) => {\n const x = S.find((O) => O.oldValue.id === V.id);\n return x ? { annotation: x.newValue, editable: g } : { annotation: V, editable: g };\n })\n }));\n }, e.observe(i, { annotations: a.map(({ id: d }) => d) });\n });\n return () => {\n e.unobserve(v), b();\n };\n }\n }, [o]), /* @__PURE__ */ U(n.Provider, { value: {\n anno: o,\n setAnno: u,\n annotations: p,\n selection: A\n }, children: t.children });\n}), F = () => s(n), G = () => {\n const { anno: t } = s(n);\n return t;\n}, J = () => {\n const { anno: t } = s(n);\n return t == null ? void 0 : t.state.store;\n}, P = () => {\n const { annotations: t } = s(n);\n return t;\n}, R = (t) => {\n const { annotations: r } = s(n);\n return C(r, t);\n}, K = (t) => t ? R(t) : P(), L = () => {\n const { selection: t } = s(n);\n return t;\n}, M = () => {\n const { anno: t } = s(n);\n return t == null ? void 0 : t.getUser();\n}, _ = () => {\n const { anno: t } = s(n), [r, o] = f([]);\n return h(() => {\n if (t) {\n const { store: u, viewport: p } = t.state;\n if (!p)\n return;\n let c;\n const A = p.subscribe((l) => {\n c && u.unobserve(c);\n const m = l.map((e) => u.getAnnotation(e));\n o(m), c = (e) => {\n const { updated: v } = e.changes;\n o((i) => i.map((b) => {\n const a = v.find((w) => w.oldValue.id === b.id);\n return a ? a.newValue : b;\n }));\n }, u.observe(c, { annotations: l });\n });\n return () => {\n A();\n };\n }\n }, [t]), r;\n}, k = (t) => {\n const r = _();\n return C(r, t);\n}, N = (t) => t ? k(t) : _();\nexport {\n B as Annotorious,\n n as AnnotoriousContext,\n J as useAnnotationStore,\n K as useAnnotations,\n G as useAnnotator,\n F as useAnnotatorState,\n M as useAnnotatorUser,\n L as useSelection,\n N as useViewportState\n};\n//# sourceMappingURL=annotorious-react.es2.js.map\n"],"names":["n","j","B","E","t","r","o","u","f","p","c","A","l","H","h","m","v","a","i","b","w","D","d","S","I","V","g","x","O","U","G","s"],"mappings":";;AAGK,MAACA,IAAIC,EAAE;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa,CAAE;AAAA,EACf,WAAW,EAAE,UAAU,GAAI;AAC7B,CAAC,GAAGC,IAAIC,EAAE,CAACC,GAAGC,MAAM;AAClB,QAAM,CAACC,GAAGC,CAAC,IAAIC,EAAE,IAAI,GAAG,CAACC,GAAGC,CAAC,IAAIF,EAAE,EAAE,GAAG,CAACG,GAAGC,CAAC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