@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
@@ -2947,6 +2947,13 @@ function transformFeature(feature, fn) {
2947
2947
  }
2948
2948
  return edgeFeature(cubics);
2949
2949
  }
2950
+ function reverseFeature(feature) {
2951
+ const cubics = feature.cubics.slice().reverse().map((c) => c.reverse());
2952
+ if (feature.type === "corner") {
2953
+ return cornerFeature(cubics, feature.convex);
2954
+ }
2955
+ return edgeFeature(cubics);
2956
+ }
2950
2957
 
2951
2958
  // src/shapes/math/corner-rounding.ts
2952
2959
  var UNROUNDED = Object.freeze({
@@ -2979,6 +2986,10 @@ function convex(prevX, prevY, currX, currY, nextX, nextY) {
2979
2986
  const v2y = nextY - currY;
2980
2987
  return v1x * v2y - v1y * v2x > 0;
2981
2988
  }
2989
+ function formatCoordinate(v) {
2990
+ const rounded = Math.round(v * 1e4) / 1e4;
2991
+ return (rounded === 0 ? 0 : rounded).toString();
2992
+ }
2982
2993
 
2983
2994
  // src/shapes/math/point.ts
2984
2995
  function point(x, y) {
@@ -3031,9 +3042,16 @@ var Cubic = class _Cubic {
3031
3042
  */
3032
3043
  pointOnCurve(t) {
3033
3044
  const u = 1 - t;
3045
+ const uu = u * u;
3046
+ const tt = t * t;
3047
+ const uuu = uu * u;
3048
+ const ttt = tt * t;
3049
+ const c0 = 3 * t * uu;
3050
+ const c1 = 3 * tt * u;
3051
+ const p = this.points;
3034
3052
  return point(
3035
- this.anchor0X * (u * u * u) + this.control0X * (3 * t * u * u) + this.control1X * (3 * t * t * u) + this.anchor1X * (t * t * t),
3036
- this.anchor0Y * (u * u * u) + this.control0Y * (3 * t * u * u) + this.control1Y * (3 * t * t * u) + this.anchor1Y * (t * t * t)
3053
+ p[0] * uuu + p[2] * c0 + p[4] * c1 + p[6] * ttt,
3054
+ p[1] * uuu + p[3] * c0 + p[5] * c1 + p[7] * ttt
3037
3055
  );
3038
3056
  }
3039
3057
  /**
@@ -3642,6 +3660,36 @@ var RoundedPolygon = class _RoundedPolygon {
3642
3660
  this.centerY + d
3643
3661
  ];
3644
3662
  }
3663
+ /**
3664
+ * Calculates the approximate signed area of the polygon using anchor points.
3665
+ * Returns > 0 for Clockwise (in screen coords, y down), < 0 for Counter-Clockwise.
3666
+ */
3667
+ calculateSignedArea() {
3668
+ let area = 0;
3669
+ const n = this.cubics.length;
3670
+ for (let i = 0; i < n; i++) {
3671
+ const c = this.cubics[i];
3672
+ area += c.anchor0X * c.anchor1Y - c.anchor1X * c.anchor0Y;
3673
+ }
3674
+ return area / 2;
3675
+ }
3676
+ /**
3677
+ * Returns true if the polygon outline runs in Clockwise order (screen coords).
3678
+ */
3679
+ isClockwise() {
3680
+ return this.calculateSignedArea() > 0;
3681
+ }
3682
+ /**
3683
+ * Returns a reversed copy of the polygon with reversed traversal order.
3684
+ * Flips the winding direction (CW ↔ CCW).
3685
+ */
3686
+ reversed() {
3687
+ const reversedFeatures = this.features.slice().reverse().map((f) => reverseFeature(f));
3688
+ return new _RoundedPolygon(
3689
+ reversedFeatures,
3690
+ point(this.centerX, this.centerY)
3691
+ );
3692
+ }
3645
3693
  };
3646
3694
  function buildCubicsList(features) {
3647
3695
  const result = [];
@@ -3710,10 +3758,21 @@ function validateContiguity(cubics) {
3710
3758
 
3711
3759
  // src/shapes/catalog/md3-expressive-shapes.ts
3712
3760
  function createShape(pts) {
3713
- const cubics = pts.map((p) => new Cubic(p));
3714
- return RoundedPolygon.fromFeatures(
3715
- cubics.map((c) => cornerFeature([c], false))
3716
- );
3761
+ let rawArea = 0;
3762
+ for (const p of pts) {
3763
+ rawArea += p[0] * p[7] - p[6] * p[1];
3764
+ }
3765
+ const normalizedPts = rawArea < 0 ? pts.slice().reverse().map((p) => [p[6], p[7], p[4], p[5], p[2], p[3], p[0], p[1]]) : pts;
3766
+ const cubics = normalizedPts.map((p) => new Cubic(p));
3767
+ const n = cubics.length;
3768
+ const features = cubics.map((c, i) => {
3769
+ const prev = cubics[(i - 1 + n) % n].pointOnCurve(0.5);
3770
+ const curr = c.pointOnCurve(0.5);
3771
+ const next = cubics[(i + 1) % n].pointOnCurve(0.5);
3772
+ const isConvex = convex(prev.x, prev.y, curr.x, curr.y, next.x, next.y);
3773
+ return cornerFeature([c], isConvex);
3774
+ });
3775
+ return RoundedPolygon.fromFeatures(features);
3717
3776
  }
3718
3777
  var archShape = createShape([
3719
3778
  [1, 0.83461, 1, 0.8547, 1, 0.86477, 0.99898, 0.87322],
@@ -4807,30 +4866,24 @@ var MD3Shapes = {
4807
4866
 
4808
4867
  // src/shapes/render/shape-rendering.ts
4809
4868
  function toSvgPath(cubics, width = 1, height = 1) {
4810
- if (cubics.length === 0) return "";
4869
+ const len = cubics.length;
4870
+ if (len === 0) return "";
4811
4871
  const paddingX = width * 0.015;
4812
4872
  const paddingY = height * 0.015;
4813
4873
  const sx = width - 2 * paddingX;
4814
4874
  const sy = height - 2 * paddingY;
4815
- const flipY = (y) => paddingY + sy * (1 - y);
4816
- const parts = [
4817
- `M ${fmt(paddingX + cubics[0].anchor0X * sx)} ${fmt(flipY(cubics[0].anchor0Y))}`
4818
- ];
4819
- for (const c of cubics) {
4820
- parts.push(
4821
- `C ${fmt(paddingX + c.control0X * sx)} ${fmt(flipY(c.control0Y))},${fmt(paddingX + c.control1X * sx)} ${fmt(flipY(c.control1Y))},${fmt(paddingX + c.anchor1X * sx)} ${fmt(flipY(c.anchor1Y))}`
4822
- );
4875
+ const c0 = cubics[0];
4876
+ let d = `M ${formatCoordinate(paddingX + c0.anchor0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c0.anchor0Y))}`;
4877
+ for (let i = 0; i < len; i++) {
4878
+ const c = cubics[i];
4879
+ d += ` C ${formatCoordinate(paddingX + c.control0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.control0Y))},${formatCoordinate(paddingX + c.control1X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.control1Y))},${formatCoordinate(paddingX + c.anchor1X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.anchor1Y))}`;
4823
4880
  }
4824
- parts.push("Z");
4825
- return parts.join(" ");
4881
+ return `${d} Z`;
4826
4882
  }
4827
4883
  function toClipPath(polygon, width, height) {
4828
4884
  const pathData = toSvgPath(polygon.cubics, width, height);
4829
4885
  return `path('${pathData}')`;
4830
4886
  }
4831
- function fmt(v) {
4832
- return Number(v.toFixed(4)).toString();
4833
- }
4834
4887
 
4835
4888
  // src/ui/navigation/navigation-shape-utils.ts
4836
4889
  function getNavigationShapeStyle(shape, width = 56, height = 56) {
@@ -7756,7 +7809,7 @@ var WIDTH_SIZE_STYLES = {
7756
7809
  },
7757
7810
  sm: {
7758
7811
  default: "w-10",
7759
- narrow: "w-12",
7812
+ narrow: "w-10",
7760
7813
  wide: "w-[3.25rem]"
7761
7814
  },
7762
7815
  md: {