framer-motion 12.4.13 → 12.6.0

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.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/client.js +1 -1
  3. package/dist/cjs/{create-DkTZDHiS.js → create-CgwP8YNL.js} +4234 -4792
  4. package/dist/cjs/debug.js +5 -281
  5. package/dist/cjs/dom-mini.js +9 -7
  6. package/dist/cjs/dom.js +81 -639
  7. package/dist/cjs/index.js +1555 -1553
  8. package/dist/cjs/m.js +11 -179
  9. package/dist/cjs/mini.js +8 -0
  10. package/dist/debug.d.ts +2 -35
  11. package/dist/dom-mini.d.ts +1 -181
  12. package/dist/dom-mini.js +1 -1
  13. package/dist/dom.d.ts +3 -242
  14. package/dist/dom.js +1 -1
  15. package/dist/es/animation/animate/single-value.mjs +1 -1
  16. package/dist/es/animation/animators/BaseAnimation.mjs +1 -1
  17. package/dist/es/animation/animators/MainThreadAnimation.mjs +1 -2
  18. package/dist/es/animation/animators/drivers/driver-frameloop.mjs +1 -2
  19. package/dist/es/animation/animators/waapi/index.mjs +1 -3
  20. package/dist/es/animation/generators/utils/velocity.mjs +1 -1
  21. package/dist/es/animation/interfaces/motion-value.mjs +2 -4
  22. package/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
  23. package/dist/es/animation/optimized-appear/start.mjs +3 -3
  24. package/dist/es/animation/sequence/utils/edit.mjs +1 -1
  25. package/dist/es/components/AnimatePresence/index.mjs +1 -1
  26. package/dist/es/components/Reorder/utils/check-reorder.mjs +1 -1
  27. package/dist/es/debug.mjs +1 -1
  28. package/dist/es/dom.mjs +1 -5
  29. package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -2
  30. package/dist/es/gestures/hover.mjs +1 -2
  31. package/dist/es/gestures/pan/PanSession.mjs +1 -2
  32. package/dist/es/gestures/pan/index.mjs +1 -1
  33. package/dist/es/gestures/press.mjs +1 -2
  34. package/dist/es/index.mjs +14 -19
  35. package/dist/es/motion/features/layout/MeasureLayout.mjs +1 -2
  36. package/dist/es/motion/utils/use-visual-element.mjs +6 -6
  37. package/dist/es/projection/node/create-projection-node.mjs +2 -8
  38. package/dist/es/projection/shared/stack.mjs +1 -1
  39. package/dist/es/projection.mjs +1 -3
  40. package/dist/es/render/VisualElement.mjs +2 -5
  41. package/dist/es/render/components/create-proxy.mjs +1 -1
  42. package/dist/es/render/dom/DOMVisualElement.mjs +1 -1
  43. package/dist/es/render/dom/scroll/info.mjs +1 -2
  44. package/dist/es/render/dom/scroll/observe.mjs +1 -1
  45. package/dist/es/render/dom/scroll/on-scroll-handler.mjs +1 -1
  46. package/dist/es/render/dom/scroll/track.mjs +1 -1
  47. package/dist/es/render/svg/SVGVisualElement.mjs +1 -1
  48. package/dist/es/render/svg/config-motion.mjs +1 -1
  49. package/dist/es/render/utils/KeyframesResolver.mjs +1 -1
  50. package/dist/es/render/utils/flat-tree.mjs +1 -1
  51. package/dist/es/render/utils/motion-values.mjs +3 -3
  52. package/dist/es/render/utils/setters.mjs +1 -1
  53. package/dist/es/utils/delay.mjs +1 -2
  54. package/dist/es/utils/reduced-motion/use-reduced-motion.mjs +1 -1
  55. package/dist/es/utils/use-animation-frame.mjs +1 -1
  56. package/dist/es/utils/use-force-update.mjs +1 -1
  57. package/dist/es/utils/use-instant-transition.mjs +1 -1
  58. package/dist/es/value/scroll/use-element-scroll.mjs +1 -1
  59. package/dist/es/value/scroll/use-viewport-scroll.mjs +1 -1
  60. package/dist/es/value/use-combine-values.mjs +2 -2
  61. package/dist/es/value/use-computed.mjs +1 -1
  62. package/dist/es/value/use-inverted-scale.mjs +3 -3
  63. package/dist/es/value/use-motion-value.mjs +1 -1
  64. package/dist/es/value/use-scroll.mjs +4 -4
  65. package/dist/es/value/use-spring.mjs +1 -1
  66. package/dist/es/value/use-transform.mjs +1 -1
  67. package/dist/es/value/use-velocity.mjs +1 -1
  68. package/dist/es/value/use-will-change/WillChangeMotionValue.mjs +2 -2
  69. package/dist/framer-motion.dev.js +8227 -8251
  70. package/dist/framer-motion.js +1 -1
  71. package/dist/m.d.ts +49 -241
  72. package/dist/size-rollup-animate.js +1 -1
  73. package/dist/size-rollup-dom-animation-assets.js +1 -1
  74. package/dist/size-rollup-dom-animation.js +1 -1
  75. package/dist/size-rollup-dom-max-assets.js +1 -1
  76. package/dist/size-rollup-dom-max.js +1 -1
  77. package/dist/size-rollup-m.js +1 -1
  78. package/dist/size-rollup-motion.js +1 -1
  79. package/dist/size-rollup-scroll.js +1 -1
  80. package/dist/types/client.d.ts +2 -2
  81. package/dist/types/index.d.ts +43 -79
  82. package/dist/{types.d-6pKw1mTI.d.ts → types.d-B50aGbjN.d.ts} +81 -289
  83. package/package.json +4 -6
  84. package/dist/es/frameloop/batcher.mjs +0 -69
  85. package/dist/es/frameloop/frame.mjs +0 -6
  86. package/dist/es/frameloop/index-legacy.mjs +0 -20
  87. package/dist/es/frameloop/microtask.mjs +0 -5
  88. package/dist/es/frameloop/order.mjs +0 -10
  89. package/dist/es/frameloop/render-step.mjs +0 -92
  90. package/dist/es/frameloop/sync-time.mjs +0 -31
  91. package/dist/es/stats/animation-count.mjs +0 -7
  92. package/dist/es/stats/buffer.mjs +0 -6
  93. package/dist/es/stats/index.mjs +0 -113
  94. package/dist/es/utils/GlobalConfig.mjs +0 -6
  95. package/dist/es/utils/array.mjs +0 -21
  96. package/dist/es/utils/subscription-manager.mjs +0 -40
  97. package/dist/es/utils/velocity-per-second.mjs +0 -11
  98. package/dist/es/utils/warn-once.mjs +0 -11
  99. package/dist/es/value/index.mjs +0 -319
  100. package/dist/three.d.ts +0 -2833
