@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/index.js CHANGED
@@ -5714,24 +5714,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
5714
5714
  if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
5715
5715
  d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
5716
5716
  }
5717
- d += " Z";
5718
5717
  return d;
5719
5718
  }
5720
5719
  function getSinePath(startX, endX, phase, wl, amp) {
5721
5720
  if (startX >= endX) return "";
5722
- let d = "";
5723
- const step = amp === 0 ? Math.max(10, endX - startX) : 1;
5724
- const yStart = Math.sin((startX + phase) / wl * 2 * Math.PI) * amp;
5725
- d += `M ${startX.toFixed(2)} ${yStart.toFixed(2)}`;
5726
- let nextX = Math.ceil(startX / step) * step;
5727
- if (nextX === startX) nextX += step;
5728
- while (nextX < endX) {
5729
- const y = Math.sin((nextX + phase) / wl * 2 * Math.PI) * amp;
5730
- d += ` L ${nextX.toFixed(2)} ${y.toFixed(2)}`;
5731
- nextX += step;
5732
- }
5733
- const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
5734
- d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
5721
+ if (amp <= 0.01) {
5722
+ return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
5723
+ }
5724
+ const safeWl = Math.max(1, wl);
5725
+ const k = 2 * Math.PI / safeWl;
5726
+ const phi = phase / safeWl * 2 * Math.PI;
5727
+ const yAt = (x) => amp * Math.sin(k * x + phi);
5728
+ const dyAt = (x) => amp * k * Math.cos(k * x + phi);
5729
+ const step = safeWl / 4;
5730
+ let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
5731
+ let currentX = startX;
5732
+ while (currentX < endX) {
5733
+ const nextX = Math.min(endX, currentX + step);
5734
+ const dx = nextX - currentX;
5735
+ const scale = dx / 3;
5736
+ const y0 = yAt(currentX);
5737
+ const dy0 = dyAt(currentX);
5738
+ const y1 = yAt(nextX);
5739
+ const dy1 = dyAt(nextX);
5740
+ const cp1x = currentX + scale;
5741
+ const cp1y = y0 + scale * dy0;
5742
+ const cp2x = nextX - scale;
5743
+ const cp2y = y1 - scale * dy1;
5744
+ d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
5745
+ currentX = nextX;
5746
+ }
5735
5747
  return d;
5736
5748
  }
