@bug-on/m3-expressive 1.2.5 → 1.2.7
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 +12 -0
- package/dist/buttons.js +260 -98
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +261 -99
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +338 -176
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +321 -159
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +32 -0
- package/dist/feedback.d.ts +32 -0
- package/dist/feedback.js +348 -186
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +326 -164
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.js +261 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +262 -100
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +261 -99
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +262 -100
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.js +260 -98
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +261 -99
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.js +391 -229
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +354 -192
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +399 -237
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +367 -205
- package/dist/pickers.mjs.map +1 -1
- package/package.json +1 -1
package/dist/layout.js
CHANGED
|
@@ -537,26 +537,46 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
537
537
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
538
538
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
539
539
|
}
|
|
540
|
-
d
|
|
541
|
-
return d;
|
|
540
|
+
return `${d} Z`;
|
|
542
541
|
}
|
|
543
542
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
544
543
|
if (startX >= endX) return "";
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
544
|
+
if (amp <= 0.01) {
|
|
545
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
546
|
+
}
|
|
547
|
+
const safeWl = Math.max(1, wl);
|
|
548
|
+
const k = 2 * Math.PI / safeWl;
|
|
549
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
550
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
551
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
552
|
+
const step = safeWl / 4;
|
|
553
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
554
|
+
let currentX = startX;
|
|
555
|
+
while (currentX < endX) {
|
|
556
|
+
const nextX = Math.min(endX, currentX + step);
|
|
557
|
+
const dx = nextX - currentX;
|
|
558
|
+
const scale = dx / 3;
|
|
559
|
+
const y0 = yAt(currentX);
|
|
560
|
+
const dy0 = dyAt(currentX);
|
|
561
|
+
const y1 = yAt(nextX);
|
|
562
|
+
const dy1 = dyAt(nextX);
|
|
563
|
+
const cp1x = currentX + scale;
|
|
564
|
+
const cp1y = y0 + scale * dy0;
|
|
565
|
+
const cp2x = nextX - scale;
|
|
566
|
+
const cp2y = y1 - scale * dy1;
|
|
567
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
568
|
+
currentX = nextX;
|
|
569
|
+
}
|
|
558
570
|
return d;
|
|
559
571
|
}
|
|
572
|
+
var GLOBAL_ROTATION_DURATION = 6e3;
|
|
573
|
+
var GLOBAL_ROTATION_TARGET = 1080;
|
|
574
|
+
var ADDITIONAL_ROTATION_CYCLE = 1500;
|
|
575
|
+
var ADDITIONAL_ROTATION_STEP = 90;
|
|
576
|
+
var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
577
|
+
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
578
|
+
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
579
|
+
var PROGRESS_CYCLE_DURATION = 1500;
|
|
560
580
|
var CircularProgress = React18__namespace.forwardRef(
|
|
561
581
|
(_a, ref) => {
|
|
562
582
|
var _b = _a, {
|
|
@@ -570,6 +590,10 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
570
590
|
crawlerSpeed = 1,
|
|
571
591
|
color,
|
|
572
592
|
trackColor,
|
|
593
|
+
showTrack = "auto",
|
|
594
|
+
minProgress = DEFAULT_MIN_PROGRESS,
|
|
595
|
+
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
596
|
+
amplitudeRange,
|
|
573
597
|
className,
|
|
574
598
|
"aria-label": ariaLabel
|
|
575
599
|
} = _b, restProps = __objRest(_b, [
|
|
@@ -583,6 +607,10 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
583
607
|
"crawlerSpeed",
|
|
584
608
|
"color",
|
|
585
609
|
"trackColor",
|
|
610
|
+
"showTrack",
|
|
611
|
+
"minProgress",
|
|
612
|
+
"maxProgress",
|
|
613
|
+
"amplitudeRange",
|
|
586
614
|
"className",
|
|
587
615
|
"aria-label"
|
|
588
616
|
]);
|
|
@@ -593,6 +621,7 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
593
621
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
594
622
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
595
623
|
const isWavy = shape === "wavy";
|
|
624
|
+
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
596
625
|
const BASELINE_SIZE = 48;
|
|
597
626
|
const scaleFactor = size / BASELINE_SIZE;
|
|
598
627
|
const effectiveAmplitude = React18__namespace.useMemo(
|
|
@@ -603,6 +632,10 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
603
632
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
604
633
|
[wavelength, scaleFactor]
|
|
605
634
|
);
|
|
635
|
+
const resolvedAmplitudeRange = React18__namespace.useMemo(
|
|
636
|
+
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
637
|
+
[amplitudeRange, effectiveAmplitude]
|
|
638
|
+
);
|
|
606
639
|
const wavyActivePath = React18__namespace.useMemo(
|
|
607
640
|
() => isWavy ? generateWavyCircularPath(
|
|
608
641
|
center,
|
|
@@ -622,6 +655,145 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
622
655
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
623
656
|
const ActiveCircleElem = react.m.circle;
|
|
624
657
|
const ActivePathElem = react.m.path;
|
|
658
|
+
const indeterminateSvgRef = React18__namespace.useRef(null);
|
|
659
|
+
const indeterminateTrackRef = React18__namespace.useRef(null);
|
|
660
|
+
const indeterminateActiveRef = React18__namespace.useRef(null);
|
|
661
|
+
const indeterminateWavyTrackPathRef = React18__namespace.useRef(null);
|
|
662
|
+
const indeterminateWavyActivePathRef = React18__namespace.useRef(null);
|
|
663
|
+
const cachedPathLengthRef = React18__namespace.useRef(0);
|
|
664
|
+
React18__namespace.useLayoutEffect(() => {
|
|
665
|
+
if (!isWavy || !wavyActivePath) {
|
|
666
|
+
cachedPathLengthRef.current = circumference;
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const el = indeterminateActiveRef.current;
|
|
670
|
+
if (el && "getTotalLength" in el) {
|
|
671
|
+
try {
|
|
672
|
+
const len = el.getTotalLength();
|
|
673
|
+
if (len > 0) {
|
|
674
|
+
cachedPathLengthRef.current = len;
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
} catch (e) {
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
cachedPathLengthRef.current = circumference;
|
|
681
|
+
}, [isWavy, circumference, wavyActivePath]);
|
|
682
|
+
react.useAnimationFrame((time) => {
|
|
683
|
+
if (isDeterminate) return;
|
|
684
|
+
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
685
|
+
const scaledTime = time * safeCrawlerSpeed;
|
|
686
|
+
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
687
|
+
const globalAngle = globalCycle / GLOBAL_ROTATION_DURATION * GLOBAL_ROTATION_TARGET;
|
|
688
|
+
const additionalFullCycles = Math.floor(
|
|
689
|
+
scaledTime / ADDITIONAL_ROTATION_CYCLE
|
|
690
|
+
);
|
|
691
|
+
const additionalCycleTime = scaledTime % ADDITIONAL_ROTATION_CYCLE;
|
|
692
|
+
const additionalEaseT = Math.min(
|
|
693
|
+
1,
|
|
694
|
+
additionalCycleTime / ADDITIONAL_ROTATION_EASE_DURATION
|
|
695
|
+
);
|
|
696
|
+
const additionalAngle = (additionalFullCycles + easeInOutCubic(additionalEaseT)) * ADDITIONAL_ROTATION_STEP;
|
|
697
|
+
const totalRotation = globalAngle + additionalAngle;
|
|
698
|
+
if (indeterminateSvgRef.current) {
|
|
699
|
+
indeterminateSvgRef.current.style.transform = `rotate(${totalRotation - 90}deg)`;
|
|
700
|
+
}
|
|
701
|
+
const progressFullCycle = PROGRESS_CYCLE_DURATION * 2;
|
|
702
|
+
const progressCycleTime = scaledTime % progressFullCycle;
|
|
703
|
+
let progress;
|
|
704
|
+
if (progressCycleTime < PROGRESS_CYCLE_DURATION) {
|
|
705
|
+
const t = progressCycleTime / PROGRESS_CYCLE_DURATION;
|
|
706
|
+
progress = minProgress + (maxProgress - minProgress) * easeInOutCubic(t);
|
|
707
|
+
} else {
|
|
708
|
+
const t = (progressCycleTime - PROGRESS_CYCLE_DURATION) / PROGRESS_CYCLE_DURATION;
|
|
709
|
+
progress = maxProgress - (maxProgress - minProgress) * easeInOutCubic(t);
|
|
710
|
+
}
|
|
711
|
+
if (isWavy) {
|
|
712
|
+
const amplitudeT = (progress - minProgress) / (maxProgress - minProgress);
|
|
713
|
+
const currentAmplitude = resolvedAmplitudeRange[0] + (resolvedAmplitudeRange[1] - resolvedAmplitudeRange[0]) * amplitudeT;
|
|
714
|
+
const dynamicPath = generateWavyCircularPath(
|
|
715
|
+
center,
|
|
716
|
+
radius,
|
|
717
|
+
currentAmplitude,
|
|
718
|
+
effectiveWavelength
|
|
719
|
+
);
|
|
720
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
721
|
+
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
722
|
+
}
|
|
723
|
+
if (indeterminateWavyTrackPathRef.current) {
|
|
724
|
+
indeterminateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
725
|
+
}
|
|
726
|
+
const pathEl = indeterminateWavyActivePathRef.current;
|
|
727
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
728
|
+
if (pathEl) {
|
|
729
|
+
try {
|
|
730
|
+
const len = pathEl.getTotalLength();
|
|
731
|
+
if (len > 0) totalLen = len;
|
|
732
|
+
} catch (e) {
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
736
|
+
const activeLen = totalLen * progress;
|
|
737
|
+
const activeOff = 0;
|
|
738
|
+
if (indeterminateWavyActivePathRef.current) {
|
|
739
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
740
|
+
"stroke-dasharray",
|
|
741
|
+
`${activeLen} ${totalLen}`
|
|
742
|
+
);
|
|
743
|
+
indeterminateWavyActivePathRef.current.setAttribute(
|
|
744
|
+
"stroke-dashoffset",
|
|
745
|
+
`${activeOff}`
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
if (shouldShowIndeterminateTrack && indeterminateWavyTrackPathRef.current) {
|
|
749
|
+
const trackStartFrac = progress + gapFrac;
|
|
750
|
+
const trackLen = Math.max(
|
|
751
|
+
1e-3,
|
|
752
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
753
|
+
);
|
|
754
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
755
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
756
|
+
"stroke-dasharray",
|
|
757
|
+
`${trackLen} ${totalLen}`
|
|
758
|
+
);
|
|
759
|
+
indeterminateWavyTrackPathRef.current.setAttribute(
|
|
760
|
+
"stroke-dashoffset",
|
|
761
|
+
`${trackOff}`
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
} else {
|
|
765
|
+
const totalLen = circumference;
|
|
766
|
+
const activeLen = totalLen * progress;
|
|
767
|
+
const activeOff = 0;
|
|
768
|
+
if (indeterminateActiveRef.current) {
|
|
769
|
+
indeterminateActiveRef.current.setAttribute(
|
|
770
|
+
"stroke-dasharray",
|
|
771
|
+
`${activeLen} ${totalLen}`
|
|
772
|
+
);
|
|
773
|
+
indeterminateActiveRef.current.setAttribute(
|
|
774
|
+
"stroke-dashoffset",
|
|
775
|
+
`${activeOff}`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
if (shouldShowIndeterminateTrack && indeterminateTrackRef.current) {
|
|
779
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
780
|
+
const trackStartFrac = progress + gapFrac;
|
|
781
|
+
const trackLen = Math.max(
|
|
782
|
+
1e-3,
|
|
783
|
+
totalLen * (1 - progress - 2 * gapFrac)
|
|
784
|
+
);
|
|
785
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
786
|
+
indeterminateTrackRef.current.setAttribute(
|
|
787
|
+
"stroke-dasharray",
|
|
788
|
+
`${trackLen} ${totalLen}`
|
|
789
|
+
);
|
|
790
|
+
indeterminateTrackRef.current.setAttribute(
|
|
791
|
+
"stroke-dashoffset",
|
|
792
|
+
`${trackOff}`
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
});
|
|
625
797
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
626
798
|
"div",
|
|
627
799
|
__spreadProps(__spreadValues({
|
|
@@ -698,9 +870,10 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
698
870
|
]
|
|
699
871
|
}
|
|
700
872
|
),
|
|
701
|
-
!isDeterminate && /* @__PURE__ */ jsxRuntime.
|
|
702
|
-
|
|
873
|
+
!isDeterminate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
874
|
+
"svg",
|
|
703
875
|
{
|
|
876
|
+
ref: indeterminateSvgRef,
|
|
704
877
|
width: size,
|
|
705
878
|
height: size,
|
|
706
879
|
viewBox: `0 0 ${size} ${size}`,
|
|
@@ -709,90 +882,60 @@ var CircularProgress = React18__namespace.forwardRef(
|
|
|
709
882
|
position: "absolute",
|
|
710
883
|
inset: 0,
|
|
711
884
|
overflow: "visible",
|
|
712
|
-
|
|
713
|
-
|
|
885
|
+
transformOrigin: "center",
|
|
886
|
+
transform: "rotate(-90deg)"
|
|
714
887
|
},
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
719
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
720
|
-
ease: "linear"
|
|
721
|
-
}
|
|
722
|
-
},
|
|
723
|
-
children: [
|
|
724
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
725
|
-
react.m.circle,
|
|
888
|
+
children: isWavy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
889
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
890
|
+
"path",
|
|
726
891
|
{
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
r: radius,
|
|
892
|
+
ref: indeterminateWavyTrackPathRef,
|
|
893
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
730
894
|
fill: "none",
|
|
731
895
|
stroke: bgTrackColor,
|
|
732
896
|
strokeWidth: trackHeight,
|
|
733
|
-
strokeLinecap: "round"
|
|
734
|
-
style: { originX: "50%", originY: "50%" },
|
|
735
|
-
animate: {
|
|
736
|
-
pathLength: [
|
|
737
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack),
|
|
738
|
-
Math.max(1e-3, 1 - 0.75 - 2 * gapForTrack),
|
|
739
|
-
Math.max(1e-3, 1 - 0.1 - 2 * gapForTrack)
|
|
740
|
-
],
|
|
741
|
-
rotate: [
|
|
742
|
-
`${(0.1 + gapForTrack) * 360}deg`,
|
|
743
|
-
`${(1 + gapForTrack) * 360}deg`,
|
|
744
|
-
`${(1.1 + gapForTrack) * 360}deg`
|
|
745
|
-
]
|
|
746
|
-
},
|
|
747
|
-
transition: {
|
|
748
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
749
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
750
|
-
ease: [0.4, 0, 0.2, 1]
|
|
751
|
-
}
|
|
897
|
+
strokeLinecap: "round"
|
|
752
898
|
}
|
|
753
899
|
),
|
|
754
|
-
|
|
755
|
-
|
|
900
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
901
|
+
"path",
|
|
756
902
|
{
|
|
903
|
+
ref: indeterminateWavyActivePathRef,
|
|
757
904
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
758
905
|
fill: "none",
|
|
759
906
|
stroke: activeColor,
|
|
760
907
|
strokeWidth: trackHeight,
|
|
761
|
-
strokeLinecap: "round"
|
|
762
|
-
style: { originX: "50%", originY: "50%" },
|
|
763
|
-
animate: {
|
|
764
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
765
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
766
|
-
},
|
|
767
|
-
transition: {
|
|
768
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
769
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
770
|
-
ease: [0.4, 0, 0.2, 1]
|
|
771
|
-
}
|
|
908
|
+
strokeLinecap: "round"
|
|
772
909
|
}
|
|
773
|
-
)
|
|
774
|
-
|
|
910
|
+
)
|
|
911
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
912
|
+
shouldShowIndeterminateTrack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
913
|
+
"circle",
|
|
914
|
+
{
|
|
915
|
+
ref: indeterminateTrackRef,
|
|
916
|
+
cx: center,
|
|
917
|
+
cy: center,
|
|
918
|
+
r: radius,
|
|
919
|
+
fill: "none",
|
|
920
|
+
stroke: bgTrackColor,
|
|
921
|
+
strokeWidth: trackHeight,
|
|
922
|
+
strokeLinecap: "round"
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
926
|
+
"circle",
|
|
775
927
|
{
|
|
928
|
+
ref: indeterminateActiveRef,
|
|
776
929
|
cx: center,
|
|
777
930
|
cy: center,
|
|
778
931
|
r: radius,
|
|
779
932
|
fill: "none",
|
|
780
933
|
stroke: activeColor,
|
|
781
934
|
strokeWidth: trackHeight,
|
|
782
|
-
strokeLinecap: "round"
|
|
783
|
-
style: { originX: "50%", originY: "50%" },
|
|
784
|
-
animate: {
|
|
785
|
-
pathLength: [0.1, 0.75, 0.1],
|
|
786
|
-
rotate: ["0deg", "90deg", "360deg"]
|
|
787
|
-
},
|
|
788
|
-
transition: {
|
|
789
|
-
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
790
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
791
|
-
ease: [0.4, 0, 0.2, 1]
|
|
792
|
-
}
|
|
935
|
+
strokeLinecap: "round"
|
|
793
936
|
}
|
|
794
937
|
)
|
|
795
|
-
]
|
|
938
|
+
] })
|
|
796
939
|
}
|
|
797
940
|
)
|
|
798
941
|
] })
|
|
@@ -956,6 +1099,12 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
956
1099
|
duration: 0.5
|
|
957
1100
|
});
|
|
958
1101
|
react.animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
1102
|
+
} else {
|
|
1103
|
+
react.animate(amplitudeMV, amplitude, {
|
|
1104
|
+
type: "spring",
|
|
1105
|
+
bounce: 0,
|
|
1106
|
+
duration: 0.5
|
|
1107
|
+
});
|
|
959
1108
|
}
|
|
960
1109
|
}, [
|
|
961
1110
|
clampedValue,
|
|
@@ -969,10 +1118,10 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
969
1118
|
1,
|
|
970
1119
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
971
1120
|
);
|
|
972
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
973
1121
|
react.useAnimationFrame((time) => {
|
|
974
1122
|
if (width === 0) return;
|
|
975
1123
|
const currentAmp = amplitudeMV.get();
|
|
1124
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
976
1125
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
977
1126
|
const capWidth = trackHeight / 2;
|
|
978
1127
|
let activePathD = "";
|
|
@@ -992,7 +1141,7 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
992
1141
|
currentAmp
|
|
993
1142
|
);
|
|
994
1143
|
} else if (fraction === 0) {
|
|
995
|
-
activePathD =
|
|
1144
|
+
activePathD = "";
|
|
996
1145
|
}
|
|
997
1146
|
const trackStart = adjHead + totalGap;
|
|
998
1147
|
if (trackStart < width - capWidth) {
|
|
@@ -1024,20 +1173,20 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1024
1173
|
activeLines.push({ tail: l1T, head: l1H });
|
|
1025
1174
|
activeLines.push({ tail: l2T, head: l2H });
|
|
1026
1175
|
}
|
|
1027
|
-
const
|
|
1028
|
-
const
|
|
1029
|
-
const
|
|
1176
|
+
const activeSegments = activeLines.map((line) => {
|
|
1177
|
+
const rawTail = line.tail * width;
|
|
1178
|
+
const rawHead = line.head * width;
|
|
1030
1179
|
const adjTail = Math.max(
|
|
1031
1180
|
capWidth,
|
|
1032
|
-
Math.min(width - capWidth,
|
|
1181
|
+
Math.min(width - capWidth, rawTail)
|
|
1033
1182
|
);
|
|
1034
1183
|
const adjHead = Math.max(
|
|
1035
1184
|
capWidth,
|
|
1036
|
-
Math.min(width - capWidth,
|
|
1185
|
+
Math.min(width - capWidth, rawHead)
|
|
1037
1186
|
);
|
|
1038
1187
|
return { adjTail, adjHead };
|
|
1039
1188
|
}).filter((seg) => seg.adjHead - seg.adjTail > 0.1);
|
|
1040
|
-
activePathD =
|
|
1189
|
+
activePathD = activeSegments.map(
|
|
1041
1190
|
(seg) => getSinePath(
|
|
1042
1191
|
seg.adjTail,
|
|
1043
1192
|
seg.adjHead,
|
|
@@ -1046,13 +1195,24 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1046
1195
|
currentAmp
|
|
1047
1196
|
)
|
|
1048
1197
|
).join(" ");
|
|
1198
|
+
const validActiveLines = activeLines.filter(
|
|
1199
|
+
(line) => line.head > line.tail && line.head * width > 0 && line.tail * width < width
|
|
1200
|
+
).sort((a, b) => a.tail - b.tail);
|
|
1049
1201
|
let currentTrackX = capWidth;
|
|
1050
|
-
for (const
|
|
1051
|
-
const
|
|
1202
|
+
for (const line of validActiveLines) {
|
|
1203
|
+
const blockStart = line.tail * width - totalGap;
|
|
1204
|
+
const blockEnd = line.head * width + totalGap;
|
|
1205
|
+
const trackEnd = Math.min(width - capWidth, blockStart);
|
|
1052
1206
|
if (trackEnd > currentTrackX) {
|
|
1053
|
-
trackD += `${getSinePath(
|
|
1207
|
+
trackD += `${getSinePath(
|
|
1208
|
+
currentTrackX,
|
|
1209
|
+
trackEnd,
|
|
1210
|
+
phase,
|
|
1211
|
+
activeWavelength,
|
|
1212
|
+
trackAmp
|
|
1213
|
+
)} `;
|
|
1054
1214
|
}
|
|
1055
|
-
currentTrackX = Math.max(currentTrackX,
|
|
1215
|
+
currentTrackX = Math.max(currentTrackX, blockEnd);
|
|
1056
1216
|
}
|
|
1057
1217
|
if (currentTrackX < width - capWidth) {
|
|
1058
1218
|
trackD += getSinePath(
|
|
@@ -1065,15 +1225,15 @@ var WavyLinearTrack = React18__namespace.memo(function WavyLinearTrack2({
|
|
|
1065
1225
|
}
|
|
1066
1226
|
}
|
|
1067
1227
|
if (activePathRef.current)
|
|
1068
|
-
activePathRef.current.setAttribute("d", activePathD);
|
|
1228
|
+
activePathRef.current.setAttribute("d", activePathD || "");
|
|
1069
1229
|
if (trackPathRef.current)
|
|
1070
|
-
trackPathRef.current.setAttribute("d", trackD.trim());
|
|
1230
|
+
trackPathRef.current.setAttribute("d", trackD.trim() || "");
|
|
1071
1231
|
});
|
|
1072
1232
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1073
1233
|
"div",
|
|
1074
1234
|
{
|
|
1075
1235
|
ref: containerRef,
|
|
1076
|
-
className: "relative w-full
|
|
1236
|
+
className: "relative w-full",
|
|
1077
1237
|
style: { height: svgHeight },
|
|
1078
1238
|
children: width > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1079
1239
|
"svg",
|
|
@@ -1127,7 +1287,7 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1127
1287
|
waveSpeed = 1,
|
|
1128
1288
|
crawlerSpeed = 1,
|
|
1129
1289
|
determinateAnimation = "md3",
|
|
1130
|
-
indeterminateAnimation = "
|
|
1290
|
+
indeterminateAnimation = "md3",
|
|
1131
1291
|
gapSize = 4,
|
|
1132
1292
|
showStopIndicator = "auto",
|
|
1133
1293
|
color,
|
|
@@ -1164,15 +1324,15 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1164
1324
|
setIsRtl(dir === "rtl");
|
|
1165
1325
|
}
|
|
1166
1326
|
}, []);
|
|
1167
|
-
const isWavy = shape === "wavy";
|
|
1168
1327
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
1328
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
1169
1329
|
const effectiveAmplitude = React18__namespace.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
1170
1330
|
const svgHeight = React18__namespace.useMemo(
|
|
1171
1331
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
1172
1332
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
1173
1333
|
);
|
|
1174
1334
|
const shouldShowStop = React18__namespace.useMemo(
|
|
1175
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
1335
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
1176
1336
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
1177
1337
|
);
|
|
1178
1338
|
const stopSize = React18__namespace.useMemo(
|
|
@@ -1182,6 +1342,8 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1182
1342
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
1183
1343
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
1184
1344
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
1345
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
1346
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
1185
1347
|
return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domMax, strict: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1186
1348
|
"div",
|
|
1187
1349
|
__spreadProps(__spreadValues({
|
|
@@ -1198,12 +1360,12 @@ var LinearProgress = React18__namespace.forwardRef(
|
|
|
1198
1360
|
style: { height: svgHeight }
|
|
1199
1361
|
}, restProps), {
|
|
1200
1362
|
children: [
|
|
1201
|
-
|
|
1363
|
+
useWavyTrack ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1202
1364
|
WavyLinearTrack,
|
|
1203
1365
|
{
|
|
1204
1366
|
trackHeight,
|
|
1205
1367
|
svgHeight,
|
|
1206
|
-
amplitude:
|
|
1368
|
+
amplitude: trackAmp,
|
|
1207
1369
|
wavelength,
|
|
1208
1370
|
indeterminateWavelength,
|
|
1209
1371
|
activeColor,
|