@nil-/xit 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/bundler.js +46 -41
- package/assets/index.js +1586 -2476
- package/assets/svelte/animate.js +27 -0
- package/assets/svelte/easing.js +130 -0
- package/assets/svelte/events.js +4 -0
- package/assets/svelte/index.js +2002 -0
- package/assets/svelte/internal/client.js +2226 -0
- package/assets/svelte/internal/disclose-version.js +2 -0
- package/assets/svelte/motion.js +192 -0
- package/assets/svelte/store.js +161 -0
- package/assets/svelte/transition.js +142 -0
- package/index.d.ts +6 -6
- package/package.json +1 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { w as P } from "./store.js";
|
|
2
|
+
import { linear as z } from "./easing.js";
|
|
3
|
+
const C = requestAnimationFrame, D = () => performance.now(), p = {
|
|
4
|
+
tick: (
|
|
5
|
+
/** @param {any} _ */
|
|
6
|
+
(t) => C(t)
|
|
7
|
+
),
|
|
8
|
+
now: () => D(),
|
|
9
|
+
tasks: /* @__PURE__ */ new Set()
|
|
10
|
+
};
|
|
11
|
+
function O(t) {
|
|
12
|
+
p.tasks.forEach((r) => {
|
|
13
|
+
r.c(t) || (p.tasks.delete(r), r.f());
|
|
14
|
+
}), p.tasks.size !== 0 && p.tick(O);
|
|
15
|
+
}
|
|
16
|
+
function M(t) {
|
|
17
|
+
let r;
|
|
18
|
+
return p.tasks.size === 0 && p.tick(O), {
|
|
19
|
+
promise: new Promise((e) => {
|
|
20
|
+
p.tasks.add(r = { c: t, f: e });
|
|
21
|
+
}),
|
|
22
|
+
abort() {
|
|
23
|
+
p.tasks.delete(r);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function h(t) {
|
|
28
|
+
return Object.prototype.toString.call(t) === "[object Date]";
|
|
29
|
+
}
|
|
30
|
+
function j(t, r, e, i) {
|
|
31
|
+
if (typeof e == "number" || h(e)) {
|
|
32
|
+
const n = i - e, s = (e - r) / (t.dt || 1 / 60), o = t.opts.stiffness * n, f = t.opts.damping * s, c = (o - f) * t.inv_mass, l = (s + c) * t.dt;
|
|
33
|
+
return Math.abs(l) < t.opts.precision && Math.abs(n) < t.opts.precision ? i : (t.settled = !1, h(e) ? new Date(e.getTime() + l) : e + l);
|
|
34
|
+
} else {
|
|
35
|
+
if (Array.isArray(e))
|
|
36
|
+
return e.map(
|
|
37
|
+
(n, s) => (
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
j(t, r[s], e[s], i[s])
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
if (typeof e == "object") {
|
|
43
|
+
const n = {};
|
|
44
|
+
for (const s in e)
|
|
45
|
+
n[s] = j(t, r[s], e[s], i[s]);
|
|
46
|
+
return n;
|
|
47
|
+
} else
|
|
48
|
+
throw new Error(`Cannot spring ${typeof e} values`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function q(t, r = {}) {
|
|
52
|
+
const e = P(t), { stiffness: i = 0.15, damping: n = 0.8, precision: s = 0.01 } = r;
|
|
53
|
+
let o, f, c, l = (
|
|
54
|
+
/** @type {T} */
|
|
55
|
+
t
|
|
56
|
+
), y = (
|
|
57
|
+
/** @type {T | undefined} */
|
|
58
|
+
t
|
|
59
|
+
), a = 1, w = 0, b = !1;
|
|
60
|
+
function k(u, m = {}) {
|
|
61
|
+
y = u;
|
|
62
|
+
const S = c = {};
|
|
63
|
+
return t == null || m.hard || d.stiffness >= 1 && d.damping >= 1 ? (b = !0, o = p.now(), l = u, e.set(t = y), Promise.resolve()) : (m.soft && (w = 1 / ((m.soft === !0 ? 0.5 : +m.soft) * 60), a = 0), f || (o = p.now(), b = !1, f = M((g) => {
|
|
64
|
+
if (b)
|
|
65
|
+
return b = !1, f = null, !1;
|
|
66
|
+
a = Math.min(a + w, 1);
|
|
67
|
+
const A = {
|
|
68
|
+
inv_mass: a,
|
|
69
|
+
opts: d,
|
|
70
|
+
settled: !0,
|
|
71
|
+
dt: (g - o) * 60 / 1e3
|
|
72
|
+
}, T = j(A, l, t, y);
|
|
73
|
+
return o = g, l = /** @type {T} */
|
|
74
|
+
t, e.set(t = /** @type {T} */
|
|
75
|
+
T), A.settled && (f = null), !A.settled;
|
|
76
|
+
})), new Promise((g) => {
|
|
77
|
+
f.promise.then(() => {
|
|
78
|
+
S === c && g();
|
|
79
|
+
});
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
const d = {
|
|
83
|
+
set: k,
|
|
84
|
+
update: (u, m) => k(u(
|
|
85
|
+
/** @type {T} */
|
|
86
|
+
y,
|
|
87
|
+
/** @type {T} */
|
|
88
|
+
t
|
|
89
|
+
), m),
|
|
90
|
+
subscribe: e.subscribe,
|
|
91
|
+
stiffness: i,
|
|
92
|
+
damping: n,
|
|
93
|
+
precision: s
|
|
94
|
+
};
|
|
95
|
+
return d;
|
|
96
|
+
}
|
|
97
|
+
function E(t, r) {
|
|
98
|
+
if (t === r || t !== t) return () => t;
|
|
99
|
+
const e = typeof t;
|
|
100
|
+
if (e !== typeof r || Array.isArray(t) !== Array.isArray(r))
|
|
101
|
+
throw new Error("Cannot interpolate values of different type");
|
|
102
|
+
if (Array.isArray(t)) {
|
|
103
|
+
const i = (
|
|
104
|
+
/** @type {Array<any>} */
|
|
105
|
+
r.map((n, s) => E(
|
|
106
|
+
/** @type {Array<any>} */
|
|
107
|
+
t[s],
|
|
108
|
+
n
|
|
109
|
+
))
|
|
110
|
+
);
|
|
111
|
+
return (n) => i.map((s) => s(n));
|
|
112
|
+
}
|
|
113
|
+
if (e === "object") {
|
|
114
|
+
if (!t || !r)
|
|
115
|
+
throw new Error("Object cannot be null");
|
|
116
|
+
if (h(t) && h(r)) {
|
|
117
|
+
const s = t.getTime(), f = r.getTime() - s;
|
|
118
|
+
return (c) => new Date(s + c * f);
|
|
119
|
+
}
|
|
120
|
+
const i = Object.keys(r), n = {};
|
|
121
|
+
return i.forEach((s) => {
|
|
122
|
+
n[s] = E(t[s], r[s]);
|
|
123
|
+
}), (s) => {
|
|
124
|
+
const o = {};
|
|
125
|
+
return i.forEach((f) => {
|
|
126
|
+
o[f] = n[f](s);
|
|
127
|
+
}), o;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (e === "number") {
|
|
131
|
+
const i = (
|
|
132
|
+
/** @type {number} */
|
|
133
|
+
r - /** @type {number} */
|
|
134
|
+
t
|
|
135
|
+
);
|
|
136
|
+
return (n) => t + n * i;
|
|
137
|
+
}
|
|
138
|
+
throw new Error(`Cannot interpolate ${e} values`);
|
|
139
|
+
}
|
|
140
|
+
function _(t, r = {}) {
|
|
141
|
+
const e = P(t);
|
|
142
|
+
let i, n = t;
|
|
143
|
+
function s(o, f) {
|
|
144
|
+
if (n = o, t == null)
|
|
145
|
+
return e.set(t = o), Promise.resolve();
|
|
146
|
+
let c = i, l = !1, {
|
|
147
|
+
delay: y = 0,
|
|
148
|
+
duration: a = 400,
|
|
149
|
+
easing: w = z,
|
|
150
|
+
interpolate: b = E
|
|
151
|
+
} = { ...r, ...f };
|
|
152
|
+
if (a === 0)
|
|
153
|
+
return c && (c.abort(), c = null), e.set(t = n), Promise.resolve();
|
|
154
|
+
const k = p.now() + y;
|
|
155
|
+
let d;
|
|
156
|
+
return i = M((u) => {
|
|
157
|
+
if (u < k) return !0;
|
|
158
|
+
l || (d = b(
|
|
159
|
+
/** @type {any} */
|
|
160
|
+
t,
|
|
161
|
+
o
|
|
162
|
+
), typeof a == "function" && (a = a(
|
|
163
|
+
/** @type {any} */
|
|
164
|
+
t,
|
|
165
|
+
o
|
|
166
|
+
)), l = !0), c && (c.abort(), c = null);
|
|
167
|
+
const m = u - k;
|
|
168
|
+
return m > /** @type {number} */
|
|
169
|
+
a ? (e.set(t = o), !1) : (e.set(t = d(w(m / a))), !0);
|
|
170
|
+
}), i.promise;
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
set: s,
|
|
174
|
+
update: (o, f) => s(o(
|
|
175
|
+
/** @type {any} */
|
|
176
|
+
n,
|
|
177
|
+
/** @type {any} */
|
|
178
|
+
t
|
|
179
|
+
), f),
|
|
180
|
+
subscribe: e.subscribe
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
184
|
+
__proto__: null,
|
|
185
|
+
spring: q,
|
|
186
|
+
tweened: _
|
|
187
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
188
|
+
export {
|
|
189
|
+
B as i,
|
|
190
|
+
M as l,
|
|
191
|
+
p as r
|
|
192
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { n as b, u as q, s as x, r as z, a as j, e as A, b as h, c as O, g as B, t as C, d as E } from "./index.js";
|
|
2
|
+
import "./internal/client.js";
|
|
3
|
+
function m(e, t, n) {
|
|
4
|
+
if (e == null)
|
|
5
|
+
return t(void 0), n && n(void 0), b;
|
|
6
|
+
const r = q(
|
|
7
|
+
() => e.subscribe(
|
|
8
|
+
t,
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
n
|
|
11
|
+
)
|
|
12
|
+
);
|
|
13
|
+
return r.unsubscribe ? () => r.unsubscribe() : r;
|
|
14
|
+
}
|
|
15
|
+
function M(e) {
|
|
16
|
+
x(e, e.v + 1);
|
|
17
|
+
}
|
|
18
|
+
const l = [];
|
|
19
|
+
function w(e, t) {
|
|
20
|
+
return {
|
|
21
|
+
subscribe: _(e, t).subscribe
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function _(e, t = b) {
|
|
25
|
+
let n = null;
|
|
26
|
+
const r = /* @__PURE__ */ new Set();
|
|
27
|
+
function u(c) {
|
|
28
|
+
if (j(e, c) && (e = c, n)) {
|
|
29
|
+
const f = !l.length;
|
|
30
|
+
for (const s of r)
|
|
31
|
+
s[1](), l.push(s, e);
|
|
32
|
+
if (f) {
|
|
33
|
+
for (let s = 0; s < l.length; s += 2)
|
|
34
|
+
l[s][0](l[s + 1]);
|
|
35
|
+
l.length = 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function o(c) {
|
|
40
|
+
u(c(
|
|
41
|
+
/** @type {T} */
|
|
42
|
+
e
|
|
43
|
+
));
|
|
44
|
+
}
|
|
45
|
+
function i(c, f = b) {
|
|
46
|
+
const s = [c, f];
|
|
47
|
+
return r.add(s), r.size === 1 && (n = t(u, o) || b), c(
|
|
48
|
+
/** @type {T} */
|
|
49
|
+
e
|
|
50
|
+
), () => {
|
|
51
|
+
r.delete(s), r.size === 0 && n && (n(), n = null);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return { set: u, update: o, subscribe: i };
|
|
55
|
+
}
|
|
56
|
+
function P(e, t, n) {
|
|
57
|
+
const r = !Array.isArray(e), u = r ? [e] : e;
|
|
58
|
+
if (!u.every(Boolean))
|
|
59
|
+
throw new Error("derived() expects stores as input, got a falsy value");
|
|
60
|
+
const o = t.length < 2;
|
|
61
|
+
return w(n, (i, c) => {
|
|
62
|
+
let f = !1;
|
|
63
|
+
const s = [];
|
|
64
|
+
let d = 0, p = b;
|
|
65
|
+
const y = () => {
|
|
66
|
+
if (d)
|
|
67
|
+
return;
|
|
68
|
+
p();
|
|
69
|
+
const a = t(r ? s[0] : s, i, c);
|
|
70
|
+
o ? i(a) : p = typeof a == "function" ? a : b;
|
|
71
|
+
}, v = u.map(
|
|
72
|
+
(a, g) => m(
|
|
73
|
+
a,
|
|
74
|
+
(k) => {
|
|
75
|
+
s[g] = k, d &= ~(1 << g), f && y();
|
|
76
|
+
},
|
|
77
|
+
() => {
|
|
78
|
+
d |= 1 << g;
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
return f = !0, y(), function() {
|
|
83
|
+
z(v), p(), f = !1;
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function T(e) {
|
|
88
|
+
return {
|
|
89
|
+
// @ts-expect-error TODO i suspect the bind is unnecessary
|
|
90
|
+
subscribe: e.subscribe.bind(e)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function S(e) {
|
|
94
|
+
let t;
|
|
95
|
+
return m(e, (n) => t = n)(), t;
|
|
96
|
+
}
|
|
97
|
+
function $(e, t) {
|
|
98
|
+
const n = _(e(), (r) => {
|
|
99
|
+
let u = !1;
|
|
100
|
+
const o = A(() => {
|
|
101
|
+
h(() => {
|
|
102
|
+
const i = e();
|
|
103
|
+
u && r(i);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return u = !0, o;
|
|
107
|
+
});
|
|
108
|
+
return t ? {
|
|
109
|
+
set: t,
|
|
110
|
+
update: (r) => t(r(e())),
|
|
111
|
+
subscribe: n.subscribe
|
|
112
|
+
} : {
|
|
113
|
+
subscribe: n.subscribe
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function D(e) {
|
|
117
|
+
let t, n = E(0), r = 0, u = b;
|
|
118
|
+
function o() {
|
|
119
|
+
return O() ? (B(n), h(() => {
|
|
120
|
+
if (r === 0) {
|
|
121
|
+
let i = !1;
|
|
122
|
+
u = e.subscribe((c) => {
|
|
123
|
+
t = c, i && M(n);
|
|
124
|
+
}), i = !0;
|
|
125
|
+
}
|
|
126
|
+
return r += 1, () => {
|
|
127
|
+
r -= 1, C().then(() => {
|
|
128
|
+
r === 0 && u();
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
}), t) : S(e);
|
|
132
|
+
}
|
|
133
|
+
return "set" in e ? {
|
|
134
|
+
get current() {
|
|
135
|
+
return o();
|
|
136
|
+
},
|
|
137
|
+
set current(i) {
|
|
138
|
+
e.set(i);
|
|
139
|
+
}
|
|
140
|
+
} : {
|
|
141
|
+
get current() {
|
|
142
|
+
return o();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
147
|
+
__proto__: null,
|
|
148
|
+
derived: P,
|
|
149
|
+
fromStore: D,
|
|
150
|
+
get: S,
|
|
151
|
+
readable: w,
|
|
152
|
+
readonly: T,
|
|
153
|
+
toStore: $,
|
|
154
|
+
writable: _
|
|
155
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
156
|
+
export {
|
|
157
|
+
S as g,
|
|
158
|
+
H as i,
|
|
159
|
+
m as s,
|
|
160
|
+
_ as w
|
|
161
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const M = (t) => t;
|
|
2
|
+
function m(t) {
|
|
3
|
+
const e = t - 1;
|
|
4
|
+
return e * e * e + 1;
|
|
5
|
+
}
|
|
6
|
+
function C(t) {
|
|
7
|
+
return t < 0.5 ? 4 * t * t * t : 0.5 * Math.pow(2 * t - 2, 3) + 1;
|
|
8
|
+
}
|
|
9
|
+
function w(t) {
|
|
10
|
+
const e = typeof t == "string" && t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);
|
|
11
|
+
return e ? [parseFloat(e[1]), e[2] || "px"] : [
|
|
12
|
+
/** @type {number} */
|
|
13
|
+
t,
|
|
14
|
+
"px"
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
function W(t, { delay: e = 0, duration: a = 400, easing: s = C, amount: p = 5, opacity: n = 0 } = {}) {
|
|
18
|
+
const c = getComputedStyle(t), r = +c.opacity, d = c.filter === "none" ? "" : c.filter, i = r * (1 - n), [o, y] = w(p);
|
|
19
|
+
return {
|
|
20
|
+
delay: e,
|
|
21
|
+
duration: a,
|
|
22
|
+
easing: s,
|
|
23
|
+
css: (f, u) => `opacity: ${r - i * u}; filter: ${d} blur(${u * o}${y});`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function q(t, { delay: e = 0, duration: a = 400, easing: s = M } = {}) {
|
|
27
|
+
const p = +getComputedStyle(t).opacity;
|
|
28
|
+
return {
|
|
29
|
+
delay: e,
|
|
30
|
+
duration: a,
|
|
31
|
+
easing: s,
|
|
32
|
+
css: (n) => `opacity: ${n * p}`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function B(t, { delay: e = 0, duration: a = 400, easing: s = m, x: p = 0, y: n = 0, opacity: c = 0 } = {}) {
|
|
36
|
+
const r = getComputedStyle(t), d = +r.opacity, i = r.transform === "none" ? "" : r.transform, o = d * (1 - c), [y, f] = w(p), [u, _] = w(n);
|
|
37
|
+
return {
|
|
38
|
+
delay: e,
|
|
39
|
+
duration: a,
|
|
40
|
+
easing: s,
|
|
41
|
+
css: ($, h) => `
|
|
42
|
+
transform: ${i} translate(${(1 - $) * y}${f}, ${(1 - $) * u}${_});
|
|
43
|
+
opacity: ${d - o * h}`
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function L(t, { delay: e = 0, duration: a = 400, easing: s = m, axis: p = "y" } = {}) {
|
|
47
|
+
const n = getComputedStyle(t), c = +n.opacity, r = p === "y" ? "height" : "width", d = parseFloat(n[r]), i = p === "y" ? ["top", "bottom"] : ["left", "right"], o = i.map(
|
|
48
|
+
(l) => (
|
|
49
|
+
/** @type {'Left' | 'Right' | 'Top' | 'Bottom'} */
|
|
50
|
+
`${l[0].toUpperCase()}${l.slice(1)}`
|
|
51
|
+
)
|
|
52
|
+
), y = parseFloat(n[`padding${o[0]}`]), f = parseFloat(n[`padding${o[1]}`]), u = parseFloat(n[`margin${o[0]}`]), _ = parseFloat(n[`margin${o[1]}`]), $ = parseFloat(
|
|
53
|
+
n[`border${o[0]}Width`]
|
|
54
|
+
), h = parseFloat(
|
|
55
|
+
n[`border${o[1]}Width`]
|
|
56
|
+
);
|
|
57
|
+
return {
|
|
58
|
+
delay: e,
|
|
59
|
+
duration: a,
|
|
60
|
+
easing: s,
|
|
61
|
+
css: (l) => `overflow: hidden;opacity: ${Math.min(l * 20, 1) * c};${r}: ${l * d}px;padding-${i[0]}: ${l * y}px;padding-${i[1]}: ${l * f}px;margin-${i[0]}: ${l * u}px;margin-${i[1]}: ${l * _}px;border-${i[0]}-width: ${l * $}px;border-${i[1]}-width: ${l * h}px;`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function R(t, { delay: e = 0, duration: a = 400, easing: s = m, start: p = 0, opacity: n = 0 } = {}) {
|
|
65
|
+
const c = getComputedStyle(t), r = +c.opacity, d = c.transform === "none" ? "" : c.transform, i = 1 - p, o = r * (1 - n);
|
|
66
|
+
return {
|
|
67
|
+
delay: e,
|
|
68
|
+
duration: a,
|
|
69
|
+
easing: s,
|
|
70
|
+
css: (y, f) => `
|
|
71
|
+
transform: ${d} scale(${1 - i * f});
|
|
72
|
+
opacity: ${r - o * f}
|
|
73
|
+
`
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function z(t, { delay: e = 0, speed: a, duration: s, easing: p = C } = {}) {
|
|
77
|
+
let n = t.getTotalLength();
|
|
78
|
+
const c = getComputedStyle(t);
|
|
79
|
+
return c.strokeLinecap !== "butt" && (n += parseInt(c.strokeWidth)), s === void 0 ? a === void 0 ? s = 800 : s = n / a : typeof s == "function" && (s = s(n)), {
|
|
80
|
+
delay: e,
|
|
81
|
+
duration: s,
|
|
82
|
+
easing: p,
|
|
83
|
+
css: (r, d) => `
|
|
84
|
+
stroke-dasharray: ${n};
|
|
85
|
+
stroke-dashoffset: ${d * n};
|
|
86
|
+
`
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function v(t, e) {
|
|
90
|
+
for (const a in e) t[a] = e[a];
|
|
91
|
+
return (
|
|
92
|
+
/** @type {T & S} */
|
|
93
|
+
t
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function I({ fallback: t, ...e }) {
|
|
97
|
+
const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
98
|
+
function p(c, r, d) {
|
|
99
|
+
const {
|
|
100
|
+
delay: i = 0,
|
|
101
|
+
duration: o = (
|
|
102
|
+
/** @param {number} d */
|
|
103
|
+
(g) => Math.sqrt(g) * 30
|
|
104
|
+
),
|
|
105
|
+
easing: y = m
|
|
106
|
+
} = v(v({}, e), d), f = c.getBoundingClientRect(), u = r.getBoundingClientRect(), _ = f.left - u.left, $ = f.top - u.top, h = f.width / u.width, l = f.height / u.height, k = Math.sqrt(_ * _ + $ * $), x = getComputedStyle(r), F = x.transform === "none" ? "" : x.transform, S = +x.opacity;
|
|
107
|
+
return {
|
|
108
|
+
delay: i,
|
|
109
|
+
duration: typeof o == "function" ? o(k) : o,
|
|
110
|
+
easing: y,
|
|
111
|
+
css: (g, b) => `
|
|
112
|
+
opacity: ${g * S};
|
|
113
|
+
transform-origin: top left;
|
|
114
|
+
transform: ${F} translate(${b * _}px,${b * $}px) scale(${g + (1 - g) * h}, ${g + (1 - g) * l});
|
|
115
|
+
`
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function n(c, r, d) {
|
|
119
|
+
return (i, o) => (c.set(o.key, i), () => {
|
|
120
|
+
if (r.has(o.key)) {
|
|
121
|
+
const y = r.get(o.key);
|
|
122
|
+
return r.delete(o.key), p(
|
|
123
|
+
/** @type {Element} */
|
|
124
|
+
y,
|
|
125
|
+
i,
|
|
126
|
+
o
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return c.delete(o.key), t && t(i, o, d);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return [n(s, a, !1), n(a, s, !0)];
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
W as blur,
|
|
136
|
+
I as crossfade,
|
|
137
|
+
z as draw,
|
|
138
|
+
q as fade,
|
|
139
|
+
B as fly,
|
|
140
|
+
R as scale,
|
|
141
|
+
L as slide
|
|
142
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -7,16 +7,16 @@ export type Writable<T> = {
|
|
|
7
7
|
update: (cb: (v: T) => T) => void;
|
|
8
8
|
};
|
|
9
9
|
export type CoDec = {
|
|
10
|
-
encode: (o:
|
|
11
|
-
decode: (a: Uint8Array) =>
|
|
10
|
+
encode: (o: Record<string, any>) => Uint8Array;
|
|
11
|
+
decode: (a: Uint8Array) => Record<string, any>;
|
|
12
12
|
};
|
|
13
13
|
export type FrameInfo = {
|
|
14
14
|
frame: string;
|
|
15
15
|
tag?: string;
|
|
16
16
|
};
|
|
17
17
|
export type Loader = {
|
|
18
|
-
one: (f: string, tag?: string) => Action<HTMLDivElement
|
|
19
|
-
all: (f: FrameInfo[]) => Action<HTMLDivElement
|
|
18
|
+
one: (f: string, tag?: string) => Promise<Action<HTMLDivElement>>;
|
|
19
|
+
all: (f: FrameInfo[]) => Promise<Action<HTMLDivElement>>;
|
|
20
20
|
};
|
|
21
21
|
export type Xit = {
|
|
22
22
|
values: {
|
|
@@ -25,7 +25,7 @@ export type Xit = {
|
|
|
25
25
|
number: (t: string, v: number) => Writable<number>;
|
|
26
26
|
string: (t: string, v: string) => Writable<string>;
|
|
27
27
|
buffer: (t: string, v: Uint8Array) => Writable<Uint8Array>;
|
|
28
|
-
json: (t: string, v: object, codec: CoDec) => Writable<
|
|
28
|
+
json: <T>(t: string, v: object, codec: CoDec) => Writable<Record<string, any>>;
|
|
29
29
|
};
|
|
30
30
|
signals: {
|
|
31
31
|
none: (t: string) => () => void;
|
|
@@ -34,7 +34,7 @@ export type Xit = {
|
|
|
34
34
|
number: (t: string) => (v: number) => void;
|
|
35
35
|
string: (t: string) => (v: string) => void;
|
|
36
36
|
buffer: (t: string) => (v: Uint8Array) => void;
|
|
37
|
-
json: (t: string, encoder: CoDec["encode"]) => (v:
|
|
37
|
+
json: <T>(t: string, encoder: CoDec["encode"]) => (v: Record<string, any>) => void;
|
|
38
38
|
};
|
|
39
39
|
loader: Loader;
|
|
40
40
|
};
|