motionwind-core 2.1.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.
- package/README.md +44 -0
- package/dist/adapter.cjs +31 -0
- package/dist/adapter.cjs.map +1 -0
- package/dist/adapter.d.cts +14 -0
- package/dist/adapter.d.ts +14 -0
- package/dist/adapter.js +3 -0
- package/dist/adapter.js.map +1 -0
- package/dist/chunk-A7EAMXLY.js +1098 -0
- package/dist/chunk-A7EAMXLY.js.map +1 -0
- package/dist/chunk-IJZCYKTO.js +352 -0
- package/dist/chunk-IJZCYKTO.js.map +1 -0
- package/dist/chunk-P6FC2RDE.js +25 -0
- package/dist/chunk-P6FC2RDE.js.map +1 -0
- package/dist/chunk-ULRTFOGX.js +28 -0
- package/dist/chunk-ULRTFOGX.js.map +1 -0
- package/dist/chunk-Z5I36REG.js +411 -0
- package/dist/chunk-Z5I36REG.js.map +1 -0
- package/dist/config.cjs +30 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/index.cjs +1970 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/parser.cjs +1690 -0
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +21 -0
- package/dist/parser.d.ts +21 -0
- package/dist/parser.js +6 -0
- package/dist/parser.js.map +1 -0
- package/dist/recipes.cjs +359 -0
- package/dist/recipes.cjs.map +1 -0
- package/dist/recipes.d.cts +19 -0
- package/dist/recipes.d.ts +19 -0
- package/dist/recipes.js +4 -0
- package/dist/recipes.js.map +1 -0
- package/dist/registry.cjs +421 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.d.cts +1 -0
- package/dist/registry.d.ts +1 -0
- package/dist/registry.js +3 -0
- package/dist/registry.js.map +1 -0
- package/dist/types-BYtWWSgh.d.cts +185 -0
- package/dist/types-BYtWWSgh.d.ts +185 -0
- package/llms.txt +77 -0
- package/package.json +96 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
type SyntaxCategory = "gesture" | "property" | "transition" | "viewport" | "scroll" | "drag" | "layout" | "variant" | "preset" | "modifier";
|
|
2
|
+
type Platform = "react" | "vue" | "vanilla" | "react-native";
|
|
3
|
+
/** Machine-readable syntax metadata shared by docs, editors and diagnostics. */
|
|
4
|
+
interface SyntaxDefinition {
|
|
5
|
+
id: string;
|
|
6
|
+
category: SyntaxCategory;
|
|
7
|
+
label: string;
|
|
8
|
+
snippet: string;
|
|
9
|
+
description: string;
|
|
10
|
+
motionKey?: string;
|
|
11
|
+
platforms?: Platform[];
|
|
12
|
+
}
|
|
13
|
+
declare const GESTURE_DEFINITIONS: readonly [SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition];
|
|
14
|
+
/**
|
|
15
|
+
* Modifier prefixes that wrap an inner class token and control conditional
|
|
16
|
+
* application based on the user's motion preference media query.
|
|
17
|
+
*/
|
|
18
|
+
declare const MODIFIER_DEFINITIONS: readonly SyntaxDefinition[];
|
|
19
|
+
declare const PROPERTY_DEFINITIONS: readonly [SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, {
|
|
20
|
+
readonly id: "property.z-zIndex";
|
|
21
|
+
readonly category: "property";
|
|
22
|
+
readonly label: "z-";
|
|
23
|
+
readonly snippet: "z-${1|0,10,20,30,40,50,auto|}";
|
|
24
|
+
readonly motionKey: "zIndex";
|
|
25
|
+
readonly description: "Animate z-index (Tailwind values: 0, 10, 20, 30, 40, 50, auto). Non-standard values translate on the z axis instead.";
|
|
26
|
+
readonly platforms: Platform[];
|
|
27
|
+
}, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition];
|
|
28
|
+
declare const CONFIG_DEFINITIONS: readonly [SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition];
|
|
29
|
+
declare const MOTIONWIND_SYNTAX_REGISTRY: readonly SyntaxDefinition[];
|
|
30
|
+
declare const GESTURE_MAP: Record<string, GestureKey>;
|
|
31
|
+
declare const GESTURE_KEYS: Set<string>;
|
|
32
|
+
declare const EASING_MAP: Record<string, string>;
|
|
33
|
+
declare function getSyntaxDefinitions(category?: SyntaxCategory): readonly SyntaxDefinition[];
|
|
34
|
+
|
|
35
|
+
type ReducedMotionPolicy = "user" | "always" | "never";
|
|
36
|
+
interface SpringToken {
|
|
37
|
+
stiffness?: number;
|
|
38
|
+
damping?: number;
|
|
39
|
+
bounce?: number;
|
|
40
|
+
mass?: number;
|
|
41
|
+
}
|
|
42
|
+
interface MotionwindTokens {
|
|
43
|
+
durations?: Record<string, number>;
|
|
44
|
+
easings?: Record<string, string | number[]>;
|
|
45
|
+
springs?: Record<string, SpringToken>;
|
|
46
|
+
}
|
|
47
|
+
interface MotionwindDiagnostic {
|
|
48
|
+
code: string;
|
|
49
|
+
message: string;
|
|
50
|
+
severity: "info" | "warning" | "error";
|
|
51
|
+
token?: string;
|
|
52
|
+
plugin?: string;
|
|
53
|
+
}
|
|
54
|
+
interface MotionwindResultPatch {
|
|
55
|
+
gestures?: ParsedResult["gestures"];
|
|
56
|
+
transition?: ParsedResult["transition"];
|
|
57
|
+
viewport?: ParsedResult["viewport"];
|
|
58
|
+
dragConfig?: ParsedResult["dragConfig"];
|
|
59
|
+
layoutConfig?: ParsedResult["layoutConfig"];
|
|
60
|
+
scroll?: Partial<ParsedResult["scroll"]>;
|
|
61
|
+
variants?: ParsedResult["variants"];
|
|
62
|
+
variantState?: ParsedResult["variantState"];
|
|
63
|
+
}
|
|
64
|
+
interface MotionwindPluginContext {
|
|
65
|
+
config: MotionwindConfig;
|
|
66
|
+
}
|
|
67
|
+
interface MotionwindPlugin {
|
|
68
|
+
name: string;
|
|
69
|
+
version: string;
|
|
70
|
+
core?: string;
|
|
71
|
+
presets?: Record<string, string | readonly string[]>;
|
|
72
|
+
definitions?: readonly SyntaxDefinition[];
|
|
73
|
+
transformToken?: (token: string, context: MotionwindPluginContext) => MotionwindResultPatch | null;
|
|
74
|
+
diagnose?: (className: string, parsed: ParsedResult, context: MotionwindPluginContext) => readonly MotionwindDiagnostic[];
|
|
75
|
+
}
|
|
76
|
+
interface MotionwindConfig {
|
|
77
|
+
adapter?: string;
|
|
78
|
+
strict?: boolean;
|
|
79
|
+
reducedMotion?: ReducedMotionPolicy;
|
|
80
|
+
tokens?: MotionwindTokens;
|
|
81
|
+
presets?: Record<string, string | readonly string[]>;
|
|
82
|
+
plugins?: readonly MotionwindPlugin[];
|
|
83
|
+
}
|
|
84
|
+
declare function defineConfig<const T extends MotionwindConfig>(config: T): T;
|
|
85
|
+
declare function defineMotionwindPlugin<const T extends MotionwindPlugin>(plugin: T): T;
|
|
86
|
+
declare function definePreset<const T extends string | readonly string[]>(preset: T): T;
|
|
87
|
+
declare const DEFAULT_MOTIONWIND_CONFIG: Readonly<MotionwindConfig>;
|
|
88
|
+
|
|
89
|
+
type GestureKey = "whileHover" | "whileTap" | "whileFocus" | "whileInView" | "whileDrag" | "initial" | "animate" | "exit";
|
|
90
|
+
type AnimatableValues = Record<string, string | number | (string | number)[]>;
|
|
91
|
+
interface TransitionConfig {
|
|
92
|
+
type?: "spring" | "tween" | "inertia";
|
|
93
|
+
duration?: number;
|
|
94
|
+
delay?: number;
|
|
95
|
+
ease?: string | number[];
|
|
96
|
+
stiffness?: number;
|
|
97
|
+
damping?: number;
|
|
98
|
+
bounce?: number;
|
|
99
|
+
mass?: number;
|
|
100
|
+
repeat?: number;
|
|
101
|
+
repeatType?: "loop" | "reverse" | "mirror";
|
|
102
|
+
repeatDelay?: number;
|
|
103
|
+
staggerChildren?: number;
|
|
104
|
+
staggerDirection?: 1 | -1;
|
|
105
|
+
delayChildren?: number;
|
|
106
|
+
when?: "beforeChildren" | "afterChildren" | false;
|
|
107
|
+
restSpeed?: number;
|
|
108
|
+
restDelta?: number;
|
|
109
|
+
times?: number[];
|
|
110
|
+
}
|
|
111
|
+
interface ViewportConfig {
|
|
112
|
+
once?: boolean;
|
|
113
|
+
amount?: "some" | "all" | number;
|
|
114
|
+
margin?: string;
|
|
115
|
+
}
|
|
116
|
+
interface DragConfig {
|
|
117
|
+
drag?: boolean | "x" | "y";
|
|
118
|
+
dragElastic?: number;
|
|
119
|
+
dragSnapToOrigin?: boolean;
|
|
120
|
+
dragMomentum?: boolean;
|
|
121
|
+
dragDirectionLock?: boolean;
|
|
122
|
+
dragConstraints?: {
|
|
123
|
+
top?: number;
|
|
124
|
+
left?: number;
|
|
125
|
+
right?: number;
|
|
126
|
+
bottom?: number;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
interface LayoutConfig {
|
|
130
|
+
layout?: boolean | "position" | "size" | "preserve-aspect";
|
|
131
|
+
layoutId?: string;
|
|
132
|
+
layoutScroll?: boolean;
|
|
133
|
+
layoutRoot?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface ScrollConfig {
|
|
136
|
+
/** Which scroll axis drives progress. Default "y". */
|
|
137
|
+
axis: "x" | "y";
|
|
138
|
+
/** Track the window/root scroll instead of the element's own position. */
|
|
139
|
+
container: boolean;
|
|
140
|
+
/** `useScroll` offset, e.g. ["start end", "end start"]. */
|
|
141
|
+
offset?: [string, string];
|
|
142
|
+
/** Map of motion style property → literal output range across scroll progress [0,1]. */
|
|
143
|
+
values: Record<string, number[]>;
|
|
144
|
+
}
|
|
145
|
+
/** Named variant target states, keyed by variant name (e.g. "hidden", "visible"). */
|
|
146
|
+
type VariantMap = Record<string, AnimatableValues>;
|
|
147
|
+
/** Which variant name is active for each of Motion's lifecycle props. */
|
|
148
|
+
interface VariantState {
|
|
149
|
+
initial?: string;
|
|
150
|
+
animate?: string;
|
|
151
|
+
exit?: string;
|
|
152
|
+
}
|
|
153
|
+
interface ParsedResult {
|
|
154
|
+
/** Tailwind classes that pass through untouched */
|
|
155
|
+
tailwindClasses: string;
|
|
156
|
+
/** Gesture props mapped to their animatable values */
|
|
157
|
+
gestures: Partial<Record<GestureKey, AnimatableValues>>;
|
|
158
|
+
/** Transition configuration */
|
|
159
|
+
transition: TransitionConfig;
|
|
160
|
+
/** Viewport configuration for whileInView */
|
|
161
|
+
viewport: ViewportConfig;
|
|
162
|
+
/** Drag configuration */
|
|
163
|
+
dragConfig: DragConfig;
|
|
164
|
+
/** Layout animation configuration */
|
|
165
|
+
layoutConfig: LayoutConfig;
|
|
166
|
+
/** Scroll-linked animation configuration (progress-driven style values) */
|
|
167
|
+
scroll: ScrollConfig;
|
|
168
|
+
/** Named variant target states */
|
|
169
|
+
variants: VariantMap;
|
|
170
|
+
/** Active variant state selectors (initial/animate/exit as variant names) */
|
|
171
|
+
variantState: VariantState;
|
|
172
|
+
/** Whether any motion classes were found */
|
|
173
|
+
hasMotion: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Reduced motion policy from `motion-reduce:` / `motion-safe:` class
|
|
176
|
+
* prefixes. `"reduce"` means apply only when `prefers-reduced-motion:
|
|
177
|
+
* reduce`; `"safe"` means apply only when `prefers-reduced-motion:
|
|
178
|
+
* no-preference`.
|
|
179
|
+
*/
|
|
180
|
+
reducedMotionPolicy?: "reduce" | "safe";
|
|
181
|
+
/** Non-fatal parser and plugin diagnostics. */
|
|
182
|
+
diagnostics: MotionwindDiagnostic[];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { type AnimatableValues as A, CONFIG_DEFINITIONS as C, DEFAULT_MOTIONWIND_CONFIG as D, EASING_MAP as E, GESTURE_DEFINITIONS as G, type LayoutConfig as L, type MotionwindConfig as M, PROPERTY_DEFINITIONS as P, type ReducedMotionPolicy as R, type ScrollConfig as S, type TransitionConfig as T, type VariantMap as V, type DragConfig as a, GESTURE_KEYS as b, GESTURE_MAP as c, type GestureKey as d, MOTIONWIND_SYNTAX_REGISTRY as e, type MotionwindDiagnostic as f, type MotionwindPlugin as g, type MotionwindResultPatch as h, type MotionwindTokens as i, type ParsedResult as j, type Platform as k, type SpringToken as l, type SyntaxCategory as m, type SyntaxDefinition as n, type VariantState as o, type ViewportConfig as p, defineConfig as q, defineMotionwindPlugin as r, definePreset as s, getSyntaxDefinitions as t, MODIFIER_DEFINITIONS as u, type MotionwindPluginContext as v };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
type SyntaxCategory = "gesture" | "property" | "transition" | "viewport" | "scroll" | "drag" | "layout" | "variant" | "preset" | "modifier";
|
|
2
|
+
type Platform = "react" | "vue" | "vanilla" | "react-native";
|
|
3
|
+
/** Machine-readable syntax metadata shared by docs, editors and diagnostics. */
|
|
4
|
+
interface SyntaxDefinition {
|
|
5
|
+
id: string;
|
|
6
|
+
category: SyntaxCategory;
|
|
7
|
+
label: string;
|
|
8
|
+
snippet: string;
|
|
9
|
+
description: string;
|
|
10
|
+
motionKey?: string;
|
|
11
|
+
platforms?: Platform[];
|
|
12
|
+
}
|
|
13
|
+
declare const GESTURE_DEFINITIONS: readonly [SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition];
|
|
14
|
+
/**
|
|
15
|
+
* Modifier prefixes that wrap an inner class token and control conditional
|
|
16
|
+
* application based on the user's motion preference media query.
|
|
17
|
+
*/
|
|
18
|
+
declare const MODIFIER_DEFINITIONS: readonly SyntaxDefinition[];
|
|
19
|
+
declare const PROPERTY_DEFINITIONS: readonly [SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, {
|
|
20
|
+
readonly id: "property.z-zIndex";
|
|
21
|
+
readonly category: "property";
|
|
22
|
+
readonly label: "z-";
|
|
23
|
+
readonly snippet: "z-${1|0,10,20,30,40,50,auto|}";
|
|
24
|
+
readonly motionKey: "zIndex";
|
|
25
|
+
readonly description: "Animate z-index (Tailwind values: 0, 10, 20, 30, 40, 50, auto). Non-standard values translate on the z axis instead.";
|
|
26
|
+
readonly platforms: Platform[];
|
|
27
|
+
}, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition];
|
|
28
|
+
declare const CONFIG_DEFINITIONS: readonly [SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition, SyntaxDefinition];
|
|
29
|
+
declare const MOTIONWIND_SYNTAX_REGISTRY: readonly SyntaxDefinition[];
|
|
30
|
+
declare const GESTURE_MAP: Record<string, GestureKey>;
|
|
31
|
+
declare const GESTURE_KEYS: Set<string>;
|
|
32
|
+
declare const EASING_MAP: Record<string, string>;
|
|
33
|
+
declare function getSyntaxDefinitions(category?: SyntaxCategory): readonly SyntaxDefinition[];
|
|
34
|
+
|
|
35
|
+
type ReducedMotionPolicy = "user" | "always" | "never";
|
|
36
|
+
interface SpringToken {
|
|
37
|
+
stiffness?: number;
|
|
38
|
+
damping?: number;
|
|
39
|
+
bounce?: number;
|
|
40
|
+
mass?: number;
|
|
41
|
+
}
|
|
42
|
+
interface MotionwindTokens {
|
|
43
|
+
durations?: Record<string, number>;
|
|
44
|
+
easings?: Record<string, string | number[]>;
|
|
45
|
+
springs?: Record<string, SpringToken>;
|
|
46
|
+
}
|
|
47
|
+
interface MotionwindDiagnostic {
|
|
48
|
+
code: string;
|
|
49
|
+
message: string;
|
|
50
|
+
severity: "info" | "warning" | "error";
|
|
51
|
+
token?: string;
|
|
52
|
+
plugin?: string;
|
|
53
|
+
}
|
|
54
|
+
interface MotionwindResultPatch {
|
|
55
|
+
gestures?: ParsedResult["gestures"];
|
|
56
|
+
transition?: ParsedResult["transition"];
|
|
57
|
+
viewport?: ParsedResult["viewport"];
|
|
58
|
+
dragConfig?: ParsedResult["dragConfig"];
|
|
59
|
+
layoutConfig?: ParsedResult["layoutConfig"];
|
|
60
|
+
scroll?: Partial<ParsedResult["scroll"]>;
|
|
61
|
+
variants?: ParsedResult["variants"];
|
|
62
|
+
variantState?: ParsedResult["variantState"];
|
|
63
|
+
}
|
|
64
|
+
interface MotionwindPluginContext {
|
|
65
|
+
config: MotionwindConfig;
|
|
66
|
+
}
|
|
67
|
+
interface MotionwindPlugin {
|
|
68
|
+
name: string;
|
|
69
|
+
version: string;
|
|
70
|
+
core?: string;
|
|
71
|
+
presets?: Record<string, string | readonly string[]>;
|
|
72
|
+
definitions?: readonly SyntaxDefinition[];
|
|
73
|
+
transformToken?: (token: string, context: MotionwindPluginContext) => MotionwindResultPatch | null;
|
|
74
|
+
diagnose?: (className: string, parsed: ParsedResult, context: MotionwindPluginContext) => readonly MotionwindDiagnostic[];
|
|
75
|
+
}
|
|
76
|
+
interface MotionwindConfig {
|
|
77
|
+
adapter?: string;
|
|
78
|
+
strict?: boolean;
|
|
79
|
+
reducedMotion?: ReducedMotionPolicy;
|
|
80
|
+
tokens?: MotionwindTokens;
|
|
81
|
+
presets?: Record<string, string | readonly string[]>;
|
|
82
|
+
plugins?: readonly MotionwindPlugin[];
|
|
83
|
+
}
|
|
84
|
+
declare function defineConfig<const T extends MotionwindConfig>(config: T): T;
|
|
85
|
+
declare function defineMotionwindPlugin<const T extends MotionwindPlugin>(plugin: T): T;
|
|
86
|
+
declare function definePreset<const T extends string | readonly string[]>(preset: T): T;
|
|
87
|
+
declare const DEFAULT_MOTIONWIND_CONFIG: Readonly<MotionwindConfig>;
|
|
88
|
+
|
|
89
|
+
type GestureKey = "whileHover" | "whileTap" | "whileFocus" | "whileInView" | "whileDrag" | "initial" | "animate" | "exit";
|
|
90
|
+
type AnimatableValues = Record<string, string | number | (string | number)[]>;
|
|
91
|
+
interface TransitionConfig {
|
|
92
|
+
type?: "spring" | "tween" | "inertia";
|
|
93
|
+
duration?: number;
|
|
94
|
+
delay?: number;
|
|
95
|
+
ease?: string | number[];
|
|
96
|
+
stiffness?: number;
|
|
97
|
+
damping?: number;
|
|
98
|
+
bounce?: number;
|
|
99
|
+
mass?: number;
|
|
100
|
+
repeat?: number;
|
|
101
|
+
repeatType?: "loop" | "reverse" | "mirror";
|
|
102
|
+
repeatDelay?: number;
|
|
103
|
+
staggerChildren?: number;
|
|
104
|
+
staggerDirection?: 1 | -1;
|
|
105
|
+
delayChildren?: number;
|
|
106
|
+
when?: "beforeChildren" | "afterChildren" | false;
|
|
107
|
+
restSpeed?: number;
|
|
108
|
+
restDelta?: number;
|
|
109
|
+
times?: number[];
|
|
110
|
+
}
|
|
111
|
+
interface ViewportConfig {
|
|
112
|
+
once?: boolean;
|
|
113
|
+
amount?: "some" | "all" | number;
|
|
114
|
+
margin?: string;
|
|
115
|
+
}
|
|
116
|
+
interface DragConfig {
|
|
117
|
+
drag?: boolean | "x" | "y";
|
|
118
|
+
dragElastic?: number;
|
|
119
|
+
dragSnapToOrigin?: boolean;
|
|
120
|
+
dragMomentum?: boolean;
|
|
121
|
+
dragDirectionLock?: boolean;
|
|
122
|
+
dragConstraints?: {
|
|
123
|
+
top?: number;
|
|
124
|
+
left?: number;
|
|
125
|
+
right?: number;
|
|
126
|
+
bottom?: number;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
interface LayoutConfig {
|
|
130
|
+
layout?: boolean | "position" | "size" | "preserve-aspect";
|
|
131
|
+
layoutId?: string;
|
|
132
|
+
layoutScroll?: boolean;
|
|
133
|
+
layoutRoot?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface ScrollConfig {
|
|
136
|
+
/** Which scroll axis drives progress. Default "y". */
|
|
137
|
+
axis: "x" | "y";
|
|
138
|
+
/** Track the window/root scroll instead of the element's own position. */
|
|
139
|
+
container: boolean;
|
|
140
|
+
/** `useScroll` offset, e.g. ["start end", "end start"]. */
|
|
141
|
+
offset?: [string, string];
|
|
142
|
+
/** Map of motion style property → literal output range across scroll progress [0,1]. */
|
|
143
|
+
values: Record<string, number[]>;
|
|
144
|
+
}
|
|
145
|
+
/** Named variant target states, keyed by variant name (e.g. "hidden", "visible"). */
|
|
146
|
+
type VariantMap = Record<string, AnimatableValues>;
|
|
147
|
+
/** Which variant name is active for each of Motion's lifecycle props. */
|
|
148
|
+
interface VariantState {
|
|
149
|
+
initial?: string;
|
|
150
|
+
animate?: string;
|
|
151
|
+
exit?: string;
|
|
152
|
+
}
|
|
153
|
+
interface ParsedResult {
|
|
154
|
+
/** Tailwind classes that pass through untouched */
|
|
155
|
+
tailwindClasses: string;
|
|
156
|
+
/** Gesture props mapped to their animatable values */
|
|
157
|
+
gestures: Partial<Record<GestureKey, AnimatableValues>>;
|
|
158
|
+
/** Transition configuration */
|
|
159
|
+
transition: TransitionConfig;
|
|
160
|
+
/** Viewport configuration for whileInView */
|
|
161
|
+
viewport: ViewportConfig;
|
|
162
|
+
/** Drag configuration */
|
|
163
|
+
dragConfig: DragConfig;
|
|
164
|
+
/** Layout animation configuration */
|
|
165
|
+
layoutConfig: LayoutConfig;
|
|
166
|
+
/** Scroll-linked animation configuration (progress-driven style values) */
|
|
167
|
+
scroll: ScrollConfig;
|
|
168
|
+
/** Named variant target states */
|
|
169
|
+
variants: VariantMap;
|
|
170
|
+
/** Active variant state selectors (initial/animate/exit as variant names) */
|
|
171
|
+
variantState: VariantState;
|
|
172
|
+
/** Whether any motion classes were found */
|
|
173
|
+
hasMotion: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Reduced motion policy from `motion-reduce:` / `motion-safe:` class
|
|
176
|
+
* prefixes. `"reduce"` means apply only when `prefers-reduced-motion:
|
|
177
|
+
* reduce`; `"safe"` means apply only when `prefers-reduced-motion:
|
|
178
|
+
* no-preference`.
|
|
179
|
+
*/
|
|
180
|
+
reducedMotionPolicy?: "reduce" | "safe";
|
|
181
|
+
/** Non-fatal parser and plugin diagnostics. */
|
|
182
|
+
diagnostics: MotionwindDiagnostic[];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { type AnimatableValues as A, CONFIG_DEFINITIONS as C, DEFAULT_MOTIONWIND_CONFIG as D, EASING_MAP as E, GESTURE_DEFINITIONS as G, type LayoutConfig as L, type MotionwindConfig as M, PROPERTY_DEFINITIONS as P, type ReducedMotionPolicy as R, type ScrollConfig as S, type TransitionConfig as T, type VariantMap as V, type DragConfig as a, GESTURE_KEYS as b, GESTURE_MAP as c, type GestureKey as d, MOTIONWIND_SYNTAX_REGISTRY as e, type MotionwindDiagnostic as f, type MotionwindPlugin as g, type MotionwindResultPatch as h, type MotionwindTokens as i, type ParsedResult as j, type Platform as k, type SpringToken as l, type SyntaxCategory as m, type SyntaxDefinition as n, type VariantState as o, type ViewportConfig as p, defineConfig as q, defineMotionwindPlugin as r, definePreset as s, getSyntaxDefinitions as t, MODIFIER_DEFINITIONS as u, type MotionwindPluginContext as v };
|
package/llms.txt
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# motionwind-core v2.0.0 — machine reference
|
|
2
|
+
|
|
3
|
+
motionwind-core is the only Motionwind syntax/parser/type/config/registry
|
|
4
|
+
implementation. Framework adapters consume its Motion-first ParsedResult.
|
|
5
|
+
|
|
6
|
+
Install: npm install motionwind-core@2
|
|
7
|
+
|
|
8
|
+
Primary exports:
|
|
9
|
+
- parseMotionClasses(className, config?) and clearParserCache()
|
|
10
|
+
- classifyMotionToken(), analyzeClassName(), sortMotionClasses()
|
|
11
|
+
- defineConfig(), definePreset(), defineMotionwindPlugin()
|
|
12
|
+
- defineMotionwindAdapter(), unsupportedCapabilities()
|
|
13
|
+
- MOTIONWIND_SYNTAX_REGISTRY, getSyntaxDefinitions()
|
|
14
|
+
- MOTIONWIND_RECIPES and BUILT_IN_PRESETS
|
|
15
|
+
- ParsedResult, MotionwindConfig, MotionwindDiagnostic, AdapterCapabilities types
|
|
16
|
+
|
|
17
|
+
Configuration:
|
|
18
|
+
```ts
|
|
19
|
+
const config = defineConfig({
|
|
20
|
+
adapter: "react",
|
|
21
|
+
strict: true,
|
|
22
|
+
reducedMotion: "user", // user | always | never
|
|
23
|
+
tokens: {
|
|
24
|
+
durations: { fast: 160 },
|
|
25
|
+
easings: { product: [0.22, 1, 0.36, 1] },
|
|
26
|
+
springs: { responsive: { stiffness: 420, damping: 28 } },
|
|
27
|
+
},
|
|
28
|
+
presets: {
|
|
29
|
+
pop: "animate-initial:scale-95 animate-enter:scale-100 animate-spring-responsive",
|
|
30
|
+
},
|
|
31
|
+
plugins: [],
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
ParsedResult:
|
|
36
|
+
```ts
|
|
37
|
+
interface ParsedResult {
|
|
38
|
+
tailwindClasses: string;
|
|
39
|
+
gestures: Partial<Record<GestureKey, AnimatableValues>>;
|
|
40
|
+
transition: TransitionConfig;
|
|
41
|
+
viewport: ViewportConfig;
|
|
42
|
+
dragConfig: DragConfig;
|
|
43
|
+
layoutConfig: LayoutConfig;
|
|
44
|
+
scroll: ScrollConfig;
|
|
45
|
+
variants: Record<string, AnimatableValues>;
|
|
46
|
+
variantState: { initial?: string; animate?: string; exit?: string };
|
|
47
|
+
diagnostics: MotionwindDiagnostic[];
|
|
48
|
+
hasMotion: boolean;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Syntax summary:
|
|
53
|
+
- gesture: animate-{hover|tap|focus|inview|drag|initial|enter|exit}:{property}-{value}
|
|
54
|
+
- transition: animate-duration-300, animate-delay-100, animate-ease-out,
|
|
55
|
+
animate-spring, animate-stiffness-400, animate-damping-24
|
|
56
|
+
- viewport: animate-once, animate-amount-50, animate-margin-100
|
|
57
|
+
- scroll: animate-scroll:y-[0,-200], animate-scroll:scaleX-[0,1],
|
|
58
|
+
animate-scroll-axis-x, animate-scroll-container
|
|
59
|
+
- drag: animate-drag-x, animate-drag-y, animate-drag-both and drag options
|
|
60
|
+
- layout: animate-layout, animate-layout-position, animate-layout-id-card
|
|
61
|
+
- variants: animate-variant-hidden:opacity-0, animate-from-hidden,
|
|
62
|
+
animate-to-visible, animate-exit-hidden
|
|
63
|
+
- presets: animate-preset-button-press or animate-preset-{configured-name}
|
|
64
|
+
- token values: animate-duration-fast, animate-ease-product,
|
|
65
|
+
animate-spring-responsive
|
|
66
|
+
|
|
67
|
+
Common properties include scale, scale-x/y, rotate, rotate-x/y, skew-x/y, x,
|
|
68
|
+
y, opacity, colors, width/height, radius, spacing, typography, filters, clip
|
|
69
|
+
path, shadows, and SVG path values. Read MOTIONWIND_SYNTAX_REGISTRY rather than
|
|
70
|
+
maintaining a duplicate property list.
|
|
71
|
+
|
|
72
|
+
AdapterCapabilities keys are gestures, scroll, layout, drag, variants, svg,
|
|
73
|
+
and reduced-motion. An adapter must report gaps; it must not silently accept an
|
|
74
|
+
unsupported capability.
|
|
75
|
+
|
|
76
|
+
Plugins can contribute presets, syntax definitions, token transforms, and
|
|
77
|
+
diagnostics. Their optional core field declares a compatible core range.
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "motionwind-core",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"description": "Framework-agnostic core for motionwind — parses animate-* classes into structured motion props. Zero dependencies.",
|
|
7
|
+
"author": "piyush555",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/piyushzingade/motionwind.git",
|
|
12
|
+
"directory": "packages/motionwind-core"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/piyushzingade/motionwind/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/piyushzingade/motionwind#readme",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"motionwind",
|
|
20
|
+
"motion",
|
|
21
|
+
"animation",
|
|
22
|
+
"tailwind",
|
|
23
|
+
"parser"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./parser": {
|
|
31
|
+
"import": "./dist/parser.js",
|
|
32
|
+
"require": "./dist/parser.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./config": {
|
|
35
|
+
"import": "./dist/config.js",
|
|
36
|
+
"require": "./dist/config.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./registry": {
|
|
39
|
+
"import": "./dist/registry.js",
|
|
40
|
+
"require": "./dist/registry.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./adapter": {
|
|
43
|
+
"import": "./dist/adapter.js",
|
|
44
|
+
"require": "./dist/adapter.cjs"
|
|
45
|
+
},
|
|
46
|
+
"./recipes": {
|
|
47
|
+
"import": "./dist/recipes.js",
|
|
48
|
+
"require": "./dist/recipes.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"main": "./dist/index.cjs",
|
|
52
|
+
"module": "./dist/index.js",
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"typesVersions": {
|
|
55
|
+
"*": {
|
|
56
|
+
"parser": [
|
|
57
|
+
"./dist/parser.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"config": [
|
|
60
|
+
"./dist/config.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"registry": [
|
|
63
|
+
"./dist/registry.d.ts"
|
|
64
|
+
],
|
|
65
|
+
"adapter": [
|
|
66
|
+
"./dist/adapter.d.ts"
|
|
67
|
+
],
|
|
68
|
+
"recipes": [
|
|
69
|
+
"./dist/recipes.d.ts"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"dist",
|
|
75
|
+
"llms.txt"
|
|
76
|
+
],
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "tsup",
|
|
79
|
+
"dev": "tsup --watch",
|
|
80
|
+
"test": "vitest run",
|
|
81
|
+
"test:watch": "vitest",
|
|
82
|
+
"lint": "eslint --max-warnings 0",
|
|
83
|
+
"check-types": "tsc --noEmit"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@repo/eslint-config": "*",
|
|
87
|
+
"@repo/typescript-config": "*",
|
|
88
|
+
"eslint": "^9.39.1",
|
|
89
|
+
"tsup": "^8.5.0",
|
|
90
|
+
"typescript": "5.9.2",
|
|
91
|
+
"vitest": "^3.2.1"
|
|
92
|
+
},
|
|
93
|
+
"publishConfig": {
|
|
94
|
+
"access": "public"
|
|
95
|
+
}
|
|
96
|
+
}
|