1 parent
195ee3b90a
commit
4449fbd0a1
37 files changed
+1656
-356
No files matched your search
@@ -261,14 +261,236 @@ export const WEEK_PARITY_VALUES: readonly ('ALL' | 'ODD' | 'EVEN')[] = ['ALL', '
|
||||
/** 一个学期按多少周为一个单双周循环(ClassIsland WeekCountDivTotal 的默认值) */
|
||||
export const WEEK_PARITY_CYCLE = 2;
|
||||
|
||||
/**
|
||||
* ClassIsland 岛层设计 token 的 TypeScript 单一来源。
|
||||
*
|
||||
* CSS 变量在 `packages/ui/src/tokens.css` 中按 `--ci-*` 一一映射;窗口几何、
|
||||
* 主进程安全区与设置页范围直接复用本对象,避免 TypeScript 与 CSS 各写一套。
|
||||
* 应用外壳仍使用 `--ch-*` / `--ch-ui-*`,本对象只服务于岛与课程信息层。
|
||||
*/
|
||||
export const CLASSISLAND_TOKENS = {
|
||||
colors: {
|
||||
light: {
|
||||
primaryColor: '#00BFFF',
|
||||
secondaryColor: '#7FFFD4',
|
||||
accentFallback: '#1E90FF',
|
||||
accentPaletteFallback: '#1E90FF',
|
||||
/** ClassIsland 原值 #E4000000(AARRGGBB),CSS 写作 RRGGBBAA。 */
|
||||
text1: '#000000E4',
|
||||
/** ClassIsland 浅色主题对 InformativeSecondary 的覆盖值。 */
|
||||
text2: '#000000C0',
|
||||
text3: '#00000072',
|
||||
text4: '#0000005C',
|
||||
text5: '#0000002E',
|
||||
textOnAccent: '#FFFFFFFF',
|
||||
bgBase: '#F3F3F3',
|
||||
bgSecondary: '#EEEEEE',
|
||||
bgTertiary: '#F9F9F9',
|
||||
fillSecondary: '#0000000A',
|
||||
smoke: '#00000066',
|
||||
islandBgCustom: '#000000',
|
||||
strokeIsland: '#00000014',
|
||||
strokeControl: '#00000024',
|
||||
strokeDivider: '#00000014',
|
||||
strokeFlyout: '#0000001B',
|
||||
fillStrong: '#00000072',
|
||||
strokeCard: '#00000016',
|
||||
strokeDrag: '#1E90FF',
|
||||
strokeTutorial: '#1E90FF',
|
||||
aqi1: '#228B22',
|
||||
aqi2: '#CCCC00',
|
||||
aqi3: '#FF8C00',
|
||||
aqi4: '#CD5C5C',
|
||||
aqi5: '#8B0000',
|
||||
aqi6: '#800080',
|
||||
weatherRain: '#0000FF',
|
||||
glowClass: '#FFFF00',
|
||||
danger: '#CD5C5C',
|
||||
warningCritical: '#C42B1C',
|
||||
warningCaution: '#9D5D00',
|
||||
warningCautionBackground: '#FFF4CE',
|
||||
},
|
||||
dark: {
|
||||
primaryColor: '#00BFFF',
|
||||
secondaryColor: '#7FFFD4',
|
||||
accentFallback: '#1E90FF',
|
||||
accentPaletteFallback: '#1E90FF',
|
||||
text1: '#FFFFFFFF',
|
||||
/** ClassIsland 深色主题对 InformativeSecondary 的覆盖值。 */
|
||||
text2: '#FFFFFFDA',
|
||||
text3: '#FFFFFFC5',
|
||||
text4: '#FFFFFF87',
|
||||
text5: '#FFFFFF5D',
|
||||
textOnAccent: '#FFFFFFFF',
|
||||
bgBase: '#202020',
|
||||
bgSecondary: '#1C1C1C',
|
||||
bgTertiary: '#282828',
|
||||
fillSecondary: '#FFFFFF14',
|
||||
smoke: '#00000066',
|
||||
islandBgCustom: '#000000',
|
||||
strokeIsland: '#FFFFFF26',
|
||||
strokeControl: '#FFFFFF3D',
|
||||
strokeDivider: '#FFFFFF26',
|
||||
strokeFlyout: '#FFFFFF33',
|
||||
fillStrong: '#FFFFFF8A',
|
||||
strokeCard: '#FFFFFF26',
|
||||
strokeDrag: '#00BFFF',
|
||||
strokeTutorial: '#00BFFF',
|
||||
aqi1: '#3CB371',
|
||||
aqi2: '#FFFF00',
|
||||
aqi3: '#FFA500',
|
||||
aqi4: '#CD5C5C',
|
||||
aqi5: '#8B0000',
|
||||
aqi6: '#9370DB',
|
||||
weatherRain: '#00BFFF',
|
||||
glowClass: '#FFFF00',
|
||||
danger: '#CD5C5C',
|
||||
warningCritical: '#FF99A4',
|
||||
warningCaution: '#FCE100',
|
||||
warningCautionBackground: '#433519',
|
||||
},
|
||||
},
|
||||
fonts: {
|
||||
app: "'HarmonyOS Sans SC', 'Microsoft YaHei UI', 'Noto Sans CJK SC', 'Noto Sans SC', 'PingFang SC', 'Source Han Sans SC', SimHei, 'WenQuanYi Micro Hei', sans-serif",
|
||||
island:
|
||||
"'HarmonyOS Sans SC', 'Microsoft YaHei UI', 'Noto Sans CJK SC', 'Noto Sans SC', 'PingFang SC', 'Source Han Sans SC', SimHei, 'WenQuanYi Micro Hei', sans-serif",
|
||||
harmonyOsSans: "'HarmonyOS Sans SC', 'Microsoft YaHei UI', SimHei",
|
||||
backend: "'Microsoft YaHei UI'",
|
||||
iconFluent: "'FluentSystemIcons-Resizable'",
|
||||
iconLucide: "'lucide'",
|
||||
iconSf: "'SF-Symbols'",
|
||||
},
|
||||
fontWeights: {
|
||||
thin: 100,
|
||||
extraLight: 200,
|
||||
light: 300,
|
||||
normal: 400,
|
||||
medium: 500,
|
||||
semiBold: 600,
|
||||
bold: 700,
|
||||
extraBold: 800,
|
||||
black: 900,
|
||||
},
|
||||
fontSizes: {
|
||||
secondary: 14,
|
||||
body: 16,
|
||||
emphasized: 18,
|
||||
large: 20,
|
||||
version: 9,
|
||||
caption: 12,
|
||||
controlBase: 13,
|
||||
label: 14,
|
||||
title: 16,
|
||||
rolling: 17,
|
||||
oobeBody: 18,
|
||||
brand: 20,
|
||||
weather: 22,
|
||||
oobeTitle: 32,
|
||||
inputMin: 1,
|
||||
inputMax: 40,
|
||||
inputStep: 0.5,
|
||||
},
|
||||
radii: {
|
||||
island: 8,
|
||||
islandLocal: 0,
|
||||
islandMax: 20,
|
||||
islandStep: 0.5,
|
||||
popup: 6,
|
||||
card: 4,
|
||||
control: 4,
|
||||
drawer: '8px 8px 0 0',
|
||||
pill: 999,
|
||||
iconButton: 14,
|
||||
oobeButton: 24,
|
||||
},
|
||||
spacing: {
|
||||
islandHeight: 40,
|
||||
islandPadX: 12,
|
||||
islandMinWidth: 20,
|
||||
componentGap: 12,
|
||||
lineGap: 5,
|
||||
settingsMaxWidth: 960,
|
||||
popupPad: 12,
|
||||
progressHeight: 3,
|
||||
editbarBottom: 64,
|
||||
splashWidth: 400,
|
||||
splashHeight: 100,
|
||||
},
|
||||
shadows: {
|
||||
island: '0 4px 8px 2px #00000048',
|
||||
mask: '0 8px 32px 0 #00000066',
|
||||
drawer: '0 8px 32px 0 #00000066',
|
||||
drawerX: '0 0 8px #00000033',
|
||||
classicMask: '0 0 8px #000000',
|
||||
adorn: '0 0 8px #00000066',
|
||||
},
|
||||
opacity: {
|
||||
islandBackground: 0.5,
|
||||
line: 1,
|
||||
pointerFaded: 0.05,
|
||||
maskFrom: 0,
|
||||
maskTo: 1,
|
||||
},
|
||||
layers: {
|
||||
windowBottom: 0,
|
||||
windowTop: 1,
|
||||
content: 0,
|
||||
mask: 1,
|
||||
drag: 1,
|
||||
drawer: 10,
|
||||
timelineAdorn: 9999,
|
||||
guide: 10000,
|
||||
/** 原值 33550336;Web 层用浏览器最大安全整数哨兵表达同一语义。 */
|
||||
sentinel: 2147483647,
|
||||
},
|
||||
dpi: {
|
||||
/** ClassIsland 的所有视觉值都以 96 DPI 的 CSS px 为基准。 */
|
||||
basis: 96,
|
||||
scale: 1,
|
||||
scaleMin: 0.75,
|
||||
scaleMax: 2.5,
|
||||
scaleStep: 0.05,
|
||||
verticalSafeArea: 20,
|
||||
tutorialSafeArea: 150,
|
||||
effectScale: 1,
|
||||
},
|
||||
misc: {
|
||||
rippleStroke: 200,
|
||||
maskFade: 'linear-gradient(to bottom, #FFFFFF00, #FFFFFF00 65%, #FFFFFFFF)',
|
||||
scrimTutorial: '#00000099',
|
||||
debugBackground: '#22222277',
|
||||
splashBackground: '#11111188',
|
||||
brandGradientA: '#0C0E1F',
|
||||
brandGradientB: '#0D1111',
|
||||
brandDark: '#0D1111',
|
||||
},
|
||||
} as const;
|
||||
|
||||
/** ClassIsland `IntToFontWeightConverter` 的逐值映射;其他值回落 Normal。 */
|
||||
export function classislandFontWeight(value: unknown): number {
|
||||
if (
|
||||
typeof value === 'number' &&
|
||||
value >= CLASSISLAND_TOKENS.fontWeights.thin &&
|
||||
value <= CLASSISLAND_TOKENS.fontWeights.black &&
|
||||
value % 100 === 0
|
||||
) {
|
||||
return value;
|
||||
}
|
||||
return CLASSISLAND_TOKENS.fontWeights.normal;
|
||||
}
|
||||
|
||||
/** 灵动岛默认外观(设置页个性化项的初始值,也是区间校验的单一来源) */
|
||||
export const DEFAULT_ISLAND_APPEARANCE = {
|
||||
height: 44,
|
||||
width: 268,
|
||||
radius: 20,
|
||||
opacity: 1,
|
||||
/** 默认强调色采用 Apple 系统蓝(与 WinIsland 的系统色体系一致) */
|
||||
accent: '#0a84ff',
|
||||
/** 默认强调色与 ClassIsland 的 PrimaryColor 对齐。 */
|
||||
accent: CLASSISLAND_TOKENS.colors.light.primaryColor,
|
||||
/** 0=自定义,1=壁纸主题色,2=跟随系统,3=屏幕主题色;未知值回落兜底色。 */
|
||||
accentSource: 0,
|
||||
accentPalette: [CLASSISLAND_TOKENS.colors.light.primaryColor] as string[],
|
||||
accentPaletteIndex: 0,
|
||||
fontSize: 13,
|
||||
animations: true,
|
||||
speed: 1,
|
||||
@@ -320,6 +542,14 @@ export const ISLAND_POSITION_LABELS: Record<(typeof ISLAND_POSITIONS)[number], s
|
||||
'bottom-right': '右下角',
|
||||
};
|
||||
|
||||
/** ClassIsland `ColorSource` 的显示顺序与中文说明。 */
|
||||
export const ISLAND_ACCENT_SOURCES = [
|
||||
{ value: 0, label: '自定义颜色' },
|
||||
{ value: 1, label: '壁纸主题色' },
|
||||
{ value: 2, label: '跟随系统' },
|
||||
{ value: 3, label: '屏幕主题色' },
|
||||
] as const;
|
||||
|
||||
/** 视觉风格可选值(参考 WinIsland 的 island_style) */
|
||||
export const ISLAND_STYLES = ['black', 'glass', 'tinted'] as const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user