motion-dom 11.14.3 → 11.16.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.
Files changed (29) hide show
  1. package/dist/cjs/index.js +665 -31
  2. package/dist/es/animation/controls/BaseGroup.mjs +82 -0
  3. package/dist/es/animation/controls/Group.mjs +13 -0
  4. package/dist/es/animation/generators/utils/calc-duration.mjs +17 -0
  5. package/dist/es/animation/generators/utils/create-generator-easing.mjs +19 -0
  6. package/dist/es/animation/generators/utils/is-generator.mjs +5 -0
  7. package/dist/es/animation/utils/get-value-transition.mjs +9 -0
  8. package/dist/es/animation/waapi/NativeAnimationControls.mjs +83 -0
  9. package/dist/es/animation/waapi/PseudoAnimation.mjs +15 -0
  10. package/dist/es/animation/waapi/utils/attach-timeline.mjs +6 -0
  11. package/dist/es/animation/waapi/utils/convert-options.mjs +55 -0
  12. package/dist/es/animation/waapi/utils/easing.mjs +44 -0
  13. package/dist/es/animation/waapi/utils/linear.mjs +14 -0
  14. package/dist/es/gestures/press/index.mjs +4 -3
  15. package/dist/es/index.mjs +15 -1
  16. package/dist/es/utils/is-bezier-definition.mjs +3 -0
  17. package/dist/es/utils/supports/flags.mjs +9 -0
  18. package/dist/es/utils/supports/linear-easing.mjs +15 -0
  19. package/dist/es/utils/supports/memo.mjs +9 -0
  20. package/dist/es/utils/supports/scroll-timeline.mjs +5 -0
  21. package/dist/es/view/index.mjs +65 -0
  22. package/dist/es/view/start.mjs +146 -0
  23. package/dist/es/view/utils/choose-layer-type.mjs +11 -0
  24. package/dist/es/view/utils/css.mjs +32 -0
  25. package/dist/es/view/utils/get-layer-name.mjs +8 -0
  26. package/dist/es/view/utils/get-view-animations.mjs +13 -0
  27. package/dist/es/view/utils/has-target.mjs +5 -0
  28. package/dist/index.d.ts +648 -3
  29. package/package.json +5 -2
