@annotorious/svelte 3.0.7 → 3.0.8
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.
- package/dist/annotorious-svelte.css +1 -1
- package/dist/annotorious-svelte.es.js +763 -16
- package/dist/annotorious-svelte.es.js.map +1 -1
- package/package.json +4 -4
- package/src/MouseOverTooltip.svelte +8 -2
- package/src/osd/OpenSeadragonAnnotator.svelte +3 -3
- package/src/osd/OpenSeadragonPopup.svelte +1 -1
- package/svelte.config.js +7 -0
- package/test/App.svelte +3 -3
- package/vite.config.js +1 -3
- package/dist/annotorious-svelte.es10.js +0 -3
- package/dist/annotorious-svelte.es10.js.map +0 -1
- package/dist/annotorious-svelte.es11.js +0 -5
- package/dist/annotorious-svelte.es11.js.map +0 -1
- package/dist/annotorious-svelte.es12.js +0 -106
- package/dist/annotorious-svelte.es12.js.map +0 -1
- package/dist/annotorious-svelte.es14.js +0 -58
- package/dist/annotorious-svelte.es14.js.map +0 -1
- package/dist/annotorious-svelte.es2.js +0 -133
- package/dist/annotorious-svelte.es2.js.map +0 -1
- package/dist/annotorious-svelte.es3.js +0 -117
- package/dist/annotorious-svelte.es3.js.map +0 -1
- package/dist/annotorious-svelte.es4.js +0 -130
- package/dist/annotorious-svelte.es4.js.map +0 -1
- package/dist/annotorious-svelte.es5.js +0 -99
- package/dist/annotorious-svelte.es5.js.map +0 -1
- package/dist/annotorious-svelte.es6.js +0 -44
- package/dist/annotorious-svelte.es6.js.map +0 -1
- package/dist/annotorious-svelte.es7.js +0 -32
- package/dist/annotorious-svelte.es7.js.map +0 -1
- package/dist/annotorious-svelte.es8.js +0 -26
- package/dist/annotorious-svelte.es8.js.map +0 -1
- package/dist/annotorious-svelte.es9.js +0 -114
- package/dist/annotorious-svelte.es9.js.map +0 -1
|
@@ -1,19 +1,766 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var st = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var pe = (e, t, n) => st(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { toSvelteStore as lt } from "@annotorious/core";
|
|
5
|
+
import { Origin as Ut, UserSelectAction as qt, createAnonymousGuest as zt, createBody as Vt, defaultColorProvider as Wt } from "@annotorious/core";
|
|
6
|
+
import { ShapeType as Ft, W3CImageFormat as Gt, createImageAnnotator as Jt } from "@annotorious/annotorious";
|
|
7
|
+
import { createOSDAnnotator as ut } from "@annotorious/openseadragon";
|
|
8
|
+
import Pe from "openseadragon";
|
|
9
|
+
function B() {
|
|
10
|
+
}
|
|
11
|
+
function at(e, t) {
|
|
12
|
+
for (const n in t) e[n] = t[n];
|
|
13
|
+
return (
|
|
14
|
+
/** @type {T & S} */
|
|
15
|
+
e
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function Ve(e) {
|
|
19
|
+
return e();
|
|
20
|
+
}
|
|
21
|
+
function Oe() {
|
|
22
|
+
return /* @__PURE__ */ Object.create(null);
|
|
23
|
+
}
|
|
24
|
+
function I(e) {
|
|
25
|
+
e.forEach(Ve);
|
|
26
|
+
}
|
|
27
|
+
function te(e) {
|
|
28
|
+
return typeof e == "function";
|
|
29
|
+
}
|
|
30
|
+
function we(e, t) {
|
|
31
|
+
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
|
|
32
|
+
}
|
|
33
|
+
function ct(e) {
|
|
34
|
+
return Object.keys(e).length === 0;
|
|
35
|
+
}
|
|
36
|
+
function ft(e, ...t) {
|
|
37
|
+
if (e == null) {
|
|
38
|
+
for (const o of t)
|
|
39
|
+
o(void 0);
|
|
40
|
+
return B;
|
|
41
|
+
}
|
|
42
|
+
const n = e.subscribe(...t);
|
|
43
|
+
return n.unsubscribe ? () => n.unsubscribe() : n;
|
|
44
|
+
}
|
|
45
|
+
function We(e, t, n) {
|
|
46
|
+
e.$$.on_destroy.push(ft(t, n));
|
|
47
|
+
}
|
|
48
|
+
function $e(e, t, n, o) {
|
|
49
|
+
if (e) {
|
|
50
|
+
const r = Fe(e, t, n, o);
|
|
51
|
+
return e[0](r);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function Fe(e, t, n, o) {
|
|
55
|
+
return e[1] && o ? at(n.ctx.slice(), e[1](o(t))) : n.ctx;
|
|
56
|
+
}
|
|
57
|
+
function Ge(e, t, n, o) {
|
|
58
|
+
if (e[2] && o) {
|
|
59
|
+
const r = e[2](o(n));
|
|
60
|
+
if (t.dirty === void 0)
|
|
61
|
+
return r;
|
|
62
|
+
if (typeof r == "object") {
|
|
63
|
+
const i = [], s = Math.max(t.dirty.length, r.length);
|
|
64
|
+
for (let u = 0; u < s; u += 1)
|
|
65
|
+
i[u] = t.dirty[u] | r[u];
|
|
66
|
+
return i;
|
|
67
|
+
}
|
|
68
|
+
return t.dirty | r;
|
|
69
|
+
}
|
|
70
|
+
return t.dirty;
|
|
71
|
+
}
|
|
72
|
+
function Je(e, t, n, o, r, i) {
|
|
73
|
+
if (r) {
|
|
74
|
+
const s = Fe(t, n, o, i);
|
|
75
|
+
e.p(s, r);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function Ke(e) {
|
|
79
|
+
if (e.ctx.length > 32) {
|
|
80
|
+
const t = [], n = e.ctx.length / 32;
|
|
81
|
+
for (let o = 0; o < n; o++)
|
|
82
|
+
t[o] = -1;
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
return -1;
|
|
86
|
+
}
|
|
87
|
+
function dt(e) {
|
|
88
|
+
return e && te(e.destroy) ? e.destroy : B;
|
|
89
|
+
}
|
|
90
|
+
function pt(e, t) {
|
|
91
|
+
e.appendChild(t);
|
|
92
|
+
}
|
|
93
|
+
function F(e, t, n) {
|
|
94
|
+
e.insertBefore(t, n || null);
|
|
95
|
+
}
|
|
96
|
+
function U(e) {
|
|
97
|
+
e.parentNode && e.parentNode.removeChild(e);
|
|
98
|
+
}
|
|
99
|
+
function Qe(e) {
|
|
100
|
+
return document.createElement(e);
|
|
101
|
+
}
|
|
102
|
+
function Ze(e) {
|
|
103
|
+
return document.createTextNode(e);
|
|
104
|
+
}
|
|
105
|
+
function Ee() {
|
|
106
|
+
return Ze("");
|
|
107
|
+
}
|
|
108
|
+
function je(e, t, n, o) {
|
|
109
|
+
return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
|
|
110
|
+
}
|
|
111
|
+
function Z(e, t, n) {
|
|
112
|
+
n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
113
|
+
}
|
|
114
|
+
function gt(e) {
|
|
115
|
+
return Array.from(e.childNodes);
|
|
116
|
+
}
|
|
117
|
+
function ht(e, t) {
|
|
118
|
+
t = "" + t, e.data !== t && (e.data = /** @type {string} */
|
|
119
|
+
t);
|
|
120
|
+
}
|
|
121
|
+
let $;
|
|
122
|
+
function W(e) {
|
|
123
|
+
$ = e;
|
|
124
|
+
}
|
|
125
|
+
function xe() {
|
|
126
|
+
if (!$) throw new Error("Function called outside component initialization");
|
|
127
|
+
return $;
|
|
128
|
+
}
|
|
129
|
+
function et(e) {
|
|
130
|
+
xe().$$.on_mount.push(e);
|
|
131
|
+
}
|
|
132
|
+
function Be(e, t) {
|
|
133
|
+
return xe().$$.context.set(e, t), t;
|
|
134
|
+
}
|
|
135
|
+
function mt(e) {
|
|
136
|
+
return xe().$$.context.get(e);
|
|
137
|
+
}
|
|
138
|
+
const X = [], Te = [];
|
|
139
|
+
let Y = [];
|
|
140
|
+
const Re = [], _t = /* @__PURE__ */ Promise.resolve();
|
|
141
|
+
let ye = !1;
|
|
142
|
+
function yt() {
|
|
143
|
+
ye || (ye = !0, _t.then(tt));
|
|
144
|
+
}
|
|
145
|
+
function be(e) {
|
|
146
|
+
Y.push(e);
|
|
147
|
+
}
|
|
148
|
+
const ge = /* @__PURE__ */ new Set();
|
|
149
|
+
let R = 0;
|
|
150
|
+
function tt() {
|
|
151
|
+
if (R !== 0)
|
|
152
|
+
return;
|
|
153
|
+
const e = $;
|
|
154
|
+
do {
|
|
155
|
+
try {
|
|
156
|
+
for (; R < X.length; ) {
|
|
157
|
+
const t = X[R];
|
|
158
|
+
R++, W(t), bt(t.$$);
|
|
159
|
+
}
|
|
160
|
+
} catch (t) {
|
|
161
|
+
throw X.length = 0, R = 0, t;
|
|
162
|
+
}
|
|
163
|
+
for (W(null), X.length = 0, R = 0; Te.length; ) Te.pop()();
|
|
164
|
+
for (let t = 0; t < Y.length; t += 1) {
|
|
165
|
+
const n = Y[t];
|
|
166
|
+
ge.has(n) || (ge.add(n), n());
|
|
167
|
+
}
|
|
168
|
+
Y.length = 0;
|
|
169
|
+
} while (X.length);
|
|
170
|
+
for (; Re.length; )
|
|
171
|
+
Re.pop()();
|
|
172
|
+
ye = !1, ge.clear(), W(e);
|
|
173
|
+
}
|
|
174
|
+
function bt(e) {
|
|
175
|
+
if (e.fragment !== null) {
|
|
176
|
+
e.update(), I(e.before_update);
|
|
177
|
+
const t = e.dirty;
|
|
178
|
+
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(be);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function vt(e) {
|
|
182
|
+
const t = [], n = [];
|
|
183
|
+
Y.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Y = t;
|
|
184
|
+
}
|
|
185
|
+
const ee = /* @__PURE__ */ new Set();
|
|
186
|
+
let j;
|
|
187
|
+
function nt() {
|
|
188
|
+
j = {
|
|
189
|
+
r: 0,
|
|
190
|
+
c: [],
|
|
191
|
+
p: j
|
|
192
|
+
// parent group
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function ot() {
|
|
196
|
+
j.r || I(j.c), j = j.p;
|
|
197
|
+
}
|
|
198
|
+
function L(e, t) {
|
|
199
|
+
e && e.i && (ee.delete(e), e.i(t));
|
|
200
|
+
}
|
|
201
|
+
function H(e, t, n, o) {
|
|
202
|
+
if (e && e.o) {
|
|
203
|
+
if (ee.has(e)) return;
|
|
204
|
+
ee.add(e), j.c.push(() => {
|
|
205
|
+
ee.delete(e), o && (n && e.d(1), o());
|
|
206
|
+
}), e.o(t);
|
|
207
|
+
} else o && o();
|
|
208
|
+
}
|
|
209
|
+
function wt(e, t, n) {
|
|
210
|
+
const { fragment: o, after_update: r } = e.$$;
|
|
211
|
+
o && o.m(t, n), be(() => {
|
|
212
|
+
const i = e.$$.on_mount.map(Ve).filter(te);
|
|
213
|
+
e.$$.on_destroy ? e.$$.on_destroy.push(...i) : I(i), e.$$.on_mount = [];
|
|
214
|
+
}), r.forEach(be);
|
|
215
|
+
}
|
|
216
|
+
function Et(e, t) {
|
|
217
|
+
const n = e.$$;
|
|
218
|
+
n.fragment !== null && (vt(n.after_update), I(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
219
|
+
}
|
|
220
|
+
function xt(e, t) {
|
|
221
|
+
e.$$.dirty[0] === -1 && (X.push(e), yt(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
222
|
+
}
|
|
223
|
+
function Se(e, t, n, o, r, i, s = null, u = [-1]) {
|
|
224
|
+
const d = $;
|
|
225
|
+
W(e);
|
|
226
|
+
const a = e.$$ = {
|
|
227
|
+
fragment: null,
|
|
228
|
+
ctx: [],
|
|
229
|
+
// state
|
|
230
|
+
props: i,
|
|
231
|
+
update: B,
|
|
232
|
+
not_equal: r,
|
|
233
|
+
bound: Oe(),
|
|
234
|
+
// lifecycle
|
|
235
|
+
on_mount: [],
|
|
236
|
+
on_destroy: [],
|
|
237
|
+
on_disconnect: [],
|
|
238
|
+
before_update: [],
|
|
239
|
+
after_update: [],
|
|
240
|
+
context: new Map(t.context || (d ? d.$$.context : [])),
|
|
241
|
+
// everything else
|
|
242
|
+
callbacks: Oe(),
|
|
243
|
+
dirty: u,
|
|
244
|
+
skip_bound: !1,
|
|
245
|
+
root: t.target || d.$$.root
|
|
246
|
+
};
|
|
247
|
+
s && s(a.root);
|
|
248
|
+
let y = !1;
|
|
249
|
+
if (a.ctx = n ? n(e, t.props || {}, (g, m, ...v) => {
|
|
250
|
+
const c = v.length ? v[0] : m;
|
|
251
|
+
return a.ctx && r(a.ctx[g], a.ctx[g] = c) && (!a.skip_bound && a.bound[g] && a.bound[g](c), y && xt(e, g)), m;
|
|
252
|
+
}) : [], a.update(), y = !0, I(a.before_update), a.fragment = o ? o(a.ctx) : !1, t.target) {
|
|
253
|
+
if (t.hydrate) {
|
|
254
|
+
const g = gt(t.target);
|
|
255
|
+
a.fragment && a.fragment.l(g), g.forEach(U);
|
|
256
|
+
} else
|
|
257
|
+
a.fragment && a.fragment.c();
|
|
258
|
+
t.intro && L(e.$$.fragment), wt(e, t.target, t.anchor), tt();
|
|
259
|
+
}
|
|
260
|
+
W(d);
|
|
261
|
+
}
|
|
262
|
+
class Ae {
|
|
263
|
+
constructor() {
|
|
264
|
+
/**
|
|
265
|
+
* ### PRIVATE API
|
|
266
|
+
*
|
|
267
|
+
* Do not use, may change at any time
|
|
268
|
+
*
|
|
269
|
+
* @type {any}
|
|
270
|
+
*/
|
|
271
|
+
pe(this, "$$");
|
|
272
|
+
/**
|
|
273
|
+
* ### PRIVATE API
|
|
274
|
+
*
|
|
275
|
+
* Do not use, may change at any time
|
|
276
|
+
*
|
|
277
|
+
* @type {any}
|
|
278
|
+
*/
|
|
279
|
+
pe(this, "$$set");
|
|
280
|
+
}
|
|
281
|
+
/** @returns {void} */
|
|
282
|
+
$destroy() {
|
|
283
|
+
Et(this, 1), this.$destroy = B;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* @template {Extract<keyof Events, string>} K
|
|
287
|
+
* @param {K} type
|
|
288
|
+
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
289
|
+
* @returns {() => void}
|
|
290
|
+
*/
|
|
291
|
+
$on(t, n) {
|
|
292
|
+
if (!te(n))
|
|
293
|
+
return B;
|
|
294
|
+
const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
295
|
+
return o.push(n), () => {
|
|
296
|
+
const r = o.indexOf(n);
|
|
297
|
+
r !== -1 && o.splice(r, 1);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* @param {Partial<Props>} props
|
|
302
|
+
* @returns {void}
|
|
303
|
+
*/
|
|
304
|
+
$set(t) {
|
|
305
|
+
this.$$set && !ct(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function Xe(e) {
|
|
309
|
+
let t;
|
|
310
|
+
const n = (
|
|
311
|
+
/*#slots*/
|
|
312
|
+
e[4].default
|
|
313
|
+
), o = $e(
|
|
314
|
+
n,
|
|
315
|
+
e,
|
|
316
|
+
/*$$scope*/
|
|
317
|
+
e[3],
|
|
318
|
+
null
|
|
319
|
+
);
|
|
320
|
+
return {
|
|
321
|
+
c() {
|
|
322
|
+
o && o.c();
|
|
323
|
+
},
|
|
324
|
+
m(r, i) {
|
|
325
|
+
o && o.m(r, i), t = !0;
|
|
326
|
+
},
|
|
327
|
+
p(r, i) {
|
|
328
|
+
o && o.p && (!t || i & /*$$scope*/
|
|
329
|
+
8) && Je(
|
|
330
|
+
o,
|
|
331
|
+
n,
|
|
332
|
+
r,
|
|
333
|
+
/*$$scope*/
|
|
334
|
+
r[3],
|
|
335
|
+
t ? Ge(
|
|
336
|
+
n,
|
|
337
|
+
/*$$scope*/
|
|
338
|
+
r[3],
|
|
339
|
+
i,
|
|
340
|
+
null
|
|
341
|
+
) : Ke(
|
|
342
|
+
/*$$scope*/
|
|
343
|
+
r[3]
|
|
344
|
+
),
|
|
345
|
+
null
|
|
346
|
+
);
|
|
347
|
+
},
|
|
348
|
+
i(r) {
|
|
349
|
+
t || (L(o, r), t = !0);
|
|
350
|
+
},
|
|
351
|
+
o(r) {
|
|
352
|
+
H(o, r), t = !1;
|
|
353
|
+
},
|
|
354
|
+
d(r) {
|
|
355
|
+
o && o.d(r);
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function St(e) {
|
|
360
|
+
let t, n, o = (
|
|
361
|
+
/*viewer*/
|
|
362
|
+
e[0] && Xe(e)
|
|
363
|
+
);
|
|
364
|
+
return {
|
|
365
|
+
c() {
|
|
366
|
+
o && o.c(), t = Ee();
|
|
367
|
+
},
|
|
368
|
+
m(r, i) {
|
|
369
|
+
o && o.m(r, i), F(r, t, i), n = !0;
|
|
370
|
+
},
|
|
371
|
+
p(r, [i]) {
|
|
372
|
+
/*viewer*/
|
|
373
|
+
r[0] ? o ? (o.p(r, i), i & /*viewer*/
|
|
374
|
+
1 && L(o, 1)) : (o = Xe(r), o.c(), L(o, 1), o.m(t.parentNode, t)) : o && (nt(), H(o, 1, 1, () => {
|
|
375
|
+
o = null;
|
|
376
|
+
}), ot());
|
|
377
|
+
},
|
|
378
|
+
i(r) {
|
|
379
|
+
n || (L(o), n = !0);
|
|
380
|
+
},
|
|
381
|
+
o(r) {
|
|
382
|
+
H(o), n = !1;
|
|
383
|
+
},
|
|
384
|
+
d(r) {
|
|
385
|
+
r && U(t), o && o.d(r);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function At(e, t, n) {
|
|
390
|
+
let { $$slots: o = {}, $$scope: r } = t, { viewer: i } = t, { opts: s = {} } = t, { anno: u = void 0 } = t;
|
|
391
|
+
const d = (a) => {
|
|
392
|
+
if (a) {
|
|
393
|
+
const y = ut(a, s), g = lt(y.state.store), m = {
|
|
394
|
+
...y,
|
|
395
|
+
state: { ...y.state, store: g }
|
|
396
|
+
};
|
|
397
|
+
Be("anno", m), Be("viewer", a), n(1, u = m);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
return e.$$set = (a) => {
|
|
401
|
+
"viewer" in a && n(0, i = a.viewer), "opts" in a && n(2, s = a.opts), "anno" in a && n(1, u = a.anno), "$$scope" in a && n(3, r = a.$$scope);
|
|
402
|
+
}, e.$$.update = () => {
|
|
403
|
+
e.$$.dirty & /*viewer*/
|
|
404
|
+
1 && d(i);
|
|
405
|
+
}, [i, u, s, r, o];
|
|
406
|
+
}
|
|
407
|
+
class Rt extends Ae {
|
|
408
|
+
constructor(t) {
|
|
409
|
+
super(), Se(this, t, At, St, we, { viewer: 0, opts: 2, anno: 1 });
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
var he = { dragStart: !0 }, Ye = (e, t, n) => Math.min(Math.max(e, t), n), me = (e) => typeof e == "string", Ct = ([e, t], n, o) => {
|
|
413
|
+
const r = (i, s) => s === 0 ? 0 : Math.ceil(i / s) * s;
|
|
414
|
+
return [r(n, e), r(o, t)];
|
|
415
|
+
}, He = (e, t) => e.some((n) => t.some((o) => n.contains(o)));
|
|
416
|
+
function _e(e, t) {
|
|
417
|
+
if (e === void 0) return;
|
|
418
|
+
if (ve(e)) return e.getBoundingClientRect();
|
|
419
|
+
if (typeof e == "object") {
|
|
420
|
+
const { top: o = 0, left: r = 0, right: i = 0, bottom: s = 0 } = e;
|
|
421
|
+
return { top: o, right: window.innerWidth - i, bottom: window.innerHeight - s, left: r };
|
|
422
|
+
}
|
|
423
|
+
if (e === "parent") return t.parentNode.getBoundingClientRect();
|
|
424
|
+
const n = document.querySelector(e);
|
|
425
|
+
if (n === null) throw new Error("The selector provided for bound doesn't exists in the document.");
|
|
426
|
+
return n.getBoundingClientRect();
|
|
427
|
+
}
|
|
428
|
+
var Q = (e, t, n) => e.style.setProperty(t, n), ve = (e) => e instanceof HTMLElement, Nt = (e, t = {}) => {
|
|
429
|
+
let n, o, { bounds: r, axis: i = "both", gpuAcceleration: s = !0, legacyTranslate: u = !0, transform: d, applyUserSelectHack: a = !0, disabled: y = !1, ignoreMultitouch: g = !1, recomputeBounds: m = he, grid: v, position: c, cancel: A, handle: w, defaultClass: f = "neodrag", defaultClassDragging: S = "neodrag-dragging", defaultClassDragged: C = "neodrag-dragged", defaultPosition: ne = { x: 0, y: 0 }, onDragStart: oe, onDrag: re, onDragEnd: ie } = t, T = !1, N = 0, k = 0, q = 0, z = 0, se = 0, le = 0, { x: G, y: J } = c ? { x: (c == null ? void 0 : c.x) ?? 0, y: (c == null ? void 0 : c.y) ?? 0 } : ne;
|
|
430
|
+
ce(G, J);
|
|
431
|
+
let M, O, V, ue, Ce, Ne = "", rt = !!c;
|
|
432
|
+
m = { ...he, ...m };
|
|
433
|
+
let K = /* @__PURE__ */ new Set();
|
|
434
|
+
const ae = document.body.style, P = e.classList;
|
|
435
|
+
function ce(l = N, h = k) {
|
|
436
|
+
if (!d) {
|
|
437
|
+
if (u) {
|
|
438
|
+
let b = `${+l}px, ${+h}px`;
|
|
439
|
+
return Q(e, "transform", s ? `translate3d(${b}, 0)` : `translate(${b})`);
|
|
440
|
+
}
|
|
441
|
+
return Q(e, "translate", `${+l}px ${+h}px ${s ? "1px" : ""}`);
|
|
442
|
+
}
|
|
443
|
+
const _ = d({ offsetX: l, offsetY: h, rootNode: e });
|
|
444
|
+
me(_) && Q(e, "transform", _);
|
|
445
|
+
}
|
|
446
|
+
const fe = (l, h) => {
|
|
447
|
+
const _ = { offsetX: N, offsetY: k, rootNode: e, currentNode: Ce };
|
|
448
|
+
e.dispatchEvent(new CustomEvent(l, { detail: _ })), h == null || h(_);
|
|
449
|
+
}, de = addEventListener;
|
|
450
|
+
de("pointerdown", Me, !1), de("pointerup", De, !1), de("pointermove", Le, !1), Q(e, "touch-action", "none");
|
|
451
|
+
const ke = () => {
|
|
452
|
+
let l = e.offsetWidth / O.width;
|
|
453
|
+
return isNaN(l) && (l = 1), l;
|
|
454
|
+
};
|
|
455
|
+
function Me(l) {
|
|
456
|
+
if (y || l.button === 2) return;
|
|
457
|
+
if (K.add(l.pointerId), g && K.size > 1) return l.preventDefault();
|
|
458
|
+
if (m.dragStart && (M = _e(r, e)), me(w) && me(A) && w === A) throw new Error("`handle` selector can't be same as `cancel` selector");
|
|
459
|
+
if (P.add(f), V = function(p, x) {
|
|
460
|
+
if (!p) return [x];
|
|
461
|
+
if (ve(p)) return [p];
|
|
462
|
+
if (Array.isArray(p)) return p;
|
|
463
|
+
const D = x.querySelectorAll(p);
|
|
464
|
+
if (D === null) throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");
|
|
465
|
+
return Array.from(D.values());
|
|
466
|
+
}(w, e), ue = function(p, x) {
|
|
467
|
+
if (!p) return [];
|
|
468
|
+
if (ve(p)) return [p];
|
|
469
|
+
if (Array.isArray(p)) return p;
|
|
470
|
+
const D = x.querySelectorAll(p);
|
|
471
|
+
if (D === null) throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");
|
|
472
|
+
return Array.from(D.values());
|
|
473
|
+
}(A, e), n = /(both|x)/.test(i), o = /(both|y)/.test(i), He(ue, V)) throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");
|
|
474
|
+
const h = l.composedPath()[0];
|
|
475
|
+
if (!V.some((p) => {
|
|
476
|
+
var x;
|
|
477
|
+
return p.contains(h) || ((x = p.shadowRoot) == null ? void 0 : x.contains(h));
|
|
478
|
+
}) || He(ue, [h])) return;
|
|
479
|
+
Ce = V.length === 1 ? e : V.find((p) => p.contains(h)), T = !0, O = e.getBoundingClientRect(), a && (Ne = ae.userSelect, ae.userSelect = "none"), fe("neodrag:start", oe);
|
|
480
|
+
const { clientX: _, clientY: b } = l, E = ke();
|
|
481
|
+
n && (q = _ - G / E), o && (z = b - J / E), M && (se = _ - O.left, le = b - O.top);
|
|
482
|
+
}
|
|
483
|
+
function De(l) {
|
|
484
|
+
K.delete(l.pointerId), T && (m.dragEnd && (M = _e(r, e)), P.remove(S), P.add(C), a && (ae.userSelect = Ne), fe("neodrag:end", ie), n && (q = N), o && (z = k), T = !1);
|
|
485
|
+
}
|
|
486
|
+
function Le(l) {
|
|
487
|
+
if (!T || g && K.size > 1) return;
|
|
488
|
+
m.drag && (M = _e(r, e)), P.add(S), l.preventDefault(), O = e.getBoundingClientRect();
|
|
489
|
+
let h = l.clientX, _ = l.clientY;
|
|
490
|
+
const b = ke();
|
|
491
|
+
if (M) {
|
|
492
|
+
const E = { left: M.left + se, top: M.top + le, right: M.right + se - O.width, bottom: M.bottom + le - O.height };
|
|
493
|
+
h = Ye(h, E.left, E.right), _ = Ye(_, E.top, E.bottom);
|
|
494
|
+
}
|
|
495
|
+
if (Array.isArray(v)) {
|
|
496
|
+
let [E, p] = v;
|
|
497
|
+
if (isNaN(+E) || E < 0) throw new Error("1st argument of `grid` must be a valid positive number");
|
|
498
|
+
if (isNaN(+p) || p < 0) throw new Error("2nd argument of `grid` must be a valid positive number");
|
|
499
|
+
let x = h - q, D = _ - z;
|
|
500
|
+
[x, D] = Ct([E / b, p / b], x, D), h = q + x, _ = z + D;
|
|
501
|
+
}
|
|
502
|
+
n && (N = Math.round((h - q) * b)), o && (k = Math.round((_ - z) * b)), G = N, J = k, fe("neodrag", re), ce();
|
|
503
|
+
}
|
|
504
|
+
return { destroy: () => {
|
|
505
|
+
const l = removeEventListener;
|
|
506
|
+
l("pointerdown", Me, !1), l("pointerup", De, !1), l("pointermove", Le, !1);
|
|
507
|
+
}, update: (l) => {
|
|
508
|
+
var _, b;
|
|
509
|
+
i = l.axis || "both", y = l.disabled ?? !1, g = l.ignoreMultitouch ?? !1, w = l.handle, r = l.bounds, m = l.recomputeBounds ?? he, A = l.cancel, a = l.applyUserSelectHack ?? !0, v = l.grid, s = l.gpuAcceleration ?? !0, u = l.legacyTranslate ?? !0, d = l.transform;
|
|
510
|
+
const h = P.contains(C);
|
|
511
|
+
P.remove(f, C), f = l.defaultClass ?? "neodrag", S = l.defaultClassDragging ?? "neodrag-dragging", C = l.defaultClassDragged ?? "neodrag-dragged", P.add(f), h && P.add(C), rt && (G = N = ((_ = l.position) == null ? void 0 : _.x) ?? N, J = k = ((b = l.position) == null ? void 0 : b.y) ?? k, ce());
|
|
512
|
+
} };
|
|
513
|
+
};
|
|
514
|
+
function Ie(e) {
|
|
515
|
+
let t, n = (
|
|
516
|
+
/*$selection*/
|
|
517
|
+
e[0].selected.map(Ue).join(", ") + ""
|
|
518
|
+
), o, r, i, s;
|
|
519
|
+
return {
|
|
520
|
+
c() {
|
|
521
|
+
t = Qe("div"), o = Ze(n), Z(t, "class", "a9s-popup a9s-osd-popup svelte-1xuxeat");
|
|
522
|
+
},
|
|
523
|
+
m(u, d) {
|
|
524
|
+
F(u, t, d), pt(t, o), i || (s = [
|
|
525
|
+
dt(r = Nt.call(null, t, {
|
|
526
|
+
position: { x: (
|
|
527
|
+
/*left*/
|
|
528
|
+
e[1]
|
|
529
|
+
), y: (
|
|
530
|
+
/*top*/
|
|
531
|
+
e[2]
|
|
532
|
+
) }
|
|
533
|
+
})),
|
|
534
|
+
je(
|
|
535
|
+
t,
|
|
536
|
+
"neodrag:start",
|
|
537
|
+
/*onDragStart*/
|
|
538
|
+
e[4]
|
|
539
|
+
),
|
|
540
|
+
je(
|
|
541
|
+
t,
|
|
542
|
+
"neodrag:end",
|
|
543
|
+
/*onDragEnd*/
|
|
544
|
+
e[5]
|
|
545
|
+
)
|
|
546
|
+
], i = !0);
|
|
547
|
+
},
|
|
548
|
+
p(u, d) {
|
|
549
|
+
d & /*$selection*/
|
|
550
|
+
1 && n !== (n = /*$selection*/
|
|
551
|
+
u[0].selected.map(Ue).join(", ") + "") && ht(o, n), r && te(r.update) && d & /*left, top*/
|
|
552
|
+
6 && r.update.call(null, {
|
|
553
|
+
position: { x: (
|
|
554
|
+
/*left*/
|
|
555
|
+
u[1]
|
|
556
|
+
), y: (
|
|
557
|
+
/*top*/
|
|
558
|
+
u[2]
|
|
559
|
+
) }
|
|
560
|
+
});
|
|
561
|
+
},
|
|
562
|
+
d(u) {
|
|
563
|
+
u && U(t), i = !1, I(s);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function kt(e) {
|
|
568
|
+
let t, n = (
|
|
569
|
+
/*$selection*/
|
|
570
|
+
e[0] && Ie(e)
|
|
571
|
+
);
|
|
572
|
+
return {
|
|
573
|
+
c() {
|
|
574
|
+
n && n.c(), t = Ee();
|
|
575
|
+
},
|
|
576
|
+
m(o, r) {
|
|
577
|
+
n && n.m(o, r), F(o, t, r);
|
|
578
|
+
},
|
|
579
|
+
p(o, [r]) {
|
|
580
|
+
/*$selection*/
|
|
581
|
+
o[0] ? n ? n.p(o, r) : (n = Ie(o), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
|
|
582
|
+
},
|
|
583
|
+
i: B,
|
|
584
|
+
o: B,
|
|
585
|
+
d(o) {
|
|
586
|
+
o && U(t), n && n.d(o);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
const Ue = (e) => e.id;
|
|
591
|
+
function Mt(e, t, n) {
|
|
592
|
+
let o, { state: r } = t, { viewer: i } = t, s, u, d = !1, a;
|
|
593
|
+
const { selection: y, store: g } = r;
|
|
594
|
+
We(e, y, (f) => n(0, o = f));
|
|
595
|
+
const m = (f) => {
|
|
596
|
+
var S;
|
|
597
|
+
return ((S = f.selected) == null ? void 0 : S.length) > 0;
|
|
598
|
+
}, v = () => {
|
|
599
|
+
d = !0, i.setMouseNavEnabled(!1);
|
|
600
|
+
}, c = () => {
|
|
601
|
+
i.setMouseNavEnabled(!0);
|
|
602
|
+
}, A = () => {
|
|
603
|
+
a && g.unobserve(a), m(o) && (d = !1, w(o), a = (f) => {
|
|
604
|
+
d || w(o);
|
|
605
|
+
}, g.observe(a, {
|
|
606
|
+
annotations: o.selected.map((f) => f.id)
|
|
607
|
+
}));
|
|
608
|
+
}, w = (f) => {
|
|
609
|
+
const S = f.selected[0].id, C = g.getAnnotation(S), { minX: ne, minY: oe, maxX: re, maxY: ie } = C.target.selector.geometry.bounds, T = 14, N = i.viewport.imageToViewerElementCoordinates(new Pe.Point(ne, oe)), k = i.viewport.imageToViewerElementCoordinates(new Pe.Point(re, ie));
|
|
610
|
+
n(1, s = k.x + T), n(2, u = N.y);
|
|
611
|
+
};
|
|
612
|
+
return et(() => {
|
|
613
|
+
const f = () => {
|
|
614
|
+
m(o) && !d && w(o);
|
|
615
|
+
};
|
|
616
|
+
return i.addHandler("update-viewport", f), () => {
|
|
617
|
+
i.removeHandler("update-viewport", f);
|
|
618
|
+
};
|
|
619
|
+
}), e.$$set = (f) => {
|
|
620
|
+
"state" in f && n(6, r = f.state), "viewer" in f && n(7, i = f.viewer);
|
|
621
|
+
}, e.$$.update = () => {
|
|
622
|
+
e.$$.dirty & /*$selection*/
|
|
623
|
+
1 && A();
|
|
624
|
+
}, [o, s, u, y, v, c, r, i];
|
|
625
|
+
}
|
|
626
|
+
class Xt extends Ae {
|
|
627
|
+
constructor(t) {
|
|
628
|
+
super(), Se(this, t, Mt, kt, we, { state: 6, viewer: 7 });
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const Dt = (e) => ({ hovered: e & /*hovered*/
|
|
632
|
+
16 }), qe = (e) => ({ hovered: (
|
|
633
|
+
/*hovered*/
|
|
634
|
+
e[4]
|
|
635
|
+
) });
|
|
636
|
+
function ze(e) {
|
|
637
|
+
let t, n, o;
|
|
638
|
+
const r = (
|
|
639
|
+
/*#slots*/
|
|
640
|
+
e[8].default
|
|
641
|
+
), i = $e(
|
|
642
|
+
r,
|
|
643
|
+
e,
|
|
644
|
+
/*$$scope*/
|
|
645
|
+
e[7],
|
|
646
|
+
qe
|
|
647
|
+
);
|
|
648
|
+
return {
|
|
649
|
+
c() {
|
|
650
|
+
t = Qe("div"), i && i.c(), Z(t, "class", "a9s-tooltip svelte-14kj0as"), Z(t, "style", n = `left:${/*left*/
|
|
651
|
+
e[2]}px; top:${/*top*/
|
|
652
|
+
e[1]}px; position: absolute;`);
|
|
653
|
+
},
|
|
654
|
+
m(s, u) {
|
|
655
|
+
F(s, t, u), i && i.m(t, null), o = !0;
|
|
656
|
+
},
|
|
657
|
+
p(s, u) {
|
|
658
|
+
i && i.p && (!o || u & /*$$scope, hovered*/
|
|
659
|
+
144) && Je(
|
|
660
|
+
i,
|
|
661
|
+
r,
|
|
662
|
+
s,
|
|
663
|
+
/*$$scope*/
|
|
664
|
+
s[7],
|
|
665
|
+
o ? Ge(
|
|
666
|
+
r,
|
|
667
|
+
/*$$scope*/
|
|
668
|
+
s[7],
|
|
669
|
+
u,
|
|
670
|
+
Dt
|
|
671
|
+
) : Ke(
|
|
672
|
+
/*$$scope*/
|
|
673
|
+
s[7]
|
|
674
|
+
),
|
|
675
|
+
qe
|
|
676
|
+
), (!o || u & /*left, top*/
|
|
677
|
+
6 && n !== (n = `left:${/*left*/
|
|
678
|
+
s[2]}px; top:${/*top*/
|
|
679
|
+
s[1]}px; position: absolute;`)) && Z(t, "style", n);
|
|
680
|
+
},
|
|
681
|
+
i(s) {
|
|
682
|
+
o || (L(i, s), o = !0);
|
|
683
|
+
},
|
|
684
|
+
o(s) {
|
|
685
|
+
H(i, s), o = !1;
|
|
686
|
+
},
|
|
687
|
+
d(s) {
|
|
688
|
+
s && U(t), i && i.d(s);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
function Lt(e) {
|
|
693
|
+
let t, n, o = (
|
|
694
|
+
/*$hover*/
|
|
695
|
+
e[0] && /*show*/
|
|
696
|
+
e[3] && ze(e)
|
|
697
|
+
);
|
|
698
|
+
return {
|
|
699
|
+
c() {
|
|
700
|
+
o && o.c(), t = Ee();
|
|
701
|
+
},
|
|
702
|
+
m(r, i) {
|
|
703
|
+
o && o.m(r, i), F(r, t, i), n = !0;
|
|
704
|
+
},
|
|
705
|
+
p(r, [i]) {
|
|
706
|
+
/*$hover*/
|
|
707
|
+
r[0] && /*show*/
|
|
708
|
+
r[3] ? o ? (o.p(r, i), i & /*$hover, show*/
|
|
709
|
+
9 && L(o, 1)) : (o = ze(r), o.c(), L(o, 1), o.m(t.parentNode, t)) : o && (nt(), H(o, 1, 1, () => {
|
|
710
|
+
o = null;
|
|
711
|
+
}), ot());
|
|
712
|
+
},
|
|
713
|
+
i(r) {
|
|
714
|
+
n || (L(o), n = !0);
|
|
715
|
+
},
|
|
716
|
+
o(r) {
|
|
717
|
+
H(o), n = !1;
|
|
718
|
+
},
|
|
719
|
+
d(r) {
|
|
720
|
+
r && U(t), o && o.d(r);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function Pt(e, t, n) {
|
|
725
|
+
let o, r, { $$slots: i = {}, $$scope: s } = t, { container: u } = t;
|
|
726
|
+
const d = mt("anno"), { store: a, hover: y } = d.state;
|
|
727
|
+
We(e, y, (c) => n(0, r = c));
|
|
728
|
+
let g, m, v = !0;
|
|
729
|
+
return et(() => {
|
|
730
|
+
const c = () => {
|
|
731
|
+
n(3, v = !0);
|
|
732
|
+
}, A = (f) => {
|
|
733
|
+
const { offsetX: S, offsetY: C } = f;
|
|
734
|
+
n(2, m = S), n(1, g = C);
|
|
735
|
+
}, w = () => {
|
|
736
|
+
n(3, v = !1);
|
|
737
|
+
};
|
|
738
|
+
return u.addEventListener("pointerenter", c), u.addEventListener("pointermove", A), u.addEventListener("pointerleave", w), () => {
|
|
739
|
+
u.removeEventListener("pointerenter", c), u.removeEventListener("pointermove", A), u.removeEventListener("pointerleave", w);
|
|
740
|
+
};
|
|
741
|
+
}), e.$$set = (c) => {
|
|
742
|
+
"container" in c && n(6, u = c.container), "$$scope" in c && n(7, s = c.$$scope);
|
|
743
|
+
}, e.$$.update = () => {
|
|
744
|
+
e.$$.dirty & /*$hover*/
|
|
745
|
+
1 && n(4, o = r ? a.getAnnotation(r) : void 0);
|
|
746
|
+
}, [r, g, m, v, o, y, u, s, i];
|
|
747
|
+
}
|
|
748
|
+
class Yt extends Ae {
|
|
749
|
+
constructor(t) {
|
|
750
|
+
super(), Se(this, t, Pt, Lt, we, { container: 6 });
|
|
751
|
+
}
|
|
752
|
+
}
|
|
6
753
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
754
|
+
Yt as MouseOverTooltip,
|
|
755
|
+
Rt as OpenSeadragonAnnotator,
|
|
756
|
+
Xt as OpenSeadragonPopup,
|
|
757
|
+
Ut as Origin,
|
|
758
|
+
Ft as ShapeType,
|
|
759
|
+
qt as UserSelectAction,
|
|
760
|
+
Gt as W3CImageFormat,
|
|
761
|
+
zt as createAnonymousGuest,
|
|
762
|
+
Vt as createBody,
|
|
763
|
+
Jt as createImageAnnotator,
|
|
764
|
+
Wt as defaultColorProvider
|
|
18
765
|
};
|
|
19
766
|
//# sourceMappingURL=annotorious-svelte.es.js.map
|