@bug-on/md3-tokens 3.0.1 → 3.0.3
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/.turbo/turbo-build.log +27 -28
- package/dist/colors.css.d.ts +2 -0
- package/dist/index.d.mts +448 -45
- package/dist/index.d.ts +448 -45
- package/dist/index.js +258 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -9
- package/dist/index.mjs.map +1 -1
- package/dist/shape.css +9 -0
- package/dist/shape.css.d.ts +2 -0
- package/package.json +11 -6
- package/src/index.ts +47 -1
- package/src/motion.ts +280 -9
- package/src/shape.css +9 -0
- package/src/shape.ts +162 -0
- package/tsup.config.ts +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
✅
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
DTS dist/index.d.ts 3.11 KB
|
|
1
|
+
|
|
2
|
+
> @bug-on/md3-tokens@3.0.3 build /home/runner/work/bug-on-md3-expressive/bug-on-md3-expressive/packages/tokens
|
|
3
|
+
> tsup && node scripts/copy-css.js
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.5.1
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/bug-on-md3-expressive/bug-on-md3-expressive/packages/tokens/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: es2017
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[34mCJS[39m Build start
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m8.97 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m21.32 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 31ms
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m7.25 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m20.06 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 32ms
|
|
19
|
+
[34mDTS[39m Build start
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 1276ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m16.57 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m16.57 KB[39m
|
|
23
|
+
Copying CSS assets to dist...
|
|
24
|
+
✅ Copied colors.css to dist/colors.css
|
|
25
|
+
✅ Copied shape.css to dist/shape.css
|
|
26
|
+
✅ Generated colors.css.d.ts
|
|
27
|
+
✅ Generated shape.css.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,204 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MD3 Expressive Motion Tokens
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Source of truth for all motion in the design system. Two layers:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Physics-based system** (May 2025, primary) — Spring tokens per the MD3
|
|
7
|
+
* motion physics system. Use these for Framer Motion / JS animations.
|
|
8
|
+
* 2. **Legacy easing + duration** (still valid for CSS transitions) — Original
|
|
9
|
+
* MD3 cubic-bezier tokens kept as a fallback.
|
|
10
|
+
*
|
|
11
|
+
* @see https://m3.material.io/styles/motion/overview/how-it-works
|
|
12
|
+
* @see https://m3.material.io/styles/motion/overview/specs
|
|
4
13
|
*/
|
|
14
|
+
/** Motion scheme — controls whether springs bounce (expressive) or not (standard). */
|
|
15
|
+
type MotionScheme = "expressive" | "standard";
|
|
16
|
+
/** Spring speed tier. */
|
|
17
|
+
type SpringSpeed = "fast" | "default" | "slow";
|
|
18
|
+
/** Spring type — spatial (position/size/shape) or effects (color/opacity). */
|
|
19
|
+
type SpringType = "spatial" | "effects";
|
|
20
|
+
/** Raw MD3 spring token — damping ratio + stiffness as specified in the design token. */
|
|
21
|
+
interface MD3SpringToken {
|
|
22
|
+
/** Damping ratio: 0 = no damping, 1 = critically damped (no bounce). */
|
|
23
|
+
dampingRatio: number;
|
|
24
|
+
/** Spring stiffness. Higher = faster animation. */
|
|
25
|
+
stiffness: number;
|
|
26
|
+
}
|
|
27
|
+
/** A pre-converted spring ready for Framer Motion `Transition`. */
|
|
28
|
+
interface FramerSpring {
|
|
29
|
+
type: "spring";
|
|
30
|
+
/** Absolute damping coefficient (converted from dampingRatio). */
|
|
31
|
+
damping: number;
|
|
32
|
+
stiffness: number;
|
|
33
|
+
}
|
|
34
|
+
/** Web CSS curve equivalent for a spring token (for CSS transitions). */
|
|
35
|
+
interface WebCurveToken {
|
|
36
|
+
/** CSS cubic-bezier(...) string. */
|
|
37
|
+
curve: string;
|
|
38
|
+
/** Duration in milliseconds. */
|
|
39
|
+
durationMs: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Raw MD3 spring tokens per the official specification.
|
|
43
|
+
* Values are identical for both "expressive" and "standard" schemes —
|
|
44
|
+
* the scheme is applied at the product level, not the token level.
|
|
45
|
+
*
|
|
46
|
+
* @see https://m3.material.io/styles/motion/easing-and-duration/tokens-specs
|
|
47
|
+
*/
|
|
48
|
+
declare const md3SpringTokens: {
|
|
49
|
+
readonly fast: {
|
|
50
|
+
readonly spatial: {
|
|
51
|
+
dampingRatio: number;
|
|
52
|
+
stiffness: number;
|
|
53
|
+
};
|
|
54
|
+
readonly effects: {
|
|
55
|
+
dampingRatio: number;
|
|
56
|
+
stiffness: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly default: {
|
|
60
|
+
readonly spatial: {
|
|
61
|
+
dampingRatio: number;
|
|
62
|
+
stiffness: number;
|
|
63
|
+
};
|
|
64
|
+
readonly effects: {
|
|
65
|
+
dampingRatio: number;
|
|
66
|
+
stiffness: number;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
readonly slow: {
|
|
70
|
+
readonly spatial: {
|
|
71
|
+
dampingRatio: number;
|
|
72
|
+
stiffness: number;
|
|
73
|
+
};
|
|
74
|
+
readonly effects: {
|
|
75
|
+
dampingRatio: number;
|
|
76
|
+
stiffness: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Ready-to-use Framer Motion spring configs, derived from MD3 spring tokens.
|
|
82
|
+
*
|
|
83
|
+
* Use **spatial** springs for: position, size, border-radius, rotation, scale.
|
|
84
|
+
* Use **effects** springs for: color, opacity (no overshoot).
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* import { framerSprings } from "@md3-expressive/tokens";
|
|
89
|
+
* <m.div transition={framerSprings.fast.spatial} />
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare const framerSprings: {
|
|
93
|
+
readonly fast: {
|
|
94
|
+
readonly spatial: FramerSpring;
|
|
95
|
+
readonly effects: FramerSpring;
|
|
96
|
+
};
|
|
97
|
+
readonly default: {
|
|
98
|
+
readonly spatial: FramerSpring;
|
|
99
|
+
readonly effects: FramerSpring;
|
|
100
|
+
};
|
|
101
|
+
readonly slow: {
|
|
102
|
+
readonly spatial: FramerSpring;
|
|
103
|
+
readonly effects: FramerSpring;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
declare const FAST_SPATIAL_SPRING: FramerSpring;
|
|
107
|
+
declare const FAST_EFFECTS_SPRING: FramerSpring;
|
|
108
|
+
declare const DEFAULT_SPATIAL_SPRING: FramerSpring;
|
|
109
|
+
declare const DEFAULT_EFFECTS_SPRING: FramerSpring;
|
|
110
|
+
declare const SLOW_SPATIAL_SPRING: FramerSpring;
|
|
111
|
+
declare const SLOW_EFFECTS_SPRING: FramerSpring;
|
|
112
|
+
/**
|
|
113
|
+
* CSS cubic-bezier + duration equivalents of MD3 spring tokens.
|
|
114
|
+
* For non-interruptible CSS transitions when JS springs are unavailable.
|
|
115
|
+
*
|
|
116
|
+
* @see https://m3.material.io/styles/motion/overview/specs
|
|
117
|
+
*/
|
|
118
|
+
declare const webCurves: {
|
|
119
|
+
readonly expressive: {
|
|
120
|
+
readonly fast: {
|
|
121
|
+
readonly spatial: {
|
|
122
|
+
curve: string;
|
|
123
|
+
durationMs: number;
|
|
124
|
+
};
|
|
125
|
+
readonly effects: {
|
|
126
|
+
curve: string;
|
|
127
|
+
durationMs: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
readonly default: {
|
|
131
|
+
readonly spatial: {
|
|
132
|
+
curve: string;
|
|
133
|
+
durationMs: number;
|
|
134
|
+
};
|
|
135
|
+
readonly effects: {
|
|
136
|
+
curve: string;
|
|
137
|
+
durationMs: number;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
readonly slow: {
|
|
141
|
+
readonly spatial: {
|
|
142
|
+
curve: string;
|
|
143
|
+
durationMs: number;
|
|
144
|
+
};
|
|
145
|
+
readonly effects: {
|
|
146
|
+
curve: string;
|
|
147
|
+
durationMs: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
readonly standard: {
|
|
152
|
+
readonly fast: {
|
|
153
|
+
readonly spatial: {
|
|
154
|
+
curve: string;
|
|
155
|
+
durationMs: number;
|
|
156
|
+
};
|
|
157
|
+
readonly effects: {
|
|
158
|
+
curve: string;
|
|
159
|
+
durationMs: number;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
readonly default: {
|
|
163
|
+
readonly spatial: {
|
|
164
|
+
curve: string;
|
|
165
|
+
durationMs: number;
|
|
166
|
+
};
|
|
167
|
+
readonly effects: {
|
|
168
|
+
curve: string;
|
|
169
|
+
durationMs: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
readonly slow: {
|
|
173
|
+
readonly spatial: {
|
|
174
|
+
curve: string;
|
|
175
|
+
durationMs: number;
|
|
176
|
+
};
|
|
177
|
+
readonly effects: {
|
|
178
|
+
curve: string;
|
|
179
|
+
durationMs: number;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Get a Framer Motion spring config for the given scheme, speed, and type.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```tsx
|
|
189
|
+
* transition={getSpring("expressive", "fast", "spatial")}
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare function getSpring(_scheme: MotionScheme, speed: SpringSpeed, type: SpringType): FramerSpring;
|
|
193
|
+
/**
|
|
194
|
+
* Get a CSS transition string for the given scheme, speed, and type.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* element.style.transition = `transform ${getCSSTransition("expressive", "fast", "spatial")}`;
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
declare function getCSSTransition(scheme: MotionScheme, speed: SpringSpeed, type: SpringType): string;
|
|
5
202
|
declare const duration: {
|
|
6
203
|
readonly short1: 50;
|
|
7
204
|
readonly short2: 100;
|
|
@@ -21,38 +218,30 @@ declare const duration: {
|
|
|
21
218
|
readonly extraLong4: 1000;
|
|
22
219
|
};
|
|
23
220
|
declare const easing: {
|
|
24
|
-
readonly standard: [number, number, number, number];
|
|
25
|
-
readonly standardAccelerate: [number, number, number, number];
|
|
26
|
-
readonly standardDecelerate: [number, number, number, number];
|
|
27
221
|
readonly emphasized: [number, number, number, number];
|
|
28
222
|
readonly emphasizedAccelerate: [number, number, number, number];
|
|
29
223
|
readonly emphasizedDecelerate: [number, number, number, number];
|
|
224
|
+
readonly standard: [number, number, number, number];
|
|
225
|
+
readonly standardAccelerate: [number, number, number, number];
|
|
226
|
+
readonly standardDecelerate: [number, number, number, number];
|
|
227
|
+
readonly legacy: [number, number, number, number];
|
|
228
|
+
readonly legacyAccelerate: [number, number, number, number];
|
|
229
|
+
readonly legacyDecelerate: [number, number, number, number];
|
|
230
|
+
readonly linear: [number, number, number, number];
|
|
30
231
|
};
|
|
232
|
+
/** @deprecated Use `framerSprings.default.spatial` or `DEFAULT_SPATIAL_SPRING` instead. */
|
|
31
233
|
declare const spring: {
|
|
32
|
-
readonly default:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
readonly damping: 30;
|
|
36
|
-
readonly mass: 0.8;
|
|
37
|
-
};
|
|
38
|
-
readonly snappy: {
|
|
39
|
-
readonly type: "spring";
|
|
40
|
-
readonly stiffness: 600;
|
|
41
|
-
readonly damping: 25;
|
|
42
|
-
};
|
|
43
|
-
readonly gentle: {
|
|
44
|
-
readonly type: "spring";
|
|
45
|
-
readonly stiffness: 300;
|
|
46
|
-
readonly damping: 20;
|
|
47
|
-
};
|
|
234
|
+
readonly default: FramerSpring;
|
|
235
|
+
readonly snappy: FramerSpring;
|
|
236
|
+
readonly gentle: FramerSpring;
|
|
48
237
|
readonly bouncy: {
|
|
238
|
+
readonly damping: number;
|
|
49
239
|
readonly type: "spring";
|
|
50
|
-
readonly stiffness:
|
|
51
|
-
readonly damping: 15;
|
|
240
|
+
readonly stiffness: number;
|
|
52
241
|
};
|
|
53
242
|
};
|
|
54
243
|
declare const motionTokens: {
|
|
55
|
-
duration: {
|
|
244
|
+
readonly duration: {
|
|
56
245
|
readonly short1: 50;
|
|
57
246
|
readonly short2: 100;
|
|
58
247
|
readonly short3: 150;
|
|
@@ -70,37 +259,251 @@ declare const motionTokens: {
|
|
|
70
259
|
readonly extraLong3: 900;
|
|
71
260
|
readonly extraLong4: 1000;
|
|
72
261
|
};
|
|
73
|
-
easing: {
|
|
74
|
-
readonly standard: [number, number, number, number];
|
|
75
|
-
readonly standardAccelerate: [number, number, number, number];
|
|
76
|
-
readonly standardDecelerate: [number, number, number, number];
|
|
262
|
+
readonly easing: {
|
|
77
263
|
readonly emphasized: [number, number, number, number];
|
|
78
264
|
readonly emphasizedAccelerate: [number, number, number, number];
|
|
79
265
|
readonly emphasizedDecelerate: [number, number, number, number];
|
|
266
|
+
readonly standard: [number, number, number, number];
|
|
267
|
+
readonly standardAccelerate: [number, number, number, number];
|
|
268
|
+
readonly standardDecelerate: [number, number, number, number];
|
|
269
|
+
readonly legacy: [number, number, number, number];
|
|
270
|
+
readonly legacyAccelerate: [number, number, number, number];
|
|
271
|
+
readonly legacyDecelerate: [number, number, number, number];
|
|
272
|
+
readonly linear: [number, number, number, number];
|
|
273
|
+
};
|
|
274
|
+
readonly spring: {
|
|
275
|
+
readonly fast: {
|
|
276
|
+
readonly spatial: {
|
|
277
|
+
dampingRatio: number;
|
|
278
|
+
stiffness: number;
|
|
279
|
+
};
|
|
280
|
+
readonly effects: {
|
|
281
|
+
dampingRatio: number;
|
|
282
|
+
stiffness: number;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
readonly default: {
|
|
286
|
+
readonly spatial: {
|
|
287
|
+
dampingRatio: number;
|
|
288
|
+
stiffness: number;
|
|
289
|
+
};
|
|
290
|
+
readonly effects: {
|
|
291
|
+
dampingRatio: number;
|
|
292
|
+
stiffness: number;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
readonly slow: {
|
|
296
|
+
readonly spatial: {
|
|
297
|
+
dampingRatio: number;
|
|
298
|
+
stiffness: number;
|
|
299
|
+
};
|
|
300
|
+
readonly effects: {
|
|
301
|
+
dampingRatio: number;
|
|
302
|
+
stiffness: number;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
80
305
|
};
|
|
81
|
-
|
|
306
|
+
readonly framerSprings: {
|
|
307
|
+
readonly fast: {
|
|
308
|
+
readonly spatial: FramerSpring;
|
|
309
|
+
readonly effects: FramerSpring;
|
|
310
|
+
};
|
|
82
311
|
readonly default: {
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
85
|
-
readonly damping: 30;
|
|
86
|
-
readonly mass: 0.8;
|
|
312
|
+
readonly spatial: FramerSpring;
|
|
313
|
+
readonly effects: FramerSpring;
|
|
87
314
|
};
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
91
|
-
readonly damping: 25;
|
|
315
|
+
readonly slow: {
|
|
316
|
+
readonly spatial: FramerSpring;
|
|
317
|
+
readonly effects: FramerSpring;
|
|
92
318
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
readonly
|
|
319
|
+
};
|
|
320
|
+
readonly webCurves: {
|
|
321
|
+
readonly expressive: {
|
|
322
|
+
readonly fast: {
|
|
323
|
+
readonly spatial: {
|
|
324
|
+
curve: string;
|
|
325
|
+
durationMs: number;
|
|
326
|
+
};
|
|
327
|
+
readonly effects: {
|
|
328
|
+
curve: string;
|
|
329
|
+
durationMs: number;
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
readonly default: {
|
|
333
|
+
readonly spatial: {
|
|
334
|
+
curve: string;
|
|
335
|
+
durationMs: number;
|
|
336
|
+
};
|
|
337
|
+
readonly effects: {
|
|
338
|
+
curve: string;
|
|
339
|
+
durationMs: number;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
readonly slow: {
|
|
343
|
+
readonly spatial: {
|
|
344
|
+
curve: string;
|
|
345
|
+
durationMs: number;
|
|
346
|
+
};
|
|
347
|
+
readonly effects: {
|
|
348
|
+
curve: string;
|
|
349
|
+
durationMs: number;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
97
352
|
};
|
|
98
|
-
readonly
|
|
99
|
-
readonly
|
|
100
|
-
|
|
101
|
-
|
|
353
|
+
readonly standard: {
|
|
354
|
+
readonly fast: {
|
|
355
|
+
readonly spatial: {
|
|
356
|
+
curve: string;
|
|
357
|
+
durationMs: number;
|
|
358
|
+
};
|
|
359
|
+
readonly effects: {
|
|
360
|
+
curve: string;
|
|
361
|
+
durationMs: number;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
readonly default: {
|
|
365
|
+
readonly spatial: {
|
|
366
|
+
curve: string;
|
|
367
|
+
durationMs: number;
|
|
368
|
+
};
|
|
369
|
+
readonly effects: {
|
|
370
|
+
curve: string;
|
|
371
|
+
durationMs: number;
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
readonly slow: {
|
|
375
|
+
readonly spatial: {
|
|
376
|
+
curve: string;
|
|
377
|
+
durationMs: number;
|
|
378
|
+
};
|
|
379
|
+
readonly effects: {
|
|
380
|
+
curve: string;
|
|
381
|
+
durationMs: number;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
102
384
|
};
|
|
103
385
|
};
|
|
104
386
|
};
|
|
105
387
|
|
|
106
|
-
|
|
388
|
+
/**
|
|
389
|
+
* MD3 Expressive Shape Tokens
|
|
390
|
+
*
|
|
391
|
+
* TypeScript counterpart to `shape.css`. Provides numeric corner radius values,
|
|
392
|
+
* CSS custom property names, and asymmetric corner helpers.
|
|
393
|
+
*
|
|
394
|
+
* Updated for M3 Expressive (May 2025): 10-level corner radius scale.
|
|
395
|
+
*
|
|
396
|
+
* @see https://m3.material.io/styles/shape/corner-radius-scale
|
|
397
|
+
*/
|
|
398
|
+
/**
|
|
399
|
+
* Numeric corner radius values (px) for all 10 shape scale levels.
|
|
400
|
+
* Map directly to `--md-sys-shape-corner-*` CSS custom properties.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```ts
|
|
404
|
+
* element.style.borderRadius = `${cornerRadius.medium}px`; // 12px
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
declare const cornerRadius: {
|
|
408
|
+
readonly none: 0;
|
|
409
|
+
readonly extraSmall: 4;
|
|
410
|
+
readonly small: 8;
|
|
411
|
+
readonly medium: 12;
|
|
412
|
+
readonly large: 16;
|
|
413
|
+
/** New in M3 Expressive (May 2025) */
|
|
414
|
+
readonly largeIncreased: 20;
|
|
415
|
+
readonly extraLarge: 28;
|
|
416
|
+
/** New in M3 Expressive (May 2025) */
|
|
417
|
+
readonly extraLargeIncreased: 32;
|
|
418
|
+
/** New in M3 Expressive (May 2025) */
|
|
419
|
+
readonly extraExtraLarge: 48;
|
|
420
|
+
readonly full: 9999;
|
|
421
|
+
};
|
|
422
|
+
type CornerRadiusKey = keyof typeof cornerRadius;
|
|
423
|
+
/**
|
|
424
|
+
* Maps each corner radius key to its CSS custom property name.
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```ts
|
|
428
|
+
* const cssVar = cornerCssVar.medium; // "--md-sys-shape-corner-medium"
|
|
429
|
+
* element.style.borderRadius = `var(${cssVar})`;
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
declare const cornerCssVar: Record<CornerRadiusKey, string>;
|
|
433
|
+
/**
|
|
434
|
+
* Describes per-corner rounding for asymmetric shapes.
|
|
435
|
+
* Follows CSS `border-radius` shorthand order:
|
|
436
|
+
* top-left, top-right, bottom-right, bottom-left.
|
|
437
|
+
*/
|
|
438
|
+
interface AsymmetricCorners {
|
|
439
|
+
topLeft: number;
|
|
440
|
+
topRight: number;
|
|
441
|
+
bottomRight: number;
|
|
442
|
+
bottomLeft: number;
|
|
443
|
+
}
|
|
444
|
+
/** Shorthand presets for common asymmetric corner patterns. */
|
|
445
|
+
declare const asymmetricCorners: {
|
|
446
|
+
/** Fully rounded top, square bottom — e.g. menu at top of screen. */
|
|
447
|
+
readonly topFull: (r?: 28) => AsymmetricCorners;
|
|
448
|
+
/** Square top, fully rounded bottom — e.g. menu at bottom of screen. */
|
|
449
|
+
readonly bottomFull: (r?: 28) => AsymmetricCorners;
|
|
450
|
+
/** Rounded start edge only — e.g. left item in a grouped set. */
|
|
451
|
+
readonly startFull: (r?: 9999) => AsymmetricCorners;
|
|
452
|
+
/** Rounded end edge only — e.g. right item in a grouped set. */
|
|
453
|
+
readonly endFull: (r?: 9999) => AsymmetricCorners;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Converts an `AsymmetricCorners` object to a CSS `border-radius` string.
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```ts
|
|
460
|
+
* element.style.borderRadius = toCSS(asymmetricCorners.topFull());
|
|
461
|
+
* // "28px 28px 0px 0px"
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
declare function asymmetricCornersToCSS(corners: AsymmetricCorners): string;
|
|
465
|
+
/**
|
|
466
|
+
* Calculates the inner border-radius that maintains optical roundness
|
|
467
|
+
* when nesting one rounded container inside another.
|
|
468
|
+
*
|
|
469
|
+
* Formula: `inner = outer - padding`
|
|
470
|
+
*
|
|
471
|
+
* @see https://m3.material.io/styles/shape/corner-radius-scale#adjust-for-optical-roundness
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* ```ts
|
|
475
|
+
* // Container has extraExtraLarge (48px), padding is 14px
|
|
476
|
+
* const inner = opticalRadius(cornerRadius.extraExtraLarge, 14); // 34
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
declare function opticalRadius(outerRadius: number, padding: number): number;
|
|
480
|
+
declare const shapeTokens: {
|
|
481
|
+
readonly cornerRadius: {
|
|
482
|
+
readonly none: 0;
|
|
483
|
+
readonly extraSmall: 4;
|
|
484
|
+
readonly small: 8;
|
|
485
|
+
readonly medium: 12;
|
|
486
|
+
readonly large: 16;
|
|
487
|
+
/** New in M3 Expressive (May 2025) */
|
|
488
|
+
readonly largeIncreased: 20;
|
|
489
|
+
readonly extraLarge: 28;
|
|
490
|
+
/** New in M3 Expressive (May 2025) */
|
|
491
|
+
readonly extraLargeIncreased: 32;
|
|
492
|
+
/** New in M3 Expressive (May 2025) */
|
|
493
|
+
readonly extraExtraLarge: 48;
|
|
494
|
+
readonly full: 9999;
|
|
495
|
+
};
|
|
496
|
+
readonly cornerCssVar: Record<"none" | "extraSmall" | "small" | "medium" | "large" | "largeIncreased" | "extraLarge" | "extraLargeIncreased" | "extraExtraLarge" | "full", string>;
|
|
497
|
+
readonly asymmetricCorners: {
|
|
498
|
+
/** Fully rounded top, square bottom — e.g. menu at top of screen. */
|
|
499
|
+
readonly topFull: (r?: 28) => AsymmetricCorners;
|
|
500
|
+
/** Square top, fully rounded bottom — e.g. menu at bottom of screen. */
|
|
501
|
+
readonly bottomFull: (r?: 28) => AsymmetricCorners;
|
|
502
|
+
/** Rounded start edge only — e.g. left item in a grouped set. */
|
|
503
|
+
readonly startFull: (r?: 9999) => AsymmetricCorners;
|
|
504
|
+
/** Rounded end edge only — e.g. right item in a grouped set. */
|
|
505
|
+
readonly endFull: (r?: 9999) => AsymmetricCorners;
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
export { type AsymmetricCorners, type CornerRadiusKey, DEFAULT_EFFECTS_SPRING, DEFAULT_SPATIAL_SPRING, FAST_EFFECTS_SPRING, FAST_SPATIAL_SPRING, type FramerSpring, type MD3SpringToken, type MotionScheme, SLOW_EFFECTS_SPRING, SLOW_SPATIAL_SPRING, type SpringSpeed, type SpringType, type WebCurveToken, asymmetricCorners, asymmetricCornersToCSS, cornerCssVar, cornerRadius, duration, easing, framerSprings, getCSSTransition, getSpring, md3SpringTokens, motionTokens, opticalRadius, shapeTokens, spring, webCurves };
|