Move clamp function to lib directory (#250)

* clamp refactoring

* pr template
This commit is contained in:
tmshv authored and GitHub committed 2026-02-08 12:34:25 +07:00
1 parent 562b4f6408
commit f4c5132d7c
4 files changed
+45 -10

No files matched your search

+1 -10
View File
@@ -1,4 +1,5 @@
import { proxy, subscribe } from "valtio"
import { clamp } from "@/lib/math"
export type ThemeName = "default" | "contrast"
export type ColorSchemeVariant = "black-on-white" | "white-on-black" | "blue-on-blue" | "brown-on-yellow" | "green-on-brown"
@@ -8,16 +9,6 @@ const MIN_FONT_SIZE = 8
const MAX_FONT_SIZE = 48
const CHANGE_FONT_SIZE_DELTA = 1
function clamp(val: number, min: number, max: number): number {
if (val < min) {
return min
}
if (val > max) {
return max
}
return val
}
export type ThemeOptions = {
theme: ThemeName
fontType: FontTypeVariant