mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
reorganize some code
This commit is contained in:
1 parent
7011d4d20f
commit
b298874f0d
24 files changed
+5
-5
No files matched your search
@@ -0,0 +1,3 @@
|
||||
export function classNames(...classes: (string | undefined)[]) {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import type * as colors from "@radix-ui/colors";
|
||||
|
||||
const ignoreEndings = ["A", "P3", "Dark", "DarkA", "DarkP3"] as const;
|
||||
|
||||
export type Color = Exclude<
|
||||
keyof typeof colors,
|
||||
`${string}${(typeof ignoreEndings)[number]}` | "__esModule"
|
||||
>;
|
||||
|
||||
export type ColorWithBW = Color | "black" | "white";
|
||||
@@ -0,0 +1,48 @@
|
||||
// Source - https://stackoverflow.com/a/9083076
|
||||
// Posted by Rene Pot, modified by community. See post 'Timeline' for change history
|
||||
// Retrieved 2026-05-11, License - CC BY-SA 4.0
|
||||
|
||||
const keys = [
|
||||
"",
|
||||
"C",
|
||||
"CC",
|
||||
"CCC",
|
||||
"CD",
|
||||
"D",
|
||||
"DC",
|
||||
"DCC",
|
||||
"DCCC",
|
||||
"CM",
|
||||
"",
|
||||
"X",
|
||||
"XX",
|
||||
"XXX",
|
||||
"XL",
|
||||
"L",
|
||||
"LX",
|
||||
"LXX",
|
||||
"LXXX",
|
||||
"XC",
|
||||
"",
|
||||
"I",
|
||||
"II",
|
||||
"III",
|
||||
"IV",
|
||||
"V",
|
||||
"VI",
|
||||
"VII",
|
||||
"VIII",
|
||||
"IX",
|
||||
];
|
||||
|
||||
export function romanize(number: number) {
|
||||
let digits = String(+number).split("");
|
||||
let roman = "";
|
||||
let i = 3;
|
||||
|
||||
while (i--) {
|
||||
roman = (keys[+digits.pop()! + i * 10] || "") + roman;
|
||||
}
|
||||
|
||||
return Array(+digits.join("") + 1).join("M") + roman;
|
||||
}
|
||||
Reference in new issue
Block a user