package/dist/cjs/m.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var motionUtils = require('motion-utils');
7
7
  var react = require('react');
8
+ var motionDom = require('motion-dom');
8
9
 
9
10
  const LayoutGroupContext = react.createContext({});
10
11
 
@@ -154,14 +155,6 @@ function useMotionRef(visualState, visualElement, externalRef) {
154
155
  [visualElement]);
155
156
  }
156
157
 
157
- /**
158
- * @public
159
- */
160
- const PresenceContext =
161
- /* @__PURE__ */ react.createContext(null);
162
-
163
- const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
164
-
165
158
  /**
166
159
  * Convert camelCase to dash-case properties.
167
160
  */
@@ -170,178 +163,19 @@ const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCas
170
163
  const optimizedAppearDataId = "framerAppearId";
171
164
  const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
172
165
 
173
- const stepsOrder = [
174
- "read", // Read
175
- "resolveKeyframes", // Write/Read/Write/Read
176
- "update", // Compute
177
- "preRender", // Compute
178
- "render", // Write
179
- "postRender", // Compute
180
- ];
181
-
182
- const statsBuffer = {
183
- value: null,
184
- addProjectionMetrics: null,
185
- };
186
-
187
- function createRenderStep(runNextFrame, stepName) {
188
- /**
189
- * We create and reuse two queues, one to queue jobs for the current frame
190
- * and one for the next. We reuse to avoid triggering GC after x frames.
191
- */
192
- let thisFrame = new Set();
193
- let nextFrame = new Set();
194
- /**
195
- * Track whether we're currently processing jobs in this step. This way
196
- * we can decide whether to schedule new jobs for this frame or next.
197
- */
198
- let isProcessing = false;
199
- let flushNextFrame = false;
200
- /**
201
- * A set of processes which were marked keepAlive when scheduled.
202
- */
203
- const toKeepAlive = new WeakSet();
204
- let latestFrameData = {
205
- delta: 0.0,
206
- timestamp: 0.0,
207
- isProcessing: false,
208
- };
209
- let numCalls = 0;
210
- function triggerCallback(callback) {
211
- if (toKeepAlive.has(callback)) {
212
- step.schedule(callback);
213
- runNextFrame();
214
- }
215
- numCalls++;
216
- callback(latestFrameData);
217
- }
218
- const step = {
219
- /**
220
- * Schedule a process to run on the next frame.
221
- */
222
- schedule: (callback, keepAlive = false, immediate = false) => {
223
- const addToCurrentFrame = immediate && isProcessing;
224
- const queue = addToCurrentFrame ? thisFrame : nextFrame;
225
- if (keepAlive)
226
- toKeepAlive.add(callback);
227
- if (!queue.has(callback))
228
- queue.add(callback);
229
- return callback;
230
- },
231
- /**
232
- * Cancel the provided callback from running on the next frame.
233
- */
234
- cancel: (callback) => {
235
- nextFrame.delete(callback);
236
- toKeepAlive.delete(callback);
237
- },
238
- /**
239
- * Execute all schedule callbacks.
240
- */
241
- process: (frameData) => {
242
- latestFrameData = frameData;
243
- /**
244
- * If we're already processing we've probably been triggered by a flushSync
245
- * inside an existing process. Instead of executing, mark flushNextFrame
246
- * as true and ensure we flush the following frame at the end of this one.
247
- */
248
- if (isProcessing) {
249
- flushNextFrame = true;
250
- return;
251
- }
252
- isProcessing = true;
253
- [thisFrame, nextFrame] = [nextFrame, thisFrame];
254
- // Execute this frame
255
- thisFrame.forEach(triggerCallback);
256
- /**
257
- * If we're recording stats then
258
- */
259
- if (stepName && statsBuffer.value) {
260
- statsBuffer.value.frameloop[stepName].push(numCalls);
261
- }
262
- numCalls = 0;
263
- // Clear the frame so no callbacks remain. This is to avoid
264
- // memory leaks should this render step not run for a while.
265
- thisFrame.clear();
266
- isProcessing = false;
267
- if (flushNextFrame) {
268
- flushNextFrame = false;
269
- step.process(frameData);
270
- }
271
- },
272
- };
273
- return step;
274
- }
275
-
276
- const maxElapsed = 40;
277
- function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
278
- let runNextFrame = false;
279
- let useDefaultElapsed = true;
280
- const state = {
281
- delta: 0.0,
282
- timestamp: 0.0,
283
- isProcessing: false,
284
- };
285
- const flagRunNextFrame = () => (runNextFrame = true);
286
- const steps = stepsOrder.reduce((acc, key) => {
287
- acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);
288
- return acc;
289
- }, {});
290
- const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
291
- const processBatch = () => {
292
- const timestamp = performance.now();
293
- runNextFrame = false;
294
- {
295
- state.delta = useDefaultElapsed
296
- ? 1000 / 60
297
- : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
298
- }
299
- state.timestamp = timestamp;
300
- state.isProcessing = true;
301
- // Unrolled render loop for better per-frame performance
302
- read.process(state);
303
- resolveKeyframes.process(state);
304
- update.process(state);
305
- preRender.process(state);
306
- render.process(state);
307
- postRender.process(state);
308
- state.isProcessing = false;
309
- if (runNextFrame && allowKeepAlive) {
310
- useDefaultElapsed = false;
311
- scheduleNextBatch(processBatch);
312
- }
313
- };
314
- const wake = () => {
315
- runNextFrame = true;
316
- useDefaultElapsed = true;
317
- if (!state.isProcessing) {
318
- scheduleNextBatch(processBatch);
319
- }
320
- };
321
- const schedule = stepsOrder.reduce((acc, key) => {
322
- const step = steps[key];
323
- acc[key] = (process, keepAlive = false, immediate = false) => {
324
- if (!runNextFrame)
325
- wake();
326
- return step.schedule(process, keepAlive, immediate);
327
- };
328
- return acc;
329
- }, {});
330
- const cancel = (process) => {
331
- for (let i = 0; i < stepsOrder.length; i++) {
332
- steps[stepsOrder[i]].cancel(process);
333
- }
334
- };
335
- return { schedule, cancel, state, steps };
336
- }
337
-
338
- const { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false);
166
+ /**
167
+ * @public
168
+ */
169
+ const PresenceContext =
170
+ /* @__PURE__ */ react.createContext(null);
339
171
 
