@aphrody/m3-motion 3.2.5 → 3.3.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M3ListStagger.d.ts","sourceRoot":"","sources":["../../src/components/M3ListStagger.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAuB,SAAQ,eAAe,CAAC,KAAK,CAAC;IACpE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAiCD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,2FAmBzB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,4GAa7B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import type { HTMLMotionProps, Transition } from "motion/react";
3
+ export interface M3SharedAxisProps extends HTMLMotionProps<"div"> {
4
+ /**
5
+ * If true, the component will transition in. If false, it will transition out.
6
+ * If omitted, the component behaves as a standard motion element meant to be unmounted/mounted
7
+ * by an external <AnimatePresence>.
8
+ */
9
+ in?: boolean;
10
+ /**
11
+ * Axis of translation.
12
+ * @default "x"
13
+ */
14
+ axis?: "x" | "y" | "z";
15
+ /**
16
+ * Direction of navigation. If true, slides forward/up/zoom-in. If false, slides backward/down/zoom-out.
17
+ * @default true
18
+ */
19
+ forward?: boolean;
20
+ /**
21
+ * If true, animate the transition on initial mount.
22
+ * @default true
23
+ */
24
+ appear?: boolean;
25
+ /**
26
+ * Custom transition for the shared axis animation.
27
+ */
28
+ transition?: Transition;
29
+ }
30
+ /**
31
+ * M3SharedAxis transition component.
32
+ * Implements the Material 3 Shared Axis motion pattern (X, Y, Z axes).
33
+ */
34
+ export declare const M3SharedAxis: React.ForwardRefExoticComponent<Omit<M3SharedAxisProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
35
+ //# sourceMappingURL=M3SharedAxis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M3SharedAxis.d.ts","sourceRoot":"","sources":["../../src/components/M3SharedAxis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAY,MAAM,cAAc,CAAC;AAG1E,MAAM,WAAW,iBAAkB,SAAQ,eAAe,CAAC,KAAK,CAAC;IAC/D;;;;OAIG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,uGA6DxB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import type { HTMLMotionProps, MotionStyle, Variants } from "motion/react";
3
+ export type M3TransitionPattern = "fade" | "fade-through" | "shared-axis-x" | "shared-axis-y" | "shared-axis-z" | "collapse";
4
+ export interface M3TransitionProps extends Omit<HTMLMotionProps<"div">, "variants" | "style"> {
5
+ style?: MotionStyle;
6
+ /**
7
+ * Unique key representing the active view/content. Changing this key triggers the transition.
8
+ */
9
+ stateKey: React.Key;
10
+ /**
11
+ * Which M3 transition pattern to apply.
12
+ * @default "fade"
13
+ */
14
+ pattern?: M3TransitionPattern;
15
+ /**
16
+ * Direction of navigation for shared-axis-* patterns.
17
+ * @default true
18
+ */
19
+ forward?: boolean;
20
+ /**
21
+ * Custom variants — overrides the pattern defaults entirely.
22
+ */
23
+ variants?: Variants;
24
+ /**
25
+ * AnimatePresence mode.
26
+ * @default "wait"
27
+ */
28
+ mode?: "wait" | "sync" | "popLayout";
29
+ }
30
+ /**
31
+ * M3Transition — generic Material 3 transition wrapper.
32
+ * Supports all standard M3 patterns via the `pattern` prop.
33
+ * The `stateKey` prop drives AnimatePresence re-mounts.
34
+ */
35
+ export declare const M3Transition: React.ForwardRefExoticComponent<Omit<M3TransitionProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
36
+ //# sourceMappingURL=M3Transition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M3Transition.d.ts","sourceRoot":"","sources":["../../src/components/M3Transition.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAc,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGvF,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,cAAc,GACd,eAAe,GACf,eAAe,GACf,eAAe,GACf,UAAU,CAAC;AAEf,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC3F,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;CACtC;AA0HD;;;;GAIG;AACH,eAAO,MAAM,YAAY,uGAoCxB,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Material Design 3 Easing Presets.
3
+ * Represented as cubic-bezier array coordinates [x1, y1, x2, y2].
4
+ *
5
+ * Source of truth: packages/material-web/tokens/versions/v0_192/_md-sys-motion.scss
6
+ * and docs/01-md3-spec-foundations.md §7.1
7
+ *
8
+ * Note on `emphasized`: the full M3 emphasized path is a 2-segment spline
9
+ * (not expressible as a single cubic-bezier). The token file maps
10
+ * easing-emphasized to cubic-bezier(0.2, 0, 0, 1) — identical to standard —
11
+ * because that is the closest single-bezier approximation used in web
12
+ * implementations. Use emphasizedDecelerate / emphasizedAccelerate for
13
+ * enter/exit transitions respectively (recommended practice per spec §7.1).
14
+ */
15
+ export declare const m3Easings: {
16
+ /** Closest single-bezier approximation. Use emphasizedDecelerate/Accelerate for transitions. */
17
+ readonly emphasized: readonly [0.2, 0, 0, 1];
18
+ readonly emphasizedDecelerate: readonly [0.05, 0.7, 0.1, 1];
19
+ readonly emphasizedAccelerate: readonly [0.3, 0, 0.8, 0.15];
20
+ readonly standard: readonly [0.2, 0, 0, 1];
21
+ readonly standardDecelerate: readonly [0, 0, 0, 1];
22
+ readonly standardAccelerate: readonly [0.3, 0, 1, 1];
23
+ readonly linear: readonly [0, 0, 1, 1];
24
+ /** Legacy (M2 default) — kept for migration compatibility. */
25
+ readonly legacy: readonly [0.4, 0, 0.2, 1];
26
+ readonly legacyDecelerate: readonly [0, 0, 0.2, 1];
27
+ readonly legacyAccelerate: readonly [0.4, 0, 1, 1];
28
+ };
29
+ export type M3EasingKey = keyof typeof m3Easings;
30
+ export type M3EasingValue = (typeof m3Easings)[M3EasingKey];
31
+ /**
32
+ * Material Design 3 Duration Presets (in seconds, compatible with Motion duration option).
33
+ *
34
+ * Canonical values from _md-sys-motion.scss:
35
+ * short1=50ms, short2=100ms, short3=150ms, short4=200ms
36
+ * medium1=250ms, medium2=300ms, medium3=350ms, medium4=400ms
37
+ * long1=450ms, long2=500ms, long3=550ms, long4=600ms
38
+ * extraLong1=700ms, extraLong2=800ms, extraLong3=900ms, extraLong4=1000ms
39
+ */
40
+ export declare const m3Durations: {
41
+ readonly short1: 0.05;
42
+ readonly short2: 0.1;
43
+ readonly short3: 0.15;
44
+ readonly short4: 0.2;
45
+ readonly medium1: 0.25;
46
+ readonly medium2: 0.3;
47
+ readonly medium3: 0.35;
48
+ readonly medium4: 0.4;
49
+ readonly long1: 0.45;
50
+ readonly long2: 0.5;
51
+ readonly long3: 0.55;
52
+ readonly long4: 0.6;
53
+ readonly extraLong1: 0.7;
54
+ readonly extraLong2: 0.8;
55
+ readonly extraLong3: 0.9;
56
+ readonly extraLong4: 1;
57
+ };
58
+ export type M3DurationKey = keyof typeof m3Durations;
59
+ export type M3DurationValue = (typeof m3Durations)[M3DurationKey];
60
+ //# sourceMappingURL=easings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"easings.d.ts","sourceRoot":"","sources":["../src/easings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS;IACpB,gGAAgG;aAChG,UAAU,YAAG,GAAG,EAAE,CAAG,EAAE,CAAG,EAAE,CAAG;aAC/B,oBAAoB,YAAG,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAG;aAC1C,oBAAoB,YAAG,GAAG,EAAE,CAAG,EAAE,GAAG,EAAE,IAAI;aAC1C,QAAQ,YAAG,GAAG,EAAE,CAAG,EAAE,CAAG,EAAE,CAAG;aAC7B,kBAAkB,YAAG,CAAG,EAAE,CAAG,EAAE,CAAG,EAAE,CAAG;aACvC,kBAAkB,YAAG,GAAG,EAAE,CAAG,EAAE,CAAG,EAAE,CAAG;aACvC,MAAM,YAAG,CAAG,EAAE,CAAG,EAAE,CAAG,EAAE,CAAG;IAC3B,8DAA8D;aAC9D,MAAM,YAAG,GAAG,EAAE,CAAG,EAAE,GAAG,EAAE,CAAG;aAC3B,gBAAgB,YAAG,CAAG,EAAE,CAAG,EAAE,GAAG,EAAE,CAAG;aACrC,gBAAgB,YAAG,GAAG,EAAE,CAAG,EAAE,CAAG,EAAE,CAAG;CAC7B,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,SAAS,CAAC;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;aACtB,MAAM,EAAE,IAAI;aACZ,MAAM,EAAE,GAAG;aACX,MAAM,EAAE,IAAI;aACZ,MAAM,EAAE,GAAG;aACX,OAAO,EAAE,IAAI;aACb,OAAO,EAAE,GAAG;aACZ,OAAO,EAAE,IAAI;aACb,OAAO,EAAE,GAAG;aACZ,KAAK,EAAE,IAAI;aACX,KAAK,EAAE,GAAG;aACV,KAAK,EAAE,IAAI;aACX,KAAK,EAAE,GAAG;aACV,UAAU,EAAE,GAAG;aACf,UAAU,EAAE,GAAG;aACf,UAAU,EAAE,GAAG;aACf,UAAU,EAAE,CAAG;CACP,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,WAAW,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { AnimationScope, AnimationPlaybackControlsWithThen, AnimationSequence, SequenceOptions, ElementOrSelector, DOMKeyframesDefinition, AnimationOptions, MotionValue, UnresolvedValueKeyframe, ValueAnimationTransition, ObjectTarget } from "motion/react";
2
+ /**
3
+ * Overloaded type for the scoped animate function returned by useM3Animate.
4
+ * Mirrors the overload set of the underlying motion animate, adding M3 defaults.
5
+ */
6
+ export interface M3AnimateFn {
7
+ (sequence: AnimationSequence, options?: SequenceOptions): AnimationPlaybackControlsWithThen;
8
+ (value: string | MotionValue<string>, keyframes: string | UnresolvedValueKeyframe<string>[], options?: ValueAnimationTransition<string>): AnimationPlaybackControlsWithThen;
9
+ (value: number | MotionValue<number>, keyframes: number | UnresolvedValueKeyframe<number>[], options?: ValueAnimationTransition<number>): AnimationPlaybackControlsWithThen;
10
+ <V extends string | number>(value: V | MotionValue<V>, keyframes: V | UnresolvedValueKeyframe<V>[], options?: ValueAnimationTransition<V>): AnimationPlaybackControlsWithThen;
11
+ (element: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen;
12
+ <O extends object>(object: O | O[], keyframes: ObjectTarget<O>, options?: AnimationOptions): AnimationPlaybackControlsWithThen;
13
+ }
14
+ /**
15
+ * A custom hook wrapping motion's `useAnimate` that injects Material 3 motion defaults
16
+ * (emphasized easing and medium2 duration) for all imperative DOM animations.
17
+ *
18
+ * SSR-safe: useAnimate creates refs; no DOM access occurs at module or render time.
19
+ */
20
+ export declare function useM3Animate<T extends Element = HTMLElement>(): [AnimationScope<T>, M3AnimateFn];
21
+ //# sourceMappingURL=useM3Animate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useM3Animate.d.ts","sourceRoot":"","sources":["../../src/hooks/useM3Animate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,iCAAiC,EACjC,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACb,MAAM,cAAc,CAAC;AAGtB;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,iCAAiC,CAAC;IAC5F,CACE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,EACnC,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC,EAAE,EACrD,OAAO,CAAC,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACzC,iCAAiC,CAAC;IACrC,CACE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,EACnC,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC,EAAE,EACrD,OAAO,CAAC,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACzC,iCAAiC,CAAC;IACrC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACxB,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EACzB,SAAS,EAAE,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAC3C,OAAO,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACpC,iCAAiC,CAAC;IACrC,CACE,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,sBAAsB,EACjC,OAAO,CAAC,EAAE,gBAAgB,GACzB,iCAAiC,CAAC;IACrC,CAAC,CAAC,SAAS,MAAM,EACf,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EACf,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,iCAAiC,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CA0ChG"}
@@ -0,0 +1,12 @@
1
+ export * from "./springs.js";
2
+ export * from "./easings.js";
3
+ export * from "./spring-interpolation.js";
4
+ export * from "./components/M3Fade.js";
5
+ export * from "./components/M3SharedAxis.js";
6
+ export * from "./components/M3FadeThrough.js";
7
+ export * from "./components/M3Collapse.js";
8
+ export * from "./components/M3ContainerTransform.js";
9
+ export * from "./components/M3Transition.js";
10
+ export * from "./components/M3ListStagger.js";
11
+ export * from "./hooks/useM3Animate.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC"}