mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 20:07:18 +01:00
The two shared packages are the first repos on the preset (link:../ts_config inside the monorepo; consumers outside use the git tag). Each eslint.config.js is now the defineConfig() call plus one override with its reason: a public API name (`nextChance`, `fuzzyMatch`) the boolean-prefix rule would rename, which is a breaking change for the three repos importing it. Everything else the preset flagged is fixed in code, not disabled: key order (perfectionist), hex casing, sort compare functions in tests, Iterator#map().toArray(), explicit returns on multiline arrows. web_ui: react-refresh/only-export-components was a real finding -- range-slider.tsx exported `steppedValue` next to the component, which breaks Vite HMR for the module. The keyboard contract moves to stepped-value.ts as `steppedValue` + a new pure `keyTarget(key, values, current)`, which also resolves unicorn/no-late-event-control: the handler now decides the target first and calls preventDefault() only when it owns the key. Its tests move with it (the 250-line gate caught the combined file). Minor bump for the new export. dist/ rebuilt in both packages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnAYyNH1Sm4iJNidfYbrZJ
19 lines
1007 B
TypeScript
19 lines
1007 B
TypeScript
/**
|
|
* Steps one thumb by `delta` positions through the distribution. Pure, so the
|
|
* keyboard contract is testable without layout.
|
|
*
|
|
* Steps to the next *distinct* value rather than the next index. Real
|
|
* distributions are lumpy -- awesome-mcp-explorer's star counts hold ~1500
|
|
* duplicate zeros -- and an index step inside a run of equal values changes the
|
|
* index while leaving the value (and therefore the thumb, and the filter)
|
|
* exactly where it was. That reads as a dead arrow key.
|
|
*/
|
|
export declare function steppedValue(values: readonly number[], current: number, delta: number): number;
|
|
/**
|
|
* The value a thumb at `current` moves to for a key, or `undefined` when the
|
|
* key is not one the slider handles (so the event is left to the browser).
|
|
* Arrow keys step one distinct value, Page keys ten, Home/End jump to the
|
|
* bounds.
|
|
*/
|
|
export declare function keyTarget(key: string, values: readonly number[], current: number): number | undefined;
|
|
//# sourceMappingURL=stepped-value.d.ts.map
|