@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/feedback.mjs
CHANGED
|
@@ -369,24 +369,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
369
369
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
370
370
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
371
371
|
}
|
|
372
|
-
d += " Z";
|
|
373
372
|
return d;
|
|
374
373
|
}
|
|
375
374
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
376
375
|
if (startX >= endX) return "";
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
376
|
+
if (amp <= 0.01) {
|
|
377
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
378
|
+
}
|
|
379
|
+
const safeWl = Math.max(1, wl);
|
|
380
|
+
const k = 2 * Math.PI / safeWl;
|
|
381
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
382
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
383
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
384
|
+
const step = safeWl / 4;
|
|
385
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
386
|
+
let currentX = startX;
|
|
387
|
+
while (currentX < endX) {
|
|
388
|
+
const nextX = Math.min(endX, currentX + step);
|
|
389
|
+
const dx = nextX - currentX;
|
|
390
|
+
const scale = dx / 3;
|
|
391
|
+
const y0 = yAt(currentX);
|
|
392
|
+
const dy0 = dyAt(currentX);
|
|
393
|
+
const y1 = yAt(nextX);
|
|
394
|
+
const dy1 = dyAt(nextX);
|
|
395
|
+
const cp1x = currentX + scale;
|
|
396
|
+
const cp1y = y0 + scale * dy0;
|
|
397
|
+
const cp2x = nextX - scale;
|
|
398
|
+
const cp2y = y1 - scale * dy1;
|
|
399
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
400
|
+
currentX = nextX;
|
|
387
401
|
}
|
|
388
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
389
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
390
402
|
return d;
|
|
391
403
|
}
|
|
392
404
|
var CircularProgress = React12.forwardRef(
|
|
@@ -541,16 +553,13 @@ var CircularProgress = React12.forwardRef(
|
|
|
541
553
|
position: "absolute",
|
|
542
554
|
inset: 0,
|
|
543
555
|
overflow: "visible",
|
|
544
|
-
rotate: "-90deg",
|
|
545
556
|
transformOrigin: "center"
|
|
546
557
|
},
|
|
547
|
-
animate: { rotate: [
|
|
558
|
+
animate: { rotate: [0, 360] },
|
|
548
559
|
transition: {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
ease: "linear"
|
|
553
|
-
}
|
|
560
|
+
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
561
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
562
|
+
ease: "linear"
|
|
554
563
|
},
|
|
555
564
|
children: [
|
|
556
565
|
/* @__PURE__ */ jsx(
|
|
@@ -563,17 +572,16 @@ var CircularProgress = React12.forwardRef(
|
|
|
563
572
|
stroke: bgTrackColor,
|
|
564
573
|
strokeWidth: trackHeight,
|
|
565
574
|
strokeLinecap: "round",
|
|
566
|
-
style: { originX: "50%", originY: "50%" },
|
|
567
575
|
animate: {
|
|
568
576
|
pathLength: [
|
|
569
|
-
Math.max(1e-3,
|
|
570
|
-
Math.max(1e-3,
|
|
571
|
-
Math.max(1e-3,
|
|
577
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
578
|
+
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
579
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
572
580
|
],
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
581
|
+
pathOffset: [
|
|
582
|
+
0.1 + gapForTrack,
|
|
583
|
+
0.75 + gapForTrack,
|
|
584
|
+
0.1 + gapForTrack
|
|
577
585
|
]
|
|
578
586
|
},
|
|
579
587
|
transition: {
|
|
@@ -591,10 +599,9 @@ var CircularProgress = React12.forwardRef(
|
|
|
591
599
|
stroke: activeColor,
|
|
592
600
|
strokeWidth: trackHeight,
|
|
593
601
|
strokeLinecap: "round",
|
|
594
|
-
style: { originX: "50%", originY: "50%" },
|
|
595
602
|
animate: {
|
|
596
603
|
pathLength: [0.1, 0.75, 0.1],
|
|
597
|
-
|
|
604
|
+
pathOffset: [0, 0.65, 1]
|
|
598
605
|
},
|
|
599
606
|
transition: {
|
|
600
607
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -612,10 +619,9 @@ var CircularProgress = React12.forwardRef(
|
|
|
612
619
|
stroke: activeColor,
|
|
613
620
|
strokeWidth: trackHeight,
|
|
614
621
|
strokeLinecap: "round",
|
|
615
|
-
style: { originX: "50%", originY: "50%" },
|
|
616
622
|
animate: {
|
|
617
623
|
pathLength: [0.1, 0.75, 0.1],
|
|
618
|
-
|
|
624
|
+
pathOffset: [0, 0.65, 1]
|
|
619
625
|
},
|
|
620
626
|
transition: {
|
|
621
627
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -788,6 +794,12 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
788
794
|
duration: 0.5
|
|
789
795
|
});
|
|
790
796
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
797
|
+
} else {
|
|
798
|
+
animate(amplitudeMV, amplitude, {
|
|
799
|
+
type: "spring",
|
|
800
|
+
bounce: 0,
|
|
801
|
+
duration: 0.5
|
|
802
|
+
});
|
|
791
803
|
}
|
|
792
804
|
}, [
|
|
793
805
|
clampedValue,
|
|
@@ -801,10 +813,10 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
801
813
|
1,
|
|
802
814
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
803
815
|
);
|
|
804
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
805
816
|
useAnimationFrame((time) => {
|
|
806
817
|
if (width === 0) return;
|
|
807
818
|
const currentAmp = amplitudeMV.get();
|
|
819
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
808
820
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
809
821
|
const capWidth = trackHeight / 2;
|
|
810
822
|
let activePathD = "";
|
|
@@ -905,7 +917,7 @@ var WavyLinearTrack = React12.memo(function WavyLinearTrack2({
|
|
|
905
917
|
"div",
|
|
906
918
|
{
|
|
907
919
|
ref: containerRef,
|
|
908
|
-
className: "relative w-full
|
|
920
|
+
className: "relative w-full",
|
|
909
921
|
style: { height: svgHeight },
|
|
910
922
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
911
923
|
"svg",
|
|
@@ -959,7 +971,7 @@ var LinearProgress = React12.forwardRef(
|
|
|
959
971
|
waveSpeed = 1,
|
|
960
972
|
crawlerSpeed = 1,
|
|
961
973
|
determinateAnimation = "md3",
|
|
962
|
-
indeterminateAnimation = "
|
|
974
|
+
indeterminateAnimation = "md3",
|
|
963
975
|
gapSize = 4,
|
|
964
976
|
showStopIndicator = "auto",
|
|
965
977
|
color,
|
|
@@ -996,15 +1008,15 @@ var LinearProgress = React12.forwardRef(
|
|
|
996
1008
|
setIsRtl(dir === "rtl");
|
|
997
1009
|
}
|
|
998
1010
|
}, []);
|
|
999
|
-
const isWavy = shape === "wavy";
|
|
1000
1011
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1012
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1001
1013
|
const effectiveAmplitude = React12.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1002
1014
|
const svgHeight = React12.useMemo(
|
|
1003
1015
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1004
1016
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1005
1017
|
);
|
|
1006
1018
|
const shouldShowStop = React12.useMemo(
|
|
1007
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1019
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1008
1020
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1009
1021
|
);
|
|
1010
1022
|
const stopSize = React12.useMemo(
|
|
@@ -1014,6 +1026,8 @@ var LinearProgress = React12.forwardRef(
|
|
|
1014
1026
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
1015
1027
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
1016
1028
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1029
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1030
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
1017
1031
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
1018
1032
|
"div",
|
|
1019
1033
|
__spreadProps(__spreadValues({
|
|
@@ -1030,12 +1044,12 @@ var LinearProgress = React12.forwardRef(
|
|
|
1030
1044
|
style: { height: svgHeight }
|
|
1031
1045
|
}, restProps), {
|
|
1032
1046
|
children: [
|
|
1033
|
-
|
|
1047
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
1034
1048
|
WavyLinearTrack,
|
|
1035
1049
|
{
|
|
1036
1050
|
trackHeight,
|
|
1037
1051
|
svgHeight,
|
|
1038
|
-
amplitude:
|
|
1052
|
+
amplitude: trackAmp,
|
|
1039
1053
|
wavelength,
|
|
1040
1054
|
indeterminateWavelength,
|
|
1041
1055
|
activeColor,
|