@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/buttons.mjs
CHANGED
|
@@ -256,24 +256,36 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
256
256
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
257
257
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
258
258
|
}
|
|
259
|
-
d += " Z";
|
|
260
259
|
return d;
|
|
261
260
|
}
|
|
262
261
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
263
262
|
if (startX >= endX) return "";
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
263
|
+
if (amp <= 0.01) {
|
|
264
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
265
|
+
}
|
|
266
|
+
const safeWl = Math.max(1, wl);
|
|
267
|
+
const k = 2 * Math.PI / safeWl;
|
|
268
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
269
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
270
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
271
|
+
const step = safeWl / 4;
|
|
272
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
273
|
+
let currentX = startX;
|
|
274
|
+
while (currentX < endX) {
|
|
275
|
+
const nextX = Math.min(endX, currentX + step);
|
|
276
|
+
const dx = nextX - currentX;
|
|
277
|
+
const scale = dx / 3;
|
|
278
|
+
const y0 = yAt(currentX);
|
|
279
|
+
const dy0 = dyAt(currentX);
|
|
280
|
+
const y1 = yAt(nextX);
|
|
281
|
+
const dy1 = dyAt(nextX);
|
|
282
|
+
const cp1x = currentX + scale;
|
|
283
|
+
const cp1y = y0 + scale * dy0;
|
|
284
|
+
const cp2x = nextX - scale;
|
|
285
|
+
const cp2y = y1 - scale * dy1;
|
|
286
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
287
|
+
currentX = nextX;
|
|
274
288
|
}
|
|
275
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
276
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
277
289
|
return d;
|
|
278
290
|
}
|
|
279
291
|
var CircularProgress = React16.forwardRef(
|
|
@@ -428,16 +440,13 @@ var CircularProgress = React16.forwardRef(
|
|
|
428
440
|
position: "absolute",
|
|
429
441
|
inset: 0,
|
|
430
442
|
overflow: "visible",
|
|
431
|
-
rotate: "-90deg",
|
|
432
443
|
transformOrigin: "center"
|
|
433
444
|
},
|
|
434
|
-
animate: { rotate: [
|
|
445
|
+
animate: { rotate: [0, 360] },
|
|
435
446
|
transition: {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
ease: "linear"
|
|
440
|
-
}
|
|
447
|
+
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
448
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
449
|
+
ease: "linear"
|
|
441
450
|
},
|
|
442
451
|
children: [
|
|
443
452
|
/* @__PURE__ */ jsx(
|
|
@@ -450,17 +459,16 @@ var CircularProgress = React16.forwardRef(
|
|
|
450
459
|
stroke: bgTrackColor,
|
|
451
460
|
strokeWidth: trackHeight,
|
|
452
461
|
strokeLinecap: "round",
|
|
453
|
-
style: { originX: "50%", originY: "50%" },
|
|
454
462
|
animate: {
|
|
455
463
|
pathLength: [
|
|
456
|
-
Math.max(1e-3,
|
|
457
|
-
Math.max(1e-3,
|
|
458
|
-
Math.max(1e-3,
|
|
464
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
465
|
+
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
466
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
459
467
|
],
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
468
|
+
pathOffset: [
|
|
469
|
+
0.1 + gapForTrack,
|
|
470
|
+
0.75 + gapForTrack,
|
|
471
|
+
0.1 + gapForTrack
|
|
464
472
|
]
|
|
465
473
|
},
|
|
466
474
|
transition: {
|
|
@@ -478,10 +486,9 @@ var CircularProgress = React16.forwardRef(
|
|
|
478
486
|
stroke: activeColor,
|
|
479
487
|
strokeWidth: trackHeight,
|
|
480
488
|
strokeLinecap: "round",
|
|
481
|
-
style: { originX: "50%", originY: "50%" },
|
|
482
489
|
animate: {
|
|
483
490
|
pathLength: [0.1, 0.75, 0.1],
|
|
484
|
-
|
|
491
|
+
pathOffset: [0, 0.65, 1]
|
|
485
492
|
},
|
|
486
493
|
transition: {
|
|
487
494
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -499,10 +506,9 @@ var CircularProgress = React16.forwardRef(
|
|
|
499
506
|
stroke: activeColor,
|
|
500
507
|
strokeWidth: trackHeight,
|
|
501
508
|
strokeLinecap: "round",
|
|
502
|
-
style: { originX: "50%", originY: "50%" },
|
|
503
509
|
animate: {
|
|
504
510
|
pathLength: [0.1, 0.75, 0.1],
|
|
505
|
-
|
|
511
|
+
pathOffset: [0, 0.65, 1]
|
|
506
512
|
},
|
|
507
513
|
transition: {
|
|
508
514
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -675,6 +681,12 @@ var WavyLinearTrack = React16.memo(function WavyLinearTrack2({
|
|
|
675
681
|
duration: 0.5
|
|
676
682
|
});
|
|
677
683
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
684
|
+
} else {
|
|
685
|
+
animate(amplitudeMV, amplitude, {
|
|
686
|
+
type: "spring",
|
|
687
|
+
bounce: 0,
|
|
688
|
+
duration: 0.5
|
|
689
|
+
});
|
|
678
690
|
}
|
|
679
691
|
}, [
|
|
680
692
|
clampedValue,
|
|
@@ -688,10 +700,10 @@ var WavyLinearTrack = React16.memo(function WavyLinearTrack2({
|
|
|
688
700
|
1,
|
|
689
701
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
690
702
|
);
|
|
691
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
692
703
|
useAnimationFrame((time) => {
|
|
693
704
|
if (width === 0) return;
|
|
694
705
|
const currentAmp = amplitudeMV.get();
|
|
706
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
695
707
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
696
708
|
const capWidth = trackHeight / 2;
|
|
697
709
|
let activePathD = "";
|
|
@@ -792,7 +804,7 @@ var WavyLinearTrack = React16.memo(function WavyLinearTrack2({
|
|
|
792
804
|
"div",
|
|
793
805
|
{
|
|
794
806
|
ref: containerRef,
|
|
795
|
-
className: "relative w-full
|
|
807
|
+
className: "relative w-full",
|
|
796
808
|
style: { height: svgHeight },
|
|
797
809
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
798
810
|
"svg",
|
|
@@ -846,7 +858,7 @@ var LinearProgress = React16.forwardRef(
|
|
|
846
858
|
waveSpeed = 1,
|
|
847
859
|
crawlerSpeed = 1,
|
|
848
860
|
determinateAnimation = "md3",
|
|
849
|
-
indeterminateAnimation = "
|
|
861
|
+
indeterminateAnimation = "md3",
|
|
850
862
|
gapSize = 4,
|
|
851
863
|
showStopIndicator = "auto",
|
|
852
864
|
color,
|
|
@@ -883,15 +895,15 @@ var LinearProgress = React16.forwardRef(
|
|
|
883
895
|
setIsRtl(dir === "rtl");
|
|
884
896
|
}
|
|
885
897
|
}, []);
|
|
886
|
-
const isWavy = shape === "wavy";
|
|
887
898
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
899
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
888
900
|
const effectiveAmplitude = React16.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
889
901
|
const svgHeight = React16.useMemo(
|
|
890
902
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
891
903
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
892
904
|
);
|
|
893
905
|
const shouldShowStop = React16.useMemo(
|
|
894
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
906
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
895
907
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
896
908
|
);
|
|
897
909
|
const stopSize = React16.useMemo(
|
|
@@ -901,6 +913,8 @@ var LinearProgress = React16.forwardRef(
|
|
|
901
913
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
902
914
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
903
915
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
916
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
917
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
904
918
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
905
919
|
"div",
|
|
906
920
|
__spreadProps(__spreadValues({
|
|
@@ -917,12 +931,12 @@ var LinearProgress = React16.forwardRef(
|
|
|
917
931
|
style: { height: svgHeight }
|
|
918
932
|
}, restProps), {
|
|
919
933
|
children: [
|
|
920
|
-
|
|
934
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
921
935
|
WavyLinearTrack,
|
|
922
936
|
{
|
|
923
937
|
trackHeight,
|
|
924
938
|
svgHeight,
|
|
925
|
-
amplitude:
|
|
939
|
+
amplitude: trackAmp,
|
|
926
940
|
wavelength,
|
|
927
941
|
indeterminateWavelength,
|
|
928
942
|
activeColor,
|