mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 19:07:17 +01:00
`web-ui-tests` has been red since6714d13and the cause was not a stale dist/: the content is byte-identical. Every one of the 16 files differed only by a trailing newline that tsc does not emit. Where the newline came from: at03bf1edthe subproject config had no exclude, so pre-commit's end-of-file-fixer appended a newline to each generated file.eaa5683added `exclude: ^web_ui/dist/` to stop that recurring, but did not revert the newlines already committed -- leaving a dist/ that no `pnpm build` can ever reproduce, and therefore a job that could never go green. It looked fine locally because `tsc -b` is incremental: with a warm tsconfig.tsbuildinfo it skips emit entirely, so `pnpm build` was a no-op and printed no diff. CI has no cache, always emits, and always failed. Deleting tsbuildinfo reproduces the failure locally in one command. Verified: after deleting tsbuildinfo and all of dist/, a from-scratch `pnpm build` reproduces exactly what is committed here -- `git diff --exit-code -- dist` is clean, which is the assertion CI makes. pnpm lint passes and pnpm coverage is 84 tests, 100% statements/branches/functions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
43 lines
2.0 KiB
TypeScript
43 lines
2.0 KiB
TypeScript
/**
|
|
* Distribution-aware slider maths.
|
|
*
|
|
* A linear min..max track is useless on skewed data, which is the normal case
|
|
* in both consumers: dufs-cloud's file sizes span bytes to gigabytes, and
|
|
* awesome-mcp-explorer's star counts run 0..166,785 with a median of 8, so a
|
|
* linear midpoint sits above 99.9% of all rows. Mapping the track through the
|
|
* actual distribution puts the middle of the track at the median, which makes
|
|
* equal track distance mean roughly equal numbers of items.
|
|
*
|
|
* This was duplicated in dufs-cloud and awesome-mcp-explorer before it moved
|
|
* here; both now import it.
|
|
*/
|
|
/**
|
|
* Bounds-checked array access (callers guarantee the index is valid). Keeps the
|
|
* quantile helpers free of scattered non-null assertions or dead undefined
|
|
* guards while still satisfying `noUncheckedIndexedAccess`.
|
|
*/
|
|
export declare function nth(values: readonly number[], index: number): number;
|
|
/** Clamp to the unit interval. */
|
|
export declare function clamp01(x: number): number;
|
|
/**
|
|
* The value at quantile `f` (0..1) of an ascending, non-empty array, with linear
|
|
* interpolation between the two straddling samples. This is what makes the
|
|
* sliders distribution-aware: f = 0.5 returns the *median*, so the middle of the
|
|
* track sits where half the items are — not the arithmetic midpoint of the
|
|
* range. Empty input yields 0 (callers hide the slider in that case).
|
|
*/
|
|
export declare function quantileValue(sorted: readonly number[], f: number): number;
|
|
/**
|
|
* The quantile (0..1) of `value` within `sorted` — the inverse of
|
|
* {@link quantileValue}, used to place a thumb at the right spot on the track.
|
|
* Values at or beyond the ends map to 0/1.
|
|
*/
|
|
export declare function valueQuantile(sorted: readonly number[], value: number): number;
|
|
/**
|
|
* Pointer x to a 0..1 fraction of a track.
|
|
*
|
|
* Extracted as pure geometry so slider behaviour is testable without layout,
|
|
* which jsdom does not implement.
|
|
*/
|
|
export declare function fractionFromPointer(rect: DOMRect, clientX: number): number;
|
|
//# sourceMappingURL=quantile.d.ts.map
|