@annotorious/react 3.1.0 → 3.1.2

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 (51) hide show
  1. package/dist/annotorious-react.es10.js +5 -5
  2. package/dist/annotorious-react.es10.js.map +1 -1
  3. package/dist/annotorious-react.es11.js +8 -3
  4. package/dist/annotorious-react.es11.js.map +1 -1
  5. package/dist/annotorious-react.es12.js +266 -8
  6. package/dist/annotorious-react.es12.js.map +1 -1
  7. package/dist/annotorious-react.es13.js +7 -264
  8. package/dist/annotorious-react.es13.js.map +1 -1
  9. package/dist/annotorious-react.es14.js +195 -7
  10. package/dist/annotorious-react.es14.js.map +1 -1
  11. package/dist/annotorious-react.es15.js +379 -185
  12. package/dist/annotorious-react.es15.js.map +1 -1
  13. package/dist/annotorious-react.es16.js +13 -390
  14. package/dist/annotorious-react.es16.js.map +1 -1
  15. package/dist/annotorious-react.es17.js +128 -10
  16. package/dist/annotorious-react.es17.js.map +1 -1
  17. package/dist/annotorious-react.es18.js +6 -7
  18. package/dist/annotorious-react.es18.js.map +1 -1
  19. package/dist/annotorious-react.es19.js +2 -2
  20. package/dist/annotorious-react.es19.js.map +1 -1
  21. package/dist/annotorious-react.es2.js +19 -19
  22. package/dist/annotorious-react.es2.js.map +1 -1
  23. package/dist/annotorious-react.es20.js +9 -31
  24. package/dist/annotorious-react.es20.js.map +1 -1
  25. package/dist/annotorious-react.es21.js +125 -405
  26. package/dist/annotorious-react.es21.js.map +1 -1
  27. package/dist/annotorious-react.es22.js +456 -119
  28. package/dist/annotorious-react.es22.js.map +1 -1
  29. package/dist/annotorious-react.es4.js +33 -33
  30. package/dist/annotorious-react.es4.js.map +1 -1
  31. package/dist/annotorious-react.es5.js +22 -22
  32. package/dist/annotorious-react.es5.js.map +1 -1
  33. package/dist/annotorious-react.es8.js +14 -14
  34. package/dist/annotorious-react.es8.js.map +1 -1
  35. package/dist/annotorious-react.es9.js +43 -43
  36. package/dist/annotorious-react.es9.js.map +1 -1
  37. package/package.json +5 -5
  38. package/dist/annotorious-react.es23.js +0 -5
  39. package/dist/annotorious-react.es23.js.map +0 -1
  40. package/dist/annotorious-react.es24.js +0 -5
  41. package/dist/annotorious-react.es24.js.map +0 -1
  42. package/dist/annotorious-react.es25.js +0 -10
  43. package/dist/annotorious-react.es25.js.map +0 -1
  44. package/dist/annotorious-react.es26.js +0 -5
  45. package/dist/annotorious-react.es26.js.map +0 -1
  46. package/dist/annotorious-react.es27.js +0 -14
  47. package/dist/annotorious-react.es27.js.map +0 -1
  48. package/dist/annotorious-react.es28.js +0 -129
  49. package/dist/annotorious-react.es28.js.map +0 -1
  50. package/dist/annotorious-react.es29.js +0 -469
  51. package/dist/annotorious-react.es29.js.map +0 -1
