@annotorious/react-manifold 0.2.0 → 0.3.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.
@@ -11,6 +11,7 @@ export interface AnnotoriousManifoldInstance<I extends Annotation = Annotation,
11
11
  deleteBody(body: AnnotationBody, origin?: Origin): void;
12
12
  destroy(): void;
13
13
  findAnnotator(annotationId: string): Annotator<I, E> | undefined;
14
+ findSource(annotationId: string): string | undefined;
14
15
  getAnnotation(id: string): I | undefined;
15
16
  getAnnotations(): I[];
16
17
  setSelected(annotationId: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"AnnotoriousManifoldInstance.d.ts","sourceRoot":"","sources":["../src/AnnotoriousManifoldInstance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACV,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,2BAA2B,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAAE,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU;IAEnH,UAAU,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAE9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErD,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAE7D,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExD,OAAO,IAAI,IAAI,CAAC;IAEhB,aAAa,CAAC,YAAY,EAAE,MAAM,GAA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;IAEhB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IAEjE,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAErD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAEzC,cAAc,IAAI,CAAC,EAAE,CAAC;IAEtB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAE5E;AAED,eAAO,MAAM,sBAAsB;QAAuD,MAAM;8FA4H/F,CAAA"}
@@ -1,13 +1,17 @@
1
- import { Annotorious as t } from "./annotorious-react-manifold.es2.js";
2
- import { AnnotoriousManifold as r, AnnotoriousManifoldContext as i, useAnnotations as s, useAnnotoriousManifold as a, useSelection as f } from "./annotorious-react-manifold.es3.js";
1
+ import { Annotorious as n } from "./annotorious-react-manifold.es2.js";
2
+ import { AnnotoriousManifold as r, AnnotoriousManifoldContext as i, useAnnotations as s, useAnnotoriousManifold as f, useSelection as a } from "./annotorious-react-manifold.es3.js";
3
3
  import { createManifoldInstance as l } from "./annotorious-react-manifold.es4.js";
4
+ import { OSDViewerContext as d, OSDViewerManifold as A, useViewers as M } from "./annotorious-react-manifold.es5.js";
4
5
  export {
5
- t as Annotorious,
6
+ n as Annotorious,
6
7
  r as AnnotoriousManifold,
7
8
  i as AnnotoriousManifoldContext,
9
+ d as OSDViewerContext,
10
+ A as OSDViewerManifold,
8
11
  l as createManifoldInstance,
9
12
  s as useAnnotations,
10
- a as useAnnotoriousManifold,
11
- f as useSelection
13
+ f as useAnnotoriousManifold,
14
+ a as useSelection,
15
+ M as useViewers
12
16
  };
13
17
  //# sourceMappingURL=annotorious-react-manifold.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"annotorious-react-manifold.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,5 +1,5 @@
1
- var e = {};
1
+ var r = {};
2
2
  export {
3
- e as __exports
3
+ r as __exports
4
4
  };
5
5
  //# sourceMappingURL=annotorious-react-manifold.es10.js.map
@@ -0,0 +1,5 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
5
+ //# sourceMappingURL=annotorious-react-manifold.es11.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotorious-react-manifold.es11.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,4 +1,4 @@
1
- import { j as n } from "./annotorious-react-manifold.es5.js";
1
+ import { j as n } from "./annotorious-react-manifold.es6.js";
2
2
  import { useContext as e, useEffect as s } from "react";
3
3
  import { Annotorious as i, useAnnotator as c } from "@annotorious/react";
4
4
  import { AnnotoriousManifoldContext as u } from "./annotorious-react-manifold.es3.js";
@@ -1,4 +1,4 @@
1
- import { j as _ } from "./annotorious-react-manifold.es5.js";
1
+ import { j as _ } from "./annotorious-react-manifold.es6.js";
2
2
  import { createContext as I, useState as A, useRef as O, useEffect as P, useContext as M } from "react";
3
3
  import { createManifoldInstance as k } from "./annotorious-react-manifold.es4.js";
4
4
  const l = I(), D = (n) => {
@@ -1,28 +1,31 @@
1
- import { Origin as r } from "@annotorious/react";
2
- const O = (s) => {
3
- const e = (t) => Array.from(s.values()).reduce((o, n) => {
1
+ import { Origin as c } from "@annotorious/react";
2
+ const B = (s) => {
3
+ const e = (t) => Array.from(s.entries()).reduce((o, [n, r]) => {
4
4
  if (o)
5
5
  return o;
6
- const a = n.state.store.getAnnotation(t);
6
+ const a = r.state.store.getAnnotation(t);
7
7
  if (a)
8
- return { annotation: a, annotator: n };
9
- }, void 0) || { annotation: void 0, annotator: void 0 }, i = (t, o = r.LOCAL) => {
8
+ return { annotation: a, annotator: r, source: n };
9
+ }, void 0) || { annotation: void 0, annotator: void 0, source: void 0 }, i = (t, o = c.LOCAL) => {
10
10
  const { annotator: n } = e(t.annotation);
11
11
  n && n.state.store.addBody(t, o);
12
- }, d = (t = r.LOCAL) => Array.from(s.values()).forEach((o) => o.state.store.clear(t)), f = (t, o = r.LOCAL) => {
13
- const { annotation: n, annotator: a } = e(t);
14
- if (a)
15
- return a.state.store.deleteAnnotation(t, o), n;
16
- }, l = (t, o = r.LOCAL) => {
12
+ }, d = (t = c.LOCAL) => Array.from(s.values()).forEach((o) => o.state.store.clear(t)), f = (t, o = c.LOCAL) => {
13
+ const { annotation: n, annotator: r } = e(t);
14
+ if (r)
15
+ return r.state.store.deleteAnnotation(t, o), n;
16
+ }, u = (t, o = c.LOCAL) => {
17
17
  const { annotator: n } = e(t.annotation);
18
18
  n && n.state.store.deleteBody(t, o);
19
- }, A = () => Array.from(s.values()).forEach((t) => t.destroy()), u = (t) => {
19
+ }, l = () => Array.from(s.values()).forEach((t) => t.destroy()), A = (t) => {
20
20
  const { annotator: o } = e(t);
21
21
  return o;
22
- }, y = (t) => e(t).annotation, v = () => Array.from(s.values()).reduce((t, o) => [...t, ...o.state.store.all()], []), L = (t, o, n) => {
23
- const a = typeof t == "string" ? t : t.id, { annotator: c } = e(a);
24
- c && c.state.store.updateAnnotation(t, o, n);
25
- }, m = (t) => {
22
+ }, y = (t) => {
23
+ const { source: o } = e(t);
24
+ return o;
25
+ }, v = (t) => e(t).annotation, L = () => Array.from(s.values()).reduce((t, o) => [...t, ...o.state.store.all()], []), m = (t, o, n) => {
26
+ const r = typeof t == "string" ? t : t.id, { annotator: a } = e(r);
27
+ a && a.state.store.updateAnnotation(t, o, n);
28
+ }, p = (t) => {
26
29
  const { annotator: o } = e(t);
27
30
  o && o.setSelected(t);
28
31
  };
@@ -32,16 +35,17 @@ const O = (s) => {
32
35
  addBody: i,
33
36
  clear: d,
34
37
  deleteAnnotation: f,
35
- deleteBody: l,
36
- destroy: A,
37
- findAnnotator: u,
38
- getAnnotation: y,
39
- getAnnotations: v,
40
- setSelected: m,
41
- updateAnnotation: L
38
+ deleteBody: u,
39
+ destroy: l,
40
+ findAnnotator: A,
41
+ findSource: y,
42
+ getAnnotation: v,
43
+ getAnnotations: L,
44
+ setSelected: p,
45
+ updateAnnotation: m
42
46
  };
43
47
  };
44
48
  export {
45
- O as createManifoldInstance
49
+ B as createManifoldInstance
46
50
  };
47
51
  //# 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 getAnnotation(id: string): I | undefined;\n\n getAnnotations(): I[];\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, annotator?: Annotator<I, E> } =>\n Array.from(annotators.values()).reduce((found, annotator) => {\n if (found)\n return found;\n\n const annotation = annotator.state.store.getAnnotation(annotationId);\n if (annotation) \n return { annotation, annotator };\n }, undefined as { annotation: I, annotator: Annotator<I, E> } | undefined ) || \n\n { annotation: undefined, annotator: 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 getAnnotation = (id: string) => \n find(id).annotation;\n\n const getAnnotations = () => \n Array.from(annotators.values()).reduce((all, annotator) =>\n [...all, ...annotator.state.store.all()], [] as I[]);\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 // Note: keeping this for later - but needs handling in the \n // context provider, because we need to mute selection events!\n /*\n if (Array.isArray(idOrIds)) {\n const resolved = idOrIds.map(find).filter(t => t.annotator);\n\n const groupedByAnnotator = resolved.reduce((grouped, { annotator, annotation }) => {\n const existing = grouped.find(t => t.annotator === annotator);\n if (existing) {\n // Append this annotation\n return grouped.map(t => t.annotator === existing.annotator ? \n { \n annotator, \n annotations: [...t.annotations, annotation ] \n } : t);\n } else {\n // New entry\n return [...grouped, {\n annotator,\n annotations: [ annotation ]\n }];\n } \n }, [] as { annotator: Annotator<I, E>, annotations: I[] }[]);\n\n groupedByAnnotator.forEach(({ annotator, annotations }) => {\n \n })\n } else { \n */\n const { annotator } = find(id);\n if (annotator)\n annotator.setSelected(id);\n // }\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 getAnnotation,\n getAnnotations,\n setSelected,\n updateAnnotation\n }\n\n}"],"names":["createManifoldInstance","annotators","find","annotationId","found","annotator","annotation","addBody","body","origin","Origin","clear","a","deleteAnnotation","id","deleteBody","destroy","findAnnotator","getAnnotation","getAnnotations","all","updateAnnotation","arg1","arg2","arg3","oldId","setSelected"],"mappings":";AAmCa,MAAAA,IAAyB,CACpCC,MACsC;AAEtC,QAAMC,IAAO,CAACC,MACZ,MAAM,KAAKF,EAAW,OAAO,CAAC,EAAE,OAAO,CAACG,GAAOC,MAAc;AACvD,QAAAD;AACK,aAAAA;AAET,UAAME,IAAaD,EAAU,MAAM,MAAM,cAAcF,CAAY;AAC/D,QAAAG;AACK,aAAA,EAAE,YAAAA,GAAY,WAAAD;EAAU,GAChC,MAAuE,KAE1E,EAAE,YAAY,QAAW,WAAW,UAMhCE,IAAU,CAACC,GAAsBC,IAASC,EAAO,UAAU;AAC/D,UAAM,EAAE,WAAAL,EAAc,IAAAH,EAAKM,EAAK,UAAU;AACtC,IAAAH,KACFA,EAAU,MAAM,MAAM,QAAQG,GAAMC,CAAM;AAAA,EAAA,GAGxCE,IAAQ,CAACF,IAASC,EAAO,UAC7B,MAAM,KAAKT,EAAW,OAAA,CAAQ,EAAE,QAAQ,CAAKW,MAAAA,EAAE,MAAM,MAAM,MAAMH,CAAM,CAAC,GAEpEI,IAAmB,CAACC,GAAYL,IAASC,EAAO,UAAU;AAC9D,UAAM,EAAE,YAAAJ,GAAY,WAAAD,EAAU,IAAIH,EAAKY,CAAE;AAEzC,QAAIT;AACF,aAAAA,EAAU,MAAM,MAAM,iBAAiBS,GAAIL,CAAM,GAC1CH;AAAA,EACT,GAGIS,IAAa,CAACP,GAAsBC,IAASC,EA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{"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 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 = (id: string) => \n find(id).annotation;\n\n const getAnnotations = () => \n Array.from(annotators.values()).reduce((all, annotator) =>\n [...all, ...annotator.state.store.all()], [] as I[]);\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 // Note: keeping this for later - but needs handling in the \n // context provider, because we need to mute selection events!\n /*\n if (Array.isArray(idOrIds)) {\n const resolved = idOrIds.map(find).filter(t => t.annotator);\n\n const groupedByAnnotator = resolved.reduce((grouped, { annotator, annotation }) => {\n const existing = grouped.find(t => t.annotator === annotator);\n if (existing) {\n // Append this annotation\n return grouped.map(t => t.annotator === existing.annotator ? \n { \n annotator, \n annotations: [...t.annotations, annotation ] \n } : t);\n } else {\n // New entry\n return [...grouped, {\n annotator,\n annotations: [ annotation ]\n }];\n } \n }, [] as { annotator: Annotator<I, E>, annotations: I[] }[]);\n\n groupedByAnnotator.forEach(({ annotator, annotations }) => {\n \n })\n } else { \n */\n const { annotator } = find(id);\n if (annotator)\n annotator.setSelected(id);\n // }\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 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","updateAnnotation","arg1","arg2","arg3","oldId","setSelected"],"mappings":";AAqCa,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,UAAM,EAAE,WAAAL,EAAc,IAAAJ,EAAKO,EAAK,UAAU;AACtC,IAAAH,KACFA,EAAU,MAAM,MAAM,QAAQG,GAAMC,CAAM;AAAA,EAAA,GAGxCE,IAAQ,CAACF,IAASC,EAAO,UAC7B,MAAM,KAAKV,EAAW,OAAA,CAAQ,EAAE,QAAQ,CAAKY,MAAAA,EAAE,MAAM,MAAM,MAAMH,CAAM,CAAC,GAEpEI,IAAmB,CAACC,GAAYL,IAASC,EAAO,UAAU;AAC9D,UAAM,EAAE,YAAAJ,GAAY,WAAAD,EAAU,IAAIJ,EAAKa,CAAE;AAEzC,QAAIT;AACF,aAAAA,EAAU,MAAM,MAAM,iBAAiBS,GAAIL,CAAM,GAC1CH;AAAA,EACT,GAGIS,IAAa,CAACP,GAAsBC,IAASC,EAAO,UAAU;AAClE,UAAM,EAAE,WAAAL,EAAc,IAAAJ,EAAKO,EAAK,UAAU;AACtC,IAAAH,KACFA,EAAU,MAAM,MAAM,WAAWG,GAAMC,CAAM;AAAA,EAAA,GAG3CO,IAAU,MACd,MAAM,KAAKhB,EAAW,OAAA,CAAQ,EAAE,QAAQ,CAAAY,MAAKA,EAAE,QAAS,CAAA,GAEpDK,IAAgB,CAACf,MAAyB;AAC9C,UAAM,EAAE,WAAAG,EAAA,IAAcJ,EAAKC,CAAY;AAChC,WAAAG;AAAA,EAAA,GAGHa,IAAa,CAAChB,MAAyB;AAC3C,UAAM,EAAE,QAAAE,EAAA,IAAWH,EAAKC,CAAY;AAC7B,WAAAE;AAAA,EAAA,GAGHe,IAAgB,CAACL,MACrBb,EAAKa,CAAE,EAAE,YAELM,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,IAAmB,CAACC,GAAkBC,GAAmBC,MAAkB;AAC/E,UAAMC,IAAgB,OAAOH,KAAS,WAAWA,IAAOA,EAAK,IAEvD,EAAE,WAAAlB,EAAA,IAAcJ,EAAKyB,CAAK;AAC5B,IAAArB,KACFA,EAAU,MAAM,MAAM,iBAAiBkB,GAAMC,GAAMC,CAAI;AAAA,EAAA,GAGrDE,IAAc,CAACb,MAAe;AA8BhC,UAAM,EAAE,WAAAT,EAAA,IAAcJ,EAAKa,CAAE;AACzB,IAAAT,KACFA,EAAU,YAAYS,CAAE;AAAA,EAAA;AAIvB,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,aAAAO;AAAA,IACA,kBAAAL;AAAA,EAAA;AAGJ;"}
@@ -1,9 +1,18 @@
1
- import { __module as e } from "./annotorious-react-manifold.es6.js";
2
- import { __require as r } from "./annotorious-react-manifold.es7.js";
3
- import { __require as o } from "./annotorious-react-manifold.es8.js";
4
- process.env.NODE_ENV === "production" ? e.exports = r() : e.exports = o();
5
- var m = e.exports;
1
+ import { j as o } from "./annotorious-react-manifold.es6.js";
2
+ import { createContext as i, useState as n, useContext as w } from "react";
3
+ const r = i({
4
+ viewers: void 0,
5
+ setViewers: void 0
6
+ }), v = (e) => {
7
+ const [t, s] = n(/* @__PURE__ */ new Map());
8
+ return /* @__PURE__ */ o.jsx(r.Provider, { value: { viewers: t, setViewers: s }, children: e.children });
9
+ }, x = () => {
10
+ const { viewers: e } = w(r);
11
+ return e;
12
+ };
6
13
  export {
7
- m as j
14
+ r as OSDViewerContext,
15
+ v as OSDViewerManifold,
16
+ x as useViewers
8
17
  };
9
18
  //# sourceMappingURL=annotorious-react-manifold.es5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es5.js","sources":["../node_modules/react/jsx-runtime.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n"],"names":["jsxRuntimeModule","require$$0","require$$1"],"mappings":";;;AAEI,QAAQ,IAAI,aAAa,eAC3BA,EAAA,UAAiBC,MAEjBD,EAAA,UAAiBE;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"annotorious-react-manifold.es5.js","sources":["../src/openseadragon/OSDViewerManifold.tsx"],"sourcesContent":["import { ReactNode, createContext, useContext, useState } from 'react';\nimport { Viewer } from '@annotorious/react';\n\ninterface OSDViewerContextValue {\n\n viewers: Map<string, Viewer>;\n\n setViewers: React.Dispatch<React.SetStateAction<Map<string, Viewer>>>\n\n}\n\nexport const OSDViewerContext = createContext<OSDViewerContextValue>({\n\n viewers: undefined,\n\n setViewers: undefined,\n\n});\n\nexport const OSDViewerManifold = (props: { children: ReactNode }) => {\n\n const [viewers, setViewers] = useState(new Map<string, Viewer>());\n\n return (\n <OSDViewerContext.Provider value={{ viewers, setViewers }}>\n {props.children}\n </OSDViewerContext.Provider>\n )\n\n}\n\nexport const useViewers = () => {\n const { viewers } = useContext(OSDViewerContext);\n return viewers;\n}"],"names":["OSDViewerContext","createContext","OSDViewerManifold","props","viewers","setViewers","useState","jsx","useViewers","useContext"],"mappings":";;AAWO,MAAMA,IAAmBC,EAAqC;AAAA,EAEnE,SAAS;AAAA,EAET,YAAY;AAEd,CAAC,GAEYC,IAAoB,CAACC,MAAmC;AAEnE,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,oBAAI,KAAqB;AAG9D,SAAAC,gBAAAA,MAACP,EAAiB,UAAjB,EAA0B,OAAO,EAAE,SAAAI,GAAS,YAAAC,EAC1C,GAAA,UAAAF,EAAM,SACT,CAAA;AAGJ,GAEaK,IAAa,MAAM;AAC9B,QAAM,EAAE,SAAAJ,EAAA,IAAYK,EAAWT,CAAgB;AACxC,SAAAI;AACT;"}
@@ -1,5 +1,9 @@
1
- var e = { exports: {} };
1
+ import { __module as e } from "./annotorious-react-manifold.es7.js";
2
+ import { __require as r } from "./annotorious-react-manifold.es8.js";
3
+ import { __require as o } from "./annotorious-react-manifold.es9.js";
4
+ process.env.NODE_ENV === "production" ? e.exports = r() : e.exports = o();
5
+ var m = e.exports;
2
6
  export {
3
- e as __module
7
+ m as j
4
8
  };
5
9
  //# sourceMappingURL=annotorious-react-manifold.es6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"annotorious-react-manifold.es6.js","sources":["../node_modules/react/jsx-runtime.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n"],"names":["jsxRuntimeModule","require$$0","require$$1"],"mappings":";;;AAEI,QAAQ,IAAI,aAAa,eAC3BA,EAAA,UAAiBC,MAEjBD,EAAA,UAAiBE;;","x_google_ignoreList":[0]}
@@ -1,33 +1,5 @@
1
- import { __exports as t } from "./annotorious-react-manifold.es9.js";
2
- import R from "react";
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var p;
13
- function v() {
14
- if (p)
15
- return t;
16
- p = 1;
17
- var s = R, m = Symbol.for("react.element"), l = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, d = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, y = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function i(o, r, u) {
19
- var e, n = {}, _ = null, f = null;
20
- u !== void 0 && (_ = "" + u), r.key !== void 0 && (_ = "" + r.key), r.ref !== void 0 && (f = r.ref);
21
- for (e in r)
22
- c.call(r, e) && !y.hasOwnProperty(e) && (n[e] = r[e]);
23
- if (o && o.defaultProps)
24
- for (e in r = o.defaultProps, r)
25
- n[e] === void 0 && (n[e] = r[e]);
26
- return { $$typeof: m, type: o, key: _, ref: f, props: n, _owner: d.current };
27
- }
28
- return t.Fragment = l, t.jsx = i, t.jsxs = i, t;
29
- }
1
+ var e = { exports: {} };
30
2
  export {
31
- v as __require
3
+ e as __module
32
4
  };
33
5
  //# sourceMappingURL=annotorious-react-manifold.es7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react-manifold.es7.js","sources":["../node_modules/react/cjs/react-jsx-runtime.production.min.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n"],"names":["f","require$$0","k","m","n","p","q","c","a","g","b","d","e","h","reactJsxRuntime_production_min"],"mappings":";;;;;;;;;;;;;;;;AASa,MAAIA,IAAEC,GAAiBC,IAAE,OAAO,IAAI,eAAe,GAAE,IAAE,OAAO,IAAI,gBAAgB,GAAEC,IAAE,OAAO,UAAU,gBAAeC,IAAEJ,EAAE,mDAAmD,mBAAkBK,IAAE,EAAC,KAAI,IAAG,KAAI,IAAG,QAAO,IAAG,UAAS,GAAE;AAClP,WAASC,EAAEC,GAAEC,GAAEC,GAAE;AAAC,QAAIC,GAAEC,IAAE,IAAGC,IAAE,MAAKC,IAAE;AAAK,IAASJ,MAAT,WAAaG,IAAE,KAAGH,IAAYD,EAAE,QAAX,WAAiBI,IAAE,KAAGJ,EAAE,MAAcA,EAAE,QAAX,WAAiBK,IAAEL,EAAE;AAAK,SAAIE,KAAKF;AAAE,MAAAL,EAAE,KAAKK,GAAEE,CAAC,KAAG,CAACL,EAAE,eAAeK,CAAC,MAAIC,EAAED,CAAC,IAAEF,EAAEE,CAAC;AAAG,QAAGH,KAAGA,EAAE;AAAa,WAAIG,KAAKF,IAAED,EAAE,cAAaC;AAAE,QAASG,EAAED,CAAC,MAAZ,WAAgBC,EAAED,CAAC,IAAEF,EAAEE,CAAC;AAAG,WAAM,EAAC,UAASR,GAAE,MAAKK,GAAE,KAAIK,GAAE,KAAIC,GAAE,OAAMF,GAAE,QAAOP,EAAE,QAAO;AAAA,EAAC;AAAC,SAAAU,aAAiB,GAAEA,EAAW,MAACR,GAAEQ,EAAA,OAAaR;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"annotorious-react-manifold.es7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}