@bug-on/md3-tokens 3.0.0 → 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/dist/index.js CHANGED
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __export = (target, all) => {
7
24
  for (var name in all)
8
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,14 +37,142 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
37
  // src/index.ts
21
38
  var index_exports = {};
22
39
  __export(index_exports, {
40
+ DEFAULT_EFFECTS_SPRING: () => DEFAULT_EFFECTS_SPRING,
41
+ DEFAULT_SPATIAL_SPRING: () => DEFAULT_SPATIAL_SPRING,
42
+ FAST_EFFECTS_SPRING: () => FAST_EFFECTS_SPRING,
43
+ FAST_SPATIAL_SPRING: () => FAST_SPATIAL_SPRING,
44
+ SLOW_EFFECTS_SPRING: () => SLOW_EFFECTS_SPRING,
45
+ SLOW_SPATIAL_SPRING: () => SLOW_SPATIAL_SPRING,
46
+ asymmetricCorners: () => asymmetricCorners,
47
+ asymmetricCornersToCSS: () => asymmetricCornersToCSS,
48
+ cornerCssVar: () => cornerCssVar,
49
+ cornerRadius: () => cornerRadius,
23
50
  duration: () => duration,
24
51
  easing: () => easing,
52
+ framerSprings: () => framerSprings,
53
+ getCSSTransition: () => getCSSTransition,
54
+ getSpring: () => getSpring,
55
+ md3SpringTokens: () => md3SpringTokens,
25
56
  motionTokens: () => motionTokens,
26
- spring: () => spring
57
+ opticalRadius: () => opticalRadius,
58
+ shapeTokens: () => shapeTokens,
59
+ spring: () => spring,
60
+ webCurves: () => webCurves
27
61
  });
28
62
  module.exports = __toCommonJS(index_exports);
29
63
 
30
64
  // src/motion.ts
65
+ var md3SpringTokens = {
66
+ fast: {
67
+ spatial: { dampingRatio: 0.6, stiffness: 800 },
68
+ effects: { dampingRatio: 1, stiffness: 3800 }
69
+ },
70
+ default: {
71
+ spatial: { dampingRatio: 0.8, stiffness: 380 },
72
+ effects: { dampingRatio: 1, stiffness: 1600 }
73
+ },
74
+ slow: {
75
+ spatial: { dampingRatio: 0.8, stiffness: 200 },
76
+ effects: { dampingRatio: 1, stiffness: 800 }
77
+ }
78
+ };
79
+ function toFramerSpring(token) {
80
+ const damping = 2 * token.dampingRatio * Math.sqrt(token.stiffness);
81
+ return { type: "spring", stiffness: token.stiffness, damping };
82
+ }
83
+ var framerSprings = {
84
+ fast: {
85
+ spatial: toFramerSpring(md3SpringTokens.fast.spatial),
86
+ effects: toFramerSpring(md3SpringTokens.fast.effects)
87
+ },
88
+ default: {
89
+ spatial: toFramerSpring(md3SpringTokens.default.spatial),
90
+ effects: toFramerSpring(md3SpringTokens.default.effects)
91
+ },
92
+ slow: {
93
+ spatial: toFramerSpring(md3SpringTokens.slow.spatial),
94
+ effects: toFramerSpring(md3SpringTokens.slow.effects)
95
+ }
96
+ };
97
+ var FAST_SPATIAL_SPRING = framerSprings.fast.spatial;
98
+ var FAST_EFFECTS_SPRING = framerSprings.fast.effects;
99
+ var DEFAULT_SPATIAL_SPRING = framerSprings.default.spatial;
100
+ var DEFAULT_EFFECTS_SPRING = framerSprings.default.effects;
101
+ var SLOW_SPATIAL_SPRING = framerSprings.slow.spatial;
102
+ var SLOW_EFFECTS_SPRING = framerSprings.slow.effects;
103
+ var webCurves = {
104
+ expressive: {
105
+ fast: {
106
+ spatial: {
107
+ curve: "cubic-bezier(0.42, 1.67, 0.21, 0.90)",
108
+ durationMs: 350
109
+ },
110
+ effects: {
111
+ curve: "cubic-bezier(0.31, 0.94, 0.34, 1.00)",
112
+ durationMs: 150
113
+ }
114
+ },
115
+ default: {
116
+ spatial: {
117
+ curve: "cubic-bezier(0.38, 1.21, 0.22, 1.00)",
118
+ durationMs: 500
119
+ },
120
+ effects: {
121
+ curve: "cubic-bezier(0.34, 0.80, 0.34, 1.00)",
122
+ durationMs: 200
123
+ }
124
+ },
125
+ slow: {
126
+ spatial: {
127
+ curve: "cubic-bezier(0.39, 1.29, 0.35, 0.98)",
128
+ durationMs: 650
129
+ },
130
+ effects: {
131
+ curve: "cubic-bezier(0.34, 0.88, 0.34, 1.00)",
132
+ durationMs: 300
133
+ }
134
+ }
135
+ },
136
+ standard: {
137
+ fast: {
138
+ spatial: {
139
+ curve: "cubic-bezier(0.27, 1.06, 0.18, 1.00)",
140
+ durationMs: 350
141
+ },
142
+ effects: {
143
+ curve: "cubic-bezier(0.31, 0.94, 0.34, 1.00)",
144
+ durationMs: 150
145
+ }
146
+ },
147
+ default: {
148
+ spatial: {
149
+ curve: "cubic-bezier(0.27, 1.06, 0.18, 1.00)",
150
+ durationMs: 500
151
+ },
152
+ effects: {
153
+ curve: "cubic-bezier(0.34, 0.80, 0.34, 1.00)",
154
+ durationMs: 200
155
+ }
156
+ },
157
+ slow: {
158
+ spatial: {
159
+ curve: "cubic-bezier(0.27, 1.06, 0.18, 1.00)",
160
+ durationMs: 750
161
+ },
162
+ effects: {
163
+ curve: "cubic-bezier(0.34, 0.88, 0.34, 1.00)",
164
+ durationMs: 300
165
+ }
166
+ }
167
+ }
168
+ };
169
+ function getSpring(_scheme, speed, type) {
170
+ return framerSprings[speed][type];
171
+ }
172
+ function getCSSTransition(scheme, speed, type) {
173
+ const { curve, durationMs } = webCurves[scheme][speed][type];
174
+ return `${durationMs}ms ${curve}`;
175
+ }
31
176
  var duration = {
32
177
  short1: 50,
33
178
  short2: 100,
@@ -47,25 +192,128 @@ var duration = {
47
192
  extraLong4: 1e3
48
193
  };
49
194
  var easing = {
195
+ // Emphasized set — most common for M3 Expressive transitions
196
+ emphasized: [0.2, 0, 0, 1],
197
+ emphasizedAccelerate: [0.3, 0, 0.8, 0.15],
198
+ emphasizedDecelerate: [0.05, 0.7, 0.1, 1],
199
+ // Standard set — for simple/utility transitions and CSS fallback
50
200
  standard: [0.2, 0, 0, 1],
51
201
  standardAccelerate: [0.3, 0, 1, 1],
52
202
  standardDecelerate: [0, 0, 0, 1],
53
- emphasized: [0.2, 0, 0, 1],
54
- emphasizedAccelerate: [0.3, 0, 0.8, 0.15],
55
- emphasizedDecelerate: [0.05, 0.7, 0.1, 1]
203
+ // Legacy set (M2 compat)
204
+ legacy: [0.4, 0, 0.2, 1],
205
+ legacyAccelerate: [0.4, 0, 1, 1],
206
+ legacyDecelerate: [0, 0, 0.2, 1],
207
+ // Linear
208
+ linear: [0, 0, 1, 1]
56
209
  };
57
210
  var spring = {
58
- default: { type: "spring", stiffness: 500, damping: 30, mass: 0.8 },
59
- snappy: { type: "spring", stiffness: 600, damping: 25 },
60
- gentle: { type: "spring", stiffness: 300, damping: 20 },
61
- bouncy: { type: "spring", stiffness: 400, damping: 15 }
211
+ default: framerSprings.default.spatial,
212
+ snappy: framerSprings.fast.spatial,
213
+ gentle: framerSprings.slow.spatial,
214
+ bouncy: __spreadProps(__spreadValues({}, framerSprings.fast.spatial), {
215
+ damping: framerSprings.fast.spatial.damping * 0.5
216
+ })
217
+ };
218
+ var motionTokens = {
219
+ duration,
220
+ easing,
221
+ spring: md3SpringTokens,
222
+ framerSprings,
223
+ webCurves
224
+ };
225
+
226
+ // src/shape.ts
227
+ var cornerRadius = {
228
+ none: 0,
229
+ extraSmall: 4,
230
+ small: 8,
231
+ medium: 12,
232
+ large: 16,
233
+ /** New in M3 Expressive (May 2025) */
234
+ largeIncreased: 20,
235
+ extraLarge: 28,
236
+ /** New in M3 Expressive (May 2025) */
237
+ extraLargeIncreased: 32,
238
+ /** New in M3 Expressive (May 2025) */
239
+ extraExtraLarge: 48,
240
+ full: 9999
241
+ };
242
+ var cornerCssVar = {
243
+ none: "--md-sys-shape-corner-none",
244
+ extraSmall: "--md-sys-shape-corner-extra-small",
245
+ small: "--md-sys-shape-corner-small",
246
+ medium: "--md-sys-shape-corner-medium",
247
+ large: "--md-sys-shape-corner-large",
248
+ largeIncreased: "--md-sys-shape-corner-large-increased",
249
+ extraLarge: "--md-sys-shape-corner-extra-large",
250
+ extraLargeIncreased: "--md-sys-shape-corner-extra-large-increased",
251
+ extraExtraLarge: "--md-sys-shape-corner-extra-extra-large",
252
+ full: "--md-sys-shape-corner-full"
253
+ };
254
+ var asymmetricCorners = {
255
+ /** Fully rounded top, square bottom — e.g. menu at top of screen. */
256
+ topFull: (r = cornerRadius.extraLarge) => ({
257
+ topLeft: r,
258
+ topRight: r,
259
+ bottomRight: 0,
260
+ bottomLeft: 0
261
+ }),
262
+ /** Square top, fully rounded bottom — e.g. menu at bottom of screen. */
263
+ bottomFull: (r = cornerRadius.extraLarge) => ({
264
+ topLeft: 0,
265
+ topRight: 0,
266
+ bottomRight: r,
267
+ bottomLeft: r
268
+ }),
269
+ /** Rounded start edge only — e.g. left item in a grouped set. */
270
+ startFull: (r = cornerRadius.full) => ({
271
+ topLeft: r,
272
+ topRight: 0,
273
+ bottomRight: 0,
274
+ bottomLeft: r
275
+ }),
276
+ /** Rounded end edge only — e.g. right item in a grouped set. */
277
+ endFull: (r = cornerRadius.full) => ({
278
+ topLeft: 0,
279
+ topRight: r,
280
+ bottomRight: r,
281
+ bottomLeft: 0
282
+ })
283
+ };
284
+ function asymmetricCornersToCSS(corners) {
285
+ return `${corners.topLeft}px ${corners.topRight}px ${corners.bottomRight}px ${corners.bottomLeft}px`;
286
+ }
287
+ function opticalRadius(outerRadius, padding) {
288
+ return Math.max(0, outerRadius - padding);
289
+ }
290
+ var shapeTokens = {
291
+ cornerRadius,
292
+ cornerCssVar,
293
+ asymmetricCorners
62
294
  };
63
- var motionTokens = { duration, easing, spring };
64
295
  // Annotate the CommonJS export names for ESM import in node:
65
296
  0 && (module.exports = {
297
+ DEFAULT_EFFECTS_SPRING,
298
+ DEFAULT_SPATIAL_SPRING,
299
+ FAST_EFFECTS_SPRING,
300
+ FAST_SPATIAL_SPRING,
301
+ SLOW_EFFECTS_SPRING,
302
+ SLOW_SPATIAL_SPRING,
303
+ asymmetricCorners,
304
+ asymmetricCornersToCSS,
305
+ cornerCssVar,
306
+ cornerRadius,
66
307
  duration,
67
308
  easing,
309
+ framerSprings,
310
+ getCSSTransition,
311
+ getSpring,
312
+ md3SpringTokens,
68
313
  motionTokens,
69
- spring
314
+ opticalRadius,
315
+ shapeTokens,
316
+ spring,
317
+ webCurves
70
318
  });
71
319
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/motion.ts"],"sourcesContent":["export { duration, easing, motionTokens, spring } from \"./motion\";\n","/**\n * MD3 Expressive Motion Tokens\n * Framework-agnostic JS objects.\n */\n\nexport const duration = {\n\tshort1: 50,\n\tshort2: 100,\n\tshort3: 150,\n\tshort4: 200,\n\tmedium1: 250,\n\tmedium2: 300,\n\tmedium3: 350,\n\tmedium4: 400,\n\tlong1: 450,\n\tlong2: 500,\n\tlong3: 550,\n\tlong4: 600,\n\textraLong1: 700,\n\textraLong2: 800,\n\textraLong3: 900,\n\textraLong4: 1000,\n} as const;\n\nexport const easing = {\n\tstandard: [0.2, 0, 0, 1] as [number, number, number, number],\n\tstandardAccelerate: [0.3, 0, 1, 1] as [number, number, number, number],\n\tstandardDecelerate: [0, 0, 0, 1] as [number, number, number, number],\n\temphasized: [0.2, 0, 0, 1] as [number, number, number, number],\n\temphasizedAccelerate: [0.3, 0, 0.8, 0.15] as [number, number, number, number],\n\temphasizedDecelerate: [0.05, 0.7, 0.1, 1.0] as [\n\t\tnumber,\n\t\tnumber,\n\t\tnumber,\n\t\tnumber,\n\t],\n} as const;\n\nexport const spring = {\n\tdefault: { type: \"spring\" as const, stiffness: 500, damping: 30, mass: 0.8 },\n\tsnappy: { type: \"spring\" as const, stiffness: 600, damping: 25 },\n\tgentle: { type: \"spring\" as const, stiffness: 300, damping: 20 },\n\tbouncy: { type: \"spring\" as const, stiffness: 400, damping: 15 },\n} as const;\n\nexport const motionTokens = { duration, easing, spring };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,WAAW;AAAA,EACvB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACb;AAEO,IAAM,SAAS;AAAA,EACrB,UAAU,CAAC,KAAK,GAAG,GAAG,CAAC;AAAA,EACvB,oBAAoB,CAAC,KAAK,GAAG,GAAG,CAAC;AAAA,EACjC,oBAAoB,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,EAC/B,YAAY,CAAC,KAAK,GAAG,GAAG,CAAC;AAAA,EACzB,sBAAsB,CAAC,KAAK,GAAG,KAAK,IAAI;AAAA,EACxC,sBAAsB,CAAC,MAAM,KAAK,KAAK,CAAG;AAM3C;AAEO,IAAM,SAAS;AAAA,EACrB,SAAS,EAAE,MAAM,UAAmB,WAAW,KAAK,SAAS,IAAI,MAAM,IAAI;AAAA,EAC3E,QAAQ,EAAE,MAAM,UAAmB,WAAW,KAAK,SAAS,GAAG;AAAA,EAC/D,QAAQ,EAAE,MAAM,UAAmB,WAAW,KAAK,SAAS,GAAG;AAAA,EAC/D,QAAQ,EAAE,MAAM,UAAmB,WAAW,KAAK,SAAS,GAAG;AAChE;AAEO,IAAM,eAAe,EAAE,UAAU,QAAQ,OAAO;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/motion.ts","../src/shape.ts"],"sourcesContent":["// Motion tokens — MD3 Expressive physics-based system + legacy easing/duration\nexport {\n\tDEFAULT_EFFECTS_SPRING,\n\tDEFAULT_SPATIAL_SPRING,\n\t// Legacy duration + easing (still valid, kept as fallback)\n\tduration,\n\teasing,\n\tFAST_EFFECTS_SPRING,\n\tFAST_SPATIAL_SPRING,\n\ttype FramerSpring,\n\t// Framer Motion ready presets\n\tframerSprings,\n\tgetCSSTransition,\n\t// Helpers\n\tgetSpring,\n\ttype MD3SpringToken,\n\t// Types\n\ttype MotionScheme,\n\t// Raw MD3 spring tokens (dampingRatio + stiffness)\n\tmd3SpringTokens,\n\t// Aggregate\n\tmotionTokens,\n\tSLOW_EFFECTS_SPRING,\n\tSLOW_SPATIAL_SPRING,\n\ttype SpringSpeed,\n\ttype SpringType,\n\t// @deprecated legacy spring presets\n\tspring,\n\ttype WebCurveToken,\n\t// Web CSS curve equivalents\n\twebCurves,\n} from \"./motion\";\n\n// Shape tokens — MD3 Expressive 10-level corner radius scale + helpers\nexport {\n\ttype AsymmetricCorners,\n\tasymmetricCorners,\n\tasymmetricCornersToCSS,\n\t// Types\n\ttype CornerRadiusKey,\n\tcornerCssVar,\n\t// Corner radius values\n\tcornerRadius,\n\topticalRadius,\n\t// Aggregate\n\tshapeTokens,\n} from \"./shape\";\n","/**\n * MD3 Expressive Motion Tokens\n *\n * Source of truth for all motion in the design system. Two layers:\n *\n * 1. **Physics-based system** (May 2025, primary) — Spring tokens per the MD3\n * motion physics system. Use these for Framer Motion / JS animations.\n * 2. **Legacy easing + duration** (still valid for CSS transitions) — Original\n * MD3 cubic-bezier tokens kept as a fallback.\n *\n * @see https://m3.material.io/styles/motion/overview/how-it-works\n * @see https://m3.material.io/styles/motion/overview/specs\n */\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Types\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** Motion scheme — controls whether springs bounce (expressive) or not (standard). */\nexport type MotionScheme = \"expressive\" | \"standard\";\n\n/** Spring speed tier. */\nexport type SpringSpeed = \"fast\" | \"default\" | \"slow\";\n\n/** Spring type — spatial (position/size/shape) or effects (color/opacity). */\nexport type SpringType = \"spatial\" | \"effects\";\n\n/** Raw MD3 spring token — damping ratio + stiffness as specified in the design token. */\nexport interface MD3SpringToken {\n\t/** Damping ratio: 0 = no damping, 1 = critically damped (no bounce). */\n\tdampingRatio: number;\n\t/** Spring stiffness. Higher = faster animation. */\n\tstiffness: number;\n}\n\n/** A pre-converted spring ready for Framer Motion `Transition`. */\nexport interface FramerSpring {\n\ttype: \"spring\";\n\t/** Absolute damping coefficient (converted from dampingRatio). */\n\tdamping: number;\n\tstiffness: number;\n}\n\n/** Web CSS curve equivalent for a spring token (for CSS transitions). */\nexport interface WebCurveToken {\n\t/** CSS cubic-bezier(...) string. */\n\tcurve: string;\n\t/** Duration in milliseconds. */\n\tdurationMs: number;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// MD3 Expressive Spring Tokens (raw: dampingRatio + stiffness)\n// Source: md.sys.motion.spring.{speed}.{type}\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Raw MD3 spring tokens per the official specification.\n * Values are identical for both \"expressive\" and \"standard\" schemes —\n * the scheme is applied at the product level, not the token level.\n *\n * @see https://m3.material.io/styles/motion/easing-and-duration/tokens-specs\n */\nexport const md3SpringTokens = {\n\tfast: {\n\t\tspatial: { dampingRatio: 0.6, stiffness: 800 } satisfies MD3SpringToken,\n\t\teffects: { dampingRatio: 1.0, stiffness: 3800 } satisfies MD3SpringToken,\n\t},\n\tdefault: {\n\t\tspatial: { dampingRatio: 0.8, stiffness: 380 } satisfies MD3SpringToken,\n\t\teffects: { dampingRatio: 1.0, stiffness: 1600 } satisfies MD3SpringToken,\n\t},\n\tslow: {\n\t\tspatial: { dampingRatio: 0.8, stiffness: 200 } satisfies MD3SpringToken,\n\t\teffects: { dampingRatio: 1.0, stiffness: 800 } satisfies MD3SpringToken,\n\t},\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Framer Motion Spring Presets\n// damping = 2 * dampingRatio * sqrt(stiffness * mass), mass = 1 (default)\n// ─────────────────────────────────────────────────────────────────────────────\n\nfunction toFramerSpring(token: MD3SpringToken): FramerSpring {\n\tconst damping = 2 * token.dampingRatio * Math.sqrt(token.stiffness);\n\treturn { type: \"spring\", stiffness: token.stiffness, damping };\n}\n\n/**\n * Ready-to-use Framer Motion spring configs, derived from MD3 spring tokens.\n *\n * Use **spatial** springs for: position, size, border-radius, rotation, scale.\n * Use **effects** springs for: color, opacity (no overshoot).\n *\n * @example\n * ```tsx\n * import { framerSprings } from \"@md3-expressive/tokens\";\n * <m.div transition={framerSprings.fast.spatial} />\n * ```\n */\nexport const framerSprings = {\n\tfast: {\n\t\tspatial: toFramerSpring(md3SpringTokens.fast.spatial),\n\t\teffects: toFramerSpring(md3SpringTokens.fast.effects),\n\t},\n\tdefault: {\n\t\tspatial: toFramerSpring(md3SpringTokens.default.spatial),\n\t\teffects: toFramerSpring(md3SpringTokens.default.effects),\n\t},\n\tslow: {\n\t\tspatial: toFramerSpring(md3SpringTokens.slow.spatial),\n\t\teffects: toFramerSpring(md3SpringTokens.slow.effects),\n\t},\n} as const;\n\n// Convenient named aliases (mirror menu-animations.ts naming convention)\nexport const FAST_SPATIAL_SPRING = framerSprings.fast.spatial;\nexport const FAST_EFFECTS_SPRING = framerSprings.fast.effects;\nexport const DEFAULT_SPATIAL_SPRING = framerSprings.default.spatial;\nexport const DEFAULT_EFFECTS_SPRING = framerSprings.default.effects;\nexport const SLOW_SPATIAL_SPRING = framerSprings.slow.spatial;\nexport const SLOW_EFFECTS_SPRING = framerSprings.slow.effects;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Web CSS Curve Conversions\n// Use these when Framer Motion is not available (pure CSS transitions).\n// Source: https://m3.material.io/styles/motion/overview/specs#web-convert\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * CSS cubic-bezier + duration equivalents of MD3 spring tokens.\n * For non-interruptible CSS transitions when JS springs are unavailable.\n *\n * @see https://m3.material.io/styles/motion/overview/specs\n */\nexport const webCurves = {\n\texpressive: {\n\t\tfast: {\n\t\t\tspatial: {\n\t\t\t\tcurve: \"cubic-bezier(0.42, 1.67, 0.21, 0.90)\",\n\t\t\t\tdurationMs: 350,\n\t\t\t} satisfies WebCurveToken,\n\t\t\teffects: {\n\t\t\t\tcurve: \"cubic-bezier(0.31, 0.94, 0.34, 1.00)\",\n\t\t\t\tdurationMs: 150,\n\t\t\t} satisfies WebCurveToken,\n\t\t},\n\t\tdefault: {\n\t\t\tspatial: {\n\t\t\t\tcurve: \"cubic-bezier(0.38, 1.21, 0.22, 1.00)\",\n\t\t\t\tdurationMs: 500,\n\t\t\t} satisfies WebCurveToken,\n\t\t\teffects: {\n\t\t\t\tcurve: \"cubic-bezier(0.34, 0.80, 0.34, 1.00)\",\n\t\t\t\tdurationMs: 200,\n\t\t\t} satisfies WebCurveToken,\n\t\t},\n\t\tslow: {\n\t\t\tspatial: {\n\t\t\t\tcurve: \"cubic-bezier(0.39, 1.29, 0.35, 0.98)\",\n\t\t\t\tdurationMs: 650,\n\t\t\t} satisfies WebCurveToken,\n\t\t\teffects: {\n\t\t\t\tcurve: \"cubic-bezier(0.34, 0.88, 0.34, 1.00)\",\n\t\t\t\tdurationMs: 300,\n\t\t\t} satisfies WebCurveToken,\n\t\t},\n\t},\n\tstandard: {\n\t\tfast: {\n\t\t\tspatial: {\n\t\t\t\tcurve: \"cubic-bezier(0.27, 1.06, 0.18, 1.00)\",\n\t\t\t\tdurationMs: 350,\n\t\t\t} satisfies WebCurveToken,\n\t\t\teffects: {\n\t\t\t\tcurve: \"cubic-bezier(0.31, 0.94, 0.34, 1.00)\",\n\t\t\t\tdurationMs: 150,\n\t\t\t} satisfies WebCurveToken,\n\t\t},\n\t\tdefault: {\n\t\t\tspatial: {\n\t\t\t\tcurve: \"cubic-bezier(0.27, 1.06, 0.18, 1.00)\",\n\t\t\t\tdurationMs: 500,\n\t\t\t} satisfies WebCurveToken,\n\t\t\teffects: {\n\t\t\t\tcurve: \"cubic-bezier(0.34, 0.80, 0.34, 1.00)\",\n\t\t\t\tdurationMs: 200,\n\t\t\t} satisfies WebCurveToken,\n\t\t},\n\t\tslow: {\n\t\t\tspatial: {\n\t\t\t\tcurve: \"cubic-bezier(0.27, 1.06, 0.18, 1.00)\",\n\t\t\t\tdurationMs: 750,\n\t\t\t} satisfies WebCurveToken,\n\t\t\teffects: {\n\t\t\t\tcurve: \"cubic-bezier(0.34, 0.88, 0.34, 1.00)\",\n\t\t\t\tdurationMs: 300,\n\t\t\t} satisfies WebCurveToken,\n\t\t},\n\t},\n} as const;\n\n/**\n * Get a Framer Motion spring config for the given scheme, speed, and type.\n *\n * @example\n * ```tsx\n * transition={getSpring(\"expressive\", \"fast\", \"spatial\")}\n * ```\n */\nexport function getSpring(\n\t_scheme: MotionScheme,\n\tspeed: SpringSpeed,\n\ttype: SpringType,\n): FramerSpring {\n\t// Spring token values are scheme-agnostic; scheme is applied at product level.\n\treturn framerSprings[speed][type];\n}\n\n/**\n * Get a CSS transition string for the given scheme, speed, and type.\n *\n * @example\n * ```ts\n * element.style.transition = `transform ${getCSSTransition(\"expressive\", \"fast\", \"spatial\")}`;\n * ```\n */\nexport function getCSSTransition(\n\tscheme: MotionScheme,\n\tspeed: SpringSpeed,\n\ttype: SpringType,\n): string {\n\tconst { curve, durationMs } = webCurves[scheme][speed][type];\n\treturn `${durationMs}ms ${curve}`;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Legacy: Duration tokens (ms) — md.sys.motion.duration.*\n// Still valid; used as CSS fallback and for easing-based animations.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const duration = {\n\tshort1: 50,\n\tshort2: 100,\n\tshort3: 150,\n\tshort4: 200,\n\tmedium1: 250,\n\tmedium2: 300,\n\tmedium3: 350,\n\tmedium4: 400,\n\tlong1: 450,\n\tlong2: 500,\n\tlong3: 550,\n\tlong4: 600,\n\textraLong1: 700,\n\textraLong2: 800,\n\textraLong3: 900,\n\textraLong4: 1000,\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Legacy: Easing tokens — md.sys.motion.easing.*\n// Cubic-bezier control points [x1, y1, x2, y2].\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const easing = {\n\t// Emphasized set — most common for M3 Expressive transitions\n\temphasized: [0.2, 0, 0, 1] as [number, number, number, number],\n\temphasizedAccelerate: [0.3, 0, 0.8, 0.15] as [number, number, number, number],\n\temphasizedDecelerate: [0.05, 0.7, 0.1, 1.0] as [\n\t\tnumber,\n\t\tnumber,\n\t\tnumber,\n\t\tnumber,\n\t],\n\n\t// Standard set — for simple/utility transitions and CSS fallback\n\tstandard: [0.2, 0, 0, 1] as [number, number, number, number],\n\tstandardAccelerate: [0.3, 0, 1, 1] as [number, number, number, number],\n\tstandardDecelerate: [0, 0, 0, 1] as [number, number, number, number],\n\n\t// Legacy set (M2 compat)\n\tlegacy: [0.4, 0, 0.2, 1] as [number, number, number, number],\n\tlegacyAccelerate: [0.4, 0, 1, 1] as [number, number, number, number],\n\tlegacyDecelerate: [0, 0, 0.2, 1] as [number, number, number, number],\n\n\t// Linear\n\tlinear: [0, 0, 1, 1] as [number, number, number, number],\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// @deprecated Legacy spring presets — kept for backward compat only.\n// Migrate to framerSprings.* or the named FAST_SPATIAL_SPRING etc. exports.\n// ─────────────────────────────────────────────────────────────────────────────\n\n/** @deprecated Use `framerSprings.default.spatial` or `DEFAULT_SPATIAL_SPRING` instead. */\nexport const spring = {\n\tdefault: framerSprings.default.spatial,\n\tsnappy: framerSprings.fast.spatial,\n\tgentle: framerSprings.slow.spatial,\n\tbouncy: {\n\t\t...framerSprings.fast.spatial,\n\t\tdamping: framerSprings.fast.spatial.damping * 0.5,\n\t},\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Aggregate export\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const motionTokens = {\n\tduration,\n\teasing,\n\tspring: md3SpringTokens,\n\tframerSprings,\n\twebCurves,\n} as const;\n","/**\n * MD3 Expressive Shape Tokens\n *\n * TypeScript counterpart to `shape.css`. Provides numeric corner radius values,\n * CSS custom property names, and asymmetric corner helpers.\n *\n * Updated for M3 Expressive (May 2025): 10-level corner radius scale.\n *\n * @see https://m3.material.io/styles/shape/corner-radius-scale\n */\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Corner radius scale — numeric values in pixels\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Numeric corner radius values (px) for all 10 shape scale levels.\n * Map directly to `--md-sys-shape-corner-*` CSS custom properties.\n *\n * @example\n * ```ts\n * element.style.borderRadius = `${cornerRadius.medium}px`; // 12px\n * ```\n */\nexport const cornerRadius = {\n\tnone: 0,\n\textraSmall: 4,\n\tsmall: 8,\n\tmedium: 12,\n\tlarge: 16,\n\t/** New in M3 Expressive (May 2025) */\n\tlargeIncreased: 20,\n\textraLarge: 28,\n\t/** New in M3 Expressive (May 2025) */\n\textraLargeIncreased: 32,\n\t/** New in M3 Expressive (May 2025) */\n\textraExtraLarge: 48,\n\tfull: 9999,\n} as const;\n\nexport type CornerRadiusKey = keyof typeof cornerRadius;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// CSS custom property names\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Maps each corner radius key to its CSS custom property name.\n *\n * @example\n * ```ts\n * const cssVar = cornerCssVar.medium; // \"--md-sys-shape-corner-medium\"\n * element.style.borderRadius = `var(${cssVar})`;\n * ```\n */\nexport const cornerCssVar: Record<CornerRadiusKey, string> = {\n\tnone: \"--md-sys-shape-corner-none\",\n\textraSmall: \"--md-sys-shape-corner-extra-small\",\n\tsmall: \"--md-sys-shape-corner-small\",\n\tmedium: \"--md-sys-shape-corner-medium\",\n\tlarge: \"--md-sys-shape-corner-large\",\n\tlargeIncreased: \"--md-sys-shape-corner-large-increased\",\n\textraLarge: \"--md-sys-shape-corner-extra-large\",\n\textraLargeIncreased: \"--md-sys-shape-corner-extra-large-increased\",\n\textraExtraLarge: \"--md-sys-shape-corner-extra-extra-large\",\n\tfull: \"--md-sys-shape-corner-full\",\n};\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Asymmetric corner helpers\n// Used for inner-corner components (menus, split buttons, grouped items).\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Describes per-corner rounding for asymmetric shapes.\n * Follows CSS `border-radius` shorthand order:\n * top-left, top-right, bottom-right, bottom-left.\n */\nexport interface AsymmetricCorners {\n\ttopLeft: number;\n\ttopRight: number;\n\tbottomRight: number;\n\tbottomLeft: number;\n}\n\n/** Shorthand presets for common asymmetric corner patterns. */\nexport const asymmetricCorners = {\n\t/** Fully rounded top, square bottom — e.g. menu at top of screen. */\n\ttopFull: (r = cornerRadius.extraLarge): AsymmetricCorners => ({\n\t\ttopLeft: r,\n\t\ttopRight: r,\n\t\tbottomRight: 0,\n\t\tbottomLeft: 0,\n\t}),\n\t/** Square top, fully rounded bottom — e.g. menu at bottom of screen. */\n\tbottomFull: (r = cornerRadius.extraLarge): AsymmetricCorners => ({\n\t\ttopLeft: 0,\n\t\ttopRight: 0,\n\t\tbottomRight: r,\n\t\tbottomLeft: r,\n\t}),\n\t/** Rounded start edge only — e.g. left item in a grouped set. */\n\tstartFull: (r = cornerRadius.full): AsymmetricCorners => ({\n\t\ttopLeft: r,\n\t\ttopRight: 0,\n\t\tbottomRight: 0,\n\t\tbottomLeft: r,\n\t}),\n\t/** Rounded end edge only — e.g. right item in a grouped set. */\n\tendFull: (r = cornerRadius.full): AsymmetricCorners => ({\n\t\ttopLeft: 0,\n\t\ttopRight: r,\n\t\tbottomRight: r,\n\t\tbottomLeft: 0,\n\t}),\n} as const;\n\n/**\n * Converts an `AsymmetricCorners` object to a CSS `border-radius` string.\n *\n * @example\n * ```ts\n * element.style.borderRadius = toCSS(asymmetricCorners.topFull());\n * // \"28px 28px 0px 0px\"\n * ```\n */\nexport function asymmetricCornersToCSS(corners: AsymmetricCorners): string {\n\treturn `${corners.topLeft}px ${corners.topRight}px ${corners.bottomRight}px ${corners.bottomLeft}px`;\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Optical roundness helper\n// When nesting rounded objects: inner radius = outer radius - padding\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Calculates the inner border-radius that maintains optical roundness\n * when nesting one rounded container inside another.\n *\n * Formula: `inner = outer - padding`\n *\n * @see https://m3.material.io/styles/shape/corner-radius-scale#adjust-for-optical-roundness\n *\n * @example\n * ```ts\n * // Container has extraExtraLarge (48px), padding is 14px\n * const inner = opticalRadius(cornerRadius.extraExtraLarge, 14); // 34\n * ```\n */\nexport function opticalRadius(outerRadius: number, padding: number): number {\n\treturn Math.max(0, outerRadius - padding);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Aggregate export\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const shapeTokens = {\n\tcornerRadius,\n\tcornerCssVar,\n\tasymmetricCorners,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AEZ,qBAAqB;AAAA;AAAA,EAErB,iBAAiB;AAAA,EACjB,MAAM;AACP;AAiBO,IAAM,eAAgD;AAAA,EAC5D,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,MAAM;AACP;AAoBO,IAAM,oBAAoB;AAAA;AAAA,EAEhC,SAAS,CAAC,IAAI,aAAa,gBAAmC;AAAA,IAC7D,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,IACb,YAAY;AAAA,EACb;AAAA;AAAA,EAEA,YAAY,CAAC,IAAI,aAAa,gBAAmC;AAAA,IAChE,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,IACb,YAAY;AAAA,EACb;AAAA;AAAA,EAEA,WAAW,CAAC,IAAI,aAAa,UAA6B;AAAA,IACzD,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,IACb,YAAY;AAAA,EACb;AAAA;AAAA,EAEA,SAAS,CAAC,IAAI,aAAa,UAA6B;AAAA,IACvD,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,IACb,YAAY;AAAA,EACb;AACD;AAWO,SAAS,uBAAuB,SAAoC;AAC1E,SAAO,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ,MAAM,QAAQ,WAAW,MAAM,QAAQ,UAAU;AACjG;AAqBO,SAAS,cAAc,aAAqB,SAAyB;AAC3E,SAAO,KAAK,IAAI,GAAG,cAAc,OAAO;AACzC;AAMO,IAAM,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACD;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,4 +1,135 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
1
21
  // src/motion.ts
22
+ var md3SpringTokens = {
23
+ fast: {
24
+ spatial: { dampingRatio: 0.6, stiffness: 800 },
25
+ effects: { dampingRatio: 1, stiffness: 3800 }
26
+ },
27
+ default: {
28
+ spatial: { dampingRatio: 0.8, stiffness: 380 },
29
+ effects: { dampingRatio: 1, stiffness: 1600 }
30
+ },
31
+ slow: {
32
+ spatial: { dampingRatio: 0.8, stiffness: 200 },
33
+ effects: { dampingRatio: 1, stiffness: 800 }
34
+ }
35
+ };
36
+ function toFramerSpring(token) {
37
+ const damping = 2 * token.dampingRatio * Math.sqrt(token.stiffness);
38
+ return { type: "spring", stiffness: token.stiffness, damping };
39
+ }
40
+ var framerSprings = {
41
+ fast: {
42
+ spatial: toFramerSpring(md3SpringTokens.fast.spatial),
43
+ effects: toFramerSpring(md3SpringTokens.fast.effects)
44
+ },
45
+ default: {
46
+ spatial: toFramerSpring(md3SpringTokens.default.spatial),
47
+ effects: toFramerSpring(md3SpringTokens.default.effects)
48
+ },
49
+ slow: {
50
+ spatial: toFramerSpring(md3SpringTokens.slow.spatial),
51
+ effects: toFramerSpring(md3SpringTokens.slow.effects)
52
+ }
53
+ };
54
+ var FAST_SPATIAL_SPRING = framerSprings.fast.spatial;
55
+ var FAST_EFFECTS_SPRING = framerSprings.fast.effects;
56
+ var DEFAULT_SPATIAL_SPRING = framerSprings.default.spatial;
57
+ var DEFAULT_EFFECTS_SPRING = framerSprings.default.effects;
58
+ var SLOW_SPATIAL_SPRING = framerSprings.slow.spatial;
59
+ var SLOW_EFFECTS_SPRING = framerSprings.slow.effects;
60
+ var webCurves = {
61
+ expressive: {
62
+ fast: {
63
+ spatial: {
64
+ curve: "cubic-bezier(0.42, 1.67, 0.21, 0.90)",
65
+ durationMs: 350
66
+ },
67
+ effects: {
68
+ curve: "cubic-bezier(0.31, 0.94, 0.34, 1.00)",
69
+ durationMs: 150
70
+ }
71
+ },
72
+ default: {
73
+ spatial: {
74
+ curve: "cubic-bezier(0.38, 1.21, 0.22, 1.00)",
75
+ durationMs: 500
76
+ },
77
+ effects: {
78
+ curve: "cubic-bezier(0.34, 0.80, 0.34, 1.00)",
79
+ durationMs: 200
80
+ }
81
+ },
82
+ slow: {
83
+ spatial: {
84
+ curve: "cubic-bezier(0.39, 1.29, 0.35, 0.98)",
85
+ durationMs: 650
86
+ },
87
+ effects: {
88
+ curve: "cubic-bezier(0.34, 0.88, 0.34, 1.00)",
89
+ durationMs: 300
90
+ }
91
+ }
92
+ },
93
+ standard: {
94
+ fast: {
95
+ spatial: {
96
+ curve: "cubic-bezier(0.27, 1.06, 0.18, 1.00)",
97
+ durationMs: 350
98
+ },
99
+ effects: {
100
+ curve: "cubic-bezier(0.31, 0.94, 0.34, 1.00)",
101
+ durationMs: 150
102
+ }
103
+ },
104
+ default: {
105
+ spatial: {
106
+ curve: "cubic-bezier(0.27, 1.06, 0.18, 1.00)",
107
+ durationMs: 500
108
+ },
109
+ effects: {
110
+ curve: "cubic-bezier(0.34, 0.80, 0.34, 1.00)",
111
+ durationMs: 200
112
+ }
113
+ },
114
+ slow: {
115
+ spatial: {
116
+ curve: "cubic-bezier(0.27, 1.06, 0.18, 1.00)",
117
+ durationMs: 750
118
+ },
119
+ effects: {
120
+ curve: "cubic-bezier(0.34, 0.88, 0.34, 1.00)",
121
+ durationMs: 300
122
+ }
123
+ }
124
+ }
125
+ };
126
+ function getSpring(_scheme, speed, type) {
127
+ return framerSprings[speed][type];
128
+ }
129
+ function getCSSTransition(scheme, speed, type) {
130
+ const { curve, durationMs } = webCurves[scheme][speed][type];
131
+ return `${durationMs}ms ${curve}`;
132
+ }
2
133
  var duration = {
3
134
  short1: 50,
4
135
  short2: 100,
@@ -18,24 +149,127 @@ var duration = {
18
149
  extraLong4: 1e3
19
150
  };
20
151
  var easing = {
152
+ // Emphasized set — most common for M3 Expressive transitions
153
+ emphasized: [0.2, 0, 0, 1],
154
+ emphasizedAccelerate: [0.3, 0, 0.8, 0.15],
155
+ emphasizedDecelerate: [0.05, 0.7, 0.1, 1],
156
+ // Standard set — for simple/utility transitions and CSS fallback
21
157
  standard: [0.2, 0, 0, 1],
22
158
  standardAccelerate: [0.3, 0, 1, 1],
23
159
  standardDecelerate: [0, 0, 0, 1],
24
- emphasized: [0.2, 0, 0, 1],
25
- emphasizedAccelerate: [0.3, 0, 0.8, 0.15],
26
- emphasizedDecelerate: [0.05, 0.7, 0.1, 1]
160
+ // Legacy set (M2 compat)
161
+ legacy: [0.4, 0, 0.2, 1],
162
+ legacyAccelerate: [0.4, 0, 1, 1],
163
+ legacyDecelerate: [0, 0, 0.2, 1],
164
+ // Linear
165
+ linear: [0, 0, 1, 1]
27
166
  };
28
167
  var spring = {
29
- default: { type: "spring", stiffness: 500, damping: 30, mass: 0.8 },
30
- snappy: { type: "spring", stiffness: 600, damping: 25 },
31
- gentle: { type: "spring", stiffness: 300, damping: 20 },
32
- bouncy: { type: "spring", stiffness: 400, damping: 15 }
168
+ default: framerSprings.default.spatial,
169
+ snappy: framerSprings.fast.spatial,
170
+ gentle: framerSprings.slow.spatial,
171
+ bouncy: __spreadProps(__spreadValues({}, framerSprings.fast.spatial), {
172
+ damping: framerSprings.fast.spatial.damping * 0.5
173
+ })
174
+ };
175
+ var motionTokens = {
176
+ duration,
177
+ easing,
178
+ spring: md3SpringTokens,
179
+ framerSprings,
180
+ webCurves
181
+ };
182
+
183
+ // src/shape.ts
184
+ var cornerRadius = {
185
+ none: 0,
186
+ extraSmall: 4,
187
+ small: 8,
188
+ medium: 12,
189
+ large: 16,
190
+ /** New in M3 Expressive (May 2025) */
191
+ largeIncreased: 20,
192
+ extraLarge: 28,
193
+ /** New in M3 Expressive (May 2025) */
194
+ extraLargeIncreased: 32,
195
+ /** New in M3 Expressive (May 2025) */
196
+ extraExtraLarge: 48,
197
+ full: 9999
198
+ };
199
+ var cornerCssVar = {
200
+ none: "--md-sys-shape-corner-none",
201
+ extraSmall: "--md-sys-shape-corner-extra-small",
202
+ small: "--md-sys-shape-corner-small",
203
+ medium: "--md-sys-shape-corner-medium",
204
+ large: "--md-sys-shape-corner-large",
205
+ largeIncreased: "--md-sys-shape-corner-large-increased",
206
+ extraLarge: "--md-sys-shape-corner-extra-large",
207
+ extraLargeIncreased: "--md-sys-shape-corner-extra-large-increased",
208
+ extraExtraLarge: "--md-sys-shape-corner-extra-extra-large",
209
+ full: "--md-sys-shape-corner-full"
210
+ };
211
+ var asymmetricCorners = {
212
+ /** Fully rounded top, square bottom — e.g. menu at top of screen. */
213
+ topFull: (r = cornerRadius.extraLarge) => ({
214
+ topLeft: r,
215
+ topRight: r,
216
+ bottomRight: 0,
217
+ bottomLeft: 0
218
+ }),
219
+ /** Square top, fully rounded bottom — e.g. menu at bottom of screen. */
220
+ bottomFull: (r = cornerRadius.extraLarge) => ({
221
+ topLeft: 0,
222
+ topRight: 0,
223
+ bottomRight: r,
224
+ bottomLeft: r
225
+ }),
226
+ /** Rounded start edge only — e.g. left item in a grouped set. */
227
+ startFull: (r = cornerRadius.full) => ({
228
+ topLeft: r,
229
+ topRight: 0,
230
+ bottomRight: 0,
231
+ bottomLeft: r
232
+ }),
233
+ /** Rounded end edge only — e.g. right item in a grouped set. */
234
+ endFull: (r = cornerRadius.full) => ({
235
+ topLeft: 0,
236
+ topRight: r,
237
+ bottomRight: r,
238
+ bottomLeft: 0
239
+ })
240
+ };
241
+ function asymmetricCornersToCSS(corners) {
242
+ return `${corners.topLeft}px ${corners.topRight}px ${corners.bottomRight}px ${corners.bottomLeft}px`;
243
+ }
244
+ function opticalRadius(outerRadius, padding) {
245
+ return Math.max(0, outerRadius - padding);
246
+ }
247
+ var shapeTokens = {
248
+ cornerRadius,
249
+ cornerCssVar,
250
+ asymmetricCorners
33
251
  };
34
- var motionTokens = { duration, easing, spring };
35
252
  export {
253
+ DEFAULT_EFFECTS_SPRING,
254
+ DEFAULT_SPATIAL_SPRING,
255
+ FAST_EFFECTS_SPRING,
256
+ FAST_SPATIAL_SPRING,
257
+ SLOW_EFFECTS_SPRING,
258
+ SLOW_SPATIAL_SPRING,
259
+ asymmetricCorners,
260
+ asymmetricCornersToCSS,
261
+ cornerCssVar,
262
+ cornerRadius,
36
263
  duration,
37
264
  easing,
265
+ framerSprings,
266
+ getCSSTransition,
267
+ getSpring,
268
+ md3SpringTokens,
38
269
  motionTokens,
39
- spring
270
+ opticalRadius,
271
+ shapeTokens,
272
+ spring,
273
+ webCurves
40
274
  };
41
275
  //# sourceMappingURL=index.mjs.map