@@ -1,269 +1,12 @@
1
- import * as s from "react";
2
- import { useLayoutEffect as k, useEffect as q } from "react";
3
- import { j as F } from "./annotorious-react.es11.js";
4
- import { getComputedStyle as Q, isElement as P } from "./annotorious-react.es22.js";
5
- import { getOverflowAncestors as xe } from "./annotorious-react.es22.js";
6
- import "react-dom";
7
- import { useFloating as Z } from "./annotorious-react.es15.js";
8
- import { arrow as ve, flip as we, inline as Ee, offset as Se, shift as Ie } from "./annotorious-react.es15.js";
9
- const $ = {
10
- ...s
11
- }, z = $.useInsertionEffect, G = z || ((t) => t());
12
- function J(t) {
13
- const n = s.useRef(() => {
14
- if (process.env.NODE_ENV !== "production")
15
- throw new Error("Cannot call an event handler while rendering.");
16
- });
17
- return G(() => {
18
- n.current = t;
19
- }), s.useCallback(function() {
20
- for (var c = arguments.length, e = new Array(c), o = 0; o < c; o++)
21
- e[o] = arguments[o];
22
- return n.current == null ? void 0 : n.current(...e);
23
- }, []);
24
- }
25
- var M = typeof document < "u" ? k : q;
26
- let y = !1, K = 0;
27
- const W = () => (
28
- // Ensure the id is unique with multiple independent versions of Floating UI
29
- // on <React 18
30
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + K++
31
- );
32
- function _() {
33
- const [t, n] = s.useState(() => y ? W() : void 0);
34
- return M(() => {
35
- t == null && n(W());
36
- }, []), s.useEffect(() => {
37
- y = !0;
38
- }, []), t;
39
- }
40
- const ee = $.useId, B = ee || _;
41
- let O;
42
- process.env.NODE_ENV !== "production" && (O = /* @__PURE__ */ new Set());
43
- function te() {
44
- for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++)
45
- c[e] = arguments[e];
46
- const o = "Floating UI: " + c.join(" ");
47
- if (!((t = O) != null && t.has(o))) {
48
- var i;
49
- (i = O) == null || i.add(o), console.warn(o);
1
+ const i = (e) => ({
2
+ length: 1,
3
+ item: (t) => t === 0 ? e : void 0,
4
+ [Symbol.iterator]: function* () {
5
+ for (let t = 0; t < this.length; t++)
6
+ yield this.item(t);
50
7
  }
51
- }
52
- function ne() {
53
- for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++)
54
- c[e] = arguments[e];
55
- const o = "Floating UI: " + c.join(" ");
56
- if (!((t = O) != null && t.has(o))) {
57
- var i;
58
- (i = O) == null || i.add(o), console.error(o);
59
- }
60
- }
61
- const ge = /* @__PURE__ */ s.forwardRef(function(n, c) {
62
- const {
63
- context: {
64
- placement: e,
65
- elements: {
66
- floating: o
67
- },
68
- middlewareData: {
69
- arrow: i,
70
- shift: a
71
- }
72
- },
73
- width: l = 14,
74
- height: u = 7,
75
- tipRadius: I = 0,
76
- strokeWidth: d = 0,
77
- staticOffset: g,
78
- stroke: h,
79
- d: r,
80
- style: {
81
- transform: p,
82
- ...R
83
- } = {},
84
- ...x
85
- } = n;
86
- process.env.NODE_ENV !== "production" && (c || te("The `ref` prop is required for `FloatingArrow`."));
87
- const C = B(), [E, f] = s.useState(!1);
88
- if (M(() => {
89
- if (!o) return;
90
- Q(o).direction === "rtl" && f(!0);
91
- }, [o]), !o)
92
- return null;
93
- const [m, b] = e.split("-"), j = m === "top" || m === "bottom";
94
- let S = g;
95
- (j && a != null && a.x || !j && a != null && a.y) && (S = null);
96
- const v = d * 2, D = v / 2, N = l / 2 * (I / -8 + 1), A = u / 2 * I / 4, w = !!r, U = S && b === "end" ? "bottom" : "top";
97
- let T = S && b === "end" ? "right" : "left";
98
- S && E && (T = b === "end" ? "left" : "right");
99
- const H = (i == null ? void 0 : i.x) != null ? S || i.x : "", X = (i == null ? void 0 : i.y) != null ? S || i.y : "", L = r || "M0,0" + (" H" + l) + (" L" + (l - N) + "," + (u - A)) + (" Q" + l / 2 + "," + u + " " + N + "," + (u - A)) + " Z", Y = {
100
- top: w ? "rotate(180deg)" : "",
101
- left: w ? "rotate(90deg)" : "rotate(-90deg)",
102
- bottom: w ? "" : "rotate(180deg)",
103
- right: w ? "rotate(-90deg)" : "rotate(90deg)"
104
- }[m];
105
- return /* @__PURE__ */ F.jsxs("svg", {
106
- ...x,
107
- "aria-hidden": !0,
108
- ref: c,
109
- width: w ? l : l + v,
110
- height: l,
111
- viewBox: "0 0 " + l + " " + (u > l ? u : l),
112
- style: {
113
- position: "absolute",
114
- pointerEvents: "none",
115
- [T]: H,
116
- [U]: X,
117
- [m]: j || w ? "100%" : "calc(100% - " + v / 2 + "px)",
118
- transform: [Y, p].filter((V) => !!V).join(" "),
119
- ...R
120
- },
121
- children: [v > 0 && /* @__PURE__ */ F.jsx("path", {
122
- clipPath: "url(#" + C + ")",
123
- fill: "none",
124
- stroke: h,
125
- strokeWidth: v + (r ? 0 : 1),
126
- d: L
127
- }), /* @__PURE__ */ F.jsx("path", {
128
- stroke: v && !r ? x.fill : "none",
129
- d: L
130
- }), /* @__PURE__ */ F.jsx("clipPath", {
131
- id: C,
132
- children: /* @__PURE__ */ F.jsx("rect", {
133
- x: -D,
134
- y: D * (w ? -1 : 1),
135
- width: l + v,
136
- height: l
137
- })
138
- })]
139
- });
140
8
  });
141
- function oe() {
142
- const t = /* @__PURE__ */ new Map();
143
- return {
144
- emit(n, c) {
145
- var e;
146
- (e = t.get(n)) == null || e.forEach((o) => o(c));
147
- },
148
- on(n, c) {
149
- t.set(n, [...t.get(n) || [], c]);
150
- },
151
- off(n, c) {
152
- var e;
153
- t.set(n, ((e = t.get(n)) == null ? void 0 : e.filter((o) => o !== c)) || []);
154
- }
155
- };
156
- }
157
- const re = /* @__PURE__ */ s.createContext(null), se = /* @__PURE__ */ s.createContext(null), ce = () => {
158
- var t;
159
- return ((t = s.useContext(re)) == null ? void 0 : t.id) || null;
160
- }, ie = () => s.useContext(se);
161
- function le(t) {
162
- const {
163
- open: n = !1,
164
- onOpenChange: c,
165
- elements: e
166
- } = t, o = B(), i = s.useRef({}), [a] = s.useState(() => oe()), l = ce() != null;
167
- if (process.env.NODE_ENV !== "production") {
168
- const r = e.reference;
169
- r && !P(r) && ne("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
170
- }
171
- const [u, I] = s.useState(e.reference), d = J((r, p, R) => {
172
- i.current.openEvent = r ? p : void 0, a.emit("openchange", {
173
- open: r,
174
- event: p,
175
- reason: R,
176
- nested: l
177
- }), c == null || c(r, p, R);
178
- }), g = s.useMemo(() => ({
179
- setPositionReference: I
180
- }), []), h = s.useMemo(() => ({
181
- reference: u || e.reference || null,
182
- floating: e.floating || null,
183
- domReference: e.reference
184
- }), [u, e.reference, e.floating]);
185
- return s.useMemo(() => ({
186
- dataRef: i,
187
- open: n,
188
- onOpenChange: d,
189
- elements: h,
190
- events: a,
191
- floatingId: o,
192
- refs: g
193
- }), [n, d, h, a, o, g]);
194
- }
195
- function pe(t) {
196
- t === void 0 && (t = {});
197
- const {
198
- nodeId: n
199
- } = t, c = le({
200
- ...t,
201
- elements: {
202
- reference: null,
203
- floating: null,
204
- ...t.elements
205
- }
206
- }), e = t.rootContext || c, o = e.elements, [i, a] = s.useState(null), [l, u] = s.useState(null), d = (o == null ? void 0 : o.domReference) || i, g = s.useRef(null), h = ie();
207
- M(() => {
208
- d && (g.current = d);
209
- }, [d]);
210
- const r = Z({
211
- ...t,
212
- elements: {
213
- ...o,
214
- ...l && {
215
- reference: l
216
- }
217
- }
218
- }), p = s.useCallback((f) => {
219
- const m = P(f) ? {
220
- getBoundingClientRect: () => f.getBoundingClientRect(),
221
- contextElement: f
222
- } : f;
223
- u(m), r.refs.setReference(m);
224
- }, [r.refs]), R = s.useCallback((f) => {
225
- (P(f) || f === null) && (g.current = f, a(f)), (P(r.refs.reference.current) || r.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
226
- // `null` to support `positionReference` + an unstable `reference`
227
- // callback ref.
228
- f !== null && !P(f)) && r.refs.setReference(f);
229
- }, [r.refs]), x = s.useMemo(() => ({
230
- ...r.refs,
231
- setReference: R,
232
- setPositionReference: p,
233
- domReference: g
234
- }), [r.refs, R, p]), C = s.useMemo(() => ({
235
- ...r.elements,
236
- domReference: d
237
- }), [r.elements, d]), E = s.useMemo(() => ({
238
- ...r,
239
- ...e,
240
- refs: x,
241
- elements: C,
242
- nodeId: n
243
- }), [r, x, C, n, e]);
244
- return M(() => {
245
- e.dataRef.current.floatingContext = E;
246
- const f = h == null ? void 0 : h.nodesRef.current.find((m) => m.id === n);
247
- f && (f.context = E);
248
- }), s.useMemo(() => ({
249
- ...r,
250
- context: E,
251
- refs: x,
252
- elements: C
253
- }), [r, x, C, E]);
254
- }
255
9
  export {
256
- ge as FloatingArrow,
257
- ve as arrow,
258
- we as flip,
259
- xe as getOverflowAncestors,
260
- Ee as inline,
261
- Se as offset,
262
- Ie as shift,
263
- pe as useFloating,
264
- ce as useFloatingParentNodeId,
265
- le as useFloatingRootContext,
266
- ie as useFloatingTree,
267
- B as useId
10
+ i as toClientRects
268
11
  };
269
12
  //# sourceMappingURL=annotorious-react.es13.js.map