@bug-on/m3-expressive 1.2.5 → 1.2.6

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.
@@ -6338,24 +6338,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
6338
6338
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
6339
6339
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
6340
6340
  }
6341
- d += " Z";
6342
6341
  return d;
6343
6342
  }
6344
6343
  function getSinePath(startX, endX, phase, wl, amp) {
6345
6344
  if (startX >= endX) return "";
6346
- let d = "";
6347
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
6348
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
6349
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
6350
- let nextX = Math.ceil(startX / step) * step;
6351
- if (nextX === startX) nextX += step;
6352
- while (nextX < endX) {
6353
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
6354
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
6355
- nextX += step;
6345
+ if (amp <= 0.01) {
6346
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
6347
+ }
6348
+ const safeWl = Math.max(1, wl);
6349
+ const k = 2 * Math.PI / safeWl;
6350
+ const phi = phase / safeWl * 2 * Math.PI;
6351
+ const yAt = (x) => amp * Math.sin(k * x + phi);
6352
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
6353
+ const step = safeWl / 4;
6354
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
6355
+ let currentX = startX;
6356
+ while (currentX < endX) {
6357
+ const nextX = Math.min(endX, currentX + step);
6358
+ const dx = nextX - currentX;
6359
+ const scale = dx / 3;
6360
+ const y0 = yAt(currentX);
6361
+ const dy0 = dyAt(currentX);
6362
+ const y1 = yAt(nextX);
6363
+ const dy1 = dyAt(nextX);
6364
+ const cp1x = currentX + scale;
6365
+ const cp1y = y0 + scale * dy0;
6366
+ const cp2x = nextX - scale;
6367
+ const cp2y = y1 - scale * dy1;
6368
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
6369
+ currentX = nextX;
6356
6370
  }
6357
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
6358
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
6359
6371
  return d;
6360
6372
  }
6361
6373
  var CircularProgress = React37__namespace.forwardRef(
@@ -6510,16 +6522,13 @@ var CircularProgress = React37__namespace.forwardRef(
6510
6522
  position: "absolute",
6511
6523
  inset: 0,
6512
6524
  overflow: "visible",
6513
- rotate: "-90deg",
6514
6525
  transformOrigin: "center"
6515
6526
  },
6516
- animate: { rotate: ["-90deg", "270deg"] },
6527
+ animate: { rotate: [0, 360] },
6517
6528
  transition: {
6518
- rotate: {
6519
- duration: 2 / Math.max(0.1, crawlerSpeed),
6520
- repeat: Number.POSITIVE_INFINITY,
6521
- ease: "linear"
6522
- }
6529
+ duration: 2 / Math.max(0.1, crawlerSpeed),
6530
+ repeat: Number.POSITIVE_INFINITY,
6531
+ ease: "linear"
6523
6532
  },
6524
6533
  children: [
6525
6534
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -6532,17 +6541,16 @@ var CircularProgress = React37__namespace.forwardRef(
6532
6541
  stroke: bgTrackColor,
6533
6542
  strokeWidth: trackHeight,
6534
6543
  strokeLinecap: "round",
6535
- style: { originX: "50%", originY: "50%" },
6536
6544
  animate: {
6537
6545
  pathLength: [
6538
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
6539
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
6540
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
6546
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
6547
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
6548
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
6541
6549
  ],
6542
- rotate: [
6543
- `${(0.1 + gapForTrack) * 360}deg`,
6544
- `${(1 + gapForTrack) * 360}deg`,
6545
- `${(1.1 + gapForTrack) * 360}deg`
6550
+ pathOffset: [
6551
+ 0.1 + gapForTrack,
6552
+ 0.75 + gapForTrack,
6553
+ 0.1 + gapForTrack
6546
6554
  ]
6547
6555
  },
6548
6556
  transition: {
@@ -6560,10 +6568,9 @@ var CircularProgress = React37__namespace.forwardRef(
6560
6568
  stroke: activeColor,
6561
6569
  strokeWidth: trackHeight,
6562
6570
  strokeLinecap: "round",
6563
- style: { originX: "50%", originY: "50%" },
6564
6571
  animate: {
6565
6572
  pathLength: [0.1, 0.75, 0.1],
6566
- rotate: ["0deg", "90deg", "360deg"]
6573
+ pathOffset: [0, 0.65, 1]
6567
6574
  },
6568
6575
  transition: {
6569
6576
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -6581,10 +6588,9 @@ var CircularProgress = React37__namespace.forwardRef(
6581
6588
  stroke: activeColor,
6582
6589
  strokeWidth: trackHeight,
6583
6590
  strokeLinecap: "round",
6584
- style: { originX: "50%", originY: "50%" },
6585
6591
  animate: {
6586
6592
  pathLength: [0.1, 0.75, 0.1],
6587
- rotate: ["0deg", "90deg", "360deg"]
6593
+ pathOffset: [0, 0.65, 1]
6588
6594
  },
6589
6595
  transition: {
6590
6596
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -6757,6 +6763,12 @@ var WavyLinearTrack = React37__namespace.memo(function WavyLinearTrack2({
6757
6763
  duration: 0.5
6758
6764
  });
6759
6765
  react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
6766
+ } else {
6767
+ react.animate(amplitudeMV, amplitude, {
6768
+ type: "spring",
6769
+ bounce: 0,
6770
+ duration: 0.5
6771
+ });
6760
6772
  }
6761
6773
  }, [
6762
6774
  clampedValue,
@@ -6770,10 +6782,10 @@ var WavyLinearTrack = React37__namespace.memo(function WavyLinearTrack2({
6770
6782
  1,
6771
6783
  isDeterminate ? wavelength : indeterminateWavelength
6772
6784
  );
6773
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
6774
6785
  react.useAnimationFrame((time) => {
6775
6786
  if (width === 0) return;
6776
6787
  const currentAmp = amplitudeMV.get();
6788
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
6777
6789
  const phase = time / 1e3 * waveSpeed * activeWavelength;
6778
6790
  const capWidth = trackHeight / 2;
6779
6791
  let activePathD = "";
@@ -6874,7 +6886,7 @@ var WavyLinearTrack = React37__namespace.memo(function WavyLinearTrack2({
6874
6886
  "div",
6875
6887
  {
6876
6888
  ref: containerRef,
6877
- className: "relative w-full overflow-hidden",
6889
+ className: "relative w-full",
6878
6890
  style: { height: svgHeight },
6879
6891
  children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
6880
6892
  "svg",
@@ -6928,7 +6940,7 @@ var LinearProgress = React37__namespace.forwardRef(
6928
6940
  waveSpeed = 1,
6929
6941
  crawlerSpeed = 1,
6930
6942
  determinateAnimation = "md3",
6931
- indeterminateAnimation = "continuous",
6943
+ indeterminateAnimation = "md3",
6932
6944
  gapSize = 4,
6933
6945
  showStopIndicator = "auto",
6934
6946
  color,
@@ -6965,15 +6977,15 @@ var LinearProgress = React37__namespace.forwardRef(
6965
6977
  setIsRtl(dir === "rtl");
6966
6978
  }
6967
6979
  }, []);
6968
- const isWavy = shape === "wavy";
6969
6980
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
6981
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
6970
6982
  const effectiveAmplitude = React37__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
6971
6983
  const svgHeight = React37__namespace.useMemo(
6972
6984
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
6973
6985
  [isWavy, trackHeight, effectiveAmplitude]
6974
6986
  );
6975
6987
  const shouldShowStop = React37__namespace.useMemo(
6976
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
6988
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
6977
6989
  [isDeterminate, resolvedTrackShape, showStopIndicator]
6978
6990
  );
6979
6991
  const stopSize = React37__namespace.useMemo(
@@ -6983,6 +6995,8 @@ var LinearProgress = React37__namespace.forwardRef(
6983
6995
  const stopOffset = (trackHeight - stopSize) / 2;
6984
6996
  const activeColor = color || "var(--md-sys-color-indicator-active)";
6985
6997
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
6998
+ const useWavyTrack = isWavy || !isDeterminate;
6999
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
6986
7000
  return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
6987
7001
  "div",
6988
7002
  __spreadProps(__spreadValues({
@@ -6999,12 +7013,12 @@ var LinearProgress = React37__namespace.forwardRef(
6999
7013
  style: { height: svgHeight }
7000
7014
  }, restProps), {
7001
7015
  children: [
7002
- isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
7016
+ useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
7003
7017
  WavyLinearTrack,
7004
7018
  {
7005
7019
  trackHeight,
7006
7020
  svgHeight,
7007
- amplitude: effectiveAmplitude,
7021
+ amplitude: trackAmp,
7008
7022
  wavelength,
7009
7023
  indeterminateWavelength,
7010
7024
  activeColor,