340
172
  /**
341
173
  * Internal, exported only for usage in Framer
342
174
  */
343
175
  const SwitchLayoutGroupContext = react.createContext({});
344
176
 
177
+ const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
178
+
345
179
  function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
346
180
  var _a, _b;
347
181
  const { visualElement: parent } = react.useContext(MotionContext);
@@ -401,7 +235,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
401
235
  isMounted.current = true;
402
236
  window.MotionIsMounted = true;
403
237
  visualElement.updateFeatures();
404
- microtask.render(visualElement.render);
238
+ motionDom.microtask.render(visualElement.render);
405
239
  /**
406
240
  * Ideally this function would always run in a useEffect.
407
241
  *
@@ -1367,8 +1201,6 @@ const htmlMotionConfig = {
1367
1201
  }),
1368
1202
  };
1369
1203
 
1370
- const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : motionUtils.noop, true);
1371
-
1372
1204
  function updateSVGDimensions(instance, renderState) {
1373
1205
  try {
1374
1206
  renderState.dimensions =
@@ -1480,9 +1312,9 @@ const svgMotionConfig = {
1480
1312
  }
1481
1313
  if (!needsMeasure)
1482
1314
  return;
1483
- frame.read(() => {
1315
+ motionDom.frame.read(() => {
1484
1316
  updateSVGDimensions(current, renderState);
1485
- frame.render(() => {
1317
+ motionDom.frame.render(() => {
1486
1318
  buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
1487
1319
  renderSVG(current, renderState);
1488
1320
  });
package/dist/cjs/mini.js CHANGED
@@ -35,6 +35,9 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
35
35
  */
36
36
  if (Array.isArray(easing))
37
37
  keyframeOptions.easing = easing;
38
+ if (motionDom.statsBuffer.value) {
39
+ motionDom.activeAnimations.waapi++;
40
+ }
38
41
  const animation = element.animate(keyframeOptions, {
39
42
  delay,
40
43
  duration,
@@ -43,6 +46,11 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
43
46
  iterations: repeat + 1,
44
47
  direction: repeatType === "reverse" ? "alternate" : "normal",
45
48
  });
49
+ if (motionDom.statsBuffer.value) {
50
+ animation.finished.finally(() => {
51
+ motionDom.activeAnimations.waapi--;
52
+ });
53
+ }
46
54
  return animation;
47
55
  }
48
56
 
