@annotorious/react 3.7.3 → 3.7.4

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 +1 @@
1
- {"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,SAAS,IAAI,aAAa,EAC1B,KAAK,EAEL,IAAI,EACL,MAAM,0BAA0B,CAAC;AAGlC,UAAU,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IAE5F,QAAQ,EAAE;QAAE,UAAU,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAElD,QAAQ,EAAE;QAAE,UAAU,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAEnD;AAED,eAAO,MAAM,kBAAkB;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,WAAW;cAAqC,SAAS;qEAsFpE,CAAC;AAEH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,OAEvD,CAChB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAE1C,CAAC,GAAG,SACjC,CAAA;AAYD,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,EAAE,WAAW,MAAM,QACf,CAAC;AAE1E,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,EA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MAAM,YAAY,GAAI,CAAC,SAAS,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,OAEvD,CAChB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAE1C,CAAC,GAAG,SACjC,CAAA;AAYD,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,EAAE,WAAW,MAAM,QACf,CAAC;AAE1E,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,EAClE,IAAI,MAAM,EACV,UAAU,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,MAuBnD,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,EAC9E,IAAI,MAAM,iDAKX,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,OAE7C,SAAS,CAAC,CAAC,CAChC,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,QAyB9D,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,IAGnC,CAAA;AAmDD,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,UAAU,GAAG,eAAe,EAAE,WAAW,MAAM,QACb,CAAC"}
@@ -1,89 +1,92 @@
1
- import { jsx as I } from "react/jsx-runtime";
2
- import { createContext as J, forwardRef as N, useState as d, useRef as U, useImperativeHandle as j, useEffect as S, useContext as h } from "react";
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import { createContext as I, forwardRef as J, useState as d, useRef as N, useImperativeHandle as U, useEffect as g, useContext as w } from "react";
3
3
  import { useDebounce as O } from "./annotorious-react.es12.js";