package/dist/index.d.ts CHANGED
@@ -1,3 +1,585 @@
1
+ interface SVGAttributes {
2
+ accentHeight?: number | string | undefined;
3
+ accumulate?: "none" | "sum" | undefined;
4
+ additive?: "replace" | "sum" | undefined;
5
+ alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
6
+ allowReorder?: "no" | "yes" | undefined;
7
+ alphabetic?: number | string | undefined;
8
+ amplitude?: number | string | undefined;
9
+ arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
10
+ ascent?: number | string | undefined;
11
+ attributeName?: string | undefined;
12
+ attributeType?: string | undefined;
13
+ autoReverse?: boolean | undefined;
14
+ azimuth?: number | string | undefined;
15
+ baseFrequency?: number | string | undefined;
16
+ baselineShift?: number | string | undefined;
17
+ baseProfile?: number | string | undefined;
18
+ bbox?: number | string | undefined;
19
+ begin?: number | string | undefined;
20
+ bias?: number | string | undefined;
21
+ by?: number | string | undefined;
22
+ calcMode?: number | string | undefined;
23
+ capHeight?: number | string | undefined;
24
+ clip?: number | string | undefined;
25
+ clipPath?: string | undefined;
26
+ clipPathUnits?: number | string | undefined;
27
+ clipRule?: number | string | undefined;
28
+ colorInterpolation?: number | string | undefined;
29
+ colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
30
+ colorProfile?: number | string | undefined;
31
+ colorRendering?: number | string | undefined;
32
+ contentScriptType?: number | string | undefined;
33
+ contentStyleType?: number | string | undefined;
34
+ cursor?: number | string | undefined;
35
+ cx?: number | string | undefined;
36
+ cy?: number | string | undefined;
37
+ d?: string | undefined;
38
+ decelerate?: number | string | undefined;
39
+ descent?: number | string | undefined;
40
+ diffuseConstant?: number | string | undefined;
41
+ direction?: number | string | undefined;
42
+ display?: number | string | undefined;
43
+ divisor?: number | string | undefined;
44
+ dominantBaseline?: number | string | undefined;
45
+ dur?: number | string | undefined;
46
+ dx?: number | string | undefined;
47
+ dy?: number | string | undefined;
48
+ edgeMode?: number | string | undefined;
49
+ elevation?: number | string | undefined;
50
+ enableBackground?: number | string | undefined;
51
+ end?: number | string | undefined;
52
+ exponent?: number | string | undefined;
53
+ externalResourcesRequired?: boolean | undefined;
54
+ fill?: string | undefined;
55
+ fillOpacity?: number | string | undefined;
56
+ fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
57
+ filter?: string | undefined;
58
+ filterRes?: number | string | undefined;
59
+ filterUnits?: number | string | undefined;
60
+ floodColor?: number | string | undefined;
61
+ floodOpacity?: number | string | undefined;
62
+ focusable?: boolean | "auto" | undefined;
63
+ fontFamily?: string | undefined;
64
+ fontSize?: number | string | undefined;
65
+ fontSizeAdjust?: number | string | undefined;
66
+ fontStretch?: number | string | undefined;
67
+ fontStyle?: number | string | undefined;
68
+ fontVariant?: number | string | undefined;
69
+ fontWeight?: number | string | undefined;
70
+ format?: number | string | undefined;
71
+ fr?: number | string | undefined;
72
+ from?: number | string | undefined;
73
+ fx?: number | string | undefined;
74
+ fy?: number | string | undefined;
75
+ g1?: number | string | undefined;
76
+ g2?: number | string | undefined;
77
+ glyphName?: number | string | undefined;
78
+ glyphOrientationHorizontal?: number | string | undefined;
79
+ glyphOrientationVertical?: number | string | undefined;
80
+ glyphRef?: number | string | undefined;
81
+ gradientTransform?: string | undefined;
82
+ gradientUnits?: string | undefined;
83
+ hanging?: number | string | undefined;
84
+ horizAdvX?: number | string | undefined;
85
+ horizOriginX?: number | string | undefined;
86
+ href?: string | undefined;
87
+ ideographic?: number | string | undefined;
88
+ imageRendering?: number | string | undefined;
89
+ in2?: number | string | undefined;
90
+ in?: string | undefined;
91
+ intercept?: number | string | undefined;
92
+ k1?: number | string | undefined;
93
+ k2?: number | string | undefined;
94
+ k3?: number | string | undefined;
95
+ k4?: number | string | undefined;
96
+ k?: number | string | undefined;
97
+ kernelMatrix?: number | string | undefined;
98
+ kernelUnitLength?: number | string | undefined;
99
+ kerning?: number | string | undefined;
100
+ keyPoints?: number | string | undefined;
101
+ keySplines?: number | string | undefined;
102
+ keyTimes?: number | string | undefined;
103
+ lengthAdjust?: number | string | undefined;
104
+ letterSpacing?: number | string | undefined;
105
+ lightingColor?: number | string | undefined;
106
+ limitingConeAngle?: number | string | undefined;
107
+ local?: number | string | undefined;
108
+ markerEnd?: string | undefined;
109
+ markerHeight?: number | string | undefined;
110
+ markerMid?: string | undefined;
111
+ markerStart?: string | undefined;
112
+ markerUnits?: number | string | undefined;
113
+ markerWidth?: number | string | undefined;
114
+ mask?: string | undefined;
115
+ maskContentUnits?: number | string | undefined;
116
+ maskUnits?: number | string | undefined;
117
+ mathematical?: number | string | undefined;
118
+ mode?: number | string | undefined;
119
+ numOctaves?: number | string | undefined;
120
+ offset?: number | string | undefined;
121
+ opacity?: number | string | undefined;
122
+ operator?: number | string | undefined;
123
+ order?: number | string | undefined;
124
+ orient?: number | string | undefined;
125
+ orientation?: number | string | undefined;
126
+ origin?: number | string | undefined;
127
+ overflow?: number | string | undefined;
128
+ overlinePosition?: number | string | undefined;
129
+ overlineThickness?: number | string | undefined;
130
+ paintOrder?: number | string | undefined;
131
+ panose1?: number | string | undefined;
132
+ path?: string | undefined;
133
+ pathLength?: number | string | undefined;
134
+ patternContentUnits?: string | undefined;
135
+ patternTransform?: number | string | undefined;
136
+ patternUnits?: string | undefined;
137
+ pointerEvents?: number | string | undefined;
138
+ points?: string | undefined;
139
+ pointsAtX?: number | string | undefined;
140
+ pointsAtY?: number | string | undefined;
141
+ pointsAtZ?: number | string | undefined;
142
+ preserveAlpha?: boolean | undefined;
143
+ preserveAspectRatio?: string | undefined;
144
+ primitiveUnits?: number | string | undefined;
145
+ r?: number | string | undefined;
146
+ radius?: number | string | undefined;
147
+ refX?: number | string | undefined;
148
+ refY?: number | string | undefined;
149
+ renderingIntent?: number | string | undefined;
150
+ repeatCount?: number | string | undefined;
151
+ repeatDur?: number | string | undefined;
152
+ requiredExtensions?: number | string | undefined;
153
+ requiredFeatures?: number | string | undefined;
154
+ restart?: number | string | undefined;
155
+ result?: string | undefined;
156
+ rotate?: number | string | undefined;
157
+ rx?: number | string | undefined;
158
+ ry?: number | string | undefined;
159
+ scale?: number | string | undefined;
160
+ seed?: number | string | undefined;
161
+ shapeRendering?: number | string | undefined;
162
+ slope?: number | string | undefined;
163
+ spacing?: number | string | undefined;
164
+ specularConstant?: number | string | undefined;
165
+ specularExponent?: number | string | undefined;
166
+ speed?: number | string | undefined;
167
+ spreadMethod?: string | undefined;
168
+ startOffset?: number | string | undefined;
169
+ stdDeviation?: number | string | undefined;
170
+ stemh?: number | string | undefined;
171
+ stemv?: number | string | undefined;
172
+ stitchTiles?: number | string | undefined;
173
+ stopColor?: string | undefined;
174
+ stopOpacity?: number | string | undefined;
175
+ strikethroughPosition?: number | string | undefined;
176
+ strikethroughThickness?: number | string | undefined;
177
+ string?: number | string | undefined;
178
+ stroke?: string | undefined;
179
+ strokeDasharray?: string | number | undefined;
180
+ strokeDashoffset?: string | number | undefined;
181
+ strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
182
+ strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
183
+ strokeMiterlimit?: number | string | undefined;
184
+ strokeOpacity?: number | string | undefined;
185
+ strokeWidth?: number | string | undefined;
186
+ surfaceScale?: number | string | undefined;
187
+ systemLanguage?: number | string | undefined;
188
+ tableValues?: number | string | undefined;
189
+ targetX?: number | string | undefined;
190
+ targetY?: number | string | undefined;
191
+ textAnchor?: string | undefined;
192
+ textDecoration?: number | string | undefined;
193
+ textLength?: number | string | undefined;
194
+ textRendering?: number | string | undefined;
195
+ to?: number | string | undefined;
196
+ transform?: string | undefined;
197
+ u1?: number | string | undefined;
198
+ u2?: number | string | undefined;
199
+ underlinePosition?: number | string | undefined;
200
+ underlineThickness?: number | string | undefined;
201
+ unicode?: number | string | undefined;
202
+ unicodeBidi?: number | string | undefined;
203
+ unicodeRange?: number | string | undefined;
204
+ unitsPerEm?: number | string | undefined;
205
+ vAlphabetic?: number | string | undefined;
206
+ values?: string | undefined;
207
+ vectorEffect?: number | string | undefined;
208
+ version?: string | undefined;
209
+ vertAdvY?: number | string | undefined;
210
+ vertOriginX?: number | string | undefined;
211
+ vertOriginY?: number | string | undefined;
212
+ vHanging?: number | string | undefined;
213
+ vIdeographic?: number | string | undefined;
214
+ viewBox?: string | undefined;
215
+ viewTarget?: number | string | undefined;
216
+ visibility?: number | string | undefined;
217
+ vMathematical?: number | string | undefined;
218
+ widths?: number | string | undefined;
219
+ wordSpacing?: number | string | undefined;
220
+ writingMode?: number | string | undefined;
221
+ x1?: number | string | undefined;
222
+ x2?: number | string | undefined;
223
+ x?: number | string | undefined;
224
+ xChannelSelector?: string | undefined;
225
+ xHeight?: number | string | undefined;
226
+ xlinkActuate?: string | undefined;
227
+ xlinkArcrole?: string | undefined;
228
+ xlinkHref?: string | undefined;
229
+ xlinkRole?: string | undefined;
230
+ xlinkShow?: string | undefined;
231
+ xlinkTitle?: string | undefined;
232
+ xlinkType?: string | undefined;
233
+ xmlBase?: string | undefined;
234
+ xmlLang?: string | undefined;
235
+ xmlns?: string | undefined;
236
+ xmlnsXlink?: string | undefined;
237
+ xmlSpace?: string | undefined;
238
+ y1?: number | string | undefined;
239
+ y2?: number | string | undefined;
240
+ y?: number | string | undefined;
241
+ yChannelSelector?: string | undefined;
242
+ z?: number | string | undefined;
243
+ zoomAndPan?: string | undefined;
244
+ }
245
+
246
+ interface ProgressTimeline {
247
+ currentTime: null | {
248
+ value: number;
249
+ };
250
+ cancel?: VoidFunction;
251
+ }
252
+ /**
253
+ * Methods to control an animation.
254
+ */
255
+ interface AnimationPlaybackControls {
256
+ /**
257
+ * The current time of the animation, in seconds.
258
+ */
259
+ time: number;
260
+ /**
261
+ * The playback speed of the animation.
262
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
263
+ */
264
+ speed: number;
265
+ /**
266
+ * The start time of the animation, in milliseconds.
267
+ */
268
+ startTime: number | null;
269
+ /**
270
+ * The state of the animation.
271
+ *
272
+ * This is currently for internal use only.
273
+ */
274
+ state?: AnimationPlayState;
275
+ duration: number;
276
+ /**
277
+ * Stops the animation at its current state, and prevents it from
278
+ * resuming when the animation is played again.
279
+ */
280
+ stop: () => void;
281
+ /**
282
+ * Plays the animation.
283
+ */
284
+ play: () => void;
285
+ /**
286
+ * Pauses the animation.
287
+ */
288
+ pause: () => void;
289
+ /**
290
+ * Completes the animation and applies the final state.
291
+ */
292
+ complete: () => void;
293
+ /**
294
+ * Cancels the animation and applies the initial state.
295
+ */
296
+ cancel: () => void;
297
+ /**
298
+ * Allows the animation to be awaited.
299
+ */
300
+ then: (onResolve: VoidFunction, onReject?: VoidFunction) => Promise<void>;
301
+ /**
302
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
303
+ *
304
+ * This is currently for internal use only.
305
+ */
306
+ attachTimeline?: (timeline: ProgressTimeline, fallback?: (animation: AnimationPlaybackControls) => VoidFunction) => VoidFunction;
307
+ /**
308
+ * Flattens the animation's easing curve to linear.
309
+ *
310
+ * This is currently for internal use only, and is used by scroll() to
311
+ * ensure an animation is being scrubbed by progress rather than eased time.
312
+ */
313
+ flatten: () => void;
314
+ }
315
+ type AnimationPlaybackControlsWithFinished = Omit<AnimationPlaybackControls, "then"> & {
316
+ finished: Promise<any>;
317
+ };
318
+ interface AnimationState<V> {
319
+ value: V;
320
+ done: boolean;
321
+ }
322
+ interface KeyframeGenerator<V> {
323
+ calculatedDuration: null | number;
324
+ next: (t: number) => AnimationState<V>;
325
+ toString: () => string;
326
+ }
327
+ interface ValueAnimationOptions<V extends string | number = number> extends ValueAnimationTransition {
328
+ keyframes: V[];
329
+ name?: string;
330
+ from?: V;
331
+ isGenerator?: boolean;
332
+ }
333
+ type GeneratorFactory = (options: ValueAnimationOptions<any>) => KeyframeGenerator<any>;
334
+ type AnimationGeneratorType = GeneratorFactory | "decay" | "spring" | "keyframes" | "tween" | "inertia";
335
+ interface AnimationPlaybackLifecycles<V> {
336
+ onUpdate?: (latest: V) => void;
337
+ onPlay?: () => void;
338
+ onComplete?: () => void;
339
+ onRepeat?: () => void;
340
+ onStop?: () => void;
341
+ }
342
+ interface ValueAnimationTransition<V = any> extends Transition, AnimationPlaybackLifecycles<V> {
343
+ }
344
+ type RepeatType = "loop" | "reverse" | "mirror";
345
+ interface AnimationPlaybackOptions {
346
+ repeat?: number;
347
+ repeatType?: RepeatType;
348
+ repeatDelay?: number;
349
+ }
350
+ interface VelocityOptions {
351
+ velocity?: number;
352
+ restSpeed?: number;
353
+ restDelta?: number;
354
+ }
355
+ interface DurationSpringOptions {
356
+ duration?: number;
357
+ visualDuration?: number;
358
+ bounce?: number;
359
+ }
360
+ interface SpringOptions extends DurationSpringOptions, VelocityOptions {
361
+ stiffness?: number;
362
+ damping?: number;
363
+ mass?: number;
364
+ }
365
+ interface DecayOptions extends VelocityOptions {
366
+ keyframes?: number[];
367
+ power?: number;
368
+ timeConstant?: number;
369
+ modifyTarget?: (v: number) => number;
370
+ }
371
+ type EasingFunction = (v: number) => number;
372
+ type EasingModifier = (easing: EasingFunction) => EasingFunction;
373
+ type BezierDefinition = readonly [number, number, number, number];
374
+ type EasingDefinition = BezierDefinition | "linear" | "easeIn" | "easeOut" | "easeInOut" | "circIn" | "circOut" | "circInOut" | "backIn" | "backOut" | "backInOut" | "anticipate";
375
+ /**
376
+ * The easing function to use. Set as one of:
377
+ *
378
+ * - The name of an in-built easing function.
379
+ * - An array of four numbers to define a cubic bezier curve.
380
+ * - An easing function, that accepts and returns a progress value between `0` and `1`.
381
+ *
382
+ * @public
383
+ */
384
+ type Easing = EasingDefinition | EasingFunction;
385
+ interface DriverControls {
386
+ start: () => void;
387
+ stop: () => void;
388
+ now: () => number;
389
+ }
390
+ type Driver = (update: (timestamp: number) => void) => DriverControls;
391
+ interface InertiaOptions extends DecayOptions {
392
+ bounceStiffness?: number;
393
+ bounceDamping?: number;
394
+ min?: number;
395
+ max?: number;
396
+ }
397
+ interface KeyframeOptions {
398
+ ease?: Easing | Easing[];
399
+ times?: number[];
400
+ }
401
+ interface Transition extends AnimationPlaybackOptions, Omit<SpringOptions, "keyframes">, Omit<InertiaOptions, "keyframes">, KeyframeOptions {
402
+ delay?: number;
403
+ elapsed?: number;
404
+ driver?: Driver;
405
+ type?: AnimationGeneratorType;
406
+ duration?: number;
407
+ autoplay?: boolean;
408
+ startTime?: number;
409
+ }
410
+ type SVGPathTransitions = {
411
+ [K in keyof SVGPathProperties]: Transition;
412
+ };
413
+ type SVGTransitions = {
414
+ [K in keyof SVGAttributes]: Transition;
415
+ };
416
+ type VariableTransitions = {
417
+ [key: `--${string}`]: Transition;
418
+ };
419
+ type StyleTransitions = {
420
+ [K in keyof CSSStyleDeclarationWithTransform]?: Transition;
421
+ };
422
+ type ValueKeyframe = string | number;
423
+ type UnresolvedValueKeyframe = ValueKeyframe | null;
424
+ type ResolvedValueKeyframe = ValueKeyframe | ValueKeyframe[];
425
+ type ValueKeyframesDefinition = ValueKeyframe | ValueKeyframe[] | UnresolvedValueKeyframe[];
426
+ type StyleKeyframesDefinition = {
427
+ [K in keyof CSSStyleDeclarationWithTransform]?: ValueKeyframesDefinition;
428
+ };
429
+ type SVGKeyframesDefinition = {
430
+ [K in keyof SVGAttributes]?: ValueKeyframesDefinition;
431
+ };
432
+ type VariableKeyframesDefinition = {
433
+ [key: `--${string}`]: ValueKeyframesDefinition;
434
+ };
435
+ type SVGPathKeyframesDefinition = {
436
+ [K in keyof SVGPathProperties]?: ValueKeyframesDefinition;
437
+ };
438
+ type DOMKeyframesDefinition = StyleKeyframesDefinition & SVGKeyframesDefinition & SVGPathKeyframesDefinition & VariableKeyframesDefinition;
439
+ interface CSSStyleDeclarationWithTransform extends Omit<CSSStyleDeclaration, "direction" | "transition" | "x" | "y" | "z"> {
440
+ x: number | string;
441
+ y: number | string;
442
+ z: number | string;
443
+ rotateX: number | string;
444
+ rotateY: number | string;
445
+ rotateZ: number | string;
446
+ scaleX: number;
447
+ scaleY: number;
448
+ scaleZ: number;
449
+ skewX: number | string;
450
+ skewY: number | string;
451
+ }
452
+ type AnimationOptionsWithValueOverrides<V = any> = StyleTransitions & SVGPathTransitions & SVGTransitions & VariableTransitions & ValueAnimationTransition<V>;
453
+ type DynamicOption<T> = (i: number, total: number) => T;
454
+ interface AnimationOptions extends Omit<AnimationOptionsWithValueOverrides, "delay"> {
455
+ delay?: number | DynamicOption<number>;
456
+ }
457
+ interface TransformProperties {
458
+ x?: string | number;
459
+ y?: string | number;
460
+ z?: string | number;
461
+ translateX?: string | number;
462
+ translateY?: string | number;
463
+ translateZ?: string | number;
464
+ rotate?: string | number;
465
+ rotateX?: string | number;
466
+ rotateY?: string | number;
467
+ rotateZ?: string | number;
468
+ scale?: string | number;
469
+ scaleX?: string | number;
470
+ scaleY?: string | number;
471
+ scaleZ?: string | number;
472
+ skew?: string | number;
473
+ skewX?: string | number;
474
+ skewY?: string | number;
475
+ originX?: string | number;
476
+ originY?: string | number;
477
+ originZ?: string | number;
478
+ perspective?: string | number;
479
+ transformPerspective?: string | number;
480
+ }
481
+ interface SVGPathProperties {
482
+ pathLength?: number;
483
+ pathOffset?: number;
484
+ pathSpacing?: number;
485
+ }
486
+
487
+ type AcceptedAnimations = AnimationPlaybackControls | AnimationPlaybackControlsWithFinished;
488
+ type GroupedAnimations = AcceptedAnimations[];
489
+ declare class BaseGroupPlaybackControls implements AnimationPlaybackControlsWithFinished {
490
+ animations: GroupedAnimations;
491
+ constructor(animations: Array<AcceptedAnimations | undefined>);
492
+ get finished(): Promise<any[]>;
493
+ /**
494
+ * TODO: Filter out cancelled or stopped animations before returning
495
+ */
496
+ private getAll;
497
+ private setAll;
498
+ attachTimeline(timeline: any, fallback: (animation: AnimationPlaybackControls | AnimationPlaybackControlsWithFinished) => VoidFunction): () => void;
499
+ get time(): number;
500
+ set time(time: number);
501
+ get speed(): number;
502
+ set speed(speed: number);
503
+ get startTime(): any;
504
+ get duration(): number;
505
+ private runAll;
506
+ flatten(): void;
507
+ play(): void;
508
+ pause(): void;
509
+ stop: () => void;
510
+ cancel(): void;
511
+ complete(): void;
512
+ }
513
+
514
+ /**
515
+ * TODO: This is a temporary class to support the legacy
516
+ * thennable API
517
+ */
518
+ declare class GroupPlaybackControls extends BaseGroupPlaybackControls implements AnimationPlaybackControls {
519
+ animations: AnimationPlaybackControls[];
520
+ then(onResolve: VoidFunction, onReject?: VoidFunction): Promise<void>;
521
+ }
522
+
523
+ declare function getValueTransition(transition: any, key: string): any;
524
+
525
+ /**
526
+ * Implement a practical max duration for keyframe generation
527
+ * to prevent infinite loops
528
+ */
529
+ declare const maxGeneratorDuration = 20000;
530
+ declare function calcGeneratorDuration(generator: KeyframeGenerator<unknown>): number;
531
+
532
+ /**
533
+ * Create a progress => progress easing function from a generator.
534
+ */
535
+ declare function createGeneratorEasing(options: Transition, scale: number | undefined, createGenerator: GeneratorFactory): {
536
+ type: string;
537
+ ease: (progress: number) => number;
538
+ duration: number;
539
+ };
540
+
541
+ declare function isGenerator(type?: AnimationGeneratorType): type is GeneratorFactory;
542
+
543
+ declare class NativeAnimationControls implements Omit<AnimationPlaybackControlsWithFinished, "then"> {
544
+ animation?: Animation;
545
+ options?: ValueAnimationOptions;
546
+ constructor(animation?: Animation);
547
+ get duration(): number;
548
+ get time(): number;
549
+ set time(newTime: number);
550
+ get speed(): number;
551
+ set speed(newSpeed: number);
552
+ get state(): AnimationPlayState;
553
+ get startTime(): number | null;
554
+ get finished(): Promise<void> | Promise<Animation>;
555
+ play(): void;
556
+ pause(): void;
557
+ stop(): void;
558
+ flatten(): void;
559
+ attachTimeline(timeline: any): (any: void) => void;
560
+ complete(): void;
561
+ cancel(): void;
562
+ }
563
+
564
+ declare function attachTimeline(animation: Animation, timeline: any): void;
565
+
566
+ declare function isWaapiSupportedEasing(easing?: Easing | Easing[]): boolean;
567
+ declare const cubicBezierAsString: ([a, b, c, d]: BezierDefinition) => string;
568
+ declare const supportedWaapiEasing: {
569
+ linear: string;
570
+ ease: string;
571
+ easeIn: string;
572
+ easeOut: string;
573
+ easeInOut: string;
574
+ circIn: string;
575
+ circOut: string;
576
+ backIn: string;
577
+ backOut: string;
578
+ };
579
+ declare function mapEasingToNativeEasing(easing: Easing | Easing[] | undefined, duration: number): undefined | string | string[];
580
+
581
+ declare const generateLinearEasing: (easing: EasingFunction, duration: number, resolution?: number) => string;
582
+
1
583
  type ElementOrSelector = Element | Element[] | NodeListOf<Element> | string;
