@bug-on/m3-expressive 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/buttons.d.mts +3 -3
  3. package/dist/buttons.d.ts +3 -3
  4. package/dist/buttons.js +110 -91
  5. package/dist/buttons.js.map +1 -1
  6. package/dist/buttons.mjs +110 -91
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/{core-Cckt8qEm.d.ts → core-DamhB5Yd.d.ts} +1 -1
  9. package/dist/{core-DDfG4pym.d.mts → core-Wsfqn9_N.d.mts} +1 -1
  10. package/dist/core.d.mts +2 -2
  11. package/dist/core.d.ts +2 -2
  12. package/dist/core.js +1 -1
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +1 -1
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/{fading-blur-mask--uZbBKLj.d.ts → fading-blur-mask-CX-bwjNU.d.mts} +6 -1
  17. package/dist/{fading-blur-mask--uZbBKLj.d.mts → fading-blur-mask-D57UMguz.d.ts} +6 -1
  18. package/dist/feedback.d.mts +17 -5
  19. package/dist/feedback.d.ts +17 -5
  20. package/dist/feedback.js +1 -1
  21. package/dist/feedback.js.map +1 -1
  22. package/dist/feedback.mjs +1 -1
  23. package/dist/feedback.mjs.map +1 -1
  24. package/dist/forms.d.mts +3 -3
  25. package/dist/forms.d.ts +3 -3
  26. package/dist/forms.js +16 -6
  27. package/dist/forms.js.map +1 -1
  28. package/dist/forms.mjs +16 -6
  29. package/dist/forms.mjs.map +1 -1
  30. package/dist/{icon-button-CxyJv7UV.d.mts → icon-button-BpX9_fwZ.d.mts} +1 -1
  31. package/dist/{icon-button-Di8VX6ou.d.ts → icon-button-DFXp9hze.d.ts} +1 -1
  32. package/dist/index.d.mts +11 -10
  33. package/dist/index.d.ts +11 -10
  34. package/dist/index.js +1790 -1133
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +1640 -988
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/layout.d.mts +92 -23
  39. package/dist/layout.d.ts +92 -23
  40. package/dist/layout.js +118 -13
  41. package/dist/layout.js.map +1 -1
  42. package/dist/layout.mjs +118 -15
  43. package/dist/layout.mjs.map +1 -1
  44. package/dist/{md3-expressive-shapes-CPcfl_Hf.d.mts → md3-expressive-shapes-wk_98LJh.d.mts} +20 -1
  45. package/dist/{md3-expressive-shapes-CPcfl_Hf.d.ts → md3-expressive-shapes-wk_98LJh.d.ts} +20 -1
  46. package/dist/md3-xBl4wgND.d.mts +44 -0
  47. package/dist/md3-xBl4wgND.d.ts +44 -0
  48. package/dist/navigation.d.mts +5 -5
  49. package/dist/navigation.d.ts +5 -5
  50. package/dist/navigation.js +74 -21
  51. package/dist/navigation.js.map +1 -1
  52. package/dist/navigation.mjs +74 -21
  53. package/dist/navigation.mjs.map +1 -1
  54. package/dist/overlays.d.mts +4 -2
  55. package/dist/overlays.d.ts +4 -2
  56. package/dist/overlays.js +85 -44
  57. package/dist/overlays.js.map +1 -1
  58. package/dist/overlays.mjs +85 -44
  59. package/dist/overlays.mjs.map +1 -1
  60. package/dist/pickers.js +89 -56
  61. package/dist/pickers.js.map +1 -1
  62. package/dist/pickers.mjs +89 -56
  63. package/dist/pickers.mjs.map +1 -1
  64. package/dist/shapes.d.mts +150 -17
  65. package/dist/shapes.d.ts +150 -17
  66. package/dist/shapes.js +618 -126
  67. package/dist/shapes.js.map +1 -1
  68. package/dist/shapes.mjs +614 -127
  69. package/dist/shapes.mjs.map +1 -1
  70. package/dist/{side-sheet-modal-Bd5Qqvp9.d.ts → side-sheet-modal-BfdgYjd3.d.ts} +70 -0
  71. package/dist/{side-sheet-modal-64FGhDxL.d.mts → side-sheet-modal-kLfHINFZ.d.mts} +70 -0
  72. package/dist/{split-button-trailing-uncheckable-CGzk7KcG.d.ts → split-button-trailing-uncheckable-BpyIlOdn.d.ts} +7 -3
  73. package/dist/{split-button-trailing-uncheckable-gAz6OAIi.d.mts → split-button-trailing-uncheckable-CpT8iPpr.d.mts} +7 -3
  74. package/dist/{text-field-DARNdj14.d.ts → text-field-Ct-LT_2T.d.ts} +23 -4
  75. package/dist/{text-field-4OlT9o8s.d.mts → text-field-D5xiGn-q.d.mts} +23 -4
  76. package/llms-full.txt +25 -3
  77. package/llms.txt +4 -1
  78. package/package.json +1 -1
  79. package/dist/md3-BQhRygSi.d.mts +0 -31
  80. package/dist/md3-BQhRygSi.d.ts +0 -31
