@bbl-digital/snorre 4.2.94 → 4.2.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/snorre.es1019.js +14 -17
- package/dist/snorre.es1020.js +10 -254
- package/dist/snorre.es1021.js +41 -2
- package/dist/snorre.es1022.js +16 -79
- package/dist/snorre.es1023.js +11 -13
- package/dist/snorre.es1024.js +24 -18
- package/dist/snorre.es1025.js +26 -13
- package/dist/snorre.es1026.js +61 -15
- package/dist/snorre.es1027.js +6 -10
- package/dist/snorre.es1028.js +10 -41
- package/dist/snorre.es1029.js +23 -10
- package/dist/snorre.es1030.js +26 -25
- package/dist/snorre.es1031.js +2 -27
- package/dist/snorre.es1032.js +11 -60
- package/dist/snorre.es1033.js +8 -5
- package/dist/snorre.es1034.js +12 -9
- package/dist/snorre.es1035.js +28 -24
- package/dist/snorre.es1036.js +254 -26
- package/dist/snorre.es1037.js +2 -2
- package/dist/snorre.es1038.js +80 -11
- package/dist/snorre.es1039.js +13 -9
- package/dist/snorre.es1040.js +18 -12
- package/dist/snorre.es1041.js +14 -28
- package/dist/snorre.es1042.js +5 -4
- package/dist/snorre.es1043.js +4 -5
- package/dist/snorre.es1124.js +24 -8
- package/dist/snorre.es1125.js +19 -22
- package/dist/snorre.es1126.js +7 -65
- package/dist/snorre.es1127.js +6 -25
- package/dist/snorre.es1128.js +22 -19
- package/dist/snorre.es1129.js +6 -7
- package/dist/snorre.es1130.js +16 -6
- package/dist/snorre.es1131.js +8 -5
- package/dist/snorre.es1132.js +8 -15
- package/dist/snorre.es1133.js +63 -7
- package/dist/snorre.es1155.js +1 -1
- package/dist/snorre.es1157.js +1 -1
- package/dist/snorre.es1334.js +5 -5
- package/dist/snorre.es1335.js +1 -1
- package/dist/snorre.es1343.js +3 -3
- package/dist/snorre.es1344.js +4 -4
- package/dist/snorre.es1345.js +4 -10
- package/dist/snorre.es1346.js +10 -6
- package/dist/snorre.es1347.js +6 -6
- package/dist/snorre.es1348.js +6 -4
- package/dist/snorre.es333.js +3 -3
- package/dist/snorre.es334.js +1 -1
- package/dist/snorre.es335.js +2 -2
- package/dist/snorre.es466.js +1 -1
- package/dist/snorre.es487.js +1 -1
- package/dist/snorre.es488.js +1 -1
- package/dist/snorre.es489.js +1 -1
- package/dist/snorre.es500.js +54 -2
- package/dist/snorre.es501.js +64 -24
- package/dist/snorre.es502.js +2 -602
- package/dist/snorre.es503.js +26 -5
- package/dist/snorre.es504.js +602 -54
- package/dist/snorre.es505.js +5 -66
- package/dist/snorre.es550.js +1 -1
- package/dist/snorre.es551.js +1 -1
- package/dist/snorre.es573.js +22 -2
- package/dist/snorre.es574.js +40 -2
- package/dist/snorre.es575.js +2 -22
- package/dist/snorre.es576.js +2 -40
- package/dist/snorre.es612.js +1 -1
- package/dist/snorre.es613.js +1 -1
- package/dist/snorre.es617.js +5 -5
- package/dist/snorre.es618.js +1 -1
- package/dist/snorre.es623.js +1 -1
- package/dist/snorre.es626.js +1 -1
- package/dist/snorre.es636.js +2 -2
- package/dist/snorre.es709.js +1 -1
- package/dist/snorre.es730.js +1 -1
- package/dist/snorre.es731.js +1 -1
- package/dist/snorre.es732.js +2 -2
- package/dist/snorre.es734.js +1 -1
- package/dist/snorre.es836.js +3 -3
- package/dist/snorre.es841.js +1 -1
- package/dist/snorre.es842.js +6 -6
- package/dist/snorre.es843.js +7 -7
- package/dist/snorre.es844.js +1 -1
- package/dist/snorre.es845.js +1 -1
- package/dist/snorre.es846.js +2 -2
- package/dist/snorre.es847.js +3 -3
- package/dist/snorre.es850.js +28 -15
- package/dist/snorre.es851.js +21 -2
- package/dist/snorre.es852.js +2 -10
- package/dist/snorre.es853.js +9 -4
- package/dist/snorre.es854.js +5 -11
- package/dist/snorre.es855.js +11 -14
- package/dist/snorre.es856.js +12 -27
- package/dist/snorre.es857.js +28 -28
- package/dist/snorre.es859.js +5 -20
- package/dist/snorre.es860.js +15 -5
- package/dist/snorre.es868.js +1 -1
- package/dist/snorre.es883.js +1 -1
- package/dist/snorre.es931.js +3 -3
- package/dist/snorre.es938.js +1 -1
- package/dist/snorre.es941.js +2 -2
- package/dist/snorre.es943.js +5 -13
- package/dist/snorre.es944.js +21 -4
- package/dist/snorre.es945.js +9 -5
- package/dist/snorre.es946.js +7 -29
- package/dist/snorre.es947.js +12 -11
- package/dist/snorre.es948.js +4 -24
- package/dist/snorre.es949.js +5 -5
- package/dist/snorre.es950.js +29 -5
- package/dist/snorre.es951.js +11 -21
- package/dist/snorre.es952.js +25 -9
- package/dist/snorre.es953.js +5 -7
- package/package.json +25 -1
- package/vite.config.js +1 -2
package/dist/snorre.es1019.js
CHANGED
@@ -1,21 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
};
|
7
|
-
function
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const s = i(r);
|
15
|
-
return c.set(e, t), s.observe(e), () => {
|
16
|
-
c.delete(e), s.unobserve(e);
|
1
|
+
import { Fragment as f, useMemo as d, createElement as p } from "react";
|
2
|
+
import { useHTMLProps as a } from "./snorre.es1124.js";
|
3
|
+
import { filterProps as P } from "./snorre.es724.js";
|
4
|
+
import { isSVGComponent as V } from "./snorre.es844.js";
|
5
|
+
import { useSVGProps as g } from "./snorre.es1125.js";
|
6
|
+
import { isMotionValue as h } from "./snorre.es606.js";
|
7
|
+
function F(o = !1) {
|
8
|
+
return (e, s, t, { latestValues: i }, n) => {
|
9
|
+
const u = (V(e) ? g : a)(s, i, n, e), m = P(s, typeof e == "string", o), c = e !== f ? { ...m, ...u, ref: t } : {}, { children: r } = s, l = d(() => h(r) ? r.get() : r, [r]);
|
10
|
+
return p(e, {
|
11
|
+
...c,
|
12
|
+
children: l
|
13
|
+
});
|
17
14
|
};
|
18
15
|
}
|
19
16
|
export {
|
20
|
-
|
17
|
+
F as createUseRender
|
21
18
|
};
|
package/dist/snorre.es1020.js
CHANGED
@@ -1,256 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
import { eachAxis as u } from "./snorre.es1058.js";
|
11
|
-
import { measurePageBox as W } from "./snorre.es1029.js";
|
12
|
-
import { getContextWindow as _ } from "./snorre.es1021.js";
|
13
|
-
import { isRefObject as D } from "./snorre.es866.js";
|
14
|
-
import { mixNumber as V } from "./snorre.es714.js";
|
15
|
-
import { percent as O } from "./snorre.es683.js";
|
16
|
-
import { addValueToWillChange as x } from "./snorre.es862.js";
|
17
|
-
import { PanSession as U } from "./snorre.es1022.js";
|
18
|
-
import { applyConstraints as z, calcRelativeConstraints as I, resolveDragElastic as F, calcViewportConstraints as K, defaultElastic as N, rebaseAxisConstraints as $, calcOrigin as q } from "./snorre.es1126.js";
|
19
|
-
import { frame as C } from "./snorre.es674.js";
|
20
|
-
const G = /* @__PURE__ */ new WeakMap();
|
21
|
-
class ft {
|
22
|
-
constructor(t) {
|
23
|
-
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = R(), this.visualElement = t;
|
24
|
-
}
|
25
|
-
start(t, { snapToCursor: s = !1 } = {}) {
|
26
|
-
const { presenceContext: i } = this.visualElement;
|
27
|
-
if (i && i.isPresent === !1)
|
28
|
-
return;
|
29
|
-
const n = (o) => {
|
30
|
-
const { dragSnapToOrigin: a } = this.getProps();
|
31
|
-
a ? this.pauseAnimation() : this.stopAnimation(), s && this.snapToCursor(j(o).point);
|
32
|
-
}, r = (o, a) => {
|
33
|
-
const { drag: f, dragPropagation: d, onDragStart: g } = this.getProps();
|
34
|
-
if (f && !d && (this.openDragLock && this.openDragLock(), this.openDragLock = M(f), !this.openDragLock))
|
35
|
-
return;
|
36
|
-
this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), u((m) => {
|
37
|
-
let E = this.getAxisMotionValue(m).get() || 0;
|
38
|
-
if (O.test(E)) {
|
39
|
-
const { projection: A } = this.visualElement;
|
40
|
-
if (A && A.layout) {
|
41
|
-
const y = A.layout.layoutBox[m];
|
42
|
-
y && (E = b(y) * (parseFloat(E) / 100));
|
43
|
-
}
|
44
|
-
}
|
45
|
-
this.originPoint[m] = E;
|
46
|
-
}), g && C.postRender(() => g(o, a)), x(this.visualElement, "transform");
|
47
|
-
const { animationState: v } = this.visualElement;
|
48
|
-
v && v.setActive("whileDrag", !0);
|
49
|
-
}, e = (o, a) => {
|
50
|
-
const { dragPropagation: f, dragDirectionLock: d, onDirectionLock: g, onDrag: v } = this.getProps();
|
51
|
-
if (!f && !this.openDragLock)
|
52
|
-
return;
|
53
|
-
const { offset: m } = a;
|
54
|
-
if (d && this.currentDirection === null) {
|
55
|
-
this.currentDirection = H(m), this.currentDirection !== null && g && g(this.currentDirection);
|
56
|
-
return;
|
57
|
-
}
|
58
|
-
this.updateAxis("x", a.point, m), this.updateAxis("y", a.point, m), this.visualElement.render(), v && v(o, a);
|
59
|
-
}, l = (o, a) => this.stop(o, a), c = () => u((o) => {
|
60
|
-
var a;
|
61
|
-
return this.getAnimationState(o) === "paused" && ((a = this.getAxisMotionValue(o).animation) === null || a === void 0 ? void 0 : a.play());
|
62
|
-
}), { dragSnapToOrigin: h } = this.getProps();
|
63
|
-
this.panSession = new U(t, {
|
64
|
-
onSessionStart: n,
|
65
|
-
onStart: r,
|
66
|
-
onMove: e,
|
67
|
-
onSessionEnd: l,
|
68
|
-
resumeAnimation: c
|
69
|
-
}, {
|
70
|
-
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
71
|
-
dragSnapToOrigin: h,
|
72
|
-
contextWindow: _(this.visualElement)
|
73
|
-
});
|
74
|
-
}
|
75
|
-
stop(t, s) {
|
76
|
-
const i = this.isDragging;
|
77
|
-
if (this.cancel(), !i)
|
78
|
-
return;
|
79
|
-
const { velocity: n } = s;
|
80
|
-
this.startAnimation(n);
|
81
|
-
const { onDragEnd: r } = this.getProps();
|
82
|
-
r && C.postRender(() => r(t, s));
|
83
|
-
}
|
84
|
-
cancel() {
|
85
|
-
this.isDragging = !1;
|
86
|
-
const { projection: t, animationState: s } = this.visualElement;
|
87
|
-
t && (t.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
|
88
|
-
const { dragPropagation: i } = this.getProps();
|
89
|
-
!i && this.openDragLock && (this.openDragLock(), this.openDragLock = null), s && s.setActive("whileDrag", !1);
|
90
|
-
}
|
91
|
-
updateAxis(t, s, i) {
|
92
|
-
const { drag: n } = this.getProps();
|
93
|
-
if (!i || !P(t, n, this.currentDirection))
|
94
|
-
return;
|
95
|
-
const r = this.getAxisMotionValue(t);
|
96
|
-
let e = this.originPoint[t] + i[t];
|
97
|
-
this.constraints && this.constraints[t] && (e = z(e, this.constraints[t], this.elastic[t])), r.set(e);
|
98
|
-
}
|
99
|
-
resolveConstraints() {
|
100
|
-
var t;
|
101
|
-
const { dragConstraints: s, dragElastic: i } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (t = this.visualElement.projection) === null || t === void 0 ? void 0 : t.layout, r = this.constraints;
|
102
|
-
s && D(s) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : s && n ? this.constraints = I(n.layoutBox, s) : this.constraints = !1, this.elastic = F(i), r !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && u((e) => {
|
103
|
-
this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = $(n.layoutBox[e], this.constraints[e]));
|
104
|
-
});
|
105
|
-
}
|
106
|
-
resolveRefConstraints() {
|
107
|
-
const { dragConstraints: t, onMeasureDragConstraints: s } = this.getProps();
|
108
|
-
if (!t || !D(t))
|
109
|
-
return !1;
|
110
|
-
const i = t.current;
|
111
|
-
L(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
|
112
|
-
const { projection: n } = this.visualElement;
|
113
|
-
if (!n || !n.layout)
|
114
|
-
return !1;
|
115
|
-
const r = W(i, n.root, this.visualElement.getTransformPagePoint());
|
116
|
-
let e = K(n.layout.layoutBox, r);
|
117
|
-
if (s) {
|
118
|
-
const l = s(T(e));
|
119
|
-
this.hasMutatedConstraints = !!l, l && (e = w(l));
|
120
|
-
}
|
121
|
-
return e;
|
122
|
-
}
|
123
|
-
startAnimation(t) {
|
124
|
-
const { drag: s, dragMomentum: i, dragElastic: n, dragTransition: r, dragSnapToOrigin: e, onDragTransitionEnd: l } = this.getProps(), c = this.constraints || {}, h = u((o) => {
|
125
|
-
if (!P(o, s, this.currentDirection))
|
126
|
-
return;
|
127
|
-
let a = c && c[o] || {};
|
128
|
-
e && (a = { min: 0, max: 0 });
|
129
|
-
const f = n ? 200 : 1e6, d = n ? 40 : 1e7, g = {
|
130
|
-
type: "inertia",
|
131
|
-
velocity: i ? t[o] : 0,
|
132
|
-
bounceStiffness: f,
|
133
|
-
bounceDamping: d,
|
134
|
-
timeConstant: 750,
|
135
|
-
restDelta: 1,
|
136
|
-
restSpeed: 10,
|
137
|
-
...r,
|
138
|
-
...a
|
139
|
-
};
|
140
|
-
return this.startAxisValueAnimation(o, g);
|
141
|
-
});
|
142
|
-
return Promise.all(h).then(l);
|
143
|
-
}
|
144
|
-
startAxisValueAnimation(t, s) {
|
145
|
-
const i = this.getAxisMotionValue(t);
|
146
|
-
return x(this.visualElement, t), i.start(S(t, i, 0, s, this.visualElement, !1));
|
147
|
-
}
|
148
|
-
stopAnimation() {
|
149
|
-
u((t) => this.getAxisMotionValue(t).stop());
|
150
|
-
}
|
151
|
-
pauseAnimation() {
|
152
|
-
u((t) => {
|
153
|
-
var s;
|
154
|
-
return (s = this.getAxisMotionValue(t).animation) === null || s === void 0 ? void 0 : s.pause();
|
155
|
-
});
|
156
|
-
}
|
157
|
-
getAnimationState(t) {
|
158
|
-
var s;
|
159
|
-
return (s = this.getAxisMotionValue(t).animation) === null || s === void 0 ? void 0 : s.state;
|
160
|
-
}
|
161
|
-
/**
|
162
|
-
* Drag works differently depending on which props are provided.
|
163
|
-
*
|
164
|
-
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
165
|
-
* - Otherwise, we apply the delta to the x/y motion values.
|
166
|
-
*/
|
167
|
-
getAxisMotionValue(t) {
|
168
|
-
const s = `_drag${t.toUpperCase()}`, i = this.visualElement.getProps(), n = i[s];
|
169
|
-
return n || this.visualElement.getValue(t, (i.initial ? i.initial[t] : void 0) || 0);
|
170
|
-
}
|
171
|
-
snapToCursor(t) {
|
172
|
-
u((s) => {
|
173
|
-
const { drag: i } = this.getProps();
|
174
|
-
if (!P(s, i, this.currentDirection))
|
175
|
-
return;
|
176
|
-
const { projection: n } = this.visualElement, r = this.getAxisMotionValue(s);
|
177
|
-
if (n && n.layout) {
|
178
|
-
const { min: e, max: l } = n.layout.layoutBox[s];
|
179
|
-
r.set(t[s] - V(e, l, 0.5));
|
180
|
-
}
|
181
|
-
});
|
182
|
-
}
|
183
|
-
/**
|
184
|
-
* When the viewport resizes we want to check if the measured constraints
|
185
|
-
* have changed and, if so, reposition the element within those new constraints
|
186
|
-
* relative to where it was before the resize.
|
187
|
-
*/
|
188
|
-
scalePositionWithinConstraints() {
|
189
|
-
if (!this.visualElement.current)
|
190
|
-
return;
|
191
|
-
const { drag: t, dragConstraints: s } = this.getProps(), { projection: i } = this.visualElement;
|
192
|
-
if (!D(s) || !i || !this.constraints)
|
193
|
-
return;
|
194
|
-
this.stopAnimation();
|
195
|
-
const n = { x: 0, y: 0 };
|
196
|
-
u((e) => {
|
197
|
-
const l = this.getAxisMotionValue(e);
|
198
|
-
if (l && this.constraints !== !1) {
|
199
|
-
const c = l.get();
|
200
|
-
n[e] = q({ min: c, max: c }, this.constraints[e]);
|
201
|
-
}
|
202
|
-
});
|
203
|
-
const { transformTemplate: r } = this.visualElement.getProps();
|
204
|
-
this.visualElement.current.style.transform = r ? r({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.resolveConstraints(), u((e) => {
|
205
|
-
if (!P(e, t, null))
|
206
|
-
return;
|
207
|
-
const l = this.getAxisMotionValue(e), { min: c, max: h } = this.constraints[e];
|
208
|
-
l.set(V(c, h, n[e]));
|
209
|
-
});
|
210
|
-
}
|
211
|
-
addListeners() {
|
212
|
-
if (!this.visualElement.current)
|
213
|
-
return;
|
214
|
-
G.set(this.visualElement, this);
|
215
|
-
const t = this.visualElement.current, s = k(t, "pointerdown", (c) => {
|
216
|
-
const { drag: h, dragListener: o = !0 } = this.getProps();
|
217
|
-
h && o && this.start(c);
|
218
|
-
}), i = () => {
|
219
|
-
const { dragConstraints: c } = this.getProps();
|
220
|
-
D(c) && c.current && (this.constraints = this.resolveRefConstraints());
|
221
|
-
}, { projection: n } = this.visualElement, r = n.addEventListener("measure", i);
|
222
|
-
n && !n.layout && (n.root && n.root.updateScroll(), n.updateLayout()), C.read(i);
|
223
|
-
const e = B(window, "resize", () => this.scalePositionWithinConstraints()), l = n.addEventListener("didUpdate", ({ delta: c, hasLayoutChanged: h }) => {
|
224
|
-
this.isDragging && h && (u((o) => {
|
225
|
-
const a = this.getAxisMotionValue(o);
|
226
|
-
a && (this.originPoint[o] += c[o].translate, a.set(a.get() + c[o].translate));
|
227
|
-
}), this.visualElement.render());
|
228
|
-
});
|
229
|
-
return () => {
|
230
|
-
e(), s(), r(), l && l();
|
231
|
-
};
|
232
|
-
}
|
233
|
-
getProps() {
|
234
|
-
const t = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: i = !1, dragPropagation: n = !1, dragConstraints: r = !1, dragElastic: e = N, dragMomentum: l = !0 } = t;
|
235
|
-
return {
|
236
|
-
...t,
|
237
|
-
drag: s,
|
238
|
-
dragDirectionLock: i,
|
239
|
-
dragPropagation: n,
|
240
|
-
dragConstraints: r,
|
241
|
-
dragElastic: e,
|
242
|
-
dragMomentum: l
|
243
|
-
};
|
244
|
-
}
|
245
|
-
}
|
246
|
-
function P(p, t, s) {
|
247
|
-
return (t === !0 || t === p) && (s === null || s === p);
|
248
|
-
}
|
249
|
-
function H(p, t = 10) {
|
250
|
-
let s = null;
|
251
|
-
return Math.abs(p.y) > t ? s = "y" : Math.abs(p.x) > t && (s = "x"), s;
|
252
|
-
}
|
1
|
+
import { makeUseVisualState as t } from "./snorre.es725.js";
|
2
|
+
import { scrapeMotionValuesFromProps as e } from "./snorre.es1028.js";
|
3
|
+
import { createHtmlRenderState as o } from "./snorre.es1126.js";
|
4
|
+
const i = {
|
5
|
+
useVisualState: t({
|
6
|
+
scrapeMotionValuesFromProps: e,
|
7
|
+
createRenderState: o
|
8
|
+
})
|
9
|
+
};
|
253
10
|
export {
|
254
|
-
|
255
|
-
G as elementDragControls
|
11
|
+
i as htmlMotionConfig
|
256
12
|
};
|
package/dist/snorre.es1021.js
CHANGED
@@ -1,4 +1,43 @@
|
|
1
|
-
|
1
|
+
import { frame as n } from "./snorre.es674.js";
|
2
|
+
import { makeUseVisualState as u } from "./snorre.es725.js";
|
3
|
+
import { transformProps as d } from "./snorre.es656.js";
|
4
|
+
import { buildSVGAttrs as l } from "./snorre.es1029.js";
|
5
|
+
import { createSvgRenderState as g } from "./snorre.es1127.js";
|
6
|
+
import { isSVGTag as c } from "./snorre.es1031.js";
|
7
|
+
import { updateSVGDimensions as S } from "./snorre.es1032.js";
|
8
|
+
import { renderSVG as V } from "./snorre.es1033.js";
|
9
|
+
import { scrapeMotionValuesFromProps as h } from "./snorre.es1034.js";
|
10
|
+
const p = ["x", "y", "width", "height", "cx", "cy", "r"], R = {
|
11
|
+
useVisualState: u({
|
12
|
+
scrapeMotionValuesFromProps: h,
|
13
|
+
createRenderState: g,
|
14
|
+
onUpdate: ({ props: t, prevProps: e, current: o, renderState: i, latestValues: a }) => {
|
15
|
+
if (!o)
|
16
|
+
return;
|
17
|
+
let m = !!t.drag;
|
18
|
+
if (!m) {
|
19
|
+
for (const r in a)
|
20
|
+
if (d.has(r)) {
|
21
|
+
m = !0;
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
if (!m)
|
26
|
+
return;
|
27
|
+
let f = !e;
|
28
|
+
if (e)
|
29
|
+
for (let r = 0; r < p.length; r++) {
|
30
|
+
const s = p[r];
|
31
|
+
t[s] !== e[s] && (f = !0);
|
32
|
+
}
|
33
|
+
f && n.read(() => {
|
34
|
+
S(o, i), n.render(() => {
|
35
|
+
l(i, a, c(o.tagName), t.transformTemplate), V(o, i);
|
36
|
+
});
|
37
|
+
});
|
38
|
+
}
|
39
|
+
})
|
40
|
+
};
|
2
41
|
export {
|
3
|
-
|
42
|
+
R as svgMotionConfig
|
4
43
|
};
|
package/dist/snorre.es1022.js
CHANGED
@@ -1,84 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return;
|
13
|
-
const i = p(this.lastMoveEventInfo, this.history), a = this.startEvent !== null, c = W(i.offset, { x: 0, y: 0 }) >= 3;
|
14
|
-
if (!a && !c)
|
15
|
-
return;
|
16
|
-
const { point: f } = i, { timestamp: m } = x;
|
17
|
-
this.history.push({ ...f, timestamp: m });
|
18
|
-
const { onStart: l, onMove: E } = this.handlers;
|
19
|
-
a || (l && l(this.lastMoveEvent, i), this.startEvent = this.lastMoveEvent), E && E(this.lastMoveEvent, i);
|
20
|
-
}, this.handlePointerMove = (i, a) => {
|
21
|
-
this.lastMoveEvent = i, this.lastMoveEventInfo = v(a, this.transformPagePoint), U.update(this.updatePoint, !0);
|
22
|
-
}, this.handlePointerUp = (i, a) => {
|
23
|
-
this.end();
|
24
|
-
const { onEnd: c, onSessionEnd: f, resumeAnimation: m } = this.handlers;
|
25
|
-
if (this.dragSnapToOrigin && m && m(), !(this.lastMoveEvent && this.lastMoveEventInfo))
|
26
|
-
return;
|
27
|
-
const l = p(i.type === "pointercancel" ? this.lastMoveEventInfo : v(a, this.transformPagePoint), this.history);
|
28
|
-
this.startEvent && c && c(i, l), f && f(i, l);
|
29
|
-
}, !D(n))
|
30
|
-
return;
|
31
|
-
this.dragSnapToOrigin = h, this.handlers = o, this.transformPagePoint = e, this.contextWindow = r || window;
|
32
|
-
const s = T(n), u = v(s, this.transformPagePoint), { point: g } = u, { timestamp: I } = x;
|
33
|
-
this.history = [{ ...g, timestamp: I }];
|
34
|
-
const { onSessionStart: P } = o;
|
35
|
-
P && P(n, p(u, this.history)), this.removeListeners = L(d(this.contextWindow, "pointermove", this.handlePointerMove), d(this.contextWindow, "pointerup", this.handlePointerUp), d(this.contextWindow, "pointercancel", this.handlePointerUp));
|
36
|
-
}
|
37
|
-
updateHandlers(n) {
|
38
|
-
this.handlers = n;
|
39
|
-
}
|
40
|
-
end() {
|
41
|
-
this.removeListeners && this.removeListeners(), O(this.updatePoint);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
function v(t, n) {
|
45
|
-
return n ? { point: n(t.point) } : t;
|
46
|
-
}
|
47
|
-
function y(t, n) {
|
48
|
-
return { x: t.x - n.x, y: t.y - n.y };
|
49
|
-
}
|
50
|
-
function p({ point: t }, n) {
|
51
|
-
return {
|
52
|
-
point: t,
|
53
|
-
delta: y(t, M(n)),
|
54
|
-
offset: y(t, V(n)),
|
55
|
-
velocity: b(n, 0.1)
|
56
|
-
};
|
57
|
-
}
|
58
|
-
function V(t) {
|
59
|
-
return t[0];
|
60
|
-
}
|
61
|
-
function M(t) {
|
62
|
-
return t[t.length - 1];
|
1
|
+
const c = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), a = (e) => {
|
2
|
+
const r = c.get(e.target);
|
3
|
+
r && r(e);
|
4
|
+
}, b = (e) => {
|
5
|
+
e.forEach(a);
|
6
|
+
};
|
7
|
+
function i({ root: e, ...r }) {
|
8
|
+
const t = e || document;
|
9
|
+
n.has(t) || n.set(t, {});
|
10
|
+
const s = n.get(t), o = JSON.stringify(r);
|
11
|
+
return s[o] || (s[o] = new IntersectionObserver(b, { root: e, ...r })), s[o];
|
63
12
|
}
|
64
|
-
function
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
const r = M(t);
|
69
|
-
for (; o >= 0 && (e = t[o], !(r.timestamp - e.timestamp > w(n))); )
|
70
|
-
o--;
|
71
|
-
if (!e)
|
72
|
-
return { x: 0, y: 0 };
|
73
|
-
const h = S(r.timestamp - e.timestamp);
|
74
|
-
if (h === 0)
|
75
|
-
return { x: 0, y: 0 };
|
76
|
-
const s = {
|
77
|
-
x: (r.x - e.x) / h,
|
78
|
-
y: (r.y - e.y) / h
|
13
|
+
function v(e, r, t) {
|
14
|
+
const s = i(r);
|
15
|
+
return c.set(e, t), s.observe(e), () => {
|
16
|
+
c.delete(e), s.unobserve(e);
|
79
17
|
};
|
80
|
-
return s.x === 1 / 0 && (s.x = 0), s.y === 1 / 0 && (s.y = 0), s;
|
81
18
|
}
|
82
19
|
export {
|
83
|
-
|
20
|
+
v as observeIntersection
|
84
21
|
};
|
package/dist/snorre.es1023.js
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
*/
|
11
|
-
hasEverUpdated: !1
|
12
|
-
};
|
1
|
+
import { convertBoundingBoxToBox as s, transformBoxPoints as f } from "./snorre.es1128.js";
|
2
|
+
import { translateAxis as n } from "./snorre.es1053.js";
|
3
|
+
function x(o, t) {
|
4
|
+
return s(f(o.getBoundingClientRect(), t));
|
5
|
+
}
|
6
|
+
function c(o, t, i) {
|
7
|
+
const r = x(o, i), { scroll: e } = t;
|
8
|
+
return e && (n(r.x, e.offset.x), n(r.y, e.offset.y)), r;
|
9
|
+
}
|
13
10
|
export {
|
14
|
-
|
11
|
+
c as measurePageBox,
|
12
|
+
x as measureViewportBox
|
15
13
|
};
|
package/dist/snorre.es1024.js
CHANGED
@@ -1,21 +1,27 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if (!n.target)
|
8
|
-
return r;
|
9
|
-
if (typeof r == "string")
|
10
|
-
if (c.test(r))
|
11
|
-
r = parseFloat(r);
|
12
|
-
else
|
13
|
-
return r;
|
14
|
-
const o = e(r, n.target.x), t = e(r, n.target.y);
|
15
|
-
return `${o}% ${t}%`;
|
1
|
+
import { VisualElement as r } from "./snorre.es658.js";
|
2
|
+
import { DOMKeyframesResolver as o } from "./snorre.es617.js";
|
3
|
+
import { isMotionValue as s } from "./snorre.es606.js";
|
4
|
+
class a extends r {
|
5
|
+
constructor() {
|
6
|
+
super(...arguments), this.KeyframeResolver = o;
|
16
7
|
}
|
17
|
-
|
8
|
+
sortInstanceNodePosition(e, t) {
|
9
|
+
return e.compareDocumentPosition(t) & 2 ? 1 : -1;
|
10
|
+
}
|
11
|
+
getBaseTargetFromProps(e, t) {
|
12
|
+
return e.style ? e.style[t] : void 0;
|
13
|
+
}
|
14
|
+
removeValueFromRenderState(e, { vars: t, style: i }) {
|
15
|
+
delete t[e], delete i[e];
|
16
|
+
}
|
17
|
+
handleChildMotionValue() {
|
18
|
+
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
19
|
+
const { children: e } = this.props;
|
20
|
+
s(e) && (this.childSubscription = e.on("change", (t) => {
|
21
|
+
this.current && (this.current.textContent = `${t}`);
|
22
|
+
}));
|
23
|
+
}
|
24
|
+
}
|
18
25
|
export {
|
19
|
-
|
20
|
-
e as pixelsToPercent
|
26
|
+
a as DOMVisualElement
|
21
27
|
};
|
package/dist/snorre.es1025.js
CHANGED
@@ -1,16 +1,29 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
const
|
11
|
-
|
1
|
+
import { isCSSVariableName as p } from "./snorre.es652.js";
|
2
|
+
import { getValueAsType as u } from "./snorre.es654.js";
|
3
|
+
import { numberValueTypes as c } from "./snorre.es655.js";
|
4
|
+
import { buildTransform as g } from "./snorre.es653.js";
|
5
|
+
import { transformProps as y } from "./snorre.es656.js";
|
6
|
+
function S(f, i, e) {
|
7
|
+
const { style: o, vars: l, transformOrigin: t } = f;
|
8
|
+
let m = !1, a = !1;
|
9
|
+
for (const r in i) {
|
10
|
+
const n = i[r];
|
11
|
+
if (y.has(r)) {
|
12
|
+
m = !0;
|
13
|
+
continue;
|
14
|
+
} else if (p(r)) {
|
15
|
+
l[r] = n;
|
16
|
+
continue;
|
17
|
+
} else {
|
18
|
+
const s = u(n, c[r]);
|
19
|
+
r.startsWith("origin") ? (a = !0, t[r] = s) : o[r] = s;
|
20
|
+
}
|
12
21
|
}
|
13
|
-
|
22
|
+
if (i.transform || (m || e ? o.transform = g(i, f.transform, e) : o.transform && (o.transform = "none")), a) {
|
23
|
+
const { originX: r = "50%", originY: n = "50%", originZ: s = 0 } = t;
|
24
|
+
o.transformOrigin = `${r} ${n} ${s}`;
|
25
|
+
}
|
26
|
+
}
|
14
27
|
export {
|
15
|
-
|
28
|
+
S as buildHTMLStyles
|
16
29
|
};
|
package/dist/snorre.es1026.js
CHANGED
@@ -1,18 +1,64 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
const e = (t) => t * 180 / Math.PI, c = (t) => {
|
2
|
+
const a = e(Math.atan2(t[1], t[0]));
|
3
|
+
return l(a);
|
4
|
+
}, f = {
|
5
|
+
x: 4,
|
6
|
+
y: 5,
|
7
|
+
translateX: 4,
|
8
|
+
translateY: 5,
|
9
|
+
scaleX: 0,
|
10
|
+
scaleY: 3,
|
11
|
+
scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
|
12
|
+
rotate: c,
|
13
|
+
rotateZ: c,
|
14
|
+
skewX: (t) => e(Math.atan(t[1])),
|
15
|
+
skewY: (t) => e(Math.atan(t[2])),
|
16
|
+
skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
|
17
|
+
}, l = (t) => (t = t % 360, t < 0 && (t += 360), t), h = c, M = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), i = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), x = {
|
18
|
+
x: 12,
|
19
|
+
y: 13,
|
20
|
+
z: 14,
|
21
|
+
translateX: 12,
|
22
|
+
translateY: 13,
|
23
|
+
translateZ: 14,
|
24
|
+
scaleX: M,
|
25
|
+
scaleY: i,
|
26
|
+
scale: (t) => (M(t) + i(t)) / 2,
|
27
|
+
rotateX: (t) => l(e(Math.atan2(t[6], t[5]))),
|
28
|
+
rotateY: (t) => l(e(Math.atan2(-t[2], t[0]))),
|
29
|
+
rotateZ: h,
|
30
|
+
rotate: h,
|
31
|
+
skewX: (t) => e(Math.atan(t[4])),
|
32
|
+
skewY: (t) => e(Math.atan(t[1])),
|
33
|
+
skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
|
34
|
+
};
|
35
|
+
function m(t) {
|
36
|
+
return t.includes("scale") ? 1 : 0;
|
37
|
+
}
|
38
|
+
function b(t, a) {
|
39
|
+
if (!t || t === "none")
|
40
|
+
return m(a);
|
41
|
+
const s = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
|
42
|
+
let n, r;
|
43
|
+
if (s)
|
44
|
+
n = x, r = s;
|
45
|
+
else {
|
46
|
+
const d = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
|
47
|
+
n = f, r = d;
|
48
|
+
}
|
49
|
+
if (!r)
|
50
|
+
return m(a);
|
51
|
+
const o = n[a], u = r[1].split(",").map(p);
|
52
|
+
return typeof o == "function" ? o(u) : u[o];
|
53
|
+
}
|
54
|
+
const X = (t, a) => {
|
55
|
+
const { transform: s = "none" } = getComputedStyle(t);
|
56
|
+
return b(s, a);
|
57
|
+
};
|
58
|
+
function p(t) {
|
59
|
+
return parseFloat(t.trim());
|
15
60
|
}
|
16
61
|
export {
|
17
|
-
|
62
|
+
b as parseValueFromTransform,
|
63
|
+
X as readTransformValue
|
18
64
|
};
|