@soomo/react-text-annotator 3.2.0-staging.9 → 3.3.0-staging.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.
@@ -1,19 +1,22 @@
1
- import { FC, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { TextAnnotation } from '@soomo/text-annotator';
3
- import { FloatingArrowProps } from '@floating-ui/react';
3
+ import { FloatingArrowProps, Placement } from '@floating-ui/react';
4
4
  interface TextAnnotationPopupProps {
5
5
  ariaNavigationMessage?: string;
6
6
  ariaCloseWarning?: string;
7
7
  arrow?: boolean;
8
8
  arrowProps?: Omit<FloatingArrowProps, 'context' | 'ref'>;
9
+ asPortal?: boolean;
10
+ placement?: Placement;
9
11
  popup(props: TextAnnotationPopupContentProps): ReactNode;
12
+ onClose?(): void;
10
13
  }
11
- export interface TextAnnotationPopupContentProps {
12
- annotation: TextAnnotation;
14
+ export interface TextAnnotationPopupContentProps<T extends TextAnnotation = TextAnnotation> {
15
+ annotation: T;
13
16
  editable?: boolean;
14
17
  event?: PointerEvent | KeyboardEvent;
15
18
  }
16
- export declare const TextAnnotationPopup: FC<TextAnnotationPopupProps>;
19
+ export declare const TextAnnotationPopup: (props: TextAnnotationPopupProps) => import("react/jsx-runtime").JSX.Element;
17
20
  /**
18
21
  * Prevent text-annotator from handling the irrelevant events
19
22
  * triggered from the popup/toolbar/dialog
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationPopup.d.ts","sourceRoot":"","sources":["../../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAqD,MAAM,OAAO,CAAC;AAEhG,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAKL,kBAAkB,EAUnB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,2BAA2B,CAAC;AAEnC,UAAU,wBAAwB;IAEhC,qBAAqB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AAS,CAAC;IAEzD,OAAO,CAAC,IAAI,IAAI,CAAC;CAElB;AAED,MAAM,WAAW,+BAA+B,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc;IAExF,UAAU,EAAE,CAAC,CAAC;IAEd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CAEtC;AAYD,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CAmJlE,CAAC;AAEF;;;;;;;;;;EAUE;AAEF,mCAAmC;AACnC,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,GAAI,OAAO,wBAAwB,4CAOjE,CAAC"}
@@ -1 +1 @@
1
- .r6o-popup-sr-only{border:0!important;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.r6o-popup-sr-only:focus,.r6o-popup-sr-only:active{clip:auto;-webkit-clip-path:none;clip-path:none;height:auto;margin:auto;overflow:visible;width:auto;white-space:normal}
1
+ .r6o-text-popup{z-index:1}.r6o-popup-sr-only{border:0!important;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.r6o-popup-sr-only:focus,.r6o-popup-sr-only:active{-webkit-clip-path:none;clip-path:none;height:auto;margin:auto;overflow:visible;width:auto;white-space:normal}.r6o-popup-sr-only:focus{clip:auto}
@@ -1,29 +1,30 @@
1
- import { jsx as g, Fragment as U, jsxs as W } from "react/jsx-runtime";
2
- import { useRef as y, useEffect as l, useContext as P, useCallback as x, Children as _, cloneElement as j, useState as S, useMemo as D } from "react";
3
- import H from "CETEIcean";
4
- import { AnnotoriousContext as R, useAnnotationStore as Q, Origin as z, useAnnotator as V, useSelection as Y } from "@annotorious/react";
5
- import { AnnotoriousPlugin as Oe } from "@annotorious/react";
6
- import { TEIPlugin as $ } from "@recogito/text-annotator-tei";
7
- import { serializeW3CTEIAnnotation as Pe } from "@recogito/text-annotator-tei";
8
- import { createTextAnnotator as I, toViewportBounds as F, toDomRectList as J, NOT_ANNOTATABLE_CLASS as q } from "@soomo/text-annotator";
9
- import { W3CTextFormat as Ie, parseW3CTextAnnotation as Be, serializeW3CTextAnnotation as Ne } from "@soomo/text-annotator";
1
+ import { jsx as f, Fragment as k, jsxs as U } from "react/jsx-runtime";
2
+ import { useRef as w, useEffect as a, useContext as O, useCallback as x, Children as W, cloneElement as _, useState as S, useMemo as j } from "react";
3
+ import D from "CETEIcean";
4
+ import { AnnotoriousContext as P, useAnnotationStore as H, Origin as Q, useAnnotator as z, useSelection as V } from "@annotorious/react";
5
+ import { AnnotoriousPlugin as Be } from "@annotorious/react";
6
+ import { TEIPlugin as Y } from "@recogito/text-annotator-tei";
7
+ import { serializeW3CTEIAnnotation as Le } from "@recogito/text-annotator-tei";
8
+ import { createTextAnnotator as R, toViewportBounds as B, toDomRectList as $, NOT_ANNOTATABLE_CLASS as q } from "@soomo/text-annotator";
9
+ import { W3CTextFormat as Me, parseW3CTextAnnotation as ke, serializeW3CTextAnnotation as Ue } from "@soomo/text-annotator";
10
10
  import "@soomo/text-annotator/dist/text-annotator.css";
11
- import { Ignore as G } from "@annotorious/core";
12
- import { Origin as ke, UserSelectAction as Ue, createBody as We } from "@annotorious/core";
13
- import { useFloating as K, autoUpdate as X, inline as Z, offset as ee, flip as te, shift as ne, arrow as oe, useDismiss as re, useRole as se, useInteractions as ie, FloatingPortal as ce, FloatingFocusManager as le, FloatingArrow as ue } from "@floating-ui/react";
14
- const O = {
11
+ import { Ignore as J } from "@annotorious/core";
12
+ import { Origin as _e, UserSelectAction as je, createBody as De } from "@annotorious/core";
13
+ import G from "debounce";
14
+ import { useFloating as K, autoUpdate as X, inline as Z, offset as ee, flip as te, shift as ne, arrow as oe, useDismiss as re, useRole as se, useInteractions as ie, FloatingPortal as le, FloatingFocusManager as ae, FloatingArrow as ce } from "@floating-ui/react";
15
+ const v = {
15
16
  tei: {
16
17
  ref: (e) => {
17
- const r = document.createElement("a");
18
+ const t = document.createElement("a");
18
19
  for (; e.firstChild; )
19
- r.appendChild(e.removeChild(e.firstChild));
20
- r.setAttribute("href", e.getAttribute("target")), e.appendChild(r);
20
+ t.appendChild(e.removeChild(e.firstChild));
21
+ t.setAttribute("href", e.getAttribute("target")), e.appendChild(t);
21
22
  },
22
23
  // Cf. https://github.com/TEIC/CETEIcean/issues/67
23
24
  graphic: (e) => {
24
- var c;
25
- const r = new Image();
26
- r.src = (c = e.getAttribute("url")) == null ? void 0 : c.trim(), e.hasAttribute("width") && r.setAttribute("width", e.getAttribute("width")), e.hasAttribute("height") && r.setAttribute("height", e.getAttribute("height")), e.appendChild(r);
25
+ var r;
26
+ const t = new Image();
27
+ t.src = (r = e.getAttribute("url")) == null ? void 0 : r.trim(), e.hasAttribute("width") && t.setAttribute("width", e.getAttribute("width")), e.hasAttribute("height") && t.setAttribute("height", e.getAttribute("height")), e.appendChild(t);
27
28
  },
28
29
  list: null,
29
30
  note: null,
@@ -32,184 +33,192 @@ const O = {
32
33
  e.hidden = !0;
33
34
  }
34
35
  }
35
- }, ve = (e) => {
36
- const r = y(null);
37
- return l(() => {
38
- var c;
36
+ }, Fe = (e) => {
37
+ const t = w(null);
38
+ return a(() => {
39
+ var r;
39
40
  if (e.tei) {
40
- const n = new H(e.initArgs);
41
- n.addBehaviors({
42
- ...O,
41
+ const s = new D(e.initArgs);
42
+ s.addBehaviors({
43
+ ...v,
43
44
  ...e.behaviors || {},
44
45
  tei: {
45
- ...O.tei,
46
- ...((c = e.behaviors) == null ? void 0 : c.tei) || {}
46
+ ...v.tei,
47
+ ...((r = e.behaviors) == null ? void 0 : r.tei) || {}
47
48
  }
48
- }), n.makeHTML5(e.tei, (s) => {
49
- r.current.appendChild(s), e.onLoad(r.current);
49
+ }), s.makeHTML5(e.tei, (n) => {
50
+ t.current.appendChild(n), e.onLoad(t.current);
50
51
  });
51
52
  }
52
53
  return () => {
53
- r.current && (r.current.innerHTML = "");
54
+ t.current && (t.current.innerHTML = "");
54
55
  };
55
- }, [e.tei, JSON.stringify(e.initArgs), e.onLoad]), /* @__PURE__ */ g(
56
+ }, [e.tei, JSON.stringify(e.initArgs), e.onLoad]), /* @__PURE__ */ f(
56
57
  "div",
57
58
  {
58
- ref: r,
59
+ ref: t,
59
60
  className: "tei-container"
60
61
  }
61
62
  );
62
- }, xe = (e) => {
63
- const { children: r, ...c } = e, { anno: n, setAnno: s } = P(R), i = x((t) => {
64
- const u = $(I(t, c));
65
- s(u);
63
+ }, ve = (e) => {
64
+ const { children: t, ...r } = e, { anno: s, setAnno: n } = O(P), i = x((l) => {
65
+ const u = Y(R(l, r));
66
+ n(u);
66
67
  }, []);
67
- return l(() => {
68
- n && n.setStyle(e.style);
69
- }, [e.style]), l(() => {
70
- n && n.setFilter(e.filter);
71
- }, [e.filter]), e.children ? /* @__PURE__ */ g(U, { children: _.toArray(e.children).map((t) => j(t, { onLoad: i })) }) : null;
72
- }, v = (e, r = { timeout: 250 }) => {
73
- const c = Q(), [n, s] = S(!0);
74
- return l(() => {
75
- if (!c || !e) return;
68
+ return a(() => {
69
+ s && s.setStyle(e.style);
70
+ }, [e.style]), a(() => {
71
+ s && s.setFilter(e.filter);
72
+ }, [e.filter]), e.children ? /* @__PURE__ */ f(k, { children: W.toArray(e.children).map((l) => _(l, { onLoad: i })) }) : null;
73
+ }, T = (e, t = { timeout: 250 }) => {
74
+ const r = H(), [s, n] = S(!0);
75
+ return a(() => {
76
+ if (!r || !e) return;
76
77
  let i;
77
- const t = (u) => {
78
- const { changes: { updated: a } } = u;
79
- (a == null ? void 0 : a.some((o) => {
80
- const { targetUpdated: f } = o;
81
- if (f) {
82
- const { oldTarget: p, newTarget: m } = f;
83
- return ae(p, m);
78
+ const l = (u) => {
79
+ const { changes: { updated: g } } = u;
80
+ (g == null ? void 0 : g.some((o) => {
81
+ const { targetUpdated: c } = o;
82
+ if (c) {
83
+ const { oldTarget: h, newTarget: d } = c;
84
+ return ue(h, d);
84
85
  }
85
- })) && (s(!1), clearTimeout(i), i = setTimeout(() => s(!0), r.timeout));
86
+ })) && (n(!1), clearTimeout(i), i = setTimeout(() => n(!0), t.timeout));
86
87
  };
87
- return c.observe(t, {
88
+ return r.observe(l, {
88
89
  annotations: e,
89
- ignore: G.BODY_ONLY,
90
- origin: z.LOCAL
90
+ ignore: J.BODY_ONLY,
91
+ origin: Q.LOCAL
91
92
  }), () => {
92
- clearTimeout(i), c.unobserve(t);
93
+ clearTimeout(i), r.unobserve(l);
93
94
  };
94
- }, [c, e, r.timeout]), n;
95
- }, ae = (e, r) => {
96
- const { selector: c } = e, n = c.map(({ quote: t }) => t), { selector: s } = r, i = s.map(({ quote: t }) => t);
97
- return n.join() !== i.join();
98
- }, Se = (e) => {
99
- const r = y(null), { className: c, children: n, ...s } = e, { style: i, filter: t, user: u, annotatingEnabled: a, userSelectAction: A } = s, { anno: o, setAnno: f } = P(R);
100
- return l(() => {
101
- if (!f) return;
102
- const p = typeof s.adapter == "function" ? s.adapter(r.current) : s.adapter, m = I(r.current, { ...s, adapter: p });
103
- return f(m), () => m.destroy();
104
- }, [f]), l(() => o == null ? void 0 : o.setStyle(i), [o, i]), l(() => o == null ? void 0 : o.setFilter(t), [o, t]), l(() => o == null ? void 0 : o.setFilter(t), [o, t]), l(() => o == null ? void 0 : o.setUserSelectAction(A), [o, A]), l(() => o == null ? void 0 : o.setUser(u), [o, u]), l(() => o == null ? void 0 : o.setAnnotatingEnabled(a), [o, a]), /* @__PURE__ */ g("div", { ref: r, className: `r6o-annotatable no-focus-outline ${c}`, children: n });
105
- }, L = () => {
95
+ }, [r, e, t.timeout]), s;
96
+ }, ue = (e, t) => {
97
+ const { selector: r } = e, s = r.map(({ quote: l }) => l), { selector: n } = t, i = n.map(({ quote: l }) => l);
98
+ return s.join() !== i.join();
99
+ }, Ee = (e) => {
100
+ const t = w(null), { className: r, children: s, ...n } = e, { style: i, filter: l, user: u, annotatingEnabled: g, userSelectAction: m } = n, { anno: o, setAnno: c } = O(P);
101
+ return a(() => {
102
+ if (!c) return;
103
+ const h = typeof n.adapter == "function" ? n.adapter(t.current) : n.adapter, d = R(t.current, { ...n, adapter: h });
104
+ return c(d), () => d.destroy();
105
+ }, [c]), a(() => o == null ? void 0 : o.setStyle(i), [o, i]), a(() => o == null ? void 0 : o.setFilter(l), [o, l]), a(() => o == null ? void 0 : o.setFilter(l), [o, l]), a(() => o == null ? void 0 : o.setUserSelectAction(m), [o, m]), a(() => o == null ? void 0 : o.setUser(u), [o, u]), a(() => o == null ? void 0 : o.setAnnotatingEnabled(g), [o, g]), /* @__PURE__ */ f("div", { ref: t, className: `r6o-annotatable no-focus-outline ${r}`, children: s });
106
+ }, E = () => {
106
107
  if (typeof navigator > "u") return !1;
107
108
  var e = navigator.userAgent || navigator.vendor || (window == null ? void 0 : window.opera);
108
109
  return !!(/android/i.test(e) || /iPad|iPhone/.test(e) && !window.MSStream);
109
- }, de = (e) => {
110
- var E;
111
- const { popup: r, ariaNavigationMessage: c } = e, n = V(), { selected: s, event: i } = Y(), t = (E = s[0]) == null ? void 0 : E.annotation;
112
- v(t == null ? void 0 : t.id);
113
- const [u, a] = S((s == null ? void 0 : s.length) > 0), A = () => n == null ? void 0 : n.cancelSelected(), [o, f] = S(!1);
114
- x(() => f(!0), []);
115
- const p = x(() => f(!1), []);
116
- l(() => {
117
- u || p();
118
- }, [u, p]);
119
- const m = y(null), { refs: T, floatingStyles: B, update: C, context: w } = K({
120
- placement: L() ? "bottom" : "top",
121
- open: u,
122
- onOpenChange: (d, h, b) => {
123
- !d && (b === "escape-key" || b === "focus-out") && (a(d), A());
110
+ };
111
+ let y = null;
112
+ const de = G((e, t, r) => {
113
+ requestAnimationFrame(() => {
114
+ const s = t.getAnnotationBounds(e);
115
+ s && (y = B(s, r.getBoundingClientRect()));
116
+ });
117
+ }, 250), fe = (e) => {
118
+ var F;
119
+ const t = z(), { selected: r, event: s } = V(), n = (F = r[0]) == null ? void 0 : F.annotation;
120
+ T(n == null ? void 0 : n.id);
121
+ const [i, l] = S((r == null ? void 0 : r.length) > 0), u = () => t == null ? void 0 : t.cancelSelected(), [g, m] = S(!1);
122
+ x(() => m(!0), []);
123
+ const o = x(() => m(!1), []);
124
+ a(() => {
125
+ i || o();
126
+ }, [i, o]);
127
+ const c = w(!1), h = w(null), { refs: d, floatingStyles: I, update: ge, context: C } = K({
128
+ placement: E() ? "bottom" : e.placement || "top",
129
+ strategy: "absolute",
130
+ open: i,
131
+ onOpenChange: (p, b, A) => {
132
+ !p && (A === "escape-key" || A === "focus-out") && (l(p), u());
124
133
  },
125
134
  middleware: [
126
135
  Z(),
127
136
  ee(10),
128
137
  te({ crossAxis: !0 }),
129
138
  ne({ crossAxis: !0, padding: 10 }),
130
- oe({ element: m })
139
+ oe({ element: h })
131
140
  ],
132
141
  whileElementsMounted: X
133
- }), N = re(w), M = se(w, { role: "dialog" }), { getFloatingProps: fe } = ie([N, M]);
134
- l(() => {
135
- if (!n) return;
136
- const d = t == null ? void 0 : t.id, h = t == null ? void 0 : t.target.selector.length;
137
- if (d && h > 0 && v) {
138
- const b = n == null ? void 0 : n.state.store.getAnnotationBounds(t.id);
139
- a(!!b);
142
+ }), L = re(C), N = se(C, { role: "dialog" }), { getFloatingProps: me } = ie([L, N]);
143
+ a(() => {
144
+ if (!t) return;
145
+ const p = n == null ? void 0 : n.id, b = n == null ? void 0 : n.target.selector.length;
146
+ if (p && b > 0 && T) {
147
+ const A = t == null ? void 0 : t.state.store.getAnnotationBounds(n.id);
148
+ l(!!A);
140
149
  } else
141
- a(!1);
142
- }, [t == null ? void 0 : t.id, t == null ? void 0 : t.target.selector, v, n == null ? void 0 : n.state.store]), l(() => {
143
- n && (u && (t != null && t.id) ? T.setPositionReference({
144
- getBoundingClientRect: () => {
145
- const d = n.state.store.getAnnotationBounds(t.id);
146
- return d ? F(d, n.element.getBoundingClientRect()) : new DOMRect();
147
- },
150
+ l(!1);
151
+ }, [n == null ? void 0 : n.id, n == null ? void 0 : n.target.selector, T, t == null ? void 0 : t.state.store]), a(() => {
152
+ e.onClose && (i ? c.current = !0 : c.current && (c.current = !1, e.onClose()));
153
+ }, [e.onClose, i]), a(() => {
154
+ t && (i && (n != null && n.id) ? d.setPositionReference({
155
+ getBoundingClientRect: () => (de(n.id, t.state.store, t.element), y || new DOMRect()),
148
156
  getClientRects: () => {
149
- const h = n.state.store.getAnnotationRects(t.id).map(
150
- (b) => F(b, n.element.getBoundingClientRect())
157
+ const b = t.state.store.getAnnotationRects(n.id).map(
158
+ (A) => B(A, t.element.getBoundingClientRect())
151
159
  );
152
- return J(h);
160
+ return $(b);
153
161
  }
154
- }) : T.setPositionReference(null));
155
- }, [u, t == null ? void 0 : t.id, t == null ? void 0 : t.target, n]), l(() => {
156
- const d = { attributes: !0, childList: !0, subtree: !0 }, h = new MutationObserver(() => C());
157
- return h.observe(document.body, d), window.document.addEventListener("scroll", C, !0), () => {
158
- h.disconnect(), window.document.removeEventListener("scroll", C, !0);
159
- };
160
- }, [C]);
161
- const k = D(() => (i == null ? void 0 : i.type) === "keyup" || (i == null ? void 0 : i.type) === "contextmenu" || L() ? -1 : 0, [i]);
162
- return u && t ? /* @__PURE__ */ g(ce, { children: /* @__PURE__ */ g(
162
+ }) : d.setPositionReference(null));
163
+ }, [i, n == null ? void 0 : n.id, n == null ? void 0 : n.target, t]);
164
+ const M = j(() => (s == null ? void 0 : s.type) === "keyup" || (s == null ? void 0 : s.type) === "contextmenu" || E() ? -1 : 0, [s]);
165
+ return i && n ? /* @__PURE__ */ f(
163
166
  le,
164
167
  {
165
- context: w,
166
- modal: !1,
167
- closeOnFocusOut: !0,
168
- returnFocus: !1,
169
- initialFocus: k,
170
- children: /* @__PURE__ */ W(
171
- "div",
168
+ root: e.asPortal ? null : t.element,
169
+ children: /* @__PURE__ */ f(
170
+ ae,
172
171
  {
173
- className: `a9s-popup r6o-popup annotation-popup r6o-text-popup ${q}`,
174
- ref: T.setFloating,
175
- style: B,
176
- children: [
177
- e.popup({
178
- annotation: s[0].annotation,
179
- editable: s[0].editable,
180
- event: i
181
- }),
182
- e.arrow && /* @__PURE__ */ g(
183
- ue,
184
- {
185
- ref: m,
186
- context: w,
187
- ...e.arrowProps || {}
188
- }
189
- ),
190
- /* @__PURE__ */ g("button", { className: "r6o-popup-sr-only", "aria-live": "assertive", onClick: A, children: e.ariaCloseWarning || "Click or leave this dialog to close it." })
191
- ]
172
+ context: C,
173
+ modal: !1,
174
+ closeOnFocusOut: !0,
175
+ returnFocus: !1,
176
+ initialFocus: M,
177
+ children: /* @__PURE__ */ U(
178
+ "div",
179
+ {
180
+ className: `a9s-popup r6o-popup annotation-popup r6o-text-popup ${q}`,
181
+ ref: d.setFloating,
182
+ style: I,
183
+ children: [
184
+ e.popup({
185
+ annotation: r[0].annotation,
186
+ editable: r[0].editable,
187
+ event: s
188
+ }),
189
+ e.arrow && /* @__PURE__ */ f(
190
+ ce,
191
+ {
192
+ ref: h,
193
+ context: C,
194
+ ...e.arrowProps || {}
195
+ }
196
+ ),
197
+ /* @__PURE__ */ f("button", { className: "r6o-popup-sr-only", "aria-live": "assertive", onClick: u, children: e.ariaCloseWarning || "Click or leave this dialog to close it." })
198
+ ]
199
+ }
200
+ )
192
201
  }
193
202
  )
194
203
  }
195
- ) }) : null;
196
- }, ye = (e) => (l(() => {
204
+ ) : null;
205
+ }, Oe = (e) => (a(() => {
197
206
  console.warn("TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.");
198
- }, []), /* @__PURE__ */ g(de, { ...e }));
207
+ }, []), /* @__PURE__ */ f(fe, { ...e }));
199
208
  export {
200
- Oe as AnnotoriousPlugin,
201
- ve as CETEIcean,
202
- ke as Origin,
203
- xe as TEIAnnotator,
204
- de as TextAnnotationPopup,
205
- Se as TextAnnotator,
206
- ye as TextAnnotatorPopup,
207
- Ue as UserSelectAction,
208
- Ie as W3CTextFormat,
209
- We as createBody,
210
- Be as parseW3CTextAnnotation,
211
- Pe as serializeW3CTEIAnnotation,
212
- Ne as serializeW3CTextAnnotation,
213
- v as useAnnotationQuoteIdle
209
+ Be as AnnotoriousPlugin,
210
+ Fe as CETEIcean,
211
+ _e as Origin,
212
+ ve as TEIAnnotator,
213
+ fe as TextAnnotationPopup,
214
+ Ee as TextAnnotator,
215
+ Oe as TextAnnotatorPopup,
216
+ je as UserSelectAction,
217
+ Me as W3CTextFormat,
218
+ De as createBody,
219
+ ke as parseW3CTextAnnotation,
220
+ Le as serializeW3CTEIAnnotation,
221
+ Ue as serializeW3CTextAnnotation,
222
+ T as useAnnotationQuoteIdle
214
223
  };
215
224
  //# sourceMappingURL=react-text-annotator.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es.js","sources":["../src/tei/CETEIcean.tsx","../src/tei/TEIAnnotator.tsx","../src/hooks/useAnnotationQuoteIdle.ts","../src/TextAnnotator.tsx","../src/TextAnnotationPopup/isMobile.ts","../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport CETEI from 'CETEIcean';\n\ninterface CETEIceanProps {\n\n initArgs?: any;\n\n tei?: string;\n\n onLoad?(element: Element): void;\n\n behaviors?: any;\n\n}\n\n// Override default list, note, table, and ref behaviors \n// so they don't introduce text into the DOM that interferes\n// with annotation. Apply a patch to graphics for robustness.\nconst PRESET_BEHAVIORS = {\n tei: {\n ref: (elem: Element) => {\n const a = document.createElement('a');\n\n while(elem.firstChild) {\n a.appendChild(elem.removeChild(elem.firstChild));\n }\n\n a.setAttribute('href', elem.getAttribute('target'));\n\n elem.appendChild(a);\n },\n // Cf. https://github.com/TEIC/CETEIcean/issues/67\n graphic: (elem: Element) => {\n const content = new Image();\n content.src = elem.getAttribute('url')?.trim();\n\n if (elem.hasAttribute('width'))\n content.setAttribute('width', elem.getAttribute('width'));\n\n if (elem.hasAttribute('height'))\n content.setAttribute('height', elem.getAttribute('height'));\n\n elem.appendChild(content);\n },\n list: null,\n note: null,\n table: null,\n teiHeader: (elem: HTMLElement) => {\n elem.hidden = true;\n }\n }\n}\n\nexport const CETEIcean = (props: CETEIceanProps) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (props.tei) {\n const ceteicean = new CETEI(props.initArgs);\n\n ceteicean.addBehaviors({\n ...PRESET_BEHAVIORS,\n ...(props.behaviors || {}),\n tei: {\n ...PRESET_BEHAVIORS.tei,\n ...(props.behaviors?.tei || {})\n }\n });\n\n ceteicean.makeHTML5(props.tei, (data: Element) => {\n el.current.appendChild(data);\n props.onLoad(el.current);\n });\n }\n\n return () => {\n if (el.current)\n el.current.innerHTML = '';\n }\n }, [props.tei, JSON.stringify(props.initArgs), props.onLoad]);\n\n return (\n <div \n ref={el}\n className=\"tei-container\" />\n )\n\n}","import { Children, JSX, ReactElement, ReactNode, cloneElement, useCallback, useContext, useEffect } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport { TEIPlugin } from '@recogito/text-annotator-tei';\nimport { createTextAnnotator, HighlightStyleExpression } from '@soomo/text-annotator';\nimport type { TextAnnotatorOptions } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport type TEIAnnotatorProps = TextAnnotatorOptions & {\n\n children?: ReactNode | JSX.Element;\n\n filter?: Filter;\n\n style?: HighlightStyleExpression\n\n}\n\nexport const TEIAnnotator = (props: TEIAnnotatorProps) => {\n\n const { children, ...opts } = props;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n const onLoad = useCallback((element: HTMLElement) => {\n const anno = TEIPlugin(createTextAnnotator(element, opts));\n setAnno(anno);\n }, []);\n\n useEffect(() => {\n if (!anno)\n return;\n \n anno.setStyle(props.style);\n }, [props.style]);\n\n useEffect(() => {\n if (!anno)\n return;\n \n anno.setFilter(props.filter);\n }, [props.filter]);\n\n return props.children ? (\n <>\n {Children.toArray(props.children).map(child => \n cloneElement(child as ReactElement, { onLoad } as any))}\n </>\n ) : null;\n\n}\n","import { useEffect, useState } from 'react';\nimport { Origin, useAnnotationStore } from '@annotorious/react';\nimport { Ignore, type StoreChangeEvent } from '@annotorious/core';\nimport type { TextAnnotation, TextAnnotationStore, TextAnnotationTarget } from '@soomo/text-annotator';\n\nexport const useAnnotationQuoteIdle = (\n annotationId: string | undefined,\n options: { timeout: number } = { timeout: 250 }\n) => {\n const store = useAnnotationStore<TextAnnotationStore>();\n\n const [isIdle, setIsIdle] = useState(true);\n\n useEffect(() => {\n if (!store || !annotationId) return;\n\n let idleTimeout: ReturnType<typeof setTimeout>;\n\n const scheduleSetIsIdle = (event: StoreChangeEvent<TextAnnotation>) => {\n const { changes: { updated } } = event;\n\n const hasChanged = updated?.some(update => {\n const { targetUpdated } = update;\n if (targetUpdated) {\n const { oldTarget, newTarget } = targetUpdated;\n return hasQuoteChanged(oldTarget, newTarget);\n }\n });\n\n if (hasChanged) {\n setIsIdle(false);\n clearTimeout(idleTimeout);\n idleTimeout = setTimeout(() => setIsIdle(true), options.timeout);\n }\n };\n\n store.observe(scheduleSetIsIdle, {\n annotations: annotationId,\n ignore: Ignore.BODY_ONLY,\n origin: Origin.LOCAL\n });\n\n return () => {\n clearTimeout(idleTimeout);\n store.unobserve(scheduleSetIsIdle);\n };\n }, [store, annotationId, options.timeout]);\n\n return isIdle;\n};\n\nconst hasQuoteChanged = (oldValue: TextAnnotationTarget, newValue: TextAnnotationTarget) => {\n const { selector: oldSelector } = oldValue;\n const oldQuotes = oldSelector.map(({ quote }) => quote);\n\n const { selector: newSelector } = newValue;\n const newQuotes = newSelector.map(({ quote }) => quote);\n\n return oldQuotes.join() !== newQuotes.join();\n};\n","import { JSX, ReactNode, useContext, useEffect, useRef } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport type { FormatAdapter } from '@annotorious/core';\nimport type { HighlightStyleExpression, TextAnnotation, TextAnnotatorOptions } from '@soomo/text-annotator';\nimport { createTextAnnotator } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport interface TextAnnotatorProps<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<TextAnnotatorOptions<I, E>, 'adapter'> {\n\n children?: ReactNode | JSX.Element;\n\n adapter?: FormatAdapter<I, E> | ((container: HTMLElement) => FormatAdapter<I, E>) | null;\n\n filter?: Filter<I>;\n\n style?: HighlightStyleExpression;\n\n className?: string;\n\n}\n\nexport const TextAnnotator = <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(\n props: TextAnnotatorProps<I, E>\n) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n const { className, children, ...opts } = props;\n const { style, filter, user, annotatingEnabled, userSelectAction } = opts;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useEffect(() => {\n if (!setAnno) return;\n\n const adapter = typeof opts.adapter === 'function' ? opts.adapter(el.current) : opts.adapter;\n\n const anno = createTextAnnotator(el.current, { ...opts, adapter });\n setAnno(anno);\n\n return () => anno.destroy();\n }, [setAnno]);\n\n useEffect(() => anno?.setStyle(style), [anno, style]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);\n\n useEffect(() => anno?.setUser(user), [anno, user]);\n\n useEffect(() => anno?.setAnnotatingEnabled(annotatingEnabled), [anno, annotatingEnabled]);\n\n return (\n <div ref={el} className={`r6o-annotatable no-focus-outline ${className}`}>\n {children}\n </div>\n );\n\n};\n","// https://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system\nexport const isMobile = () => {\n if (typeof navigator === 'undefined') return false;\n\n // @ts-ignore\n var userAgent: string = navigator.userAgent || navigator.vendor || window?.opera;\n\n if (/android/i.test(userAgent)) \n return true;\n\n // @ts-ignore\n // Note: as of recently, this NO LONGER DETECTS FIREFOX ON iOS!\n // This means FF/iOS will behave like on the desktop, and loose\n // selection handlebars after the popup opens.\n if (/iPad|iPhone/.test(userAgent) && !window.MSStream)\n return true;\n\n return false;\n}","import React, { FC, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useAnnotator, useSelection } from '@annotorious/react';\nimport {\n NOT_ANNOTATABLE_CLASS,\n type TextAnnotation,\n type TextAnnotator,\n toDomRectList,\n toViewportBounds\n} from '@soomo/text-annotator';\nimport {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingArrowProps,\n FloatingFocusManager,\n FloatingPortal,\n inline,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useRole\n} from '@floating-ui/react';\nimport { isMobile } from './isMobile';\nimport { useAnnotationQuoteIdle } from '../hooks';\n\nimport './TextAnnotationPopup.css';\n\ninterface TextAnnotationPopupProps {\n\n ariaNavigationMessage?: string;\n\n ariaCloseWarning?: string;\n\n arrow?: boolean;\n\n arrowProps?: Omit<FloatingArrowProps, 'context' | 'ref'>;\n\n popup(props: TextAnnotationPopupContentProps): ReactNode;\n\n}\n\nexport interface TextAnnotationPopupContentProps {\n\n annotation: TextAnnotation;\n\n editable?: boolean;\n\n event?: PointerEvent | KeyboardEvent;\n\n}\n\nexport const TextAnnotationPopup: FC<TextAnnotationPopupProps> = (props) => {\n\n const { popup, ariaNavigationMessage } = props;\n\n const r = useAnnotator<TextAnnotator>();\n\n const { selected, event } = useSelection<TextAnnotation>();\n const annotation = selected[0]?.annotation;\n\n const isAnnotationQuoteIdle = useAnnotationQuoteIdle(annotation?.id);\n\n const [isOpen, setOpen] = useState(selected?.length > 0);\n const handleClose = () => r?.cancelSelected();\n\n const [isFocused, setFocused] = useState(false);\n const handleFocus = useCallback(() => setFocused(true), []);\n const handleBlur = useCallback(() => setFocused(false), []);\n useEffect(() => {\n if (!isOpen) handleBlur();\n }, [isOpen, handleBlur]);\n\n const arrowRef = useRef(null);\n\n const { refs, floatingStyles, update, context } = useFloating({\n placement: isMobile() ? 'bottom' : 'top',\n open: isOpen,\n onOpenChange: (open, _event, reason) => {\n if (!open && (reason === 'escape-key' || reason === 'focus-out')) {\n setOpen(open);\n handleClose();\n }\n },\n middleware: [\n inline(),\n offset(10),\n flip({ crossAxis: true }),\n shift({ crossAxis: true, padding: 10 }),\n arrow({ element: arrowRef })\n ],\n whileElementsMounted: autoUpdate\n });\n\n const dismiss = useDismiss(context);\n\n const role = useRole(context, { role: 'dialog' });\n\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n useEffect(() => {\n if (!r) return;\n\n const annotationId = annotation?.id;\n const annotationSelectorsLength = annotation?.target.selector.length;\n\n if (annotationId && annotationSelectorsLength > 0 && useAnnotationQuoteIdle) {\n const bounds = r?.state.store.getAnnotationBounds(annotation.id);\n setOpen(Boolean(bounds));\n } else {\n setOpen(false);\n }\n }, [annotation?.id, annotation?.target.selector, useAnnotationQuoteIdle, r?.state.store]);\n\n useEffect(() => {\n if (!r) return;\n\n if (isOpen && annotation?.id) {\n refs.setPositionReference({\n getBoundingClientRect: () => {\n const bounds = r.state.store.getAnnotationBounds(annotation.id);\n return bounds\n ? toViewportBounds(bounds, r.element.getBoundingClientRect())\n : new DOMRect();\n },\n getClientRects: () => {\n const rects = r.state.store.getAnnotationRects(annotation.id);\n const denormalizedRects = rects.map((rect) =>\n toViewportBounds(rect, r.element.getBoundingClientRect())\n );\n return toDomRectList(denormalizedRects);\n }\n });\n } else {\n refs.setPositionReference(null);\n }\n }, [isOpen, annotation?.id, annotation?.target, r]);\n\n useEffect(() => {\n const config: MutationObserverInit = { attributes: true, childList: true, subtree: true };\n\n const mutationObserver = new MutationObserver(() => update());\n mutationObserver.observe(document.body, config);\n\n window.document.addEventListener('scroll', update, true);\n\n return () => {\n mutationObserver.disconnect();\n window.document.removeEventListener('scroll', update, true);\n };\n }, [update]);\n\n // Don't shift focus to the floating element if selected via keyboard or on mobile.\n const initialFocus = useMemo(() => {\n return (event?.type === 'keyup' || event?.type === 'contextmenu' || isMobile()) ? -1 : 0;\n }, [event]);\n\n /**\n * Announce the navigation hint only on the keyboard selection,\n * because the focus isn't shifted to the popup automatically then\n */\n // useAnnouncePopupNavigation({\n // disabled: isFocused,\n // floatingOpen: isOpen,\n // message: ariaNavigationMessage,\n // });\n\n return isOpen && annotation ? (\n <FloatingPortal>\n <FloatingFocusManager\n context={context}\n modal={false}\n closeOnFocusOut={true}\n returnFocus={false}\n initialFocus={initialFocus}>\n <div\n className={`a9s-popup r6o-popup annotation-popup r6o-text-popup ${NOT_ANNOTATABLE_CLASS}`}\n ref={refs.setFloating}\n style={floatingStyles}>\n {props.popup({\n annotation: selected[0].annotation,\n editable: selected[0].editable,\n event\n })}\n{props.arrow && (\n <FloatingArrow\n ref={arrowRef}\n context={context}\n {...(props.arrowProps || {})} />\n )}\n\n <button className=\"r6o-popup-sr-only\" aria-live=\"assertive\" onClick={handleClose}>\n {props.ariaCloseWarning || 'Click or leave this dialog to close it.'}\n </button>\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n ) : null;\n\n};\n\n/**\n * Prevent text-annotator from handling the irrelevant events\n * triggered from the popup/toolbar/dialog\n *\nconst getStopEventsPropagationProps = <T extends HTMLElement = HTMLElement>() => ({\n onPointerUp: (event: React.PointerEvent<T>) => event.stopPropagation(),\n onPointerDown: (event: React.PointerEvent<T>) => event.stopPropagation(),\n onMouseDown: (event: React.MouseEvent<T>) => event.stopPropagation(),\n onMouseUp: (event: React.MouseEvent<T>) => event.stopPropagation()\n});\n*/\n\n/** For backwards compatibility **/\n/** @deprecated Use TextAnnotationPopup instead */\nexport const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => {\n\n useEffect(() => {\n console.warn('TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.');\n }, []);\n\n return <TextAnnotationPopup {...props} />;\n};\n"],"names":["PRESET_BEHAVIORS","elem","a","content","_a","CETEIcean","props","el","useRef","useEffect","ceteicean","CETEI","data","jsx","TEIAnnotator","children","opts","anno","setAnno","useContext","AnnotoriousContext","onLoad","useCallback","element","TEIPlugin","createTextAnnotator","Fragment","Children","child","cloneElement","useAnnotationQuoteIdle","annotationId","options","store","useAnnotationStore","isIdle","setIsIdle","useState","idleTimeout","scheduleSetIsIdle","event","updated","update","targetUpdated","oldTarget","newTarget","hasQuoteChanged","Ignore","Origin","oldValue","newValue","oldSelector","oldQuotes","quote","newSelector","newQuotes","TextAnnotator","className","style","filter","user","annotatingEnabled","userSelectAction","adapter","isMobile","userAgent","TextAnnotationPopup","popup","ariaNavigationMessage","r","useAnnotator","selected","useSelection","annotation","isOpen","setOpen","handleClose","isFocused","setFocused","handleBlur","arrowRef","refs","floatingStyles","context","useFloating","open","_event","reason","inline","offset","flip","shift","arrow","autoUpdate","dismiss","useDismiss","role","useRole","getFloatingProps","useInteractions","annotationSelectorsLength","bounds","toViewportBounds","denormalizedRects","rect","toDomRectList","config","mutationObserver","initialFocus","useMemo","FloatingPortal","FloatingFocusManager","jsxs","NOT_ANNOTATABLE_CLASS","FloatingArrow","TextAnnotatorPopup"],"mappings":";;;;;;;;;;;;;AAkBA,MAAMA,IAAmB;AAAA,EACvB,KAAK;AAAA,IACH,KAAK,CAACC,MAAkB;AAChB,YAAAC,IAAI,SAAS,cAAc,GAAG;AAEpC,aAAMD,EAAK;AACT,QAAAC,EAAE,YAAYD,EAAK,YAAYA,EAAK,UAAU,CAAC;AAGjD,MAAAC,EAAE,aAAa,QAAQD,EAAK,aAAa,QAAQ,CAAC,GAElDA,EAAK,YAAYC,CAAC;AAAA,IACpB;AAAA;AAAA,IAEA,SAAS,CAACD,MAAkB;;AACpB,YAAAE,IAAU,IAAI,MAAM;AAC1B,MAAAA,EAAQ,OAAMC,IAAAH,EAAK,aAAa,KAAK,MAAvB,gBAAAG,EAA0B,QAEpCH,EAAK,aAAa,OAAO,KAC3BE,EAAQ,aAAa,SAASF,EAAK,aAAa,OAAO,CAAC,GAEtDA,EAAK,aAAa,QAAQ,KAC5BE,EAAQ,aAAa,UAAUF,EAAK,aAA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;AAAA,MACA,UAAA,gBAAAI;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,uDAAuDC,CAAqB;AAAA,UACvF,KAAKhC,EAAK;AAAA,UACV,OAAOC;AAAA,UACN,UAAA;AAAA,YAAA5E,EAAM,MAAM;AAAA,cACX,YAAYiE,EAAS,CAAC,EAAE;AAAA,cACxB,UAAUA,EAAS,CAAC,EAAE;AAAA,cACtB,OAAA/B;AAAA,YAAA,CACD;AAAA,YACVlC,EAAM,SACK,gBAAAO;AAAA,cAACqG;AAAA,cAAA;AAAA,gBACC,KAAKlC;AAAA,gBACL,SAAAG;AAAA,gBACC,GAAI7E,EAAM,cAAc,CAAA;AAAA,cAAC;AAAA,YAAI;AAAA,YAGlC,gBAAAO,EAAC,UAAO,EAAA,WAAU,qBAAoB,aAAU,aAAY,SAAS+D,GAClE,UAAMtE,EAAA,oBAAoB,0CAC7B,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,KAEJ,IACE;AAEN,GAgBa6G,KAAqB,CAAC7G,OAEjCG,EAAU,MAAM;AACd,UAAQ,KAAK,mHAAmH;AAClI,GAAG,EAAE,GAEE,gBAAAI,EAACqD,IAAqB,EAAA,GAAG5D,EAAO,CAAA;"}
1
+ {"version":3,"file":"react-text-annotator.es.js","sources":["../src/tei/CETEIcean.tsx","../src/tei/TEIAnnotator.tsx","../src/hooks/useAnnotationQuoteIdle.ts","../src/TextAnnotator.tsx","../src/TextAnnotationPopup/isMobile.ts","../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport CETEI from 'CETEIcean';\n\ninterface CETEIceanProps {\n\n initArgs?: any;\n\n tei?: string;\n\n onLoad?(element: Element): void;\n\n behaviors?: any;\n\n}\n\n// Override default list, note, table, and ref behaviors \n// so they don't introduce text into the DOM that interferes\n// with annotation. Apply a patch to graphics for robustness.\nconst PRESET_BEHAVIORS = {\n tei: {\n ref: (elem: Element) => {\n const a = document.createElement('a');\n\n while(elem.firstChild) {\n a.appendChild(elem.removeChild(elem.firstChild));\n }\n\n a.setAttribute('href', elem.getAttribute('target'));\n\n elem.appendChild(a);\n },\n // Cf. https://github.com/TEIC/CETEIcean/issues/67\n graphic: (elem: Element) => {\n const content = new Image();\n content.src = elem.getAttribute('url')?.trim();\n\n if (elem.hasAttribute('width'))\n content.setAttribute('width', elem.getAttribute('width'));\n\n if (elem.hasAttribute('height'))\n content.setAttribute('height', elem.getAttribute('height'));\n\n elem.appendChild(content);\n },\n list: null,\n note: null,\n table: null,\n teiHeader: (elem: HTMLElement) => {\n elem.hidden = true;\n }\n }\n}\n\nexport const CETEIcean = (props: CETEIceanProps) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (props.tei) {\n const ceteicean = new CETEI(props.initArgs);\n\n ceteicean.addBehaviors({\n ...PRESET_BEHAVIORS,\n ...(props.behaviors || {}),\n tei: {\n ...PRESET_BEHAVIORS.tei,\n ...(props.behaviors?.tei || {})\n }\n });\n\n ceteicean.makeHTML5(props.tei, (data: Element) => {\n el.current.appendChild(data);\n props.onLoad(el.current);\n });\n }\n\n return () => {\n if (el.current)\n el.current.innerHTML = '';\n }\n }, [props.tei, JSON.stringify(props.initArgs), props.onLoad]);\n\n return (\n <div \n ref={el}\n className=\"tei-container\" />\n )\n\n}","import { Children, JSX, ReactElement, ReactNode, cloneElement, useCallback, useContext, useEffect } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport { TEIPlugin } from '@recogito/text-annotator-tei';\nimport { createTextAnnotator, HighlightStyleExpression } from '@soomo/text-annotator';\nimport type { TextAnnotatorOptions } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport type TEIAnnotatorProps = TextAnnotatorOptions & {\n\n children?: ReactNode | JSX.Element;\n\n filter?: Filter;\n\n style?: HighlightStyleExpression\n\n}\n\nexport const TEIAnnotator = (props: TEIAnnotatorProps) => {\n\n const { children, ...opts } = props;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n const onLoad = useCallback((element: HTMLElement) => {\n const anno = TEIPlugin(createTextAnnotator(element, opts));\n setAnno(anno);\n }, []);\n\n useEffect(() => {\n if (!anno)\n return;\n \n anno.setStyle(props.style);\n }, [props.style]);\n\n useEffect(() => {\n if (!anno)\n return;\n \n anno.setFilter(props.filter);\n }, [props.filter]);\n\n return props.children ? (\n <>\n {Children.toArray(props.children).map(child => \n cloneElement(child as ReactElement, { onLoad } as any))}\n </>\n ) : null;\n\n}\n","import { useEffect, useState } from 'react';\nimport { Origin, useAnnotationStore } from '@annotorious/react';\nimport { Ignore, type StoreChangeEvent } from '@annotorious/core';\nimport type { TextAnnotation, TextAnnotationStore, TextAnnotationTarget } from '@soomo/text-annotator';\n\nexport const useAnnotationQuoteIdle = (\n annotationId: string | undefined,\n options: { timeout: number } = { timeout: 250 }\n) => {\n const store = useAnnotationStore<TextAnnotationStore>();\n\n const [isIdle, setIsIdle] = useState(true);\n\n useEffect(() => {\n if (!store || !annotationId) return;\n\n let idleTimeout: ReturnType<typeof setTimeout>;\n\n const scheduleSetIsIdle = (event: StoreChangeEvent<TextAnnotation>) => {\n const { changes: { updated } } = event;\n\n const hasChanged = updated?.some(update => {\n const { targetUpdated } = update;\n if (targetUpdated) {\n const { oldTarget, newTarget } = targetUpdated;\n return hasQuoteChanged(oldTarget, newTarget);\n }\n });\n\n if (hasChanged) {\n setIsIdle(false);\n clearTimeout(idleTimeout);\n idleTimeout = setTimeout(() => setIsIdle(true), options.timeout);\n }\n };\n\n store.observe(scheduleSetIsIdle, {\n annotations: annotationId,\n ignore: Ignore.BODY_ONLY,\n origin: Origin.LOCAL\n });\n\n return () => {\n clearTimeout(idleTimeout);\n store.unobserve(scheduleSetIsIdle);\n };\n }, [store, annotationId, options.timeout]);\n\n return isIdle;\n};\n\nconst hasQuoteChanged = (oldValue: TextAnnotationTarget, newValue: TextAnnotationTarget) => {\n const { selector: oldSelector } = oldValue;\n const oldQuotes = oldSelector.map(({ quote }) => quote);\n\n const { selector: newSelector } = newValue;\n const newQuotes = newSelector.map(({ quote }) => quote);\n\n return oldQuotes.join() !== newQuotes.join();\n};\n","import { JSX, ReactNode, useContext, useEffect, useRef } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport type { FormatAdapter } from '@annotorious/core';\nimport type { HighlightStyleExpression, TextAnnotation, TextAnnotatorOptions } from '@soomo/text-annotator';\nimport { createTextAnnotator } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport interface TextAnnotatorProps<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<TextAnnotatorOptions<I, E>, 'adapter'> {\n\n children?: ReactNode | JSX.Element;\n\n adapter?: FormatAdapter<I, E> | ((container: HTMLElement) => FormatAdapter<I, E>) | null;\n\n filter?: Filter<I>;\n\n style?: HighlightStyleExpression;\n\n className?: string;\n\n}\n\nexport const TextAnnotator = <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(\n props: TextAnnotatorProps<I, E>\n) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n const { className, children, ...opts } = props;\n const { style, filter, user, annotatingEnabled, userSelectAction } = opts;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useEffect(() => {\n if (!setAnno) return;\n\n const adapter = typeof opts.adapter === 'function' ? opts.adapter(el.current) : opts.adapter;\n\n const anno = createTextAnnotator(el.current, { ...opts, adapter });\n setAnno(anno);\n\n return () => anno.destroy();\n }, [setAnno]);\n\n useEffect(() => anno?.setStyle(style), [anno, style]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);\n\n useEffect(() => anno?.setUser(user), [anno, user]);\n\n useEffect(() => anno?.setAnnotatingEnabled(annotatingEnabled), [anno, annotatingEnabled]);\n\n return (\n <div ref={el} className={`r6o-annotatable no-focus-outline ${className}`}>\n {children}\n </div>\n );\n\n};\n","// https://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system\nexport const isMobile = () => {\n if (typeof navigator === 'undefined') return false;\n\n // @ts-ignore\n var userAgent: string = navigator.userAgent || navigator.vendor || window?.opera;\n\n if (/android/i.test(userAgent)) \n return true;\n\n // @ts-ignore\n // Note: as of recently, this NO LONGER DETECTS FIREFOX ON iOS!\n // This means FF/iOS will behave like on the desktop, and loose\n // selection handlebars after the popup opens.\n if (/iPad|iPhone/.test(userAgent) && !window.MSStream)\n return true;\n\n return false;\n}","import React, { FC, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport debounce from 'debounce';\nimport { useAnnotator, useSelection } from '@annotorious/react';\nimport {\n NOT_ANNOTATABLE_CLASS,\n TextAnnotationStore,\n toViewportBounds,\n toDomRectList,\n type TextAnnotation,\n type TextAnnotator,\n} from '@soomo/text-annotator';\nimport {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingArrowProps,\n FloatingFocusManager,\n FloatingPortal,\n inline,\n offset,\n Placement,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useRole\n} from '@floating-ui/react';\nimport { isMobile } from './isMobile';\nimport { useAnnotationQuoteIdle } from '../hooks';\n\nimport './TextAnnotationPopup.css';\n\ninterface TextAnnotationPopupProps {\n\n ariaNavigationMessage?: string;\n\n ariaCloseWarning?: string;\n\n arrow?: boolean;\n\n arrowProps?: Omit<FloatingArrowProps, 'context' | 'ref'>;\n\n asPortal?: boolean;\n\n placement?: Placement;\n\n popup(props: TextAnnotationPopupContentProps): ReactNode;\n\n onClose?(): void;\n\n}\n\nexport interface TextAnnotationPopupContentProps<T extends TextAnnotation = TextAnnotation> {\n\n annotation: T;\n\n editable?: boolean;\n\n event?: PointerEvent | KeyboardEvent;\n\n}\n\nlet cachedBounds = null;\n\nconst updateViewportBounds = debounce((annotationId: string, store: TextAnnotationStore, container: HTMLElement) => {\n requestAnimationFrame(() => {\n const bounds = store.getAnnotationBounds(annotationId);\n if (!bounds) return;\n cachedBounds = toViewportBounds(bounds, container.getBoundingClientRect());\n });\n}, 250);\n\nexport const TextAnnotationPopup = (props: TextAnnotationPopupProps) => {\n\n const r = useAnnotator<TextAnnotator>();\n\n const { selected, event } = useSelection<TextAnnotation>();\n\n const annotation = selected[0]?.annotation;\n\n const isAnnotationQuoteIdle = useAnnotationQuoteIdle(annotation?.id);\n\n const [isOpen, setOpen] = useState(selected?.length > 0);\n const handleClose = () => r?.cancelSelected();\n\n const [isFocused, setFocused] = useState(false);\n const handleFocus = useCallback(() => setFocused(true), []);\n const handleBlur = useCallback(() => setFocused(false), []);\n useEffect(() => {\n if (!isOpen) handleBlur();\n }, [isOpen, handleBlur]);\n\n // So we can reliably trigger the onClose callback\n const wasOpenRef = useRef(false);\n\n const arrowRef = useRef(null);\n\n const { refs, floatingStyles, update, context } = useFloating({\n placement: isMobile() ? 'bottom' : props.placement || 'top',\n strategy: 'absolute',\n open: isOpen,\n onOpenChange: (open, _event, reason) => {\n if (!open && (reason === 'escape-key' || reason === 'focus-out')) {\n setOpen(open);\n handleClose();\n }\n },\n middleware: [\n inline(),\n offset(10),\n flip({ crossAxis: true }),\n shift({ crossAxis: true, padding: 10, }),\n arrow({ element: arrowRef })\n ],\n whileElementsMounted: autoUpdate\n });\n\n const dismiss = useDismiss(context);\n\n const role = useRole(context, { role: 'dialog' });\n\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n useEffect(() => {\n if (!r) return;\n\n const annotationId = annotation?.id;\n const annotationSelectorsLength = annotation?.target.selector.length;\n\n if (annotationId && annotationSelectorsLength > 0 && useAnnotationQuoteIdle) {\n const bounds = r?.state.store.getAnnotationBounds(annotation.id);\n setOpen(Boolean(bounds));\n } else {\n setOpen(false);\n }\n }, [annotation?.id, annotation?.target.selector, useAnnotationQuoteIdle, r?.state.store]);\n\n useEffect(() => {\n if (!props.onClose) return;\n\n if (isOpen) {\n wasOpenRef.current = true;\n } else if (wasOpenRef.current) {\n wasOpenRef.current = false;\n props.onClose();\n }\n }, [props.onClose, isOpen]);\n\n useEffect(() => {\n if (!r) return;\n\n if (isOpen && annotation?.id) {\n refs.setPositionReference({\n getBoundingClientRect: () => {\n // Debounced!\n updateViewportBounds(annotation.id, r.state.store, r.element);\n return cachedBounds ? cachedBounds : new DOMRect();\n },\n getClientRects: () => {\n const rects = r.state.store.getAnnotationRects(annotation.id);\n const denormalizedRects = rects.map((rect) =>\n toViewportBounds(rect, r.element.getBoundingClientRect())\n );\n return toDomRectList(denormalizedRects);\n }\n });\n } else {\n refs.setPositionReference(null);\n }\n }, [isOpen, annotation?.id, annotation?.target, r]);\n\n // Don't shift focus to the floating element if selected via keyboard or on mobile.\n const initialFocus = useMemo(() => {\n return (event?.type === 'keyup' || event?.type === 'contextmenu' || isMobile()) ? -1 : 0;\n }, [event]);\n\n /**\n * Announce the navigation hint only on the keyboard selection,\n * because the focus isn't shifted to the popup automatically then\n */\n // useAnnouncePopupNavigation({\n // disabled: isFocused,\n // floatingOpen: isOpen,\n // message: ariaNavigationMessage,\n // });\n\n return isOpen && annotation ? (\n <FloatingPortal\n root={props.asPortal ? null : r.element}>\n <FloatingFocusManager\n context={context}\n modal={false}\n closeOnFocusOut={true}\n returnFocus={false}\n initialFocus={initialFocus}>\n <div\n className={`a9s-popup r6o-popup annotation-popup r6o-text-popup ${NOT_ANNOTATABLE_CLASS}`}\n ref={refs.setFloating}\n style={floatingStyles}>\n {props.popup({\n annotation: selected[0].annotation,\n editable: selected[0].editable,\n event\n })}\n{props.arrow && (\n <FloatingArrow\n ref={arrowRef}\n context={context}\n {...(props.arrowProps || {})} />\n )}\n\n <button className=\"r6o-popup-sr-only\" aria-live=\"assertive\" onClick={handleClose}>\n {props.ariaCloseWarning || 'Click or leave this dialog to close it.'}\n </button>\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n ) : null;\n\n};\n\n/**\n * Prevent text-annotator from handling the irrelevant events\n * triggered from the popup/toolbar/dialog\n *\nconst getStopEventsPropagationProps = <T extends HTMLElement = HTMLElement>() => ({\n onPointerUp: (event: React.PointerEvent<T>) => event.stopPropagation(),\n onPointerDown: (event: React.PointerEvent<T>) => event.stopPropagation(),\n onMouseDown: (event: React.MouseEvent<T>) => event.stopPropagation(),\n onMouseUp: (event: React.MouseEvent<T>) => event.stopPropagation()\n});\n*/\n\n/** For backwards compatibility **/\n/** @deprecated Use TextAnnotationPopup instead */\nexport const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => {\n\n useEffect(() => {\n console.warn('TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.');\n }, []);\n\n return <TextAnnotationPopup {...props} />;\n};\n"],"names":["PRESET_BEHAVIORS","elem","a","content","_a","CETEIcean","props","el","useRef","useEffect","ceteicean","CETEI","data","jsx","TEIAnnotator","children","opts","anno","setAnno","useContext","AnnotoriousContext","onLoad","useCallback","element","TEIPlugin","createTextAnnotator","Fragment","Children","child","cloneElement","useAnnotationQuoteIdle","annotationId","options","store","useAnnotationStore","isIdle","setIsIdle","useState","idleTimeout","scheduleSetIsIdle","event","updated","update","targetUpdated","oldTarget","newTarget","hasQuoteChanged","Ignore","Origin","oldValue","newValue","oldSelector","oldQuotes","quote","newSelector","newQuotes","TextAnnotator","className","style","filter","user","annotatingEnabled","userSelectAction","adapter","isMobile","userAgent","cachedBounds","updateViewportBounds","debounce","container","bounds","toViewportBounds","TextAnnotationPopup","r","useAnnotator","selected","useSelection","annotation","isOpen","setOpen","handleClose","isFocused","setFocused","handleBlur","wasOpenRef","arrowRef","refs","floatingStyles","context","useFloating","open","_event","reason","inline","offset","flip","shift","arrow","autoUpdate","dismiss","useDismiss","role","useRole","getFloatingProps","useInteractions","annotationSelectorsLength","denormalizedRects","rect","toDomRectList","initialFocus","useMemo","FloatingPortal","FloatingFocusManager","jsxs","NOT_ANNOTATABLE_CLASS","FloatingArrow","TextAnnotatorPopup"],"mappings":";;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,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA,IAEA;AAEN,GAgBa8G,KAAqB,CAAC9G,OAEjCG,EAAU,MAAM;AACd,UAAQ,KAAK,mHAAmH;AAClI,GAAG,CAAA,CAAE,GAEE,gBAAAI,EAAC2D,IAAA,EAAqB,GAAGlE,EAAA,CAAO;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soomo/react-text-annotator",
3
- "version": "3.2.0-staging.9",
3
+ "version": "3.3.0-staging.0",
4
4
  "description": "Recogito Text Annotator React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -24,21 +24,21 @@
24
24
  "module": "./dist/react-text-annotator.es.js",
25
25
  "types": "./dist/index.d.ts",
26
26
  "devDependencies": {
27
- "@types/react": "^19.1.6",
28
- "@types/react-dom": "^19.1.5",
29
- "@vitejs/plugin-react": "^4.5.0",
30
- "react": "^18.3.1",
31
- "react-dom": "^18.3.1",
32
- "typescript": "5.8.3",
33
- "vite": "^6.3.5",
27
+ "@types/react": "^19.1.13",
28
+ "@types/react-dom": "^19.1.9",
29
+ "@vitejs/plugin-react": "^4.7.0",
30
+ "react": "^19.1.1",
31
+ "react-dom": "^19.1.1",
32
+ "typescript": "5.9.2",
33
+ "vite": "^6.3.6",
34
34
  "vite-plugin-dts": "^4.5.4",
35
35
  "vite-plugin-externalize-deps": "^0.9.0",
36
36
  "vite-tsconfig-paths": "^5.1.4"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0",
40
- "react": "16.8.0 || >=17.x || >=18.x || >=19.x",
41
- "react-dom": "16.8.0 || >=17.x || >=18.x || >=19.x"
40
+ "react": ">=18.x || >=19.x",
41
+ "react-dom": ">=18.x || >=19.x"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "openseadragon": {
@@ -46,13 +46,14 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@annotorious/core": "^3.3.6",
50
- "@annotorious/react": "^3.3.6",
51
- "@floating-ui/react": "^0.27.9",
49
+ "@annotorious/core": "^3.7.7",
50
+ "@annotorious/react": "^3.7.7",
51
+ "@floating-ui/react": "^0.27.16",
52
52
  "@react-aria/live-announcer": "^3.3.4",
53
- "@soomo/text-annotator": "3.2.0-staging.9",
54
- "@recogito/text-annotator-tei": "3.0.5",
55
- "CETEIcean": "^1.9.4",
53
+ "@soomo/text-annotator": "3.3.0-staging.0",
54
+ "@recogito/text-annotator-tei": "3.1.6",
55
+ "CETEIcean": "^1.9.5",
56
+ "debounce": "^2.2.0",
56
57
  "dequal": "^2.0.3",
57
58
  "unique-random": "^4.0.0"
58
59
  }