package/dist/shapes.d.mts CHANGED
@@ -1,6 +1,50 @@
1
- import { R as RoundedPolygon, a as CornerRounding, b as Cubic, e as MutableCubic, M as MD3ShapeName } from './md3-expressive-shapes-CPcfl_Hf.mjs';
2
- export { A as ANGLE_EPSILON, C as CornerFeature, D as DISTANCE_EPSILON, E as EdgeFeature, F as FLOAT_PI, c as Feature, d as MD3Shapes, P as Point, f as PointTransformer, U as UNROUNDED, g as addPoints, h as clockwise, i as convex, j as cornerFeature, k as cornerRounding, l as directionVector, m as distance, n as distanceSquared, o as dividePoint, p as dotProduct, q as edgeFeature, r as getDirection, s as getDistance, t as getDistanceSquared, u as interpolate, v as lerpPoint, w as point, x as positiveModulo, y as radialToCartesian, z as rotate90, B as scalePoint, G as square, H as subtractPoints, I as transformFeature, J as transformPoint } from './md3-expressive-shapes-CPcfl_Hf.mjs';
1
+ import { M as MD3ShapeName, R as RoundedPolygon, a as CornerRounding, b as Cubic, e as MutableCubic } from './md3-expressive-shapes-wk_98LJh.mjs';
2
+ export { A as ANGLE_EPSILON, C as CornerFeature, D as DISTANCE_EPSILON, E as EdgeFeature, F as FLOAT_PI, c as Feature, d as MD3Shapes, P as Point, f as PointTransformer, U as UNROUNDED, g as addPoints, h as clockwise, i as convex, j as cornerFeature, k as cornerRounding, l as directionVector, m as distance, n as distanceSquared, o as dividePoint, p as dotProduct, q as edgeFeature, r as formatCoordinate, s as getDirection, t as getDistance, u as getDistanceSquared, v as interpolate, w as lerpPoint, x as point, y as positiveModulo, z as radialToCartesian, B as rotate90, G as scalePoint, H as square, I as subtractPoints, J as transformFeature, K as transformPoint } from './md3-expressive-shapes-wk_98LJh.mjs';
3
3
  import { ReactNode, CSSProperties } from 'react';
4
+ import { a as MD3ColorToken } from './md3-xBl4wgND.mjs';
5
+
6
+ /**
7
+ * Material Design 3 Expressive — Shape Pairings & Families.
8
+ *
9
+ * Defines natural, expressive bidirectional morph pairings for all 35 MD3 shapes.
10
+ * Organized by design families:
11
+ * - Organic & Floral
12
+ * - Starburst & Explosive
13
+ * - Clover, Gem & Diamond
14
+ * - Cookies & Geometric Multi-sided
15
+ * - Rounded & Architectural
16
+ * - Polygonal & Directional
17
+ */
18
+
19
+ /**
20
+ * Curated bidirectional morph pairings for MD3 Expressive shapes.
21
+ * Each shape is paired with a harmonious companion shape within its design family.
22
+ */
23
+ declare const MD3_SHAPE_PAIRINGS: Readonly<Record<MD3ShapeName, MD3ShapeName>>;
24
+ /**
25
+ * Shape families grouping shapes by structural and expressive traits.
26
+ */
27
+ declare const MD3_SHAPE_FAMILIES: {
28
+ readonly organic: readonly ["circle", "flower", "sunny", "verySunny", "bun", "clamshell", "puffy"];
29
+ readonly starburst: readonly ["burst", "softBurst", "boom", "softBoom", "cookie12Sided"];
30
+ readonly cloverAndGems: readonly ["diamond", "puffyDiamond", "clover4Leaf", "clover8Leaf", "gem", "heart"];
31
+ readonly cookiesAndPolygons: readonly ["cookie4Sided", "cookie6Sided", "cookie7Sided", "cookie9Sided", "square"];
32
+ readonly roundedContainers: readonly ["pill", "oval", "arch", "semiCircle", "slanted"];
33
+ readonly directionalAndPixel: readonly ["triangle", "arrow", "pentagon", "fan", "ghostish", "pixelTriangle", "pixelCircle"];
34
+ };
35
+ type MD3ShapeFamily = keyof typeof MD3_SHAPE_FAMILIES;
36
+ /**
37
+ * Returns the recommended morph target shape for a given shape.
38
+ * If a custom RoundedPolygon is passed without a name match, defaults to "circle".
39
+ *
40
+ * @param shape - Shape name or RoundedPolygon instance
41
+ * @returns The recommended companion MD3 shape name
42
+ *
43
+ * @example
44
+ * getRecommendedMorphShape("flower"); // "sunny"
45
+ * getRecommendedMorphShape("burst"); // "softBurst"
46
+ */
47
+ declare function getRecommendedMorphShape(shape: MD3ShapeName | RoundedPolygon): MD3ShapeName;
4
48
 
