@annotorious/react 3.7.2 → 3.7.3

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;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,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,89 @@
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 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";
3
+ import { useDebounce as O } from "./annotorious-react.es12.js";
4
+ const f = J({
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
+ }), 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(() => {
12
12
  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);
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);
17
+ 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) => {
22
+ const v = {
23
+ selected: R,
24
+ previous: i.selected,
25
+ ...D
26
+ };
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) => ({
31
+ ...V,
32
+ selected: V.selected.map(({ annotation: x, editable: C }) => {
33
+ const H = v.find((y) => y.oldValue.id === x.id);
27
34
  return H ? { annotation: H.newValue, editable: C } : { annotation: x, editable: C };
28
35
  })
29
36
  }));
30
- }, s.observe(u, { annotations: f.map(({ id: v }) => v) });
37
+ }, r.observe(l, { annotations: w.map(({ id: i }) => i) });
31
38
  });
32
39
  return () => {
33
- s.unobserve(b), A();
40
+ r.unobserve(A), g();
34
41
  };
35
42
  }
36
- }, [n]), /* @__PURE__ */ j(d.Provider, { value: {
43
+ }, [n]), /* @__PURE__ */ I(f.Provider, { value: {
37
44
  anno: n,
38
45
  setAnno: c,
39
46
  annotations: a,
40
- selection: i
47
+ selection: u
41
48
  }, children: t.children });
42
- }), p = () => {
43
- const { anno: t } = w(d);
49
+ }), b = () => {
50
+ const { anno: t } = h(f);
44
51
  return t;
45
- }, k = () => {
46
- const t = p();
52
+ }, E = () => {
53
+ const t = b();
47
54
  return t == null ? void 0 : t.state.store;
48
- }, q = () => {
49
- const { annotations: t } = w(d);
55
+ }, P = () => {
56
+ const { annotations: t } = h(f);
50
57
  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(
58
+ }, k = (t) => {
59
+ const { annotations: e } = h(f);
60
+ return O(e, t);
61
+ }, L = (t) => t ? k(t) : P(), q = (t, e) => {
62
+ const n = E(), [c, a] = d(
56
63
  n == null ? void 0 : n.getAnnotation(t)
57
64
  );
58
- return h(() => {
65
+ return S(() => {
59
66
  if (!n) return;
60
- const o = (i) => {
61
- const r = i.changes.updated[0];
62
- r && a(r.newValue);
67
+ const o = (u) => {
68
+ const s = u.changes.updated[0];
69
+ s && a(s.newValue);
63
70
  };
64
71
  return n.observe(o, { ...e, annotations: t }), () => n.unobserve(o);
65
72
  }, []), c;
66
73
  }, M = (t) => {
67
- const e = p(), n = z(t);
74
+ const e = b(), n = q(t);
68
75
  return e && n ? e.state.selection.evalSelectAction(n) : void 0;
69
- }, N = () => {
70
- const { selection: t } = w(d);
71
- return t;
72
76
  }, Q = () => {
73
- const t = p(), [e, n] = l();
74
- return h(() => {
77
+ const { selection: t } = h(f);
78
+ return t;
79
+ }, T = () => {
80
+ const t = b(), [e, n] = d();
81
+ return S(() => {
75
82
  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);
83
+ const { hover: c, store: a } = t.state, o = c.subscribe((u) => {
84
+ if (u) {
85
+ const s = a.getAnnotation(u);
86
+ n(s);
80
87
  } else
81
88
  n(void 0);
82
89
  });
@@ -84,48 +91,48 @@ const d = E({
84
91
  o();
85
92
  };
86
93
  }, [t]), e;
87
- }, T = () => {
88
- const t = p();
94
+ }, W = () => {
95
+ const t = b();
89
96
  return t == null ? void 0 : t.getUser();
90
- }, D = () => {
91
- const t = p(), [e, n] = l([]);
92
- return h(() => {
97
+ }, _ = () => {
98
+ const t = b(), [e, n] = d([]);
99
+ return S(() => {
93
100
  if (t) {
94
101
  const { store: c, viewport: a } = t.state;
95
102
  if (!a)
96
103
  return;
97
104
  let o;
98
- const i = a.subscribe((r) => {
105
+ const u = a.subscribe((s) => {
99
106
  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;
107
+ const m = s.map((p) => c.getAnnotation(p));
108
+ n(m), o = (p) => {
109
+ const { updated: r } = p.changes;
110
+ n((A) => A.map((l) => {
111
+ const g = r.find((w) => w.oldValue.id === l.id);
112
+ return g ? g.newValue : l;
106
113
  }));
107
- }, c.observe(o, { annotations: r });
114
+ }, c.observe(o, { annotations: s });
108
115
  });
109
116
  return () => {
110
- i();
117
+ u();
111
118
  };
112
119
  }
113
120
  }, [t]), e;
114
- }, B = (t) => {
115
- const e = D();
116
- return _(e, t);
117
- }, W = (t) => t ? B(t) : D();
121
+ }, z = (t) => {
122
+ const e = _();
123
+ return O(e, t);
124
+ }, X = (t) => t ? z(t) : _();
118
125
  export {
119
126
  K as Annotorious,
120
- d as AnnotoriousContext,
121
- z as useAnnotation,
127
+ f as AnnotoriousContext,
128
+ q as useAnnotation,
122
129
  M as useAnnotationSelectAction,
123
- k as useAnnotationStore,
130
+ E as useAnnotationStore,
124
131
  L as useAnnotations,
125
- p as useAnnotator,
126
- T as useAnnotatorUser,
127
- Q as useHover,
128
- N as useSelection,
129
- W as useViewportState
132
+ b as useAnnotator,
133
+ W as useAnnotatorUser,
134
+ T as useHover,
135
+ Q as useSelection,
136
+ X as useViewportState
130
137
  };
131
138
  //# 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,GAAaC,CAAc,IAAIF,EAAuB,CAAA,CAAE,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAA,GAAI;AAEtE,SAAAK,EAAoBR,GAAK,MAAMC,CAAI,GAEnCQ,EAAU,MAAM;AACd,QAAIR,GAAM;AACR,YAAM,EAAE,WAAAK,GAAW,OAAAI,GAAO,OAAAC,EAAA,IAAUV,EAAK;AAIzC,MAA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AAQ,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\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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,gBAAAA,EAAM;AACf,GAEM8C,IAAoB,MAA4B;AACpD,QAAM9C,IAAO2B,EAAA,GAEP,CAACoB,GAAYC,CAAa,IAAI9C,EAAc,CAAA,CAAE;AAEpD,SAAAQ,EAAU,MAAM;AACd,QAAIV,GAAM;AACR,YAAM,EAAE,OAAAW,GAAO,UAAAsC,EAAA,IAAajD,EAAK;AAEjC,UAAI,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;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@annotorious/react",
3
- "version": "3.7.2",
3
+ "version": "3.7.3",
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.3",
49
+ "@annotorious/core": "3.7.3",
50
+ "@annotorious/openseadragon": "3.7.3",
51
51
  "@floating-ui/react": "^0.27.15",
52
52
  "zustand": "^5.0.7"
53
53
  },