@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/CHANGELOG.md +6 -0
- package/dist/buttons.js +53 -39
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +53 -39
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +54 -40
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +54 -40
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +53 -39
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +53 -39
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.js +54 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -40
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +54 -40
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +54 -40
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +53 -39
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +53 -39
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +53 -39
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +53 -39
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +53 -39
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +53 -39
- package/dist/pickers.mjs.map +1 -1
- package/package.json +1 -1
package/dist/core.mjs
CHANGED
|
@@ -646,24 +646,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
646
646
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
647
647
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
648
648
|
}
|
|
649
|
-
d += " Z";
|
|
650
649
|
return d;
|
|
651
650
|
}
|
|
652
651
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
653
652
|
if (startX >= endX) return "";
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
653
|
+
if (amp <= 0.01) {
|
|
654
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
655
|
+
}
|
|
656
|
+
const safeWl = Math.max(1, wl);
|
|
657
|
+
const k = 2 * Math.PI / safeWl;
|
|
658
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
659
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
660
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
661
|
+
const step = safeWl / 4;
|
|
662
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
663
|
+
let currentX = startX;
|
|
664
|
+
while (currentX < endX) {
|
|
665
|
+
const nextX = Math.min(endX, currentX + step);
|
|
666
|
+
const dx = nextX - currentX;
|
|
667
|
+
const scale = dx / 3;
|
|
668
|
+
const y0 = yAt(currentX);
|
|
669
|
+
const dy0 = dyAt(currentX);
|
|
670
|
+
const y1 = yAt(nextX);
|
|
671
|
+
const dy1 = dyAt(nextX);
|
|
672
|
+
const cp1x = currentX + scale;
|
|
673
|
+
const cp1y = y0 + scale * dy0;
|
|
674
|
+
const cp2x = nextX - scale;
|
|
675
|
+
const cp2y = y1 - scale * dy1;
|
|
676
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
677
|
+
currentX = nextX;
|
|
678
|
+
}
|
|
667
679
|
return d;
|
|
668
680
|
}
|
|
669
681
|
var CircularProgress = React11.forwardRef(
|
|
@@ -818,16 +830,13 @@ var CircularProgress = React11.forwardRef(
|
|
|
818
830
|
position: "absolute",
|
|
819
831
|
inset: 0,
|
|
820
832
|
overflow: "visible",
|
|
821
|
-
rotate: "-90deg",
|
|
822
833
|
transformOrigin: "center"
|
|
823
834
|
},
|
|
824
|
-
animate: { rotate: [
|
|
835
|
+
animate: { rotate: [0, 360] },
|
|
825
836
|
transition: {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
ease: "linear"
|
|
830
|
-
}
|
|
837
|
+
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
838
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
839
|
+
ease: "linear"
|
|
831
840
|
},
|
|
832
841
|
children: [
|
|
833
842
|
/* @__PURE__ */ jsx(
|
|
@@ -840,17 +849,16 @@ var CircularProgress = React11.forwardRef(
|
|
|
840
849
|
stroke: bgTrackColor,
|
|
841
850
|
strokeWidth: trackHeight,
|
|
842
851
|
strokeLinecap: "round",
|
|
843
|
-
style: { originX: "50%", originY: "50%" },
|
|
844
852
|
animate: {
|
|
845
853
|
pathLength: [
|
|
846
|
-
Math.max(1e-3,
|
|
847
|
-
Math.max(1e-3,
|
|
848
|
-
Math.max(1e-3,
|
|
854
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
855
|
+
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
856
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
849
857
|
],
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
858
|
+
pathOffset: [
|
|
859
|
+
0.1 + gapForTrack,
|
|
860
|
+
0.75 + gapForTrack,
|
|
861
|
+
0.1 + gapForTrack
|
|
854
862
|
]
|
|
855
863
|
},
|
|
856
864
|
transition: {
|
|
@@ -868,10 +876,9 @@ var CircularProgress = React11.forwardRef(
|
|
|
868
876
|
stroke: activeColor,
|
|
869
877
|
strokeWidth: trackHeight,
|
|
870
878
|
strokeLinecap: "round",
|
|
871
|
-
style: { originX: "50%", originY: "50%" },
|
|
872
879
|
animate: {
|
|
873
880
|
pathLength: [0.1, 0.75, 0.1],
|
|
874
|
-
|
|
881
|
+
pathOffset: [0, 0.65, 1]
|
|
875
882
|
},
|
|
876
883
|
transition: {
|
|
877
884
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -889,10 +896,9 @@ var CircularProgress = React11.forwardRef(
|
|
|
889
896
|
stroke: activeColor,
|
|
890
897
|
strokeWidth: trackHeight,
|
|
891
898
|
strokeLinecap: "round",
|
|
892
|
-
style: { originX: "50%", originY: "50%" },
|
|
893
899
|
animate: {
|
|
894
900
|
pathLength: [0.1, 0.75, 0.1],
|
|
895
|
-
|
|
901
|
+
pathOffset: [0, 0.65, 1]
|
|
896
902
|
},
|
|
897
903
|
transition: {
|
|
898
904
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -1065,6 +1071,12 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
1065
1071
|
duration: 0.5
|
|
1066
1072
|
});
|
|
1067
1073
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
1074
|
+
} else {
|
|
1075
|
+
animate(amplitudeMV, amplitude, {
|
|
1076
|
+
type: "spring",
|
|
1077
|
+
bounce: 0,
|
|
1078
|
+
duration: 0.5
|
|
1079
|
+
});
|
|
1068
1080
|
}
|
|
1069
1081
|
}, [
|
|
1070
1082
|
clampedValue,
|
|
@@ -1078,10 +1090,10 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
1078
1090
|
1,
|
|
1079
1091
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
1080
1092
|
);
|
|
1081
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
1082
1093
|
useAnimationFrame((time) => {
|
|
1083
1094
|
if (width === 0) return;
|
|
1084
1095
|
const currentAmp = amplitudeMV.get();
|
|
1096
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
1085
1097
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
1086
1098
|
const capWidth = trackHeight / 2;
|
|
1087
1099
|
let activePathD = "";
|
|
@@ -1182,7 +1194,7 @@ var WavyLinearTrack = React11.memo(function WavyLinearTrack2({
|
|
|
1182
1194
|
"div",
|
|
1183
1195
|
{
|
|
1184
1196
|
ref: containerRef,
|
|
1185
|
-
className: "relative w-full
|
|
1197
|
+
className: "relative w-full",
|
|
1186
1198
|
style: { height: svgHeight },
|
|
1187
1199
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
1188
1200
|
"svg",
|
|
@@ -1236,7 +1248,7 @@ var LinearProgress = React11.forwardRef(
|
|
|
1236
1248
|
waveSpeed = 1,
|
|
1237
1249
|
crawlerSpeed = 1,
|
|
1238
1250
|
determinateAnimation = "md3",
|
|
1239
|
-
indeterminateAnimation = "
|
|
1251
|
+
indeterminateAnimation = "md3",
|
|
1240
1252
|
gapSize = 4,
|
|
1241
1253
|
showStopIndicator = "auto",
|
|
1242
1254
|
color,
|
|
@@ -1273,15 +1285,15 @@ var LinearProgress = React11.forwardRef(
|
|
|
1273
1285
|
setIsRtl(dir === "rtl");
|
|
1274
1286
|
}
|
|
1275
1287
|
}, []);
|
|
1276
|
-
const isWavy = shape === "wavy";
|
|
1277
1288
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1289
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1278
1290
|
const effectiveAmplitude = React11.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1279
1291
|
const svgHeight = React11.useMemo(
|
|
1280
1292
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1281
1293
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1282
1294
|
);
|
|
1283
1295
|
const shouldShowStop = React11.useMemo(
|
|
1284
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1296
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1285
1297
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1286
1298
|
);
|
|
1287
1299
|
const stopSize = React11.useMemo(
|
|
@@ -1291,6 +1303,8 @@ var LinearProgress = React11.forwardRef(
|
|
|
1291
1303
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
1292
1304
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
1293
1305
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1306
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1307
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
1294
1308
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
1295
1309
|
"div",
|
|
1296
1310
|
__spreadProps(__spreadValues({
|
|
@@ -1307,12 +1321,12 @@ var LinearProgress = React11.forwardRef(
|
|
|
1307
1321
|
style: { height: svgHeight }
|
|
1308
1322
|
}, restProps), {
|
|
1309
1323
|
children: [
|
|
1310
|
-
|
|
1324
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
1311
1325
|
WavyLinearTrack,
|
|
1312
1326
|
{
|
|
1313
1327
|
trackHeight,
|
|
1314
1328
|
svgHeight,
|
|
1315
|
-
amplitude:
|
|
1329
|
+
amplitude: trackAmp,
|
|
1316
1330
|
wavelength,
|
|
1317
1331
|
indeterminateWavelength,
|
|
1318
1332
|
activeColor,
|