@annotorious/svelte 3.0.0-rc.22 → 3.0.0-rc.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-svelte.es11.js","sources":["../../../node_modules/svelte/src/shared/version.js"],"sourcesContent":["// generated during release, do not modify\n\n/**\n * The current version, as set in package.json.\n *\n * https://svelte.dev/docs/svelte-compiler#svelte-version\n * @type {string}\n */\nexport const VERSION = '4.2.
|
|
1
|
+
{"version":3,"file":"annotorious-svelte.es11.js","sources":["../../../node_modules/svelte/src/shared/version.js"],"sourcesContent":["// generated during release, do not modify\n\n/**\n * The current version, as set in package.json.\n *\n * https://svelte.dev/docs/svelte-compiler#svelte-version\n * @type {string}\n */\nexport const VERSION = '4.2.17';\nexport const PUBLIC_VERSION = '4';\n"],"names":["PUBLIC_VERSION"],"mappings":"AASY,MAACA,IAAiB;","x_google_ignoreList":[0]}
|
|
@@ -1,123 +1,126 @@
|
|
|
1
|
-
var
|
|
2
|
-
const u = (
|
|
3
|
-
return [u(i,
|
|
4
|
-
},
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
1
|
+
var G = { dragStart: !0 }, oe = (t, s, i) => Math.min(Math.max(t, s), i), J = (t) => typeof t == "string", ue = ([t, s], i, c) => {
|
|
2
|
+
const u = (w, f) => f === 0 ? 0 : Math.ceil(w / f) * f;
|
|
3
|
+
return [u(i, t), u(c, s)];
|
|
4
|
+
}, ie = (t, s) => t.some((i) => s.some((c) => i.contains(c)));
|
|
5
|
+
function K(t, s) {
|
|
6
|
+
if (t === void 0)
|
|
7
7
|
return;
|
|
8
|
-
if (
|
|
9
|
-
return
|
|
10
|
-
if (typeof
|
|
11
|
-
const { top:
|
|
12
|
-
return { top:
|
|
8
|
+
if (O(t))
|
|
9
|
+
return t.getBoundingClientRect();
|
|
10
|
+
if (typeof t == "object") {
|
|
11
|
+
const { top: c = 0, left: u = 0, right: w = 0, bottom: f = 0 } = t;
|
|
12
|
+
return { top: c, right: window.innerWidth - w, bottom: window.innerHeight - f, left: u };
|
|
13
13
|
}
|
|
14
|
-
if (
|
|
14
|
+
if (t === "parent")
|
|
15
15
|
return s.parentNode.getBoundingClientRect();
|
|
16
|
-
const i = document.querySelector(
|
|
16
|
+
const i = document.querySelector(t);
|
|
17
17
|
if (i === null)
|
|
18
18
|
throw new Error("The selector provided for bound doesn't exists in the document.");
|
|
19
19
|
return i.getBoundingClientRect();
|
|
20
20
|
}
|
|
21
|
-
var
|
|
22
|
-
let i,
|
|
21
|
+
var L = (t, s, i) => t.style.setProperty(s, i), O = (t) => t instanceof HTMLElement, fe = (t, s = {}) => {
|
|
22
|
+
let i, c, { bounds: u, axis: w = "both", gpuAcceleration: f = !0, legacyTranslate: Q = !0, transform: T, applyUserSelectHack: X = !0, disabled: V = !1, ignoreMultitouch: Y = !1, recomputeBounds: x = G, grid: q, position: p, cancel: N, handle: D, defaultClass: M = "neodrag", defaultClassDragging: P = "neodrag-dragging", defaultClassDragged: S = "neodrag-dragged", defaultPosition: ae = { x: 0, y: 0 }, onDragStart: se, onDrag: le, onDragEnd: de } = s, B = !1, y = 0, b = 0, A = 0, C = 0, k = 0, z = 0, { x: $, y: R } = p ? { x: (p == null ? void 0 : p.x) ?? 0, y: (p == null ? void 0 : p.y) ?? 0 } : ae;
|
|
23
23
|
W($, R);
|
|
24
|
-
let g, v, E,
|
|
25
|
-
x = { ...
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
let g, v, E, I, Z, _ = "", ce = !!p;
|
|
25
|
+
x = { ...G, ...x };
|
|
26
|
+
let H = /* @__PURE__ */ new Set();
|
|
27
|
+
const U = document.body.style, m = t.classList;
|
|
28
|
+
function W(e = y, r = b) {
|
|
29
|
+
if (!T) {
|
|
30
|
+
if (Q) {
|
|
31
|
+
let a = `${+e}px, ${+r}px`;
|
|
32
|
+
return L(t, "transform", f ? `translate3d(${a}, 0)` : `translate(${a})`);
|
|
32
33
|
}
|
|
33
|
-
return
|
|
34
|
+
return L(t, "translate", `${+e}px ${+r}px ${f ? "1px" : ""}`);
|
|
34
35
|
}
|
|
35
|
-
const o =
|
|
36
|
-
|
|
36
|
+
const o = T({ offsetX: e, offsetY: r, rootNode: t });
|
|
37
|
+
J(o) && L(t, "transform", o);
|
|
37
38
|
}
|
|
38
|
-
const j = (
|
|
39
|
-
const o = { offsetX:
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
let
|
|
45
|
-
return isNaN(
|
|
39
|
+
const j = (e, r) => {
|
|
40
|
+
const o = { offsetX: y, offsetY: b, rootNode: t, currentNode: Z };
|
|
41
|
+
t.dispatchEvent(new CustomEvent(e, { detail: o })), r == null || r(o);
|
|
42
|
+
}, F = addEventListener;
|
|
43
|
+
F("pointerdown", te, !1), F("pointerup", ne, !1), F("pointermove", re, !1), L(t, "touch-action", "none");
|
|
44
|
+
const ee = () => {
|
|
45
|
+
let e = t.offsetWidth / v.width;
|
|
46
|
+
return isNaN(e) && (e = 1), e;
|
|
46
47
|
};
|
|
47
|
-
function
|
|
48
|
-
if (
|
|
48
|
+
function te(e) {
|
|
49
|
+
if (V || e.button === 2)
|
|
49
50
|
return;
|
|
50
|
-
if (
|
|
51
|
+
if (H.add(e.pointerId), Y && H.size > 1)
|
|
52
|
+
return e.preventDefault();
|
|
53
|
+
if (x.dragStart && (g = K(u, t)), J(D) && J(N) && D === N)
|
|
51
54
|
throw new Error("`handle` selector can't be same as `cancel` selector");
|
|
52
|
-
if (m.add(M), E = function(n,
|
|
55
|
+
if (m.add(M), E = function(n, d) {
|
|
53
56
|
if (!n)
|
|
54
|
-
return [
|
|
55
|
-
if (
|
|
57
|
+
return [d];
|
|
58
|
+
if (O(n))
|
|
56
59
|
return [n];
|
|
57
60
|
if (Array.isArray(n))
|
|
58
61
|
return n;
|
|
59
|
-
const h =
|
|
62
|
+
const h = d.querySelectorAll(n);
|
|
60
63
|
if (h === null)
|
|
61
64
|
throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");
|
|
62
65
|
return Array.from(h.values());
|
|
63
|
-
}(D,
|
|
66
|
+
}(D, t), I = function(n, d) {
|
|
64
67
|
if (!n)
|
|
65
68
|
return [];
|
|
66
|
-
if (
|
|
69
|
+
if (O(n))
|
|
67
70
|
return [n];
|
|
68
71
|
if (Array.isArray(n))
|
|
69
72
|
return n;
|
|
70
|
-
const h =
|
|
73
|
+
const h = d.querySelectorAll(n);
|
|
71
74
|
if (h === null)
|
|
72
75
|
throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");
|
|
73
76
|
return Array.from(h.values());
|
|
74
|
-
}(N,
|
|
77
|
+
}(N, t), i = /(both|x)/.test(w), c = /(both|y)/.test(w), ie(I, E))
|
|
75
78
|
throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");
|
|
76
|
-
const r =
|
|
79
|
+
const r = e.composedPath()[0];
|
|
77
80
|
if (!E.some((n) => {
|
|
78
|
-
var
|
|
79
|
-
return n.contains(r) || ((
|
|
80
|
-
}) ||
|
|
81
|
+
var d;
|
|
82
|
+
return n.contains(r) || ((d = n.shadowRoot) == null ? void 0 : d.contains(r));
|
|
83
|
+
}) || ie(I, [r]))
|
|
81
84
|
return;
|
|
82
|
-
|
|
83
|
-
const { clientX: o, clientY: a } =
|
|
84
|
-
i && (A = o - $ / l),
|
|
85
|
+
Z = E.length === 1 ? t : E.find((n) => n.contains(r)), B = !0, v = t.getBoundingClientRect(), X && (_ = U.userSelect, U.userSelect = "none"), j("neodrag:start", se);
|
|
86
|
+
const { clientX: o, clientY: a } = e, l = ee();
|
|
87
|
+
i && (A = o - $ / l), c && (C = a - R / l), g && (k = o - v.left, z = a - v.top);
|
|
85
88
|
}
|
|
86
|
-
function
|
|
87
|
-
B && (x.dragEnd && (g =
|
|
89
|
+
function ne(e) {
|
|
90
|
+
H.delete(e.pointerId), B && (x.dragEnd && (g = K(u, t)), m.remove(P), m.add(S), X && (U.userSelect = _), j("neodrag:end", de), i && (A = y), c && (C = b), B = !1);
|
|
88
91
|
}
|
|
89
|
-
function
|
|
90
|
-
if (!B)
|
|
92
|
+
function re(e) {
|
|
93
|
+
if (!B || Y && H.size > 1)
|
|
91
94
|
return;
|
|
92
|
-
x.drag && (g =
|
|
93
|
-
let r =
|
|
94
|
-
const a =
|
|
95
|
+
x.drag && (g = K(u, t)), m.add(P), e.preventDefault(), v = t.getBoundingClientRect();
|
|
96
|
+
let r = e.clientX, o = e.clientY;
|
|
97
|
+
const a = ee();
|
|
95
98
|
if (g) {
|
|
96
|
-
const l = { left: g.left +
|
|
97
|
-
r =
|
|
99
|
+
const l = { left: g.left + k, top: g.top + z, right: g.right + k - v.width, bottom: g.bottom + z - v.height };
|
|
100
|
+
r = oe(r, l.left, l.right), o = oe(o, l.top, l.bottom);
|
|
98
101
|
}
|
|
99
|
-
if (Array.isArray(
|
|
100
|
-
let [l, n] =
|
|
102
|
+
if (Array.isArray(q)) {
|
|
103
|
+
let [l, n] = q;
|
|
101
104
|
if (isNaN(+l) || l < 0)
|
|
102
105
|
throw new Error("1st argument of `grid` must be a valid positive number");
|
|
103
106
|
if (isNaN(+n) || n < 0)
|
|
104
107
|
throw new Error("2nd argument of `grid` must be a valid positive number");
|
|
105
|
-
let
|
|
106
|
-
[
|
|
108
|
+
let d = r - A, h = o - C;
|
|
109
|
+
[d, h] = ue([l / a, n / a], d, h), r = A + d, o = C + h;
|
|
107
110
|
}
|
|
108
|
-
i && (
|
|
111
|
+
i && (y = Math.round((r - A) * a)), c && (b = Math.round((o - C) * a)), $ = y, R = b, j("neodrag", le), W();
|
|
109
112
|
}
|
|
110
113
|
return { destroy: () => {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
}, update: (
|
|
114
|
+
const e = removeEventListener;
|
|
115
|
+
e("pointerdown", te, !1), e("pointerup", ne, !1), e("pointermove", re, !1);
|
|
116
|
+
}, update: (e) => {
|
|
114
117
|
var o, a;
|
|
115
|
-
|
|
118
|
+
w = e.axis || "both", V = e.disabled ?? !1, Y = e.ignoreMultitouch ?? !1, D = e.handle, u = e.bounds, x = e.recomputeBounds ?? G, N = e.cancel, X = e.applyUserSelectHack ?? !0, q = e.grid, f = e.gpuAcceleration ?? !0, Q = e.legacyTranslate ?? !0, T = e.transform;
|
|
116
119
|
const r = m.contains(S);
|
|
117
|
-
m.remove(M, S), M =
|
|
120
|
+
m.remove(M, S), M = e.defaultClass ?? "neodrag", P = e.defaultClassDragging ?? "neodrag-dragging", S = e.defaultClassDragged ?? "neodrag-dragged", m.add(M), r && m.add(S), ce && ($ = y = ((o = e.position) == null ? void 0 : o.x) ?? y, R = b = ((a = e.position) == null ? void 0 : a.y) ?? b, W());
|
|
118
121
|
} };
|
|
119
122
|
};
|
|
120
123
|
export {
|
|
121
|
-
|
|
124
|
+
fe as draggable
|
|
122
125
|
};
|
|
123
126
|
//# sourceMappingURL=annotorious-svelte.es12.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-svelte.es12.js","sources":["../../../node_modules/@neodrag/svelte/dist/min/index.js"],"sourcesContent":["var t={dragStart:!0},e=(t,e,n)=>Math.min(Math.max(t,e),n),n=t=>\"string\"==typeof t,r=([t,e],n,r)=>{const o=(t,e)=>0===e?0:Math.ceil(t/e)*e;return[o(n,t),o(r,e)]};var o=(t,e)=>t.some((t=>e.some((e=>t.contains(e)))));function i(t,e){if(void 0===t)return;if(s(t))return t.getBoundingClientRect();if(\"object\"==typeof t){const{top:e=0,left:n=0,right:r=0,bottom:o=0}=t;return{top:e,right:window.innerWidth-r,bottom:window.innerHeight-o,left:n}}if(\"parent\"===t)return e.parentNode.getBoundingClientRect();const n=document.querySelector(t);if(null===n)throw new Error(\"The selector provided for bound doesn't exists in the document.\");return n.getBoundingClientRect()}var a=(t,e,n)=>t.style.setProperty(e,n),s=t=>t instanceof HTMLElement,d=(d,l={})=>{let c,u,{bounds:f,axis:g=\"both\",gpuAcceleration:h=!0,legacyTranslate:p=!0,transform:m,applyUserSelectHack:y=!0,disabled:b=!1,ignoreMultitouch:w=!1,recomputeBounds:v=t,grid:x,position:E,cancel:S,handle:A,defaultClass:C=\"neodrag\",defaultClassDragging:N=\"neodrag-dragging\",defaultClassDragged:D=\"neodrag-dragged\",defaultPosition:M={x:0,y:0},onDragStart:B,onDrag:$,onDragEnd:R}=l,H=!1,L=0,P=0,T=0,X=0,Y=0,q=0,{x:k,y:U}=E?{x:E?.x??0,y:E?.y??0}:M;Q(k,U);let W,j,z,F,G,I=\"\",J=!!E;v={...t,...v};const K=document.body.style,O=d.classList;function Q(t=L,e=P){if(!m){if(p){let n=`${+t}px, ${+e}px`;return a(d,\"transform\",h?`translate3d(${n}, 0)`:`translate(${n})`)}return a(d,\"translate\",`${+t}px ${+e}px ${h?\"1px\":\"\"}`)}const r=m({offsetX:t,offsetY:e,rootNode:d});n(r)&&a(d,\"transform\",r)}const V=(t,e)=>{const n={offsetX:L,offsetY:P,rootNode:d,currentNode:G};d.dispatchEvent(new CustomEvent(t,{detail:n})),e?.(n)};const Z=addEventListener;Z(\"pointerdown\",tt,!1),Z(\"pointerup\",et,!1),Z(\"pointermove\",nt,!1),a(d,\"touch-action\",\"none\");const _=()=>{let t=d.offsetWidth/j.width;return isNaN(t)&&(t=1),t};function tt(t){if(b)return;if(2===t.button)return;if(w&&!t.isPrimary)return;if(v.dragStart&&(W=i(f,d)),n(A)&&n(S)&&A===S)throw new Error(\"`handle` selector can't be same as `cancel` selector\");if(O.add(C),z=function(t,e){if(!t)return[e];if(s(t))return[t];if(Array.isArray(t))return t;const n=e.querySelectorAll(t);if(null===n)throw new Error(\"Selector passed for `handle` option should be child of the element on which the action is applied\");return Array.from(n.values())}(A,d),F=function(t,e){if(!t)return[];if(s(t))return[t];if(Array.isArray(t))return t;const n=e.querySelectorAll(t);if(null===n)throw new Error(\"Selector passed for `cancel` option should be child of the element on which the action is applied\");return Array.from(n.values())}(S,d),c=/(both|x)/.test(g),u=/(both|y)/.test(g),o(F,z))throw new Error(\"Element being dragged can't be a child of the element on which `cancel` is applied\");const e=t.composedPath()[0];if(!z.some((t=>t.contains(e)||t.shadowRoot?.contains(e)))||o(F,[e]))return;G=1===z.length?d:z.find((t=>t.contains(e))),H=!0,j=d.getBoundingClientRect(),y&&(I=K.userSelect,K.userSelect=\"none\"),V(\"neodrag:start\",B);const{clientX:r,clientY:a}=t,l=_();c&&(T=r-k/l),u&&(X=a-U/l),W&&(Y=r-j.left,q=a-j.top)}function et(){H&&(v.dragEnd&&(W=i(f,d)),O.remove(N),O.add(D),y&&(K.userSelect=I),V(\"neodrag:end\",R),c&&(T=L),u&&(X=P),H=!1)}function nt(t){if(!H)return;v.drag&&(W=i(f,d)),O.add(N),t.preventDefault(),j=d.getBoundingClientRect();let n=t.clientX,o=t.clientY;const a=_();if(W){const t={left:W.left+Y,top:W.top+q,right:W.right+Y-j.width,bottom:W.bottom+q-j.height};n=e(n,t.left,t.right),o=e(o,t.top,t.bottom)}if(Array.isArray(x)){let[t,e]=x;if(isNaN(+t)||t<0)throw new Error(\"1st argument of `grid` must be a valid positive number\");if(isNaN(+e)||e<0)throw new Error(\"2nd argument of `grid` must be a valid positive number\");let i=n-T,s=o-X;[i,s]=r([t/a,e/a],i,s),n=T+i,o=X+s}c&&(L=Math.round((n-T)*a)),u&&(P=Math.round((o-X)*a)),k=L,U=P,V(\"neodrag\",$),Q()}return{destroy:()=>{const t=removeEventListener;t(\"pointerdown\",tt,!1),t(\"pointerup\",et,!1),t(\"pointermove\",nt,!1)},update:e=>{g=e.axis||\"both\",b=e.disabled??!1,w=e.ignoreMultitouch??!1,A=e.handle,f=e.bounds,v=e.recomputeBounds??t,S=e.cancel,y=e.applyUserSelectHack??!0,x=e.grid,h=e.gpuAcceleration??!0,p=e.legacyTranslate??!0,m=e.transform;const n=O.contains(D);O.remove(C,D),C=e.defaultClass??\"neodrag\",N=e.defaultClassDragging??\"neodrag-dragging\",D=e.defaultClassDragged??\"neodrag-dragged\",O.add(C),n&&O.add(D),J&&(k=L=e.position?.x??L,U=P=e.position?.y??P,Q())}}};export{d as draggable};"],"names":["t","e","n","r","o","i","s","a","d","l","c","u","f","g","h","p","m","y","b","w","v","x","E","S","A","C","N","D","M","B","$","R","H","L","P","T","X","k","U","Q","W","j","z","F","G","I","J","K","O","V","Z","_a","_b"],"mappings":"AAAA,IAAIA,IAAE,EAAC,WAAU,GAAE,GAAEC,KAAE,CAACD,GAAEC,GAAEC,MAAI,KAAK,IAAI,KAAK,IAAIF,GAAEC,CAAC,GAAEC,CAAC,GAAEA,IAAE,CAAAF,MAAa,OAAOA,KAAjB,UAAmBG,KAAE,CAAC,CAACH,GAAEC,CAAC,GAAEC,GAAEC,MAAI;AAAC,QAAMC,IAAE,CAACJ,GAAEC,MAAQA,MAAJ,IAAM,IAAE,KAAK,KAAKD,IAAEC,CAAC,IAAEA;AAAE,SAAM,CAACG,EAAEF,GAAEF,CAAC,GAAEI,EAAED,GAAEF,CAAC,CAAC;AAAC,GAAMG,KAAE,CAACJ,GAAEC,MAAID,EAAE,KAAM,CAAAA,MAAGC,EAAE,KAAM,CAAAA,MAAGD,EAAE,SAASC,CAAC,CAAC,CAAI;AAAC,SAASI,EAAEL,GAAEC,GAAE;AAAC,MAAYD,MAAT;AAAW;AAAO,MAAGM,EAAEN,CAAC;AAAE,WAAOA,EAAE,sBAAqB;AAAG,MAAa,OAAOA,KAAjB,UAAmB;AAAC,UAAK,EAAC,KAAIC,IAAE,GAAE,MAAKC,IAAE,GAAE,OAAMC,IAAE,GAAE,QAAOC,IAAE,EAAC,IAAEJ;AAAE,WAAM,EAAC,KAAIC,GAAE,OAAM,OAAO,aAAWE,GAAE,QAAO,OAAO,cAAYC,GAAE,MAAKF,EAAC;AAAA,EAAC;AAAC,MAAcF,MAAX;AAAa,WAAOC,EAAE,WAAW;AAAwB,QAAMC,IAAE,SAAS,cAAcF,CAAC;AAAE,MA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EAAE,aAAF,gBAAAkD,EAAY,MAAGlB,GAAEK,IAAEJ,MAAEkB,IAAAnD,EAAE,aAAF,gBAAAmD,EAAY,MAAGlB,GAAEK,EAAC;AAAA,EAAG,EAAC;AAAC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"annotorious-svelte.es12.js","sources":["../../../node_modules/@neodrag/svelte/dist/min/index.js"],"sourcesContent":["var e={dragStart:!0},t=(e,t,n)=>Math.min(Math.max(e,t),n),n=e=>\"string\"==typeof e,r=([e,t],n,r)=>{const o=(e,t)=>0===t?0:Math.ceil(e/t)*t;return[o(n,e),o(r,t)]};var o=(e,t)=>e.some((e=>t.some((t=>e.contains(t)))));function i(e,t){if(void 0===e)return;if(s(e))return e.getBoundingClientRect();if(\"object\"==typeof e){const{top:t=0,left:n=0,right:r=0,bottom:o=0}=e;return{top:t,right:window.innerWidth-r,bottom:window.innerHeight-o,left:n}}if(\"parent\"===e)return t.parentNode.getBoundingClientRect();const n=document.querySelector(e);if(null===n)throw new Error(\"The selector provided for bound doesn't exists in the document.\");return n.getBoundingClientRect()}var a=(e,t,n)=>e.style.setProperty(t,n),s=e=>e instanceof HTMLElement,d=(d,l={})=>{let c,u,{bounds:f,axis:g=\"both\",gpuAcceleration:h=!0,legacyTranslate:p=!0,transform:m,applyUserSelectHack:w=!0,disabled:y=!1,ignoreMultitouch:b=!1,recomputeBounds:v=e,grid:x,position:E,cancel:S,handle:A,defaultClass:C=\"neodrag\",defaultClassDragging:N=\"neodrag-dragging\",defaultClassDragged:D=\"neodrag-dragged\",defaultPosition:M={x:0,y:0},onDragStart:B,onDrag:$,onDragEnd:R}=l,H=!1,L=0,T=0,X=0,Y=0,q=0,P=0,{x:k,y:z}=E?{x:E?.x??0,y:E?.y??0}:M;V(k,z);let I,U,W,j,F,G=\"\",J=!!E;v={...e,...v};let K=new Set;const O=document.body.style,Q=d.classList;function V(e=L,t=T){if(!m){if(p){let n=`${+e}px, ${+t}px`;return a(d,\"transform\",h?`translate3d(${n}, 0)`:`translate(${n})`)}return a(d,\"translate\",`${+e}px ${+t}px ${h?\"1px\":\"\"}`)}const r=m({offsetX:e,offsetY:t,rootNode:d});n(r)&&a(d,\"transform\",r)}const Z=(e,t)=>{const n={offsetX:L,offsetY:T,rootNode:d,currentNode:F};d.dispatchEvent(new CustomEvent(e,{detail:n})),t?.(n)};const _=addEventListener;_(\"pointerdown\",te,!1),_(\"pointerup\",ne,!1),_(\"pointermove\",re,!1),a(d,\"touch-action\",\"none\");const ee=()=>{let e=d.offsetWidth/U.width;return isNaN(e)&&(e=1),e};function te(e){if(y)return;if(2===e.button)return;if(K.add(e.pointerId),b&&K.size>1)return e.preventDefault();if(v.dragStart&&(I=i(f,d)),n(A)&&n(S)&&A===S)throw new Error(\"`handle` selector can't be same as `cancel` selector\");if(Q.add(C),W=function(e,t){if(!e)return[t];if(s(e))return[e];if(Array.isArray(e))return e;const n=t.querySelectorAll(e);if(null===n)throw new Error(\"Selector passed for `handle` option should be child of the element on which the action is applied\");return Array.from(n.values())}(A,d),j=function(e,t){if(!e)return[];if(s(e))return[e];if(Array.isArray(e))return e;const n=t.querySelectorAll(e);if(null===n)throw new Error(\"Selector passed for `cancel` option should be child of the element on which the action is applied\");return Array.from(n.values())}(S,d),c=/(both|x)/.test(g),u=/(both|y)/.test(g),o(j,W))throw new Error(\"Element being dragged can't be a child of the element on which `cancel` is applied\");const t=e.composedPath()[0];if(!W.some((e=>e.contains(t)||e.shadowRoot?.contains(t)))||o(j,[t]))return;F=1===W.length?d:W.find((e=>e.contains(t))),H=!0,U=d.getBoundingClientRect(),w&&(G=O.userSelect,O.userSelect=\"none\"),Z(\"neodrag:start\",B);const{clientX:r,clientY:a}=e,l=ee();c&&(X=r-k/l),u&&(Y=a-z/l),I&&(q=r-U.left,P=a-U.top)}function ne(e){K.delete(e.pointerId),H&&(v.dragEnd&&(I=i(f,d)),Q.remove(N),Q.add(D),w&&(O.userSelect=G),Z(\"neodrag:end\",R),c&&(X=L),u&&(Y=T),H=!1)}function re(e){if(!H||b&&K.size>1)return;v.drag&&(I=i(f,d)),Q.add(N),e.preventDefault(),U=d.getBoundingClientRect();let n=e.clientX,o=e.clientY;const a=ee();if(I){const e={left:I.left+q,top:I.top+P,right:I.right+q-U.width,bottom:I.bottom+P-U.height};n=t(n,e.left,e.right),o=t(o,e.top,e.bottom)}if(Array.isArray(x)){let[e,t]=x;if(isNaN(+e)||e<0)throw new Error(\"1st argument of `grid` must be a valid positive number\");if(isNaN(+t)||t<0)throw new Error(\"2nd argument of `grid` must be a valid positive number\");let i=n-X,s=o-Y;[i,s]=r([e/a,t/a],i,s),n=X+i,o=Y+s}c&&(L=Math.round((n-X)*a)),u&&(T=Math.round((o-Y)*a)),k=L,z=T,Z(\"neodrag\",$),V()}return{destroy:()=>{const e=removeEventListener;e(\"pointerdown\",te,!1),e(\"pointerup\",ne,!1),e(\"pointermove\",re,!1)},update:t=>{g=t.axis||\"both\",y=t.disabled??!1,b=t.ignoreMultitouch??!1,A=t.handle,f=t.bounds,v=t.recomputeBounds??e,S=t.cancel,w=t.applyUserSelectHack??!0,x=t.grid,h=t.gpuAcceleration??!0,p=t.legacyTranslate??!0,m=t.transform;const n=Q.contains(D);Q.remove(C,D),C=t.defaultClass??\"neodrag\",N=t.defaultClassDragging??\"neodrag-dragging\",D=t.defaultClassDragged??\"neodrag-dragged\",Q.add(C),n&&Q.add(D),J&&(k=L=t.position?.x??L,z=T=t.position?.y??T,V())}}};\n//!THIS IS HACK, WE WANNA IMPORT THE TYPE WHEN THE ISSUE IS FIXED LATER\nexport{d as draggable};"],"names":["e","t","n","r","o","i","s","a","d","l","c","u","f","g","h","p","m","w","y","b","v","x","E","S","A","C","N","D","M","B","$","R","H","L","T","X","Y","q","P","k","z","V","I","U","W","j","F","G","J","K","O","Q","Z","_","_a","_b"],"mappings":"AAAA,IAAIA,IAAE,EAAC,WAAU,GAAE,GAAEC,KAAE,CAACD,GAAEC,GAAEC,MAAI,KAAK,IAAI,KAAK,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
|
-
{"version":3,"file":"annotorious-svelte.es9.js","sources":["../../../node_modules/svelte/src/runtime/internal/Component.js"],"sourcesContent":["import {\n\tadd_render_callback,\n\tflush,\n\tflush_render_callbacks,\n\tschedule_update,\n\tdirty_components\n} from './scheduler.js';\nimport { current_component, set_current_component } from './lifecycle.js';\nimport { blank_object, is_empty, is_function, run, run_all, noop } from './utils.js';\nimport {\n\tchildren,\n\tdetach,\n\tstart_hydrating,\n\tend_hydrating,\n\tget_custom_elements_slots,\n\tinsert,\n\telement,\n\tattr\n} from './dom.js';\nimport { transition_in } from './transitions.js';\n\n/** @returns {void} */\nexport function bind(component, name, callback) {\n\tconst index = component.$$.props[name];\n\tif (index !== undefined) {\n\t\tcomponent.$$.bound[index] = callback;\n\t\tcallback(component.$$.ctx[index]);\n\t}\n}\n\n/** @returns {void} */\nexport function create_component(block) {\n\tblock && block.c();\n}\n\n/** @returns {void} */\nexport function claim_component(block, parent_nodes) {\n\tblock && block.l(parent_nodes);\n}\n\n/** @returns {void} */\nexport function mount_component(component, target, anchor) {\n\tconst { fragment, after_update } = component.$$;\n\tfragment && fragment.m(target, anchor);\n\t// onMount happens before the initial afterUpdate\n\tadd_render_callback(() => {\n\t\tconst new_on_destroy = component.$$.on_mount.map(run).filter(is_function);\n\t\t// if the component was destroyed immediately\n\t\t// it will update the `$$.on_destroy` reference to `null`.\n\t\t// the destructured on_destroy may still reference to the old array\n\t\tif (component.$$.on_destroy) {\n\t\t\tcomponent.$$.on_destroy.push(...new_on_destroy);\n\t\t} else {\n\t\t\t// Edge case - component was destroyed immediately,\n\t\t\t// most likely as a result of a binding initialising\n\t\t\trun_all(new_on_destroy);\n\t\t}\n\t\tcomponent.$$.on_mount = [];\n\t});\n\tafter_update.forEach(add_render_callback);\n}\n\n/** @returns {void} */\nexport function destroy_component(component, detaching) {\n\tconst $$ = component.$$;\n\tif ($$.fragment !== null) {\n\t\tflush_render_callbacks($$.after_update);\n\t\trun_all($$.on_destroy);\n\t\t$$.fragment && $$.fragment.d(detaching);\n\t\t// TODO null out other refs, including component.$$ (but need to\n\t\t// preserve final state?)\n\t\t$$.on_destroy = $$.fragment = null;\n\t\t$$.ctx = [];\n\t}\n}\n\n/** @returns {void} */\nfunction make_dirty(component, i) {\n\tif (component.$$.dirty[0] === -1) {\n\t\tdirty_components.push(component);\n\t\tschedule_update();\n\t\tcomponent.$$.dirty.fill(0);\n\t}\n\tcomponent.$$.dirty[(i / 31) | 0] |= 1 << i % 31;\n}\n\n// TODO: Document the other params\n/**\n * @param {SvelteComponent} component\n * @param {import('./public.js').ComponentConstructorOptions} options\n *\n * @param {import('./utils.js')['not_equal']} not_equal Used to compare props and state values.\n * @param {(target: Element | ShadowRoot) => void} [append_styles] Function that appends styles to the DOM when the component is first initialised.\n * This will be the `add_css` function from the compiled component.\n *\n * @returns {void}\n */\nexport function init(\n\tcomponent,\n\toptions,\n\tinstance,\n\tcreate_fragment,\n\tnot_equal,\n\tprops,\n\tappend_styles = null,\n\tdirty = [-1]\n) {\n\tconst parent_component = current_component;\n\tset_current_component(component);\n\t/** @type {import('./private.js').T$$} */\n\tconst $$ = (component.$$ = {\n\t\tfragment: null,\n\t\tctx: [],\n\t\t// state\n\t\tprops,\n\t\tupdate: noop,\n\t\tnot_equal,\n\t\tbound: blank_object(),\n\t\t// lifecycle\n\t\ton_mount: [],\n\t\ton_destroy: [],\n\t\ton_disconnect: [],\n\t\tbefore_update: [],\n\t\tafter_update: [],\n\t\tcontext: new Map(options.context || (parent_component ? parent_component.$$.context : [])),\n\t\t// everything else\n\t\tcallbacks: blank_object(),\n\t\tdirty,\n\t\tskip_bound: false,\n\t\troot: options.target || parent_component.$$.root\n\t});\n\tappend_styles && append_styles($$.root);\n\tlet ready = false;\n\t$$.ctx = instance\n\t\t? instance(component, options.props || {}, (i, ret, ...rest) => {\n\t\t\t\tconst value = rest.length ? rest[0] : ret;\n\t\t\t\tif ($$.ctx && not_equal($$.ctx[i], ($$.ctx[i] = value))) {\n\t\t\t\t\tif (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);\n\t\t\t\t\tif (ready) make_dirty(component, i);\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t })\n\t\t: [];\n\t$$.update();\n\tready = true;\n\trun_all($$.before_update);\n\t// `false` as a special case of no DOM component\n\t$$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n\tif (options.target) {\n\t\tif (options.hydrate) {\n\t\t\tstart_hydrating();\n\t\t\t// TODO: what is the correct type here?\n\t\t\t// @ts-expect-error\n\t\t\tconst nodes = children(options.target);\n\t\t\t$$.fragment && $$.fragment.l(nodes);\n\t\t\tnodes.forEach(detach);\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t$$.fragment && $$.fragment.c();\n\t\t}\n\t\tif (options.intro) transition_in(component.$$.fragment);\n\t\tmount_component(component, options.target, options.anchor);\n\t\tend_hydrating();\n\t\tflush();\n\t}\n\tset_current_component(parent_component);\n}\n\nexport let SvelteElement;\n\nif (typeof HTMLElement === 'function') {\n\tSvelteElement = class extends HTMLElement {\n\t\t/** The Svelte component constructor */\n\t\t$$ctor;\n\t\t/** Slots */\n\t\t$$s;\n\t\t/** The Svelte component instance */\n\t\t$$c;\n\t\t/** Whether or not the custom element is connected */\n\t\t$$cn = false;\n\t\t/** Component props data */\n\t\t$$d = {};\n\t\t/** `true` if currently in the process of reflecting component props back to attributes */\n\t\t$$r = false;\n\t\t/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */\n\t\t$$p_d = {};\n\t\t/** @type {Record<string, Function[]>} Event listeners */\n\t\t$$l = {};\n\t\t/** @type {Map<Function, Function>} Event listener unsubscribe functions */\n\t\t$$l_u = new Map();\n\n\t\tconstructor($$componentCtor, $$slots, use_shadow_dom) {\n\t\t\tsuper();\n\t\t\tthis.$$ctor = $$componentCtor;\n\t\t\tthis.$$s = $$slots;\n\t\t\tif (use_shadow_dom) {\n\t\t\t\tthis.attachShadow({ mode: 'open' });\n\t\t\t}\n\t\t}\n\n\t\taddEventListener(type, listener, options) {\n\t\t\t// We can't determine upfront if the event is a custom event or not, so we have to\n\t\t\t// listen to both. If someone uses a custom event with the same name as a regular\n\t\t\t// browser event, this fires twice - we can't avoid that.\n\t\t\tthis.$$l[type] = this.$$l[type] || [];\n\t\t\tthis.$$l[type].push(listener);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t}\n\t\t\tsuper.addEventListener(type, listener, options);\n\t\t}\n\n\t\tremoveEventListener(type, listener, options) {\n\t\t\tsuper.removeEventListener(type, listener, options);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$l_u.get(listener);\n\t\t\t\tif (unsub) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tthis.$$l_u.delete(listener);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tasync connectedCallback() {\n\t\t\tthis.$$cn = true;\n\t\t\tif (!this.$$c) {\n\t\t\t\t// We wait one tick to let possible child slot elements be created/mounted\n\t\t\t\tawait Promise.resolve();\n\t\t\t\tif (!this.$$cn || this.$$c) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfunction create_slot(name) {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tlet node;\n\t\t\t\t\t\tconst obj = {\n\t\t\t\t\t\t\tc: function create() {\n\t\t\t\t\t\t\t\tnode = element('slot');\n\t\t\t\t\t\t\t\tif (name !== 'default') {\n\t\t\t\t\t\t\t\t\tattr(node, 'name', name);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * @param {HTMLElement} target\n\t\t\t\t\t\t\t * @param {HTMLElement} [anchor]\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tm: function mount(target, anchor) {\n\t\t\t\t\t\t\t\tinsert(target, node, anchor);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\td: function destroy(detaching) {\n\t\t\t\t\t\t\t\tif (detaching) {\n\t\t\t\t\t\t\t\t\tdetach(node);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn obj;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst $$slots = {};\n\t\t\t\tconst existing_slots = get_custom_elements_slots(this);\n\t\t\t\tfor (const name of this.$$s) {\n\t\t\t\t\tif (name in existing_slots) {\n\t\t\t\t\t\t$$slots[name] = [create_slot(name)];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const attribute of this.attributes) {\n\t\t\t\t\t// this.$$data takes precedence over this.attributes\n\t\t\t\t\tconst name = this.$$g_p(attribute.name);\n\t\t\t\t\tif (!(name in this.$$d)) {\n\t\t\t\t\t\tthis.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Port over props that were set programmatically before ce was initialized\n\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\tif (!(key in this.$$d) && this[key] !== undefined) {\n\t\t\t\t\t\tthis.$$d[key] = this[key]; // don't transform, these were set through JavaScript\n\t\t\t\t\t\tdelete this[key]; // remove the property that shadows the getter/setter\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$c = new this.$$ctor({\n\t\t\t\t\ttarget: this.shadowRoot || this,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...this.$$d,\n\t\t\t\t\t\t$$slots,\n\t\t\t\t\t\t$$scope: {\n\t\t\t\t\t\t\tctx: []\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Reflect component props as attributes\n\t\t\t\tconst reflect_attributes = () => {\n\t\t\t\t\tthis.$$r = true;\n\t\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\t\tthis.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]];\n\t\t\t\t\t\tif (this.$$p_d[key].reflect) {\n\t\t\t\t\t\t\tconst attribute_value = get_custom_element_value(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tthis.$$d[key],\n\t\t\t\t\t\t\t\tthis.$$p_d,\n\t\t\t\t\t\t\t\t'toAttribute'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (attribute_value == null) {\n\t\t\t\t\t\t\t\tthis.removeAttribute(this.$$p_d[key].attribute || key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.setAttribute(this.$$p_d[key].attribute || key, attribute_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.$$r = false;\n\t\t\t\t};\n\t\t\t\tthis.$$c.$$.after_update.push(reflect_attributes);\n\t\t\t\treflect_attributes(); // once initially because after_update is added too late for first render\n\n\t\t\t\tfor (const type in this.$$l) {\n\t\t\t\t\tfor (const listener of this.$$l[type]) {\n\t\t\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$l = {};\n\t\t\t}\n\t\t}\n\n\t\t// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte\n\t\t// and setting attributes through setAttribute etc, this is helpful\n\t\tattributeChangedCallback(attr, _oldValue, newValue) {\n\t\t\tif (this.$$r) return;\n\t\t\tattr = this.$$g_p(attr);\n\t\t\tthis.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');\n\t\t\tthis.$$c?.$set({ [attr]: this.$$d[attr] });\n\t\t}\n\n\t\tdisconnectedCallback() {\n\t\t\tthis.$$cn = false;\n\t\t\t// In a microtask, because this could be a move within the DOM\n\t\t\tPromise.resolve().then(() => {\n\t\t\t\tif (!this.$$cn) {\n\t\t\t\t\tthis.$$c.$destroy();\n\t\t\t\t\tthis.$$c = undefined;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t$$g_p(attribute_name) {\n\t\t\treturn (\n\t\t\t\tObject.keys(this.$$p_d).find(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tthis.$$p_d[key].attribute === attribute_name ||\n\t\t\t\t\t\t(!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name)\n\t\t\t\t) || attribute_name\n\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * @param {string} prop\n * @param {any} value\n * @param {Record<string, CustomElementPropDefinition>} props_definition\n * @param {'toAttribute' | 'toProp'} [transform]\n */\nfunction get_custom_element_value(prop, value, props_definition, transform) {\n\tconst type = props_definition[prop]?.type;\n\tvalue = type === 'Boolean' && typeof value !== 'boolean' ? value != null : value;\n\tif (!transform || !props_definition[prop]) {\n\t\treturn value;\n\t} else if (transform === 'toAttribute') {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value == null ? null : JSON.stringify(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value ? '' : null;\n\t\t\tcase 'Number':\n\t\t\t\treturn value == null ? null : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value && JSON.parse(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value; // conversion already handled above\n\t\t\tcase 'Number':\n\t\t\t\treturn value != null ? +value : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t}\n}\n\n/**\n * @internal\n *\n * Turn a Svelte component into a custom element.\n * @param {import('./public.js').ComponentType} Component A Svelte component constructor\n * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe\n * @param {string[]} slots The slots to create\n * @param {string[]} accessors Other accessors besides the ones for props the component has\n * @param {boolean} use_shadow_dom Whether to use shadow DOM\n * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]\n */\nexport function create_custom_element(\n\tComponent,\n\tprops_definition,\n\tslots,\n\taccessors,\n\tuse_shadow_dom,\n\textend\n) {\n\tlet Class = class extends SvelteElement {\n\t\tconstructor() {\n\t\t\tsuper(Component, slots, use_shadow_dom);\n\t\t\tthis.$$p_d = props_definition;\n\t\t}\n\t\tstatic get observedAttributes() {\n\t\t\treturn Object.keys(props_definition).map((key) =>\n\t\t\t\t(props_definition[key].attribute || key).toLowerCase()\n\t\t\t);\n\t\t}\n\t};\n\tObject.keys(props_definition).forEach((prop) => {\n\t\tObject.defineProperty(Class.prototype, prop, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];\n\t\t\t},\n\t\t\tset(value) {\n\t\t\t\tvalue = get_custom_element_value(prop, value, props_definition);\n\t\t\t\tthis.$$d[prop] = value;\n\t\t\t\tthis.$$c?.$set({ [prop]: value });\n\t\t\t}\n\t\t});\n\t});\n\taccessors.forEach((accessor) => {\n\t\tObject.defineProperty(Class.prototype, accessor, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c?.[accessor];\n\t\t\t}\n\t\t});\n\t});\n\tif (extend) {\n\t\t// @ts-expect-error - assigning here is fine\n\t\tClass = extend(Class);\n\t}\n\tComponent.element = /** @type {any} */ (Class);\n\treturn Class;\n}\n\n/**\n * Base class for Svelte components. Used when dev=false.\n *\n * @template {Record<string, any>} [Props=any]\n * @template {Record<string, any>} [Events=any]\n */\nexport class SvelteComponent {\n\t/**\n\t * ### PRIVATE API\n\t *\n\t * Do not use, may change at any time\n\t *\n\t * @type {any}\n\t */\n\t$$ = undefined;\n\t/**\n\t * ### PRIVATE API\n\t *\n\t * Do not use, may change at any time\n\t *\n\t * @type {any}\n\t */\n\t$$set = undefined;\n\n\t/** @returns {void} */\n\t$destroy() {\n\t\tdestroy_component(this, 1);\n\t\tthis.$destroy = noop;\n\t}\n\n\t/**\n\t * @template {Extract<keyof Events, string>} K\n\t * @param {K} type\n\t * @param {((e: Events[K]) => void) | null | undefined} callback\n\t * @returns {() => void}\n\t */\n\t$on(type, callback) {\n\t\tif (!is_function(callback)) {\n\t\t\treturn noop;\n\t\t}\n\t\tconst callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);\n\t\tcallbacks.push(callback);\n\t\treturn () => {\n\t\t\tconst index = callbacks.indexOf(callback);\n\t\t\tif (index !== -1) callbacks.splice(index, 1);\n\t\t};\n\t}\n\n\t/**\n\t * @param {Partial<Props>} props\n\t * @returns {void}\n\t */\n\t$set(props) {\n\t\tif (this.$$set && !is_empty(props)) {\n\t\t\tthis.$$.skip_bound = true;\n\t\t\tthis.$$set(props);\n\t\t\tthis.$$.skip_bound = false;\n\t\t}\n\t}\n}\n\n/**\n * @typedef {Object} CustomElementPropDefinition\n * @property {string} [attribute]\n * @property {boolean} [reflect]\n * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]\n */\n"],"names":["mount_component","component","target","anchor","fragment","after_update","add_render_callback","new_on_destroy","run","is_function","run_all","destroy_component","detaching","$$","flush_render_callbacks","make_dirty","i","dirty_components","schedule_update","init","options","instance","create_fragment","not_equal","props","append_styles","dirty","parent_component","current_component","set_current_component","noop","blank_object","ready","ret","rest","value","nodes","children","detach","transition_in","flush","SvelteComponent","__publicField","type","callback","callbacks","index","is_empty"],"mappings":";;;;;;;;AAyCO,SAASA,EAAgBC,GAAWC,GAAQC,GAAQ;AAC1D,QAAM,EAAE,UAAAC,GAAU,cAAAC,MAAiBJ,EAAU;AAC7C,EAAAG,KAAYA,EAAS,EAAEF,GAAQC,CAAM,GAErCG,EAAoB,MAAM;AACzB,UAAMC,IAAiBN,EAAU,GAAG,SAAS,IAAIO,CAAG,EAAE,OAAOC,CAAW;AAIxE,IAAIR,EAAU,GAAG,aAChBA,EAAU,GAAG,WAAW,KAAK,GAAGM,CAAc,IAI9CG,EAAQH,CAAc,GAEvBN,EAAU,GAAG,WAAW;EAC1B,CAAE,GACDI,EAAa,QA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B,aAAOd;AAER,UAAMe,IAAY,KAAK,GAAG,UAAUF,CAAI,MAAM,KAAK,GAAG,UAAUA,CAAI,IAAI,CAAE;AAC1E,WAAAE,EAAU,KAAKD,CAAQ,GAChB,MAAM;AACZ,YAAME,IAAQD,EAAU,QAAQD,CAAQ;AACxC,MAAIE,MAAU,MAAID,EAAU,OAAOC,GAAO,CAAC;AAAA,IAC9C;AAAA,EACE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,KAAKtB,GAAO;AACX,IAAI,KAAK,SAAS,CAACuB,EAASvB,CAAK,MAChC,KAAK,GAAG,aAAa,IACrB,KAAK,MAAMA,CAAK,GAChB,KAAK,GAAG,aAAa;AAAA,EAEtB;AACF;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"annotorious-svelte.es9.js","sources":["../../../node_modules/svelte/src/runtime/internal/Component.js"],"sourcesContent":["import {\n\tadd_render_callback,\n\tflush,\n\tflush_render_callbacks,\n\tschedule_update,\n\tdirty_components\n} from './scheduler.js';\nimport { current_component, set_current_component } from './lifecycle.js';\nimport { blank_object, is_empty, is_function, run, run_all, noop } from './utils.js';\nimport {\n\tchildren,\n\tdetach,\n\tstart_hydrating,\n\tend_hydrating,\n\tget_custom_elements_slots,\n\tinsert,\n\telement,\n\tattr\n} from './dom.js';\nimport { transition_in } from './transitions.js';\n\n/** @returns {void} */\nexport function bind(component, name, callback) {\n\tconst index = component.$$.props[name];\n\tif (index !== undefined) {\n\t\tcomponent.$$.bound[index] = callback;\n\t\tcallback(component.$$.ctx[index]);\n\t}\n}\n\n/** @returns {void} */\nexport function create_component(block) {\n\tblock && block.c();\n}\n\n/** @returns {void} */\nexport function claim_component(block, parent_nodes) {\n\tblock && block.l(parent_nodes);\n}\n\n/** @returns {void} */\nexport function mount_component(component, target, anchor) {\n\tconst { fragment, after_update } = component.$$;\n\tfragment && fragment.m(target, anchor);\n\t// onMount happens before the initial afterUpdate\n\tadd_render_callback(() => {\n\t\tconst new_on_destroy = component.$$.on_mount.map(run).filter(is_function);\n\t\t// if the component was destroyed immediately\n\t\t// it will update the `$$.on_destroy` reference to `null`.\n\t\t// the destructured on_destroy may still reference to the old array\n\t\tif (component.$$.on_destroy) {\n\t\t\tcomponent.$$.on_destroy.push(...new_on_destroy);\n\t\t} else {\n\t\t\t// Edge case - component was destroyed immediately,\n\t\t\t// most likely as a result of a binding initialising\n\t\t\trun_all(new_on_destroy);\n\t\t}\n\t\tcomponent.$$.on_mount = [];\n\t});\n\tafter_update.forEach(add_render_callback);\n}\n\n/** @returns {void} */\nexport function destroy_component(component, detaching) {\n\tconst $$ = component.$$;\n\tif ($$.fragment !== null) {\n\t\tflush_render_callbacks($$.after_update);\n\t\trun_all($$.on_destroy);\n\t\t$$.fragment && $$.fragment.d(detaching);\n\t\t// TODO null out other refs, including component.$$ (but need to\n\t\t// preserve final state?)\n\t\t$$.on_destroy = $$.fragment = null;\n\t\t$$.ctx = [];\n\t}\n}\n\n/** @returns {void} */\nfunction make_dirty(component, i) {\n\tif (component.$$.dirty[0] === -1) {\n\t\tdirty_components.push(component);\n\t\tschedule_update();\n\t\tcomponent.$$.dirty.fill(0);\n\t}\n\tcomponent.$$.dirty[(i / 31) | 0] |= 1 << i % 31;\n}\n\n// TODO: Document the other params\n/**\n * @param {SvelteComponent} component\n * @param {import('./public.js').ComponentConstructorOptions} options\n *\n * @param {import('./utils.js')['not_equal']} not_equal Used to compare props and state values.\n * @param {(target: Element | ShadowRoot) => void} [append_styles] Function that appends styles to the DOM when the component is first initialised.\n * This will be the `add_css` function from the compiled component.\n *\n * @returns {void}\n */\nexport function init(\n\tcomponent,\n\toptions,\n\tinstance,\n\tcreate_fragment,\n\tnot_equal,\n\tprops,\n\tappend_styles = null,\n\tdirty = [-1]\n) {\n\tconst parent_component = current_component;\n\tset_current_component(component);\n\t/** @type {import('./private.js').T$$} */\n\tconst $$ = (component.$$ = {\n\t\tfragment: null,\n\t\tctx: [],\n\t\t// state\n\t\tprops,\n\t\tupdate: noop,\n\t\tnot_equal,\n\t\tbound: blank_object(),\n\t\t// lifecycle\n\t\ton_mount: [],\n\t\ton_destroy: [],\n\t\ton_disconnect: [],\n\t\tbefore_update: [],\n\t\tafter_update: [],\n\t\tcontext: new Map(options.context || (parent_component ? parent_component.$$.context : [])),\n\t\t// everything else\n\t\tcallbacks: blank_object(),\n\t\tdirty,\n\t\tskip_bound: false,\n\t\troot: options.target || parent_component.$$.root\n\t});\n\tappend_styles && append_styles($$.root);\n\tlet ready = false;\n\t$$.ctx = instance\n\t\t? instance(component, options.props || {}, (i, ret, ...rest) => {\n\t\t\t\tconst value = rest.length ? rest[0] : ret;\n\t\t\t\tif ($$.ctx && not_equal($$.ctx[i], ($$.ctx[i] = value))) {\n\t\t\t\t\tif (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);\n\t\t\t\t\tif (ready) make_dirty(component, i);\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t })\n\t\t: [];\n\t$$.update();\n\tready = true;\n\trun_all($$.before_update);\n\t// `false` as a special case of no DOM component\n\t$$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n\tif (options.target) {\n\t\tif (options.hydrate) {\n\t\t\tstart_hydrating();\n\t\t\t// TODO: what is the correct type here?\n\t\t\t// @ts-expect-error\n\t\t\tconst nodes = children(options.target);\n\t\t\t$$.fragment && $$.fragment.l(nodes);\n\t\t\tnodes.forEach(detach);\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t$$.fragment && $$.fragment.c();\n\t\t}\n\t\tif (options.intro) transition_in(component.$$.fragment);\n\t\tmount_component(component, options.target, options.anchor);\n\t\tend_hydrating();\n\t\tflush();\n\t}\n\tset_current_component(parent_component);\n}\n\nexport let SvelteElement;\n\nif (typeof HTMLElement === 'function') {\n\tSvelteElement = class extends HTMLElement {\n\t\t/** The Svelte component constructor */\n\t\t$$ctor;\n\t\t/** Slots */\n\t\t$$s;\n\t\t/** The Svelte component instance */\n\t\t$$c;\n\t\t/** Whether or not the custom element is connected */\n\t\t$$cn = false;\n\t\t/** Component props data */\n\t\t$$d = {};\n\t\t/** `true` if currently in the process of reflecting component props back to attributes */\n\t\t$$r = false;\n\t\t/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */\n\t\t$$p_d = {};\n\t\t/** @type {Record<string, Function[]>} Event listeners */\n\t\t$$l = {};\n\t\t/** @type {Map<Function, Function>} Event listener unsubscribe functions */\n\t\t$$l_u = new Map();\n\n\t\tconstructor($$componentCtor, $$slots, use_shadow_dom) {\n\t\t\tsuper();\n\t\t\tthis.$$ctor = $$componentCtor;\n\t\t\tthis.$$s = $$slots;\n\t\t\tif (use_shadow_dom) {\n\t\t\t\tthis.attachShadow({ mode: 'open' });\n\t\t\t}\n\t\t}\n\n\t\taddEventListener(type, listener, options) {\n\t\t\t// We can't determine upfront if the event is a custom event or not, so we have to\n\t\t\t// listen to both. If someone uses a custom event with the same name as a regular\n\t\t\t// browser event, this fires twice - we can't avoid that.\n\t\t\tthis.$$l[type] = this.$$l[type] || [];\n\t\t\tthis.$$l[type].push(listener);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t}\n\t\t\tsuper.addEventListener(type, listener, options);\n\t\t}\n\n\t\tremoveEventListener(type, listener, options) {\n\t\t\tsuper.removeEventListener(type, listener, options);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$l_u.get(listener);\n\t\t\t\tif (unsub) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tthis.$$l_u.delete(listener);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tasync connectedCallback() {\n\t\t\tthis.$$cn = true;\n\t\t\tif (!this.$$c) {\n\t\t\t\t// We wait one tick to let possible child slot elements be created/mounted\n\t\t\t\tawait Promise.resolve();\n\t\t\t\tif (!this.$$cn || this.$$c) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfunction create_slot(name) {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tlet node;\n\t\t\t\t\t\tconst obj = {\n\t\t\t\t\t\t\tc: function create() {\n\t\t\t\t\t\t\t\tnode = element('slot');\n\t\t\t\t\t\t\t\tif (name !== 'default') {\n\t\t\t\t\t\t\t\t\tattr(node, 'name', name);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * @param {HTMLElement} target\n\t\t\t\t\t\t\t * @param {HTMLElement} [anchor]\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tm: function mount(target, anchor) {\n\t\t\t\t\t\t\t\tinsert(target, node, anchor);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\td: function destroy(detaching) {\n\t\t\t\t\t\t\t\tif (detaching) {\n\t\t\t\t\t\t\t\t\tdetach(node);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn obj;\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst $$slots = {};\n\t\t\t\tconst existing_slots = get_custom_elements_slots(this);\n\t\t\t\tfor (const name of this.$$s) {\n\t\t\t\t\tif (name in existing_slots) {\n\t\t\t\t\t\t$$slots[name] = [create_slot(name)];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const attribute of this.attributes) {\n\t\t\t\t\t// this.$$data takes precedence over this.attributes\n\t\t\t\t\tconst name = this.$$g_p(attribute.name);\n\t\t\t\t\tif (!(name in this.$$d)) {\n\t\t\t\t\t\tthis.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Port over props that were set programmatically before ce was initialized\n\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\tif (!(key in this.$$d) && this[key] !== undefined) {\n\t\t\t\t\t\tthis.$$d[key] = this[key]; // don't transform, these were set through JavaScript\n\t\t\t\t\t\tdelete this[key]; // remove the property that shadows the getter/setter\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$c = new this.$$ctor({\n\t\t\t\t\ttarget: this.shadowRoot || this,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...this.$$d,\n\t\t\t\t\t\t$$slots,\n\t\t\t\t\t\t$$scope: {\n\t\t\t\t\t\t\tctx: []\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Reflect component props as attributes\n\t\t\t\tconst reflect_attributes = () => {\n\t\t\t\t\tthis.$$r = true;\n\t\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\t\tthis.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]];\n\t\t\t\t\t\tif (this.$$p_d[key].reflect) {\n\t\t\t\t\t\t\tconst attribute_value = get_custom_element_value(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tthis.$$d[key],\n\t\t\t\t\t\t\t\tthis.$$p_d,\n\t\t\t\t\t\t\t\t'toAttribute'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (attribute_value == null) {\n\t\t\t\t\t\t\t\tthis.removeAttribute(this.$$p_d[key].attribute || key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.setAttribute(this.$$p_d[key].attribute || key, attribute_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.$$r = false;\n\t\t\t\t};\n\t\t\t\tthis.$$c.$$.after_update.push(reflect_attributes);\n\t\t\t\treflect_attributes(); // once initially because after_update is added too late for first render\n\n\t\t\t\tfor (const type in this.$$l) {\n\t\t\t\t\tfor (const listener of this.$$l[type]) {\n\t\t\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$l = {};\n\t\t\t}\n\t\t}\n\n\t\t// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte\n\t\t// and setting attributes through setAttribute etc, this is helpful\n\t\tattributeChangedCallback(attr, _oldValue, newValue) {\n\t\t\tif (this.$$r) return;\n\t\t\tattr = this.$$g_p(attr);\n\t\t\tthis.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');\n\t\t\tthis.$$c?.$set({ [attr]: this.$$d[attr] });\n\t\t}\n\n\t\tdisconnectedCallback() {\n\t\t\tthis.$$cn = false;\n\t\t\t// In a microtask, because this could be a move within the DOM\n\t\t\tPromise.resolve().then(() => {\n\t\t\t\tif (!this.$$cn && this.$$c) {\n\t\t\t\t\tthis.$$c.$destroy();\n\t\t\t\t\tthis.$$c = undefined;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t$$g_p(attribute_name) {\n\t\t\treturn (\n\t\t\t\tObject.keys(this.$$p_d).find(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tthis.$$p_d[key].attribute === attribute_name ||\n\t\t\t\t\t\t(!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name)\n\t\t\t\t) || attribute_name\n\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * @param {string} prop\n * @param {any} value\n * @param {Record<string, CustomElementPropDefinition>} props_definition\n * @param {'toAttribute' | 'toProp'} [transform]\n */\nfunction get_custom_element_value(prop, value, props_definition, transform) {\n\tconst type = props_definition[prop]?.type;\n\tvalue = type === 'Boolean' && typeof value !== 'boolean' ? value != null : value;\n\tif (!transform || !props_definition[prop]) {\n\t\treturn value;\n\t} else if (transform === 'toAttribute') {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value == null ? null : JSON.stringify(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value ? '' : null;\n\t\t\tcase 'Number':\n\t\t\t\treturn value == null ? null : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value && JSON.parse(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value; // conversion already handled above\n\t\t\tcase 'Number':\n\t\t\t\treturn value != null ? +value : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t}\n}\n\n/**\n * @internal\n *\n * Turn a Svelte component into a custom element.\n * @param {import('./public.js').ComponentType} Component A Svelte component constructor\n * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe\n * @param {string[]} slots The slots to create\n * @param {string[]} accessors Other accessors besides the ones for props the component has\n * @param {boolean} use_shadow_dom Whether to use shadow DOM\n * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]\n */\nexport function create_custom_element(\n\tComponent,\n\tprops_definition,\n\tslots,\n\taccessors,\n\tuse_shadow_dom,\n\textend\n) {\n\tlet Class = class extends SvelteElement {\n\t\tconstructor() {\n\t\t\tsuper(Component, slots, use_shadow_dom);\n\t\t\tthis.$$p_d = props_definition;\n\t\t}\n\t\tstatic get observedAttributes() {\n\t\t\treturn Object.keys(props_definition).map((key) =>\n\t\t\t\t(props_definition[key].attribute || key).toLowerCase()\n\t\t\t);\n\t\t}\n\t};\n\tObject.keys(props_definition).forEach((prop) => {\n\t\tObject.defineProperty(Class.prototype, prop, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];\n\t\t\t},\n\t\t\tset(value) {\n\t\t\t\tvalue = get_custom_element_value(prop, value, props_definition);\n\t\t\t\tthis.$$d[prop] = value;\n\t\t\t\tthis.$$c?.$set({ [prop]: value });\n\t\t\t}\n\t\t});\n\t});\n\taccessors.forEach((accessor) => {\n\t\tObject.defineProperty(Class.prototype, accessor, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c?.[accessor];\n\t\t\t}\n\t\t});\n\t});\n\tif (extend) {\n\t\t// @ts-expect-error - assigning here is fine\n\t\tClass = extend(Class);\n\t}\n\tComponent.element = /** @type {any} */ (Class);\n\treturn Class;\n}\n\n/**\n * Base class for Svelte components. Used when dev=false.\n *\n * @template {Record<string, any>} [Props=any]\n * @template {Record<string, any>} [Events=any]\n */\nexport class SvelteComponent {\n\t/**\n\t * ### PRIVATE API\n\t *\n\t * Do not use, may change at any time\n\t *\n\t * @type {any}\n\t */\n\t$$ = undefined;\n\t/**\n\t * ### PRIVATE API\n\t *\n\t * Do not use, may change at any time\n\t *\n\t * @type {any}\n\t */\n\t$$set = undefined;\n\n\t/** @returns {void} */\n\t$destroy() {\n\t\tdestroy_component(this, 1);\n\t\tthis.$destroy = noop;\n\t}\n\n\t/**\n\t * @template {Extract<keyof Events, string>} K\n\t * @param {K} type\n\t * @param {((e: Events[K]) => void) | null | undefined} callback\n\t * @returns {() => void}\n\t */\n\t$on(type, callback) {\n\t\tif (!is_function(callback)) {\n\t\t\treturn noop;\n\t\t}\n\t\tconst callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);\n\t\tcallbacks.push(callback);\n\t\treturn () => {\n\t\t\tconst index = callbacks.indexOf(callback);\n\t\t\tif (index !== -1) callbacks.splice(index, 1);\n\t\t};\n\t}\n\n\t/**\n\t * @param {Partial<Props>} props\n\t * @returns {void}\n\t */\n\t$set(props) {\n\t\tif (this.$$set && !is_empty(props)) {\n\t\t\tthis.$$.skip_bound = true;\n\t\t\tthis.$$set(props);\n\t\t\tthis.$$.skip_bound = false;\n\t\t}\n\t}\n}\n\n/**\n * @typedef {Object} CustomElementPropDefinition\n * @property {string} [attribute]\n * @property {boolean} [reflect]\n * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]\n */\n"],"names":["mount_component","component","target","anchor","fragment","after_update","add_render_callback","new_on_destroy","run","is_function","run_all","destroy_component","detaching","$$","flush_render_callbacks","make_dirty","i","dirty_components","schedule_update","init","options","instance","create_fragment","not_equal","props","append_styles","dirty","parent_component","current_component","set_current_component","noop","blank_object","ready","ret","rest","value","nodes","children","detach","transition_in","flush","SvelteComponent","__publicField","type","callback","callbacks","index","is_empty"],"mappings":";;;;;;;;AAyCO,SAASA,EAAgBC,GAAWC,GAAQC,GAAQ;AAC1D,QAAM,EAAE,UAAAC,GAAU,cAAAC,MAAiBJ,EAAU;AAC7C,EAAAG,KAAYA,EAAS,EAAEF,GAAQC,CAAM,GAErCG,EAAoB,MAAM;AACzB,UAAMC,IAAiBN,EAAU,GAAG,SAAS,IAAIO,CAAG,EAAE,OAAOC,CAAW;AAIxE,IAAIR,EAAU,GAAG,aAChBA,EAAU,GAAG,WAAW,KAAK,GAAGM,CAAc,IAI9CG,EAAQH,CAAc,GAEvBN,EAAU,GAAG,WAAW;EAC1B,CAAE,GACDI,EAAa,QAAQC,CAAmB;AACzC;AAGO,SAASK,EAAkBV,GAAWW,GAAW;AACvD,QAAMC,IAAKZ,EAAU;AACrB,EAAIY,EAAG,aAAa,SACnBC,EAAuBD,EAAG,YAAY,GACtCH,EAAQG,EAAG,UAAU,GACrBA,EAAG,YAAYA,EAAG,SAAS,EAAED,CAAS,GAGtCC,EAAG,aAAaA,EAAG,WAAW,MAC9BA,EAAG,MAAM;AAEX;AAGA,SAASE,EAAWd,GAAWe,GAAG;AACjC,EAAIf,EAAU,GAAG,MAAM,CAAC,MAAM,OAC7BgB,EAAiB,KAAKhB,CAAS,GAC/BiB,KACAjB,EAAU,GAAG,MAAM,KAAK,CAAC,IAE1BA,EAAU,GAAG,MAAOe,IAAI,KAAM,CAAC,KAAK,KAAKA,IAAI;AAC9C;AAaO,SAASG,EACflB,GACAmB,GACAC,GACAC,GACAC,GACAC,GACAC,IAAgB,MAChBC,IAAQ,CAAC,EAAE,GACV;AACD,QAAMC,IAAmBC;AACzB,EAAAC,EAAsB5B,CAAS;AAE/B,QAAMY,IAAMZ,EAAU,KAAK;AAAA,IAC1B,UAAU;AAAA,IACV,KAAK,CAAE;AAAA;AAAA,IAEP,OAAAuB;AAAA,IACA,QAAQM;AA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U,GAAG,QAAQ,GACtDD,EAAgBC,GAAWmB,EAAQ,QAAQA,EAAQ,MAAM,GAEzDoB;EACA;AACD,EAAAX,EAAsBF,CAAgB;AACvC;AAmSO,MAAMc,EAAgB;AAAA,EAAtB;AAQN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,EAAA;AAQA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,EAAA;AAAA;AAAA;AAAA,EAGA,WAAW;AACV,IAAA/B,EAAkB,MAAM,CAAC,GACzB,KAAK,WAAWmB;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQD,IAAIa,GAAMC,GAAU;AACnB,QAAI,CAACnC,EAAYmC,CAAQ;AACxB,aAAOd;AAER,UAAMe,IAAY,KAAK,GAAG,UAAUF,CAAI,MAAM,KAAK,GAAG,UAAUA,CAAI,IAAI,CAAE;AAC1E,WAAAE,EAAU,KAAKD,CAAQ,GAChB,MAAM;AACZ,YAAME,IAAQD,EAAU,QAAQD,CAAQ;AACxC,MAAIE,MAAU,MAAID,EAAU,OAAOC,GAAO,CAAC;AAAA,IAC9C;AAAA,EACE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMD,KAAKtB,GAAO;AACX,IAAI,KAAK,SAAS,CAACuB,EAASvB,CAAK,MAChC,KAAK,GAAG,aAAa,IACrB,KAAK,MAAMA,CAAK,GAChB,KAAK,GAAG,aAAa;AAAA,EAEtB;AACF;","x_google_ignoreList":[0]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { createAnonymousGuest as _createAnonymousGuest, createBody as _createBody, defaultColorProvider as _defaultColorProvider, Origin as _Origin, PointerSelectAction as _PointerSelectAction } from '@annotorious/core';
|
|
2
|
+
import { ShapeType as _ShapeType } from '@annotorious/annotorious';
|
|
1
3
|
export * from './osd';
|
|
2
4
|
export { default as MouseOverTooltip } from './MouseOverTooltip.svelte';
|
|
3
5
|
export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Appearance, AppearanceProvider, Color, DrawingStyle, Filter, FormatAdapter, HoverState, LifecycleEvents, ParseResult, PresentUser, Purpose, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, SvelteAnnotator, SvelteAnnotatorState, User, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
|
|
4
|
-
import { createAnonymousGuest as _createAnonymousGuest, createBody as _createBody, defaultColorProvider as _defaultColorProvider, Origin as _Origin, PointerSelectAction as _PointerSelectAction } from '@annotorious/core';
|
|
5
6
|
export { _createAnonymousGuest as createAnonymousGuest };
|
|
6
7
|
export { _createBody as createBody };
|
|
7
8
|
export { _defaultColorProvider as defaultColorProvider };
|
|
8
9
|
export { _Origin as Origin };
|
|
9
10
|
export { _PointerSelectAction as PointerSelectAction };
|
|
10
11
|
export type { AnnotoriousOpts, DrawingMode, DrawingTool, ImageAnnotator as AnnotoriousImageAnnotator, ImageAnnotation, ImageAnnotator, ImageAnnotatorState, Polygon, PolygonGeometry, Rectangle, RectangleGeometry, Shape } from '@annotorious/annotorious';
|
|
11
|
-
import
|
|
12
|
-
export declare const createImageAnnotator: <E extends unknown = import("@annotorious/annotorious").ImageAnnotation>(image: string | HTMLImageElement | HTMLCanvasElement, options?: import("@annotorious/annotorious").AnnotoriousOpts<import("@annotorious/annotorious").ImageAnnotation, E>) => import("@annotorious/annotorious").ImageAnnotator<E>;
|
|
12
|
+
export declare const createImageAnnotator: <E extends unknown = import('@annotorious/annotorious').ImageAnnotation>(image: string | HTMLImageElement | HTMLCanvasElement, options?: import('@annotorious/annotorious').AnnotoriousOpts<import('@annotorious/annotorious').ImageAnnotation, E>) => import('@annotorious/annotorious').ImageAnnotator<E>;
|
|
13
13
|
export declare const ShapeType: typeof _ShapeType;
|
|
14
|
-
export declare const W3CImageFormat: (source: string, invertY?: boolean) => import(
|
|
14
|
+
export declare const W3CImageFormat: (source: string, invertY?: boolean) => import('@annotorious/annotorious').W3CImageFormatAdapter;
|
|
15
15
|
export type { OpenSeadragonAnnotator as AnnotoriousOpenSeadragonAnnotator } from '@annotorious/openseadragon';
|
|
16
16
|
export type { Viewer } from 'openseadragon';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annotorious/svelte",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.24",
|
|
4
4
|
"description": "Annotorious Svelte bindings",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"svelte": "./src/index.ts",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@sveltejs/vite-plugin-svelte": "^3.0
|
|
18
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.0",
|
|
19
19
|
"@tsconfig/svelte": "^5.0.4",
|
|
20
20
|
"@types/openseadragon": "^3.0.10",
|
|
21
|
-
"svelte": "^4.2.
|
|
22
|
-
"svelte-check": "^3.
|
|
23
|
-
"svelte-preprocess": "^5.1.
|
|
21
|
+
"svelte": "^4.2.17",
|
|
22
|
+
"svelte-check": "^3.7.1",
|
|
23
|
+
"svelte-preprocess": "^5.1.4",
|
|
24
24
|
"tslib": "^2.6.2",
|
|
25
|
-
"typescript": "^5.4.
|
|
26
|
-
"vite": "^5.2.
|
|
27
|
-
"vite-plugin-dts": "^3.
|
|
25
|
+
"typescript": "^5.4.5",
|
|
26
|
+
"vite": "^5.2.11",
|
|
27
|
+
"vite-plugin-dts": "^3.9.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"openseadragon": "^3.0.0 || ^4.0.0"
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@annotorious/core": "3.0.0-rc.
|
|
39
|
-
"@annotorious/annotorious": "3.0.0-rc.
|
|
40
|
-
"@annotorious/openseadragon": "3.0.0-rc.
|
|
41
|
-
"@neodrag/svelte": "^2.0.
|
|
38
|
+
"@annotorious/core": "3.0.0-rc.24",
|
|
39
|
+
"@annotorious/annotorious": "3.0.0-rc.24",
|
|
40
|
+
"@annotorious/openseadragon": "3.0.0-rc.24",
|
|
41
|
+
"@neodrag/svelte": "^2.0.6"
|
|
42
42
|
},
|
|
43
43
|
"sideEffects": false
|
|
44
44
|
}
|