4
- const f = J({
4
+ const f = I({
5
5
  anno: void 0,
6
6
  setAnno: void 0,
7
7
  annotations: [],
8
8
  selection: { selected: [] }
9
- }), K = N((t, e) => {
10
- const [n, c] = d(null), [a, o] = d([]), [u, s] = d({ selected: [], previous: [] }), m = U([]);
11
- return j(e, () => n), S(() => {
9
+ }), j = (t, e) => {
10
+ const { event: n, ...r } = t, { event: s, ...o } = e;
11
+ return JSON.stringify(r) !== JSON.stringify(o) ? !1 : (n == null ? void 0 : n.timeStamp) === (s == null ? void 0 : s.timeStamp);
12
+ }, L = J((t, e) => {
13
+ const [n, r] = d(null), [s, o] = d([]), [u, i] = d({ selected: [], previous: [] }), h = N([]);
14
+ return U(e, () => n), g(() => {
12
15
  if (n) {
13
- const { selection: p, store: r } = n.state;
14
- r.all().length > 0 && o(r.all());
15
- const A = () => o(() => r.all());
16
- r.observe(A);
16
+ const { selection: p, store: c } = n.state;
17
+ c.all().length > 0 && o(c.all());
18
+ const A = () => o(() => c.all());
19
+ c.observe(A);
17
20
  let l;
18
- const g = p.subscribe(({ selected: w, ...D }) => {
19
- l && r.unobserve(l);
20
- const R = (w || []).map(({ id: i, editable: v }) => ({ annotation: r.getAnnotation(i), editable: v }));
21
- s((i) => {
21
+ const m = p.subscribe(({ selected: S, ...D }) => {
22
+ l && c.unobserve(l);
23
+ const R = (S || []).map(({ id: a, editable: v }) => ({ annotation: c.getAnnotation(a), editable: v }));
24
+ i((a) => {
22
25
  const v = {
23
26
  selected: R,
24
- previous: i.selected,
27
+ previous: a.selected,
25
28
  ...D
26
29
  };
27
- return JSON.stringify(i) === JSON.stringify(v) ? i : (m.current = i.selected, v);
28
- }), l = (i) => {
29
- const { updated: v } = i.changes;
30
- s((V) => ({
30
+ return j(a, v) ? a : (h.current = a.selected, v);
31
+ }), l = (a) => {
32
+ const { updated: v } = a.changes;
33
+ i((V) => ({
31
34
  ...V,
32
35
  selected: V.selected.map(({ annotation: x, editable: C }) => {
33
36
  const H = v.find((y) => y.oldValue.id === x.id);
34
37
  return H ? { annotation: H.newValue, editable: C } : { annotation: x, editable: C };
35
38
  })
36
39
  }));
37
- }, r.observe(l, { annotations: w.map(({ id: i }) => i) });
40
+ }, c.observe(l, { annotations: S.map(({ id: a }) => a) });
38
41
  });
39
42
  return () => {
40
- r.unobserve(A), g();
43
+ c.unobserve(A), m();
41
44
  };
42
45
  }
43
- }, [n]), /* @__PURE__ */ I(f.Provider, { value: {
46
+ }, [n]), /* @__PURE__ */ E(f.Provider, { value: {
44
47
  anno: n,
45
- setAnno: c,
46
- annotations: a,
48
+ setAnno: r,
49
+ annotations: s,
47
50
  selection: u
48
51
  }, children: t.children });
49
52
  }), b = () => {
50
- const { anno: t } = h(f);
53
+ const { anno: t } = w(f);
51
54
  return t;
52
- }, E = () => {
55
+ }, q = () => {
53
56
  const t = b();
54
57
  return t == null ? void 0 : t.state.store;
55
58
  }, P = () => {
56
- const { annotations: t } = h(f);
59
+ const { annotations: t } = w(f);
57
60
  return t;
58
61
  }, k = (t) => {
59
- const { annotations: e } = h(f);
62
+ const { annotations: e } = w(f);
60
63
  return O(e, t);
61
- }, L = (t) => t ? k(t) : P(), q = (t, e) => {
62
- const n = E(), [c, a] = d(
64
+ }, M = (t) => t ? k(t) : P(), z = (t, e) => {
65
+ const n = q(), [r, s] = d(
63
66
  n == null ? void 0 : n.getAnnotation(t)
64
67
  );
65
- return S(() => {
68
+ return g(() => {
66
69
  if (!n) return;
67
70
  const o = (u) => {
68
- const s = u.changes.updated[0];
69
- s && a(s.newValue);
71
+ const i = u.changes.updated[0];
72
+ i && s(i.newValue);
70
73
  };
71
74
  return n.observe(o, { ...e, annotations: t }), () => n.unobserve(o);
72
- }, []), c;
73
- }, M = (t) => {
74
- const e = b(), n = q(t);
75
+ }, []), r;
76
+ }, Q = (t) => {
77
+ const e = b(), n = z(t);
75
78
  return e && n ? e.state.selection.evalSelectAction(n) : void 0;
76
- }, Q = () => {
77
- const { selection: t } = h(f);
78
- return t;
79
79
  }, T = () => {
80
+ const { selection: t } = w(f);
81
+ return t;
82
+ }, W = () => {
80
83
  const t = b(), [e, n] = d();
81
- return S(() => {
84
+ return g(() => {
82
85
  if (!t) return;
83
- const { hover: c, store: a } = t.state, o = c.subscribe((u) => {
86
+ const { hover: r, store: s } = t.state, o = r.subscribe((u) => {
84
87
  if (u) {
85
- const s = a.getAnnotation(u);
86
- n(s);
88
+ const i = s.getAnnotation(u);
89
+ n(i);
87
90
  } else
88
91
  n(void 0);
89
92
  });
@@ -91,48 +94,48 @@ const f = J({
91
94
  o();
92
95
  };
93
96
  }, [t]), e;
94
- }, W = () => {
97
+ }, X = () => {
95
98
  const t = b();
96
99
  return t == null ? void 0 : t.getUser();
97
100
  }, _ = () => {
98
101
  const t = b(), [e, n] = d([]);
99
- return S(() => {
102
+ return g(() => {
100
103
  if (t) {
101
- const { store: c, viewport: a } = t.state;
102
- if (!a)
104
+ const { store: r, viewport: s } = t.state;
105
+ if (!s)
103
106
  return;
104
107
  let o;
105
- const u = a.subscribe((s) => {
106
- o && c.unobserve(o);
107
- const m = s.map((p) => c.getAnnotation(p));
108
- n(m), o = (p) => {
109
- const { updated: r } = p.changes;
108
+ const u = s.subscribe((i) => {
109
+ o && r.unobserve(o);
110
+ const h = i.map((p) => r.getAnnotation(p));
111
+ n(h), o = (p) => {
112
+ const { updated: c } = p.changes;
110
113
  n((A) => A.map((l) => {
111
- const g = r.find((w) => w.oldValue.id === l.id);
112
- return g ? g.newValue : l;
114
+ const m = c.find((S) => S.oldValue.id === l.id);
115
+ return m ? m.newValue : l;
113
116
  }));
114
- }, c.observe(o, { annotations: s });
117
+ }, r.observe(o, { annotations: i });
115
118
  });
116
119
  return () => {
117
120
  u();
118
121
  };
119
122
  }
120
123
  }, [t]), e;
121
- }, z = (t) => {
124
+ }, B = (t) => {
122
125
  const e = _();
123
126
  return O(e, t);
124
- }, X = (t) => t ? z(t) : _();
127
+ }, Y = (t) => t ? B(t) : _();
125
128
  export {
126
- K as Annotorious,
129
+ L as Annotorious,
127
130
  f as AnnotoriousContext,
128
- q as useAnnotation,
129
- M as useAnnotationSelectAction,
130
- E as useAnnotationStore,
131
- L as useAnnotations,
131
+ z as useAnnotation,
132
+ Q as useAnnotationSelectAction,
133
+ q as useAnnotationStore,
134
+ M as useAnnotations,
132
135
  b as useAnnotator,
133
- W as useAnnotatorUser,
134
- T as useHover,
135
- Q as useSelection,
136
- X as useViewportState
136
+ X as useAnnotatorUser,
137
+ W as useHover,
138
+ T as useSelection,
139
+ Y as useViewportState
137
140
  };
138
141
  //# sourceMappingURL=annotorious-react.es2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react.es2.js","sources":["../src/Annotorious.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { \n createContext, \n forwardRef,\n useContext, \n useEffect, \n useImperativeHandle, \n useRef,\n useState \n} from 'react';\nimport type { StoreObserveOptions } from '@annotorious/core';\nimport type {\n Annotation,\n Annotator,\n ImageAnnotation,\n Selection as CoreSelection,\n Store,\n StoreChangeEvent,\n User\n} from '@annotorious/annotorious';\nimport { useDebounce } from './useDebounce';\n\ninterface Selection<T extends Annotation = Annotation> extends Omit<CoreSelection, 'selected'> {\n\n selected: { annotation: T, editable?: boolean }[];\n\n previous: { annotation: T, editable?: boolean }[];\n\n}\n\nexport const AnnotoriousContext = createContext({\n\n anno: undefined,\n\n setAnno: undefined,\n\n annotations: [],\n\n selection: { selected: [] }\n\n});\n\nexport const Annotorious = forwardRef<Annotator, { children: ReactNode }>((props: { children: ReactNode }, ref) => {\n\n const [anno, setAnno] = useState<Annotator>(null);\n\n const [annotations, setAnnotations] = useState<Annotation[]>([]);\n\n const [selection, setSelection] = useState<Selection>({ selected: [], previous: [] });\n\n const previousSelectionRef = useRef<{ annotation: Annotation, editable?: boolean }[]>([]);\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store } = anno.state;\n\n // Components below <Annotorious /> may have\n // loaded annotations into the store already! \n if (store.all().length > 0)\n setAnnotations(store.all());\n\n // Keeps annotations in sync with a React state,\n // so clients can render components the usual React way.\n const onStoreChange = () => setAnnotations(() => store.all());\n\n store.observe(onStoreChange);\n\n // Keep selection in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let selectionStoreObserver: (event: StoreChangeEvent<Annotation>) => void;\n\n const unsubscribeSelection = selection.subscribe(({ selected, ...rest }) => {\n if (selectionStoreObserver)\n store.unobserve(selectionStoreObserver);\n\n const resolved = (selected || [])\n .map(({ id, editable }) => ({ annotation: store.getAnnotation(id), editable }));\n\n setSelection(currentSelection => {\n const next = {\n selected: resolved,\n previous: currentSelection.selected,\n ...rest\n } as Selection;\n\n if (JSON.stringify(currentSelection) === JSON.stringify(next)) \n return currentSelection;\n \n previousSelectionRef.current = currentSelection.selected;\n \n return next;\n });\n\n selectionStoreObserver = event => {\n const { updated } = event.changes;\n\n setSelection((selection) => ({\n ...selection,\n selected: selection.selected.map(({ annotation, editable }) => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? { annotation: next.newValue, editable } : { annotation, editable };\n })\n }));\n }\n\n store.observe(selectionStoreObserver, { annotations: selected.map(({ id }) => id) });\n });\n\n return () => {\n store.unobserve(onStoreChange);\n unsubscribeSelection();\n }\n }\n }, [anno]);\n\n return (\n <AnnotoriousContext.Provider value={{\n anno,\n setAnno,\n annotations,\n selection\n }}>\n {props.children}\n </AnnotoriousContext.Provider>\n )\n\n});\n\nexport const useAnnotator = <T extends unknown = Annotator<any, unknown>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno as T;\n}\n\nexport const useAnnotationStore = <T extends unknown = Store<Annotation>>() => {\n const anno = useAnnotator();\n return anno?.state.store as T | undefined;\n}\n\nconst _useAnnotations = <T extends Annotation>() => {\n const { annotations } = useContext(AnnotoriousContext);\n return annotations as T[];\n}\n\nconst _useAnnotationsDebounced = <T extends Annotation>(debounce: number) => {\n const { annotations } = useContext(AnnotoriousContext);\n return useDebounce(annotations, debounce) as T[];\n}\n\nexport const useAnnotations = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useAnnotationsDebounced<T>(debounce) : _useAnnotations<T>();\n\nexport const useAnnotation = <T extends Annotation = ImageAnnotation>(\n id: string,\n options?: Omit<StoreObserveOptions, 'annotations'>\n) => {\n const store = useAnnotationStore<Store<T>>();\n\n const [annotation, setAnnotation] = useState<T | undefined>(\n store?.getAnnotation(id)\n );\n\n useEffect(() => {\n if (!store) return;\n\n const handleChange = (event: StoreChangeEvent<T>) => {\n const updated = event.changes.updated[0];\n if (updated) {\n setAnnotation(updated.newValue);\n }\n };\n\n store.observe(handleChange, { ...options, annotations: id });\n return () => store.unobserve(handleChange);\n }, []);\n\n return annotation;\n}\n\nexport const useAnnotationSelectAction = <I extends Annotation = ImageAnnotation>(\n id: string\n) => {\n const anno = useAnnotator();\n const annotation = useAnnotation<I>(id);\n return anno && annotation ? anno.state.selection.evalSelectAction(annotation) : undefined;\n}\n\nexport const useSelection = <T extends Annotation = ImageAnnotation>() => {\n const { selection } = useContext(AnnotoriousContext);\n return selection as Selection<T>;\n}\n\nexport const useHover = <T extends Annotation = ImageAnnotation>() => {\n const anno = useAnnotator();\n\n const [hover, setHover] = useState<T | undefined>();\n\n useEffect(() => {\n if (!anno) return;\n\n const { hover, store } = (anno as Annotator<T, unknown>).state;\n\n const unsubscribeHover = hover.subscribe(id => {\n if (id) {\n const annotation = store.getAnnotation(id);\n setHover(annotation);\n } else {\n setHover(undefined);\n }\n });\n\n return () => {\n unsubscribeHover();\n };\n }, [anno]);\n\n return hover;\n}\n\nexport const useAnnotatorUser = (): User => {\n const anno = useAnnotator();\n return anno?.getUser();\n}\n\nconst _useViewportState = <T extends Annotation>() => {\n const anno = useAnnotator();\n\n const [inViewport, setInViewport] = useState<T[]>([]);\n\n useEffect(() => {\n if (anno) {\n const { store, viewport } = anno.state;\n\n if (!viewport)\n return;\n\n // Keep viewport annotations in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let viewportStoreObserver: (event: StoreChangeEvent<T>) => void;\n\n const unsubscribeViewport = viewport.subscribe(ids => {\n if (viewportStoreObserver)\n store.unobserve(viewportStoreObserver);\n\n const resolved = ids.map(id => store.getAnnotation(id)) as T[];\n setInViewport(resolved);\n\n viewportStoreObserver = event => {\n const { updated } = event.changes;\n\n setInViewport(annotations => annotations.map(annotation => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? next.newValue : annotation;\n }));\n };\n\n store.observe(viewportStoreObserver, { annotations: ids });\n });\n\n return () => {\n unsubscribeViewport();\n };\n }\n }, [anno]);\n\n return inViewport;\n}\n\nconst _useViewportStateDebounced = <T extends Annotation>(debounce: number) => {\n const inViewport = _useViewportState();\n return useDebounce(inViewport, debounce) as T[];\n}\n\nexport const useViewportState = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useViewportStateDebounced<T>(debounce) : _useViewportState<T>();\n"],"names":["AnnotoriousContext","createContext","Annotorious","forwardRef","props","ref","anno","setAnno","useState","annotations","setAnnotations","selection","setSelection","previousSelectionRef","useRef","useImperativeHandle","useEffect","store","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","rest","resolved","id","editable","currentSelection","next","event","updated","annotation","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useAnnotation","options","setAnnotation","handleChange","useAnnotationSelectAction","useSelection","useHover","hover","setHover","unsubscribeHover","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;AA8BO,MAAMA,IAAqBC,EAAc;AAAA,EAE9C,MAAM;AAAA,EAEN,SAAS;AAAA,EAET,aAAa,CAAA;AAAA,EAEb,WAAW,EAAE,UAAU,CAAA,EAAC;AAE1B,CAAC,GAEYC,IAAcC,EAA+C,CAACC,GAAgCC,MAAQ;AAEjH,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAoB,IAAI,GAE1C,CAACC,GAAaC,CAAc,IAAIF,EAAuB,CAAA,CAAE,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAA,GAAI,UAAU,C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AAI,CAACiD;AACH;AAIF,UAAIC;AAEJ,YAAMC,IAAsBF,EAAS,UAAU,CAAAG,MAAO;AACpD,QAAIF,KACFvC,EAAM,UAAUuC,CAAqB;AAEvC,cAAMjC,IAAWmC,EAAI,IAAI,OAAMzC,EAAM,cAAcO,CAAE,CAAC;AACtD,QAAA8B,EAAc/B,CAAQ,GAEtBiC,IAAwB,CAAA5B,MAAS;AAC/B,gBAAM,EAAE,SAAAC,MAAYD,EAAM;AAE1B,UAAA0B,EAAc,CAAA7C,MAAeA,EAAY,IAAI,CAAAqB,MAAc;AACzD,kBAAMH,IAAOE,EAAQ,KAAK,CAAAE,MAAKA,EAAE,SAAS,OAAOD,EAAW,EAAE;AAC9D,mBAAOH,IAAOA,EAAK,WAAWG;AAAA,UAChC,CAAC,CAAC;AAAA,QACJ,GAEAb,EAAM,QAAQuC,GAAuB,EAAE,aAAaE,GAAK;AAAA,MAC3D,CAAC;AAED,aAAO,MAAM;AACX,QAAAD,EAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAACnD,CAAI,CAAC,GAEF+C;AACT,GAEMM,IAA6B,CAAuBrB,MAAqB;AAC7E,QAAMe,IAAaD,EAAA;AACnB,SAAOb,EAAYc,GAAYf,CAAQ;AACzC,GAEasB,IAAmB,CAAyCtB,MACvEA,IAAWqB,EAA8BrB,CAAQ,IAAIc,EAAA;"}
1
+ {"version":3,"file":"annotorious-react.es2.js","sources":["../src/Annotorious.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { \n createContext, \n forwardRef,\n useContext, \n useEffect, \n useImperativeHandle, \n useRef,\n useState \n} from 'react';\nimport type { StoreObserveOptions } from '@annotorious/core';\nimport type {\n Annotation,\n Annotator,\n ImageAnnotation,\n Selection as CoreSelection,\n Store,\n StoreChangeEvent,\n User\n} from '@annotorious/annotorious';\nimport { useDebounce } from './useDebounce';\n\ninterface Selection<T extends Annotation = Annotation> extends Omit<CoreSelection, 'selected'> {\n\n selected: { annotation: T, editable?: boolean }[];\n\n previous: { annotation: T, editable?: boolean }[];\n\n}\n\nexport const AnnotoriousContext = createContext({\n\n anno: undefined,\n\n setAnno: undefined,\n\n annotations: [],\n\n selection: { selected: [] }\n\n});\n\nconst isSelectionEqual = (a: Selection, b: Selection) => {\n const { event: eventA, ...restA } = a; \n const { event: eventB, ...restB } = b; \n\n if (JSON.stringify(restA) !== JSON.stringify(restB)) return false;\n\n return eventA?.timeStamp === eventB?.timeStamp;\n}\n\nexport const Annotorious = forwardRef<Annotator, { children: ReactNode }>((props: { children: ReactNode }, ref) => {\n\n const [anno, setAnno] = useState<Annotator>(null);\n\n const [annotations, setAnnotations] = useState<Annotation[]>([]);\n\n const [selection, setSelection] = useState<Selection>({ selected: [], previous: [] });\n\n const previousSelectionRef = useRef<{ annotation: Annotation, editable?: boolean }[]>([]);\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store } = anno.state;\n\n // Components below <Annotorious /> may have\n // loaded annotations into the store already! \n if (store.all().length > 0)\n setAnnotations(store.all());\n\n // Keeps annotations in sync with a React state,\n // so clients can render components the usual React way.\n const onStoreChange = () => setAnnotations(() => store.all());\n\n store.observe(onStoreChange);\n\n // Keep selection in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let selectionStoreObserver: (event: StoreChangeEvent<Annotation>) => void;\n\n const unsubscribeSelection = selection.subscribe(({ selected, ...rest }) => {\n if (selectionStoreObserver)\n store.unobserve(selectionStoreObserver);\n\n const resolved = (selected || [])\n .map(({ id, editable }) => ({ annotation: store.getAnnotation(id), editable }));\n\n setSelection(currentSelection => {\n const next = {\n selected: resolved,\n previous: currentSelection.selected,\n ...rest\n } as Selection;\n\n // Prevent unnecessary re-renders\n if (isSelectionEqual(currentSelection, next))\n return currentSelection;\n \n previousSelectionRef.current = currentSelection.selected;\n \n return next;\n });\n\n selectionStoreObserver = event => {\n const { updated } = event.changes;\n\n setSelection((selection) => ({\n ...selection,\n selected: selection.selected.map(({ annotation, editable }) => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? { annotation: next.newValue, editable } : { annotation, editable };\n })\n }));\n }\n\n store.observe(selectionStoreObserver, { annotations: selected.map(({ id }) => id) });\n });\n\n return () => {\n store.unobserve(onStoreChange);\n unsubscribeSelection();\n }\n }\n }, [anno]);\n\n return (\n <AnnotoriousContext.Provider value={{\n anno,\n setAnno,\n annotations,\n selection\n }}>\n {props.children}\n </AnnotoriousContext.Provider>\n )\n\n});\n\nexport const useAnnotator = <T extends unknown = Annotator<any, unknown>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno as T;\n}\n\nexport const useAnnotationStore = <T extends unknown = Store<Annotation>>() => {\n const anno = useAnnotator();\n return anno?.state.store as T | undefined;\n}\n\nconst _useAnnotations = <T extends Annotation>() => {\n const { annotations } = useContext(AnnotoriousContext);\n return annotations as T[];\n}\n\nconst _useAnnotationsDebounced = <T extends Annotation>(debounce: number) => {\n const { annotations } = useContext(AnnotoriousContext);\n return useDebounce(annotations, debounce) as T[];\n}\n\nexport const useAnnotations = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useAnnotationsDebounced<T>(debounce) : _useAnnotations<T>();\n\nexport const useAnnotation = <T extends Annotation = ImageAnnotation>(\n id: string,\n options?: Omit<StoreObserveOptions, 'annotations'>\n) => {\n const store = useAnnotationStore<Store<T>>();\n\n const [annotation, setAnnotation] = useState<T | undefined>(\n store?.getAnnotation(id)\n );\n\n useEffect(() => {\n if (!store) return;\n\n const handleChange = (event: StoreChangeEvent<T>) => {\n const updated = event.changes.updated[0];\n if (updated) {\n setAnnotation(updated.newValue);\n }\n };\n\n store.observe(handleChange, { ...options, annotations: id });\n return () => store.unobserve(handleChange);\n }, []);\n\n return annotation;\n}\n\nexport const useAnnotationSelectAction = <I extends Annotation = ImageAnnotation>(\n id: string\n) => {\n const anno = useAnnotator();\n const annotation = useAnnotation<I>(id);\n return anno && annotation ? anno.state.selection.evalSelectAction(annotation) : undefined;\n}\n\nexport const useSelection = <T extends Annotation = ImageAnnotation>() => {\n const { selection } = useContext(AnnotoriousContext);\n return selection as Selection<T>;\n}\n\nexport const useHover = <T extends Annotation = ImageAnnotation>() => {\n const anno = useAnnotator();\n\n const [hover, setHover] = useState<T | undefined>();\n\n useEffect(() => {\n if (!anno) return;\n\n const { hover, store } = (anno as Annotator<T, unknown>).state;\n\n const unsubscribeHover = hover.subscribe(id => {\n if (id) {\n const annotation = store.getAnnotation(id);\n setHover(annotation);\n } else {\n setHover(undefined);\n }\n });\n\n return () => {\n unsubscribeHover();\n };\n }, [anno]);\n\n return hover;\n}\n\nexport const useAnnotatorUser = (): User => {\n const anno = useAnnotator();\n return anno?.getUser();\n}\n\nconst _useViewportState = <T extends Annotation>() => {\n const anno = useAnnotator();\n\n const [inViewport, setInViewport] = useState<T[]>([]);\n\n useEffect(() => {\n if (anno) {\n const { store, viewport } = anno.state;\n\n if (!viewport)\n return;\n\n // Keep viewport annotations in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let viewportStoreObserver: (event: StoreChangeEvent<T>) => void;\n\n const unsubscribeViewport = viewport.subscribe(ids => {\n if (viewportStoreObserver)\n store.unobserve(viewportStoreObserver);\n\n const resolved = ids.map(id => store.getAnnotation(id)) as T[];\n setInViewport(resolved);\n\n viewportStoreObserver = event => {\n const { updated } = event.changes;\n\n setInViewport(annotations => annotations.map(annotation => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? next.newValue : annotation;\n }));\n };\n\n store.observe(viewportStoreObserver, { annotations: ids });\n });\n\n return () => {\n unsubscribeViewport();\n };\n }\n }, [anno]);\n\n return inViewport;\n}\n\nconst _useViewportStateDebounced = <T extends Annotation>(debounce: number) => {\n const inViewport = _useViewportState();\n return useDebounce(inViewport, debounce) as T[];\n}\n\nexport const useViewportState = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useViewportStateDebounced<T>(debounce) : _useViewportState<T>();\n"],"names":["AnnotoriousContext","createContext","isSelectionEqual","a","b","eventA","restA","eventB","restB","Annotorious","forwardRef","props","ref","anno","setAnno","useState","annotations","setAnnotations","selection","setSelection","previousSelectionRef","useRef","useImperativeHandle","useEffect","store","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","rest","resolved","id","editable","currentSelection","next","event","updated","annotation","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useAnnotation","options","setAnnotation","handleChange","useAnnotationSelectAction","useSelection","useHover","hover","setHover","unsubscribeHover","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;AA8BO,MAAMA,IAAqBC,EAAc;AAAA,EAE9C,MAAM;AAAA,EAEN,SAAS;AAAA,EAET,aAAa,CAAA;AAAA,EAEb,WAAW,EAAE,UAAU,CAAA,EAAC;AAE1B,CAAC,GAEKC,IAAmB,CAACC,GAAcC,MAAiB;AACvD,QAAM,EAAE,OAAOC,GAAQ,GAAGC,MAAUH,GAC9B,EAAE,OAAOI,GAAQ,GAAGC,MAAUJ;AAEpC,SAAI,KAAK,UAAUE,CAAK,MAAM,KAAK,UAAUE,CAAK,IAAU,MAErDH,KAAA,gBAAAA,EAAQ,gBAAcE,KAAA,gBAAAA,EAAQ;AACvC,GAEaE,IAAcC,EAA+C,CAACC,GAAgCC,MAAQ;AAEjH,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAoB,IAAI,GAE1C,CAACC,GAAaC,CAAc,IAAIF,EAAuB,CAAA,CAAE,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAA,GAAI,UAAU,CAAA,GAAI,GAE9EK,IAAuBC,EAAyD,EAAE;AAExF,SAAAC,EAAoBV,GAAK,MAAMC,CAAI,GAEnCU,EAAU,MAAM;AACd,QAAIV,GAAM;AACR,YAAM,EAAE,WAAAK,GAAW,OAAAM,EAAA,IAAU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AAC;AACtD,QAAA8B,EAAc/B,CAAQ,GAEtBiC,IAAwB,CAAA5B,MAAS;AAC/B,gBAAM,EAAE,SAAAC,MAAYD,EAAM;AAE1B,UAAA0B,EAAc,CAAA7C,MAAeA,EAAY,IAAI,CAAAqB,MAAc;AACzD,kBAAMH,IAAOE,EAAQ,KAAK,CAAAE,MAAKA,EAAE,SAAS,OAAOD,EAAW,EAAE;AAC9D,mBAAOH,IAAOA,EAAK,WAAWG;AAAA,UAChC,CAAC,CAAC;AAAA,QACJ,GAEAb,EAAM,QAAQuC,GAAuB,EAAE,aAAaE,GAAK;AAAA,MAC3D,CAAC;AAED,aAAO,MAAM;AACX,QAAAD,EAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAACnD,CAAI,CAAC,GAEF+C;AACT,GAEMM,IAA6B,CAAuBrB,MAAqB;AAC7E,QAAMe,IAAaD,EAAA;AACnB,SAAOb,EAAYc,GAAYf,CAAQ;AACzC,GAEasB,IAAmB,CAAyCtB,MACvEA,IAAWqB,EAA8BrB,CAAQ,IAAIc,EAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@annotorious/react",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
4
4
  "description": "Annotorious React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -45,9 +45,9 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@annotorious/annotorious": "3.7.3",
49
- "@annotorious/core": "3.7.3",
50
- "@annotorious/openseadragon": "3.7.3",
48
+ "@annotorious/annotorious": "3.7.4",
49
+ "@annotorious/core": "3.7.4",
50
+ "@annotorious/openseadragon": "3.7.4",
51
51
  "@floating-ui/react": "^0.27.15",
52
52
  "zustand": "^5.0.7"
53
53
  },