Skip to content

Commit 504dc16

Browse files
committed
v0.14.3
1 parent 95f2a8c commit 504dc16

File tree

3 files changed

+50
-50
lines changed

3 files changed

+50
-50
lines changed

dist/veloxi.js

+48-48
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function Fe(o) {
3232
return t === 0 ? e.toLowerCase() : e.toUpperCase();
3333
}).replace(/\s+/g, "").replace(/-+/g, "");
3434
}
35-
function _e(o) {
35+
function ge(o) {
3636
return o.split("").map((e, t) => e.toUpperCase() === e ? `${t !== 0 ? "-" : ""}${e.toLowerCase()}` : e).join("");
3737
}
3838
class C {
@@ -103,7 +103,7 @@ class Me {
103103
this.call(e);
104104
}
105105
}
106-
class ge extends Me {
106+
class _e extends Me {
107107
constructor(t) {
108108
super();
109109
a(this, "_handler");
@@ -127,7 +127,7 @@ class z {
127127
return;
128128
}
129129
let s = this._listeners.get(e);
130-
s || (s = [], this._listeners.set(e, s)), s.push(new ge(t));
130+
s || (s = [], this._listeners.set(e, s)), s.push(new _e(t));
131131
}
132132
removeEventListener(e, t, i) {
133133
if (i) {
@@ -143,7 +143,7 @@ class z {
143143
let s = this._keyedListeners.get(e);
144144
s || (s = /* @__PURE__ */ new Map(), this._keyedListeners.set(e, s));
145145
let n = s.get(i);
146-
n || (n = [], s.set(i, n)), n.push(new ge(t));
146+
n || (n = [], s.set(i, n)), n.push(new _e(t));
147147
}
148148
_removeKeyedEventListener(e, t, i) {
149149
let s = this._keyedListeners.get(e);
@@ -587,9 +587,9 @@ function He(o, e, t, i, s) {
587587
return (o - e) / (t - e) * (s - i) + i;
588588
}
589589
function je(o, e, t, i) {
590-
const s = e.getScroll(), n = e.position.x - s.x, r = e.position.y - s.y, l = o.x || n, u = o.y || r, c = Math.abs(n - l), d = Math.abs(r - u), g = Math.sqrt(c * c + d * d);
591-
let _ = U(0, g / t, 1);
592-
return typeof i > "u" ? 1 - _ : g <= i ? 1 : (_ = U((g - i) / t, 0, 1), 1 - _);
590+
const s = e.getScroll(), n = e.position.x - s.x, r = e.position.y - s.y, l = o.x || n, u = o.y || r, c = Math.abs(n - l), d = Math.abs(r - u), _ = Math.sqrt(c * c + d * d);
591+
let g = U(0, _ / t, 1);
592+
return typeof i > "u" ? 1 - g : _ <= i ? 1 : (g = U((_ - i) / t, 0, 1), 1 - g);
593593
}
594594
function m(o) {
595595
let e = o.match(/^([\d.]+)([a-zA-Z%]*)$/);
@@ -882,11 +882,11 @@ class at extends K {
882882
class ot extends K {
883883
update({ animatorProp: e, current: t, target: i, dt: s }) {
884884
return i.map((n, r) => {
885-
const l = t[r], u = n.value === 0 ? l.unit : n.unit, d = (n.value - l.value) * this._config.speed, g = l.value + d * s;
886-
let _ = m(`${g}${u}`);
887-
return this._shouldFinish(n.value, l.value, d) && (_ = n, requestAnimationFrame(() => {
885+
const l = t[r], u = n.value === 0 ? l.unit : n.unit, d = (n.value - l.value) * this._config.speed, _ = l.value + d * s;
886+
let g = m(`${_}${u}`);
887+
return this._shouldFinish(n.value, l.value, d) && (g = n, requestAnimationFrame(() => {
888888
e.callCompleteCallback();
889-
})), e.callUpdateCallback(), _;
889+
})), e.callUpdateCallback(), g;
890890
});
891891
}
892892
_shouldFinish(e, t, i) {
@@ -968,11 +968,11 @@ class ht extends J {
968968
return s.map((r, l) => {
969969
const u = i[l], c = r.value === 0 ? u.unit : r.unit, d = -(u.value - r.value) * this._config.stiffness;
970970
this._velocity += d, this._velocity *= this._config.damping;
971-
const g = u.value + this._velocity * n * this._config.speed;
972-
let _ = m(`${g}${c}`);
973-
return this._shouldFinish(r.value, u.value) && (_ = r, requestAnimationFrame(() => {
971+
const _ = u.value + this._velocity * n * this._config.speed;
972+
let g = m(`${_}${c}`);
973+
return this._shouldFinish(r.value, u.value) && (g = r, requestAnimationFrame(() => {
974974
t.callCompleteCallback();
975-
})), _;
975+
})), g;
976976
});
977977
}
978978
_shouldFinish(t, i) {
@@ -1012,7 +1012,7 @@ class dt extends ee {
10121012
);
10131013
}
10141014
}
1015-
class _t extends ee {
1015+
class gt extends ee {
10161016
update({ animatorProp: e, initial: t, target: i, ts: s }) {
10171017
this._startTime || (this._startTime = s);
10181018
const n = Math.min(1, (s - this._startTime) / this._config.duration);
@@ -1024,7 +1024,7 @@ class _t extends ee {
10241024
});
10251025
}
10261026
}
1027-
class gt extends ee {
1027+
class _t extends ee {
10281028
update({ animatorProp: e, initial: t, target: i, ts: s }) {
10291029
this._startTime || (this._startTime = s);
10301030
const n = Math.min(1, (s - this._startTime) / this._config.duration);
@@ -1067,7 +1067,7 @@ class pt extends te {
10671067
return new G();
10681068
}
10691069
createTweenAnimator(e) {
1070-
return new _t({ ...Q, ...e });
1070+
return new gt({ ...Q, ...e });
10711071
}
10721072
createDynamicAnimator(e) {
10731073
return new ot({
@@ -1087,7 +1087,7 @@ class we extends te {
10871087
return new at({ ...j, ...e });
10881088
}
10891089
createTweenAnimator(e) {
1090-
return new gt({ ...Q, ...e });
1090+
return new _t({ ...Q, ...e });
10911091
}
10921092
createSpringAnimator(e) {
10931093
return new ut({ ...Z, ...e });
@@ -1453,8 +1453,8 @@ class wt extends P {
14531453
}
14541454
update(t, i) {
14551455
if ((this._view.isInverseEffectEnabled || this._view.isLayoutTransitionEnabled) && !this._view.isTemporaryView && this._runLayoutTransition(), this._view.isInverseEffectEnabled) {
1456-
const c = this._view._parent, d = c ? c.scale.x : 1, g = c ? c.scale.y : 1;
1457-
this._parentScaleInverse = new h(1 / d, 1 / g), this._parentScaleInverse.equals(new h(1, 1)) || (this._hasChanged = !0);
1456+
const c = this._view._parent, d = c ? c.scale.x : 1, _ = c ? c.scale.y : 1;
1457+
this._parentScaleInverse = new h(1 / d, 1 / _), this._parentScaleInverse.equals(new h(1, 1)) || (this._hasChanged = !0);
14581458
}
14591459
if (this._targetValue.x === this._currentValue.x && this._targetValue.y === this._currentValue.y)
14601460
return;
@@ -1482,8 +1482,8 @@ class wt extends P {
14821482
let c = !1;
14831483
if (n !== 0 || r !== 0 || !Number.isNaN(l) && l !== 1 || !Number.isNaN(u) && u !== 1 ? c = !0 : c = (() => {
14841484
const d = this._view._parents;
1485-
for (let g = 0; g < d.length; g++) {
1486-
const _ = d[g], v = _.previousRect.size.width / _.rect.size.width, f = _.previousRect.size.height / _.rect.size.height;
1485+
for (let _ = 0; _ < d.length; _++) {
1486+
const g = d[_], v = g.previousRect.size.width / g.rect.size.width, f = g.previousRect.size.height / g.rect.size.height;
14871487
if (v !== 1 || f !== 1)
14881488
return !0;
14891489
}
@@ -1521,13 +1521,13 @@ class wt extends P {
15211521
return;
15221522
}
15231523
this._animateLayoutUpdateNextFrame = !0;
1524-
const d = this._previousRect, g = this._rect, _ = this._view._parent;
1524+
const d = this._previousRect, _ = this._rect, g = this._view._parent;
15251525
let v = 0, f = 0;
1526-
_ && (v = _.previousRect.viewportOffset.left - _.rect.viewportOffset.left), _ && (f = _.previousRect.viewportOffset.top - _.rect.viewportOffset.top);
1526+
g && (v = g.previousRect.viewportOffset.left - g.rect.viewportOffset.left), g && (f = g.previousRect.viewportOffset.top - g.rect.viewportOffset.top);
15271527
let w = 1, y = 1;
1528-
_ && (w = _.previousRect.size.width / _.rect.size.width, y = _.previousRect.size.height / _.rect.size.height);
1529-
const k = _ ? _.previousRect.viewportOffset.left : 0, Te = _ ? _.previousRect.viewportOffset.top : 0, se = d.viewportOffset.left - k, ne = d.viewportOffset.top - Te, Ae = se / w - se, Ie = ne / y - ne;
1530-
let E = d.viewportOffset.left - g.viewportOffset.left - v + Ae, x = d.viewportOffset.top - g.viewportOffset.top - f + Ie;
1528+
g && (w = g.previousRect.size.width / g.rect.size.width, y = g.previousRect.size.height / g.rect.size.height);
1529+
const k = g ? g.previousRect.viewportOffset.left : 0, Te = g ? g.previousRect.viewportOffset.top : 0, se = d.viewportOffset.left - k, ne = d.viewportOffset.top - Te, Ae = se / w - se, Ie = ne / y - ne;
1530+
let E = d.viewportOffset.left - _.viewportOffset.left - v + Ae, x = d.viewportOffset.top - _.viewportOffset.top - f + Ie;
15311531
E = Number.isFinite(E) ? E : 0, x = Number.isFinite(x) ? x : 0, this._setTarget(new h(E, x), !1);
15321532
} else this._animateLayoutUpdateNextFrame && (this._setTarget(this._initialValue, !0), this._animateLayoutUpdateNextFrame = !1);
15331533
}
@@ -1650,9 +1650,9 @@ class Pt extends P {
16501650
let n = !1;
16511651
if ((!Number.isNaN(i) && i !== 1 || !Number.isNaN(s) && s !== 1) && (n = !0), n) {
16521652
if (this._currentValue.x !== 1 || this._currentValue.y !== 1) {
1653-
const d = this._view.previousRect.size.width / this._view.rect.size.width, g = this._view.previousRect.size.height / this._view.rect.size.height;
1653+
const d = this._view.previousRect.size.width / this._view.rect.size.width, _ = this._view.previousRect.size.height / this._view.rect.size.height;
16541654
this._setTarget(
1655-
new h(this._currentValue.x * d, this._currentValue.y * g),
1655+
new h(this._currentValue.x * d, this._currentValue.y * _),
16561656
!1
16571657
), t && (this._animateLayoutUpdateNextFrame = !0);
16581658
return;
@@ -2113,7 +2113,7 @@ class Et {
21132113
"border-radius"
21142114
], s = {};
21152115
for (const u in t)
2116-
t.hasOwnProperty(u) && (s[_e(u)] = t[u]);
2116+
t.hasOwnProperty(u) && (s[ge(u)] = t[u]);
21172117
return e.split(";").map((u) => u.trim()).filter(Boolean).filter((u) => {
21182118
const c = u.indexOf(":");
21192119
if (c === -1) return !1;
@@ -2124,7 +2124,7 @@ class Et {
21242124
_getUserStyles() {
21252125
return Object.keys(this.styles).reduce((e, t) => {
21262126
if (!t) return e;
2127-
const i = _e(t).replace("webkit", "-webkit").replace("moz", "-moz");
2127+
const i = ge(t).replace("webkit", "-webkit").replace("moz", "-moz");
21282128
return e + `${i}: ${this.styles[t]}; `;
21292129
}, this._externalUserStyles);
21302130
}
@@ -2262,8 +2262,8 @@ class xt {
22622262
c
22632263
);
22642264
this._plugins.push(d);
2265-
const g = n.dataset.velView, _ = this._createNewView(n, g, d);
2266-
_.isInverseEffectEnabled && _.setAnimatorsFromParent(), d.notifyAboutViewAdded(_);
2265+
const _ = n.dataset.velView, g = this._createNewView(n, _, d);
2266+
g.isInverseEffectEnabled && g.setAnimatorsFromParent(), d.notifyAboutViewAdded(g);
22672267
});
22682268
const s = i.filter((n) => !!this._getPluginIdForElement(n));
22692269
s.length !== 0 && s.forEach((n) => {
@@ -2461,13 +2461,13 @@ class xt {
24612461
c
24622462
);
24632463
this._plugins.push(d);
2464-
let g = [];
2465-
u !== document.documentElement && g.push(u);
2466-
const _ = u.querySelectorAll(
2464+
let _ = [];
2465+
u !== document.documentElement && _.push(u);
2466+
const g = u.querySelectorAll(
24672467
`[data-vel-plugin=${d.pluginName}]`
24682468
);
2469-
g = [...g, ..._];
2470-
const v = g.filter((f) => {
2469+
_ = [..._, ...g];
2470+
const v = _.filter((f) => {
24712471
if (this._isElementIgnored(f))
24722472
return !1;
24732473
if (!f.parentElement)
@@ -2740,23 +2740,23 @@ class At extends H {
27402740
r
27412741
);
27422742
this._emitEvent(n, c), clearTimeout(this._stopTimer), this._stopTimer = setTimeout(() => {
2743-
this._emitEvent(n, c, !0);
2743+
this._pointerDownPerView.get(n.id) === !0 && this._emitEvent(n, c, !0);
27442744
}, 120);
27452745
}
27462746
});
27472747
});
27482748
}
27492749
_emitEvent(t, i, s = !1) {
2750-
const n = this._viewPointerPositionLog.get(t.id), r = n && n.length >= 2 ? n[n.length - 2] : null, l = this._pointerX - this._initialPointerPerView.get(t.id).x, u = this._pointerY - this._initialPointerPerView.get(t.id).y, c = this._pointerX, d = this._pointerY, g = r ? r.x - this._initialPointerPerView.get(t.id).x : l, _ = r ? r.y - this._initialPointerPerView.get(t.id).y : u, v = this._pointerY - this._initialPointer.y, f = this._pointerX - this._initialPointer.x, w = xe(this._initialPointer, {
2750+
const n = this._viewPointerPositionLog.get(t.id), r = n && n.length >= 2 ? n[n.length - 2] : null, l = this._pointerX - this._initialPointerPerView.get(t.id).x, u = this._pointerY - this._initialPointerPerView.get(t.id).y, c = this._pointerX, d = this._pointerY, _ = r ? r.x - this._initialPointerPerView.get(t.id).x : l, g = r ? r.y - this._initialPointerPerView.get(t.id).y : u, v = this._pointerY - this._initialPointer.y, f = this._pointerX - this._initialPointer.x, w = xe(this._initialPointer, {
27512751
x: this._pointerX,
27522752
y: this._pointerY
27532753
}), y = this._pointerDownPerView.get(t.id) === !0;
27542754
y || this._viewPointerPositionLog.clear();
27552755
const k = {
27562756
view: t,
27572757
target: t.element,
2758-
previousX: g,
2759-
previousY: _,
2758+
previousX: _,
2759+
previousY: g,
27602760
x: l,
27612761
y: u,
27622762
pointerX: c,
@@ -2828,10 +2828,10 @@ class Nt extends H {
28282828
this.getViews().forEach((r) => {
28292829
if (!this._viewIsPointerDownMap.get(r.id) || !this._viewPointerPositionLog.has(r.id))
28302830
return;
2831-
const l = new h(i, s), u = this._viewPointerPositionLog.get(r.id), c = u[u.length - 2] || l.clone(), d = this._targetPerView.get(r.id), g = n(c, l);
2832-
d && r.hasElement(d) && g.hasSwiped && this.emit(It, {
2831+
const l = new h(i, s), u = this._viewPointerPositionLog.get(r.id), c = u[u.length - 2] || l.clone(), d = this._targetPerView.get(r.id), _ = n(c, l);
2832+
d && r.hasElement(d) && _.hasSwiped && this.emit(It, {
28332833
view: r,
2834-
direction: g.direction
2834+
direction: _.direction
28352835
}), this._viewPointerPositionLog.set(r.id, []), this._viewIsPointerDownMap.set(r.id, !1);
28362836
});
28372837
function n(r, l) {
@@ -2845,12 +2845,12 @@ class Nt extends H {
28452845
"down",
28462846
"left",
28472847
"right"
2848-
], g = [
2848+
], _ = [
28492849
c.dot(u.up),
28502850
c.dot(u.down),
28512851
c.dot(u.left),
28522852
c.dot(u.right)
2853-
], _ = Math.max(...g), v = g.indexOf(_), f = d[v], w = h.sub(l, r).magnitude;
2853+
], g = Math.max(..._), v = _.indexOf(g), f = d[v], w = h.sub(l, r).magnitude;
28542854
return {
28552855
hasSwiped: c.dot(u[f]) * w > 30,
28562856
direction: f

dist/veloxi.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "veloxi",
33
"author": "Taha Shashtari ([email protected])",
4-
"version": "0.14.2",
4+
"version": "0.14.3",
55
"private": false,
66
"type": "module",
77
"main": "./dist/veloxi.min.js",

0 commit comments

Comments
 (0)