package/dist/debug.d.ts CHANGED
@@ -1,35 +1,2 @@
1
- type StepId = "read" | "resolveKeyframes" | "update" | "preRender" | "render" | "postRender";
2
-
3
- declare const stepsOrder: StepId[];
4
- type StepNames = (typeof stepsOrder)[number];
5
-
6
- interface Summary {
7
- min: number;
8
- max: number;
9
- avg: number;
10
- }
11
- type FrameloopStatNames = "rate" | StepNames;
12
- interface Stats<T> {
13
- frameloop: {
14
- [key in FrameloopStatNames]: T;
15
- };
16
- animations: {
17
- mainThread: T;
18
- waapi: T;
19
- layout: T;
20
- };
21
- layoutProjection: {
22
- nodes: T;
23
- calculatedTargetDeltas: T;
24
- calculatedProjections: T;
25
- };
26
- }
27
- type StatsBuffer = number[];
28
- type FrameStats = Stats<number>;
29
- type StatsRecording = Stats<StatsBuffer>;
30
- type StatsSummary = Stats<Summary>;
31
-
32
- declare function reportStats(): StatsSummary;
33
- declare function recordStats(): typeof reportStats;
34
-
35
- export { type FrameStats, type Stats, type StatsBuffer, type StatsRecording, type StatsSummary, type Summary, recordStats };
1
+ export * from 'motion-dom';
2
+ export { recordStats } from 'motion-dom';
@@ -1,184 +1,4 @@
1
- import { AnimationPlaybackControls, TransformProperties, AnimationPlaybackOptions, Transition, UnresolvedValueKeyframe, ElementOrSelector, DOMKeyframesDefinition, AnimationOptions, GroupPlaybackControls } from 'motion-dom';
2
-
3
- /**
4
- * @public
5
- */
6
- type Subscriber<T> = (v: T) => void;
7
- interface MotionValueEventCallbacks<V> {
8
- animationStart: () => void;
9
- animationComplete: () => void;
10
- animationCancel: () => void;
11
- change: (latestValue: V) => void;
12
- renderRequest: () => void;
13
- }
14
- interface ResolvedValues {
15
- [key: string]: string | number;
16
- }
17
- interface Owner {
18
- current: HTMLElement | unknown;
19
- getProps: () => {
20
- onUpdate?: (latest: ResolvedValues) => void;
21
- transformTemplate?: (transform: TransformProperties, generatedTransform: string) => string;
22
- };
23
- }
24
- /**
25
- * `MotionValue` is used to track the state and velocity of motion values.
26
- *
27
- * @public
28
- */
29
- declare class MotionValue<V = any> {
30
- /**
31
- * This will be replaced by the build step with the latest version number.
32
- * When MotionValues are provided to motion components, warn if versions are mixed.
33
- */
34
- version: string;
35
- /**
36
- * If a MotionValue has an owner, it was created internally within Motion
37
- * and therefore has no external listeners. It is therefore safe to animate via WAAPI.
38
- */
39
- owner?: Owner;
40
- /**
41
- * The current state of the `MotionValue`.
42
- */
43
- private current;
44
- /**
45
- * The previous state of the `MotionValue`.
46
- */
47
- private prev;
48
- /**
49
- * The previous state of the `MotionValue` at the end of the previous frame.
50
- */
51
- private prevFrameValue;
52
- /**
53
- * The last time the `MotionValue` was updated.
54
- */
55
- updatedAt: number;
56
- /**
57
- * The time `prevFrameValue` was updated.
58
- */
59
- prevUpdatedAt: number | undefined;
60
- private stopPassiveEffect?;
61
- /**
62
- * A reference to the currently-controlling animation.
63
- */
64
- animation?: AnimationPlaybackControls;
65
- setCurrent(current: V): void;
66
- setPrevFrameValue(prevFrameValue?: V | undefined): void;
67
- /**
68
- * Adds a function that will be notified when the `MotionValue` is updated.
69
- *
70
- * It returns a function that, when called, will cancel the subscription.
71
- *
72
- * When calling `onChange` inside a React component, it should be wrapped with the
73
- * `useEffect` hook. As it returns an unsubscribe function, this should be returned
74
- * from the `useEffect` function to ensure you don't add duplicate subscribers..
75
- *
76
- * ```jsx
77
- * export const MyComponent = () => {
78
- * const x = useMotionValue(0)
79
- * const y = useMotionValue(0)
80
- * const opacity = useMotionValue(1)
81
- *
82
- * useEffect(() => {
83
- * function updateOpacity() {
84
- * const maxXY = Math.max(x.get(), y.get())
85
- * const newOpacity = transform(maxXY, [0, 100], [1, 0])
86
- * opacity.set(newOpacity)
87
- * }
88
- *
89
- * const unsubscribeX = x.on("change", updateOpacity)
90
- * const unsubscribeY = y.on("change", updateOpacity)
91
- *
92
- * return () => {
93
- * unsubscribeX()
94
- * unsubscribeY()
95
- * }
96
- * }, [])
97
- *
98
- * return <motion.div style={{ x }} />
99
- * }
100
- * ```
101
- *
102
- * @param subscriber - A function that receives the latest value.
103
- * @returns A function that, when called, will cancel this subscription.
104
- *
105
- * @deprecated
106
- */
107
- onChange(subscription: Subscriber<V>): () => void;
108
- /**
109
- * An object containing a SubscriptionManager for each active event.
110
- */
111
- private events;
112
- on<EventName extends keyof MotionValueEventCallbacks<V>>(eventName: EventName, callback: MotionValueEventCallbacks<V>[EventName]): VoidFunction;
113
- clearListeners(): void;
114
- /**
115
- * Sets the state of the `MotionValue`.
116
- *
117
- * @remarks
118
- *
119
- * ```jsx
120
- * const x = useMotionValue(0)
121
- * x.set(10)
122
- * ```
123
- *
124
- * @param latest - Latest value to set.
125
- * @param render - Whether to notify render subscribers. Defaults to `true`
126
- *
127
- * @public
128
- */
129
- set(v: V, render?: boolean): void;
130
- setWithVelocity(prev: V, current: V, delta: number): void;
131
- /**
132
- * Set the state of the `MotionValue`, stopping any active animations,
133
- * effects, and resets velocity to `0`.
134
- */
135
- jump(v: V, endAnimation?: boolean): void;
136
- updateAndNotify: (v: V, render?: boolean) => void;
137
- /**
138
- * Returns the latest state of `MotionValue`
139
- *
140
- * @returns - The latest state of `MotionValue`
141
- *
142
- * @public
143
- */
144
- get(): NonNullable<V>;
145
- /**
146
- * @public
147
- */
148
- getPrevious(): V | undefined;
149
- /**
150
- * Returns the latest velocity of `MotionValue`
151
- *
152
- * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
153
- *
154
- * @public
155
- */
156
- getVelocity(): number;
157
- hasAnimated: boolean;
158
- /**
159
- * Stop the currently active animation.
160
- *
161
- * @public
162
- */
163
- stop(): void;
164
- /**
165
- * Returns `true` if this value is currently animating.
166
- *
167
- * @public
168
- */
169
- isAnimating(): boolean;
170
- private clearAnimation;
171
- /**
172
- * Destroy and clean up subscribers to this `MotionValue`.
173
- *
174
- * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
175
- * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
176
- * created a `MotionValue` via the `motionValue` function.
177
- *
178
- * @public
179
- */
180
- destroy(): void;
181
- }
1
+ import { AnimationPlaybackOptions, Transition, MotionValue, UnresolvedValueKeyframe, ElementOrSelector, DOMKeyframesDefinition, AnimationOptions, GroupPlaybackControls, AnimationPlaybackControls } from 'motion-dom';
182
2
 
