feat(tui): add managed config interface

This commit is contained in:
Dax Raad 2026-07-12 16:54:08 -04:00
commit 3568dd1b99
52 changed files with 848 additions and 266 deletions

View file

@ -1,8 +1,10 @@
import { MacOSScrollAccel, type ScrollAcceleration } from "@opentui/core"
export type ScrollConfig = {
scroll_acceleration?: { enabled?: boolean }
scroll_speed?: number
scroll?: {
acceleration?: boolean
speed?: number
}
}
export class CustomSpeedScroll implements ScrollAcceleration {
@ -16,11 +18,11 @@ export class CustomSpeedScroll implements ScrollAcceleration {
}
export function getScrollAcceleration(tuiConfig?: ScrollConfig): ScrollAcceleration {
if (tuiConfig?.scroll_acceleration?.enabled) {
if (tuiConfig?.scroll?.acceleration) {
return new MacOSScrollAccel()
}
if (tuiConfig?.scroll_speed !== undefined) {
return new CustomSpeedScroll(tuiConfig.scroll_speed)
if (tuiConfig?.scroll?.speed !== undefined) {
return new CustomSpeedScroll(tuiConfig.scroll.speed)
}
return new CustomSpeedScroll(3)