@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.
@@ -6315,24 +6315,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
6315
6315
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
6316
6316
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
6317
6317
  }
6318
- d += " Z";
6319
6318
  return d;
6320
6319
  }
6321
6320
  function getSinePath(startX, endX, phase, wl, amp) {
6322
6321
  if (startX >= endX) return "";
6323
- let d = "";
6324
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
6325
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
6326
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
6327
- let nextX = Math.ceil(startX / step) * step;
6328
- if (nextX === startX) nextX += step;
6329
- while (nextX < endX) {
6330
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
6331
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
6332
- nextX += step;
6322
+ if (amp <= 0.01) {
6323
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
6324
+ }
6325
+ const safeWl = Math.max(1, wl);
6326
+ const k = 2 * Math.PI / safeWl;
6327
+ const phi = phase / safeWl * 2 * Math.PI;
6328
+ const yAt = (x) => amp * Math.sin(k * x + phi);
6329
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
6330
+ const step = safeWl / 4;
6331
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
6332
+ let currentX = startX;
6333
+ while (currentX < endX) {
6334
+ const nextX = Math.min(endX, currentX + step);
6335
+ const dx = nextX - currentX;
6336
+ const scale = dx / 3;
6337
+ const y0 = yAt(currentX);
6338
+ const dy0 = dyAt(currentX);
6339
+ const y1 = yAt(nextX);
6340
+ const dy1 = dyAt(nextX);
6341
+ const cp1x = currentX + scale;
6342
+ const cp1y = y0 + scale * dy0;
6343
+ const cp2x = nextX - scale;
6344
+ const cp2y = y1 - scale * dy1;
6345
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
6346
+ currentX = nextX;
6333
6347
  }
6334
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
6335
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
6336
6348
  return d;
6337
6349
  }
6338
6350
  var CircularProgress = React37.forwardRef(
@@ -6487,16 +6499,13 @@ var CircularProgress = React37.forwardRef(
6487
6499
  position: "absolute",
6488
6500
  inset: 0,
6489
6501
  overflow: "visible",
6490
- rotate: "-90deg",
6491
6502
  transformOrigin: "center"
6492
6503
  },
6493
- animate: { rotate: ["-90deg", "270deg"] },
6504
+ animate: { rotate: [0, 360] },
6494
6505
  transition: {
6495
- rotate: {
6496
- duration: 2 / Math.max(0.1, crawlerSpeed),
6497
- repeat: Number.POSITIVE_INFINITY,
6498
- ease: "linear"
6499
- }
6506
+ duration: 2 / Math.max(0.1, crawlerSpeed),
6507
+ repeat: Number.POSITIVE_INFINITY,
6508
+ ease: "linear"
6500
6509
  },
6501
6510
  children: [
6502
6511
  /* @__PURE__ */ jsx(
@@ -6509,17 +6518,16 @@ var CircularProgress = React37.forwardRef(
6509
6518
  stroke: bgTrackColor,
6510
6519
  strokeWidth: trackHeight,
6511
6520
  strokeLinecap: "round",
6512
- style: { originX: "50%", originY: "50%" },
6513
6521
  animate: {
6514
6522
  pathLength: [
6515
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
6516
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
6517
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
6523
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
6524
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
6525
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
6518
6526
  ],
6519
- rotate: [
6520
- `${(0.1 + gapForTrack) * 360}deg`,
6521
- `${(1 + gapForTrack) * 360}deg`,
6522
- `${(1.1 + gapForTrack) * 360}deg`
6527
+ pathOffset: [
6528
+ 0.1 + gapForTrack,
6529
+ 0.75 + gapForTrack,
6530
+ 0.1 + gapForTrack
6523
6531
  ]
6524
6532
  },
6525
6533
  transition: {
@@ -6537,10 +6545,9 @@ var CircularProgress = React37.forwardRef(
6537
6545
  stroke: activeColor,
6538
6546
  strokeWidth: trackHeight,
6539
6547
  strokeLinecap: "round",
6540
- style: { originX: "50%", originY: "50%" },
6541
6548
  animate: {
6542
6549
  pathLength: [0.1, 0.75, 0.1],
6543
- rotate: ["0deg", "90deg", "360deg"]
6550
+ pathOffset: [0, 0.65, 1]
6544
6551
  },
6545
6552
  transition: {
6546
6553
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -6558,10 +6565,9 @@ var CircularProgress = React37.forwardRef(
6558
6565
  stroke: activeColor,
6559
6566
  strokeWidth: trackHeight,
6560
6567
  strokeLinecap: "round",
6561
- style: { originX: "50%", originY: "50%" },
6562
6568
  animate: {
6563
6569
  pathLength: [0.1, 0.75, 0.1],
6564
- rotate: ["0deg", "90deg", "360deg"]
6570
+ pathOffset: [0, 0.65, 1]
6565
6571
  },
6566
6572
  transition: {
6567
6573
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -6734,6 +6740,12 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
6734
6740
  duration: 0.5
6735
6741
  });
6736
6742
  animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
6743
+ } else {
6744
+ animate(amplitudeMV, amplitude, {
6745
+ type: "spring",
6746
+ bounce: 0,
6747
+ duration: 0.5
6748
+ });
6737
6749
  }
6738
6750
  }, [
6739
6751
  clampedValue,
@@ -6747,10 +6759,10 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
6747
6759
  1,
6748
6760
  isDeterminate ? wavelength : indeterminateWavelength
6749
6761
  );
6750
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
6751
6762
  useAnimationFrame((time) => {
6752
6763
  if (width === 0) return;
6753
6764
  const currentAmp = amplitudeMV.get();
6765
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
6754
6766
  const phase = time / 1e3 * waveSpeed * activeWavelength;
6755
6767
  const capWidth = trackHeight / 2;
6756
6768
  let activePathD = "";
@@ -6851,7 +6863,7 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
6851
6863
  "div",
6852
6864
  {
6853
6865
  ref: containerRef,
6854
- className: "relative w-full overflow-hidden",
6866
+ className: "relative w-full",
6855
6867
  style: { height: svgHeight },
6856
6868
  children: width > 0 && /* @__PURE__ */ jsxs(
6857
6869
  "svg",
@@ -6905,7 +6917,7 @@ var LinearProgress = React37.forwardRef(
6905
6917
  waveSpeed = 1,
6906
6918
  crawlerSpeed = 1,
6907
6919
  determinateAnimation = "md3",
6908
- indeterminateAnimation = "continuous",
6920
+ indeterminateAnimation = "md3",
6909
6921
  gapSize = 4,
6910
6922
  showStopIndicator = "auto",
6911
6923
  color,
@@ -6942,15 +6954,15 @@ var LinearProgress = React37.forwardRef(
6942
6954
  setIsRtl(dir === "rtl");
6943
6955
  }
6944
6956
  }, []);
6945
- const isWavy = shape === "wavy";
6946
6957
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
6958
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
6947
6959
  const effectiveAmplitude = React37.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
6948
6960
  const svgHeight = React37.useMemo(
6949
6961
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
6950
6962
  [isWavy, trackHeight, effectiveAmplitude]
6951
6963
  );
6952
6964
  const shouldShowStop = React37.useMemo(
6953
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
6965
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
6954
6966
  [isDeterminate, resolvedTrackShape, showStopIndicator]
6955
6967
  );
6956
6968
  const stopSize = React37.useMemo(
@@ -6960,6 +6972,8 @@ var LinearProgress = React37.forwardRef(
6960
6972
  const stopOffset = (trackHeight - stopSize) / 2;
6961
6973
  const activeColor = color || "var(--md-sys-color-indicator-active)";
6962
6974
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
6975
+ const useWavyTrack = isWavy || !isDeterminate;
6976
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
6963
6977
  return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
6964
6978
  "div",
6965
6979
  __spreadProps(__spreadValues({
@@ -6976,12 +6990,12 @@ var LinearProgress = React37.forwardRef(
6976
6990
  style: { height: svgHeight }
6977
6991
  }, restProps), {
6978
6992
  children: [
6979
- isWavy ? /* @__PURE__ */ jsx(
6993
+ useWavyTrack ? /* @__PURE__ */ jsx(
6980
6994
  WavyLinearTrack,
6981
6995
  {
6982
6996
  trackHeight,
6983
6997
  svgHeight,
6984
- amplitude: effectiveAmplitude,
6998
+ amplitude: trackAmp,
6985
6999
  wavelength,
6986
7000
  indeterminateWavelength,
6987
7001
  activeColor,