@kyralabs/m3e-motion 1.3.0 → 1.4.0
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/dist/index.d.ts +316 -2
- package/dist/index.js +411 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -437,6 +437,226 @@ function menuNavigationTarget(key, count, current) {
|
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
+
// src/toolbar-navigation.ts
|
|
441
|
+
function toolbarNavigationTarget(key, count, current, orientation = "horizontal", rtl = false) {
|
|
442
|
+
if (count === 0) return null;
|
|
443
|
+
let step;
|
|
444
|
+
switch (key) {
|
|
445
|
+
case "Home":
|
|
446
|
+
return 0;
|
|
447
|
+
case "End":
|
|
448
|
+
return count - 1;
|
|
449
|
+
case "ArrowRight":
|
|
450
|
+
case "ArrowLeft":
|
|
451
|
+
if (orientation !== "horizontal") return null;
|
|
452
|
+
step = key === "ArrowRight" !== rtl ? 1 : -1;
|
|
453
|
+
break;
|
|
454
|
+
case "ArrowDown":
|
|
455
|
+
case "ArrowUp":
|
|
456
|
+
if (orientation !== "vertical") return null;
|
|
457
|
+
step = key === "ArrowDown" ? 1 : -1;
|
|
458
|
+
break;
|
|
459
|
+
default:
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
if (current < 0) return step > 0 ? 0 : count - 1;
|
|
463
|
+
return Math.min(Math.max(current + step, 0), count - 1);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// src/cubic-bezier.ts
|
|
467
|
+
var bezier = (p1, p2, t) => 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t;
|
|
468
|
+
var cubicBezier = (a, b, c, d) => (fraction) => {
|
|
469
|
+
if (!(fraction > 0 && fraction < 1)) return fraction;
|
|
470
|
+
let lo = 0;
|
|
471
|
+
let hi = 1;
|
|
472
|
+
for (let i = 0; i < 30; i++) {
|
|
473
|
+
const mid = (lo + hi) / 2;
|
|
474
|
+
if (bezier(a, c, mid) < fraction) lo = mid;
|
|
475
|
+
else hi = mid;
|
|
476
|
+
}
|
|
477
|
+
return bezier(b, d, (lo + hi) / 2);
|
|
478
|
+
};
|
|
479
|
+
function parseCubicBezier(css) {
|
|
480
|
+
const values = /cubic-bezier\(([^)]*)\)/.exec(css)?.[1]?.split(",").map(Number);
|
|
481
|
+
return values?.length === 4 && values.every(Number.isFinite) ? cubicBezier(...values) : null;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// src/app-bar-scroll.ts
|
|
485
|
+
function appBarScrollState(height) {
|
|
486
|
+
return { heightOffsetLimit: -height, heightOffset: 0, contentOffset: 0, atStart: true };
|
|
487
|
+
}
|
|
488
|
+
function withHeightOffset(state, offset) {
|
|
489
|
+
return { ...state, heightOffset: Math.min(Math.max(offset, state.heightOffsetLimit), 0) };
|
|
490
|
+
}
|
|
491
|
+
function withHeight(state, height) {
|
|
492
|
+
return withHeightOffset({ ...state, heightOffsetLimit: -height }, state.heightOffset);
|
|
493
|
+
}
|
|
494
|
+
function collapsedFraction(state) {
|
|
495
|
+
return state.heightOffsetLimit !== 0 ? state.heightOffset / state.heightOffsetLimit + 0 : 0;
|
|
496
|
+
}
|
|
497
|
+
function overlappedFraction(state) {
|
|
498
|
+
if (!state.atStart && state.contentOffset === 0) return 1;
|
|
499
|
+
if (state.heightOffsetLimit === 0) return 0;
|
|
500
|
+
const limit = state.heightOffsetLimit;
|
|
501
|
+
const clamped = Math.min(Math.max(limit + Math.abs(state.contentOffset), limit), 0);
|
|
502
|
+
return 1 - clamped / limit;
|
|
503
|
+
}
|
|
504
|
+
function isScrolledUnder(state) {
|
|
505
|
+
return overlappedFraction(state) > 0.01;
|
|
506
|
+
}
|
|
507
|
+
function scrollAppBar(state, behavior, scrollTop, delta) {
|
|
508
|
+
const next = { ...state, contentOffset: -scrollTop, atStart: scrollTop <= 0 };
|
|
509
|
+
if (behavior === "pinned") return next;
|
|
510
|
+
if (behavior === "enter-always" || delta < 0) {
|
|
511
|
+
return withHeightOffset(next, state.heightOffset + delta);
|
|
512
|
+
}
|
|
513
|
+
const below = (top) => Math.max(0, -state.heightOffset - top);
|
|
514
|
+
return withHeightOffset(next, state.heightOffset + below(scrollTop) - below(scrollTop + delta));
|
|
515
|
+
}
|
|
516
|
+
function settleTarget(state) {
|
|
517
|
+
const fraction = collapsedFraction(state);
|
|
518
|
+
if (fraction < 0.01 || fraction === 1) return null;
|
|
519
|
+
if (!(state.heightOffset < 0 && state.heightOffset > state.heightOffsetLimit)) return null;
|
|
520
|
+
return fraction < 0.5 ? 0 : state.heightOffsetLimit;
|
|
521
|
+
}
|
|
522
|
+
var TOP_TITLE_ALPHA_EASING = [0.8, 0, 0.8, 0.15];
|
|
523
|
+
var FAST_OUT_LINEAR_IN_EASING = [0.4, 0, 1, 1];
|
|
524
|
+
var topTitleAlpha = /* @__PURE__ */ cubicBezier(...TOP_TITLE_ALPHA_EASING);
|
|
525
|
+
var fastOutLinearIn = /* @__PURE__ */ cubicBezier(...FAST_OUT_LINEAR_IN_EASING);
|
|
526
|
+
function twoRowsFrame(fraction) {
|
|
527
|
+
return {
|
|
528
|
+
collapsedTitleAlpha: topTitleAlpha(fraction),
|
|
529
|
+
expandedTitleAlpha: 1 - fraction,
|
|
530
|
+
containerColorFraction: fastOutLinearIn(fraction),
|
|
531
|
+
collapsedTitleHidden: fraction < 0.5
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/floating-toolbar-scroll.ts
|
|
536
|
+
function floatingToolbarScrollState(offsetLimit = -Number.MAX_VALUE, offset = 0, contentOffset = 0) {
|
|
537
|
+
return withToolbarOffset({ offsetLimit, offset: 0, contentOffset }, offset);
|
|
538
|
+
}
|
|
539
|
+
function withToolbarOffset(state, offset) {
|
|
540
|
+
return { ...state, offset: Math.min(Math.max(offset, state.offsetLimit), 0) };
|
|
541
|
+
}
|
|
542
|
+
function withToolbarOffsetLimit(state, distance) {
|
|
543
|
+
return withToolbarOffset({ ...state, offsetLimit: -Math.max(distance, 0) }, state.offset);
|
|
544
|
+
}
|
|
545
|
+
function scrollFloatingToolbar(state, delta) {
|
|
546
|
+
return withToolbarOffset(
|
|
547
|
+
{ ...state, contentOffset: state.contentOffset + delta },
|
|
548
|
+
state.offset + delta
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
function toolbarCollapsedFraction(state) {
|
|
552
|
+
return state.offsetLimit !== 0 ? state.offset / state.offsetLimit + 0 : 0;
|
|
553
|
+
}
|
|
554
|
+
function toolbarSettleTarget(state) {
|
|
555
|
+
return settleTarget({
|
|
556
|
+
heightOffsetLimit: state.offsetLimit,
|
|
557
|
+
heightOffset: state.offset,
|
|
558
|
+
contentOffset: state.contentOffset});
|
|
559
|
+
}
|
|
560
|
+
function toolbarExpansionScroll(expanded, collapseThreshold, expandThreshold, contentOffset = 0) {
|
|
561
|
+
return {
|
|
562
|
+
contentOffset,
|
|
563
|
+
threshold: expanded ? contentOffset - collapseThreshold : contentOffset + expandThreshold
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function scrollToolbarExpansion(state, delta, collapseThreshold, expandThreshold) {
|
|
567
|
+
const contentOffset = state.contentOffset + delta;
|
|
568
|
+
if (delta < 0 && contentOffset <= state.threshold) {
|
|
569
|
+
return {
|
|
570
|
+
state: { contentOffset, threshold: contentOffset + expandThreshold },
|
|
571
|
+
change: "collapse"
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
if (delta > 0 && contentOffset >= state.threshold) {
|
|
575
|
+
return {
|
|
576
|
+
state: { contentOffset, threshold: contentOffset - collapseThreshold },
|
|
577
|
+
change: "expand"
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
return { state: { contentOffset, threshold: state.threshold }, change: null };
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// src/progress-indicator.ts
|
|
584
|
+
var line = (t, [delay, duration], easing) => t <= delay ? 0 : t >= delay + duration ? 1 : easing((t - delay) / duration);
|
|
585
|
+
function linearIndeterminateFractions(elapsedMillis, timing) {
|
|
586
|
+
const t = Math.max(0, elapsedMillis) % timing.durationMillis;
|
|
587
|
+
return [
|
|
588
|
+
line(t, timing.firstTail, timing.easing),
|
|
589
|
+
line(t, timing.firstHead, timing.easing),
|
|
590
|
+
line(t, timing.secondTail, timing.easing),
|
|
591
|
+
line(t, timing.secondHead, timing.easing)
|
|
592
|
+
];
|
|
593
|
+
}
|
|
594
|
+
function circularIndeterminateFrame(elapsedMillis, timing) {
|
|
595
|
+
const d = timing.durationMillis;
|
|
596
|
+
const t = Math.max(0, elapsedMillis) % d;
|
|
597
|
+
const steps = Math.round(d / timing.additionalDelayMillis);
|
|
598
|
+
const step = timing.additionalRotation / steps;
|
|
599
|
+
const index = Math.floor(t / timing.additionalDelayMillis);
|
|
600
|
+
const within = t - index * timing.additionalDelayMillis;
|
|
601
|
+
const additional = step * index + step * Math.min(1, within / timing.additionalDurationMillis);
|
|
602
|
+
const half = d / 2;
|
|
603
|
+
const range = timing.maxProgress - timing.minProgress;
|
|
604
|
+
const sweep = t <= half ? timing.minProgress + range * (t / half) : timing.maxProgress - range * timing.easing((t - half) / half);
|
|
605
|
+
return { rotation: timing.rotation * t / d + additional, sweep };
|
|
606
|
+
}
|
|
607
|
+
function waveTravelMillis(wavelength, waveSpeed, minMillis, vertexCount = 1) {
|
|
608
|
+
if (!(waveSpeed > 0 && wavelength > 0)) return Number.POSITIVE_INFINITY;
|
|
609
|
+
return Math.max(minMillis, Math.round(wavelength / waveSpeed * 1e3 * vertexCount));
|
|
610
|
+
}
|
|
611
|
+
var waveOffset = (elapsedMillis, travelMillis) => Number.isFinite(travelMillis) ? Math.max(0, elapsedMillis) % travelMillis / travelMillis : 0;
|
|
612
|
+
var indicatorAmplitude = (progress, minProgress, maxProgress) => progress <= minProgress || progress >= maxProgress ? 0 : 1;
|
|
613
|
+
var AmplitudeAnimation = class {
|
|
614
|
+
#from;
|
|
615
|
+
#to;
|
|
616
|
+
#start = 0;
|
|
617
|
+
#tween = null;
|
|
618
|
+
#value;
|
|
619
|
+
constructor(initial) {
|
|
620
|
+
this.#from = initial;
|
|
621
|
+
this.#to = initial;
|
|
622
|
+
this.#value = initial;
|
|
623
|
+
}
|
|
624
|
+
get value() {
|
|
625
|
+
return this.#value;
|
|
626
|
+
}
|
|
627
|
+
get target() {
|
|
628
|
+
return this.#to;
|
|
629
|
+
}
|
|
630
|
+
get isRunning() {
|
|
631
|
+
return this.#tween !== null;
|
|
632
|
+
}
|
|
633
|
+
/** Advances to `now` (ms). */
|
|
634
|
+
sample(now) {
|
|
635
|
+
const tween = this.#tween;
|
|
636
|
+
if (tween === null) return this.#value;
|
|
637
|
+
const fraction = tween.durationMillis > 0 ? (now - this.#start) / tween.durationMillis : 1;
|
|
638
|
+
if (fraction >= 1) {
|
|
639
|
+
this.#tween = null;
|
|
640
|
+
this.#value = this.#to;
|
|
641
|
+
} else {
|
|
642
|
+
this.#value = this.#from + (this.#to - this.#from) * tween.easing(Math.max(0, fraction));
|
|
643
|
+
}
|
|
644
|
+
return this.#value;
|
|
645
|
+
}
|
|
646
|
+
/** Requests `target` at `now`; returns true when a tween started. */
|
|
647
|
+
update(target, now, increase, decrease) {
|
|
648
|
+
this.sample(now);
|
|
649
|
+
if (this.#tween !== null || target === this.#to) return false;
|
|
650
|
+
const tween = this.#value < target ? increase : decrease;
|
|
651
|
+
this.#from = this.#value;
|
|
652
|
+
this.#to = target;
|
|
653
|
+
this.#start = now;
|
|
654
|
+
this.#tween = tween;
|
|
655
|
+
if (tween.durationMillis <= 0) this.sample(now);
|
|
656
|
+
return true;
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
|
|
440
660
|
// src/loading-indicator.ts
|
|
441
661
|
var FULL_ROTATION = 360;
|
|
442
662
|
var QUARTER_ROTATION = FULL_ROTATION / 4;
|
|
@@ -572,38 +792,197 @@ function menuPosition(input) {
|
|
|
572
792
|
};
|
|
573
793
|
}
|
|
574
794
|
|
|
575
|
-
// src/
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
795
|
+
// src/search-bar.ts
|
|
796
|
+
var SEARCH_BAR_EXPANDED_THRESHOLD = 0.02;
|
|
797
|
+
var SEARCH_DROPDOWN_VISIBLE_PROGRESS = 0.1;
|
|
798
|
+
var TweenAnimatable = class {
|
|
799
|
+
#value;
|
|
800
|
+
#from;
|
|
801
|
+
#target;
|
|
802
|
+
#start = 0;
|
|
803
|
+
#spec = null;
|
|
804
|
+
constructor(value) {
|
|
805
|
+
this.#value = value;
|
|
806
|
+
this.#from = value;
|
|
807
|
+
this.#target = value;
|
|
808
|
+
}
|
|
809
|
+
get value() {
|
|
810
|
+
return this.#value;
|
|
811
|
+
}
|
|
812
|
+
get target() {
|
|
813
|
+
return this.#target;
|
|
814
|
+
}
|
|
815
|
+
get isRunning() {
|
|
816
|
+
return this.#spec !== null;
|
|
817
|
+
}
|
|
818
|
+
snapTo(value) {
|
|
819
|
+
this.#spec = null;
|
|
820
|
+
this.#value = value;
|
|
821
|
+
this.#from = value;
|
|
822
|
+
this.#target = value;
|
|
823
|
+
}
|
|
824
|
+
animateTo(target, spec, now) {
|
|
825
|
+
this.sample(now);
|
|
826
|
+
if (spec === null || spec.delay + spec.duration <= 0) {
|
|
827
|
+
this.snapTo(target);
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
this.#from = this.#value;
|
|
831
|
+
this.#target = target;
|
|
832
|
+
this.#start = now;
|
|
833
|
+
this.#spec = spec;
|
|
834
|
+
}
|
|
835
|
+
sample(now) {
|
|
836
|
+
const spec = this.#spec;
|
|
837
|
+
if (spec === null) return this.#value;
|
|
838
|
+
const elapsed = now - this.#start - spec.delay;
|
|
839
|
+
if (elapsed >= spec.duration) {
|
|
840
|
+
this.snapTo(this.#target);
|
|
841
|
+
return this.#value;
|
|
842
|
+
}
|
|
843
|
+
const fraction = elapsed <= 0 ? 0 : spec.easing(elapsed / spec.duration);
|
|
844
|
+
this.#value = this.#from + (this.#target - this.#from) * fraction;
|
|
845
|
+
return this.#value;
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
var SearchBarAnimation = class {
|
|
849
|
+
#progress;
|
|
850
|
+
#content;
|
|
851
|
+
#slide = new SpringAnimatable(0);
|
|
852
|
+
#specs = null;
|
|
853
|
+
#dropdownShown = false;
|
|
854
|
+
#dropdownVisible = false;
|
|
855
|
+
constructor(expanded = false) {
|
|
856
|
+
this.#progress = new SpringAnimatable(expanded ? 1 : 0);
|
|
857
|
+
this.#content = new TweenAnimatable(expanded ? 1 : 0);
|
|
858
|
+
this.#dropdownShown = expanded;
|
|
859
|
+
this.#dropdownVisible = expanded;
|
|
860
|
+
}
|
|
861
|
+
/** SearchBarState.targetValue. */
|
|
862
|
+
get isTargetExpanded() {
|
|
863
|
+
return this.#progress.target === 1;
|
|
864
|
+
}
|
|
865
|
+
/** SearchBarState.currentValue: expanded until the value drops to the 0.02 tolerance. */
|
|
866
|
+
get isExpanded() {
|
|
867
|
+
return this.#progress.value > SEARCH_BAR_EXPANDED_THRESHOLD;
|
|
868
|
+
}
|
|
869
|
+
get isRunning() {
|
|
870
|
+
return this.#progress.isRunning || this.#content.isRunning || this.#slide.isRunning;
|
|
871
|
+
}
|
|
872
|
+
/** animateToExpanded() at `now` (ms). */
|
|
873
|
+
expand(specs, now) {
|
|
874
|
+
this.#specs = specs;
|
|
875
|
+
this.#progress.animateTo(1, specs.expand, now);
|
|
876
|
+
this.#content.animateTo(1, specs.contentFadeIn, now);
|
|
877
|
+
}
|
|
878
|
+
/** animateToCollapsed() at `now` (ms). */
|
|
879
|
+
collapse(specs, now) {
|
|
880
|
+
this.#specs = specs;
|
|
881
|
+
this.#content.animateTo(0, specs.contentFadeOut, now);
|
|
882
|
+
this.#progress.animateTo(0, specs.collapse, now);
|
|
883
|
+
}
|
|
884
|
+
/** Jumps to collapsed (0) or expanded (1), stopping every animation. */
|
|
885
|
+
snapTo(expanded) {
|
|
886
|
+
this.#progress.snapTo(expanded ? 1 : 0);
|
|
887
|
+
this.#content.snapTo(expanded ? 1 : 0);
|
|
888
|
+
this.#slide.snapTo(0);
|
|
889
|
+
this.#dropdownShown = expanded;
|
|
890
|
+
this.#dropdownVisible = expanded;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Advances to `now`. `dropdownHeight` (px, the drop-down's full height) enables the with-gap
|
|
894
|
+
* slide: AnimatedVisibility(visible = progress > 0.1 && target == Expanded) slides in from minus
|
|
895
|
+
* half the height on the expand spring and out to it on the collapse spring.
|
|
896
|
+
*/
|
|
897
|
+
sample(now, dropdownHeight) {
|
|
898
|
+
const value = this.#progress.sample(now);
|
|
899
|
+
const progress = Math.min(Math.max(value, 0), 1);
|
|
900
|
+
const contentProgress = Math.min(Math.max(this.#content.sample(now), 0), 1);
|
|
901
|
+
if (dropdownHeight !== void 0) {
|
|
902
|
+
const hidden = Math.round(-dropdownHeight / 2);
|
|
903
|
+
const visible = progress > SEARCH_DROPDOWN_VISIBLE_PROGRESS && this.isTargetExpanded;
|
|
904
|
+
if (visible !== this.#dropdownVisible) {
|
|
905
|
+
this.#dropdownVisible = visible;
|
|
906
|
+
if (visible) {
|
|
907
|
+
if (!this.#dropdownShown) this.#slide.snapTo(hidden);
|
|
908
|
+
this.#dropdownShown = true;
|
|
909
|
+
this.#slide.animateTo(0, this.#specs?.expand ?? null, now);
|
|
910
|
+
} else if (this.#dropdownShown) {
|
|
911
|
+
this.#slide.animateTo(hidden, this.#specs?.collapse ?? null, now);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
this.#slide.sample(now);
|
|
915
|
+
if (!visible && this.#dropdownShown && !this.#slide.isRunning) this.#dropdownShown = false;
|
|
916
|
+
}
|
|
917
|
+
return {
|
|
918
|
+
value,
|
|
919
|
+
progress,
|
|
920
|
+
contentProgress,
|
|
921
|
+
slide: this.#slide.value,
|
|
922
|
+
dropdownShown: this.#dropdownShown
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
var lerp = (a, b, t) => a + (b - a) * t;
|
|
927
|
+
function searchViewFrame(input) {
|
|
928
|
+
const { variant, collapsed: c, window: w, insetTop, metrics: m } = input;
|
|
929
|
+
const { value, progress: p } = input.sample;
|
|
930
|
+
const none = { radius: 0, alpha: 1, minHeight: 0, maxHeight: 0 };
|
|
931
|
+
if (variant === "docked" || variant === "docked-with-gap") {
|
|
932
|
+
const ratio = variant === "docked" ? m.dockedMaxHeightRatio : m.withGapMaxHeightRatio;
|
|
933
|
+
const tableMax = w.height * ratio;
|
|
934
|
+
const maxHeight = lerp(c.height, tableMax, Math.max(value, 0));
|
|
935
|
+
const minHeight = Math.min(Math.min(m.dockedMinHeight, tableMax), maxHeight);
|
|
936
|
+
if (variant === "docked") {
|
|
937
|
+
return {
|
|
938
|
+
surface: { ...c, radius: 0, alpha: 1, minHeight, maxHeight },
|
|
939
|
+
field: { x: c.x, y: c.y, width: c.width },
|
|
940
|
+
results: { x: c.x, y: c.y + c.height, width: c.width, maxHeight: maxHeight - c.height }
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
return {
|
|
944
|
+
surface: { x: 0, y: 0, width: w.width, height: w.height, ...none, alpha: p },
|
|
945
|
+
field: { x: c.x, y: c.y, width: c.width },
|
|
946
|
+
results: {
|
|
947
|
+
x: c.x,
|
|
948
|
+
y: c.y + c.height + m.dropdownGap,
|
|
949
|
+
width: c.width,
|
|
950
|
+
maxHeight: Math.max(0, maxHeight - c.height - m.dropdownGap)
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
const contained = variant === "full-screen-contained";
|
|
955
|
+
const width = contained ? w.width : lerp(c.width, w.width, p);
|
|
956
|
+
const height = contained ? w.height : lerp(c.height, w.height, p);
|
|
957
|
+
const offsetX = contained ? 0 : lerp(c.x, 0, p);
|
|
958
|
+
const padding = contained ? m.containedHorizontalPadding : 0;
|
|
959
|
+
const fieldWidth = lerp(c.width, width - 2 * padding, value);
|
|
960
|
+
const centerX2 = lerp(c.x + c.width / 2, offsetX + width / 2, value);
|
|
961
|
+
const topPadding = insetTop + (contained ? m.containedTopPadding : m.verticalPadding);
|
|
962
|
+
const animatedTopPadding = topPadding * Math.min(p, 1);
|
|
963
|
+
const bottomPadding = contained ? m.verticalPadding : m.verticalPadding * p;
|
|
964
|
+
const offsetY = lerp(c.y, 0, p);
|
|
965
|
+
const fieldY = offsetY + animatedTopPadding;
|
|
966
|
+
return {
|
|
967
|
+
surface: contained ? { x: 0, y: 0, width, height, ...none, alpha: p } : { x: offsetX, y: offsetY, width, height, ...none, radius: m.cornerRadius * (1 - p) },
|
|
968
|
+
field: { x: Math.round(centerX2 - fieldWidth / 2), y: fieldY, width: fieldWidth },
|
|
969
|
+
results: {
|
|
970
|
+
x: offsetX,
|
|
971
|
+
y: fieldY + c.height + bottomPadding,
|
|
972
|
+
width,
|
|
973
|
+
maxHeight: Math.max(0, height - (c.height + animatedTopPadding + bottomPadding))
|
|
974
|
+
}
|
|
975
|
+
};
|
|
601
976
|
}
|
|
602
|
-
function
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
977
|
+
function searchNavigationTarget(key, enabled, active) {
|
|
978
|
+
const indices = enabled.flatMap((on, i) => on ? [i] : []);
|
|
979
|
+
const first = indices[0];
|
|
980
|
+
const last = indices.at(-1);
|
|
981
|
+
if (first === void 0 || last === void 0) return null;
|
|
982
|
+
const at2 = indices.indexOf(active);
|
|
983
|
+
if (key === "ArrowDown") return at2 === -1 ? first : indices[at2 + 1] ?? last;
|
|
984
|
+
if (key === "ArrowUp") return at2 === -1 ? last : at2 === 0 ? -1 : indices[at2 - 1] ?? first;
|
|
985
|
+
return null;
|
|
607
986
|
}
|
|
608
987
|
|
|
609
988
|
// src/button-group.ts
|
|
@@ -652,6 +1031,6 @@ function buttonGroupWidths(items, pressed, expandedRatio, visibleCount = items.l
|
|
|
652
1031
|
return widths.slice(0, last);
|
|
653
1032
|
}
|
|
654
1033
|
|
|
655
|
-
export { DEFAULT_DISPLACEMENT_THRESHOLD, SpringAnimatable, SpringSimulation, animatedInt, appBarScrollState, buttonGroupVisibleCount, buttonGroupWidths, collapsedFraction, dampingCoefficient, dampingRatioFromCoefficient, estimateAnimationDurationMillis, estimateAnimationDurationMillisDouble, fabMenuItemVisible, indeterminateFrame, initialIndeterminateFrame, isScrolledUnder, menuNavigationTarget, menuPosition, menuTransformOrigin, morphSpringDurationMillis, overlappedFraction, scrollAppBar, settleTarget, springDurationMillis, springToLinear, springValue, springVelocity, withHeight, withHeightOffset };
|
|
1034
|
+
export { AmplitudeAnimation, DEFAULT_DISPLACEMENT_THRESHOLD, FAST_OUT_LINEAR_IN_EASING, SEARCH_BAR_EXPANDED_THRESHOLD, SEARCH_DROPDOWN_VISIBLE_PROGRESS, SearchBarAnimation, SpringAnimatable, SpringSimulation, TOP_TITLE_ALPHA_EASING, TweenAnimatable, animatedInt, appBarScrollState, buttonGroupVisibleCount, buttonGroupWidths, circularIndeterminateFrame, collapsedFraction, cubicBezier, dampingCoefficient, dampingRatioFromCoefficient, estimateAnimationDurationMillis, estimateAnimationDurationMillisDouble, fabMenuItemVisible, floatingToolbarScrollState, indeterminateFrame, indicatorAmplitude, initialIndeterminateFrame, isScrolledUnder, linearIndeterminateFractions, menuNavigationTarget, menuPosition, menuTransformOrigin, morphSpringDurationMillis, overlappedFraction, parseCubicBezier, scrollAppBar, scrollFloatingToolbar, scrollToolbarExpansion, searchNavigationTarget, searchViewFrame, settleTarget, springDurationMillis, springToLinear, springValue, springVelocity, toolbarCollapsedFraction, toolbarExpansionScroll, toolbarNavigationTarget, toolbarSettleTarget, twoRowsFrame, waveOffset, waveTravelMillis, withHeight, withHeightOffset, withToolbarOffset, withToolbarOffsetLimit };
|
|
656
1035
|
//# sourceMappingURL=index.js.map
|
|
657
1036
|
//# sourceMappingURL=index.js.map
|