@annotorious/react 3.7.2 → 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.
@@ -6,6 +6,10 @@ interface Selection<T extends Annotation = Annotation> extends Omit<CoreSelectio
6
6
  annotation: T;
7
7
  editable?: boolean;
8
8
  }[];
9
+ previous: {
10
+ annotation: T;
11
+ editable?: boolean;
12
+ }[];
9
13
  }
10
14
  export declare const AnnotoriousContext: import('react').Context<{
11
15
  anno: any;
@@ -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;AASvC,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;CAEnD;AAED,eAAO,MAAM,kBAAkB;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,WAAW;cAAqC,SAAS;qEAuEpE,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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MAAM,kBAAkB;;;;;;;EAU7B,CAAC;AAWH,eAAO,MAAM,WAAW;cAAqC,SAAS;qEAuFpE,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,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,82 +1,92 @@
1
- import { jsx as j } from "react/jsx-runtime";
2
- import { createContext as E, forwardRef as P, useState as l, useImperativeHandle as R, useEffect as h, useContext as w } from "react";
3
- import { useDebounce as _ } from "./annotorious-react.es12.js";
4
- const d = E({
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
+ import { useDebounce as O } from "./annotorious-react.es12.js";
4
+ const f = I({
5
5
  anno: void 0,
6
6
  setAnno: void 0,
7
7
  annotations: [],
8
8
  selection: { selected: [] }
9
- }), K = P((t, e) => {
10
- const [n, c] = l(null), [a, o] = l([]), [i, r] = l({ selected: [] });
11
- return R(e, () => n), h(() => {
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: S, store: s, hover: V } = n.state;
14
- s.all().length > 0 && o(s.all());
15
- const b = () => o(() => s.all());
16
- s.observe(b);
17
- let u;
18
- const A = S.subscribe(({ selected: f, ...I }) => {
19
- u && s.unobserve(u);
20
- const O = (f || []).map(({ id: v, editable: m }) => ({ annotation: s.getAnnotation(v), editable: m }));
21
- r({ selected: O, ...I }), u = (v) => {
22
- const { updated: m } = v.changes;
23
- r((g) => ({
24
- ...g,
25
- selected: g.selected.map(({ annotation: x, editable: C }) => {
26
- const H = m.find((U) => U.oldValue.id === x.id);
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);
20
+ let l;
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) => {
25
+ const v = {
26
+ selected: R,
27
+ previous: a.selected,
28
+ ...D
29
+ };
30
+ return j(a, v) ? a : (h.current = a.selected, v);
31
+ }), l = (a) => {
32
+ const { updated: v } = a.changes;
33
+ i((V) => ({
34
+ ...V,
35
+ selected: V.selected.map(({ annotation: x, editable: C }) => {
36
+ const H = v.find((y) => y.oldValue.id === x.id);
27
37
  return H ? { annotation: H.newValue, editable: C } : { annotation: x, editable: C };
28
38
  })
29
39
  }));
30
- }, s.observe(u, { annotations: f.map(({ id: v }) => v) });
40
+ }, c.observe(l, { annotations: S.map(({ id: a }) => a) });
31
41
  });
32
42
  return () => {
33
- s.unobserve(b), A();
43
+ c.unobserve(A), m();
34
44
  };
35
45
  }
36
- }, [n]), /* @__PURE__ */ j(d.Provider, { value: {
46
+ }, [n]), /* @__PURE__ */ E(f.Provider, { value: {
37
47
  anno: n,
38
- setAnno: c,
39
- annotations: a,
40
- selection: i
48
+ setAnno: r,
49
+ annotations: s,
50
+ selection: u
41
51
  }, children: t.children });
42
- }), p = () => {
43
- const { anno: t } = w(d);
52
+ }), b = () => {
53
+ const { anno: t } = w(f);
44
54
  return t;
45
- }, k = () => {
46
- const t = p();
47
- return t == null ? void 0 : t.state.store;
48
55
  }, q = () => {
49
- const { annotations: t } = w(d);
56
+ const t = b();
57
+ return t == null ? void 0 : t.state.store;
58
+ }, P = () => {
59
+ const { annotations: t } = w(f);
50
60
  return t;
51
- }, y = (t) => {
52
- const { annotations: e } = w(d);
53
- return _(e, t);
54
- }, L = (t) => t ? y(t) : q(), z = (t, e) => {
55
- const n = k(), [c, a] = l(
61
+ }, k = (t) => {
62
+ const { annotations: e } = w(f);
63
+ return O(e, t);
64
+ }, M = (t) => t ? k(t) : P(), z = (t, e) => {
65
+ const n = q(), [r, s] = d(
56
66
  n == null ? void 0 : n.getAnnotation(t)
57
67
  );
58
- return h(() => {
68
+ return g(() => {
59
69
  if (!n) return;
60
- const o = (i) => {
61
- const r = i.changes.updated[0];
62
- r && a(r.newValue);
70
+ const o = (u) => {
71
+ const i = u.changes.updated[0];
72
+ i && s(i.newValue);
63
73
  };
64
74
  return n.observe(o, { ...e, annotations: t }), () => n.unobserve(o);
65
- }, []), c;
66
- }, M = (t) => {
67
- const e = p(), n = z(t);
75
+ }, []), r;
76
+ }, Q = (t) => {
77
+ const e = b(), n = z(t);
68
78
  return e && n ? e.state.selection.evalSelectAction(n) : void 0;
69
- }, N = () => {
70
- const { selection: t } = w(d);
79
+ }, T = () => {
80
+ const { selection: t } = w(f);
71
81
  return t;
72
- }, Q = () => {
73
- const t = p(), [e, n] = l();
74
- return h(() => {
82
+ }, W = () => {
83
+ const t = b(), [e, n] = d();
84
+ return g(() => {
75
85
  if (!t) return;
76
- const { hover: c, store: a } = t.state, o = c.subscribe((i) => {
77
- if (i) {
78
- const r = a.getAnnotation(i);
79
- n(r);
86
+ const { hover: r, store: s } = t.state, o = r.subscribe((u) => {
87
+ if (u) {
88
+ const i = s.getAnnotation(u);
89
+ n(i);
80
90
  } else
81
91
  n(void 0);
82
92
  });
@@ -84,48 +94,48 @@ const d = E({
84
94
  o();
85
95
  };
86
96
  }, [t]), e;
87
- }, T = () => {
88
- const t = p();
97
+ }, X = () => {
98
+ const t = b();
89
99
  return t == null ? void 0 : t.getUser();
90
- }, D = () => {
91
- const t = p(), [e, n] = l([]);
92
- return h(() => {
100
+ }, _ = () => {
101
+ const t = b(), [e, n] = d([]);
102
+ return g(() => {
93
103
  if (t) {
94
- const { store: c, viewport: a } = t.state;
95
- if (!a)
104
+ const { store: r, viewport: s } = t.state;
105
+ if (!s)
96
106
  return;
97
107
  let o;
98
- const i = a.subscribe((r) => {
99
- o && c.unobserve(o);
100
- const S = r.map((s) => c.getAnnotation(s));
101
- n(S), o = (s) => {
102
- const { updated: V } = s.changes;
103
- n((b) => b.map((u) => {
104
- const A = V.find((f) => f.oldValue.id === u.id);
105
- return A ? A.newValue : u;
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;
113
+ n((A) => A.map((l) => {
114
+ const m = c.find((S) => S.oldValue.id === l.id);
115
+ return m ? m.newValue : l;
106
116
  }));
107
- }, c.observe(o, { annotations: r });
117
+ }, r.observe(o, { annotations: i });
108
118
  });
109
119
  return () => {
110
- i();
120
+ u();
111
121
  };
112
122
  }
113
123
  }, [t]), e;
114
124
  }, B = (t) => {
115
- const e = D();
116
- return _(e, t);
117
- }, W = (t) => t ? B(t) : D();
125
+ const e = _();
126
+ return O(e, t);
127
+ }, Y = (t) => t ? B(t) : _();
118
128
  export {
119
- K as Annotorious,
120
- d as AnnotoriousContext,
129
+ L as Annotorious,
130
+ f as AnnotoriousContext,
121
131
  z as useAnnotation,
122
- M as useAnnotationSelectAction,
123
- k as useAnnotationStore,
124
- L as useAnnotations,
125
- p as useAnnotator,
126
- T as useAnnotatorUser,
127
- Q as useHover,
128
- N as useSelection,
129
- W as useViewportState
132
+ Q as useAnnotationSelectAction,
133
+ q as useAnnotationStore,
134
+ M as useAnnotations,
135
+ b as useAnnotator,
136
+ X as useAnnotatorUser,
137
+ W as useHover,
138
+ T as useSelection,
139
+ Y as useViewportState
130
140
  };
131
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 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}\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: [] });\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store, hover } = 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({ selected: resolved, ...rest });\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","useImperativeHandle","useEffect","store","hover","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","rest","resolved","id","editable","event","updated","annotation","next","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useAnnotation","options","setAnnotation","handleChange","useAnnotationSelectAction","useSelection","useHover","setHover","unsubscribeHover","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;AA2BO,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,GAAa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qB;AAEvC,cAAM/B,IAAWiC,EAAI,IAAI,OAAMxC,EAAM,cAAcQ,CAAE,CAAC;AACtD,QAAA4B,EAAc7B,CAAQ,GAEtB+B,IAAwB,CAAA5B,MAAS;AAC/B,gBAAM,EAAE,SAAAC,MAAYD,EAAM;AAE1B,UAAA0B,EAAc,CAAA1C,MAAeA,EAAY,IAAI,CAAAkB,MAAc;AACzD,kBAAMC,IAAOF,EAAQ,KAAK,CAAAG,MAAKA,EAAE,SAAS,OAAOF,EAAW,EAAE;AAC9D,mBAAOC,IAAOA,EAAK,WAAWD;AAAA,UAChC,CAAC,CAAC;AAAA,QACJ,GAEAZ,EAAM,QAAQsC,GAAuB,EAAE,aAAaE,GAAK;AAAA,MAC3D,CAAC;AAED,aAAO,MAAM;AACX,QAAAD,EAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF,GAAG,CAAChD,CAAI,CAAC,GAEF4C;AACT,GAEMM,IAA6B,CAAuBpB,MAAqB;AAC7E,QAAMc,IAAaD,EAAA;AACnB,SAAOZ,EAAYa,GAAYd,CAAQ;AACzC,GAEaqB,IAAmB,CAAyCrB,MACvEA,IAAWoB,EAA8BpB,CAAQ,IAAIa,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,IAAUX,EAAK;AAIlC,MAAIW,EAAM,MAAM,SAAS,KACvBP,EAAeO,EAAM,KAAK;AAI5B,YAAMC,IAAgB,MAAMR,EAAe,MAAMO,EA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B,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.2",
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.2",
49
- "@annotorious/core": "3.7.2",
50
- "@annotorious/openseadragon": "3.7.2",
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
  },