@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/layout.mjs
CHANGED
|
@@ -515,24 +515,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
515
515
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
516
516
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
517
517
|
}
|
|
518
|
-
d += " Z";
|
|
519
518
|
return d;
|
|
520
519
|
}
|
|
521
520
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
522
521
|
if (startX >= endX) return "";
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
522
|
+
if (amp <= 0.01) {
|
|
523
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
524
|
+
}
|
|
525
|
+
const safeWl = Math.max(1, wl);
|
|
526
|
+
const k = 2 * Math.PI / safeWl;
|
|
527
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
528
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
529
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
530
|
+
const step = safeWl / 4;
|
|
531
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
532
|
+
let currentX = startX;
|
|
533
|
+
while (currentX < endX) {
|
|
534
|
+
const nextX = Math.min(endX, currentX + step);
|
|
535
|
+
const dx = nextX - currentX;
|
|
536
|
+
const scale = dx / 3;
|
|
537
|
+
const y0 = yAt(currentX);
|
|
538
|
+
const dy0 = dyAt(currentX);
|
|
539
|
+
const y1 = yAt(nextX);
|
|
540
|
+
const dy1 = dyAt(nextX);
|
|
541
|
+
const cp1x = currentX + scale;
|
|
542
|
+
const cp1y = y0 + scale * dy0;
|
|
543
|
+
const cp2x = nextX - scale;
|
|
544
|
+
const cp2y = y1 - scale * dy1;
|
|
545
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
546
|
+
currentX = nextX;
|
|
547
|
+
}
|
|
536
548
|
return d;
|
|
537
549
|
}
|
|
538
550
|
var CircularProgress = React18.forwardRef(
|
|
@@ -687,16 +699,13 @@ var CircularProgress = React18.forwardRef(
|
|
|
687
699
|
position: "absolute",
|
|
688
700
|
inset: 0,
|
|
689
701
|
overflow: "visible",
|
|
690
|
-
rotate: "-90deg",
|
|
691
702
|
transformOrigin: "center"
|
|
692
703
|
},
|
|
693
|
-
animate: { rotate: [
|
|
704
|
+
animate: { rotate: [0, 360] },
|
|
694
705
|
transition: {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
ease: "linear"
|
|
699
|
-
}
|
|
706
|
+
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
707
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
708
|
+
ease: "linear"
|
|
700
709
|
},
|
|
701
710
|
children: [
|
|
702
711
|
/* @__PURE__ */ jsx(
|
|
@@ -709,17 +718,16 @@ var CircularProgress = React18.forwardRef(
|
|
|
709
718
|
stroke: bgTrackColor,
|
|
710
719
|
strokeWidth: trackHeight,
|
|
711
720
|
strokeLinecap: "round",
|
|
712
|
-
style: { originX: "50%", originY: "50%" },
|
|
713
721
|
animate: {
|
|
714
722
|
pathLength: [
|
|
715
|
-
Math.max(1e-3,
|
|
716
|
-
Math.max(1e-3,
|
|
717
|
-
Math.max(1e-3,
|
|
723
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
724
|
+
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
725
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
718
726
|
],
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
727
|
+
pathOffset: [
|
|
728
|
+
0.1 + gapForTrack,
|
|
729
|
+
0.75 + gapForTrack,
|
|
730
|
+
0.1 + gapForTrack
|
|
723
731
|
]
|
|
724
732
|
},
|
|
725
733
|
transition: {
|
|
@@ -737,10 +745,9 @@ var CircularProgress = React18.forwardRef(
|
|
|
737
745
|
stroke: activeColor,
|
|
738
746
|
strokeWidth: trackHeight,
|
|
739
747
|
strokeLinecap: "round",
|
|
740
|
-
style: { originX: "50%", originY: "50%" },
|
|
741
748
|
animate: {
|
|
742
749
|
pathLength: [0.1, 0.75, 0.1],
|
|
743
|
-
|
|
750
|
+
pathOffset: [0, 0.65, 1]
|
|
744
751
|
},
|
|
745
752
|
transition: {
|
|
746
753
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -758,10 +765,9 @@ var CircularProgress = React18.forwardRef(
|
|
|
758
765
|
stroke: activeColor,
|
|
759
766
|
strokeWidth: trackHeight,
|
|
760
767
|
strokeLinecap: "round",
|
|
761
|
-
style: { originX: "50%", originY: "50%" },
|
|
762
768
|
animate: {
|
|
763
769
|
pathLength: [0.1, 0.75, 0.1],
|
|
764
|
-
|
|
770
|
+
pathOffset: [0, 0.65, 1]
|
|
765
771
|
},
|
|
766
772
|
transition: {
|
|
767
773
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -934,6 +940,12 @@ var WavyLinearTrack = React18.memo(function WavyLinearTrack2({
|
|
|
934
940
|
duration: 0.5
|
|
935
941
|
});
|
|
936
942
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
943
|
+
} else {
|
|
944
|
+
animate(amplitudeMV, amplitude, {
|
|
945
|
+
type: "spring",
|
|
946
|
+
bounce: 0,
|
|
947
|
+
duration: 0.5
|
|
948
|
+
});
|
|
937
949
|
}
|
|
938
950
|
}, [
|
|
939
951
|
clampedValue,
|
|
@@ -947,10 +959,10 @@ var WavyLinearTrack = React18.memo(function WavyLinearTrack2({
|
|
|
947
959
|
1,
|
|
948
960
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
949
961
|
);
|
|
950
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
951
962
|
useAnimationFrame((time) => {
|
|
952
963
|
if (width === 0) return;
|
|
953
964
|
const currentAmp = amplitudeMV.get();
|
|
965
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
954
966
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
955
967
|
const capWidth = trackHeight / 2;
|
|
956
968
|
let activePathD = "";
|
|
@@ -1051,7 +1063,7 @@ var WavyLinearTrack = React18.memo(function WavyLinearTrack2({
|
|
|
1051
1063
|
"div",
|
|
1052
1064
|
{
|
|
1053
1065
|
ref: containerRef,
|
|
1054
|
-
className: "relative w-full
|
|
1066
|
+
className: "relative w-full",
|
|
1055
1067
|
style: { height: svgHeight },
|
|
1056
1068
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
1057
1069
|
"svg",
|
|
@@ -1105,7 +1117,7 @@ var LinearProgress = React18.forwardRef(
|
|
|
1105
1117
|
waveSpeed = 1,
|
|
1106
1118
|
crawlerSpeed = 1,
|
|
1107
1119
|
determinateAnimation = "md3",
|
|
1108
|
-
indeterminateAnimation = "
|
|
1120
|
+
indeterminateAnimation = "md3",
|
|
1109
1121
|
gapSize = 4,
|
|
1110
1122
|
showStopIndicator = "auto",
|
|
1111
1123
|
color,
|
|
@@ -1142,15 +1154,15 @@ var LinearProgress = React18.forwardRef(
|
|
|
1142
1154
|
setIsRtl(dir === "rtl");
|
|
1143
1155
|
}
|
|
1144
1156
|
}, []);
|
|
1145
|
-
const isWavy = shape === "wavy";
|
|
1146
1157
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1158
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1147
1159
|
const effectiveAmplitude = React18.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1148
1160
|
const svgHeight = React18.useMemo(
|
|
1149
1161
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1150
1162
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1151
1163
|
);
|
|
1152
1164
|
const shouldShowStop = React18.useMemo(
|
|
1153
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1165
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1154
1166
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1155
1167
|
);
|
|
1156
1168
|
const stopSize = React18.useMemo(
|
|
@@ -1160,6 +1172,8 @@ var LinearProgress = React18.forwardRef(
|
|
|
1160
1172
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
1161
1173
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
1162
1174
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1175
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1176
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
1163
1177
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
1164
1178
|
"div",
|
|
1165
1179
|
__spreadProps(__spreadValues({
|
|
@@ -1176,12 +1190,12 @@ var LinearProgress = React18.forwardRef(
|
|
|
1176
1190
|
style: { height: svgHeight }
|
|
1177
1191
|
}, restProps), {
|
|
1178
1192
|
children: [
|
|
1179
|
-
|
|
1193
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
1180
1194
|
WavyLinearTrack,
|
|
1181
1195
|
{
|
|
1182
1196
|
trackHeight,
|
|
1183
1197
|
svgHeight,
|
|
1184
|
-
amplitude:
|
|
1198
|
+
amplitude: trackAmp,
|
|
1185
1199
|
wavelength,
|
|
1186
1200
|
indeterminateWavelength,
|
|
1187
1201
|
activeColor,
|