2
584
  interface WithQuerySelectorAll {
3
585
  querySelectorAll: Element["querySelectorAll"];
@@ -86,6 +668,69 @@ interface PointerEventOptions extends EventOptions {
86
668
  */
87
669
  declare function press(elementOrSelector: ElementOrSelector, onPressStart: OnPressStartEvent, options?: PointerEventOptions): VoidFunction;
88
670
 
671
+ declare const isBezierDefinition: (easing: Easing | Easing[]) => easing is BezierDefinition;
672
+
673
+ /**
674
+ * Add the ability for test suites to manually set support flags
675
+ * to better test more environments.
676
+ */
677
+ declare const supportsFlags: Record<string, boolean | undefined>;
678
+
679
+ declare const supportsLinearEasing: () => boolean;
680
+
681
+ declare global {
682
+ interface Window {
683
+ ScrollTimeline: ScrollTimeline;
684
+ }
685
+ }
686
+ declare class ScrollTimeline implements ProgressTimeline {
687
+ constructor(options: ScrollOptions);
688
+ currentTime: null | {
689
+ value: number;
690
+ };
691
+ cancel?: VoidFunction;
692
+ }
693
+ declare const supportsScrollTimeline: () => boolean;
694
+
695
+ type ViewTransitionAnimationDefinition = {
696
+ keyframes: DOMKeyframesDefinition;
697
+ options: AnimationOptions;
698
+ };
699
+ type ViewTransitionTarget = {
700
+ layout?: ViewTransitionAnimationDefinition;
701
+ enter?: ViewTransitionAnimationDefinition;
702
+ exit?: ViewTransitionAnimationDefinition;
703
+ new?: ViewTransitionAnimationDefinition;
704
+ old?: ViewTransitionAnimationDefinition;
705
+ };
706
+ interface ViewTransitionOptions extends AnimationOptions {
707
+ }
708
+ type Target = string | Element;
709
+
710
+ /**
711
+ * TODO:
712
+ * - Create view transition on next tick
713
+ * - Replace animations with Motion animations
714
+ * - Return GroupAnimation on next tick
715
+ */
716
+ declare class ViewTransitionBuilder {
717
+ private currentTarget;
718
+ private targets;
719
+ private notifyReady;
720
+ private readyPromise;
721
+ constructor(update: () => void | Promise<void>, options?: ViewTransitionOptions);
722
+ get(selector: Target): this;
723
+ layout(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
724
+ new(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
725
+ old(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
726
+ enter(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
727
+ exit(keyframes: DOMKeyframesDefinition, options?: AnimationOptions): this;
728
+ crossfade(options?: AnimationOptions): this;
729
+ updateTarget(target: "enter" | "exit" | "layout" | "new" | "old", keyframes: DOMKeyframesDefinition, options?: AnimationOptions): void;
730
+ then(resolve: () => void, reject?: () => void): Promise<void>;
731
+ }
732
+ declare function view(update: () => void | Promise<void>, defaultOptions?: ViewTransitionOptions): ViewTransitionBuilder;
733
+
89
734
  declare const isDragging: {
90
735
  x: boolean;
91
736
  y: boolean;
@@ -94,8 +739,6 @@ declare function isDragActive(): boolean;
94
739
 
95
740
  declare function setDragLock(axis: boolean | "x" | "y" | "lockDirection"): (() => void) | null;
96
741
 
97
- declare const isPrimaryPointer: (event: PointerEvent) => boolean;
98
-
99
742
  /**
100
743
  * Recursively traverse up the tree to check whether the provided child node
101
744
  * is the parent or a descendant of it.
@@ -105,4 +748,6 @@ declare const isPrimaryPointer: (event: PointerEvent) => boolean;
105
748
  */
106
749
  declare const isNodeOrChild: (parent: Element | null, child?: Element | null) => boolean;
107
750
 
108
- export { type AnimationScope, type ElementOrSelector, type EventOptions, type OnHoverEndEvent, type OnHoverStartEvent, type OnPressEndEvent, type OnPressStartEvent, type PointerEventOptions, type PressGestureInfo, type SelectorCache, type WithQuerySelectorAll, hover, isDragActive, isDragging, isNodeOrChild, isPrimaryPointer, press, resolveElements, setDragLock };
751
+ declare const isPrimaryPointer: (event: PointerEvent) => boolean;
752
+
753
+ export { type AnimationGeneratorType, type AnimationOptions, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackControlsWithFinished, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, type BezierDefinition, type CSSStyleDeclarationWithTransform, type DOMKeyframesDefinition, type DecayOptions, type Driver, type DriverControls, type DurationSpringOptions, type DynamicOption, type Easing, type EasingDefinition, type EasingFunction, type EasingModifier, type ElementOrSelector, type EventOptions, type GeneratorFactory, GroupPlaybackControls, type InertiaOptions, type KeyframeGenerator, type KeyframeOptions, NativeAnimationControls, type OnHoverEndEvent, type OnHoverStartEvent, type OnPressEndEvent, type OnPressStartEvent, type PointerEventOptions, type PressGestureInfo, type ProgressTimeline, type RepeatType, type ResolvedValueKeyframe, type SVGAttributes, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type SelectorCache, type SpringOptions, type StyleKeyframesDefinition, type StyleTransitions, type Target, type TransformProperties, type Transition, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationTransition, type ValueKeyframe, type ValueKeyframesDefinition, type VariableKeyframesDefinition, type VariableTransitions, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type WithQuerySelectorAll, attachTimeline, calcGeneratorDuration, createGeneratorEasing, cubicBezierAsString, generateLinearEasing, getValueTransition, hover, isBezierDefinition, isDragActive, isDragging, isGenerator, isNodeOrChild, isPrimaryPointer, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, press, resolveElements, setDragLock, supportedWaapiEasing, supportsFlags, supportsLinearEasing, supportsScrollTimeline, view };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-dom",
3
- "version": "11.14.3",
3
+ "version": "11.16.1",
4
4
  "author": "Matt Perry",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/motiondivision/motion",
@@ -15,10 +15,13 @@
15
15
  "default": "./dist/cjs/index.js"
16
16
  }
17
17
  },
18
+ "dependencies": {
19
+ "motion-utils": "^11.16.0"
20
+ },
18
21
  "scripts": {
19
22
  "clean": "rm -rf types dist lib",
20
23
  "build": "yarn clean && tsc -p . && rollup -c",
21
24
  "dev": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\""
22
25
  },
23
- "gitHead": "5f420ccca7d3159ec9bb362ff3c13153f38e90f2"
26
+ "gitHead": "d0d281ab97fe3ceef4d582d8da622faab907998d"
24
27
  }