@soomo/react-text-annotator 3.1.0-staging.23 → 3.1.0-staging.24

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.
Files changed (64) hide show
  1. package/dist/react-text-annotator.css +1 -31
  2. package/dist/react-text-annotator.es.js +245 -21
  3. package/dist/react-text-annotator.es.js.map +1 -1
  4. package/package.json +7 -6
  5. package/dist/react-text-annotator.es10.js +0 -490
  6. package/dist/react-text-annotator.es10.js.map +0 -1
  7. package/dist/react-text-annotator.es11.js +0 -85
  8. package/dist/react-text-annotator.es11.js.map +0 -1
  9. package/dist/react-text-annotator.es12.js +0 -48
  10. package/dist/react-text-annotator.es12.js.map +0 -1
  11. package/dist/react-text-annotator.es13.js +0 -28
  12. package/dist/react-text-annotator.es13.js.map +0 -1
  13. package/dist/react-text-annotator.es14.js +0 -1638
  14. package/dist/react-text-annotator.es14.js.map +0 -1
  15. package/dist/react-text-annotator.es15.js +0 -12
  16. package/dist/react-text-annotator.es15.js.map +0 -1
  17. package/dist/react-text-annotator.es17.js +0 -285
  18. package/dist/react-text-annotator.es17.js.map +0 -1
  19. package/dist/react-text-annotator.es18.js +0 -600
  20. package/dist/react-text-annotator.es18.js.map +0 -1
  21. package/dist/react-text-annotator.es19.js +0 -18
  22. package/dist/react-text-annotator.es19.js.map +0 -1
  23. package/dist/react-text-annotator.es2.js +0 -67
  24. package/dist/react-text-annotator.es2.js.map +0 -1
  25. package/dist/react-text-annotator.es20.js +0 -5
  26. package/dist/react-text-annotator.es20.js.map +0 -1
  27. package/dist/react-text-annotator.es21.js +0 -34
  28. package/dist/react-text-annotator.es21.js.map +0 -1
  29. package/dist/react-text-annotator.es22.js +0 -901
  30. package/dist/react-text-annotator.es22.js.map +0 -1
  31. package/dist/react-text-annotator.es23.js +0 -5
  32. package/dist/react-text-annotator.es23.js.map +0 -1
  33. package/dist/react-text-annotator.es24.js +0 -5
  34. package/dist/react-text-annotator.es24.js.map +0 -1
  35. package/dist/react-text-annotator.es25.js +0 -117
  36. package/dist/react-text-annotator.es25.js.map +0 -1
  37. package/dist/react-text-annotator.es26.js +0 -312
  38. package/dist/react-text-annotator.es26.js.map +0 -1
  39. package/dist/react-text-annotator.es27.js +0 -61
  40. package/dist/react-text-annotator.es27.js.map +0 -1
  41. package/dist/react-text-annotator.es28.js +0 -23
  42. package/dist/react-text-annotator.es28.js.map +0 -1
  43. package/dist/react-text-annotator.es29.js +0 -130
  44. package/dist/react-text-annotator.es29.js.map +0 -1
  45. package/dist/react-text-annotator.es3.js +0 -29
  46. package/dist/react-text-annotator.es3.js.map +0 -1
  47. package/dist/react-text-annotator.es30.js +0 -167
  48. package/dist/react-text-annotator.es30.js.map +0 -1
  49. package/dist/react-text-annotator.es31.js +0 -314
  50. package/dist/react-text-annotator.es31.js.map +0 -1
  51. package/dist/react-text-annotator.es32.js +0 -152
  52. package/dist/react-text-annotator.es32.js.map +0 -1
  53. package/dist/react-text-annotator.es33.js +0 -629
  54. package/dist/react-text-annotator.es33.js.map +0 -1
  55. package/dist/react-text-annotator.es4.js +0 -43
  56. package/dist/react-text-annotator.es4.js.map +0 -1
  57. package/dist/react-text-annotator.es5.js +0 -48
  58. package/dist/react-text-annotator.es5.js.map +0 -1
  59. package/dist/react-text-annotator.es6.js +0 -29
  60. package/dist/react-text-annotator.es6.js.map +0 -1
  61. package/dist/react-text-annotator.es7.js +0 -154
  62. package/dist/react-text-annotator.es7.js.map +0 -1
  63. package/dist/react-text-annotator.es8.js +0 -6
  64. package/dist/react-text-annotator.es8.js.map +0 -1