183
3
  type GenericKeyframesTarget<V> = V[] | Array<null | V>;
184
4
 
package/dist/dom-mini.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,(function(t){"use strict";const e=t=>t;let n=e;function i(t){let e;return()=>(void 0===e&&(e=t()),e)}const a=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i},o=t=>1e3*t,s=t=>t/1e3,r=i(()=>void 0!==window.ScrollTimeline);class l extends class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map(n=>r()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0);return()=>{n.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach(e=>e[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}function u(t,e=100,n){const i=n({...t,keyframes:[0,e]}),a=Math.min(function(t){let e=0,n=t.next(e);for(;!n.done&&e<2e4;)e+=50,n=t.next(e);return e>=2e4?1/0:e}(i),2e4);return{type:"keyframes",ease:t=>i.next(a*t).value/e,duration:s(a)}}function c(t){return"function"==typeof t}const h={linearEasing:void 0};function f(t,e){const n=i(t);return()=>{var t;return null!==(t=h[e])&&void 0!==t?t:n()}}const m=f(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),d=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,p={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:d([0,.65,.55,1]),circOut:d([.55,0,1,.45]),backIn:d([.31,.01,.66,-.59]),backOut:d([.33,1.53,.69,.99])};function y(t,e){return t?"function"==typeof t&&m()?((t,e,n=10)=>{let i="";const o=Math.max(Math.round(e/n),2);for(let e=0;e<o;e++)i+=t(a(0,o-1,e))+", ";return`linear(${i.substring(0,i.length-2)})`})(t,e):(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?d(t):Array.isArray(t)?t.map(t=>y(t,e)||p.easeOut):p[t]:void 0}function g(t,e,n){var i;if(t instanceof EventTarget)return[t];if("string"==typeof t){let a=document;e&&(a=e.current);const o=null!==(i=null==n?void 0:n[t])&&void 0!==i?i:a.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}function v(t,e){return n=t,Array.isArray(n)&&"number"!=typeof n[0]?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t;var n}const A=(t,e,n)=>t+(e-t)*n;function b(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const o=a(0,e,i);t.push(A(n,1,o))}}function T(t){const e=[0];return b(e,t.length-1),e}function w(t,e,n,i){return"string"==typeof t&&function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?g(t,n,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function x(t,e,n){return t*(e+1)}function P(t,e,n,i){var a;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(a=i.get(e))&&void 0!==a?a:t}function k(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function M(t,e,n,i,a,o){!function(t,e,n){for(let i=0;i<t.length;i++){const a=t[i];a.at>e&&a.at<n&&(k(t,a),i--)}}(t,a,o);for(let s=0;s<e.length;s++)t.push({value:e[s],at:A(a,o,i[s]),easing:v(n,s)})}function O(t,e){for(let n=0;n<t.length;n++)t[n]=t[n]/(e+1)}function R(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function W(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function F(t,e){return e[t]||(e[t]=[]),e[t]}function E(t){return Array.isArray(t)?t:[t]}function B(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const S=t=>"number"==typeof t,$=t=>t.every(S);const I=(t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}))("px"),L={borderWidth:I,borderTopWidth:I,borderRightWidth:I,borderBottomWidth:I,borderLeftWidth:I,borderRadius:I,radius:I,borderTopLeftRadius:I,borderTopRightRadius:I,borderBottomRightRadius:I,borderBottomLeftRadius:I,width:I,maxWidth:I,height:I,maxHeight:I,top:I,right:I,bottom:I,left:I,padding:I,paddingTop:I,paddingRight:I,paddingBottom:I,paddingLeft:I,margin:I,marginTop:I,marginRight:I,marginBottom:I,marginLeft:I,backgroundPositionX:I,backgroundPositionY:I},V=t=>null!==t;function j(t,e,n){t.style.setProperty(e,n)}function q(t,e,n){t.style[e]=n}const C=i(()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0}),N=i(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),z=new WeakMap;function D(t){const e=z.get(t)||new Map;return z.set(t,e),z.get(t)}class H extends class{constructor(t){this.animation=t}get duration(){var t,e,n;const i=(null===(e=null===(t=this.animation)||void 0===t?void 0:t.effect)||void 0===e?void 0:e.getComputedTiming().duration)||(null===(n=this.options)||void 0===n?void 0:n.duration)||300;return s(Number(i))}get time(){var t;return this.animation?s((null===(t=this.animation)||void 0===t?void 0:t.currentTime)||0):0}set time(t){this.animation&&(this.animation.currentTime=o(t))}get speed(){return this.animation?this.animation.playbackRate:1}set speed(t){this.animation&&(this.animation.playbackRate=t)}get state(){return this.animation?this.animation.playState:"finished"}get startTime(){return this.animation?this.animation.startTime:null}get finished(){return this.animation?this.animation.finished:Promise.resolve()}play(){this.animation&&this.animation.play()}pause(){this.animation&&this.animation.pause()}stop(){this.animation&&"idle"!==this.state&&"finished"!==this.state&&(this.animation.commitStyles&&this.animation.commitStyles(),this.cancel())}flatten(){var t,e;this.animation&&(null===(t=this.options)||void 0===t?void 0:t.allowFlatten)&&(null===(e=this.animation.effect)||void 0===e||e.updateTiming({easing:"linear"}))}attachTimeline(t){return this.animation&&function(t,e){t.timeline=e,t.onfinish=null}(this.animation,t),e}complete(){this.animation&&this.animation.finish()}cancel(){try{this.animation&&this.animation.cancel()}catch(t){}}}{constructor(t,e,i,a){const s=e.startsWith("--");n("string"!=typeof a.type);const r=D(t).get(e);r&&r.stop();if(Array.isArray(i)||(i=[i]),function(t,e,n){for(let i=0;i<e.length;i++)null===e[i]&&(e[i]=0===i?n():e[i-1]),"number"==typeof e[i]&&L[t]&&(e[i]=L[t].transform(e[i]));!C()&&e.length<2&&e.unshift(n())}(e,i,()=>e.startsWith("--")?t.style.getPropertyValue(e):window.getComputedStyle(t)[e]),c(a.type)){const t=u(a,100,a.type);a.ease=m()?t.ease:"easeOut",a.duration=o(t.duration),a.type="keyframes"}else a.ease=a.ease||"easeOut";const l=()=>{this.setValue(t,e,function(t,{repeat:e,repeatType:n="loop"},i){const a=t.filter(V),o=e&&"loop"!==n&&e%2==1?0:a.length-1;return o&&void 0!==i?i:a[o]}(i,a)),this.cancel(),this.resolveFinishedPromise()},h=()=>{this.setValue=s?j:q,this.options=a,this.updateFinishedPromise(),this.removeAnimation=()=>{const n=z.get(t);n&&n.delete(e)}};N()?(super(function(t,e,n,{delay:i=0,duration:a=300,repeat:o=0,repeatType:s="loop",ease:r="easeInOut",times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=y(r,a);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:i,duration:a,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}(t,e,i,a)),h(),!1===a.autoplay&&this.animation.pause(),this.animation.onfinish=l,D(t).set(e,this)):(super(),h(),l())}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}play(){"finished"===this.state&&this.updateFinishedPromise(),super.play()}cancel(){this.removeAnimation(),super.cancel()}}function X(t,e,n,i){const a=g(t,i),s=a.length,r=[];for(let t=0;t<s;t++){const i=a[t],c={...n};"function"==typeof c.delay&&(c.delay=c.delay(t,s));for(const t in e){const n=e[t],a={...(l=c,u=t,l?l[u]||l.default||l:void 0)};a.duration=a.duration?o(a.duration):a.duration,a.delay=o(a.delay||0),a.allowFlatten=!c.type&&!c.ease,r.push(new H(i,t,n,a))}}var l,u;return r}const Y=(t=>function(e,n,i){return new l(X(e,n,i,t))})();t.animate=Y,t.animateSequence=function(t,e){const n=[];return function(t,{defaultTransition:e={},...n}={},i,s){const r=e.duration||.3,l=new Map,h=new Map,f={},m=new Map;let d=0,p=0,y=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){m.set(a,p);continue}if(!Array.isArray(a)){m.set(a.name,P(p,a.at,d,m));continue}let[l,A,k={}]=a;void 0!==k.at&&(p=P(p,k.at,d,m));let R=0;const S=(t,n,i,a=0,l=0)=>{const h=E(t),{delay:f=0,times:m=T(h),type:d="keyframes",repeat:g,repeatType:A,repeatDelay:w=0,...P}=n;let{ease:k=e.ease||"easeOut",duration:W}=n;const F="function"==typeof f?f(a,l):f,B=h.length,S=c(d)?d:null==s?void 0:s[d];if(B<=2&&S){let t=100;if(2===B&&$(h)){const e=h[1]-h[0];t=Math.abs(e)}const e={...P};void 0!==W&&(e.duration=o(W));const n=u(e,t,S);k=n.ease,W=n.duration}null!=W||(W=r);const I=p+F;1===m.length&&0===m[0]&&(m[1]=1);const L=m.length-h.length;if(L>0&&b(m,L),1===h.length&&h.unshift(null),g){W=x(W,g);const t=[...h],e=[...m];k=Array.isArray(k)?[...k]:[k];const n=[...k];for(let i=0;i<g;i++){h.push(...t);for(let a=0;a<t.length;a++)m.push(e[a]+(i+1)),k.push(0===a?"linear":v(n,a-1))}O(m,g)}const V=I+W;M(i,h,k,m,I,V),R=Math.max(F+W,R),y=Math.max(V,y)};if(g=l,Boolean(g&&g.getVelocity)){S(A,k,F("default",W(l,h)))}else{const t=w(l,A,i,f),e=t.length;for(let n=0;n<e;n++){A=A,k=k;const i=W(t[n],h);for(const t in A)S(A[t],B(k,t),F(t,i),n,e)}}d=p,p+=R}var g;return h.forEach((t,i)=>{for(const o in t){const s=t[o];s.sort(R);const r=[],u=[],c=[];for(let t=0;t<s.length;t++){const{at:e,value:n,easing:i}=s[t];r.push(n),u.push(a(0,y,e)),c.push(i||"easeOut")}0!==u[0]&&(u.unshift(0),r.unshift(r[0]),c.unshift("easeInOut")),1!==u[u.length-1]&&(u.push(1),r.push(null)),l.has(i)||l.set(i,{keyframes:{},transition:{}});const h=l.get(i);h.keyframes[o]=r,h.transition[o]={...e,duration:y,ease:c,times:u,...n}}}),l}(t,e).forEach(({keyframes:t,transition:e},i)=>{n.push(...X(i,t,e))}),new l(n)}}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,(function(t){"use strict";function e(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const n=t=>t;let i=n;function a(t){let e;return()=>(void 0===e&&(e=t()),e)}const o=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i},s=t=>1e3*t,r=t=>t/1e3,l=a(()=>void 0!==window.ScrollTimeline);class u extends class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map(n=>l()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0);return()=>{n.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach(e=>e[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}function c(t,e=100,n){const i=n({...t,keyframes:[0,e]}),a=Math.min(function(t){let e=0,n=t.next(e);for(;!n.done&&e<2e4;)e+=50,n=t.next(e);return e>=2e4?1/0:e}(i),2e4);return{type:"keyframes",ease:t=>i.next(a*t).value/e,duration:r(a)}}function h(t){return"function"==typeof t}const f={linearEasing:void 0};function m(t,e){const n=a(t);return()=>{var t;return null!==(t=f[e])&&void 0!==t?t:n()}}const d=m(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),p=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,y={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:p([0,.65,.55,1]),circOut:p([.55,0,1,.45]),backIn:p([.31,.01,.66,-.59]),backOut:p([.33,1.53,.69,.99])};function g(t,e){return t?"function"==typeof t&&d()?((t,e,n=10)=>{let i="";const a=Math.max(Math.round(e/n),2);for(let e=0;e<a;e++)i+=t(o(0,a-1,e))+", ";return`linear(${i.substring(0,i.length-2)})`})(t,e):(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?p(t):Array.isArray(t)?t.map(t=>g(t,e)||y.easeOut):y[t]:void 0}function v(t,e,n){var i;if(t instanceof EventTarget)return[t];if("string"==typeof t){let a=document;e&&(a=e.current);const o=null!==(i=null==n?void 0:n[t])&&void 0!==i?i:a.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}function A(t,e){return n=t,Array.isArray(n)&&"number"!=typeof n[0]?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t;var n}const b=(t,e,n)=>t+(e-t)*n;function T(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=o(0,e,i);t.push(b(n,1,a))}}function w(t){const e=[0];return T(e,t.length-1),e}function x(t,e,n,i){return"string"==typeof t&&function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?v(t,n,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function P(t,e,n){return t*(e+1)}function k(t,e,n,i){var a;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(a=i.get(e))&&void 0!==a?a:t}function M(t,n,i,a,o,s){!function(t,n,i){for(let a=0;a<t.length;a++){const o=t[a];o.at>n&&o.at<i&&(e(t,o),a--)}}(t,o,s);for(let e=0;e<n.length;e++)t.push({value:n[e],at:b(o,s,a[e]),easing:A(i,e)})}function O(t,e){for(let n=0;n<t.length;n++)t[n]=t[n]/(e+1)}function R(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function W(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function F(t,e){return e[t]||(e[t]=[]),e[t]}function E(t){return Array.isArray(t)?t:[t]}function B(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const S=t=>"number"==typeof t,$=t=>t.every(S);const I=(t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}))("px"),L={borderWidth:I,borderTopWidth:I,borderRightWidth:I,borderBottomWidth:I,borderLeftWidth:I,borderRadius:I,radius:I,borderTopLeftRadius:I,borderTopRightRadius:I,borderBottomRightRadius:I,borderBottomLeftRadius:I,width:I,maxWidth:I,height:I,maxHeight:I,top:I,right:I,bottom:I,left:I,padding:I,paddingTop:I,paddingRight:I,paddingBottom:I,paddingLeft:I,margin:I,marginTop:I,marginRight:I,marginBottom:I,marginLeft:I,backgroundPositionX:I,backgroundPositionY:I},V=t=>null!==t;function j(t,e,n){t.style.setProperty(e,n)}function q(t,e,n){t.style[e]=n}const C=a(()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0}),N=a(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),z=new WeakMap;function D(t){const e=z.get(t)||new Map;return z.set(t,e),z.get(t)}class H extends class{constructor(t){this.animation=t}get duration(){var t,e,n;const i=(null===(e=null===(t=this.animation)||void 0===t?void 0:t.effect)||void 0===e?void 0:e.getComputedTiming().duration)||(null===(n=this.options)||void 0===n?void 0:n.duration)||300;return r(Number(i))}get time(){var t;return this.animation?r((null===(t=this.animation)||void 0===t?void 0:t.currentTime)||0):0}set time(t){this.animation&&(this.animation.currentTime=s(t))}get speed(){return this.animation?this.animation.playbackRate:1}set speed(t){this.animation&&(this.animation.playbackRate=t)}get state(){return this.animation?this.animation.playState:"finished"}get startTime(){return this.animation?this.animation.startTime:null}get finished(){return this.animation?this.animation.finished:Promise.resolve()}play(){this.animation&&this.animation.play()}pause(){this.animation&&this.animation.pause()}stop(){this.animation&&"idle"!==this.state&&"finished"!==this.state&&(this.animation.commitStyles&&this.animation.commitStyles(),this.cancel())}flatten(){var t,e;this.animation&&(null===(t=this.options)||void 0===t?void 0:t.allowFlatten)&&(null===(e=this.animation.effect)||void 0===e||e.updateTiming({easing:"linear"}))}attachTimeline(t){return this.animation&&function(t,e){t.timeline=e,t.onfinish=null}(this.animation,t),n}complete(){this.animation&&this.animation.finish()}cancel(){try{this.animation&&this.animation.cancel()}catch(t){}}}{constructor(t,e,n,a){const o=e.startsWith("--");i("string"!=typeof a.type);const r=D(t).get(e);r&&r.stop();if(Array.isArray(n)||(n=[n]),function(t,e,n){for(let i=0;i<e.length;i++)null===e[i]&&(e[i]=0===i?n():e[i-1]),"number"==typeof e[i]&&L[t]&&(e[i]=L[t].transform(e[i]));!C()&&e.length<2&&e.unshift(n())}(e,n,()=>e.startsWith("--")?t.style.getPropertyValue(e):window.getComputedStyle(t)[e]),h(a.type)){const t=c(a,100,a.type);a.ease=d()?t.ease:"easeOut",a.duration=s(t.duration),a.type="keyframes"}else a.ease=a.ease||"easeOut";const l=()=>{this.setValue(t,e,function(t,{repeat:e,repeatType:n="loop"},i){const a=t.filter(V),o=e&&"loop"!==n&&e%2==1?0:a.length-1;return o&&void 0!==i?i:a[o]}(n,a)),this.cancel(),this.resolveFinishedPromise()},u=()=>{this.setValue=o?j:q,this.options=a,this.updateFinishedPromise(),this.removeAnimation=()=>{const n=z.get(t);n&&n.delete(e)}};N()?(super(function(t,e,n,{delay:i=0,duration:a=300,repeat:o=0,repeatType:s="loop",ease:r="easeInOut",times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=g(r,a);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:i,duration:a,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"})}(t,e,n,a)),u(),!1===a.autoplay&&this.animation.pause(),this.animation.onfinish=l,D(t).set(e,this)):(super(),u(),l())}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}play(){"finished"===this.state&&this.updateFinishedPromise(),super.play()}cancel(){this.removeAnimation(),super.cancel()}}function X(t,e,n,i){const a=v(t,i),o=a.length,r=[];for(let t=0;t<o;t++){const i=a[t],c={...n};"function"==typeof c.delay&&(c.delay=c.delay(t,o));for(const t in e){const n=e[t],a={...(l=c,u=t,l?l[u]||l.default||l:void 0)};a.duration=a.duration?s(a.duration):a.duration,a.delay=s(a.delay||0),a.allowFlatten=!c.type&&!c.ease,r.push(new H(i,t,n,a))}}var l,u;return r}const Y=(t=>function(e,n,i){return new u(X(e,n,i,t))})();t.animate=Y,t.animateSequence=function(t,e){const n=[];return function(t,{defaultTransition:e={},...n}={},i,a){const r=e.duration||.3,l=new Map,u=new Map,f={},m=new Map;let d=0,p=0,y=0;for(let n=0;n<t.length;n++){const o=t[n];if("string"==typeof o){m.set(o,p);continue}if(!Array.isArray(o)){m.set(o.name,k(p,o.at,d,m));continue}let[l,v,b={}]=o;void 0!==b.at&&(p=k(p,b.at,d,m));let R=0;const S=(t,n,i,o=0,l=0)=>{const u=E(t),{delay:f=0,times:m=w(u),type:d="keyframes",repeat:g,repeatType:v,repeatDelay:b=0,...x}=n;let{ease:k=e.ease||"easeOut",duration:W}=n;const F="function"==typeof f?f(o,l):f,B=u.length,S=h(d)?d:null==a?void 0:a[d];if(B<=2&&S){let t=100;if(2===B&&$(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...x};void 0!==W&&(e.duration=s(W));const n=c(e,t,S);k=n.ease,W=n.duration}null!=W||(W=r);const I=p+F;1===m.length&&0===m[0]&&(m[1]=1);const L=m.length-u.length;if(L>0&&T(m,L),1===u.length&&u.unshift(null),g){W=P(W,g);const t=[...u],e=[...m];k=Array.isArray(k)?[...k]:[k];const n=[...k];for(let i=0;i<g;i++){u.push(...t);for(let a=0;a<t.length;a++)m.push(e[a]+(i+1)),k.push(0===a?"linear":A(n,a-1))}O(m,g)}const V=I+W;M(i,u,k,m,I,V),R=Math.max(F+W,R),y=Math.max(V,y)};if(g=l,Boolean(g&&g.getVelocity)){S(v,b,F("default",W(l,u)))}else{const t=x(l,v,i,f),e=t.length;for(let n=0;n<e;n++){v=v,b=b;const i=W(t[n],u);for(const t in v)S(v[t],B(b,t),F(t,i),n,e)}}d=p,p+=R}var g;return u.forEach((t,i)=>{for(const a in t){const s=t[a];s.sort(R);const r=[],u=[],c=[];for(let t=0;t<s.length;t++){const{at:e,value:n,easing:i}=s[t];r.push(n),u.push(o(0,y,e)),c.push(i||"easeOut")}0!==u[0]&&(u.unshift(0),r.unshift(r[0]),c.unshift("easeInOut")),1!==u[u.length-1]&&(u.push(1),r.push(null)),l.has(i)||l.set(i,{keyframes:{},transition:{}});const h=l.get(i);h.keyframes[a]=r,h.transition[a]={...e,duration:y,ease:c,times:u,...n}}}),l}(t,e).forEach(({keyframes:t,transition:e},i)=>{n.push(...X(i,t,e))}),new u(n)}}));