@annotorious/core
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -31,3 +31,3 @@ var W = Object.prototype.hasOwnProperty; | ||
const o = /* @__PURE__ */ new Set(); | ||
function s(b) { | ||
function i(b) { | ||
if (Q(e, b) && (e = b, t)) { | ||
@@ -44,12 +44,12 @@ const y = !I.length; | ||
} | ||
function m(b) { | ||
s(b(e)); | ||
function f(b) { | ||
i(b(e)); | ||
} | ||
function E(b, y = _) { | ||
function w(b, y = _) { | ||
const g = [b, y]; | ||
return o.add(g), o.size === 1 && (t = n(s, m) || _), b(e), () => { | ||
return o.add(g), o.size === 1 && (t = n(i, f) || _), b(e), () => { | ||
o.delete(g), o.size === 0 && t && (t(), t = null); | ||
}; | ||
} | ||
return { set: s, update: m, subscribe: E }; | ||
return { set: i, update: f, subscribe: w }; | ||
} | ||
@@ -59,7 +59,7 @@ const Le = (e) => { | ||
let o; | ||
return n((s) => o = s), e.observe(({ changes: s }) => { | ||
return n((i) => o = i), e.observe(({ changes: i }) => { | ||
if (o) { | ||
(s.deleted || []).some((b) => b.id === o) && t(void 0); | ||
const E = (s.updated || []).find(({ oldValue: b }) => b.id === o); | ||
E && t(E.newValue.id); | ||
(i.deleted || []).some((b) => b.id === o) && t(void 0); | ||
const w = (i.updated || []).find(({ oldValue: b }) => b.id === o); | ||
w && t(w.newValue.id); | ||
} | ||
@@ -75,65 +75,65 @@ }), { | ||
var X = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(X || {}); | ||
const z = { selected: [] }, Se = (e) => { | ||
const { subscribe: n, set: t } = j(z); | ||
let o, s = z; | ||
n((u) => s = u); | ||
const m = () => { | ||
x(s, z) || t(z); | ||
}, E = () => { | ||
var u; | ||
return ((u = s.selected) == null ? void 0 : u.length) === 0; | ||
}, b = (u) => { | ||
if (E()) | ||
const z = { selected: [] }, Se = (e, n) => { | ||
const { subscribe: t, set: o } = j(z); | ||
let i = n, f = z; | ||
t((m) => f = m); | ||
const w = () => { | ||
x(f, z) || o(z); | ||
}, b = () => { | ||
var m; | ||
return ((m = f.selected) == null ? void 0 : m.length) === 0; | ||
}, y = (m) => { | ||
if (b()) | ||
return !1; | ||
const w = typeof u == "string" ? u : u.id; | ||
return s.selected.some((v) => v.id === w); | ||
}, y = (u, w) => { | ||
const v = e.getAnnotation(u); | ||
if (!v) { | ||
console.warn("Invalid selection: " + u); | ||
const v = typeof m == "string" ? m : m.id; | ||
return f.selected.some((U) => U.id === v); | ||
}, g = (m, v) => { | ||
const U = e.getAnnotation(m); | ||
if (!U) { | ||
console.warn("Invalid selection: " + m); | ||
return; | ||
} | ||
switch (q(v, o)) { | ||
switch (q(U, i)) { | ||
case "EDIT": | ||
t({ selected: [{ id: u, editable: !0 }], event: w }); | ||
o({ selected: [{ id: m, editable: !0 }], event: v }); | ||
break; | ||
case "SELECT": | ||
t({ selected: [{ id: u }], event: w }); | ||
o({ selected: [{ id: m }], event: v }); | ||
break; | ||
default: | ||
t({ selected: [], event: w }); | ||
o({ selected: [], event: v }); | ||
} | ||
}, g = (u, w) => { | ||
const v = Array.isArray(u) ? u : [u], U = v.map((T) => e.getAnnotation(T)).filter((T) => !!T); | ||
t({ | ||
selected: U.map((T) => { | ||
const l = w === void 0 ? q(T, o) === "EDIT" : w; | ||
return { id: T.id, editable: l }; | ||
}, L = (m, v) => { | ||
const U = Array.isArray(m) ? m : [m], T = U.map((a) => e.getAnnotation(a)).filter((a) => !!a); | ||
o({ | ||
selected: T.map((a) => { | ||
const u = v === void 0 ? q(a, i) === "EDIT" : v; | ||
return { id: a.id, editable: u }; | ||
}) | ||
}), U.length !== v.length && console.warn("Invalid selection", u); | ||
}, L = (u) => { | ||
if (E()) | ||
}), T.length !== U.length && console.warn("Invalid selection", m); | ||
}, r = (m) => { | ||
if (b()) | ||
return !1; | ||
const { selected: w } = s; | ||
w.some(({ id: U }) => u.includes(U)) && t({ selected: w.filter(({ id: U }) => !u.includes(U)) }); | ||
}, a = (u) => o = u; | ||
const { selected: v } = f; | ||
v.some(({ id: T }) => m.includes(T)) && o({ selected: v.filter(({ id: T }) => !m.includes(T)) }); | ||
}, E = (m) => i = m; | ||
return e.observe( | ||
({ changes: u }) => L((u.deleted || []).map((w) => w.id)) | ||
({ changes: m }) => r((m.deleted || []).map((v) => v.id)) | ||
), { | ||
get event() { | ||
return s ? s.event : null; | ||
return f ? f.event : null; | ||
}, | ||
get selected() { | ||
return s ? [...s.selected] : null; | ||
return f ? [...f.selected] : null; | ||
}, | ||
get userSelectAction() { | ||
return o; | ||
return i; | ||
}, | ||
clear: m, | ||
isEmpty: E, | ||
isSelected: b, | ||
setSelected: g, | ||
setUserSelectAction: a, | ||
subscribe: n, | ||
userSelect: y | ||
clear: w, | ||
isEmpty: b, | ||
isSelected: y, | ||
setSelected: L, | ||
setUserSelectAction: E, | ||
subscribe: t, | ||
userSelect: g | ||
}; | ||
@@ -165,3 +165,3 @@ }, q = (e, n) => typeof n == "function" ? n(e) : n || "EDIT"; | ||
const Oe = (e) => { | ||
const { creator: n, updatedBy: t } = e.target, o = e.bodies.reduce((s, m) => [...s, m.creator, m.updatedBy].filter(Boolean), []); | ||
const { creator: n, updatedBy: t } = e.target, o = e.bodies.reduce((i, f) => [...i, f.creator, f.updatedBy].filter(Boolean), []); | ||
return [ | ||
@@ -171,3 +171,3 @@ n, | ||
...o | ||
].filter((s) => s); | ||
].filter((i) => i); | ||
}, Te = (e, n, t, o) => ({ | ||
@@ -186,6 +186,6 @@ id: H(), | ||
}, se = (e, n) => n.bodies.map((t) => { | ||
const o = e.bodies.find((s) => s.id === t.id); | ||
const o = e.bodies.find((i) => i.id === t.id); | ||
return { newBody: t, oldBody: o && !x(o, t) ? o : void 0 }; | ||
}).filter(({ oldBody: t }) => t).map(({ oldBody: t, newBody: o }) => ({ oldBody: t, newBody: o })), ie = (e, n) => !x(e.target, n.target), F = (e, n) => { | ||
const t = ne(e, n), o = oe(e, n), s = se(e, n); | ||
const t = ne(e, n), o = oe(e, n), i = se(e, n); | ||
return { | ||
@@ -196,3 +196,3 @@ oldValue: e, | ||
bodiesDeleted: o.length > 0 ? o : void 0, | ||
bodiesUpdated: s.length > 0 ? s : void 0, | ||
bodiesUpdated: i.length > 0 ? i : void 0, | ||
targetUpdated: ie(e, n) ? { oldTarget: e.target, newTarget: n.target } : void 0 | ||
@@ -203,3 +203,3 @@ }; | ||
const ae = (e, n) => { | ||
var m, E; | ||
var f, w; | ||
const { changes: t, origin: o } = n; | ||
@@ -211,4 +211,4 @@ if (!(!e.options.origin || e.options.origin === o)) | ||
if (!(y(t.created) || y(t.deleted))) { | ||
const L = (m = t.updated) == null ? void 0 : m.some((u) => y(u.bodiesCreated) || y(u.bodiesDeleted) || y(u.bodiesUpdated)), a = (E = t.updated) == null ? void 0 : E.some((u) => u.targetUpdated); | ||
if (b === "BODY_ONLY" && L && !a || b === "TARGET_ONLY" && a && !L) | ||
const L = (f = t.updated) == null ? void 0 : f.some((E) => y(E.bodiesCreated) || y(E.bodiesDeleted) || y(E.bodiesUpdated)), r = (w = t.updated) == null ? void 0 : w.some((E) => E.targetUpdated); | ||
if (b === "BODY_ONLY" && L && !r || b === "TARGET_ONLY" && r && !L) | ||
return !1; | ||
@@ -227,18 +227,18 @@ } | ||
}, re = (e, n) => { | ||
const t = new Set((e.created || []).map((a) => a.id)), o = new Set((e.updated || []).map(({ newValue: a }) => a.id)), s = new Set((n.created || []).map((a) => a.id)), m = new Set((n.deleted || []).map((a) => a.id)), E = new Set((n.updated || []).map(({ oldValue: a }) => a.id)), b = new Set((n.updated || []).filter(({ oldValue: a }) => t.has(a.id) || o.has(a.id)).map(({ oldValue: a }) => a.id)), y = [ | ||
...(e.created || []).filter((a) => !m.has(a.id)).map((a) => E.has(a.id) ? n.updated.find(({ oldValue: u }) => u.id === a.id).newValue : a), | ||
const t = new Set((e.created || []).map((r) => r.id)), o = new Set((e.updated || []).map(({ newValue: r }) => r.id)), i = new Set((n.created || []).map((r) => r.id)), f = new Set((n.deleted || []).map((r) => r.id)), w = new Set((n.updated || []).map(({ oldValue: r }) => r.id)), b = new Set((n.updated || []).filter(({ oldValue: r }) => t.has(r.id) || o.has(r.id)).map(({ oldValue: r }) => r.id)), y = [ | ||
...(e.created || []).filter((r) => !f.has(r.id)).map((r) => w.has(r.id) ? n.updated.find(({ oldValue: E }) => E.id === r.id).newValue : r), | ||
...n.created || [] | ||
], g = [ | ||
...(e.deleted || []).filter((a) => !s.has(a.id)), | ||
...(n.deleted || []).filter((a) => !t.has(a.id)) | ||
...(e.deleted || []).filter((r) => !i.has(r.id)), | ||
...(n.deleted || []).filter((r) => !t.has(r.id)) | ||
], L = [ | ||
...(e.updated || []).filter(({ newValue: a }) => !m.has(a.id)).map((a) => { | ||
const { oldValue: u, newValue: w } = a; | ||
if (E.has(w.id)) { | ||
const v = n.updated.find((U) => U.oldValue.id === w.id).newValue; | ||
return F(u, v); | ||
...(e.updated || []).filter(({ newValue: r }) => !f.has(r.id)).map((r) => { | ||
const { oldValue: E, newValue: m } = r; | ||
if (w.has(m.id)) { | ||
const v = n.updated.find((U) => U.oldValue.id === m.id).newValue; | ||
return F(E, v); | ||
} else | ||
return a; | ||
return r; | ||
}), | ||
...(n.updated || []).filter(({ oldValue: a }) => !b.has(a.id)) | ||
...(n.updated || []).filter(({ oldValue: r }) => !b.has(r.id)) | ||
]; | ||
@@ -261,12 +261,12 @@ return { created: y, deleted: g, updated: L }; | ||
}, ce = (e) => e.id !== void 0, De = () => { | ||
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), t = [], o = (d, r = {}) => t.push({ onChange: d, options: r }), s = (d) => { | ||
const r = t.findIndex((c) => c.onChange == d); | ||
r > -1 && t.splice(r, 1); | ||
}, m = (d, r) => { | ||
const c = { | ||
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), t = [], o = (d, c = {}) => t.push({ onChange: d, options: c }), i = (d) => { | ||
const c = t.findIndex((l) => l.onChange == d); | ||
c > -1 && t.splice(c, 1); | ||
}, f = (d, c) => { | ||
const l = { | ||
origin: d, | ||
changes: { | ||
created: r.created || [], | ||
updated: r.updated || [], | ||
deleted: r.deleted || [] | ||
created: c.created || [], | ||
updated: c.updated || [], | ||
deleted: c.deleted || [] | ||
}, | ||
@@ -276,5 +276,5 @@ state: [...e.values()] | ||
t.forEach((p) => { | ||
ae(p, c) && p.onChange(c); | ||
ae(p, l) && p.onChange(l); | ||
}); | ||
}, E = (d, r = O.LOCAL) => { | ||
}, w = (d, c = O.LOCAL) => { | ||
if (d.id && e.get(d.id)) | ||
@@ -284,29 +284,29 @@ throw Error(`Cannot add annotation ${d.id} - exists already`); | ||
const p = V(d); | ||
e.set(p.id, p), p.bodies.forEach((S) => n.set(S.id, p.id)), m(r, { created: [p] }); | ||
e.set(p.id, p), p.bodies.forEach((S) => n.set(S.id, p.id)), f(c, { created: [p] }); | ||
} | ||
}, b = (d, r) => { | ||
const c = V(typeof d == "string" ? r : d), p = typeof d == "string" ? d : d.id, S = p && e.get(p); | ||
}, b = (d, c) => { | ||
const l = V(typeof d == "string" ? c : d), p = typeof d == "string" ? d : d.id, S = p && e.get(p); | ||
if (S) { | ||
const C = F(S, c); | ||
return p === c.id ? e.set(p, c) : (e.delete(p), e.set(c.id, c)), S.bodies.forEach((B) => n.delete(B.id)), c.bodies.forEach((B) => n.set(B.id, c.id)), C; | ||
const C = F(S, l); | ||
return p === l.id ? e.set(p, l) : (e.delete(p), e.set(l.id, l)), S.bodies.forEach((B) => n.delete(B.id)), l.bodies.forEach((B) => n.set(B.id, l.id)), C; | ||
} else | ||
console.warn(`Cannot update annotation ${p} - does not exist`); | ||
}, y = (d, r = O.LOCAL, c = O.LOCAL) => { | ||
const p = ce(r) ? c : r, S = b(d, r); | ||
S && m(p, { updated: [S] }); | ||
}, g = (d, r = O.LOCAL) => { | ||
const c = d.reduce((p, S) => { | ||
}, y = (d, c = O.LOCAL, l = O.LOCAL) => { | ||
const p = ce(c) ? l : c, S = b(d, c); | ||
S && f(p, { updated: [S] }); | ||
}, g = (d, c = O.LOCAL) => { | ||
const l = d.reduce((p, S) => { | ||
const C = b(S); | ||
return C ? [...p, C] : p; | ||
}, []); | ||
c.length > 0 && m(r, { updated: c }); | ||
}, L = (d, r = O.LOCAL) => { | ||
const c = e.get(d.annotation); | ||
if (c) { | ||
l.length > 0 && f(c, { updated: l }); | ||
}, L = (d, c = O.LOCAL) => { | ||
const l = e.get(d.annotation); | ||
if (l) { | ||
const p = { | ||
...c, | ||
bodies: [...c.bodies, d] | ||
...l, | ||
bodies: [...l.bodies, d] | ||
}; | ||
e.set(c.id, p), n.set(d.id, p.id), m(r, { updated: [{ | ||
oldValue: c, | ||
e.set(l.id, p), n.set(d.id, p.id), f(c, { updated: [{ | ||
oldValue: l, | ||
newValue: p, | ||
@@ -317,12 +317,12 @@ bodiesCreated: [d] | ||
console.warn(`Attempt to add body to missing annotation: ${d.annotation}`); | ||
}, a = () => [...e.values()], u = (d = O.LOCAL) => { | ||
const r = [...e.values()]; | ||
e.clear(), n.clear(), m(d, { deleted: r }); | ||
}, w = (d, r = !0, c = O.LOCAL) => { | ||
}, r = () => [...e.values()], E = (d = O.LOCAL) => { | ||
const c = [...e.values()]; | ||
e.clear(), n.clear(), f(d, { deleted: c }); | ||
}, m = (d, c = !0, l = O.LOCAL) => { | ||
const p = d.map(V); | ||
if (r) { | ||
if (c) { | ||
const S = [...e.values()]; | ||
e.clear(), n.clear(), p.forEach((C) => { | ||
e.set(C.id, C), C.bodies.forEach((B) => n.set(B.id, C.id)); | ||
}), m(c, { created: p, deleted: S }); | ||
}), f(l, { created: p, deleted: S }); | ||
} else { | ||
@@ -337,32 +337,32 @@ const S = d.reduce((C, B) => { | ||
e.set(C.id, C), C.bodies.forEach((B) => n.set(B.id, C.id)); | ||
}), m(c, { created: p }); | ||
}), f(l, { created: p }); | ||
} | ||
}, v = (d) => { | ||
const r = typeof d == "string" ? d : d.id, c = e.get(r); | ||
if (c) | ||
return e.delete(r), c.bodies.forEach((p) => n.delete(p.id)), c; | ||
console.warn(`Attempt to delete missing annotation: ${r}`); | ||
}, U = (d, r = O.LOCAL) => { | ||
const c = v(d); | ||
c && m(r, { deleted: [c] }); | ||
}, T = (d, r = O.LOCAL) => { | ||
const c = d.reduce((p, S) => { | ||
const c = typeof d == "string" ? d : d.id, l = e.get(c); | ||
if (l) | ||
return e.delete(c), l.bodies.forEach((p) => n.delete(p.id)), l; | ||
console.warn(`Attempt to delete missing annotation: ${c}`); | ||
}, U = (d, c = O.LOCAL) => { | ||
const l = v(d); | ||
l && f(c, { deleted: [l] }); | ||
}, T = (d, c = O.LOCAL) => { | ||
const l = d.reduce((p, S) => { | ||
const C = v(S); | ||
return C ? [...p, C] : p; | ||
}, []); | ||
c.length > 0 && m(r, { deleted: c }); | ||
}, l = (d) => { | ||
const r = e.get(d.annotation); | ||
if (r) { | ||
const c = r.bodies.find((p) => p.id === d.id); | ||
if (c) { | ||
n.delete(c.id); | ||
l.length > 0 && f(c, { deleted: l }); | ||
}, a = (d) => { | ||
const c = e.get(d.annotation); | ||
if (c) { | ||
const l = c.bodies.find((p) => p.id === d.id); | ||
if (l) { | ||
n.delete(l.id); | ||
const p = { | ||
...r, | ||
bodies: r.bodies.filter((C) => C.id !== d.id) | ||
...c, | ||
bodies: c.bodies.filter((C) => C.id !== d.id) | ||
}; | ||
return e.set(r.id, p), { | ||
oldValue: r, | ||
return e.set(c.id, p), { | ||
oldValue: c, | ||
newValue: p, | ||
bodiesDeleted: [c] | ||
bodiesDeleted: [l] | ||
}; | ||
@@ -373,15 +373,15 @@ } else | ||
console.warn(`Attempt to delete body from missing annotation ${d.annotation}`); | ||
}, f = (d, r = O.LOCAL) => { | ||
const c = l(d); | ||
c && m(r, { updated: [c] }); | ||
}, i = (d, r = O.LOCAL) => { | ||
const c = d.map((p) => l(p)).filter(Boolean); | ||
c.length > 0 && m(r, { updated: c }); | ||
}, u = (d, c = O.LOCAL) => { | ||
const l = a(d); | ||
l && f(c, { updated: [l] }); | ||
}, s = (d, c = O.LOCAL) => { | ||
const l = d.map((p) => a(p)).filter(Boolean); | ||
l.length > 0 && f(c, { updated: l }); | ||
}, h = (d) => { | ||
const r = e.get(d); | ||
return r ? { ...r } : void 0; | ||
const c = e.get(d); | ||
return c ? { ...c } : void 0; | ||
}, A = (d) => { | ||
const r = n.get(d); | ||
if (r) { | ||
const p = h(r).bodies.find((S) => S.id === d); | ||
const c = n.get(d); | ||
if (c) { | ||
const p = h(c).bodies.find((S) => S.id === d); | ||
if (p) | ||
@@ -392,39 +392,39 @@ return p; | ||
console.warn(`Attempt to retrieve missing body: ${d}`); | ||
}, R = (d, r) => { | ||
if (d.annotation !== r.annotation) | ||
}, R = (d, c) => { | ||
if (d.annotation !== c.annotation) | ||
throw "Annotation integrity violation: annotation ID must be the same when updating bodies"; | ||
const c = e.get(d.annotation); | ||
if (c) { | ||
const p = c.bodies.find((C) => C.id === d.id), S = { | ||
...c, | ||
bodies: c.bodies.map((C) => C.id === p.id ? r : C) | ||
const l = e.get(d.annotation); | ||
if (l) { | ||
const p = l.bodies.find((C) => C.id === d.id), S = { | ||
...l, | ||
bodies: l.bodies.map((C) => C.id === p.id ? c : C) | ||
}; | ||
return e.set(c.id, S), p.id !== r.id && (n.delete(p.id), n.set(r.id, S.id)), { | ||
oldValue: c, | ||
return e.set(l.id, S), p.id !== c.id && (n.delete(p.id), n.set(c.id, S.id)), { | ||
oldValue: l, | ||
newValue: S, | ||
bodiesUpdated: [{ oldBody: p, newBody: r }] | ||
bodiesUpdated: [{ oldBody: p, newBody: c }] | ||
}; | ||
} else | ||
console.warn(`Attempt to add body to missing annotation ${d.annotation}`); | ||
}, N = (d, r, c = O.LOCAL) => { | ||
const p = R(d, r); | ||
p && m(c, { updated: [p] }); | ||
}, k = (d, r = O.LOCAL) => { | ||
const c = d.map((p) => R({ id: p.id, annotation: p.annotation }, p)).filter(Boolean); | ||
m(r, { updated: c }); | ||
}, N = (d, c, l = O.LOCAL) => { | ||
const p = R(d, c); | ||
p && f(l, { updated: [p] }); | ||
}, k = (d, c = O.LOCAL) => { | ||
const l = d.map((p) => R({ id: p.id, annotation: p.annotation }, p)).filter(Boolean); | ||
f(c, { updated: l }); | ||
}, M = (d) => { | ||
const r = e.get(d.annotation); | ||
if (r) { | ||
const c = { | ||
...r, | ||
const c = e.get(d.annotation); | ||
if (c) { | ||
const l = { | ||
...c, | ||
target: { | ||
...r.target, | ||
...c.target, | ||
...d | ||
} | ||
}; | ||
return e.set(r.id, c), { | ||
oldValue: r, | ||
newValue: c, | ||
return e.set(c.id, l), { | ||
oldValue: c, | ||
newValue: l, | ||
targetUpdated: { | ||
oldTarget: r.target, | ||
oldTarget: c.target, | ||
newTarget: d | ||
@@ -437,26 +437,26 @@ } | ||
return { | ||
addAnnotation: E, | ||
addAnnotation: w, | ||
addBody: L, | ||
all: a, | ||
bulkAddAnnotation: w, | ||
all: r, | ||
bulkAddAnnotation: m, | ||
bulkDeleteAnnotation: T, | ||
bulkDeleteBodies: i, | ||
bulkDeleteBodies: s, | ||
bulkUpdateAnnotation: g, | ||
bulkUpdateBodies: k, | ||
bulkUpdateTargets: (d, r = O.LOCAL) => { | ||
const c = d.map((p) => M(p)).filter(Boolean); | ||
c.length > 0 && m(r, { updated: c }); | ||
bulkUpdateTargets: (d, c = O.LOCAL) => { | ||
const l = d.map((p) => M(p)).filter(Boolean); | ||
l.length > 0 && f(c, { updated: l }); | ||
}, | ||
clear: u, | ||
clear: E, | ||
deleteAnnotation: U, | ||
deleteBody: f, | ||
deleteBody: u, | ||
getAnnotation: h, | ||
getBody: A, | ||
observe: o, | ||
unobserve: s, | ||
unobserve: i, | ||
updateAnnotation: y, | ||
updateBody: N, | ||
updateTarget: (d, r = O.LOCAL) => { | ||
const c = M(d); | ||
c && m(r, { updated: [c] }); | ||
updateTarget: (d, c = O.LOCAL) => { | ||
const l = M(d); | ||
l && f(c, { updated: [l] }); | ||
} | ||
@@ -467,3 +467,3 @@ }; | ||
subscribe: (t) => { | ||
const o = (s) => t(s.state); | ||
const o = (i) => t(i.state); | ||
return e.observe(o), t(e.all()), () => e.unobserve(o); | ||
@@ -474,3 +474,3 @@ } | ||
emit(e, ...n) { | ||
for (let t = 0, o = this.events[e] || [], s = o.length; t < s; t++) | ||
for (let t = 0, o = this.events[e] || [], i = o.length; t < i; t++) | ||
o[t](...n); | ||
@@ -483,3 +483,3 @@ }, | ||
var o; | ||
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((s) => n !== s); | ||
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => n !== i); | ||
}; | ||
@@ -490,7 +490,7 @@ } | ||
const n = J(), t = []; | ||
let o = -1, s = !1, m = 0; | ||
const E = (i) => { | ||
if (!s) { | ||
const { changes: h } = i, A = performance.now(); | ||
if (A - m > le) | ||
let o = -1, i = !1, f = 0; | ||
const w = (s) => { | ||
if (!i) { | ||
const { changes: h } = s, A = performance.now(); | ||
if (A - f > le) | ||
t.splice(o + 1), t.push(h), o = t.length - 1; | ||
@@ -501,18 +501,18 @@ else { | ||
} | ||
m = A; | ||
f = A; | ||
} | ||
s = !1; | ||
i = !1; | ||
}; | ||
e.observe(E, { origin: O.LOCAL }); | ||
const b = (i) => i && i.length > 0 && e.bulkDeleteAnnotation(i), y = (i) => i && i.length > 0 && e.bulkAddAnnotation(i, !1), g = (i) => i && i.length > 0 && e.bulkUpdateAnnotation(i.map(({ oldValue: h }) => h)), L = (i) => i && i.length > 0 && e.bulkUpdateAnnotation(i.map(({ newValue: h }) => h)), a = (i) => i && i.length > 0 && e.bulkAddAnnotation(i, !1), u = (i) => i && i.length > 0 && e.bulkDeleteAnnotation(i); | ||
e.observe(w, { origin: O.LOCAL }); | ||
const b = (s) => s && s.length > 0 && e.bulkDeleteAnnotation(s), y = (s) => s && s.length > 0 && e.bulkAddAnnotation(s, !1), g = (s) => s && s.length > 0 && e.bulkUpdateAnnotation(s.map(({ oldValue: h }) => h)), L = (s) => s && s.length > 0 && e.bulkUpdateAnnotation(s.map(({ newValue: h }) => h)), r = (s) => s && s.length > 0 && e.bulkAddAnnotation(s, !1), E = (s) => s && s.length > 0 && e.bulkDeleteAnnotation(s); | ||
return { | ||
canRedo: () => t.length - 1 > o, | ||
canUndo: () => o > -1, | ||
destroy: () => e.unobserve(E), | ||
on: (i, h) => n.on(i, h), | ||
destroy: () => e.unobserve(w), | ||
on: (s, h) => n.on(s, h), | ||
redo: () => { | ||
if (t.length - 1 > o) { | ||
s = !0; | ||
const { created: i, updated: h, deleted: A } = t[o + 1]; | ||
y(i), L(h), u(A), n.emit("redo", t[o + 1]), o += 1; | ||
i = !0; | ||
const { created: s, updated: h, deleted: A } = t[o + 1]; | ||
y(s), L(h), E(A), n.emit("redo", t[o + 1]), o += 1; | ||
} | ||
@@ -522,5 +522,5 @@ }, | ||
if (o > -1) { | ||
s = !0; | ||
const { created: i, updated: h, deleted: A } = t[o]; | ||
b(i), g(h), a(A), n.emit("undo", t[o]), o -= 1; | ||
i = !0; | ||
const { created: s, updated: h, deleted: A } = t[o]; | ||
b(s), g(h), r(A), n.emit("undo", t[o]), o -= 1; | ||
} | ||
@@ -536,51 +536,51 @@ } | ||
}, ke = (e, n, t, o) => { | ||
const { store: s, selection: m, hover: E, viewport: b } = e, y = /* @__PURE__ */ new Map(); | ||
let g = [], L, a; | ||
const u = (l, f) => { | ||
y.has(l) ? y.get(l).push(f) : y.set(l, [f]); | ||
}, w = (l, f) => { | ||
const i = y.get(l); | ||
if (i) { | ||
const h = i.indexOf(f); | ||
h !== -1 && i.splice(h, 1); | ||
const { store: i, selection: f, hover: w, viewport: b } = e, y = /* @__PURE__ */ new Map(); | ||
let g = [], L, r; | ||
const E = (a, u) => { | ||
y.has(a) ? y.get(a).push(u) : y.set(a, [u]); | ||
}, m = (a, u) => { | ||
const s = y.get(a); | ||
if (s) { | ||
const h = s.indexOf(u); | ||
h !== -1 && s.splice(h, 1); | ||
} | ||
}, v = (l, f, i) => { | ||
y.has(l) && setTimeout(() => { | ||
y.get(l).forEach((h) => { | ||
}, v = (a, u, s) => { | ||
y.has(a) && setTimeout(() => { | ||
y.get(a).forEach((h) => { | ||
if (t) { | ||
const A = Array.isArray(f) ? f.map((N) => t.serialize(N)) : t.serialize(f), R = i ? i instanceof PointerEvent ? i : t.serialize(i) : void 0; | ||
const A = Array.isArray(u) ? u.map((N) => t.serialize(N)) : t.serialize(u), R = s ? s instanceof PointerEvent ? s : t.serialize(s) : void 0; | ||
h(A, R); | ||
} else | ||
h(f, i); | ||
h(u, s); | ||
}); | ||
}, 1); | ||
}, U = () => { | ||
const { selected: l } = m, f = (l || []).map(({ id: i }) => s.getAnnotation(i)); | ||
f.forEach((i) => { | ||
const h = g.find((A) => A.id === i.id); | ||
(!h || !x(h, i)) && v("updateAnnotation", i, h); | ||
}), g = g.map((i) => { | ||
const h = f.find(({ id: A }) => A === i.id); | ||
return h || i; | ||
const { selected: a } = f, u = (a || []).map(({ id: s }) => i.getAnnotation(s)); | ||
u.forEach((s) => { | ||
const h = g.find((A) => A.id === s.id); | ||
(!h || !x(h, s)) && v("updateAnnotation", s, h); | ||
}), g = g.map((s) => { | ||
const h = u.find(({ id: A }) => A === s.id); | ||
return h || s; | ||
}); | ||
}; | ||
m.subscribe(({ selected: l }) => { | ||
if (!(g.length === 0 && l.length === 0)) { | ||
if (g.length === 0 && l.length > 0) | ||
g = l.map(({ id: f }) => s.getAnnotation(f)); | ||
else if (g.length > 0 && l.length === 0) | ||
g.forEach((f) => { | ||
const i = s.getAnnotation(f.id); | ||
i && !x(i, f) && v("updateAnnotation", i, f); | ||
f.subscribe(({ selected: a }) => { | ||
if (!(g.length === 0 && a.length === 0)) { | ||
if (g.length === 0 && a.length > 0) | ||
g = a.map(({ id: u }) => i.getAnnotation(u)); | ||
else if (g.length > 0 && a.length === 0) | ||
g.forEach((u) => { | ||
const s = i.getAnnotation(u.id); | ||
s && !x(s, u) && v("updateAnnotation", s, u); | ||
}), g = []; | ||
else { | ||
const f = new Set(g.map((A) => A.id)), i = new Set(l.map(({ id: A }) => A)); | ||
g.filter((A) => !i.has(A.id)).forEach((A) => { | ||
const R = s.getAnnotation(A.id); | ||
const u = new Set(g.map((A) => A.id)), s = new Set(a.map(({ id: A }) => A)); | ||
g.filter((A) => !s.has(A.id)).forEach((A) => { | ||
const R = i.getAnnotation(A.id); | ||
R && !x(R, A) && v("updateAnnotation", R, A); | ||
}), g = [ | ||
// Remove annotations that were deselected | ||
...g.filter((A) => i.has(A.id)), | ||
...g.filter((A) => s.has(A.id)), | ||
// Add editable annotations that were selected | ||
...l.filter(({ id: A }) => !f.has(A)).map(({ id: A }) => s.getAnnotation(A)) | ||
...a.filter(({ id: A }) => !u.has(A)).map(({ id: A }) => i.getAnnotation(A)) | ||
]; | ||
@@ -590,8 +590,8 @@ } | ||
} | ||
}), E.subscribe((l) => { | ||
!L && l ? v("mouseEnterAnnotation", s.getAnnotation(l)) : L && !l ? v("mouseLeaveAnnotation", s.getAnnotation(L)) : L && l && (v("mouseLeaveAnnotation", s.getAnnotation(L)), v("mouseEnterAnnotation", s.getAnnotation(l))), L = l; | ||
}), b == null || b.subscribe((l) => v("viewportIntersect", l.map((f) => s.getAnnotation(f)))), s.observe((l) => { | ||
o && (a && clearTimeout(a), a = setTimeout(U, 1e3)); | ||
const { created: f, deleted: i } = l.changes; | ||
(f || []).forEach((A) => v("createAnnotation", A)), (i || []).forEach((A) => v("deleteAnnotation", A)), (l.changes.updated || []).filter((A) => [ | ||
}), w.subscribe((a) => { | ||
!L && a ? v("mouseEnterAnnotation", i.getAnnotation(a)) : L && !a ? v("mouseLeaveAnnotation", i.getAnnotation(L)) : L && a && (v("mouseLeaveAnnotation", i.getAnnotation(L)), v("mouseEnterAnnotation", i.getAnnotation(a))), L = a; | ||
}), b == null || b.subscribe((a) => v("viewportIntersect", a.map((u) => i.getAnnotation(u)))), i.observe((a) => { | ||
o && (r && clearTimeout(r), r = setTimeout(U, 1e3)); | ||
const { created: u, deleted: s } = a.changes; | ||
(u || []).forEach((A) => v("createAnnotation", A)), (s || []).forEach((A) => v("deleteAnnotation", A)), (a.changes.updated || []).filter((A) => [ | ||
...A.bodiesCreated || [], | ||
@@ -604,7 +604,7 @@ ...A.bodiesDeleted || [], | ||
}); | ||
}, { origin: O.LOCAL }), s.observe((l) => { | ||
}, { origin: O.LOCAL }), i.observe((a) => { | ||
if (g) { | ||
const f = new Set(g.map((h) => h.id)), i = (l.changes.updated || []).filter(({ newValue: h }) => f.has(h.id)).map(({ newValue: h }) => h); | ||
i.length > 0 && (g = g.map((h) => { | ||
const A = i.find((R) => R.id === h.id); | ||
const u = new Set(g.map((h) => h.id)), s = (a.changes.updated || []).filter(({ newValue: h }) => u.has(h.id)).map(({ newValue: h }) => h); | ||
s.length > 0 && (g = g.map((h) => { | ||
const A = s.find((R) => R.id === h.id); | ||
return A || h; | ||
@@ -614,14 +614,14 @@ })); | ||
}, { origin: O.REMOTE }); | ||
const T = (l) => (f) => { | ||
const { updated: i } = f; | ||
l ? (i || []).forEach((h) => v("updateAnnotation", h.oldValue, h.newValue)) : (i || []).forEach((h) => v("updateAnnotation", h.newValue, h.oldValue)); | ||
const T = (a) => (u) => { | ||
const { updated: s } = u; | ||
a ? (s || []).forEach((h) => v("updateAnnotation", h.oldValue, h.newValue)) : (s || []).forEach((h) => v("updateAnnotation", h.newValue, h.oldValue)); | ||
}; | ||
return n.on("undo", T(!0)), n.on("redo", T(!1)), { on: u, off: w, emit: v }; | ||
return n.on("undo", T(!0)), n.on("redo", T(!1)), { on: E, off: m, emit: v }; | ||
}, Ie = (e) => (n) => n.map((t) => e.serialize(t)), ue = (e) => (n) => n.reduce((t, o) => { | ||
const { parsed: s, error: m } = e.parse(o); | ||
return m ? { | ||
const { parsed: i, error: f } = e.parse(o); | ||
return f ? { | ||
parsed: t.parsed, | ||
failed: [...t.failed, o] | ||
} : s ? { | ||
parsed: [...t.parsed, s], | ||
} : i ? { | ||
parsed: [...t.parsed, i], | ||
failed: t.failed | ||
@@ -632,47 +632,47 @@ } : { | ||
}, { parsed: [], failed: [] }), Ne = (e, n, t) => { | ||
const { store: o, selection: s } = e, m = (l) => { | ||
const { store: o, selection: i } = e, f = (a) => { | ||
if (t) { | ||
const { parsed: f, error: i } = t.parse(l); | ||
f ? o.addAnnotation(f, O.REMOTE) : console.error(i); | ||
const { parsed: u, error: s } = t.parse(a); | ||
u ? o.addAnnotation(u, O.REMOTE) : console.error(s); | ||
} else | ||
o.addAnnotation(l, O.REMOTE); | ||
}, E = () => s.clear(), b = () => o.clear(), y = (l) => { | ||
const f = o.getAnnotation(l); | ||
return t && f ? t.serialize(f) : f; | ||
o.addAnnotation(a, O.REMOTE); | ||
}, w = () => i.clear(), b = () => o.clear(), y = (a) => { | ||
const u = o.getAnnotation(a); | ||
return t && u ? t.serialize(u) : u; | ||
}, g = () => t ? o.all().map(t.serialize) : o.all(), L = () => { | ||
var i; | ||
const f = (((i = s.selected) == null ? void 0 : i.map((h) => h.id)) || []).map((h) => o.getAnnotation(h)).filter(Boolean); | ||
return t ? f.map(t.serialize) : f; | ||
}, a = (l, f = !0) => fetch(l).then((i) => i.json()).then((i) => (w(i, f), i)), u = (l) => { | ||
if (typeof l == "string") { | ||
const f = o.getAnnotation(l); | ||
if (o.deleteAnnotation(l), f) | ||
return t ? t.serialize(f) : f; | ||
var s; | ||
const u = (((s = i.selected) == null ? void 0 : s.map((h) => h.id)) || []).map((h) => o.getAnnotation(h)).filter(Boolean); | ||
return t ? u.map(t.serialize) : u; | ||
}, r = (a, u = !0) => fetch(a).then((s) => s.json()).then((s) => (m(s, u), s)), E = (a) => { | ||
if (typeof a == "string") { | ||
const u = o.getAnnotation(a); | ||
if (o.deleteAnnotation(a), u) | ||
return t ? t.serialize(u) : u; | ||
} else { | ||
const f = t ? t.parse(l).parsed : l; | ||
if (f) | ||
return o.deleteAnnotation(f), l; | ||
const u = t ? t.parse(a).parsed : a; | ||
if (u) | ||
return o.deleteAnnotation(u), a; | ||
} | ||
}, w = (l, f = !0) => { | ||
}, m = (a, u = !0) => { | ||
if (t) { | ||
const { parsed: i, failed: h } = ue(t)(l); | ||
h.length > 0 && console.warn(`Discarded ${h.length} invalid annotations`, h), o.bulkAddAnnotation(i, f, O.REMOTE); | ||
const { parsed: s, failed: h } = ue(t)(a); | ||
h.length > 0 && console.warn(`Discarded ${h.length} invalid annotations`, h), o.bulkAddAnnotation(s, u, O.REMOTE); | ||
} else | ||
o.bulkAddAnnotation(l, f, O.REMOTE); | ||
}, v = (l, f) => { | ||
l ? s.setSelected(l, f) : s.clear(); | ||
}, U = (l) => { | ||
s.clear(), s.setUserSelectAction(l); | ||
}, T = (l) => { | ||
o.bulkAddAnnotation(a, u, O.REMOTE); | ||
}, v = (a, u) => { | ||
a ? i.setSelected(a, u) : i.clear(); | ||
}, U = (a) => { | ||
i.clear(), i.setUserSelectAction(a); | ||
}, T = (a) => { | ||
if (t) { | ||
const f = t.parse(l).parsed, i = t.serialize(o.getAnnotation(f.id)); | ||
return o.updateAnnotation(f), i; | ||
const u = t.parse(a).parsed, s = t.serialize(o.getAnnotation(u.id)); | ||
return o.updateAnnotation(u), s; | ||
} else { | ||
const f = o.getAnnotation(l.id); | ||
return o.updateAnnotation(l), f; | ||
const u = o.getAnnotation(a.id); | ||
return o.updateAnnotation(a), u; | ||
} | ||
}; | ||
return { | ||
addAnnotation: m, | ||
cancelSelected: E, | ||
addAnnotation: f, | ||
cancelSelected: w, | ||
canRedo: n.canRedo, | ||
@@ -684,6 +684,6 @@ canUndo: n.canUndo, | ||
getSelected: L, | ||
loadAnnotations: a, | ||
loadAnnotations: r, | ||
redo: n.redo, | ||
removeAnnotation: u, | ||
setAnnotations: w, | ||
removeAnnotation: E, | ||
setAnnotations: m, | ||
setSelected: v, | ||
@@ -696,9 +696,9 @@ setUserSelectAction: U, | ||
let pe = (e) => crypto.getRandomValues(new Uint8Array(e)), ge = (e, n, t) => { | ||
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, s = -~(1.6 * o * n / e.length); | ||
return (m = n) => { | ||
let E = ""; | ||
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * n / e.length); | ||
return (f = n) => { | ||
let w = ""; | ||
for (; ; ) { | ||
let b = t(s), y = s; | ||
let b = t(i), y = i; | ||
for (; y--; ) | ||
if (E += e[b[y] & o] || "", E.length === m) return E; | ||
if (w += e[b[y] & o] || "", w.length === f) return w; | ||
} | ||
@@ -715,15 +715,15 @@ }; | ||
let t = 0; | ||
for (let o = 0, s = n.length; o < s; o++) { | ||
let m = n.charCodeAt(o); | ||
t = (t << 5) - t + m, t |= 0; | ||
for (let o = 0, i = n.length; o < i; o++) { | ||
let f = n.charCodeAt(o); | ||
t = (t << 5) - t + f, t |= 0; | ||
} | ||
return `${t}`; | ||
}, be = (e) => e ? typeof e == "object" ? { ...e } : e : void 0, $e = (e, n) => (Array.isArray(e) ? e : [e]).map((t) => { | ||
const { id: o, type: s, purpose: m, value: E, created: b, modified: y, creator: g, ...L } = t; | ||
const { id: o, type: i, purpose: f, value: w, created: b, modified: y, creator: g, ...L } = t; | ||
return { | ||
id: o || `temp-${Ae(t)}`, | ||
annotation: n, | ||
type: s, | ||
purpose: m, | ||
value: E, | ||
type: i, | ||
purpose: f, | ||
value: w, | ||
creator: be(g), | ||
@@ -736,8 +736,8 @@ created: b ? new Date(b) : void 0, | ||
var b; | ||
const { annotation: t, created: o, updated: s, ...m } = n, E = { | ||
...m, | ||
const { annotation: t, created: o, updated: i, ...f } = n, w = { | ||
...f, | ||
created: o == null ? void 0 : o.toISOString(), | ||
modified: s == null ? void 0 : s.toISOString() | ||
modified: i == null ? void 0 : i.toISOString() | ||
}; | ||
return (b = E.id) != null && b.startsWith("temp-") && delete E.id, E; | ||
return (b = w.id) != null && b.startsWith("temp-") && delete w.id, w; | ||
}), ve = [ | ||
@@ -765,55 +765,55 @@ "#ff7c00", | ||
return { assignRandomColor: () => { | ||
const o = Math.floor(Math.random() * e.length), s = e[o]; | ||
return e.splice(o, 1), s; | ||
const o = Math.floor(Math.random() * e.length), i = e[o]; | ||
return e.splice(o, 1), i; | ||
}, releaseColor: (o) => e.push(o) }; | ||
}, ye = () => { | ||
const e = Ee(); | ||
return { addUser: (o, s) => { | ||
const m = e.assignRandomColor(); | ||
return { addUser: (o, i) => { | ||
const f = e.assignRandomColor(); | ||
return { | ||
label: s.name || s.id, | ||
avatar: s.avatar, | ||
color: m | ||
label: i.name || i.id, | ||
avatar: i.avatar, | ||
color: f | ||
}; | ||
}, removeUser: (o) => e.releaseColor(o.appearance.color) }; | ||
}, we = (e, n) => e.every((t) => e.includes(t)) && n.every((t) => e.includes(t)), _e = me(), Ye = (e = ye()) => { | ||
const n = J(), t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = (a, u) => { | ||
if (t.has(a)) { | ||
console.warn("Attempt to add user that is already present", a, u); | ||
const n = J(), t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (r, E) => { | ||
if (t.has(r)) { | ||
console.warn("Attempt to add user that is already present", r, E); | ||
return; | ||
} | ||
const w = e.addUser(a, u); | ||
t.set(a, { | ||
...u, | ||
presenceKey: a, | ||
appearance: w | ||
const m = e.addUser(r, E); | ||
t.set(r, { | ||
...E, | ||
presenceKey: r, | ||
appearance: m | ||
}); | ||
}, m = (a) => { | ||
const u = t.get(a); | ||
if (!u) { | ||
console.warn("Attempt to remove user that is not present", a); | ||
}, f = (r) => { | ||
const E = t.get(r); | ||
if (!E) { | ||
console.warn("Attempt to remove user that is not present", r); | ||
return; | ||
} | ||
e.removeUser(u), t.delete(a); | ||
}, E = (a) => { | ||
const u = new Set(a.map((U) => U.presenceKey)), w = a.filter(({ presenceKey: U }) => !t.has(U)), v = Array.from(t.values()).filter((U) => !u.has(U.presenceKey)); | ||
w.forEach(({ presenceKey: U, user: T }) => s(U, T)), v.forEach((U) => { | ||
e.removeUser(E), t.delete(r); | ||
}, w = (r) => { | ||
const E = new Set(r.map((U) => U.presenceKey)), m = r.filter(({ presenceKey: U }) => !t.has(U)), v = Array.from(t.values()).filter((U) => !E.has(U.presenceKey)); | ||
m.forEach(({ presenceKey: U, user: T }) => i(U, T)), v.forEach((U) => { | ||
const { presenceKey: T } = U; | ||
o.has(T) && n.emit("selectionChange", U, null), m(T); | ||
}), (w.length > 0 || v.length > 0) && n.emit("presence", g()); | ||
}, b = (a, u) => { | ||
const w = t.get(a); | ||
if (!w) { | ||
o.has(T) && n.emit("selectionChange", U, null), f(T); | ||
}), (m.length > 0 || v.length > 0) && n.emit("presence", g()); | ||
}, b = (r, E) => { | ||
const m = t.get(r); | ||
if (!m) { | ||
console.warn("Activity notification from user that is not present"); | ||
return; | ||
} | ||
const v = o.get(a); | ||
(!v || !we(v, u)) && (o.set(a, u), n.emit("selectionChange", w, u)); | ||
}, y = (a, u) => { | ||
const w = t.get(a); | ||
if (!w) { | ||
console.warn("Selection change for user that is not present", a); | ||
const v = o.get(r); | ||
(!v || !we(v, E)) && (o.set(r, E), n.emit("selectionChange", m, E)); | ||
}, y = (r, E) => { | ||
const m = t.get(r); | ||
if (!m) { | ||
console.warn("Selection change for user that is not present", r); | ||
return; | ||
} | ||
u ? o.set(a, u) : o.delete(a), n.emit("selectionChange", w, u); | ||
E ? o.set(r, E) : o.delete(r), n.emit("selectionChange", m, E); | ||
}, g = () => [...Array.from(t.values())]; | ||
@@ -823,4 +823,4 @@ return { | ||
notifyActivity: b, | ||
on: (a, u) => n.on(a, u), | ||
syncUsers: E, | ||
on: (r, E) => n.on(r, E), | ||
syncUsers: w, | ||
updateSelection: y | ||
@@ -827,0 +827,0 @@ }; |
@@ -18,3 +18,3 @@ import { Annotation } from '../model'; | ||
export type UserSelectActionExpression<T extends Annotation> = UserSelectAction | ((a: T) => UserSelectAction); | ||
export declare const createSelectionState: <T extends Annotation>(store: Store<T>) => { | ||
export declare const createSelectionState: <T extends Annotation>(store: Store<T>, defaultSelectionAction?: UserSelectActionExpression<T>) => { | ||
readonly event: PointerEvent | KeyboardEvent | null | undefined; | ||
@@ -21,0 +21,0 @@ readonly selected: { |
@@ -20,4 +20,4 @@ import { Annotation, Annotator, AnnotatorState } from '../model'; | ||
*/ | ||
export declare const toSvelteStore: <T extends Annotation>(store: Store<T>) => SvelteStore<T>; | ||
export declare const toSvelteStore: <T extends Annotation = Annotation>(store: Store<T>) => SvelteStore<T>; | ||
export {}; | ||
//# sourceMappingURL=SvelteStore.d.ts.map |
{ | ||
"name": "@annotorious/core", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Annotorious core types and functions", | ||
"author": "Rainer Simon", | ||
"license": "BSD-3-Clause", | ||
"homepage": "https://annotorious.github.io", | ||
"homepage": "https://annotorious.dev", | ||
"type": "module", | ||
@@ -9,0 +9,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
182353