@@ -1,31 +1 @@
1
- .r6o-canvas-highlight-layer{position:fixed;top:0;bottom:0;left:0;width:100vw;height:100vh;pointer-events:none}.r6o-canvas-highlight-layer.bg{mix-blend-mode:multiply;z-index:1}.r6o-annotatable .r6o-span-highlight-layer{position:absolute;top:0;left:0;width:100%;height:100%;mix-blend-mode:multiply;pointer-events:none;z-index:1}.r6o-annotatable .r6o-span-highlight-layer.hidden{display:none}.r6o-annotatable .r6o-span-highlight-layer .r6o-annotation{position:absolute;display:block;border-style:solid;border-width:0;box-sizing:content-box}.r6o-presence-layer{left:0;position:fixed;top:0;bottom:0;width:100vw;pointer-events:none}html,body{overscroll-behavior-y:none}.r6o-annotatable{position:relative;-webkit-tap-highlight-color:transparent}.r6o-annotatable.no-focus-outline{outline:none}.hovered *{cursor:pointer}*::selection,::selection{background:#0080ff2e}::-moz-selection{background:#0080ff2e}
2
- /*
3
- * Close message should be visible only to the keyboard
4
- * or the screen reader users as the popup behavior hint
5
- * Inspired by https://gist.github.com/ffoodd/000b59f431e3e64e4ce1a24d5bb36034
6
- */
7
- .r6o-popup-sr-only {
8
- border: 0 !important;
9
- clip: rect(1px, 1px, 1px, 1px);
10
- -webkit-clip-path: inset(50%);
11
- clip-path: inset(50%);
12
- height: 1px;
13
- margin: -1px;
14
- overflow: hidden;
15
- padding: 0;
16
- position: absolute;
17
- width: 1px;
18
- white-space: nowrap;
19
- }
20
-
21
- .r6o-popup-sr-only:focus,
22
- .r6o-popup-sr-only:active {
23
- clip: auto;
24
- -webkit-clip-path: none;
25
- clip-path: none;
26
- height: auto;
27
- margin: auto;
28
- overflow: visible;
29
- width: auto;
30
- white-space: normal;
31
- }
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,24 +1,248 @@
1
- import { CETEIcean } from "./react-text-annotator.es2.js";
2
- import { TEIAnnotator } from "./react-text-annotator.es3.js";
3
- import { useAnnouncePopupNavigation } from "./react-text-annotator.es4.js";
4
- import { useAnnotationQuoteIdling } from "./react-text-annotator.es5.js";
5
- import { TextAnnotator } from "./react-text-annotator.es6.js";
6
- import { TextAnnotationPopup, TextAnnotatorPopup } from "./react-text-annotator.es7.js";
7
- import { Origin, UserSelectAction, createBody } from "@annotorious/core";
8
- import { AnnotoriousPlugin } from "@annotorious/react";
9
- import { W3CTextFormat } from "@soomo/text-annotator";
1
+ import { jsx as m, Fragment as $, jsxs as V } from "react/jsx-runtime";
2
+ import { useRef as T, useEffect as a, useContext as B, useCallback as w, Children as W, cloneElement as Y, useLayoutEffect as z, useMemo as I, useState as y } from "react";
3
+ import J from "CETEIcean";
4
+ import { AnnotoriousContext as N, useAnnotationStore as M, useSelection as U, Origin as D, useAnnotator as G } from "@annotorious/react";
5
+ import { AnnotoriousPlugin as _e } from "@annotorious/react";
6
+ import { TEIPlugin as K } from "@recogito/text-annotator-tei";
7
+ import { createTextAnnotator as k, toViewportBounds as O, toDomRectList as X, NOT_ANNOTATABLE_CLASS as Z } from "@soomo/text-annotator";
8
+ import { W3CTextFormat as He } from "@soomo/text-annotator";
9
+ import "@soomo/text-annotator/dist/text-annotator.css";
10
+ import { announce as F, destroyAnnouncer as ee } from "@react-aria/live-announcer";
11
+ import { exhaustiveUniqueRandom as te } from "unique-random";
12
+ import { dequal as ne } from "dequal/lite";
13
+ import { Ignore as oe } from "@annotorious/core";
14
+ import { Origin as $e, UserSelectAction as Ve, createBody as We } from "@annotorious/core";
15
+ import { useFloating as re, autoUpdate as se, inline as ie, offset as ue, flip as ce, shift as ae, arrow as le, useDismiss as de, useRole as ge, useInteractions as fe, FloatingPortal as me, FloatingFocusManager as pe, FloatingArrow as he } from "@floating-ui/react";
16
+ const L = {
17
+ tei: {
18
+ ref: (e) => {
19
+ const r = document.createElement("a");
20
+ for (; e.firstChild; )
21
+ r.appendChild(e.removeChild(e.firstChild));
22
+ r.setAttribute("href", e.getAttribute("target")), e.appendChild(r);
23
+ },
24
+ // Cf. https://github.com/TEIC/CETEIcean/issues/67
25
+ graphic: (e) => {
26
+ var u;
27
+ const r = new Image();
28
+ r.src = (u = e.getAttribute("url")) == null ? void 0 : u.trim(), e.hasAttribute("width") && r.setAttribute("width", e.getAttribute("width")), e.hasAttribute("height") && r.setAttribute("height", e.getAttribute("height")), e.appendChild(r);
29
+ },
30
+ list: null,
31
+ note: null,
32
+ table: null,
33
+ teiHeader: (e) => {
34
+ e.hidden = !0;
35
+ }
36
+ }
37
+ }, Ne = (e) => {
38
+ const r = T(null);
39
+ return a(() => {
40
+ var u;
41
+ if (e.tei) {
42
+ const n = new J(e.initArgs);
43
+ n.addBehaviors({
44
+ ...L,
45
+ ...e.behaviors || {},
46
+ tei: {
47
+ ...L.tei,
48
+ ...((u = e.behaviors) == null ? void 0 : u.tei) || {}
49
+ }
50
+ }), n.makeHTML5(e.tei, (s) => {
51
+ r.current.appendChild(s), e.onLoad(r.current);
52
+ });
53
+ }
54
+ return () => {
55
+ r.current.innerHTML = "";
56
+ };
57
+ }, [e.tei, JSON.stringify(e.initArgs), e.onLoad]), /* @__PURE__ */ m(
58
+ "div",
59
+ {
60
+ ref: r,
61
+ className: "tei-container"
62
+ }
63
+ );
64
+ }, Me = (e) => {
65
+ const { children: r, ...u } = e, { anno: n, setAnno: s } = B(N), i = w((t) => {
66
+ const d = K(k(t, u));
67
+ s(d);
68
+ }, []);
69
+ return a(() => {
70
+ n && n.setStyle(e.style);
71
+ }, [e.style]), a(() => {
72
+ n && n.setFilter(e.filter);
73
+ }, [e.filter]), e.children ? /* @__PURE__ */ m($, { children: W.toArray(e.children).map((t) => Y(t, { onLoad: i })) }) : null;
74
+ }, Ae = (e) => {
75
+ const {
76
+ message: r = "Press Tab to move to Notes Dialog",
77
+ idle: u = 700,
78
+ floatingOpen: n,
79
+ disabled: s = !1
80
+ } = e, i = M(), { event: t } = U(), d = w(te(1, 1e4), []);
81
+ z(() => {
82
+ if (!(s || !r))
83
+ return F("", "polite"), () => ee();
84
+ }, [s, r]);
85
+ const c = I(() => n ? d() : 0, [n]), g = w(() => {
86
+ const l = Array.from({ length: c }).map(() => " ").join("");
87
+ F(`${r} ${l}`, "polite");
88
+ }, [r, c]), o = T(null);
89
+ a(() => {
90
+ if (s || !n || !r) return;
91
+ const l = () => {
92
+ clearTimeout(o.current), o.current = setTimeout(g, u);
93
+ };
94
+ return l(), i.observe(l, { origin: D.LOCAL }), () => {
95
+ clearTimeout(o.current), i.unobserve(l);
96
+ };
97
+ }, [s, n, t == null ? void 0 : t.type, r, g, i]);
98
+ }, be = (e, r = { timeout: 500 }) => {
99
+ const u = M(), [n, s] = y(!0);
100
+ return a(() => {
101
+ if (!u || !e) return;
102
+ let i;
103
+ const t = (d) => {
104
+ const { changes: { updated: c } } = d;
105
+ (c == null ? void 0 : c.some((o) => {
106
+ const { targetUpdated: l } = o;
107
+ if (l) {
108
+ const { oldTarget: h, newTarget: A } = l;
109
+ return we(h, A);
110
+ }
111
+ })) && (s(!1), clearTimeout(i), i = setTimeout(() => s(!0), r.timeout));
112
+ };
113
+ return u.observe(t, {
114
+ annotations: e,
115
+ ignore: oe.BODY_ONLY,
116
+ origin: D.LOCAL
117
+ }), () => {
118
+ clearTimeout(i), u.unobserve(t);
119
+ };
120
+ }, [u, e, r.timeout]), n;
121
+ }, we = (e, r) => {
122
+ const { selector: u } = e, n = u.map(({ quote: t }) => t), { selector: s } = r, i = s.map(({ quote: t }) => t);
123
+ return !ne(n, i);
124
+ }, Ue = (e) => {
125
+ const r = T(null), { className: u, children: n, ...s } = e, { style: i, filter: t, user: d, annotatingEnabled: c, userSelectAction: g } = s, { anno: o, setAnno: l } = B(N);
126
+ return a(() => {
127
+ if (!l) return;
128
+ const h = typeof s.adapter == "function" ? s.adapter(r.current) : s.adapter, A = k(r.current, { ...s, adapter: h });
129
+ return l(A), () => A.destroy();
130
+ }, [l]), a(() => o == null ? void 0 : o.setStyle(i), [o, i]), a(() => o == null ? void 0 : o.setFilter(t), [o, t]), a(() => o == null ? void 0 : o.setFilter(t), [o, t]), a(() => o == null ? void 0 : o.setUserSelectAction(g), [o, g]), a(() => o == null ? void 0 : o.setUser(d), [o, d]), a(() => o == null ? void 0 : o.setAnnotatingEnabled(c), [o, c]), /* @__PURE__ */ m("div", { ref: r, className: u, children: n });
131
+ }, R = () => {
132
+ var e = navigator.userAgent || navigator.vendor || window.opera;
133
+ return !!(/android/i.test(e) || /iPad|iPhone/.test(e) && !window.MSStream);
134
+ }, ve = (e) => {
135
+ var E;
136
+ const { popup: r, ariaNavigationMessage: u } = e, n = G(), { selected: s, event: i } = U(), t = (E = s[0]) == null ? void 0 : E.annotation, d = be(t == null ? void 0 : t.id), [c, g] = y((s == null ? void 0 : s.length) > 0), o = () => n == null ? void 0 : n.cancelSelected(), [l, h] = y(!1), A = w(() => h(!0), []), P = w(() => h(!1), []);
137
+ a(() => {
138
+ c || P();
139
+ }, [c, P]);
140
+ const x = T(null), { refs: S, floatingStyles: Q, update: v, context: C } = re({
141
+ placement: R() ? "bottom" : "top",
142
+ open: c,
143
+ onOpenChange: (f, p, b) => {
144
+ !f && (b === "escape-key" || b === "focus-out") && (g(f), o());
145
+ },
146
+ middleware: [
147
+ ie(),
148
+ ue(10),
149
+ ce({ crossAxis: !0 }),
150
+ ae({ crossAxis: !0, padding: 10 }),
151
+ le({ element: x })
152
+ ],
153
+ whileElementsMounted: se
154
+ }), _ = de(C), q = ge(C, { role: "dialog" }), { getFloatingProps: H } = fe([_, q]);
155
+ a(() => {
156
+ if (!n) return;
157
+ const f = t == null ? void 0 : t.id, p = t == null ? void 0 : t.target.selector.length;
158
+ if (f && p > 0 && d) {
159
+ const b = n.state.store.getAnnotationBounds(t.id);
160
+ g(!!b);
161
+ } else
162
+ g(!1);
163
+ }, [t == null ? void 0 : t.id, t == null ? void 0 : t.target.selector, d, n == null ? void 0 : n.state.store]), a(() => {
164
+ n && (c && (t != null && t.id) ? S.setPositionReference({
165
+ getBoundingClientRect: () => {
166
+ const f = n.state.store.getAnnotationBounds(t.id);
167
+ return f ? O(f, n.element.getBoundingClientRect()) : new DOMRect();
168
+ },
169
+ getClientRects: () => {
170
+ const p = n.state.store.getAnnotationRects(t.id).map(
171
+ (b) => O(b, n.element.getBoundingClientRect())
172
+ );
173
+ return X(p);
174
+ }
175
+ }) : S.setPositionReference(null));
176
+ }, [c, t == null ? void 0 : t.id, t == null ? void 0 : t.target, n]), a(() => {
177
+ const f = { attributes: !0, childList: !0, subtree: !0 }, p = new MutationObserver(() => v());
178
+ return p.observe(document.body, f), window.document.addEventListener("scroll", v, !0), () => {
179
+ p.disconnect(), window.document.removeEventListener("scroll", v, !0);
180
+ };
181
+ }, [v]);
182
+ const j = I(() => (i == null ? void 0 : i.type) === "keyup" || (i == null ? void 0 : i.type) === "contextmenu" || R() ? -1 : 0, [i]);
183
+ return Ae({
184
+ disabled: l,
185
+ floatingOpen: c,
186
+ message: u
187
+ }), c && t ? /* @__PURE__ */ m(me, { children: /* @__PURE__ */ m(
188
+ pe,
189
+ {
190
+ context: C,
191
+ modal: !1,
192
+ closeOnFocusOut: !0,
193
+ returnFocus: !1,
194
+ initialFocus: j,
195
+ children: /* @__PURE__ */ V(
196
+ "div",
197
+ {
198
+ className: `a9s-popup r6o-popup annotation-popup r6o-text-popup ${Z}`,
199
+ ref: S.setFloating,
200
+ style: Q,
201
+ ...H({
202
+ onFocus: A,
203
+ onBlur: P,
204
+ ...Ce()
205
+ }),
206
+ children: [
207
+ r({
208
+ annotation: s[0].annotation,
209
+ editable: s[0].editable,
210
+ event: i
211
+ }),
212
+ e.arrow && /* @__PURE__ */ m(
213
+ he,
214
+ {
215
+ ref: x,
216
+ context: C,
217
+ ...e.arrowProps || {}
218
+ }
219
+ ),
220
+ /* @__PURE__ */ m("button", { className: "r6o-popup-sr-only", "aria-live": "assertive", onClick: o, children: e.ariaCloseWarning || "Click or leave this dialog to close it." })
221
+ ]
222
+ }
223
+ )
224
+ }
225
+ ) }) : null;
226
+ }, Ce = () => ({
227
+ onPointerUp: (e) => e.stopPropagation(),
228
+ onPointerDown: (e) => e.stopPropagation(),
229
+ onMouseDown: (e) => e.stopPropagation(),
230
+ onMouseUp: (e) => e.stopPropagation()
231
+ }), De = (e) => (a(() => {
232
+ console.warn("TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.");
233
+ }, []), /* @__PURE__ */ m(ve, { ...e }));
10
234
  export {
11
- AnnotoriousPlugin,
12
- CETEIcean,
13
- Origin,
14
- TEIAnnotator,
15
- TextAnnotationPopup,
16
- TextAnnotator,
17
- TextAnnotatorPopup,
18
- UserSelectAction,
19
- W3CTextFormat,
20
- createBody,
21
- useAnnotationQuoteIdling,
22
- useAnnouncePopupNavigation
235
+ _e as AnnotoriousPlugin,
236
+ Ne as CETEIcean,
237
+ $e as Origin,
238
+ Me as TEIAnnotator,
239
+ ve as TextAnnotationPopup,
240
+ Ue as TextAnnotator,
241
+ De as TextAnnotatorPopup,
242
+ Ve as UserSelectAction,
243
+ He as W3CTextFormat,
244
+ We as createBody,
245
+ be as useAnnotationQuoteIdling,
246
+ Ae as useAnnouncePopupNavigation
23
247
  };
24
248
  //# sourceMappingURL=react-text-annotator.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"react-text-annotator.es.js","sources":["../src/tei/CETEIcean.tsx","../src/tei/TEIAnnotator.tsx","../src/hooks/useAnnouncePopupNavigation.ts","../src/hooks/useAnnotationQuoteIdling.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 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, 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 }))}\n </>\n ) : null;\n\n}\n","import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';\n\nimport { Origin, useAnnotationStore, useSelection } from '@annotorious/react';\nimport type { TextAnnotation } from '@soomo/text-annotator';\nimport { announce, destroyAnnouncer } from '@react-aria/live-announcer';\nimport { exhaustiveUniqueRandom } from 'unique-random';\n\ninterface AnnouncePopupOpeningArgs {\n message?: string;\n idle?: number;\n floatingOpen: boolean;\n floatingFocused?: boolean;\n disabled?: boolean;\n}\n\nexport const useAnnouncePopupNavigation = (args: AnnouncePopupOpeningArgs) => {\n const {\n message = 'Press Tab to move to Notes Dialog',\n idle = 700,\n floatingOpen,\n disabled = false\n } = args;\n\n const store = useAnnotationStore();\n const { event } = useSelection<TextAnnotation>();\n\n // Generate random numbers that do not repeat until the entire 1-10000 range has appeared\n const uniqueRandom = useCallback(exhaustiveUniqueRandom(1, 10000), []);\n\n /**\n * Initialize the `LiveAnnouncer` class and\n * its `polite` announcements live area\n */\n useLayoutEffect(() => {\n if (disabled || !message) return;\n\n announce('', 'polite');\n return () => destroyAnnouncer();\n }, [disabled, message]);\n\n /**\n * Screen reader requires messages to always be unique!\n * Otherwise, the hint will be announced once per page.\n */\n const announcementSeed = useMemo(() => floatingOpen ? uniqueRandom() : 0, [floatingOpen]);\n\n const announcePopupNavigation = useCallback(() => {\n /**\n * To imitate the uniqueness of the announced message\n * w/o mutating it - we can append spaces at the end.\n */\n const uniqueSpaces = Array.from({ length: announcementSeed }).map(() => ' ').join('');\n announce(`${message} ${uniqueSpaces}`, 'polite');\n }, [message, announcementSeed]);\n\n const idleTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (disabled || !floatingOpen || !message) return;\n\n const scheduleIdleAnnouncement = () => {\n clearTimeout(idleTimeoutRef.current);\n idleTimeoutRef.current = setTimeout(announcePopupNavigation, idle);\n };\n\n scheduleIdleAnnouncement();\n store.observe(scheduleIdleAnnouncement, { origin: Origin.LOCAL });\n\n return () => {\n clearTimeout(idleTimeoutRef.current);\n store.unobserve(scheduleIdleAnnouncement);\n };\n }, [disabled, floatingOpen, event?.type, message, announcePopupNavigation, store]);\n\n};\n","import { useEffect, useState } from 'react';\nimport { dequal } from 'dequal/lite';\n\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 useAnnotationQuoteIdling = (\n annotationId: string | undefined,\n options: { timeout: number } = { timeout: 500 }\n) => {\n const store = useAnnotationStore<TextAnnotationStore>();\n\n const [isIdling, setIdling] = useState(true);\n\n useEffect(() => {\n if (!store || !annotationId) return;\n\n let idlingTimeout: ReturnType<typeof setTimeout>;\n\n const scheduleSetIdling = (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 hasTargetQuoteChanged(oldTarget, newTarget);\n }\n });\n\n if (hasChanged) {\n setIdling(false);\n\n clearTimeout(idlingTimeout);\n idlingTimeout = setTimeout(() => setIdling(true), options.timeout);\n }\n };\n\n store.observe(scheduleSetIdling, {\n annotations: annotationId,\n ignore: Ignore.BODY_ONLY,\n origin: Origin.LOCAL\n });\n\n return () => {\n clearTimeout(idlingTimeout);\n store.unobserve(scheduleSetIdling);\n };\n }, [store, annotationId, options.timeout]);\n\n return isIdling;\n};\n\nconst hasTargetQuoteChanged = (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 !dequal(oldQuotes, newQuotes);\n};\n","import { 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={className}>\n {children}\n </div>\n );\n\n};\n","// https://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system\nexport const isMobile = () => {\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, useRef, useEffect, useMemo, useState } from 'react';\nimport { useAnnotator, useSelection } from '@annotorious/react';\nimport {\n NOT_ANNOTATABLE_CLASS,\n toViewportBounds,\n toDomRectList,\n type TextAnnotation,\n type TextAnnotator,\n} from '@soomo/text-annotator';\n\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';\n\nimport { isMobile } from './isMobile';\nimport { useAnnouncePopupNavigation, useAnnotationQuoteIdling } 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 isAnnotationQuoteIdling = useAnnotationQuoteIdling(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 && isAnnotationQuoteIdling) {\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, isAnnotationQuoteIdling, 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 {...getFloatingProps({\n onFocus: handleFocus,\n onBlur: handleBlur,\n ...getStopEventsPropagationProps()\n })}>\n {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/** 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","useAnnouncePopupNavigation","args","message","idle","floatingOpen","disabled","store","useAnnotationStore","event","useSelection","uniqueRandom","exhaustiveUniqueRandom","useLayoutEffect","announce","destroyAnnouncer","announcementSeed","useMemo","announcePopupNavigation","uniqueSpaces","idleTimeoutRef","scheduleIdleAnnouncement","Origin","useAnnotationQuoteIdling","annotationId","options","isIdling","setIdling","useState","idlingTimeout","scheduleSetIdling","updated","update","targetUpdated","oldTarget","newTarget","hasTargetQuoteChanged","Ignore","oldValue","newValue","oldSelector","oldQuotes","quote","newSelector","newQuotes","dequal","TextAnnotator","className","style","filter","user","annotatingEnabled","userSelectAction","adapter","isMobile","userAgent","TextAnnotationPopup","popup","ariaNavigationMessage","r","useAnnotator","selected","annotation","isAnnotationQuoteIdling","isOpen","setOpen","handleClose","isFocused","setFocused","handleFocus","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","FloatingPortal","FloatingFocusManager","jsxs","NOT_ANNOTATABLE_CLASS","getStopEventsPropagationProps","FloatingArrow","TextAnnotatorPopup"],"mappings":";;;;;;;;;;;;;;;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AA;AAAA,MAAA;AAAA,IACF;AAAA,KAEJ,IACE;AAEN,GAMM+H,KAAgC,OAA4C;AAAA,EAChF,aAAa,CAAC/F,MAAiCA,EAAM,gBAAgB;AAAA,EACrE,eAAe,CAACA,MAAiCA,EAAM,gBAAgB;AAAA,EACvE,aAAa,CAACA,MAA+BA,EAAM,gBAAgB;AAAA,EACnE,WAAW,CAACA,MAA+BA,EAAM,gBAAgB;AACnE,IAIaiG,KAAqB,CAACjI,OAEjCG,EAAU,MAAM;AACd,UAAQ,KAAK,mHAAmH;AAClI,GAAG,EAAE,GAEE,gBAAAI,EAACwE,IAAqB,EAAA,GAAG/E,EAAO,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soomo/react-text-annotator",
3
- "version": "3.1.0-staging.23",
3
+ "version": "3.1.0-staging.24",
4
4
  "description": "Recogito Text Annotator React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -28,9 +28,10 @@
28
28
  "@vitejs/plugin-react": "^4.3.4",
29
29
  "react": "^18.3.1",
30
30
  "react-dom": "^18.3.1",
31
- "typescript": "5.7.2",
32
- "vite": "^6.0.3",
33
- "vite-plugin-dts": "^4.3.0",
31
+ "typescript": "^5.7.3",
32
+ "vite": "^6.1.1",
33
+ "vite-plugin-dts": "^4.5.0",
34
+ "vite-plugin-externalize-deps": "^0.9.0",
34
35
  "vite-tsconfig-paths": "^5.1.4"
35
36
  },
36
37
  "peerDependencies": {
@@ -46,9 +47,9 @@
46
47
  "dependencies": {
47
48
  "@annotorious/core": "^3.0.14",
48
49
  "@annotorious/react": "^3.0.14",
49
- "@floating-ui/react": "^0.27.1",
50
+ "@floating-ui/react": "^0.27.4",
50
51
  "@react-aria/live-announcer": "^3.3.4",
51
- "@soomo/text-annotator": "3.1.0-staging.23",
52
+ "@soomo/text-annotator": "3.1.0-staging.24",
52
53
  "@recogito/text-annotator-tei": "3.0.0-rc.53",
53
54
  "CETEIcean": "^1.9.3",
54
55
  "dequal": "^2.0.3",