@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.
package/dist/feedback.js CHANGED
@@ -390,24 +390,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
390
390
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
391
391
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
392
392
  }
393
- d += " Z";
394
393
  return d;
395
394
  }
396
395
  function getSinePath(startX, endX, phase, wl, amp) {
397
396
  if (startX >= endX) return "";
398
- let d = "";
399
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
400
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
401
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
402
- let nextX = Math.ceil(startX / step) * step;
403
- if (nextX === startX) nextX += step;
404
- while (nextX < endX) {
405
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
406
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
407
- nextX += step;
397
+ if (amp <= 0.01) {
398
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
399
+ }
400
+ const safeWl = Math.max(1, wl);
401
+ const k = 2 * Math.PI / safeWl;
402
+ const phi = phase / safeWl * 2 * Math.PI;
403
+ const yAt = (x) => amp * Math.sin(k * x + phi);
404
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
405
+ const step = safeWl / 4;
406
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
407
+ let currentX = startX;
408
+ while (currentX < endX) {
409
+ const nextX = Math.min(endX, currentX + step);
410
+ const dx = nextX - currentX;
411
+ const scale = dx / 3;
412
+ const y0 = yAt(currentX);
413
+ const dy0 = dyAt(currentX);
414
+ const y1 = yAt(nextX);
415
+ const dy1 = dyAt(nextX);
416
+ const cp1x = currentX + scale;
417
+ const cp1y = y0 + scale * dy0;
418
+ const cp2x = nextX - scale;
419
+ const cp2y = y1 - scale * dy1;
420
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
421
+ currentX = nextX;
408
422
  }
409
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
410
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
411
423
  return d;
412
424
  }
413
425
  var CircularProgress = React12__namespace.forwardRef(
@@ -562,16 +574,13 @@ var CircularProgress = React12__namespace.forwardRef(
562
574
  position: "absolute",
563
575
  inset: 0,
564
576
  overflow: "visible",
565
- rotate: "-90deg",
566
577
  transformOrigin: "center"
567
578
  },
568
- animate: { rotate: ["-90deg", "270deg"] },
579
+ animate: { rotate: [0, 360] },
569
580
  transition: {
570
- rotate: {
571
- duration: 2 / Math.max(0.1, crawlerSpeed),
572
- repeat: Number.POSITIVE_INFINITY,
573
- ease: "linear"
574
- }
581
+ duration: 2 / Math.max(0.1, crawlerSpeed),
582
+ repeat: Number.POSITIVE_INFINITY,
583
+ ease: "linear"
575
584
  },
576
585
  children: [
577
586
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -584,17 +593,16 @@ var CircularProgress = React12__namespace.forwardRef(
584
593
  stroke: bgTrackColor,
585
594
  strokeWidth: trackHeight,
586
595
  strokeLinecap: "round",
587
- style: { originX: "50%", originY: "50%" },
588
596
  animate: {
589
597
  pathLength: [
590
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
591
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
592
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
598
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
599
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
600
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
593
601
  ],
594
- rotate: [
595
- `${(0.1 + gapForTrack) * 360}deg`,
596
- `${(1 + gapForTrack) * 360}deg`,
597
- `${(1.1 + gapForTrack) * 360}deg`
602
+ pathOffset: [
603
+ 0.1 + gapForTrack,
604
+ 0.75 + gapForTrack,
605
+ 0.1 + gapForTrack
598
606
  ]
599
607
  },
600
608
  transition: {
@@ -612,10 +620,9 @@ var CircularProgress = React12__namespace.forwardRef(
612
620
  stroke: activeColor,
613
621
  strokeWidth: trackHeight,
614
622
  strokeLinecap: "round",
615
- style: { originX: "50%", originY: "50%" },
616
623
  animate: {
617
624
  pathLength: [0.1, 0.75, 0.1],
618
- rotate: ["0deg", "90deg", "360deg"]
625
+ pathOffset: [0, 0.65, 1]
619
626
  },
620
627
  transition: {
621
628
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -633,10 +640,9 @@ var CircularProgress = React12__namespace.forwardRef(
633
640
  stroke: activeColor,
634
641
  strokeWidth: trackHeight,
635
642
  strokeLinecap: "round",
636
- style: { originX: "50%", originY: "50%" },
637
643
  animate: {
638
644
  pathLength: [0.1, 0.75, 0.1],
639
- rotate: ["0deg", "90deg", "360deg"]
645
+ pathOffset: [0, 0.65, 1]
640
646
  },
641
647
  transition: {
642
648
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -809,6 +815,12 @@ var WavyLinearTrack = React12__namespace.memo(function WavyLinearTrack2({
809
815
  duration: 0.5
810
816
  });
811
817
  react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
818
+ } else {
819
+ react.animate(amplitudeMV, amplitude, {
820
+ type: "spring",
821
+ bounce: 0,
822
+ duration: 0.5
823
+ });
812
824
  }
813
825
  }, [
814
826
  clampedValue,
@@ -822,10 +834,10 @@ var WavyLinearTrack = React12__namespace.memo(function WavyLinearTrack2({
822
834
  1,
823
835
  isDeterminate ? wavelength : indeterminateWavelength
824
836
  );
825
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
826
837
  react.useAnimationFrame((time) => {
827
838
  if (width === 0) return;
828
839
  const currentAmp = amplitudeMV.get();
840
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
829
841
  const phase = time / 1e3 * waveSpeed * activeWavelength;
830
842
  const capWidth = trackHeight / 2;
831
843
  let activePathD = "";
@@ -926,7 +938,7 @@ var WavyLinearTrack = React12__namespace.memo(function WavyLinearTrack2({
926
938
  "div",
927
939
  {
928
940
  ref: containerRef,
929
- className: "relative w-full overflow-hidden",
941
+ className: "relative w-full",
930
942
  style: { height: svgHeight },
931
943
  children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
932
944
  "svg",
@@ -980,7 +992,7 @@ var LinearProgress = React12__namespace.forwardRef(
980
992
  waveSpeed = 1,
981
993
  crawlerSpeed = 1,
982
994
  determinateAnimation = "md3",
983
- indeterminateAnimation = "continuous",
995
+ indeterminateAnimation = "md3",
984
996
  gapSize = 4,
985
997
  showStopIndicator = "auto",
986
998
  color,
@@ -1017,15 +1029,15 @@ var LinearProgress = React12__namespace.forwardRef(
1017
1029
  setIsRtl(dir === "rtl");
1018
1030
  }
1019
1031
  }, []);
1020
- const isWavy = shape === "wavy";
1021
1032
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
1033
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
1022
1034
  const effectiveAmplitude = React12__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
1023
1035
  const svgHeight = React12__namespace.useMemo(
1024
1036
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
1025
1037
  [isWavy, trackHeight, effectiveAmplitude]
1026
1038
  );
1027
1039
  const shouldShowStop = React12__namespace.useMemo(
1028
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
1040
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
1029
1041
  [isDeterminate, resolvedTrackShape, showStopIndicator]
1030
1042
  );
1031
1043
  const stopSize = React12__namespace.useMemo(
@@ -1035,6 +1047,8 @@ var LinearProgress = React12__namespace.forwardRef(
1035
1047
  const stopOffset = (trackHeight - stopSize) / 2;
1036
1048
  const activeColor = color || "var(--md-sys-color-indicator-active)";
1037
1049
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
1050
+ const useWavyTrack = isWavy || !isDeterminate;
1051
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
1038
1052
  return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1039
1053
  "div",
1040
1054
  __spreadProps(__spreadValues({
@@ -1051,12 +1065,12 @@ var LinearProgress = React12__namespace.forwardRef(
1051
1065
  style: { height: svgHeight }
1052
1066
  }, restProps), {
1053
1067
  children: [
1054
- isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
1068
+ useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
1055
1069
  WavyLinearTrack,
1056
1070
  {
1057
1071
  trackHeight,
1058
1072
  svgHeight,
1059
- amplitude: effectiveAmplitude,
1073
+ amplitude: trackAmp,
1060
1074
  wavelength,
1061
1075
  indeterminateWavelength,
1062
1076
  activeColor,