5
49
  /**
6
50
  * MD3 Corner Radius Token Scale.
@@ -171,6 +215,8 @@ interface MeasuredFeature {
171
215
  readonly progress: number;
172
216
  /** Whether this corner is convex */
173
217
  readonly convex: boolean;
218
+ /** Polar angle in radians [-PI, PI] from polygon center to feature midpoint */
219
+ readonly angle: number;
174
220
  }
175
221
  /**
176
222
  * A list of MeasuredCubics covering the full outline of a polygon.
@@ -209,12 +255,10 @@ declare class MeasuredPolygon {
209
255
 
210
256
  /**
211
257
  * Creates a DoubleMapper that maps progress values between two polygons
212
- * based on matching their convex corners by proximity.
258
+ * based on matching their features by optimal cyclic alignment.
213
259
  *
214
- * The algorithm:
215
- * 1. Extract convex corner progress values from both polygons
216
- * 2. Match each corner in polygon1 to the closest corner of the same type in polygon2
217
- * 3. Build a piecewise-linear bidirectional mapper
260
+ * Finds the cyclic phase shift that minimizes both perimeter distance
261
+ * and spatial angular difference between features of polygon 1 and polygon 2.
218
262
  *
219
263
  * @param features1 - Measured features from polygon 1
220
264
  * @param features2 - Measured features from polygon 2
@@ -264,13 +308,30 @@ declare class Morph {
264
308
  * Returns the interpolated shape at the given progress as a list of Cubics.
265
309
  *
266
310
  * Note: This allocates a new list. For performance-critical animation loops,
267
- * use {@link forEachCubic} instead.
311
+ * use {@link toSvgPath} or {@link forEachCubic} instead.
268
312
  *
269
313
  * @param progress - Value in [0, 1]. 0 = start shape, 1 = end shape.
270
314
  * Values outside [0, 1] produce exaggerated shapes (useful for bounce/overshoot).
271
315
  * @returns List of interpolated Cubic curves forming the morphed shape
272
316
  */
273
317
  asCubics(progress: number): Cubic[];
318
+ /**
319
+ * Returns an SVG path data string for the morphed shape at the given progress.
320
+ * Directly evaluates coordinates without allocating intermediate Cubic objects.
321
+ *
322
+ * @param progress - Value in [0, 1]
323
+ * @param width - Target pixel width (default: 1)
324
+ * @param height - Target pixel height (default: 1)
325
+ */
326
+ toSvgPath(progress: number, width?: number, height?: number): string;
327
+ /**
328
+ * Returns a CSS clip-path value for the morphed shape at the given progress.
329
+ *
330
+ * @param progress - Value in [0, 1]
331
+ * @param width - Element width in pixels
332
+ * @param height - Element height in pixels
333
+ */
334
+ toClipPath(progress: number, width: number, height: number): string;
274
335
  /**
275
336
  * Iterates over the morphed cubics without allocating new Cubic instances.
276
337
  * Reuses a single MutableCubic for each callback invocation.
@@ -408,9 +469,10 @@ interface ShapeMediaProps {
408
469
  shape: ShapeRef;
409
470
  /**
410
471
  * The target shape to morph to (optional).
472
+ * If "auto", picks the recommended MD3 shape pairing.
411
473
  * When not provided, no morphing animation occurs.
412
474
  */
413
- morphTo?: ShapeRef;
475
+ morphTo?: ShapeRef | "auto";
414
476
  /** Which interaction triggers the morph (default: "hover"). */
415
477
  morphOn?: MorphTrigger;
416
478
  /** Animation options. */