5737
5749
  var CircularProgress = React62__namespace.forwardRef(
@@ -5886,16 +5898,13 @@ var CircularProgress = React62__namespace.forwardRef(
5886
5898
  position: "absolute",
5887
5899
  inset: 0,
5888
5900
  overflow: "visible",
5889
- rotate: "-90deg",
5890
5901
  transformOrigin: "center"
5891
5902
  },
5892
- animate: { rotate: ["-90deg", "270deg"] },
5903
+ animate: { rotate: [0, 360] },
5893
5904
  transition: {
5894
- rotate: {
5895
- duration: 2 / Math.max(0.1, crawlerSpeed),
5896
- repeat: Number.POSITIVE_INFINITY,
5897
- ease: "linear"
5898
- }
5905
+ duration: 2 / Math.max(0.1, crawlerSpeed),
5906
+ repeat: Number.POSITIVE_INFINITY,
5907
+ ease: "linear"
5899
5908
  },
5900
5909
  children: [
5901
5910
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5908,17 +5917,16 @@ var CircularProgress = React62__namespace.forwardRef(
5908
5917
  stroke: bgTrackColor,
5909
5918
  strokeWidth: trackHeight,
5910
5919
  strokeLinecap: "round",
5911
- style: { originX: "50%", originY: "50%" },
5912
5920
  animate: {
5913
5921
  pathLength: [
5914
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
5915
- Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
5916
- Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
5922
+ Math.max(1e-3, 0.9 - 2 * gapForTrack),
5923
+ Math.max(1e-3, 0.25 - 2 * gapForTrack),
5924
+ Math.max(1e-3, 0.9 - 2 * gapForTrack)
5917
5925
  ],
5918
- rotate: [
5919
- `${(0.1 + gapForTrack) * 360}deg`,
5920
- `${(1 + gapForTrack) * 360}deg`,
5921
- `${(1.1 + gapForTrack) * 360}deg`
5926
+ pathOffset: [
5927
+ 0.1 + gapForTrack,
5928
+ 0.75 + gapForTrack,
5929
+ 0.1 + gapForTrack
5922
5930
  ]
5923
5931
  },
5924
5932
  transition: {
@@ -5936,10 +5944,9 @@ var CircularProgress = React62__namespace.forwardRef(
5936
5944
  stroke: activeColor,
5937
5945
  strokeWidth: trackHeight,
5938
5946
  strokeLinecap: "round",
5939
- style: { originX: "50%", originY: "50%" },
5940
5947
  animate: {
5941
5948
  pathLength: [0.1, 0.75, 0.1],
5942
- rotate: ["0deg", "90deg", "360deg"]
5949
+ pathOffset: [0, 0.65, 1]
5943
5950
  },
5944
5951
  transition: {
5945
5952
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -5957,10 +5964,9 @@ var CircularProgress = React62__namespace.forwardRef(
5957
5964
  stroke: activeColor,
5958
5965
  strokeWidth: trackHeight,
5959
5966
  strokeLinecap: "round",
5960
- style: { originX: "50%", originY: "50%" },
5961
5967
  animate: {
5962
5968
  pathLength: [0.1, 0.75, 0.1],
5963
- rotate: ["0deg", "90deg", "360deg"]
5969
+ pathOffset: [0, 0.65, 1]
5964
5970
  },
5965
5971
  transition: {
5966
5972
  duration: 2 / Math.max(0.1, crawlerSpeed),
@@ -6133,6 +6139,12 @@ var WavyLinearTrack = React62__namespace.memo(function WavyLinearTrack2({
6133
6139
  duration: 0.5
6134
6140
  });
6135
6141
  react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
6142
+ } else {
6143
+ react.animate(amplitudeMV, amplitude, {
6144
+ type: "spring",
6145
+ bounce: 0,
6146
+ duration: 0.5
6147
+ });
6136
6148
  }
6137
6149
  }, [
6138
6150
  clampedValue,
@@ -6146,10 +6158,10 @@ var WavyLinearTrack = React62__namespace.memo(function WavyLinearTrack2({
6146
6158
  1,
6147
6159
  isDeterminate ? wavelength : indeterminateWavelength
6148
6160
  );
6149
- const trackAmp = trackShape === "wavy" ? amplitude : 0;
6150
6161
  react.useAnimationFrame((time) => {
6151
6162
  if (width === 0) return;
6152
6163
  const currentAmp = amplitudeMV.get();
6164
+ const trackAmp = trackShape === "wavy" ? amplitude : 0;
6153
6165
  const phase = time / 1e3 * waveSpeed * activeWavelength;
6154
6166
  const capWidth = trackHeight / 2;
6155
6167
  let activePathD = "";
@@ -6250,7 +6262,7 @@ var WavyLinearTrack = React62__namespace.memo(function WavyLinearTrack2({
6250
6262
  "div",
6251
6263
  {
6252
6264
  ref: containerRef,
6253
- className: "relative w-full overflow-hidden",
6265
+ className: "relative w-full",
6254
6266
  style: { height: svgHeight },
6255
6267
  children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
6256
6268
  "svg",
@@ -6304,7 +6316,7 @@ var LinearProgress = React62__namespace.forwardRef(
6304
6316
  waveSpeed = 1,
6305
6317
  crawlerSpeed = 1,
6306
6318
  determinateAnimation = "md3",
6307
- indeterminateAnimation = "continuous",
6319
+ indeterminateAnimation = "md3",
6308
6320
  gapSize = 4,
6309
6321
  showStopIndicator = "auto",
6310
6322
  color,
@@ -6341,15 +6353,15 @@ var LinearProgress = React62__namespace.forwardRef(
6341
6353
  setIsRtl(dir === "rtl");
6342
6354
  }
6343
6355
  }, []);
6344
- const isWavy = shape === "wavy";
6345
6356
  const resolvedTrackShape = trackShape != null ? trackShape : shape;
6357
+ const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
6346
6358
  const effectiveAmplitude = React62__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
6347
6359
  const svgHeight = React62__namespace.useMemo(
6348
6360
  () => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
6349
6361
  [isWavy, trackHeight, effectiveAmplitude]
6350
6362
  );
6351
6363
  const shouldShowStop = React62__namespace.useMemo(
6352
- () => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
6364
+ () => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
6353
6365
  [isDeterminate, resolvedTrackShape, showStopIndicator]
6354
6366
  );
6355
6367
  const stopSize = React62__namespace.useMemo(
@@ -6359,6 +6371,8 @@ var LinearProgress = React62__namespace.forwardRef(
6359
6371
  const stopOffset = (trackHeight - stopSize) / 2;
6360
6372
  const activeColor = color || "var(--md-sys-color-indicator-active)";
6361
6373
  const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
6374
+ const useWavyTrack = isWavy || !isDeterminate;
6375
+ const trackAmp = isWavy ? effectiveAmplitude : 0;
6362
6376
  return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
6363
6377
  "div",
6364
6378
  __spreadProps(__spreadValues({
@@ -6375,12 +6389,12 @@ var LinearProgress = React62__namespace.forwardRef(
6375
6389
  style: { height: svgHeight }
6376
6390
  }, restProps), {
6377
6391
  children: [
6378
- isWavy ? /* @__PURE__ */ jsxRuntime.jsx(
6392
+ useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
6379
6393
  WavyLinearTrack,
6380
6394
  {
6381
6395
  trackHeight,
6382
6396
  svgHeight,
6383
- amplitude: effectiveAmplitude,
6397
+ amplitude: trackAmp,
6384
6398
  wavelength,
6385
6399
  indeterminateWavelength,
6386
6400
  activeColor,