探索/组织/用户仓库样式 github 布局 (#8)

Co-authored-by: lutinglt <lutinglt@users.noreply.github.com>
This commit is contained in:
鲁汀
2025-08-06 15:05:43 +08:00
committed by GitHub
parent 93e5fa8a7d
commit 8dcd7cf002
10 changed files with 142 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
type Primitive = string | boolean | number | null | undefined;
type Tokens = { [key: string]: string | Tokens };
export type CSSVarFunction = `var(--${string})`;
export type WithOptionalLayer<T extends Tokens> = T & { "@layer"?: string };
export type MapLeafNodes<Obj, LeafType> = {
[Prop in keyof Obj]: Obj[Prop] extends Primitive
? LeafType

View File

@@ -1 +1,2 @@
export { scaleColorLight } from "./scss";
export { fallbackVar } from "./var";

7
src/functions/var.ts Normal file
View File

@@ -0,0 +1,7 @@
import type { CSSVarFunction } from "src/core/types";
type CSSFallbackVar = `var(--${string}, ${string})`;
export function fallbackVar(cssvar: CSSVarFunction, fallback: string): CSSFallbackVar {
const var_name = cssvar.replace("var(--", "").replace(")", "");
return `var(--${var_name}, ${fallback})`;
}

View File

@@ -38,6 +38,15 @@ const otherVars = {
const customVars = {
custom: {
cloneMenuWidth: "custom-clone-menu-width",
explore: {
repolistColumns: "custom-explore-repolist-columns",
userlistColumns: "custom-explore-userlist-columns",
},
userRepolistColumns: "custom-user-repolist-columns",
org: {
repolistColumns: "custom-org-repolist-columns",
userlistColumns: "custom-org-userlist-columns",
},
},
};