@@ -441,8 +503,8 @@ interface ShapeMediaProps {
441
503
  interface ShapeIconProps {
442
504
  /** The base shape. */
443
505
  shape: ShapeRef;
444
- /** Shape to morph to on hover. */
445
- morphTo?: ShapeRef;
506
+ /** Shape to morph to on hover (or "auto" for recommended pairing). */
507
+ morphTo?: ShapeRef | "auto";
446
508
  /** Size in pixels (width = height). Default: 48. */
447
509
  size?: number;
448
510
  /** Icon content. */
@@ -451,8 +513,14 @@ interface ShapeIconProps {
451
513
  className?: string;
452
514
  /** Inline styles. */
453
515
  style?: CSSProperties;
454
- /** Background color. Default: "currentColor". */
455
- color?: string;
516
+ /**
517
+ * Background color. Default: "currentColor".
518
+ *
519
+ * @example
520
+ * color="var(--md-sys-color-primary-container)"
521
+ * color="var(--md-sys-color-surface-container-high)"
522
+ */
523
+ color?: MD3ColorToken;
456
524
  /** ARIA label. */
457
525
  "aria-label"?: string;
458
526
  }
@@ -478,8 +546,52 @@ interface ShapeSvgProps {
478
546
  "aria-label"?: string;
479
547
  /** Morph progress [0, 1] — set to animate between shape and morphTo. */
480
548
  progress?: number;
481
- /** Target shape for morphed SVG rendering. */
482
- morphTo?: ShapeRef;
549
+ /** Target shape for morphed SVG rendering (or "auto" for recommended pairing). */
550
+ morphTo?: ShapeRef | "auto";
551
+ }
552
+ /** Options for useShapeSequenceMorph hook. */
553
+ interface UseShapeSequenceMorphOptions {
554
+ /** Array of shapes to morph through in sequence. */
555
+ shapes: ShapeRef[];
556
+ /** Duration per morph in seconds (default: 0.6). */
557
+ duration?: number;
558
+ /** Interval between morph steps in seconds when autoplay is enabled (default: 2.0). */
559
+ interval?: number;
560
+ /** Whether to automatically cycle through shapes (default: false). */
561
+ autoplay?: boolean;
562
+ /** Whether to loop back to the first shape after reaching the end (default: true). */
563
+ loop?: boolean;
564
+ /** Custom animation options. */
565
+ morphOptions?: ShapeMorphOptions;
566
+ /** Output clip-path width in pixels. */
567
+ width: number;
568
+ /** Output clip-path height in pixels. */
569
+ height: number;
570
+ /** Whether the sequence animation is disabled. */
571
+ disabled?: boolean;
572
+ }
573
+ /** Return value of useShapeSequenceMorph hook. */
574
+ interface UseShapeSequenceMorphResult {
575
+ /** CSS clip-path string for the current interpolated frame. */
576
+ clipPath: string;
577
+ /** Index of current base shape in the shapes array. */
578
+ currentIndex: number;
579
+ /** Index of next target shape. */
580
+ nextIndex: number;
581
+ /** Current morph progress between currentIndex and nextIndex [0, 1]. */
582
+ progress: number;
583
+ /** Whether autoplay is currently active. */
584
+ isPlaying: boolean;
585
+ /** Advance to the next shape in the sequence. */
586
+ next: () => void;
587
+ /** Go back to the previous shape in the sequence. */
588
+ prev: () => void;
589
+ /** Jump directly to a specific shape index. */
590
+ goTo: (index: number) => void;
591
+ /** Start autoplay cycling. */
592
+ play: () => void;
593
+ /** Pause autoplay cycling. */
594
+ pause: () => void;
483
595
  }
484
596
 
485
597
  /**
@@ -608,7 +720,7 @@ declare function ShapeSvg({ shape, morphTo, progress, width, height, fill, strok
608
720
 
609
721
  interface UseShapeMorphOptions {
610
722
  shape: ShapeRef;
611
- morphTo?: ShapeRef;
723
+ morphTo?: ShapeRef | "auto";
612
724
  morphOn?: MorphTrigger;
613
725
  morphOptions?: ShapeMorphOptions;
614
726
  scrollProgress?: number;
@@ -621,4 +733,25 @@ interface UseShapeMorphOptions {
621
733
  */
622
734
  declare function useShapeMorph({ shape, morphTo, morphOn, morphOptions, scrollProgress, width, height, disabled, }: UseShapeMorphOptions): UseShapeMorphResult;
623
735
 
624
- export { CornerRounding, Cubic, type CubicPair, type DoubleMapper, MD3CornerRadius, type MD3CornerRadiusToken, MD3ShapeName, type MeasuredCubic, type MeasuredFeature, MeasuredPolygon, Morph, type MorphTrigger, MutableCubic, RoundedPolygon, ShapeIcon, type ShapeIconProps, ShapeMedia, type ShapeMediaProps, ShapeMediaServer, type ShapeMorphOptions, type ShapeRef, ShapeSvg, type ShapeSvgProps, type UseShapeMorphResult, circle, createDoubleMapper, featureMapper, interpolatePath, pill, pillStar, rectangle, star, toClipPath, toSvgPath, useShapeMorph };
736
+ /**
737
+ * useShapeSequenceMorph — React hook for animating through a sequence of shapes.
738
+ *
739
+ * Smoothly morphs through an array of MD3 Expressive shapes, supporting
740
+ * autoplay, manual step-by-step navigation, and looping.
741
+ *
742
+ * @example
743
+ * const { clipPath, next, prev, isPlaying } = useShapeSequenceMorph({
744
+ * shapes: ["circle", "flower", "sunny", "burst"],
745
+ * autoplay: true,
746
+ * interval: 2.5,
747
+ * duration: 0.6,
748
+ * width: 200,
749
+ * height: 200,
750
+ * });
751
+ *
752
+ * return <div style={{ clipPath }}>...</div>;
753
+ */
754
+
755
+ declare function useShapeSequenceMorph({ shapes, duration, interval, autoplay, loop, morphOptions, width, height, disabled, }: UseShapeSequenceMorphOptions): UseShapeSequenceMorphResult;
756
+
757
+ export { CornerRounding, Cubic, type CubicPair, type DoubleMapper, MD3CornerRadius, type MD3CornerRadiusToken, type MD3ShapeFamily, MD3ShapeName, MD3_SHAPE_FAMILIES, MD3_SHAPE_PAIRINGS, type MeasuredCubic, type MeasuredFeature, MeasuredPolygon, Morph, type MorphTrigger, MutableCubic, RoundedPolygon, ShapeIcon, type ShapeIconProps, ShapeMedia, type ShapeMediaProps, ShapeMediaServer, type ShapeMorphOptions, type ShapeRef, ShapeSvg, type ShapeSvgProps, type UseShapeMorphResult, type UseShapeSequenceMorphOptions, type UseShapeSequenceMorphResult, circle, createDoubleMapper, featureMapper, getRecommendedMorphShape, interpolatePath, pill, pillStar, rectangle, star, toClipPath, toSvgPath, useShapeMorph, useShapeSequenceMorph };
package/dist/shapes.d.ts CHANGED
@@ -1,6 +1,50 @@
1
- import { R as RoundedPolygon, a as CornerRounding, b as Cubic, e as MutableCubic, M as MD3ShapeName } from './md3-expressive-shapes-CPcfl_Hf.js';
2
- export { A as ANGLE_EPSILON, C as CornerFeature, D as DISTANCE_EPSILON, E as EdgeFeature, F as FLOAT_PI, c as Feature, d as MD3Shapes, P as Point, f as PointTransformer, U as UNROUNDED, g as addPoints, h as clockwise, i as convex, j as cornerFeature, k as cornerRounding, l as directionVector, m as distance, n as distanceSquared, o as dividePoint, p as dotProduct, q as edgeFeature, r as getDirection, s as getDistance, t as getDistanceSquared, u as interpolate, v as lerpPoint, w as point, x as positiveModulo, y as radialToCartesian, z as rotate90, B as scalePoint, G as square, H as subtractPoints, I as transformFeature, J as transformPoint } from './md3-expressive-shapes-CPcfl_Hf.js';
1
+ import { M as MD3ShapeName, R as RoundedPolygon, a as CornerRounding, b as Cubic, e as MutableCubic } from './md3-expressive-shapes-wk_98LJh.js';
2
+ export { A as ANGLE_EPSILON, C as CornerFeature, D as DISTANCE_EPSILON, E as EdgeFeature, F as FLOAT_PI, c as Feature, d as MD3Shapes, P as Point, f as PointTransformer, U as UNROUNDED, g as addPoints, h as clockwise, i as convex, j as cornerFeature, k as cornerRounding, l as directionVector, m as distance, n as distanceSquared, o as dividePoint, p as dotProduct, q as edgeFeature, r as formatCoordinate, s as getDirection, t as getDistance, u as getDistanceSquared, v as interpolate, w as lerpPoint, x as point, y as positiveModulo, z as radialToCartesian, B as rotate90, G as scalePoint, H as square, I as subtractPoints, J as transformFeature, K as transformPoint } from './md3-expressive-shapes-wk_98LJh.js';
3
3
  import { ReactNode, CSSProperties } from 'react';
4
+ import { a as MD3ColorToken } from './md3-xBl4wgND.js';
5
+
6
+ /**
7
+ * Material Design 3 Expressive — Shape Pairings & Families.
8
+ *
9
+ * Defines natural, expressive bidirectional morph pairings for all 35 MD3 shapes.
10
+ * Organized by design families:
11
+ * - Organic & Floral
12
+ * - Starburst & Explosive
13
+ * - Clover, Gem & Diamond
14
+ * - Cookies & Geometric Multi-sided
15
+ * - Rounded & Architectural
16
+ * - Polygonal & Directional
17
+ */
18
+
19
+ /**
20
+ * Curated bidirectional morph pairings for MD3 Expressive shapes.
21
+ * Each shape is paired with a harmonious companion shape within its design family.
22
+ */
23
+ declare const MD3_SHAPE_PAIRINGS: Readonly<Record<MD3ShapeName, MD3ShapeName>>;
24
+ /**
25
+ * Shape families grouping shapes by structural and expressive traits.
26
+ */
27
+ declare const MD3_SHAPE_FAMILIES: {
28
+ readonly organic: readonly ["circle", "flower", "sunny", "verySunny", "bun", "clamshell", "puffy"];
29
+ readonly starburst: readonly ["burst", "softBurst", "boom", "softBoom", "cookie12Sided"];
30
+ readonly cloverAndGems: readonly ["diamond", "puffyDiamond", "clover4Leaf", "clover8Leaf", "gem", "heart"];
31
+ readonly cookiesAndPolygons: readonly ["cookie4Sided", "cookie6Sided", "cookie7Sided", "cookie9Sided", "square"];
32
+ readonly roundedContainers: readonly ["pill", "oval", "arch", "semiCircle", "slanted"];
33
+ readonly directionalAndPixel: readonly ["triangle", "arrow", "pentagon", "fan", "ghostish", "pixelTriangle", "pixelCircle"];
34
+ };
35
+ type MD3ShapeFamily = keyof typeof MD3_SHAPE_FAMILIES;
36
+ /**
37
+ * Returns the recommended morph target shape for a given shape.
38
+ * If a custom RoundedPolygon is passed without a name match, defaults to "circle".
39
+ *
40
+ * @param shape - Shape name or RoundedPolygon instance
41
+ * @returns The recommended companion MD3 shape name
42
+ *
43
+ * @example
44
+ * getRecommendedMorphShape("flower"); // "sunny"
45
+ * getRecommendedMorphShape("burst"); // "softBurst"
46
+ */
47
+ declare function getRecommendedMorphShape(shape: MD3ShapeName | RoundedPolygon): MD3ShapeName;
4
48
 
5
49
  /**
6
50
  * MD3 Corner Radius Token Scale.
@@ -171,6 +215,8 @@ interface MeasuredFeature {
171
215
  readonly progress: number;
172
216
  /** Whether this corner is convex */
173
217
  readonly convex: boolean;
218
+ /** Polar angle in radians [-PI, PI] from polygon center to feature midpoint */
219
+ readonly angle: number;
174
220
  }
175
221
  /**
176
222
  * A list of MeasuredCubics covering the full outline of a polygon.
@@ -209,12 +255,10 @@ declare class MeasuredPolygon {
209
255
 
210
256
  /**
211
257
  * Creates a DoubleMapper that maps progress values between two polygons
212
- * based on matching their convex corners by proximity.
258
+ * based on matching their features by optimal cyclic alignment.
213
259
  *
214
- * The algorithm:
215
- * 1. Extract convex corner progress values from both polygons
216
- * 2. Match each corner in polygon1 to the closest corner of the same type in polygon2
217
- * 3. Build a piecewise-linear bidirectional mapper
260
+ * Finds the cyclic phase shift that minimizes both perimeter distance
261
+ * and spatial angular difference between features of polygon 1 and polygon 2.
218
262
  *
219
263
  * @param features1 - Measured features from polygon 1
220
264
  * @param features2 - Measured features from polygon 2
@@ -264,13 +308,30 @@ declare class Morph {
264
308
  * Returns the interpolated shape at the given progress as a list of Cubics.
265
309
  *
266
310
  * Note: This allocates a new list. For performance-critical animation loops,
267
- * use {@link forEachCubic} instead.
311
+ * use {@link toSvgPath} or {@link forEachCubic} instead.
268
312
  *
269
313
  * @param progress - Value in [0, 1]. 0 = start shape, 1 = end shape.
270
314
  * Values outside [0, 1] produce exaggerated shapes (useful for bounce/overshoot).
271
315
  * @returns List of interpolated Cubic curves forming the morphed shape
272
316
  */
273
317
  asCubics(progress: number): Cubic[];
318
+ /**
319
+ * Returns an SVG path data string for the morphed shape at the given progress.
320
+ * Directly evaluates coordinates without allocating intermediate Cubic objects.
321
+ *
322
+ * @param progress - Value in [0, 1]
323
+ * @param width - Target pixel width (default: 1)
324
+ * @param height - Target pixel height (default: 1)
325
+ */
326
+ toSvgPath(progress: number, width?: number, height?: number): string;
327
+ /**
328
+ * Returns a CSS clip-path value for the morphed shape at the given progress.
329
+ *
330
+ * @param progress - Value in [0, 1]
331
+ * @param width - Element width in pixels
332
+ * @param height - Element height in pixels
333
+ */
334
+ toClipPath(progress: number, width: number, height: number): string;
274
335
  /**
275
336
  * Iterates over the morphed cubics without allocating new Cubic instances.
276
337
  * Reuses a single MutableCubic for each callback invocation.
@@ -408,9 +469,10 @@ interface ShapeMediaProps {
408
469
  shape: ShapeRef;
409
470
  /**
410
471
  * The target shape to morph to (optional).
472
+ * If "auto", picks the recommended MD3 shape pairing.
411
473
  * When not provided, no morphing animation occurs.
412
474
  */
413
- morphTo?: ShapeRef;
475
+ morphTo?: ShapeRef | "auto";
414
476
  /** Which interaction triggers the morph (default: "hover"). */
415
477
  morphOn?: MorphTrigger;
416
478
  /** Animation options. */
@@ -441,8 +503,8 @@ interface ShapeMediaProps {
441
503
  interface ShapeIconProps {
442
504
  /** The base shape. */
443
505
  shape: ShapeRef;
444
- /** Shape to morph to on hover. */
445
- morphTo?: ShapeRef;
506
+ /** Shape to morph to on hover (or "auto" for recommended pairing). */
507
+ morphTo?: ShapeRef | "auto";
446
508
  /** Size in pixels (width = height). Default: 48. */
447
509
  size?: number;
448
510
  /** Icon content. */
@@ -451,8 +513,14 @@ interface ShapeIconProps {
451
513
  className?: string;
452
514
  /** Inline styles. */
453
515
  style?: CSSProperties;
454
- /** Background color. Default: "currentColor". */
455
- color?: string;
516
+ /**
517
+ * Background color. Default: "currentColor".
518
+ *
519
+ * @example
520
+ * color="var(--md-sys-color-primary-container)"
521
+ * color="var(--md-sys-color-surface-container-high)"
522
+ */
523
+ color?: MD3ColorToken;
456
524
  /** ARIA label. */
457
525
  "aria-label"?: string;
458
526
  }
@@ -478,8 +546,52 @@ interface ShapeSvgProps {
478
546
  "aria-label"?: string;
479
547
  /** Morph progress [0, 1] — set to animate between shape and morphTo. */
480
548
  progress?: number;
481
- /** Target shape for morphed SVG rendering. */
482
- morphTo?: ShapeRef;
549
+ /** Target shape for morphed SVG rendering (or "auto" for recommended pairing). */
550
+ morphTo?: ShapeRef | "auto";
551
+ }
552
+ /** Options for useShapeSequenceMorph hook. */
553
+ interface UseShapeSequenceMorphOptions {
554
+ /** Array of shapes to morph through in sequence. */
555
+ shapes: ShapeRef[];
556
+ /** Duration per morph in seconds (default: 0.6). */
557
+ duration?: number;
558
+ /** Interval between morph steps in seconds when autoplay is enabled (default: 2.0). */
559
+ interval?: number;
560
+ /** Whether to automatically cycle through shapes (default: false). */
561
+ autoplay?: boolean;
562
+ /** Whether to loop back to the first shape after reaching the end (default: true). */
563
+ loop?: boolean;
564
+ /** Custom animation options. */
565
+ morphOptions?: ShapeMorphOptions;
566
+ /** Output clip-path width in pixels. */
567
+ width: number;
568
+ /** Output clip-path height in pixels. */
569
+ height: number;
570
+ /** Whether the sequence animation is disabled. */
571
+ disabled?: boolean;
572
+ }
573
+ /** Return value of useShapeSequenceMorph hook. */
574
+ interface UseShapeSequenceMorphResult {
575
+ /** CSS clip-path string for the current interpolated frame. */
576
+ clipPath: string;
577
+ /** Index of current base shape in the shapes array. */
578
+ currentIndex: number;
579
+ /** Index of next target shape. */
580
+ nextIndex: number;
581
+ /** Current morph progress between currentIndex and nextIndex [0, 1]. */
582
+ progress: number;
583
+ /** Whether autoplay is currently active. */
584
+ isPlaying: boolean;
585
+ /** Advance to the next shape in the sequence. */
586
+ next: () => void;
587
+ /** Go back to the previous shape in the sequence. */
588
+ prev: () => void;
589
+ /** Jump directly to a specific shape index. */
590
+ goTo: (index: number) => void;
591
+ /** Start autoplay cycling. */
592
+ play: () => void;
593
+ /** Pause autoplay cycling. */
594
+ pause: () => void;
483
595
  }
484
596
 
485
597
  /**
@@ -608,7 +720,7 @@ declare function ShapeSvg({ shape, morphTo, progress, width, height, fill, strok
608
720
 
609
721
  interface UseShapeMorphOptions {
610
722
  shape: ShapeRef;
611
- morphTo?: ShapeRef;
723
+ morphTo?: ShapeRef | "auto";
612
724
  morphOn?: MorphTrigger;
613
725
  morphOptions?: ShapeMorphOptions;
614
726
  scrollProgress?: number;
@@ -621,4 +733,25 @@ interface UseShapeMorphOptions {
621
733
  */
622
734
  declare function useShapeMorph({ shape, morphTo, morphOn, morphOptions, scrollProgress, width, height, disabled, }: UseShapeMorphOptions): UseShapeMorphResult;
623
735
 
624
- export { CornerRounding, Cubic, type CubicPair, type DoubleMapper, MD3CornerRadius, type MD3CornerRadiusToken, MD3ShapeName, type MeasuredCubic, type MeasuredFeature, MeasuredPolygon, Morph, type MorphTrigger, MutableCubic, RoundedPolygon, ShapeIcon, type ShapeIconProps, ShapeMedia, type ShapeMediaProps, ShapeMediaServer, type ShapeMorphOptions, type ShapeRef, ShapeSvg, type ShapeSvgProps, type UseShapeMorphResult, circle, createDoubleMapper, featureMapper, interpolatePath, pill, pillStar, rectangle, star, toClipPath, toSvgPath, useShapeMorph };
736
+ /**
737
+ * useShapeSequenceMorph — React hook for animating through a sequence of shapes.
738
+ *
739
+ * Smoothly morphs through an array of MD3 Expressive shapes, supporting
740
+ * autoplay, manual step-by-step navigation, and looping.
741
+ *
742
+ * @example
743
+ * const { clipPath, next, prev, isPlaying } = useShapeSequenceMorph({
744
+ * shapes: ["circle", "flower", "sunny", "burst"],
745
+ * autoplay: true,
746
+ * interval: 2.5,
747
+ * duration: 0.6,
748
+ * width: 200,
749
+ * height: 200,
750
+ * });
751
+ *
752
+ * return <div style={{ clipPath }}>...</div>;
753
+ */
754
+
755
+ declare function useShapeSequenceMorph({ shapes, duration, interval, autoplay, loop, morphOptions, width, height, disabled, }: UseShapeSequenceMorphOptions): UseShapeSequenceMorphResult;
756
+
757
+ export { CornerRounding, Cubic, type CubicPair, type DoubleMapper, MD3CornerRadius, type MD3CornerRadiusToken, type MD3ShapeFamily, MD3ShapeName, MD3_SHAPE_FAMILIES, MD3_SHAPE_PAIRINGS, type MeasuredCubic, type MeasuredFeature, MeasuredPolygon, Morph, type MorphTrigger, MutableCubic, RoundedPolygon, ShapeIcon, type ShapeIconProps, ShapeMedia, type ShapeMediaProps, ShapeMediaServer, type ShapeMorphOptions, type ShapeRef, ShapeSvg, type ShapeSvgProps, type UseShapeMorphResult, type UseShapeSequenceMorphOptions, type UseShapeSequenceMorphResult, circle, createDoubleMapper, featureMapper, getRecommendedMorphShape, interpolatePath, pill, pillStar, rectangle, star, toClipPath, toSvgPath, useShapeMorph, useShapeSequenceMorph };