@kyralabs/m3e-motion 1.5.0 → 1.6.1
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 +125 -3
- package/dist/index.js +192 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -76,12 +76,22 @@ declare const fabMenuItemVisible: (index: number, itemCount: number, stagger: nu
|
|
|
76
76
|
*/
|
|
77
77
|
declare function menuNavigationTarget(key: string, count: number, current: number): number | null;
|
|
78
78
|
|
|
79
|
+
/** React Aria useTypeSelect clears the typed string after this long (TYPEAHEAD_DEBOUNCE_WAIT_MS). */
|
|
80
|
+
declare const TYPEAHEAD_TIMEOUT_MS = 1000;
|
|
81
|
+
/**
|
|
82
|
+
* Index of the first item in `texts` that starts with `search`, from `from` (the focused item,
|
|
83
|
+
* −1: none) to the end, then from the start; −1 when none does.
|
|
84
|
+
*/
|
|
85
|
+
declare function typeSelectTarget(texts: readonly string[], from: number, search: string): number;
|
|
86
|
+
|
|
79
87
|
type ToolbarOrientation = 'horizontal' | 'vertical';
|
|
88
|
+
/** A toolbar orientation, or `both`: both arrow key pairs move along the one item order. */
|
|
89
|
+
type NavigationOrientation = ToolbarOrientation | 'both';
|
|
80
90
|
/**
|
|
81
91
|
* The item index `key` moves focus to from `current` (−1: none focused) among `count` items, or
|
|
82
|
-
* null when the key does not navigate. At either end the index stays put
|
|
92
|
+
* null when the key does not navigate. At either end the index stays put unless `wrap`.
|
|
83
93
|
*/
|
|
84
|
-
declare function toolbarNavigationTarget(key: string, count: number, current: number, orientation?:
|
|
94
|
+
declare function toolbarNavigationTarget(key: string, count: number, current: number, orientation?: NavigationOrientation, rtl?: boolean, wrap?: boolean): number | null;
|
|
85
95
|
|
|
86
96
|
/** Where a floating toolbar leaves the screen (FloatingToolbarExitDirection), logical. */
|
|
87
97
|
type FloatingToolbarExitDirection = 'bottom' | 'top' | 'start' | 'end';
|
|
@@ -931,6 +941,118 @@ declare class DrawerAnimation {
|
|
|
931
941
|
sample(now: number): DrawerSample;
|
|
932
942
|
}
|
|
933
943
|
|
|
944
|
+
/** No `steps`: a key moves 1 % of the range (slideOnKeyEvents: `if (steps > 0) steps + 1 else 100`). */
|
|
945
|
+
declare const SLIDER_KEY_DIVISIONS = 100;
|
|
946
|
+
/** PageUp / PageDown: `(actualSteps / 10).coerceIn(1, 10)` steps. */
|
|
947
|
+
declare const SLIDER_PAGE_DIVISOR = 10;
|
|
948
|
+
declare const SLIDER_PAGE_MAX_STEPS = 10;
|
|
949
|
+
/**
|
|
950
|
+
* Compose `steps` for a web `step` (a value increment; 0, negative or absent = continuous):
|
|
951
|
+
* the stops between the ends, `round((max − min) / step) − 1`, at least 0. A `step` that does not
|
|
952
|
+
* divide the range gives evenly spaced ticks the nearest to it.
|
|
953
|
+
*/
|
|
954
|
+
declare function sliderSteps(min: number, max: number, step?: number): number;
|
|
955
|
+
/** stepsToTickFractions: `steps + 2` fractions i / (steps + 1); none without steps. */
|
|
956
|
+
declare function sliderTickFractions(steps: number): number[];
|
|
957
|
+
/** calcFraction: the 0..1 fraction `value` is of min..max (0 for an empty range). */
|
|
958
|
+
declare function sliderFraction(value: number, min: number, max: number): number;
|
|
959
|
+
/** The value at `fraction` of min..max. */
|
|
960
|
+
declare const sliderValueAt: (fraction: number, min: number, max: number) => number;
|
|
961
|
+
/** snapValueToTick in value space: the nearest tick value (the first of equals), or `value`. */
|
|
962
|
+
declare function sliderSnap(value: number, steps: number, min: number, max: number): number;
|
|
963
|
+
/** The bounds of one thumb: the track, or for a range thumb up to / from the other thumb. */
|
|
964
|
+
interface SliderThumbBounds {
|
|
965
|
+
readonly min: number;
|
|
966
|
+
readonly max: number;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* The value a thumb takes for a requested `value`: coerced into its bounds, then snapped to the
|
|
970
|
+
* nearest tick of the whole track (SliderState.value / RangeSliderState.startValue / endValue).
|
|
971
|
+
*/
|
|
972
|
+
declare function sliderThumbValue(value: number, bounds: SliderThumbBounds, steps: number, min: number, max: number): number;
|
|
973
|
+
/** The bounds of thumb `index` among `values` (one thumb, or a range's start and end). */
|
|
974
|
+
declare function sliderThumbBounds(values: readonly number[], index: number, min: number, max: number): SliderThumbBounds;
|
|
975
|
+
/** One key step: `rangeLength / actualSteps`. */
|
|
976
|
+
declare function sliderKeyDelta(steps: number, min: number, max: number): number;
|
|
977
|
+
/** PageUp / PageDown: how many key steps a page is. */
|
|
978
|
+
declare function sliderPageSteps(steps: number): number;
|
|
979
|
+
type SliderKeyAction = 'increment' | 'decrement' | 'page-increment' | 'page-decrement' | 'min' | 'max';
|
|
980
|
+
interface SliderKeyOptions {
|
|
981
|
+
readonly vertical?: boolean;
|
|
982
|
+
/** Right-to-left layout: the horizontal arrows swap (Compose `sign = -1`). */
|
|
983
|
+
readonly rtl?: boolean;
|
|
984
|
+
/** Shift held: an arrow moves a page (m3.material.io "a larger interval"; React Aria). */
|
|
985
|
+
readonly shiftKey?: boolean;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* What a key does. Compose: ArrowRight / ArrowLeft on a horizontal slider (swapped in RTL),
|
|
989
|
+
* ArrowUp / ArrowDown on a vertical one (minimum at the bottom: up increases, owner decision
|
|
990
|
+
* M8 #21), PageUp / PageDown, Home / End. The web adds the other arrow pair per the ARIA slider
|
|
991
|
+
* pattern (Up / Right increase) and Shift + arrow for a page (m3.material.io keyboard table);
|
|
992
|
+
* Compose ignores them. Other keys: null.
|
|
993
|
+
*/
|
|
994
|
+
declare function sliderKeyAction(key: string, options?: SliderKeyOptions): SliderKeyAction | null;
|
|
995
|
+
/**
|
|
996
|
+
* The value a key action gives thumb `index` (the result is coerced into the thumb's bounds and
|
|
997
|
+
* snapped). Home / End go to the thumb's bounds: a range start thumb's End meets the end thumb.
|
|
998
|
+
*/
|
|
999
|
+
declare function sliderKeyValue(action: SliderKeyAction, values: readonly number[], index: number, steps: number, min: number, max: number): number;
|
|
1000
|
+
/**
|
|
1001
|
+
* The range thumb a press at `value` moves (RangeSliderLogic): the closer one; when both are as
|
|
1002
|
+
* close, the start thumb if it lies after the pointer (stacked thumbs pressed before them), else
|
|
1003
|
+
* the end thumb.
|
|
1004
|
+
*/
|
|
1005
|
+
declare function sliderClosestThumb(values: readonly number[], value: number): number;
|
|
1006
|
+
/** Input of `sliderTrackGeometry` (one axis; slider.css mirrors it for RTL and vertical). */
|
|
1007
|
+
interface SliderTrackInput {
|
|
1008
|
+
/** Track length: the slider's length less the thumb width. */
|
|
1009
|
+
readonly length: number;
|
|
1010
|
+
/** Outer corner size (the default Track: thickness / 2). */
|
|
1011
|
+
readonly cornerSize: number;
|
|
1012
|
+
/** TrackInsideCornerSize. */
|
|
1013
|
+
readonly insideCornerSize: number;
|
|
1014
|
+
/** ThumbWidth (the thumb's layout size along the track; its handle may be narrower). */
|
|
1015
|
+
readonly thumbWidth: number;
|
|
1016
|
+
/** ThumbTrackGapSize. */
|
|
1017
|
+
readonly gapSize: number;
|
|
1018
|
+
readonly steps: number;
|
|
1019
|
+
/** The single thumb's fraction, or the range end's. */
|
|
1020
|
+
readonly fraction: number;
|
|
1021
|
+
/** A range's start fraction. */
|
|
1022
|
+
readonly startFraction?: number;
|
|
1023
|
+
readonly centered?: boolean;
|
|
1024
|
+
/** Track(trackCornerSize) and CenteredTrack shrink corners; the default Track does not. */
|
|
1025
|
+
readonly cornerShrinking?: boolean;
|
|
1026
|
+
/** Stop indicators drawn (SliderWithTrackIconsSample passes null). Default true. */
|
|
1027
|
+
readonly stopIndicator?: boolean;
|
|
1028
|
+
}
|
|
1029
|
+
type SliderTrackPartKind = 'inactive-start' | 'active' | 'inactive-end';
|
|
1030
|
+
interface SliderTrackPart {
|
|
1031
|
+
readonly kind: SliderTrackPartKind;
|
|
1032
|
+
readonly start: number;
|
|
1033
|
+
readonly end: number;
|
|
1034
|
+
readonly startRadius: number;
|
|
1035
|
+
readonly endRadius: number;
|
|
1036
|
+
}
|
|
1037
|
+
interface SliderTick {
|
|
1038
|
+
readonly position: number;
|
|
1039
|
+
readonly active: boolean;
|
|
1040
|
+
}
|
|
1041
|
+
interface SliderTrackGeometry {
|
|
1042
|
+
/** Thumb centres along the track (one, or a range's start and end). */
|
|
1043
|
+
readonly thumbs: readonly number[];
|
|
1044
|
+
readonly parts: readonly SliderTrackPart[];
|
|
1045
|
+
/** Stop indicator centres. */
|
|
1046
|
+
readonly stops: readonly number[];
|
|
1047
|
+
readonly ticks: readonly SliderTick[];
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* SliderImpl's thumb placement and drawTrack (LTR, horizontal), in track coordinates: with steps,
|
|
1051
|
+
* a value off the first and last tick sits between the corners
|
|
1052
|
+
* ((length − 2 × corner) × fraction + corner), else length × fraction.
|
|
1053
|
+
*/
|
|
1054
|
+
declare function sliderTrackGeometry(input: SliderTrackInput): SliderTrackGeometry;
|
|
1055
|
+
|
|
934
1056
|
/** TabRow.kt L461 / L608: `maxOf(contentWidth, 24.dp)` ("Enforce minimum touch target of 24.dp"). */
|
|
935
1057
|
declare const TAB_INDICATOR_MIN_WIDTH = 24;
|
|
936
1058
|
type TabRowVariant = 'primary' | 'secondary';
|
|
@@ -1228,4 +1350,4 @@ declare class ThreePaneScaffoldAnimation {
|
|
|
1228
1350
|
sample(now: number): ThreePaneScaffoldSample;
|
|
1229
1351
|
}
|
|
1230
1352
|
|
|
1231
|
-
export { type AdaptStrategy, AmplitudeAnimation, type AmplitudeTween, type AppBarScrollBehavior, type AppBarScrollState, type BackNavigationBehavior, type ButtonGroupItemSize, type CircularIndeterminateFrame, type CircularIndeterminateTiming, DEFAULT_DISPLACEMENT_THRESHOLD, DRAWER_POSITIONAL_THRESHOLD, DRAWER_SETTLE_MILLIS, DRAWER_VELOCITY_THRESHOLD, DrawerAnimation, type DrawerSample, type DrawerSpecs, type Easing, FAST_OUT_LINEAR_IN_EASING, type FloatingToolbarExitDirection, type FloatingToolbarScrollState, type IndeterminateFrame, LIST_DETAIL_ADAPT_STRATEGIES, LIST_DETAIL_INITIAL_HISTORY, LIST_DETAIL_PANE_ORDER, type LinearEasing, type LinearEasingOptions, type LinearIndeterminateTiming, ListDetailPaneScaffoldRole, type LoadingIndicatorTiming, MODAL_RAIL_EXPANDED_PROGRESS, type MenuAnchorPosition, type MenuPositionInput, type MenuPositionResult, type MenuRect, type Motion, NAVIGATION_SUITE_EXPANDED_FROM, NAVIGATION_SUITE_TYPES, type NavigationSuiteSample, NavigationSuiteScaffoldAnimation, type NavigationSuiteType, type NavigationSuiteTypeOptions, PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD, PANE_EXPANSION_SAMPLE_ANCHORS, PANE_MOTION_DELAYED_RATIO, PANE_MOTION_VISIBILITY_THRESHOLD, type PaneAdaptedValue, type PaneExpansionAnchor, type PaneExpansionLayout, type PaneMotion, type PaneRect, type PaneRule, type PaneScaffoldDirective, type PaneTransition, RECOMMENDED_MAX_PANES, SEARCH_BAR_EXPANDED_THRESHOLD, SEARCH_DROPDOWN_VISIBLE_PROGRESS, SUPPORTING_PANE_ADAPT_STRATEGIES, SUPPORTING_PANE_INITIAL_HISTORY, SUPPORTING_PANE_ORDER, SearchBarAnimation, type SearchBarSample, type SearchBarSpecs, type SearchRect, type SearchViewFrame, type SearchViewInput, type SearchViewMetrics, type SearchViewVariant, SpringAnimatable, SpringSimulation, type SpringSpec, SupportingPaneScaffoldRole, TAB_INDICATOR_MIN_WIDTH, THREE_PANE_SCAFFOLD_ROLES, TOP_TITLE_ALPHA_EASING, TabIndicatorAnimation, type TabIndicatorSample, type TabMeasure, type TabPosition, type TabRowVariant, TabScrollAnimation, type ThreePaneScaffoldAdaptStrategies, ThreePaneScaffoldAnimation, type ThreePaneScaffoldDestinationItem, type ThreePaneScaffoldDirectiveOptions, type ThreePaneScaffoldLayout, type ThreePaneScaffoldLayoutInput, ThreePaneScaffoldNavigator, type ThreePaneScaffoldNavigatorOptions, type ThreePaneScaffoldRole, type ThreePaneScaffoldSample, type ThreePaneScaffoldValue, type ToolbarExpansionScroll, type ToolbarOrientation, TweenAnimatable, type TweenSpec, type TwoRowsFrame, WINDOW_HEIGHT_BREAKPOINTS, WINDOW_WIDTH_BREAKPOINTS, WideNavigationRailAnimation, type WideNavigationRailAnimationOptions, type WideNavigationRailMetrics, type WideNavigationRailSample, type WideNavigationRailSpecs, type WideNavigationRailWidthInput, type WindowHeightSizeClass, type WindowPostureOptions, type WindowSizeClass, type WindowSizeClassOptions, type WindowWidthSizeClass, animatedInt, appBarScrollState, buttonGroupVisibleCount, buttonGroupWidths, calculatePaneMotion, calculateThreePaneScaffoldValue, circularIndeterminateFrame, closestPaneExpansionAnchor, collapsedFraction, cubicBezier, dampingCoefficient, dampingRatioFromCoefficient, drawerSettlesOpen, estimateAnimationDurationMillis, estimateAnimationDurationMillisDouble, expandedPanes, exponentialDecayTarget, fabMenuItemVisible, floatingToolbarScrollState, indeterminateFrame, indicatorAmplitude, initialIndeterminateFrame, isAtLeastBreakpoint, isHeightAtLeastBreakpoint, isNavigationBarType, isScrolledUnder, isWidthAtLeastBreakpoint, linearIndeterminateFractions, menuNavigationTarget, menuPosition, menuTransformOrigin, morphSpringDurationMillis, navigationSuiteOffset, navigationSuiteType, nextPaneExpansionAnchor, overlappedFraction, paneExpansionAnchorPosition, paneScaffoldDirective, paneTransitions, parseCubicBezier, sameThreePaneScaffoldValue, sameWindowSizeClass, scrollAppBar, scrollFloatingToolbar, scrollToolbarExpansion, scrollableTabOffset, searchNavigationTarget, searchViewFrame, settleTarget, springDurationMillis, springToLinear, springValue, springVelocity, tabIndicatorShift, tabIndicatorTarget, tabPositions, threePaneScaffoldDirective, threePaneScaffoldLayout, toolbarCollapsedFraction, toolbarExpansionScroll, toolbarNavigationTarget, toolbarSettleTarget, twoRowsFrame, waveOffset, waveTravelMillis, wideNavigationRailItemWidth, wideNavigationRailWidth, windowHeightSizeClass, windowSizeClass, windowWidthSizeClass, withHeight, withHeightOffset, withToolbarOffset, withToolbarOffsetLimit };
|
|
1353
|
+
export { type AdaptStrategy, AmplitudeAnimation, type AmplitudeTween, type AppBarScrollBehavior, type AppBarScrollState, type BackNavigationBehavior, type ButtonGroupItemSize, type CircularIndeterminateFrame, type CircularIndeterminateTiming, DEFAULT_DISPLACEMENT_THRESHOLD, DRAWER_POSITIONAL_THRESHOLD, DRAWER_SETTLE_MILLIS, DRAWER_VELOCITY_THRESHOLD, DrawerAnimation, type DrawerSample, type DrawerSpecs, type Easing, FAST_OUT_LINEAR_IN_EASING, type FloatingToolbarExitDirection, type FloatingToolbarScrollState, type IndeterminateFrame, LIST_DETAIL_ADAPT_STRATEGIES, LIST_DETAIL_INITIAL_HISTORY, LIST_DETAIL_PANE_ORDER, type LinearEasing, type LinearEasingOptions, type LinearIndeterminateTiming, ListDetailPaneScaffoldRole, type LoadingIndicatorTiming, MODAL_RAIL_EXPANDED_PROGRESS, type MenuAnchorPosition, type MenuPositionInput, type MenuPositionResult, type MenuRect, type Motion, NAVIGATION_SUITE_EXPANDED_FROM, NAVIGATION_SUITE_TYPES, type NavigationOrientation, type NavigationSuiteSample, NavigationSuiteScaffoldAnimation, type NavigationSuiteType, type NavigationSuiteTypeOptions, PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD, PANE_EXPANSION_SAMPLE_ANCHORS, PANE_MOTION_DELAYED_RATIO, PANE_MOTION_VISIBILITY_THRESHOLD, type PaneAdaptedValue, type PaneExpansionAnchor, type PaneExpansionLayout, type PaneMotion, type PaneRect, type PaneRule, type PaneScaffoldDirective, type PaneTransition, RECOMMENDED_MAX_PANES, SEARCH_BAR_EXPANDED_THRESHOLD, SEARCH_DROPDOWN_VISIBLE_PROGRESS, SLIDER_KEY_DIVISIONS, SLIDER_PAGE_DIVISOR, SLIDER_PAGE_MAX_STEPS, SUPPORTING_PANE_ADAPT_STRATEGIES, SUPPORTING_PANE_INITIAL_HISTORY, SUPPORTING_PANE_ORDER, SearchBarAnimation, type SearchBarSample, type SearchBarSpecs, type SearchRect, type SearchViewFrame, type SearchViewInput, type SearchViewMetrics, type SearchViewVariant, type SliderKeyAction, type SliderKeyOptions, type SliderThumbBounds, type SliderTick, type SliderTrackGeometry, type SliderTrackInput, type SliderTrackPart, type SliderTrackPartKind, SpringAnimatable, SpringSimulation, type SpringSpec, SupportingPaneScaffoldRole, TAB_INDICATOR_MIN_WIDTH, THREE_PANE_SCAFFOLD_ROLES, TOP_TITLE_ALPHA_EASING, TYPEAHEAD_TIMEOUT_MS, TabIndicatorAnimation, type TabIndicatorSample, type TabMeasure, type TabPosition, type TabRowVariant, TabScrollAnimation, type ThreePaneScaffoldAdaptStrategies, ThreePaneScaffoldAnimation, type ThreePaneScaffoldDestinationItem, type ThreePaneScaffoldDirectiveOptions, type ThreePaneScaffoldLayout, type ThreePaneScaffoldLayoutInput, ThreePaneScaffoldNavigator, type ThreePaneScaffoldNavigatorOptions, type ThreePaneScaffoldRole, type ThreePaneScaffoldSample, type ThreePaneScaffoldValue, type ToolbarExpansionScroll, type ToolbarOrientation, TweenAnimatable, type TweenSpec, type TwoRowsFrame, WINDOW_HEIGHT_BREAKPOINTS, WINDOW_WIDTH_BREAKPOINTS, WideNavigationRailAnimation, type WideNavigationRailAnimationOptions, type WideNavigationRailMetrics, type WideNavigationRailSample, type WideNavigationRailSpecs, type WideNavigationRailWidthInput, type WindowHeightSizeClass, type WindowPostureOptions, type WindowSizeClass, type WindowSizeClassOptions, type WindowWidthSizeClass, animatedInt, appBarScrollState, buttonGroupVisibleCount, buttonGroupWidths, calculatePaneMotion, calculateThreePaneScaffoldValue, circularIndeterminateFrame, closestPaneExpansionAnchor, collapsedFraction, cubicBezier, dampingCoefficient, dampingRatioFromCoefficient, drawerSettlesOpen, estimateAnimationDurationMillis, estimateAnimationDurationMillisDouble, expandedPanes, exponentialDecayTarget, fabMenuItemVisible, floatingToolbarScrollState, indeterminateFrame, indicatorAmplitude, initialIndeterminateFrame, isAtLeastBreakpoint, isHeightAtLeastBreakpoint, isNavigationBarType, isScrolledUnder, isWidthAtLeastBreakpoint, linearIndeterminateFractions, menuNavigationTarget, menuPosition, menuTransformOrigin, morphSpringDurationMillis, navigationSuiteOffset, navigationSuiteType, nextPaneExpansionAnchor, overlappedFraction, paneExpansionAnchorPosition, paneScaffoldDirective, paneTransitions, parseCubicBezier, sameThreePaneScaffoldValue, sameWindowSizeClass, scrollAppBar, scrollFloatingToolbar, scrollToolbarExpansion, scrollableTabOffset, searchNavigationTarget, searchViewFrame, settleTarget, sliderClosestThumb, sliderFraction, sliderKeyAction, sliderKeyDelta, sliderKeyValue, sliderPageSteps, sliderSnap, sliderSteps, sliderThumbBounds, sliderThumbValue, sliderTickFractions, sliderTrackGeometry, sliderValueAt, springDurationMillis, springToLinear, springValue, springVelocity, tabIndicatorShift, tabIndicatorTarget, tabPositions, threePaneScaffoldDirective, threePaneScaffoldLayout, toolbarCollapsedFraction, toolbarExpansionScroll, toolbarNavigationTarget, toolbarSettleTarget, twoRowsFrame, typeSelectTarget, waveOffset, waveTravelMillis, wideNavigationRailItemWidth, wideNavigationRailWidth, windowHeightSizeClass, windowSizeClass, windowWidthSizeClass, withHeight, withHeightOffset, withToolbarOffset, withToolbarOffsetLimit };
|
package/dist/index.js
CHANGED
|
@@ -438,8 +438,21 @@ function menuNavigationTarget(key, count, current) {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
+
// src/type-select.ts
|
|
442
|
+
var TYPEAHEAD_TIMEOUT_MS = 1e3;
|
|
443
|
+
var collator;
|
|
444
|
+
function typeSelectTarget(texts, from, search) {
|
|
445
|
+
collator ??= new Intl.Collator(void 0, { usage: "search", sensitivity: "base" });
|
|
446
|
+
const compare = collator;
|
|
447
|
+
const matches = (text) => text !== "" && compare.compare(text.slice(0, search.length), search) === 0;
|
|
448
|
+
const start = Math.max(from, 0);
|
|
449
|
+
for (let i = start; i < texts.length; i++) if (matches(texts[i] ?? "")) return i;
|
|
450
|
+
for (let i = 0; i < start; i++) if (matches(texts[i] ?? "")) return i;
|
|
451
|
+
return -1;
|
|
452
|
+
}
|
|
453
|
+
|
|
441
454
|
// src/toolbar-navigation.ts
|
|
442
|
-
function toolbarNavigationTarget(key, count, current, orientation = "horizontal", rtl = false) {
|
|
455
|
+
function toolbarNavigationTarget(key, count, current, orientation = "horizontal", rtl = false, wrap = false) {
|
|
443
456
|
if (count === 0) return null;
|
|
444
457
|
let step;
|
|
445
458
|
switch (key) {
|
|
@@ -449,19 +462,21 @@ function toolbarNavigationTarget(key, count, current, orientation = "horizontal"
|
|
|
449
462
|
return count - 1;
|
|
450
463
|
case "ArrowRight":
|
|
451
464
|
case "ArrowLeft":
|
|
452
|
-
if (orientation
|
|
465
|
+
if (orientation === "vertical") return null;
|
|
453
466
|
step = key === "ArrowRight" !== rtl ? 1 : -1;
|
|
454
467
|
break;
|
|
455
468
|
case "ArrowDown":
|
|
456
469
|
case "ArrowUp":
|
|
457
|
-
if (orientation
|
|
470
|
+
if (orientation === "horizontal") return null;
|
|
458
471
|
step = key === "ArrowDown" ? 1 : -1;
|
|
459
472
|
break;
|
|
460
473
|
default:
|
|
461
474
|
return null;
|
|
462
475
|
}
|
|
463
476
|
if (current < 0) return step > 0 ? 0 : count - 1;
|
|
464
|
-
|
|
477
|
+
const next = current + step;
|
|
478
|
+
if (wrap) return (next + count) % count;
|
|
479
|
+
return Math.min(Math.max(next, 0), count - 1);
|
|
465
480
|
}
|
|
466
481
|
|
|
467
482
|
// src/cubic-bezier.ts
|
|
@@ -1592,6 +1607,178 @@ var DrawerAnimation = class {
|
|
|
1592
1607
|
}
|
|
1593
1608
|
};
|
|
1594
1609
|
|
|
1610
|
+
// src/slider.ts
|
|
1611
|
+
var SLIDER_KEY_DIVISIONS = 100;
|
|
1612
|
+
var SLIDER_PAGE_DIVISOR = 10;
|
|
1613
|
+
var SLIDER_PAGE_MAX_STEPS = 10;
|
|
1614
|
+
var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
1615
|
+
var lerp3 = (a, b, t) => a + (b - a) * t;
|
|
1616
|
+
function sliderSteps(min, max, step) {
|
|
1617
|
+
if (step === void 0 || !(step > 0) || !(max > min)) return 0;
|
|
1618
|
+
return Math.max(0, Math.round((max - min) / step) - 1);
|
|
1619
|
+
}
|
|
1620
|
+
function sliderTickFractions(steps) {
|
|
1621
|
+
if (steps <= 0) return [];
|
|
1622
|
+
return Array.from({ length: steps + 2 }, (_, i) => i / (steps + 1));
|
|
1623
|
+
}
|
|
1624
|
+
function sliderFraction(value, min, max) {
|
|
1625
|
+
return clamp(max - min === 0 ? 0 : (value - min) / (max - min), 0, 1);
|
|
1626
|
+
}
|
|
1627
|
+
var sliderValueAt = (fraction, min, max) => lerp3(min, max, fraction);
|
|
1628
|
+
function sliderSnap(value, steps, min, max) {
|
|
1629
|
+
const ticks = sliderTickFractions(steps);
|
|
1630
|
+
if (ticks.length === 0) return value;
|
|
1631
|
+
let best = value;
|
|
1632
|
+
let distance = Infinity;
|
|
1633
|
+
for (const t of ticks) {
|
|
1634
|
+
const v = lerp3(min, max, t);
|
|
1635
|
+
const d = Math.abs(v - value);
|
|
1636
|
+
if (d < distance) {
|
|
1637
|
+
distance = d;
|
|
1638
|
+
best = v;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
return best;
|
|
1642
|
+
}
|
|
1643
|
+
function sliderThumbValue(value, bounds, steps, min, max) {
|
|
1644
|
+
return sliderSnap(clamp(value, bounds.min, bounds.max), steps, min, max);
|
|
1645
|
+
}
|
|
1646
|
+
function sliderThumbBounds(values, index, min, max) {
|
|
1647
|
+
return {
|
|
1648
|
+
min: index > 0 ? values[index - 1] ?? min : min,
|
|
1649
|
+
max: index < values.length - 1 ? values[index + 1] ?? max : max
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
function sliderKeyDelta(steps, min, max) {
|
|
1653
|
+
const actual = steps > 0 ? steps + 1 : SLIDER_KEY_DIVISIONS;
|
|
1654
|
+
return Math.abs(max - min) / actual;
|
|
1655
|
+
}
|
|
1656
|
+
function sliderPageSteps(steps) {
|
|
1657
|
+
const actual = steps > 0 ? steps + 1 : SLIDER_KEY_DIVISIONS;
|
|
1658
|
+
return clamp(Math.floor(actual / SLIDER_PAGE_DIVISOR), 1, SLIDER_PAGE_MAX_STEPS);
|
|
1659
|
+
}
|
|
1660
|
+
function sliderKeyAction(key, options = {}) {
|
|
1661
|
+
const { vertical = false, rtl = false, shiftKey = false } = options;
|
|
1662
|
+
const page = (up) => shiftKey ? up ? "page-increment" : "page-decrement" : up ? "increment" : "decrement";
|
|
1663
|
+
switch (key) {
|
|
1664
|
+
case "ArrowUp":
|
|
1665
|
+
return page(true);
|
|
1666
|
+
case "ArrowDown":
|
|
1667
|
+
return page(false);
|
|
1668
|
+
case "ArrowRight":
|
|
1669
|
+
return page(vertical || !rtl);
|
|
1670
|
+
case "ArrowLeft":
|
|
1671
|
+
return page(!(vertical || !rtl));
|
|
1672
|
+
case "PageUp":
|
|
1673
|
+
return "page-increment";
|
|
1674
|
+
case "PageDown":
|
|
1675
|
+
return "page-decrement";
|
|
1676
|
+
case "Home":
|
|
1677
|
+
return "min";
|
|
1678
|
+
case "End":
|
|
1679
|
+
return "max";
|
|
1680
|
+
default:
|
|
1681
|
+
return null;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
function sliderKeyValue(action, values, index, steps, min, max) {
|
|
1685
|
+
const value = values[index] ?? min;
|
|
1686
|
+
const bounds = sliderThumbBounds(values, index, min, max);
|
|
1687
|
+
const delta = sliderKeyDelta(steps, min, max);
|
|
1688
|
+
const page = sliderPageSteps(steps) * delta;
|
|
1689
|
+
const target = action === "increment" ? value + delta : action === "decrement" ? value - delta : action === "page-increment" ? value + page : action === "page-decrement" ? value - page : action === "min" ? bounds.min : bounds.max;
|
|
1690
|
+
return sliderThumbValue(target, bounds, steps, min, max);
|
|
1691
|
+
}
|
|
1692
|
+
function sliderClosestThumb(values, value) {
|
|
1693
|
+
const [start, end] = values;
|
|
1694
|
+
if (start === void 0 || end === void 0) return 0;
|
|
1695
|
+
const diffStart = Math.abs(start - value);
|
|
1696
|
+
const diffEnd = Math.abs(end - value);
|
|
1697
|
+
if (diffStart !== diffEnd) return diffStart < diffEnd ? 0 : 1;
|
|
1698
|
+
return start > value ? 0 : 1;
|
|
1699
|
+
}
|
|
1700
|
+
function sliderTrackGeometry(input) {
|
|
1701
|
+
const {
|
|
1702
|
+
length,
|
|
1703
|
+
cornerSize: c,
|
|
1704
|
+
insideCornerSize: inside,
|
|
1705
|
+
thumbWidth,
|
|
1706
|
+
gapSize,
|
|
1707
|
+
steps,
|
|
1708
|
+
fraction,
|
|
1709
|
+
centered = false,
|
|
1710
|
+
cornerShrinking = false,
|
|
1711
|
+
stopIndicator = true
|
|
1712
|
+
} = input;
|
|
1713
|
+
const range = input.startFraction !== void 0;
|
|
1714
|
+
const ticks = sliderTickFractions(steps);
|
|
1715
|
+
const onEdge = (f) => f === ticks[0] || f === ticks[ticks.length - 1];
|
|
1716
|
+
const position = (f) => ticks.length > 0 && !onEdge(f) ? (length - c * 2) * f + c : length * f;
|
|
1717
|
+
const end = position(fraction);
|
|
1718
|
+
const start = range ? position(input.startFraction) : 0;
|
|
1719
|
+
const centre = length / 2;
|
|
1720
|
+
const before = fraction < 0.5;
|
|
1721
|
+
const after = fraction > 0.5;
|
|
1722
|
+
const startThumb = centered ? !after ? thumbWidth : 0 : range ? thumbWidth : 0;
|
|
1723
|
+
const endThumb = centered ? !before ? thumbWidth : 0 : thumbWidth;
|
|
1724
|
+
const startGapSize = centered || range ? gapSize : 0;
|
|
1725
|
+
const startGap = startGapSize > 0 ? startThumb / 2 + startGapSize : 0;
|
|
1726
|
+
const endGap = gapSize > 0 ? endThumb / 2 + gapSize : 0;
|
|
1727
|
+
const thresholdCorner = !cornerShrinking || ticks.length > 0;
|
|
1728
|
+
const parts = [];
|
|
1729
|
+
const stops = [];
|
|
1730
|
+
const adjustedEnd = centered ? Math.min(end, centre) : start;
|
|
1731
|
+
const rangeThreshold = startGap + (thresholdCorner ? c : 0);
|
|
1732
|
+
if ((centered || range) && adjustedEnd > rangeThreshold) {
|
|
1733
|
+
parts.push({
|
|
1734
|
+
kind: "inactive-start",
|
|
1735
|
+
start: 0,
|
|
1736
|
+
end: adjustedEnd - startGap,
|
|
1737
|
+
startRadius: c,
|
|
1738
|
+
endRadius: inside
|
|
1739
|
+
});
|
|
1740
|
+
if (stopIndicator) stops.push(c);
|
|
1741
|
+
}
|
|
1742
|
+
const adjustedStart = centered ? Math.max(end, centre) : end;
|
|
1743
|
+
const inactiveThreshold = length - endGap - (thresholdCorner ? c : 0);
|
|
1744
|
+
if (adjustedStart < inactiveThreshold) {
|
|
1745
|
+
parts.push({
|
|
1746
|
+
kind: "inactive-end",
|
|
1747
|
+
start: adjustedStart + endGap,
|
|
1748
|
+
end: length,
|
|
1749
|
+
startRadius: inside,
|
|
1750
|
+
endRadius: c
|
|
1751
|
+
});
|
|
1752
|
+
if (stopIndicator) stops.push(length - c);
|
|
1753
|
+
}
|
|
1754
|
+
const activeStart = centered ? adjustedEnd + (adjustedEnd < centre ? startGap : 0) : range ? start + startGap : 0;
|
|
1755
|
+
const activeEnd = centered ? adjustedStart - (adjustedStart > centre ? endGap : 0) : end - endGap;
|
|
1756
|
+
const activeStartRadius = centered || range ? inside : c;
|
|
1757
|
+
const activeThreshold = thresholdCorner ? activeStartRadius : 0;
|
|
1758
|
+
if (activeEnd - activeStart > activeThreshold) {
|
|
1759
|
+
parts.push({
|
|
1760
|
+
kind: "active",
|
|
1761
|
+
start: activeStart,
|
|
1762
|
+
end: activeEnd,
|
|
1763
|
+
startRadius: activeStartRadius,
|
|
1764
|
+
endRadius: inside
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
const tickList = [];
|
|
1768
|
+
const centreGap = centered ? end > centre ? startGap : endGap : 0;
|
|
1769
|
+
const thumbGap = centered ? end > centre ? endGap : startGap : endGap;
|
|
1770
|
+
ticks.forEach((t, i) => {
|
|
1771
|
+
if (stopIndicator && ((centered || range) && i === 0 || i === ticks.length - 1)) return;
|
|
1772
|
+
const p = lerp3(c, length - c, t);
|
|
1773
|
+
const within = (centreOf, gap) => p >= centreOf - gap && p <= centreOf + gap;
|
|
1774
|
+
if (centered && within(centre, centreGap) || range && within(start, startGap) || within(end, thumbGap)) {
|
|
1775
|
+
return;
|
|
1776
|
+
}
|
|
1777
|
+
tickList.push({ position: p, active: p >= activeStart && p <= activeEnd });
|
|
1778
|
+
});
|
|
1779
|
+
return { thumbs: range ? [start, end] : [end], parts, stops, ticks: tickList };
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1595
1782
|
// src/tabs.ts
|
|
1596
1783
|
var TAB_INDICATOR_MIN_WIDTH = 24;
|
|
1597
1784
|
var THRESHOLD = 0.01;
|
|
@@ -2257,6 +2444,6 @@ var ThreePaneScaffoldAnimation = class {
|
|
|
2257
2444
|
}
|
|
2258
2445
|
};
|
|
2259
2446
|
|
|
2260
|
-
export { AmplitudeAnimation, DEFAULT_DISPLACEMENT_THRESHOLD, DRAWER_POSITIONAL_THRESHOLD, DRAWER_SETTLE_MILLIS, DRAWER_VELOCITY_THRESHOLD, DrawerAnimation, FAST_OUT_LINEAR_IN_EASING, LIST_DETAIL_ADAPT_STRATEGIES, LIST_DETAIL_INITIAL_HISTORY, LIST_DETAIL_PANE_ORDER, ListDetailPaneScaffoldRole, MODAL_RAIL_EXPANDED_PROGRESS, NAVIGATION_SUITE_EXPANDED_FROM, NAVIGATION_SUITE_TYPES, NavigationSuiteScaffoldAnimation, PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD, PANE_EXPANSION_SAMPLE_ANCHORS, PANE_MOTION_DELAYED_RATIO, PANE_MOTION_VISIBILITY_THRESHOLD, RECOMMENDED_MAX_PANES, SEARCH_BAR_EXPANDED_THRESHOLD, SEARCH_DROPDOWN_VISIBLE_PROGRESS, SUPPORTING_PANE_ADAPT_STRATEGIES, SUPPORTING_PANE_INITIAL_HISTORY, SUPPORTING_PANE_ORDER, SearchBarAnimation, SpringAnimatable, SpringSimulation, SupportingPaneScaffoldRole, TAB_INDICATOR_MIN_WIDTH, THREE_PANE_SCAFFOLD_ROLES, TOP_TITLE_ALPHA_EASING, TabIndicatorAnimation, TabScrollAnimation, ThreePaneScaffoldAnimation, ThreePaneScaffoldNavigator, TweenAnimatable, WINDOW_HEIGHT_BREAKPOINTS, WINDOW_WIDTH_BREAKPOINTS, WideNavigationRailAnimation, animatedInt, appBarScrollState, buttonGroupVisibleCount, buttonGroupWidths, calculatePaneMotion, calculateThreePaneScaffoldValue, circularIndeterminateFrame, closestPaneExpansionAnchor, collapsedFraction, cubicBezier, dampingCoefficient, dampingRatioFromCoefficient, drawerSettlesOpen, estimateAnimationDurationMillis, estimateAnimationDurationMillisDouble, expandedPanes, exponentialDecayTarget, fabMenuItemVisible, floatingToolbarScrollState, indeterminateFrame, indicatorAmplitude, initialIndeterminateFrame, isAtLeastBreakpoint, isHeightAtLeastBreakpoint, isNavigationBarType, isScrolledUnder, isWidthAtLeastBreakpoint, linearIndeterminateFractions, menuNavigationTarget, menuPosition, menuTransformOrigin, morphSpringDurationMillis, navigationSuiteOffset, navigationSuiteType, nextPaneExpansionAnchor, overlappedFraction, paneExpansionAnchorPosition, paneScaffoldDirective, paneTransitions, parseCubicBezier, sameThreePaneScaffoldValue, sameWindowSizeClass, scrollAppBar, scrollFloatingToolbar, scrollToolbarExpansion, scrollableTabOffset, searchNavigationTarget, searchViewFrame, settleTarget, springDurationMillis, springToLinear, springValue, springVelocity, tabIndicatorShift, tabIndicatorTarget, tabPositions, threePaneScaffoldDirective, threePaneScaffoldLayout, toolbarCollapsedFraction, toolbarExpansionScroll, toolbarNavigationTarget, toolbarSettleTarget, twoRowsFrame, waveOffset, waveTravelMillis, wideNavigationRailItemWidth, wideNavigationRailWidth, windowHeightSizeClass, windowSizeClass, windowWidthSizeClass, withHeight, withHeightOffset, withToolbarOffset, withToolbarOffsetLimit };
|
|
2447
|
+
export { AmplitudeAnimation, DEFAULT_DISPLACEMENT_THRESHOLD, DRAWER_POSITIONAL_THRESHOLD, DRAWER_SETTLE_MILLIS, DRAWER_VELOCITY_THRESHOLD, DrawerAnimation, FAST_OUT_LINEAR_IN_EASING, LIST_DETAIL_ADAPT_STRATEGIES, LIST_DETAIL_INITIAL_HISTORY, LIST_DETAIL_PANE_ORDER, ListDetailPaneScaffoldRole, MODAL_RAIL_EXPANDED_PROGRESS, NAVIGATION_SUITE_EXPANDED_FROM, NAVIGATION_SUITE_TYPES, NavigationSuiteScaffoldAnimation, PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD, PANE_EXPANSION_SAMPLE_ANCHORS, PANE_MOTION_DELAYED_RATIO, PANE_MOTION_VISIBILITY_THRESHOLD, RECOMMENDED_MAX_PANES, SEARCH_BAR_EXPANDED_THRESHOLD, SEARCH_DROPDOWN_VISIBLE_PROGRESS, SLIDER_KEY_DIVISIONS, SLIDER_PAGE_DIVISOR, SLIDER_PAGE_MAX_STEPS, SUPPORTING_PANE_ADAPT_STRATEGIES, SUPPORTING_PANE_INITIAL_HISTORY, SUPPORTING_PANE_ORDER, SearchBarAnimation, SpringAnimatable, SpringSimulation, SupportingPaneScaffoldRole, TAB_INDICATOR_MIN_WIDTH, THREE_PANE_SCAFFOLD_ROLES, TOP_TITLE_ALPHA_EASING, TYPEAHEAD_TIMEOUT_MS, TabIndicatorAnimation, TabScrollAnimation, ThreePaneScaffoldAnimation, ThreePaneScaffoldNavigator, TweenAnimatable, WINDOW_HEIGHT_BREAKPOINTS, WINDOW_WIDTH_BREAKPOINTS, WideNavigationRailAnimation, animatedInt, appBarScrollState, buttonGroupVisibleCount, buttonGroupWidths, calculatePaneMotion, calculateThreePaneScaffoldValue, circularIndeterminateFrame, closestPaneExpansionAnchor, collapsedFraction, cubicBezier, dampingCoefficient, dampingRatioFromCoefficient, drawerSettlesOpen, estimateAnimationDurationMillis, estimateAnimationDurationMillisDouble, expandedPanes, exponentialDecayTarget, fabMenuItemVisible, floatingToolbarScrollState, indeterminateFrame, indicatorAmplitude, initialIndeterminateFrame, isAtLeastBreakpoint, isHeightAtLeastBreakpoint, isNavigationBarType, isScrolledUnder, isWidthAtLeastBreakpoint, linearIndeterminateFractions, menuNavigationTarget, menuPosition, menuTransformOrigin, morphSpringDurationMillis, navigationSuiteOffset, navigationSuiteType, nextPaneExpansionAnchor, overlappedFraction, paneExpansionAnchorPosition, paneScaffoldDirective, paneTransitions, parseCubicBezier, sameThreePaneScaffoldValue, sameWindowSizeClass, scrollAppBar, scrollFloatingToolbar, scrollToolbarExpansion, scrollableTabOffset, searchNavigationTarget, searchViewFrame, settleTarget, sliderClosestThumb, sliderFraction, sliderKeyAction, sliderKeyDelta, sliderKeyValue, sliderPageSteps, sliderSnap, sliderSteps, sliderThumbBounds, sliderThumbValue, sliderTickFractions, sliderTrackGeometry, sliderValueAt, springDurationMillis, springToLinear, springValue, springVelocity, tabIndicatorShift, tabIndicatorTarget, tabPositions, threePaneScaffoldDirective, threePaneScaffoldLayout, toolbarCollapsedFraction, toolbarExpansionScroll, toolbarNavigationTarget, toolbarSettleTarget, twoRowsFrame, typeSelectTarget, waveOffset, waveTravelMillis, wideNavigationRailItemWidth, wideNavigationRailWidth, windowHeightSizeClass, windowSizeClass, windowWidthSizeClass, withHeight, withHeightOffset, withToolbarOffset, withToolbarOffsetLimit };
|
|
2261
2448
|
//# sourceMappingURL=index.js.map
|
|
2262
2449
|
//# sourceMappingURL=index.js.map
|