@tamagui/animations-motion 2.7.7 → 3.0.0-beta.643.1
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/cjs/createAnimations.cjs +926 -791
- package/dist/cjs/createAnimations.native.cjs +1158 -0
- package/dist/cjs/createAnimations.native.js +1109 -943
- package/dist/cjs/createAnimations.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +42 -0
- package/dist/cjs/index.native.js +28 -29
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/polyfill.cjs +3 -2
- package/dist/cjs/polyfill.native.cjs +6 -0
- package/dist/cjs/polyfill.native.js +3 -1
- package/dist/cjs/polyfill.native.js.map +1 -1
- package/dist/esm/createAnimations.mjs +912 -769
- package/dist/esm/createAnimations.mjs.map +1 -1
- package/dist/esm/createAnimations.native.js +1096 -923
- package/dist/esm/createAnimations.native.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.native.js +14 -12
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/polyfill.mjs +2 -1
- package/dist/esm/polyfill.mjs.map +1 -1
- package/dist/esm/polyfill.native.js +2 -1
- package/dist/esm/polyfill.native.js.map +1 -1
- package/package.json +5 -5
- package/src/createAnimations.tsx +338 -56
- package/src/index.native.ts +4 -4
- package/types/createAnimations.d.ts.map +2 -2
- package/types/index.native.d.ts +2 -2
- package/types/index.native.d.ts.map +2 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -7,36 +8,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
10
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
14
15
|
};
|
|
15
16
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: () => from[key],
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
23
24
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: true
|
|
32
28
|
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
30
|
var createAnimations_exports = {};
|
|
37
31
|
__export(createAnimations_exports, {
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
createAnimations: () => createAnimations,
|
|
33
|
+
disableAnimationProps: () => disableAnimationProps
|
|
40
34
|
});
|
|
41
35
|
module.exports = __toCommonJS(createAnimations_exports);
|
|
42
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -46,949 +40,1121 @@ var import_web = require("@tamagui/web");
|
|
|
46
40
|
var import_react = require("motion/react");
|
|
47
41
|
var import_react2 = __toESM(require("react"), 1);
|
|
48
42
|
function _instanceof(left, right) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
44
|
+
return !!right[Symbol.hasInstance](left);
|
|
45
|
+
} else {
|
|
46
|
+
return left instanceof right;
|
|
47
|
+
}
|
|
54
48
|
}
|
|
55
49
|
function _type_of(obj) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
50
|
+
"@swc/helpers - typeof";
|
|
51
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
59
52
|
}
|
|
60
53
|
var isServer = typeof window === "undefined";
|
|
61
54
|
function useAnimateSSRSafe() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
if (isServer) {
|
|
56
|
+
return [(0, import_react2.useRef)(null), function() {}];
|
|
57
|
+
}
|
|
58
|
+
return (0, import_react.useAnimate)();
|
|
66
59
|
}
|
|
67
|
-
var
|
|
68
|
-
|
|
60
|
+
var asStyleRecord = function(style) {
|
|
61
|
+
return style && (typeof style === "undefined" ? "undefined" : _type_of(style)) === "object" && !Array.isArray(style) ? style : {};
|
|
62
|
+
};
|
|
63
|
+
function assignInlineStyles(node, styles) {
|
|
64
|
+
for (var key in styles) {
|
|
65
|
+
node.style[key] = (0, import_web.normalizeValueWithProperty)(styles[key], key);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
var MotionValueStrategy = /* @__PURE__ */ new WeakMap();
|
|
69
|
+
var PendingMotionOnFinish = /* @__PURE__ */ new WeakMap();
|
|
69
70
|
function settlePendingMotionOnFinish(mv, controls) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
var onFinish = PendingMotionOnFinish.get(mv);
|
|
72
|
+
if (!onFinish) return;
|
|
73
|
+
PendingMotionOnFinish.delete(mv);
|
|
74
|
+
controls.then(function() {
|
|
75
|
+
return onFinish();
|
|
76
|
+
}).catch(function() {
|
|
77
|
+
return onFinish();
|
|
78
|
+
});
|
|
78
79
|
}
|
|
79
|
-
var PopperPositionAnims = /* @__PURE__ */new WeakMap();
|
|
80
|
+
var PopperPositionAnims = /* @__PURE__ */ new WeakMap();
|
|
80
81
|
function parseTranslate(transform) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
if (!transform || transform === "none") return {
|
|
83
|
+
x: 0,
|
|
84
|
+
y: 0
|
|
85
|
+
};
|
|
86
|
+
try {
|
|
87
|
+
var m = new DOMMatrixReadOnly(transform);
|
|
88
|
+
if (!m.is2D || m.a !== 1 || m.b !== 0 || m.c !== 0 || m.d !== 1) return null;
|
|
89
|
+
return {
|
|
90
|
+
x: m.e,
|
|
91
|
+
y: m.f
|
|
92
|
+
};
|
|
93
|
+
} catch (e) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
95
96
|
}
|
|
96
97
|
function createAnimations(animations) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
98
|
+
var isHydratingGlobal;
|
|
99
|
+
var hydratingComponents = /* @__PURE__ */ new Set();
|
|
100
|
+
return {
|
|
101
|
+
View: MotionView,
|
|
102
|
+
Text: MotionText,
|
|
103
|
+
isReactNative: false,
|
|
104
|
+
inputStyle: "css",
|
|
105
|
+
outputStyle: "inline",
|
|
106
|
+
avoidReRenders: true,
|
|
107
|
+
animations,
|
|
108
|
+
usePresence: import_use_presence.usePresence,
|
|
109
|
+
ResetPresence: import_use_presence.ResetPresence,
|
|
110
|
+
onMount() {
|
|
111
|
+
isHydratingGlobal = false;
|
|
112
|
+
hydratingComponents.forEach(function(cb) {
|
|
113
|
+
return cb();
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
useAnimations: function(animationProps) {
|
|
117
|
+
if (isHydratingGlobal === void 0 && !(0, import_web.getConfig)().settings.disableSSR) {
|
|
118
|
+
isHydratingGlobal = true;
|
|
119
|
+
}
|
|
120
|
+
var { props, style, componentState, stateRef, useStyleEmitter, presence, onTransition, styleProps } = animationProps;
|
|
121
|
+
var animationKey = Array.isArray(props.transition) ? props.transition[0] : props.transition;
|
|
122
|
+
var isComponentHydrating = componentState.unmounted === true;
|
|
123
|
+
var isMounting = componentState.unmounted === "should-enter";
|
|
124
|
+
var isEntering = !!componentState.unmounted;
|
|
125
|
+
var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;
|
|
126
|
+
var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];
|
|
127
|
+
var refs = (0, import_react2.useRef)(null);
|
|
128
|
+
if (!refs.current) {
|
|
129
|
+
refs.current = {
|
|
130
|
+
isFirstRender: true,
|
|
131
|
+
lastDoAnimate: null,
|
|
132
|
+
lastDontAnimate: null,
|
|
133
|
+
controls: null,
|
|
134
|
+
lastAnimateAt: 0,
|
|
135
|
+
disposed: false,
|
|
136
|
+
wasExiting: false,
|
|
137
|
+
isExiting: false,
|
|
138
|
+
sendExitComplete: void 0,
|
|
139
|
+
animationState: "default",
|
|
140
|
+
frozenExitTarget: null,
|
|
141
|
+
exitCompleteScheduled: false,
|
|
142
|
+
enterCompleteScheduled: false,
|
|
143
|
+
disableAnimation: true,
|
|
144
|
+
wasEntering: false,
|
|
145
|
+
wasDisabled: false,
|
|
146
|
+
onTransition: void 0,
|
|
147
|
+
enterStarted: false,
|
|
148
|
+
exitStarted: false,
|
|
149
|
+
updateInFlight: false,
|
|
150
|
+
updateControls: null,
|
|
151
|
+
wasNoClass: !!styleProps.noClass
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
var emit = function(phase, cause, finished) {
|
|
155
|
+
var _refs_current_onTransition, _refs_current;
|
|
156
|
+
(_refs_current_onTransition = (_refs_current = refs.current).onTransition) === null || _refs_current_onTransition === void 0 ? void 0 : _refs_current_onTransition.call(_refs_current, phase === "end" ? {
|
|
157
|
+
phase,
|
|
158
|
+
cause,
|
|
159
|
+
finished
|
|
160
|
+
} : {
|
|
161
|
+
phase,
|
|
162
|
+
cause
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
var justFinishedEntering = refs.current.wasEntering && !isEntering;
|
|
166
|
+
(0, import_react2.useEffect)(function() {
|
|
167
|
+
refs.current.wasEntering = isEntering;
|
|
168
|
+
});
|
|
169
|
+
var animationState = isExiting ? "exit" : isMounting || justFinishedEntering ? "enter" : "default";
|
|
170
|
+
var disableAnimation = isComponentHydrating || isMounting || !animationKey;
|
|
171
|
+
var [scope] = useAnimateSSRSafe();
|
|
172
|
+
refs.current.isExiting = isExiting;
|
|
173
|
+
refs.current.sendExitComplete = sendExitComplete;
|
|
174
|
+
refs.current.animationState = animationState;
|
|
175
|
+
refs.current.disableAnimation = disableAnimation;
|
|
176
|
+
refs.current.onTransition = onTransition;
|
|
177
|
+
var justStartedExiting = isExiting && !refs.current.wasExiting;
|
|
178
|
+
var justStoppedExiting = !isExiting && refs.current.wasExiting;
|
|
179
|
+
if (justStartedExiting || justStoppedExiting) {
|
|
180
|
+
refs.current.frozenExitTarget = null;
|
|
181
|
+
refs.current.exitCompleteScheduled = false;
|
|
182
|
+
refs.current.enterCompleteScheduled = false;
|
|
183
|
+
}
|
|
184
|
+
(0, import_react2.useEffect)(function() {
|
|
185
|
+
refs.current.wasExiting = isExiting;
|
|
186
|
+
});
|
|
187
|
+
(0, import_web.useIsomorphicLayoutEffect)(function() {
|
|
188
|
+
if (justStoppedExiting && refs.current.exitStarted) {
|
|
189
|
+
refs.current.exitStarted = false;
|
|
190
|
+
emit("end", "exit", false);
|
|
191
|
+
}
|
|
192
|
+
}, [justStoppedExiting]);
|
|
193
|
+
var { dontAnimate = {}, doAnimate, animationOptions } = getMotionAnimatedProps(props, style, disableAnimation, animationState);
|
|
194
|
+
var [firstRenderStyle] = (0, import_react2.useState)(style);
|
|
195
|
+
if (refs.current.isFirstRender) {
|
|
196
|
+
refs.current.lastDontAnimate = firstRenderStyle;
|
|
197
|
+
}
|
|
198
|
+
var [isHydrating, setIsHydrating] = (0, import_react2.useState)(isHydratingGlobal);
|
|
199
|
+
(0, import_react2.useLayoutEffect)(function() {
|
|
200
|
+
if (isHydratingGlobal) {
|
|
201
|
+
hydratingComponents.add(function() {
|
|
202
|
+
setIsHydrating(false);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return function() {
|
|
206
|
+
refs.current.disposed = true;
|
|
207
|
+
};
|
|
208
|
+
}, []);
|
|
209
|
+
var flushAnimation = function(param) {
|
|
210
|
+
var { doAnimate: doAnimateRaw = {}, animationOptions: passedOptions = {}, dontAnimate: dontAnimate2 } = param;
|
|
211
|
+
var startedControls = null;
|
|
212
|
+
var isCurrentlyExiting = refs.current.isExiting;
|
|
213
|
+
var currentSendExitComplete = refs.current.sendExitComplete;
|
|
214
|
+
var currentAnimationState = refs.current.animationState;
|
|
215
|
+
var doAnimate2 = doAnimateRaw;
|
|
216
|
+
if (isCurrentlyExiting && refs.current.frozenExitTarget) {
|
|
217
|
+
doAnimate2 = refs.current.frozenExitTarget;
|
|
218
|
+
}
|
|
219
|
+
var _props_transition;
|
|
220
|
+
var animationOptions2 = isCurrentlyExiting && currentSendExitComplete ? getAnimationOptions((_props_transition = props.transition) !== null && _props_transition !== void 0 ? _props_transition : null, "exit") : passedOptions;
|
|
221
|
+
try {
|
|
222
|
+
var node = stateRef.current.host;
|
|
223
|
+
if (refs.current.isFirstRender) {
|
|
224
|
+
refs.current.lastDontAnimate = null;
|
|
225
|
+
refs.current.lastDoAnimate = null;
|
|
226
|
+
}
|
|
227
|
+
if (process.env.NODE_ENV === "development") {
|
|
228
|
+
if (props["debug"] && props["debug"] !== "profile") {
|
|
229
|
+
console.groupCollapsed(`[motion] animate (${JSON.stringify(getDiff(refs.current.lastDoAnimate, doAnimate2), null, 2)})`);
|
|
230
|
+
console.info({
|
|
231
|
+
props,
|
|
232
|
+
componentState,
|
|
233
|
+
doAnimate: doAnimate2,
|
|
234
|
+
dontAnimate: dontAnimate2,
|
|
235
|
+
animationOptions: animationOptions2,
|
|
236
|
+
animationProps,
|
|
237
|
+
lastDoAnimate: { ...refs.current.lastDoAnimate },
|
|
238
|
+
lastDontAnimate: { ...refs.current.lastDontAnimate },
|
|
239
|
+
isExiting,
|
|
240
|
+
style,
|
|
241
|
+
node
|
|
242
|
+
});
|
|
243
|
+
console.groupCollapsed(`trace >`);
|
|
244
|
+
console.trace();
|
|
245
|
+
console.groupEnd();
|
|
246
|
+
console.groupEnd();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (!_instanceof(node, HTMLElement)) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
var prevDont = refs.current.lastDontAnimate;
|
|
253
|
+
if (dontAnimate2) {
|
|
254
|
+
if (prevDont) {
|
|
255
|
+
removeRemovedStyles(prevDont, dontAnimate2, node, doAnimate2);
|
|
256
|
+
var changed = getDiff(prevDont, dontAnimate2);
|
|
257
|
+
if (changed) {
|
|
258
|
+
assignInlineStyles(node, changed);
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
assignInlineStyles(node, dontAnimate2);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (doAnimate2) {
|
|
265
|
+
if (prevDont) {
|
|
266
|
+
for (var key in prevDont) {
|
|
267
|
+
if (key in doAnimate2) {
|
|
268
|
+
node.style[key] = (0, import_web.normalizeValueWithProperty)(prevDont[key], key);
|
|
269
|
+
if (refs.current.lastDoAnimate) {
|
|
270
|
+
refs.current.lastDoAnimate[key] = prevDont[key];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
var lastAnimated = refs.current.lastDoAnimate;
|
|
276
|
+
if (lastAnimated) {
|
|
277
|
+
removeRemovedStyles(lastAnimated, doAnimate2, node, dontAnimate2);
|
|
278
|
+
}
|
|
279
|
+
var diff = getDiff(refs.current.lastDoAnimate, doAnimate2);
|
|
280
|
+
if (diff) {
|
|
281
|
+
if (isCurrentlyExiting && !refs.current.frozenExitTarget) {
|
|
282
|
+
refs.current.frozenExitTarget = { ...doAnimate2 };
|
|
283
|
+
}
|
|
284
|
+
var isPopperPosition = node.hasAttribute("data-popper-animate-position");
|
|
285
|
+
var popperHandledTransform = false;
|
|
286
|
+
if (isPopperPosition && !isCurrentlyExiting && typeof diff.transform === "string") {
|
|
287
|
+
var target = parseTranslate(diff.transform);
|
|
288
|
+
if (target) {
|
|
289
|
+
var entry = PopperPositionAnims.get(node);
|
|
290
|
+
if (!entry) {
|
|
291
|
+
var seed = target;
|
|
292
|
+
try {
|
|
293
|
+
var _parseTranslate;
|
|
294
|
+
seed = (_parseTranslate = parseTranslate(getComputedStyle(node).transform)) !== null && _parseTranslate !== void 0 ? _parseTranslate : target;
|
|
295
|
+
} catch (e) {}
|
|
296
|
+
var x = (0, import_react.motionValue)(seed.x);
|
|
297
|
+
var y = (0, import_react.motionValue)(seed.y);
|
|
298
|
+
var write = function() {
|
|
299
|
+
node.style.transform = `translate3d(${x.get()}px, ${y.get()}px, 0)`;
|
|
300
|
+
};
|
|
301
|
+
x.on("change", write);
|
|
302
|
+
y.on("change", write);
|
|
303
|
+
entry = {
|
|
304
|
+
x,
|
|
305
|
+
y,
|
|
306
|
+
stop: null
|
|
307
|
+
};
|
|
308
|
+
PopperPositionAnims.set(node, entry);
|
|
309
|
+
}
|
|
310
|
+
if (!entry.stop) {
|
|
311
|
+
try {
|
|
312
|
+
var live = parseTranslate(getComputedStyle(node).transform);
|
|
313
|
+
if (live) {
|
|
314
|
+
entry.x.jump(live.x);
|
|
315
|
+
entry.y.jump(live.y);
|
|
316
|
+
}
|
|
317
|
+
} catch (e) {}
|
|
318
|
+
}
|
|
319
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
320
|
+
try {
|
|
321
|
+
for (var _iterator = node.getAnimations()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
322
|
+
var anim = _step.value;
|
|
323
|
+
try {
|
|
324
|
+
var _anim_effect_getKeyframes, _anim_effect;
|
|
325
|
+
var kf = (_anim_effect = anim.effect) === null || _anim_effect === void 0 ? void 0 : (_anim_effect_getKeyframes = _anim_effect.getKeyframes) === null || _anim_effect_getKeyframes === void 0 ? void 0 : _anim_effect_getKeyframes.call(_anim_effect);
|
|
326
|
+
if (kf === null || kf === void 0 ? void 0 : kf.some(function(k) {
|
|
327
|
+
return "transform" in k;
|
|
328
|
+
})) {
|
|
329
|
+
anim.cancel();
|
|
330
|
+
}
|
|
331
|
+
} catch (e) {}
|
|
332
|
+
}
|
|
333
|
+
} catch (err) {
|
|
334
|
+
_didIteratorError = true;
|
|
335
|
+
_iteratorError = err;
|
|
336
|
+
} finally {
|
|
337
|
+
try {
|
|
338
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
339
|
+
_iterator.return();
|
|
340
|
+
}
|
|
341
|
+
} finally {
|
|
342
|
+
if (_didIteratorError) {
|
|
343
|
+
throw _iteratorError;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
var opts = animationOptions2;
|
|
348
|
+
var _opts_transform, _ref;
|
|
349
|
+
var positionTransition = (_ref = (_opts_transform = opts.transform) !== null && _opts_transform !== void 0 ? _opts_transform : opts.default) !== null && _ref !== void 0 ? _ref : animationOptions2;
|
|
350
|
+
var cx = (0, import_react.animate)(entry.x, target.x, positionTransition);
|
|
351
|
+
var cy = (0, import_react.animate)(entry.y, target.y, positionTransition);
|
|
352
|
+
entry.stop = function() {
|
|
353
|
+
cx.stop();
|
|
354
|
+
cy.stop();
|
|
355
|
+
};
|
|
356
|
+
popperHandledTransform = true;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (isCurrentlyExiting) {
|
|
360
|
+
var entry1 = PopperPositionAnims.get(node);
|
|
361
|
+
if (entry1 === null || entry1 === void 0 ? void 0 : entry1.stop) {
|
|
362
|
+
entry1.stop();
|
|
363
|
+
entry1.stop = null;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
var midFlightValues = null;
|
|
367
|
+
if (refs.current.controls) {
|
|
368
|
+
try {
|
|
369
|
+
var computed = getComputedStyle(node);
|
|
370
|
+
midFlightValues = {};
|
|
371
|
+
for (var key1 in diff) {
|
|
372
|
+
var val = computed[key1];
|
|
373
|
+
if (val !== void 0 && val !== "") {
|
|
374
|
+
midFlightValues[key1] = val;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} catch (e) {}
|
|
378
|
+
if (isCurrentlyExiting) {
|
|
379
|
+
refs.current.controls.stop();
|
|
380
|
+
}
|
|
381
|
+
if (midFlightValues) {
|
|
382
|
+
for (var key2 in midFlightValues) {
|
|
383
|
+
if (key2 === "transform" && popperHandledTransform) continue;
|
|
384
|
+
node.style[key2] = midFlightValues[key2];
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (isPopperPosition && !popperHandledTransform) {
|
|
388
|
+
var anims = node.getAnimations();
|
|
389
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
390
|
+
try {
|
|
391
|
+
for (var _iterator1 = anims[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
392
|
+
var anim1 = _step1.value;
|
|
393
|
+
anim1.cancel();
|
|
394
|
+
}
|
|
395
|
+
} catch (err) {
|
|
396
|
+
_didIteratorError1 = true;
|
|
397
|
+
_iteratorError1 = err;
|
|
398
|
+
} finally {
|
|
399
|
+
try {
|
|
400
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
401
|
+
_iterator1.return();
|
|
402
|
+
}
|
|
403
|
+
} finally {
|
|
404
|
+
if (_didIteratorError1) {
|
|
405
|
+
throw _iteratorError1;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
var fixedDiff = fixTransparentColors(diff, refs.current.lastDoAnimate, doAnimate2);
|
|
412
|
+
var waapiDiff = Object.fromEntries(Object.entries(fixedDiff).map(function(param2) {
|
|
413
|
+
var [key3, value] = param2;
|
|
414
|
+
return [key3, Array.isArray(value) ? value.map(function(item) {
|
|
415
|
+
return (0, import_web.normalizeValueWithProperty)(item, key3);
|
|
416
|
+
}) : (0, import_web.normalizeValueWithProperty)(value, key3)];
|
|
417
|
+
}));
|
|
418
|
+
if (popperHandledTransform && "transform" in waapiDiff) {
|
|
419
|
+
waapiDiff = { ...waapiDiff };
|
|
420
|
+
delete waapiDiff.transform;
|
|
421
|
+
}
|
|
422
|
+
if ((isPopperPosition || isCurrentlyExiting) && (midFlightValues === null || midFlightValues === void 0 ? void 0 : midFlightValues.transform) && waapiDiff.transform) {
|
|
423
|
+
waapiDiff.transform = [midFlightValues.transform, waapiDiff.transform];
|
|
424
|
+
}
|
|
425
|
+
if (Object.keys(waapiDiff).length > 0) {
|
|
426
|
+
startedControls = (0, import_react.animate)(node, waapiDiff, animationOptions2);
|
|
427
|
+
refs.current.controls = startedControls;
|
|
428
|
+
}
|
|
429
|
+
refs.current.lastAnimateAt = Date.now();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
refs.current.lastDontAnimate = dontAnimate2 ? { ...dontAnimate2 } : {};
|
|
433
|
+
refs.current.lastDoAnimate = doAnimate2 ? { ...doAnimate2 } : {};
|
|
434
|
+
} finally {
|
|
435
|
+
if (isCurrentlyExiting && currentSendExitComplete) {
|
|
436
|
+
if (refs.current.enterStarted) {
|
|
437
|
+
refs.current.enterStarted = false;
|
|
438
|
+
emit("end", "enter", false);
|
|
439
|
+
}
|
|
440
|
+
if (startedControls) {
|
|
441
|
+
if (!refs.current.exitStarted) {
|
|
442
|
+
refs.current.exitStarted = true;
|
|
443
|
+
emit("start", "exit");
|
|
444
|
+
}
|
|
445
|
+
refs.current.exitCompleteScheduled = true;
|
|
446
|
+
var complete = function(finished) {
|
|
447
|
+
if (!refs.current.isExiting) return;
|
|
448
|
+
if (refs.current.exitStarted) {
|
|
449
|
+
refs.current.exitStarted = false;
|
|
450
|
+
emit("end", "exit", finished);
|
|
451
|
+
}
|
|
452
|
+
currentSendExitComplete();
|
|
453
|
+
};
|
|
454
|
+
startedControls.finished.then(function() {
|
|
455
|
+
return complete(true);
|
|
456
|
+
}).catch(function() {
|
|
457
|
+
return complete(false);
|
|
458
|
+
});
|
|
459
|
+
} else if (!refs.current.exitCompleteScheduled) {
|
|
460
|
+
emit("start", "exit");
|
|
461
|
+
emit("end", "exit", true);
|
|
462
|
+
currentSendExitComplete();
|
|
463
|
+
}
|
|
464
|
+
} else if (currentAnimationState === "enter") {
|
|
465
|
+
if (startedControls) {
|
|
466
|
+
if (!refs.current.enterStarted) {
|
|
467
|
+
refs.current.enterStarted = true;
|
|
468
|
+
emit("start", "enter");
|
|
469
|
+
}
|
|
470
|
+
refs.current.enterCompleteScheduled = true;
|
|
471
|
+
var complete1 = function(finished) {
|
|
472
|
+
if (refs.current.disposed || refs.current.animationState !== "enter") return;
|
|
473
|
+
if (refs.current.enterStarted) {
|
|
474
|
+
refs.current.enterStarted = false;
|
|
475
|
+
emit("end", "enter", finished);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
startedControls.finished.then(function() {
|
|
479
|
+
return complete1(true);
|
|
480
|
+
}).catch(function() {
|
|
481
|
+
return complete1(false);
|
|
482
|
+
});
|
|
483
|
+
} else if (!refs.current.enterCompleteScheduled && !refs.current.disableAnimation) {
|
|
484
|
+
emit("start", "enter");
|
|
485
|
+
emit("end", "enter", true);
|
|
486
|
+
}
|
|
487
|
+
} else if (startedControls) {
|
|
488
|
+
var controls = startedControls;
|
|
489
|
+
if (refs.current.updateInFlight) {
|
|
490
|
+
emit("end", "update", false);
|
|
491
|
+
}
|
|
492
|
+
refs.current.updateInFlight = true;
|
|
493
|
+
refs.current.updateControls = controls;
|
|
494
|
+
emit("start", "update");
|
|
495
|
+
var settle = function(finished) {
|
|
496
|
+
if (refs.current.updateControls !== controls) return;
|
|
497
|
+
refs.current.updateInFlight = false;
|
|
498
|
+
refs.current.updateControls = null;
|
|
499
|
+
emit("end", "update", finished);
|
|
500
|
+
};
|
|
501
|
+
controls.finished.then(function() {
|
|
502
|
+
return settle(true);
|
|
503
|
+
}).catch(function() {
|
|
504
|
+
return settle(false);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function(nextStyle, effectiveTransition) {
|
|
510
|
+
var _$animationProps = getMotionAnimatedProps(props, nextStyle, disableAnimation, refs.current.animationState, effectiveTransition);
|
|
511
|
+
flushAnimation(_$animationProps);
|
|
512
|
+
});
|
|
513
|
+
(0, import_web.useIsomorphicLayoutEffect)(function() {
|
|
514
|
+
if (refs.current.isFirstRender) {
|
|
515
|
+
refs.current.isFirstRender = false;
|
|
516
|
+
refs.current.wasDisabled = disableAnimation;
|
|
517
|
+
if (isHydrating) {
|
|
518
|
+
if (doAnimate && Object.keys(doAnimate).length > 0) {
|
|
519
|
+
refs.current.lastDoAnimate = { ...doAnimate };
|
|
520
|
+
} else {
|
|
521
|
+
refs.current.lastDoAnimate = dontAnimate ? { ...dontAnimate } : {};
|
|
522
|
+
}
|
|
523
|
+
refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {};
|
|
524
|
+
refs.current.lastAnimateAt = Date.now();
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {};
|
|
528
|
+
refs.current.lastDoAnimate = doAnimate ? { ...doAnimate } : {};
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
var justEnabled = refs.current.wasDisabled && !disableAnimation;
|
|
532
|
+
refs.current.wasDisabled = disableAnimation;
|
|
533
|
+
var justStrippedClasses = !refs.current.wasNoClass && !!styleProps.noClass;
|
|
534
|
+
refs.current.wasNoClass = !!styleProps.noClass;
|
|
535
|
+
if ((justEnabled || justStrippedClasses) && animationState !== "enter") {
|
|
536
|
+
var node = stateRef.current.host;
|
|
537
|
+
if (_instanceof(node, HTMLElement)) {
|
|
538
|
+
if (dontAnimate) assignInlineStyles(node, dontAnimate);
|
|
539
|
+
if (doAnimate) assignInlineStyles(node, doAnimate);
|
|
540
|
+
var entry = PopperPositionAnims.get(node);
|
|
541
|
+
if (entry) {
|
|
542
|
+
var _doAnimate_transform;
|
|
543
|
+
var target = parseTranslate((_doAnimate_transform = doAnimate === null || doAnimate === void 0 ? void 0 : doAnimate.transform) !== null && _doAnimate_transform !== void 0 ? _doAnimate_transform : dontAnimate === null || dontAnimate === void 0 ? void 0 : dontAnimate.transform);
|
|
544
|
+
if (target) {
|
|
545
|
+
var _entry_stop;
|
|
546
|
+
(_entry_stop = entry.stop) === null || _entry_stop === void 0 ? void 0 : _entry_stop.call(entry);
|
|
547
|
+
entry.stop = null;
|
|
548
|
+
entry.x.jump(target.x);
|
|
549
|
+
entry.y.jump(target.y);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {};
|
|
554
|
+
refs.current.lastDoAnimate = doAnimate ? { ...doAnimate } : {};
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
flushAnimation({
|
|
558
|
+
doAnimate,
|
|
559
|
+
dontAnimate,
|
|
560
|
+
animationOptions
|
|
561
|
+
});
|
|
562
|
+
}, [
|
|
563
|
+
style,
|
|
564
|
+
isExiting,
|
|
565
|
+
disableAnimation,
|
|
566
|
+
styleProps.noClass
|
|
567
|
+
]);
|
|
568
|
+
if (process.env.NODE_ENV === "development") {
|
|
569
|
+
if (props["debug"] && props["debug"] !== "profile") {
|
|
570
|
+
console.groupCollapsed(`[motion] render`);
|
|
571
|
+
console.info({
|
|
572
|
+
style,
|
|
573
|
+
doAnimate,
|
|
574
|
+
dontAnimate,
|
|
575
|
+
scope,
|
|
576
|
+
animationOptions,
|
|
577
|
+
isExiting,
|
|
578
|
+
isFirstRender: refs.current.isFirstRender,
|
|
579
|
+
animationProps
|
|
580
|
+
});
|
|
581
|
+
console.groupEnd();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return {
|
|
585
|
+
style: firstRenderStyle,
|
|
586
|
+
ref: scope,
|
|
587
|
+
render: "div"
|
|
588
|
+
};
|
|
589
|
+
},
|
|
590
|
+
useAnimatedNumber(initial) {
|
|
591
|
+
var motionValue2 = (0, import_react.useMotionValue)(initial);
|
|
592
|
+
return import_react2.default.useMemo(function() {
|
|
593
|
+
return {
|
|
594
|
+
getInstance() {
|
|
595
|
+
return motionValue2;
|
|
596
|
+
},
|
|
597
|
+
getValue() {
|
|
598
|
+
return motionValue2.get();
|
|
599
|
+
},
|
|
600
|
+
setValue(next) {
|
|
601
|
+
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { type: "spring" }, onFinish = arguments.length > 2 ? arguments[2] : void 0;
|
|
602
|
+
if (config.type === "direct") {
|
|
603
|
+
MotionValueStrategy.set(motionValue2, { type: "direct" });
|
|
604
|
+
motionValue2.set(next);
|
|
605
|
+
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
MotionValueStrategy.set(motionValue2, config);
|
|
609
|
+
if (onFinish) {
|
|
610
|
+
var prior = PendingMotionOnFinish.get(motionValue2);
|
|
611
|
+
if (prior) {
|
|
612
|
+
PendingMotionOnFinish.delete(motionValue2);
|
|
613
|
+
prior();
|
|
614
|
+
}
|
|
615
|
+
PendingMotionOnFinish.set(motionValue2, onFinish);
|
|
616
|
+
}
|
|
617
|
+
motionValue2.set(next);
|
|
618
|
+
},
|
|
619
|
+
stop() {
|
|
620
|
+
motionValue2.stop();
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
}, [motionValue2]);
|
|
624
|
+
},
|
|
625
|
+
useAnimatedNumberReaction(param, onValue) {
|
|
626
|
+
var { value } = param;
|
|
627
|
+
var instance = value.getInstance();
|
|
628
|
+
(0, import_react.useMotionValueEvent)(instance, "change", onValue);
|
|
629
|
+
},
|
|
630
|
+
useAnimatedNumberStyle(val, getStyleProp) {
|
|
631
|
+
var motionValue2 = val.getInstance();
|
|
632
|
+
var getStyleRef = (0, import_react2.useRef)(getStyleProp);
|
|
633
|
+
getStyleRef.current = getStyleProp;
|
|
634
|
+
return (0, import_react2.useMemo)(function() {
|
|
635
|
+
return {
|
|
636
|
+
getStyle: function(cur) {
|
|
637
|
+
return getStyleRef.current(cur);
|
|
638
|
+
},
|
|
639
|
+
motionValue: motionValue2
|
|
640
|
+
};
|
|
641
|
+
}, []);
|
|
642
|
+
},
|
|
643
|
+
useAnimatedNumbersStyle(vals, getStyleProp) {
|
|
644
|
+
var motionValues = vals.map(function(v) {
|
|
645
|
+
return v.getInstance();
|
|
646
|
+
});
|
|
647
|
+
var getStyleRef = (0, import_react2.useRef)(getStyleProp);
|
|
648
|
+
getStyleRef.current = getStyleProp;
|
|
649
|
+
return (0, import_react2.useMemo)(function() {
|
|
650
|
+
return {
|
|
651
|
+
getStyle: function() {
|
|
652
|
+
for (var _len = arguments.length, currentValues = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
653
|
+
currentValues[_key] = arguments[_key];
|
|
654
|
+
}
|
|
655
|
+
return getStyleRef.current(...currentValues);
|
|
656
|
+
},
|
|
657
|
+
motionValues
|
|
658
|
+
};
|
|
659
|
+
}, []);
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
function getMotionAnimatedProps(props, style, disable) {
|
|
663
|
+
var animationState = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "default", transitionOverride = arguments.length > 4 ? arguments[4] : void 0;
|
|
664
|
+
if (disable) {
|
|
665
|
+
return { dontAnimate: style };
|
|
666
|
+
}
|
|
667
|
+
var _ref;
|
|
668
|
+
var animationOptions = getAnimationOptions((_ref = transitionOverride !== null && transitionOverride !== void 0 ? transitionOverride : props.transition) !== null && _ref !== void 0 ? _ref : null, animationState);
|
|
669
|
+
var dontAnimate;
|
|
670
|
+
var doAnimate;
|
|
671
|
+
var animateOnly = props.animateOnly;
|
|
672
|
+
for (var key in style) {
|
|
673
|
+
var value = style[key];
|
|
674
|
+
if (disableAnimationProps.has(key) || animateOnly && !animateOnly.includes(key)) {
|
|
675
|
+
dontAnimate || (dontAnimate = {});
|
|
676
|
+
dontAnimate[key] = value;
|
|
677
|
+
} else {
|
|
678
|
+
doAnimate || (doAnimate = {});
|
|
679
|
+
doAnimate[key] = value;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
return {
|
|
683
|
+
dontAnimate,
|
|
684
|
+
doAnimate,
|
|
685
|
+
animationOptions
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
function getAnimationOptions(transitionProp) {
|
|
689
|
+
var animationState = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
|
|
690
|
+
var normalized = (0, import_animation_helpers.normalizeTransition)(transitionProp);
|
|
691
|
+
var effectiveKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
|
|
692
|
+
if (!effectiveKey && animationState === "default") {
|
|
693
|
+
effectiveKey = normalized.enter || normalized.exit || null;
|
|
694
|
+
}
|
|
695
|
+
var globalConfigOverride = normalized.config ? { ...normalized.config } : void 0;
|
|
696
|
+
if (!effectiveKey && Object.keys(normalized.properties).length === 0 && !globalConfigOverride) {
|
|
697
|
+
return {};
|
|
698
|
+
}
|
|
699
|
+
var defaultConfig = effectiveKey ? withInferredType(animations[effectiveKey]) : null;
|
|
700
|
+
var delay = normalized.delay;
|
|
701
|
+
var result = {};
|
|
702
|
+
if (defaultConfig) {
|
|
703
|
+
Object.assign(result, defaultConfig);
|
|
704
|
+
}
|
|
705
|
+
if (globalConfigOverride) {
|
|
706
|
+
Object.assign(result, globalConfigOverride);
|
|
707
|
+
if (result.type === void 0 && result.duration !== void 0 && result.damping === void 0 && result.stiffness === void 0 && result.mass === void 0) {
|
|
708
|
+
result.type = "tween";
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
if (delay) {
|
|
712
|
+
result.delay = delay;
|
|
713
|
+
}
|
|
714
|
+
if (defaultConfig || globalConfigOverride || delay) {
|
|
715
|
+
result.default = {
|
|
716
|
+
...defaultConfig,
|
|
717
|
+
...globalConfigOverride,
|
|
718
|
+
...delay ? { delay } : null
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
722
|
+
try {
|
|
723
|
+
for (var _iterator = Object.entries(normalized.properties)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
724
|
+
var [propName, animationNameOrConfig] = _step.value;
|
|
725
|
+
if (typeof animationNameOrConfig === "string") {
|
|
726
|
+
result[propName] = withInferredType(animations[animationNameOrConfig]);
|
|
727
|
+
} else if (animationNameOrConfig && (typeof animationNameOrConfig === "undefined" ? "undefined" : _type_of(animationNameOrConfig)) === "object") {
|
|
728
|
+
var baseConfig = animationNameOrConfig.type ? withInferredType(animations[animationNameOrConfig.type]) : defaultConfig;
|
|
729
|
+
result[propName] = {
|
|
730
|
+
...baseConfig,
|
|
731
|
+
...animationNameOrConfig
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
} catch (err) {
|
|
736
|
+
_didIteratorError = true;
|
|
737
|
+
_iteratorError = err;
|
|
738
|
+
} finally {
|
|
739
|
+
try {
|
|
740
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
741
|
+
_iterator.return();
|
|
742
|
+
}
|
|
743
|
+
} finally {
|
|
744
|
+
if (_didIteratorError) {
|
|
745
|
+
throw _iteratorError;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
convertMsToS(result);
|
|
750
|
+
convertMsToS(result.default);
|
|
751
|
+
for (var key in result) {
|
|
752
|
+
if (key !== "default" && _type_of(result[key]) === "object") {
|
|
753
|
+
convertMsToS(result[key]);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return result;
|
|
757
|
+
}
|
|
725
758
|
}
|
|
726
759
|
function withInferredType(config) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
...config
|
|
736
|
-
};
|
|
760
|
+
if (!config) {
|
|
761
|
+
return { type: "spring" };
|
|
762
|
+
}
|
|
763
|
+
var isTimingBased = config.duration !== void 0 && config.damping === void 0 && config.stiffness === void 0 && config.mass === void 0;
|
|
764
|
+
return {
|
|
765
|
+
type: isTimingBased ? "tween" : "spring",
|
|
766
|
+
...config
|
|
767
|
+
};
|
|
737
768
|
}
|
|
738
769
|
function convertMsToS(config) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
770
|
+
if (!config) return;
|
|
771
|
+
if (typeof config.delay === "number") config.delay = config.delay / 1e3;
|
|
772
|
+
if (typeof config.duration === "number") {
|
|
773
|
+
var isTimingBased = config.type === "tween" || config.type === void 0 && config.damping === void 0 && config.stiffness === void 0 && config.mass === void 0;
|
|
774
|
+
if (isTimingBased) {
|
|
775
|
+
config.duration = config.duration / 1e3;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
747
778
|
}
|
|
748
779
|
function removeRemovedStyles(prev, next, node, dontClearIfIn) {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
780
|
+
for (var key in prev) {
|
|
781
|
+
if (!(key in next)) {
|
|
782
|
+
if (dontClearIfIn && key in dontClearIfIn) {
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
node.style[key] = "";
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
var disableAnimationProps = /* @__PURE__ */ new Set([
|
|
790
|
+
"alignContent",
|
|
791
|
+
"alignItems",
|
|
792
|
+
"boxSizing",
|
|
793
|
+
"contain",
|
|
794
|
+
"containerType",
|
|
795
|
+
"display",
|
|
796
|
+
"flexBasis",
|
|
797
|
+
"flexDirection",
|
|
798
|
+
"fontFamily",
|
|
799
|
+
"justifyContent",
|
|
800
|
+
"overflow",
|
|
801
|
+
"overflowX",
|
|
802
|
+
"overflowY",
|
|
803
|
+
"pointerEvents",
|
|
804
|
+
"position",
|
|
805
|
+
"textWrap",
|
|
806
|
+
"userSelect"
|
|
807
|
+
]);
|
|
808
|
+
function motionPropsEqual(a, b) {
|
|
809
|
+
for (var key in a) {
|
|
810
|
+
if (!(key in b)) return false;
|
|
811
|
+
}
|
|
812
|
+
for (var key1 in b) {
|
|
813
|
+
if (key1 === "children") continue;
|
|
814
|
+
var av = a[key1];
|
|
815
|
+
var bv = b[key1];
|
|
816
|
+
if (typeof bv === "function" && typeof av === "function") continue;
|
|
817
|
+
if (!Object.is(av, bv)) return false;
|
|
818
|
+
}
|
|
819
|
+
return true;
|
|
820
|
+
}
|
|
821
|
+
function motionStylesEqual(a, b) {
|
|
822
|
+
if (a.length !== b.length) return false;
|
|
823
|
+
for (var i = 0; i < a.length; i++) {
|
|
824
|
+
var sa = a[i];
|
|
825
|
+
var sb = b[i];
|
|
826
|
+
if (sa === sb) continue;
|
|
827
|
+
if (!sa || !sb) return false;
|
|
828
|
+
var aCount = 0;
|
|
829
|
+
for (var key in sa) {
|
|
830
|
+
aCount++;
|
|
831
|
+
if (!Object.is(sa[key], sb[key])) return false;
|
|
832
|
+
}
|
|
833
|
+
var bCount = 0;
|
|
834
|
+
for (var _key in sb) {
|
|
835
|
+
bCount++;
|
|
836
|
+
}
|
|
837
|
+
if (aCount !== bCount) return false;
|
|
838
|
+
}
|
|
839
|
+
return true;
|
|
757
840
|
}
|
|
758
|
-
var disableAnimationProps = /* @__PURE__ */new Set(["alignContent", "alignItems", "boxSizing", "contain", "containerType", "display", "flexBasis", "flexDirection", "fontFamily", "justifyContent", "overflow", "overflowX", "overflowY", "pointerEvents", "position", "textWrap", "userSelect"]);
|
|
759
841
|
var MotionView = createMotionView("div");
|
|
760
842
|
var MotionText = createMotionView("span");
|
|
843
|
+
var transformAliases = {
|
|
844
|
+
x: "translateX",
|
|
845
|
+
y: "translateY",
|
|
846
|
+
scale: "scale",
|
|
847
|
+
scaleX: "scaleX",
|
|
848
|
+
scaleY: "scaleY",
|
|
849
|
+
rotate: "rotate",
|
|
850
|
+
rotateX: "rotateX",
|
|
851
|
+
rotateY: "rotateY",
|
|
852
|
+
rotateZ: "rotateZ",
|
|
853
|
+
skewX: "skewX",
|
|
854
|
+
skewY: "skewY"
|
|
855
|
+
};
|
|
856
|
+
function compileAnimatedStyle(initialSource, initialResolved) {
|
|
857
|
+
var shorthands = (0, import_web.getConfig)().shorthands;
|
|
858
|
+
var entries = Object.keys(initialSource).map(function(source) {
|
|
859
|
+
var _shorthands_source, _shorthands_source1, _shorthands_source2;
|
|
860
|
+
return {
|
|
861
|
+
source,
|
|
862
|
+
target: (_shorthands_source = shorthands === null || shorthands === void 0 ? void 0 : shorthands[source]) !== null && _shorthands_source !== void 0 ? _shorthands_source : source,
|
|
863
|
+
tokenValue: typeof initialSource[source] === "string" && initialResolved[(_shorthands_source1 = shorthands === null || shorthands === void 0 ? void 0 : shorthands[source]) !== null && _shorthands_source1 !== void 0 ? _shorthands_source1 : source] !== initialSource[source] ? initialResolved[(_shorthands_source2 = shorthands === null || shorthands === void 0 ? void 0 : shorthands[source]) !== null && _shorthands_source2 !== void 0 ? _shorthands_source2 : source] : void 0
|
|
864
|
+
};
|
|
865
|
+
});
|
|
866
|
+
return function(sourceStyle) {
|
|
867
|
+
var resolved = {};
|
|
868
|
+
var transforms = [];
|
|
869
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
870
|
+
try {
|
|
871
|
+
for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
872
|
+
var entry = _step.value;
|
|
873
|
+
var value = sourceStyle[entry.source];
|
|
874
|
+
if (value === void 0) continue;
|
|
875
|
+
if (entry.source === "transform" && Array.isArray(value)) {
|
|
876
|
+
resolved.transform = (0, import_web.transformsToString)(value);
|
|
877
|
+
} else if (entry.source in transformAliases) {
|
|
878
|
+
transforms.push({ [transformAliases[entry.source]]: value });
|
|
879
|
+
} else {
|
|
880
|
+
var _entry_tokenValue;
|
|
881
|
+
resolved[entry.target] = (_entry_tokenValue = entry.tokenValue) !== null && _entry_tokenValue !== void 0 ? _entry_tokenValue : (0, import_web.normalizeValueWithProperty)(value, entry.target);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
} catch (err) {
|
|
885
|
+
_didIteratorError = true;
|
|
886
|
+
_iteratorError = err;
|
|
887
|
+
} finally {
|
|
888
|
+
try {
|
|
889
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
890
|
+
_iterator.return();
|
|
891
|
+
}
|
|
892
|
+
} finally {
|
|
893
|
+
if (_didIteratorError) {
|
|
894
|
+
throw _iteratorError;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (transforms.length) resolved.transform = (0, import_web.transformsToString)(transforms);
|
|
899
|
+
return resolved;
|
|
900
|
+
};
|
|
901
|
+
}
|
|
761
902
|
function createMotionView(defaultTag) {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
903
|
+
var isText = defaultTag === "span";
|
|
904
|
+
var Component = (0, import_web.createRefComponent)(function(propsIn, ref) {
|
|
905
|
+
var _hooks_usePropsTransform;
|
|
906
|
+
var { forwardedRef, animation, render = defaultTag, style, ...propsRest } = propsIn;
|
|
907
|
+
var [scope, animate] = useAnimateSSRSafe();
|
|
908
|
+
var hostRef = (0, import_react2.useRef)(null);
|
|
909
|
+
var seededNode = (0, import_react2.useRef)(null);
|
|
910
|
+
var seededInCurrentFrame = (0, import_react2.useRef)(false);
|
|
911
|
+
var queuedAnimationFrames = (0, import_react2.useRef)(/* @__PURE__ */ new WeakMap());
|
|
912
|
+
var composedRefs = (0, import_web.useComposedRefs)(forwardedRef, ref, hostRef, scope);
|
|
913
|
+
var stateRef = (0, import_react2.useRef)(null);
|
|
914
|
+
if (!stateRef.current) {
|
|
915
|
+
stateRef.current = { get host() {
|
|
916
|
+
return hostRef.current;
|
|
917
|
+
} };
|
|
918
|
+
}
|
|
919
|
+
var [_, state] = (0, import_web.useThemeWithState)({});
|
|
920
|
+
var styles = Array.isArray(style) ? style : [style];
|
|
921
|
+
var [animatedStyle, nonAnimatedStyles] = (function() {
|
|
922
|
+
var animatedStyle2;
|
|
923
|
+
var nonAnimatedStyles2 = [];
|
|
924
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
925
|
+
try {
|
|
926
|
+
for (var _iterator = styles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
927
|
+
var style2 = _step.value;
|
|
928
|
+
if (style2.getStyle) {
|
|
929
|
+
animatedStyle2 = style2;
|
|
930
|
+
} else {
|
|
931
|
+
nonAnimatedStyles2.push(style2);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
} catch (err) {
|
|
935
|
+
_didIteratorError = true;
|
|
936
|
+
_iteratorError = err;
|
|
937
|
+
} finally {
|
|
938
|
+
try {
|
|
939
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
940
|
+
_iterator.return();
|
|
941
|
+
}
|
|
942
|
+
} finally {
|
|
943
|
+
if (_didIteratorError) {
|
|
944
|
+
throw _iteratorError;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
return [animatedStyle2, nonAnimatedStyles2];
|
|
949
|
+
})();
|
|
950
|
+
function getProps(props2) {
|
|
951
|
+
if (process.env.NODE_ENV === "development" && propsIn.debug === "profile" && typeof performance !== "undefined") {
|
|
952
|
+
performance.mark("tamagui-motion-style-split");
|
|
953
|
+
}
|
|
954
|
+
var out = (0, import_web.getSplitStyles)(props2, isText ? import_web.Text.staticConfig : import_web.View.staticConfig, state === null || state === void 0 ? void 0 : state.theme, state === null || state === void 0 ? void 0 : state.name, { unmounted: false }, {
|
|
955
|
+
isAnimated: false,
|
|
956
|
+
noClass: true,
|
|
957
|
+
resolveValues: "auto"
|
|
958
|
+
});
|
|
959
|
+
if (!out) {
|
|
960
|
+
return {};
|
|
961
|
+
}
|
|
962
|
+
if (out.viewProps.style) {
|
|
963
|
+
(0, import_web.fixStyles)(out.viewProps.style);
|
|
964
|
+
(0, import_web.styleToCSS)(out.viewProps.style);
|
|
965
|
+
}
|
|
966
|
+
return out.viewProps;
|
|
967
|
+
}
|
|
968
|
+
var resolvedAnimatedStyle = (0, import_react2.useMemo)(function() {
|
|
969
|
+
if (!animatedStyle) return null;
|
|
970
|
+
var currentValues = animatedStyle.motionValues ? animatedStyle.motionValues.map(function(value) {
|
|
971
|
+
return value.get();
|
|
972
|
+
}) : animatedStyle.motionValue ? [animatedStyle.motionValue.get()] : [];
|
|
973
|
+
var initialSource = animatedStyle.getStyle(...currentValues);
|
|
974
|
+
var initialResolved = asStyleRecord(getProps({ style: initialSource }).style);
|
|
975
|
+
return {
|
|
976
|
+
initial: initialResolved,
|
|
977
|
+
resolve: compileAnimatedStyle(initialSource, initialResolved)
|
|
978
|
+
};
|
|
979
|
+
}, [
|
|
980
|
+
animatedStyle,
|
|
981
|
+
state === null || state === void 0 ? void 0 : state.theme,
|
|
982
|
+
state === null || state === void 0 ? void 0 : state.name
|
|
983
|
+
]);
|
|
984
|
+
var memoRef = (0, import_react2.useRef)(null);
|
|
985
|
+
var props;
|
|
986
|
+
var cached = memoRef.current;
|
|
987
|
+
if (cached && cached.theme === (state === null || state === void 0 ? void 0 : state.theme) && cached.themeName === (state === null || state === void 0 ? void 0 : state.name) && motionStylesEqual(cached.styles, nonAnimatedStyles) && motionPropsEqual(cached.propsRest, propsRest)) {
|
|
988
|
+
props = { ...cached.result };
|
|
989
|
+
for (var key in propsRest) {
|
|
990
|
+
var val = propsRest[key];
|
|
991
|
+
if (key === "children" || typeof val === "function") {
|
|
992
|
+
props[key] = val;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
} else {
|
|
996
|
+
props = getProps({
|
|
997
|
+
...propsRest,
|
|
998
|
+
style: nonAnimatedStyles
|
|
999
|
+
});
|
|
1000
|
+
memoRef.current = {
|
|
1001
|
+
propsRest,
|
|
1002
|
+
styles: nonAnimatedStyles,
|
|
1003
|
+
theme: state === null || state === void 0 ? void 0 : state.theme,
|
|
1004
|
+
themeName: state === null || state === void 0 ? void 0 : state.name,
|
|
1005
|
+
result: props
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
if (resolvedAnimatedStyle) {
|
|
1009
|
+
props = {
|
|
1010
|
+
...props,
|
|
1011
|
+
style: {
|
|
1012
|
+
...asStyleRecord(props.style),
|
|
1013
|
+
...resolvedAnimatedStyle.initial
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
var Element = render || "div";
|
|
1018
|
+
var transformedProps = (_hooks_usePropsTransform = import_web.hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(import_web.hooks, render, props, stateRef, false);
|
|
1019
|
+
(0, import_web.useIsomorphicLayoutEffect)(function() {
|
|
1020
|
+
if (!animatedStyle) return;
|
|
1021
|
+
var node = hostRef.current;
|
|
1022
|
+
if (_instanceof(node, HTMLElement) && seededNode.current !== node) {
|
|
1023
|
+
var currentStyle = animatedStyle.motionValues ? animatedStyle.getStyle(...animatedStyle.motionValues.map(function(value) {
|
|
1024
|
+
return value.get();
|
|
1025
|
+
})) : animatedStyle.motionValue ? animatedStyle.getStyle(animatedStyle.motionValue.get()) : null;
|
|
1026
|
+
var webStyle = currentStyle && (resolvedAnimatedStyle === null || resolvedAnimatedStyle === void 0 ? void 0 : resolvedAnimatedStyle.resolve(currentStyle));
|
|
1027
|
+
if (webStyle) {
|
|
1028
|
+
assignInlineStyles(node, webStyle);
|
|
1029
|
+
seededNode.current = node;
|
|
1030
|
+
seededInCurrentFrame.current = true;
|
|
1031
|
+
requestAnimationFrame(function() {
|
|
1032
|
+
if (seededNode.current === node) seededInCurrentFrame.current = false;
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
var toTransition = function(animationConfig) {
|
|
1037
|
+
return (animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.type) === "timing" ? {
|
|
1038
|
+
type: "tween",
|
|
1039
|
+
duration: (animationConfig.duration || 0) / 1e3
|
|
1040
|
+
} : (animationConfig === null || animationConfig === void 0 ? void 0 : animationConfig.type) === "direct" ? {
|
|
1041
|
+
type: "tween",
|
|
1042
|
+
duration: 0
|
|
1043
|
+
} : {
|
|
1044
|
+
type: "spring",
|
|
1045
|
+
...animationConfig
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
var animateNodeTo = function(nextStyle, transition, motionValue3) {
|
|
1049
|
+
if (!_instanceof(node, HTMLElement) || hostRef.current !== node) return;
|
|
1050
|
+
var webStyle2 = resolvedAnimatedStyle === null || resolvedAnimatedStyle === void 0 ? void 0 : resolvedAnimatedStyle.resolve(nextStyle);
|
|
1051
|
+
if (!webStyle2) return;
|
|
1052
|
+
settlePendingMotionOnFinish(motionValue3, animate(node, webStyle2, transition));
|
|
1053
|
+
};
|
|
1054
|
+
var animateChangedValue = function(nextStyle, transition, motionValue3) {
|
|
1055
|
+
if (seededInCurrentFrame.current && seededNode.current === node) {
|
|
1056
|
+
var queuedFrame = queuedAnimationFrames.current.get(motionValue3);
|
|
1057
|
+
if (queuedFrame !== void 0) cancelAnimationFrame(queuedFrame);
|
|
1058
|
+
var frame = requestAnimationFrame(function() {
|
|
1059
|
+
if (queuedAnimationFrames.current.get(motionValue3) !== frame) return;
|
|
1060
|
+
queuedAnimationFrames.current.delete(motionValue3);
|
|
1061
|
+
if (hostRef.current === node) {
|
|
1062
|
+
animateNodeTo(nextStyle, transition, motionValue3);
|
|
1063
|
+
} else {
|
|
1064
|
+
var onFinish = PendingMotionOnFinish.get(motionValue3);
|
|
1065
|
+
PendingMotionOnFinish.delete(motionValue3);
|
|
1066
|
+
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
queuedAnimationFrames.current.set(motionValue3, frame);
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
animateNodeTo(nextStyle, transition, motionValue3);
|
|
1073
|
+
};
|
|
1074
|
+
if (animatedStyle.motionValues) {
|
|
1075
|
+
var mvs = animatedStyle.motionValues;
|
|
1076
|
+
var styleForAll = function() {
|
|
1077
|
+
return animatedStyle.getStyle(...mvs.map(function(value) {
|
|
1078
|
+
return value.get();
|
|
1079
|
+
}));
|
|
1080
|
+
};
|
|
1081
|
+
var unsubs = mvs.map(function(mv) {
|
|
1082
|
+
return mv.on("change", function() {
|
|
1083
|
+
return animateChangedValue(styleForAll(), toTransition(MotionValueStrategy.get(mv)), mv);
|
|
1084
|
+
});
|
|
1085
|
+
});
|
|
1086
|
+
return function() {
|
|
1087
|
+
return unsubs.forEach(function(fn) {
|
|
1088
|
+
return fn();
|
|
1089
|
+
});
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
var motionValue2 = animatedStyle.motionValue;
|
|
1093
|
+
if (!motionValue2) return;
|
|
1094
|
+
return motionValue2.on("change", function(value) {
|
|
1095
|
+
return animateChangedValue(animatedStyle.getStyle(value), toTransition(MotionValueStrategy.get(motionValue2)), motionValue2);
|
|
1096
|
+
});
|
|
1097
|
+
}, [animatedStyle, resolvedAnimatedStyle]);
|
|
1098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Element, {
|
|
1099
|
+
...transformedProps,
|
|
1100
|
+
ref: composedRefs
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1103
|
+
Component["acceptRenderProp"] = true;
|
|
1104
|
+
return Component;
|
|
936
1105
|
}
|
|
937
1106
|
function getDiff(previous, next) {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1107
|
+
if (!previous) {
|
|
1108
|
+
return next;
|
|
1109
|
+
}
|
|
1110
|
+
var diff = null;
|
|
1111
|
+
for (var key in next) {
|
|
1112
|
+
if (next[key] !== previous[key]) {
|
|
1113
|
+
diff || (diff = {});
|
|
1114
|
+
diff[key] = next[key];
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return diff;
|
|
949
1118
|
}
|
|
950
1119
|
function fixTransparentColors(diff, previous, next) {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
result[key] = fixed;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
return result;
|
|
1120
|
+
var result = diff;
|
|
1121
|
+
for (var key in diff) {
|
|
1122
|
+
if (diff[key] === "transparent") {
|
|
1123
|
+
var fixed = "rgba(0, 0, 0, 0)";
|
|
1124
|
+
var candidates = [previous === null || previous === void 0 ? void 0 : previous[key], next === null || next === void 0 ? void 0 : next[key]];
|
|
1125
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1126
|
+
try {
|
|
1127
|
+
for (var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
1128
|
+
var candidate = _step.value;
|
|
1129
|
+
if (typeof candidate === "string" && candidate !== "transparent") {
|
|
1130
|
+
var rgbaMatch = candidate.match(/^rgba?\(([^,]+),\s*([^,]+),\s*([^,)]+)/);
|
|
1131
|
+
if (rgbaMatch) {
|
|
1132
|
+
fixed = `rgba(${rgbaMatch[1]}, ${rgbaMatch[2]}, ${rgbaMatch[3]}, 0)`;
|
|
1133
|
+
break;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
} catch (err) {
|
|
1138
|
+
_didIteratorError = true;
|
|
1139
|
+
_iteratorError = err;
|
|
1140
|
+
} finally {
|
|
1141
|
+
try {
|
|
1142
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1143
|
+
_iterator.return();
|
|
1144
|
+
}
|
|
1145
|
+
} finally {
|
|
1146
|
+
if (_didIteratorError) {
|
|
1147
|
+
throw _iteratorError;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
if (result === diff) {
|
|
1152
|
+
result = { ...diff };
|
|
1153
|
+
}
|
|
1154
|
+
result[key] = fixed;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
return result;
|
|
993
1158
|
}
|
|
1159
|
+
|
|
994
1160
|
//# sourceMappingURL=createAnimations.native.js.map
|