refactor: extract magic constants — wave 5 (single-site thresholds)
Long-tail cleanup: threshold and default-value literals in shared helpers get named module-level constants. - CharacterComparisonEngine: CHAR_PROXIMITY_RANGE_PCT (5), DEFAULT_RENDER_SIZE_PX (16) — kept local instead of importing DEFAULT_FONT_SIZE from \$entities/Font because \$shared/lib cannot legally upward-import from \$entities per FSD (also avoids an init cycle through the mocks barrel). - typographySettingsStore: BASE_SIZE_EPSILON (0.01) — rounding-jitter guard for baseSize reconciliation. - createDebouncedState: DEFAULT_DEBOUNCE_MS (300) — exported so callers can mirror the default. - createVirtualizer: MEASUREMENT_EPSILON_PX (0.5) — minimum height delta before committing a re-measured row. - createPerspectiveManager: PERSPECTIVE_TOGGLE_THRESHOLD (0.5) — the halfway point on the 0-1 spring that flips isBack/isFront. Skipped #19 (PerspectivePlan defaults) per review — marginal gain.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import { debounce } from '$shared/lib/utils';
|
||||
|
||||
/**
|
||||
* Default debounce delay used when no wait is provided. Picked to feel
|
||||
* snappy for typing while still coalescing API-bound side effects.
|
||||
*/
|
||||
export const DEFAULT_DEBOUNCE_MS = 300;
|
||||
|
||||
/**
|
||||
* Creates reactive state with immediate and debounced values.
|
||||
*
|
||||
@@ -23,7 +29,7 @@ import { debounce } from '$shared/lib/utils';
|
||||
* <p>Searching: {search.debounced}</p>
|
||||
* ```
|
||||
*/
|
||||
export function createDebouncedState<T>(initialValue: T, wait: number = 300) {
|
||||
export function createDebouncedState<T>(initialValue: T, wait: number = DEFAULT_DEBOUNCE_MS) {
|
||||
let immediate = $state(initialValue);
|
||||
let debounced = $state(initialValue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user