No files matched your search
@@ -50,7 +50,8 @@ description: 经典提醒、自定义常驻方案、课程与课件传输。
|
||||
## 外观、位置与输入
|
||||
|
||||
经典模式可调宽高、字号、主题色、黑色/半透明/渐变、停靠与边距;自定义内容根据实际测量适配工作区。
|
||||
自定义方案可配置缩放、圆角、颜色和行间距,默认值与范围在 shared/island-layout.ts。外观页的圆角滑块同步修改当前自定义方案的常态圆角,与编辑器设置一致。
|
||||
自定义方案可配置缩放、四档字号、字重、圆角、背景/前景色和行间距,默认值与范围在 shared/island-layout.ts。四档字号输入范围是 1–40px,可按组件或单行覆盖;关闭行级覆盖后只回落该行,不影响其他行。
|
||||
强调色支持自定义、壁纸调色板、跟随系统和屏幕调色板四种来源;自定义背景与前景可分别关闭,关闭后回落当前亮/暗主题。前景色会派生 100% / 85.5% / 77.3% / 52.9% / 36.5% 五级文字 alpha。外观页的圆角滑块同步修改当前自定义方案的常态圆角,与编辑器设置一致。
|
||||
左右边距只在左/右停靠时生效,居中锚点仍在屏幕中线。
|
||||
触摸屏自动进入触摸模式,保留触摸命中和失焦宽限;鼠标模式按光标控制输入穿透。
|
||||
自定义常驻内容支持鼠标避让淡化及反转,交互入口、展开/编辑和触摸操作按实现暂停避让。
|
||||
|
||||
@@ -10,15 +10,17 @@ description: 本地经典/自定义岛的几何、外观与动画入口。
|
||||
|
||||
## 经典几何与外观
|
||||
|
||||
| 来源 | 内容 |
|
||||
| ---------------------------------------------------- | ----------------------------------------------------- |
|
||||
| shared/src/constants.ts 的 DEFAULT_ISLAND_APPEARANCE | 默认宽 268、高 44、圆角 20、字号 13、边距 8,顶部居中 |
|
||||
| ISLAND_APPEARANCE_RANGES | 滑块与主进程归一化共用的范围 |
|
||||
| ISLAND_SIZE_DELTA | 展开、紧急与叫人相对尺寸 |
|
||||
| ISLAND_SHADOW_PAD | 窗口边界的透明留白 |
|
||||
| ISLAND_LIST_METRICS / islandListLayout | 主进程和渲染层共用列表度量,控制行数与工作区高度 |
|
||||
| desktop-client/src/island/squircle.ts | 超椭圆路径 |
|
||||
| desktop-client/src/island/classic-island.css | 经典底色、文字、图形与状态样式 |
|
||||
| 来源 | 内容 |
|
||||
| ---------------------------------------------------- | --------------------------------------------------------------------- |
|
||||
| shared/src/constants.ts 的 DEFAULT_ISLAND_APPEARANCE | 默认宽 268、高 44、圆角 20、字号 13、边距 8,顶部居中 |
|
||||
| shared/src/constants.ts 的 CLASSISLAND_TOKENS | 岛层颜色、字体、字号、圆角、间距、阴影、层级与 DPI 的 TypeScript 来源 |
|
||||
| ISLAND_APPEARANCE_RANGES | 滑块与主进程归一化共用的范围 |
|
||||
| ISLAND_SIZE_DELTA | 展开、紧急与叫人相对尺寸 |
|
||||
| ISLAND_SHADOW_PAD | 窗口边界的透明留白 |
|
||||
| ISLAND_LIST_METRICS / islandListLayout | 主进程和渲染层共用列表度量,控制行数与工作区高度 |
|
||||
| desktop-client/src/island/squircle.ts | 超椭圆路径 |
|
||||
| desktop-client/src/island/classic-island.css | 经典底色、文字、图形与状态样式 |
|
||||
| ui/src/tokens.css | `--ci-*` 亮/暗两套 CSS 变量,以及五级文字工具类 |
|
||||
|
||||
classic 的 black/glass/tinted 是本地 CSS 外观;glass 使用半透明色,不采样桌面模糊。
|
||||
不要对透明岛调用 setBackgroundMaterial:系统材质作用于整窗矩形,可能破坏逐像素透明。
|
||||
@@ -41,6 +43,47 @@ CLASSISLAND_ISLAND_METRICS 位于 shared/src/island-layout.ts:
|
||||
方案有常态 rows 和无通知展开 expandedRows,运行时由 CustomIslandRuntime.vue 测量自然内容,
|
||||
再按屏幕工作区与方案缩放适配。字体与外观覆盖按组件契约生效,不能拿经典固定宽高解释自定义内容尺寸。
|
||||
|
||||
自定义岛默认使用 CSS `border-radius`;经典岛继续保留连续圆角。圆角同时作用于自绘背景与内容裁切,
|
||||
默认 8px、范围 0–20px、步进 0.5px。背景色只通过 `--resident-background` 派生,背景 alpha 与整行
|
||||
`opacity` 分开计算,避免整行不透明度连带淡化投影和覆盖层。
|
||||
|
||||
### ClassIsland token 层
|
||||
|
||||
`CLASSISLAND_TOKENS` 与 `--ci-*` 一一对应,应用外壳继续使用 `--ch-*` / `--ch-ui-*`。
|
||||
ClassIsland 源值中的颜色采用 Avalonia `AARRGGBB`,写入 CSS 时统一转换为
|
||||
`RRGGBBAA`,alpha 数值不变。
|
||||
|
||||
| 类别 | 关键值 |
|
||||
| -------- | ------------------------------------------------------------------------ |
|
||||
| 强调色 | PrimaryColor / DeepSkyBlue、SecondaryColor / Aquamarine、DodgerBlue 兜底 |
|
||||
| 五级前景 | 100% / 85.5% / 77.3% / 52.9% / 36.5%,开启自定义前景时写进颜色 alpha |
|
||||
| 四档字号 | 14 / 16 / 18 / 20px,设置范围 1–40px,步进 0.5px |
|
||||
| 字重 | 100–900 逐值映射,默认 500;其他值回落 400 |
|
||||
| 圆角 | 岛 8、弹窗 6、卡片与控件 4、抽屉 8 8 0 0、胶囊 999px |
|
||||
| 间距 | 行高 40、左右 12、组件间距 12、行距 5、进度条 3px |
|
||||
| 层级 | 遮罩/拖拽 1、抽屉 10、时间轴装饰 9999、哨兵 2147483647 |
|
||||
| DPI | 96 DPI 基准、缩放 0.75–2.5、Fluent 竖直安全区 20px |
|
||||
|
||||
四档字号可写在组件自身、单个行或方案根元素。行级与组件级都通过 CSS 变量覆盖;关闭覆盖时删除
|
||||
对应内联变量并回落到方案或 `:root`。自定义前景关闭时同样删除行内五级变量,由 `html.dark` 切换
|
||||
主题默认值。
|
||||
|
||||
强调色来源严格区分自定义、壁纸调色板、跟随系统与屏幕调色板;主进程输出 `resolvedAccent`,设置页
|
||||
仍保留用户选择的 `accent`,避免切换来源时覆盖原自定义色。主题切换通过岛桥接的 `island:theme`
|
||||
事件实时同步 `html.dark`,不依赖主窗口的 DOM。
|
||||
|
||||
### 主界面对照
|
||||
|
||||
| ClassIsland 概念 | ClassHelper 实体 |
|
||||
| ----------------------- | ------------------------------------------------------------------ |
|
||||
| MainWindow | 独立 `island.html` + 主进程透明 `BrowserWindow` |
|
||||
| MainWindowLine | `CustomIslandRuntime.vue` 的 `.layout-row` 与行级 CSS 变量 |
|
||||
| ComponentPresenter | `ComponentNode.vue` 根节点的宽高、透明度、隐藏与裁剪 |
|
||||
| 日期/时钟/天气/课程组件 | `ComponentNode.vue`、`WeatherBrief.vue` 等共享组件 |
|
||||
| Fluent/Classic 主题 | `custom-runtime.css` / `custom-island.css` / `classic-island.css` |
|
||||
| 编辑模式视图 | 主窗口 `IslandEditorView.vue`、`IslandEditorNode.vue` 与右侧检查器 |
|
||||
| 提醒宿主 | `ClassicNotifications.vue`,嵌入自定义岛或经典岛 |
|
||||
|
||||
## 动画与命中
|
||||
|
||||
经典与自定义岛的形变都使用 src/island/spring.ts 的 SpringValue;默认 stiffness=0.10、damping=0.68,
|
||||
@@ -56,4 +99,5 @@ CLASSISLAND_ISLAND_METRICS 位于 shared/src/island-layout.ts:
|
||||
|
||||
外观范围改 shared,经典样式改 classic-island.css,自定义样式改 custom-runtime.css 和 custom-island.css,
|
||||
原生窗口与命中改 main/island.ts。组件结构/设置改 shared/island-layout.ts 并同步编辑器和运行时。
|
||||
改 token 后运行 `pnpm check:design-tokens`,它会校验亮/暗键集合、必备 token、kebab-case 与岛内裸颜色。
|
||||
展示行为见[灵动岛](../app/island.md),测试见[验收与测试](testing.md)。
|
||||
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 84 KiB |
@@ -16,8 +16,9 @@
|
||||
"build": "pnpm build:shared && pnpm --filter @classhelper/server build && pnpm --filter @classhelper/web-admin build && pnpm --filter @classhelper/desktop-client build",
|
||||
"build:desktop": "pnpm build:shared && pnpm --filter @classhelper/desktop-client build",
|
||||
"check:icons": "node scripts/check-icons.mjs",
|
||||
"check:design-tokens": "node scripts/check-design-tokens.mjs",
|
||||
"typecheck": "pnpm build:shared && pnpm -r --workspace-concurrency=1 --no-bail typecheck",
|
||||
"lint": "node scripts/check-authz.mjs && eslint .",
|
||||
"lint": "node scripts/check-authz.mjs && node scripts/check-design-tokens.mjs && eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"format": "prettier --write \"**/*.{ts,js,mjs,cjs,vue,json,md,yaml,yml,css,scss,html}\"",
|
||||
"format:check": "prettier --check \"**/*.{ts,js,mjs,cjs,vue,json,md,yaml,yml,css,scss,html}\"",
|
||||
|
||||
@@ -180,11 +180,18 @@ const style = computed<CSSProperties>(() => {
|
||||
const n = props.node,
|
||||
a = n.appearance,
|
||||
override = a.resourceOverridingEnabled;
|
||||
const color =
|
||||
a.background +
|
||||
Math.round((a.customBackgroundOpacityEnabled ? a.backgroundOpacity : 1) * 255)
|
||||
.toString(16)
|
||||
.padStart(2, '0');
|
||||
const alpha = a.customBackgroundOpacityEnabled ? a.backgroundOpacity : 1;
|
||||
const color = `color-mix(in srgb, ${a.background} ${alpha * 100}%, transparent)`;
|
||||
const customText: Record<string, string> =
|
||||
override && a.customForegroundEnabled
|
||||
? {
|
||||
'--ci-text-1': a.foreground,
|
||||
'--ci-text-2': `color-mix(in srgb, ${a.foreground} 85.5%, transparent)`,
|
||||
'--ci-text-3': `color-mix(in srgb, ${a.foreground} 77.3%, transparent)`,
|
||||
'--ci-text-4': `color-mix(in srgb, ${a.foreground} 52.9%, transparent)`,
|
||||
'--ci-text-5': `color-mix(in srgb, ${a.foreground} 36.5%, transparent)`,
|
||||
}
|
||||
: {};
|
||||
return {
|
||||
opacity: a.opacity,
|
||||
width: n.advanced.width ? `${n.advanced.width}px` : undefined,
|
||||
@@ -195,17 +202,19 @@ const style = computed<CSSProperties>(() => {
|
||||
n.advanced.align
|
||||
],
|
||||
textAlign: n.advanced.align === 'start' ? 'start' : n.advanced.align === 'end' ? 'end' : 'center',
|
||||
color: override && a.customForegroundEnabled ? a.foreground : undefined,
|
||||
color: 'var(--ci-text-1)',
|
||||
background: override && a.customBackgroundEnabled ? color : undefined,
|
||||
borderRadius: override && a.customCornerRadiusEnabled ? `${a.cornerRadius}px` : undefined,
|
||||
fontSize: override ? `${a.bodyFontSize}px` : undefined,
|
||||
'--secondary': override ? `${a.secondaryFontSize}px` : undefined,
|
||||
'--emphasized': override ? `${a.emphasizedFontSize}px` : undefined,
|
||||
'--large': override ? `${a.largeFontSize}px` : undefined,
|
||||
'--ci-fs-secondary': override ? `${a.secondaryFontSize}px` : undefined,
|
||||
'--ci-fs-body': override ? `${a.bodyFontSize}px` : undefined,
|
||||
'--ci-fs-emphasized': override ? `${a.emphasizedFontSize}px` : undefined,
|
||||
'--ci-fs-large': override ? `${a.largeFontSize}px` : undefined,
|
||||
'--rolling-duration': `${Math.max(1, 200 / n.settings.speed)}s`,
|
||||
flexDirection: container.value ? (n.settings.direction === 'vertical' ? 'column' : 'row') : undefined,
|
||||
gap: container.value ? `${n.settings.gap}px` : undefined,
|
||||
display: container.value ? 'flex' : undefined,
|
||||
...customText,
|
||||
};
|
||||
});
|
||||
</script>
|
||||
@@ -298,9 +307,10 @@ const style = computed<CSSProperties>(() => {
|
||||
padding: 6px;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
.component-node:not(.node-editing) {
|
||||
line-height: 1.4;
|
||||
line-height: var(--ci-line-height-body);
|
||||
}
|
||||
.clock {
|
||||
font-variant-numeric: tabular-nums;
|
||||
@@ -316,7 +326,7 @@ const style = computed<CSSProperties>(() => {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
gap: calc(var(--ci-component-gap) / 2);
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
.lesson-line strong {
|
||||
@@ -326,10 +336,10 @@ const style = computed<CSSProperties>(() => {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.lesson-line.current strong {
|
||||
color: #fff;
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
.lesson-line.break {
|
||||
opacity: 0.86;
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
.time-divider {
|
||||
display: block;
|
||||
@@ -344,19 +354,21 @@ const style = computed<CSSProperties>(() => {
|
||||
flex-shrink: 0;
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
color: var(--ci-text-3);
|
||||
font-size: var(--ci-fs-secondary);
|
||||
}
|
||||
.lesson-progress {
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
height: 2px;
|
||||
background: #ffffff24;
|
||||
height: var(--ci-progress-height);
|
||||
background: var(--ci-fill-strong);
|
||||
overflow: hidden;
|
||||
border-radius: 1px;
|
||||
border-radius: calc(var(--ci-progress-height) / 3);
|
||||
}
|
||||
.lesson-progress i {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: var(--island-accent, #60a5fa);
|
||||
background: var(--island-accent, var(--ci-accent));
|
||||
transform-origin: left;
|
||||
transition: transform 1s linear;
|
||||
}
|
||||
@@ -391,28 +403,26 @@ const style = computed<CSSProperties>(() => {
|
||||
animation: none;
|
||||
}
|
||||
.selected {
|
||||
outline: 2px solid #85aaff;
|
||||
border-radius: 8px;
|
||||
background: #759cff14;
|
||||
outline: 2px solid var(--ci-stroke-drag);
|
||||
border-radius: var(--ci-radius-island);
|
||||
background: var(--ci-accent-fill-tertiary);
|
||||
}
|
||||
.node-handle {
|
||||
touch-action: none;
|
||||
cursor: grab;
|
||||
display: block;
|
||||
font:
|
||||
10px 'Microsoft YaHei',
|
||||
sans-serif;
|
||||
font: var(--ci-fw-normal) var(--ci-fs-version) / 1.2 var(--ci-font);
|
||||
padding: 3px 6px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--ci-radius-control);
|
||||
min-height: 24px;
|
||||
margin-bottom: 4px;
|
||||
color: #ffffff80;
|
||||
background: #ffffff0d;
|
||||
color: var(--ci-text-3);
|
||||
background: var(--ci-fill-secondary);
|
||||
}
|
||||
.node-handle:hover {
|
||||
background: #ffffff20;
|
||||
color: #fff;
|
||||
background: var(--ci-accent-soft);
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
.notification,
|
||||
.homework,
|
||||
@@ -429,19 +439,19 @@ const style = computed<CSSProperties>(() => {
|
||||
cursor: pointer;
|
||||
}
|
||||
.node-editing:hover {
|
||||
box-shadow: inset 0 0 0 1px #ffffff28;
|
||||
border-radius: 8px;
|
||||
box-shadow: inset 0 0 0 var(--ci-stroke-island-w) var(--ci-stroke-control);
|
||||
border-radius: var(--ci-radius-island);
|
||||
}
|
||||
small {
|
||||
font-size: var(--secondary, 12px);
|
||||
opacity: 0.7;
|
||||
color: var(--ci-text-3);
|
||||
font-size: var(--ci-fs-secondary);
|
||||
}
|
||||
strong,
|
||||
.emphasized {
|
||||
font-size: var(--emphasized, 20px);
|
||||
font-size: var(--ci-fs-emphasized);
|
||||
}
|
||||
.large {
|
||||
font-size: var(--large, 28px);
|
||||
font-size: var(--ci-fs-large);
|
||||
}
|
||||
@keyframes rolling {
|
||||
from {
|
||||
@@ -453,4 +463,3 @@ strong,
|
||||
}
|
||||
</style>
|
||||
<style src="./lesson-ending.css"></style>
|
||||
<style src="./lesson-ending.css"></style>
|
||||
@@ -20,7 +20,8 @@ const style = computed(() => {
|
||||
: position.endsWith('right')
|
||||
? { right: `${ISLAND_SHADOW_PAD}px` }
|
||||
: { left: '50%', transform: 'translateX(-50%)' }),
|
||||
'--transfer-accent': props.appearance.accent,
|
||||
'--ci-accent': props.appearance.resolvedAccent ?? props.appearance.accent,
|
||||
'--transfer-accent': 'var(--ci-accent)',
|
||||
};
|
||||
});
|
||||
const status = computed(
|
||||
@@ -68,15 +69,12 @@ onUnmounted(() => window.removeEventListener('resize', report));
|
||||
.courseware-transfer {
|
||||
position: fixed;
|
||||
box-sizing: border-box;
|
||||
padding: 17px 24px;
|
||||
border-radius: 24px;
|
||||
color: white;
|
||||
background: rgba(20, 20, 24, 0.97);
|
||||
box-shadow: 0 2px 8px #0004;
|
||||
font:
|
||||
13px/1.4 'Segoe UI',
|
||||
'Microsoft YaHei',
|
||||
sans-serif;
|
||||
padding: calc(var(--ci-popup-pad) + var(--ci-line-gap)) calc(var(--ci-popup-pad) * 2);
|
||||
border-radius: var(--ci-radius-oobe-btn);
|
||||
color: var(--ci-text-1);
|
||||
background: color-mix(in srgb, var(--ci-bg-secondary) 97%, transparent);
|
||||
box-shadow: var(--ci-shadow-island);
|
||||
font: var(--ci-fw-normal) var(--ci-fs-control-base) / 1.4 var(--ci-font);
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -84,26 +82,26 @@ header,
|
||||
.metadata {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
gap: calc(var(--ci-component-gap) * 0.8);
|
||||
}
|
||||
header {
|
||||
color: #ffffffb8;
|
||||
font-size: 12px;
|
||||
color: var(--ci-text-2);
|
||||
font-size: var(--ci-fs-caption);
|
||||
}
|
||||
header strong {
|
||||
color: var(--transfer-accent);
|
||||
}
|
||||
.filename {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
font-weight: var(--ci-fw-semi-bold);
|
||||
font-size: var(--ci-fs-title);
|
||||
margin: 5px 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.metadata {
|
||||
color: #ffffffb8;
|
||||
font-size: 12px;
|
||||
color: var(--ci-text-2);
|
||||
font-size: var(--ci-fs-caption);
|
||||
}
|
||||
progress {
|
||||
display: block;
|
||||
@@ -111,20 +109,20 @@ progress {
|
||||
height: 5px;
|
||||
margin-top: 11px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--ci-radius-island);
|
||||
overflow: hidden;
|
||||
accent-color: var(--transfer-accent);
|
||||
}
|
||||
progress::-webkit-progress-bar {
|
||||
background: #ffffff30;
|
||||
background: var(--ci-fill-strong);
|
||||
}
|
||||
progress::-webkit-progress-value {
|
||||
background: var(--transfer-accent);
|
||||
}
|
||||
p {
|
||||
margin: 3px 0;
|
||||
font-size: 11px;
|
||||
color: #ffb4ab;
|
||||
font-size: var(--ci-fs-caption);
|
||||
color: var(--ci-warning-critical);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
ISLAND_SHADOW_PAD,
|
||||
PRIORITY_RANK,
|
||||
type IslandAppearance,
|
||||
type IslandLayoutRow,
|
||||
type IslandLayoutSettings,
|
||||
type IslandState,
|
||||
type IslandTimePointDto,
|
||||
@@ -13,7 +14,6 @@ import {
|
||||
import ComponentNode from './ComponentNode.vue';
|
||||
import ComponentIcon from './ComponentIcon.vue';
|
||||
import ClassicNotifications from './ClassicNotifications.vue';
|
||||
import { squirclePath } from './squircle.js';
|
||||
import { SpringValue } from './spring.js';
|
||||
import LessonReminderContent from './LessonReminderContent.vue';
|
||||
|
||||
@@ -78,6 +78,33 @@ function fitted(size: { width: number; height: number }) {
|
||||
);
|
||||
return { scale, width: Math.ceil(size.width * scale), height: Math.ceil(size.height * scale) };
|
||||
}
|
||||
/** 页面配置里的十六进制颜色转成背景 alpha;输入已由 shared 归一化。 */
|
||||
function withAlpha(hex: string, alpha: number): string {
|
||||
return `color-mix(in srgb, ${hex} ${Math.min(1, Math.max(0, alpha)) * 100}%, transparent)`;
|
||||
}
|
||||
/** 自定义前景色必须写进颜色 alpha,不能用 opacity 连带淡化子元素与阴影。 */
|
||||
function foregroundVars(hex: string): Record<string, string> {
|
||||
return {
|
||||
'--ci-text-1': hex,
|
||||
'--ci-text-2': `color-mix(in srgb, ${hex} 85.5%, transparent)`,
|
||||
'--ci-text-3': `color-mix(in srgb, ${hex} 77.3%, transparent)`,
|
||||
'--ci-text-4': `color-mix(in srgb, ${hex} 52.9%, transparent)`,
|
||||
'--ci-text-5': `color-mix(in srgb, ${hex} 36.5%, transparent)`,
|
||||
};
|
||||
}
|
||||
function rowStyle(row: IslandLayoutRow): Record<string, string> {
|
||||
const style: Record<string, string> = {
|
||||
'--row-gap': `${row.gap}px`,
|
||||
opacity: String(row.opacity),
|
||||
};
|
||||
if (row.fontOverridesEnabled) {
|
||||
style['--ci-fs-secondary'] = `${row.secondaryFontSize}px`;
|
||||
style['--ci-fs-body'] = `${row.bodyFontSize}px`;
|
||||
style['--ci-fs-emphasized'] = `${row.emphasizedFontSize}px`;
|
||||
style['--ci-fs-large'] = `${row.largeFontSize}px`;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
const compactFit = computed(() => fitted(natural.value.compact));
|
||||
const detailsFit = computed(() => fitted(natural.value.details));
|
||||
const lessonFit = computed(() => fitted(natural.value.lesson));
|
||||
@@ -98,30 +125,44 @@ const progress = ref(0);
|
||||
const lessonProgress = ref(0);
|
||||
const compactAlpha = computed(() => Math.max(0, 1 - progress.value * 1.5) * (1 - lessonProgress.value));
|
||||
const detailsAlpha = computed(() => progress.value * progress.value * (1 - lessonProgress.value));
|
||||
const path = computed(() => squirclePath(morph.value.width, morph.value.height, morph.value.radius));
|
||||
const style = computed<CSSProperties>(() => ({
|
||||
width: `${morph.value.width}px`,
|
||||
height: `${morph.value.height}px`,
|
||||
'--card-path': `path("${path.value}")`,
|
||||
'--island-font': `${props.appearance.fontSize}px`,
|
||||
'--island-accent': props.appearance.accent,
|
||||
'--state-color':
|
||||
props.state.active?.priority === 'URGENT'
|
||||
? '#ff453a'
|
||||
: props.state.active?.kind === 'call'
|
||||
? '#ff9f0a'
|
||||
: props.appearance.accent,
|
||||
'--resident-background': 'var(--wn-bg)',
|
||||
'--resident-radius': `${morph.value.radius}px`,
|
||||
'--resident-scale': fit.value.scale,
|
||||
'--custom-row-gap': `${scheme.value.spacing}px`,
|
||||
'--resident-row-width': `${Math.max(60, available.value.width / scheme.value.scale - 58)}px`,
|
||||
'--secondary': `${(props.appearance.fontSize / 13) * 14}px`,
|
||||
'--emphasized': `${(props.appearance.fontSize / 13) * 18}px`,
|
||||
'--large': `${(props.appearance.fontSize / 13) * 20}px`,
|
||||
'--ci-body-font': `${(props.appearance.fontSize / 13) * 16}px`,
|
||||
'--resident-fade-duration': motion.value ? `${200 / props.appearance.speed}ms` : '0ms',
|
||||
}));
|
||||
const style = computed<CSSProperties>(() => {
|
||||
const current = scheme.value;
|
||||
const background = lesson.value
|
||||
? 'transparent'
|
||||
: expanded.value && messages.value.length
|
||||
? current.customForegroundEnabled
|
||||
? 'var(--ci-brand-dark)'
|
||||
: 'var(--ci-bg-base)'
|
||||
: current.customBackgroundEnabled
|
||||
? withAlpha(current.color, current.opacity)
|
||||
: 'var(--ci-bg-secondary)';
|
||||
return {
|
||||
width: `${morph.value.width}px`,
|
||||
height: `${morph.value.height}px`,
|
||||
'--island-font': `${current.bodyFontSize}px`,
|
||||
'--ci-fs-secondary': `${current.secondaryFontSize}px`,
|
||||
'--ci-fs-body': `${current.bodyFontSize}px`,
|
||||
'--ci-fs-emphasized': `${current.emphasizedFontSize}px`,
|
||||
'--ci-fs-large': `${current.largeFontSize}px`,
|
||||
'--ci-font-weight': String(current.fontWeight),
|
||||
'--ci-scale': String(current.scale),
|
||||
'--ci-accent': props.appearance.resolvedAccent ?? props.appearance.accent,
|
||||
'--state-color':
|
||||
props.state.active?.priority === 'URGENT'
|
||||
? 'var(--ci-danger)'
|
||||
: props.state.active?.kind === 'call'
|
||||
? 'var(--ci-warning-caution)'
|
||||
: 'var(--ci-accent)',
|
||||
'--resident-background': background,
|
||||
'--resident-radius': `${morph.value.radius}px`,
|
||||
'--resident-scale': fit.value.scale,
|
||||
'--custom-row-gap': `${current.spacing}px`,
|
||||
'--resident-row-width': `${Math.max(60, available.value.width / current.scale - 58)}px`,
|
||||
'--ci-body-font': `${current.bodyFontSize}px`,
|
||||
'--resident-fade-duration': motion.value ? `${200 / props.appearance.speed}ms` : '0ms',
|
||||
...(current.customForegroundEnabled ? foregroundVars(current.foreground) : {}),
|
||||
};
|
||||
});
|
||||
let morphFrame = 0;
|
||||
let morphFallback: ReturnType<typeof setTimeout> | undefined;
|
||||
function animate() {
|
||||
@@ -342,6 +383,16 @@ onUnmounted(() => {
|
||||
:data-bottom="appearance.position.startsWith('bottom')"
|
||||
@pointerdown.capture="pointer"
|
||||
>
|
||||
<span
|
||||
class="resident-shadow"
|
||||
:class="{ 'resident-shadow-hidden': lesson || (scheme.separated && !expanded) }"
|
||||
:style="{
|
||||
width: `${morph.width}px`,
|
||||
height: `${morph.height}px`,
|
||||
borderRadius: `${morph.radius}px`,
|
||||
}"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<section
|
||||
ref="shell"
|
||||
class="custom-card resident-card island-card"
|
||||
@@ -371,16 +422,6 @@ onUnmounted(() => {
|
||||
@keydown="key"
|
||||
@transitionend.self="reportHit"
|
||||
>
|
||||
<svg
|
||||
class="shape"
|
||||
:width="morph.width"
|
||||
:height="morph.height"
|
||||
:viewBox="`0 0 ${morph.width} ${morph.height}`"
|
||||
preserveAspectRatio="none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path :d="path" />
|
||||
</svg>
|
||||
<span class="tint" aria-hidden="true" />
|
||||
<div
|
||||
class="resident-page resident-compact-page"
|
||||
@@ -400,7 +441,7 @@ onUnmounted(() => {
|
||||
:key="row.id"
|
||||
class="layout-row"
|
||||
:data-row="row.id"
|
||||
:style="{ '--row-gap': `${row.gap}px` }"
|
||||
:style="rowStyle(row)"
|
||||
>
|
||||
<div class="row-components">
|
||||
<ComponentNode
|
||||
@@ -482,7 +523,7 @@ onUnmounted(() => {
|
||||
:key="row.id"
|
||||
class="layout-row"
|
||||
:data-row="row.id"
|
||||
:style="{ '--row-gap': `${row.gap}px` }"
|
||||
:style="rowStyle(row)"
|
||||
>
|
||||
<div class="row-components">
|
||||
<ComponentNode
|
||||
|
||||
@@ -29,10 +29,10 @@ onUnmounted(() => clearInterval(clock));
|
||||
* - 造型:**连续圆角(超椭圆 squircle)**而不是 border-radius(WinIsland `utils/shape.rs`);
|
||||
* 展开卡半径取 `min(48 * 圆角系数, w/2, h/2)`,胶囊半径取 `h/2`(满圆角);
|
||||
* - 底色:默认纯黑(WinIsland `default` 风格),可选半透明毛玻璃(`glass`;
|
||||
* **纯 CSS 实现**,取 WinIsland 拿不到 host backdrop 时的降级色 `rgba(32,32,36,.804)`——
|
||||
* **纯 CSS 实现**,取 WinIsland 拿不到 host backdrop 时的 80.4% 深色降级底——
|
||||
* Electron 的 `setBackgroundMaterial()` 不能用在逐像素透明窗口上,原因见 `main/island.ts`);
|
||||
* - 描边:1px 白、alpha 30(纯黑)/ 40(玻璃、主题色),与 WinIsland `BORDER_*_ALPHA` 同值;
|
||||
* - 阴影:只在展开态,`0 2px 3px rgba(0,0,0,.11)`(WinIsland `draw_expanded_shadow`);
|
||||
* - 阴影:只在展开态,2px 偏移、3px 模糊、11% 黑(WinIsland `draw_expanded_shadow`);
|
||||
* - 排版:白字 + alpha 分级(.92/.72/.58),**所有文本 = 基础字号 × 排版系数**,
|
||||
* 因此「字号」设置一改,岛内文字整体等比缩放(WinIsland `font_size` 模型);
|
||||
* - 动效:**单调缓动(无过冲、无回弹)**,只有淡入淡出与窗口形变,符合"开合不震动"。
|
||||
@@ -150,8 +150,8 @@ const showAfterClassHint = computed(() => state.value.reason === 'after-class' &
|
||||
|
||||
/** 状态色(WinIsland 资源占用色板同源):危险红 / 警告橙 / 强调蓝 */
|
||||
const stateColor = computed(() => {
|
||||
if (isUrgent.value) return '#ff453a';
|
||||
if (isCall.value) return '#ff9f0a';
|
||||
if (isUrgent.value) return 'var(--ci-danger)';
|
||||
if (isCall.value) return 'var(--ci-warning-caution)';
|
||||
if (isHomework.value) return appearance.value.accent;
|
||||
return '';
|
||||
});
|
||||
@@ -519,7 +519,8 @@ function applyAppearance(next: IslandAppearance | null | undefined): void {
|
||||
if (!next) return;
|
||||
appearance.value = next;
|
||||
const style = document.documentElement.style;
|
||||
style.setProperty('--island-accent', next.accent);
|
||||
style.setProperty('--ci-accent', next.resolvedAccent ?? next.accent);
|
||||
style.setProperty('--ci-accent-fill', 'var(--ci-accent)');
|
||||
style.setProperty('--island-radius', `${next.radius}px`);
|
||||
style.setProperty('--island-font', `${next.fontSize}px`);
|
||||
style.setProperty('--island-w', `${next.width}px`);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import {
|
||||
defaultIslandLayouts,
|
||||
DEFAULT_ISLAND_APPEARANCE,
|
||||
@@ -18,6 +18,7 @@ const schedules = ref<ScheduleDto[]>([]);
|
||||
const timePoints = ref<IslandTimePointDto[]>([]);
|
||||
const appearance = ref<IslandAppearance>({ ...DEFAULT_ISLAND_APPEARANCE });
|
||||
const nativeVisible = ref(false);
|
||||
const theme = ref<'light' | 'dark'>('light');
|
||||
const resident = () => settings.value.layout === 'custom';
|
||||
const state = ref<IslandState>({
|
||||
mode: 'hidden',
|
||||
@@ -31,11 +32,15 @@ const state = ref<IslandState>({
|
||||
updatedAt: 0,
|
||||
});
|
||||
let heartbeat: ReturnType<typeof setInterval>;
|
||||
watch(theme, (value) => document.documentElement.classList.toggle('dark', value === 'dark'), {
|
||||
immediate: true,
|
||||
});
|
||||
onUnmounted(() => clearInterval(heartbeat));
|
||||
onMounted(async () => {
|
||||
heartbeat = setInterval(() => window.island?.alive(), 5000);
|
||||
const bridge = window.island;
|
||||
if (bridge) {
|
||||
bridge.onTheme((value) => (theme.value = value));
|
||||
bridge.onLayout((value) => (settings.value = value));
|
||||
bridge.onSchedules((value) => (schedules.value = value));
|
||||
bridge.onTimePoints((value) => (timePoints.value = value));
|
||||
@@ -43,6 +48,7 @@ onMounted(async () => {
|
||||
bridge.onAppearance((value) => (appearance.value = value));
|
||||
bridge.onVisibility((value) => (nativeVisible.value = value));
|
||||
nativeVisible.value = await bridge.getVisible();
|
||||
theme.value = await bridge.getTheme();
|
||||
appearance.value = await bridge.getAppearance();
|
||||
settings.value = await bridge.getLayout();
|
||||
schedules.value = await bridge.getSchedules();
|
||||
|
||||
@@ -198,20 +198,20 @@ onUnmounted(() => {
|
||||
width: max-content;
|
||||
min-width: 300px;
|
||||
max-width: 800px;
|
||||
height: 40px;
|
||||
height: var(--ci-island-height);
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
color: var(--ci-text-1);
|
||||
font-size: var(--ci-fs-body);
|
||||
line-height: 1;
|
||||
border-radius: 8px;
|
||||
background: #20202080;
|
||||
border-radius: var(--ci-radius-island);
|
||||
background: color-mix(in srgb, var(--ci-bg-base) 50%, transparent);
|
||||
}
|
||||
.ci-lesson-info {
|
||||
height: 40px;
|
||||
height: var(--ci-island-height);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
gap: var(--ci-component-gap);
|
||||
padding: 0 14px;
|
||||
white-space: nowrap;
|
||||
transition: opacity var(--ci-duration) ease-in;
|
||||
@@ -230,25 +230,26 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
gap: calc(var(--ci-component-gap) / 2);
|
||||
}
|
||||
.ci-lesson-course strong {
|
||||
font-size: 20px;
|
||||
font-size: var(--ci-fs-large);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.ci-lesson-course small {
|
||||
flex-shrink: 0;
|
||||
font-size: 14px;
|
||||
color: var(--ci-text-3);
|
||||
font-size: var(--ci-fs-secondary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.ci-mask {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
fill: var(--island-accent, #60a5fa);
|
||||
height: var(--ci-island-height);
|
||||
fill: var(--island-accent, var(--ci-accent));
|
||||
pointer-events: none;
|
||||
}
|
||||
.ci-mask-title {
|
||||
@@ -257,9 +258,9 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: calc(var(--ci-component-gap) * 0.67);
|
||||
opacity: 0;
|
||||
font-size: 18px;
|
||||
font-size: var(--ci-fs-emphasized);
|
||||
transform: scale(1.1);
|
||||
transition:
|
||||
opacity var(--ci-duration) linear,
|
||||
@@ -309,8 +310,8 @@ onUnmounted(() => {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: var(--island-accent, #60a5fa);
|
||||
height: var(--ci-progress-height);
|
||||
background: var(--island-accent, var(--ci-accent));
|
||||
transform-origin: left;
|
||||
transition: transform 50ms linear;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ const advice = computed(() => {
|
||||
}
|
||||
small {
|
||||
display: block;
|
||||
font-size: var(--secondary, 12px);
|
||||
color: var(--ci-text-3);
|
||||
font-size: var(--ci-fs-secondary);
|
||||
}
|
||||
</style>
|
||||
@@ -18,10 +18,13 @@ body,
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
:root {
|
||||
/* 经典岛沿用历史变量名,但颜色唯一来源仍是 --ci-accent。 */
|
||||
--island-accent: var(--ci-accent);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family:
|
||||
-apple-system, 'Segoe UI Variable Display', 'Segoe UI', 'Microsoft YaHei', 'PingFang SC',
|
||||
'Helvetica Neue', sans-serif;
|
||||
font-family: var(--ci-font-island);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
@@ -53,36 +56,38 @@ body {
|
||||
margin: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
color: rgba(255, 255, 255, 0.92);
|
||||
color: var(--ci-text-on-accent);
|
||||
font-family: var(--ci-font-island);
|
||||
font-size: var(--island-font, 13px);
|
||||
font-weight: var(--ci-font-weight);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
/* 配色 token(默认:WinIsland 纯黑风格) */
|
||||
--wn-bg: #000000;
|
||||
--wn-border: rgba(255, 255, 255, 0.118);
|
||||
--wn-text-1: rgba(255, 255, 255, 0.92);
|
||||
--wn-text-2: rgba(255, 255, 255, 0.72);
|
||||
--wn-text-3: rgba(255, 255, 255, 0.58);
|
||||
--wn-surface: rgba(255, 255, 255, 0.1);
|
||||
--wn-surface-hover: rgba(255, 255, 255, 0.18);
|
||||
--wn-divider: rgba(255, 255, 255, 0.09);
|
||||
--wn-bg: var(--ci-island-bg-custom);
|
||||
--wn-border: var(--ci-stroke-island);
|
||||
--wn-text-1: var(--ci-text-on-accent);
|
||||
--wn-text-2: color-mix(in srgb, var(--ci-text-on-accent) 85.5%, transparent);
|
||||
--wn-text-3: color-mix(in srgb, var(--ci-text-on-accent) 77.3%, transparent);
|
||||
--wn-surface: var(--ci-fill-secondary);
|
||||
--wn-surface-hover: var(--ci-accent-soft);
|
||||
--wn-divider: var(--ci-stroke-divider);
|
||||
}
|
||||
|
||||
.island-card[data-style='glass'] {
|
||||
/* WinIsland「glass 无 host backdrop」降级色:比纯黑透一点,但保证任何桌面下都不是白底 */
|
||||
--wn-bg: rgba(32, 32, 36, 0.804);
|
||||
--wn-border: rgba(255, 255, 255, 0.157);
|
||||
--wn-surface: rgba(255, 255, 255, 0.14);
|
||||
--wn-surface-hover: rgba(255, 255, 255, 0.22);
|
||||
--wn-bg: color-mix(in srgb, var(--ci-bg-base) 80.4%, transparent);
|
||||
--wn-border: var(--ci-stroke-control);
|
||||
--wn-surface: var(--ci-fill-secondary);
|
||||
--wn-surface-hover: var(--ci-accent-fill-tertiary);
|
||||
}
|
||||
|
||||
.island-card[data-style='tinted'] {
|
||||
--wn-bg: #0b0b0f;
|
||||
--wn-border: rgba(255, 255, 255, 0.14);
|
||||
--wn-bg: color-mix(in srgb, var(--ci-island-bg-custom) 88%, var(--ci-accent));
|
||||
--wn-border: var(--ci-stroke-control);
|
||||
}
|
||||
/* 阅读老师消息时使用实色底,玻璃风格也不透出桌面。 */
|
||||
.island-card.message-surface {
|
||||
--wn-bg: #202020;
|
||||
--wn-bg: var(--ci-brand-dark);
|
||||
}
|
||||
|
||||
.island-card.hidden-placeholder {
|
||||
@@ -120,7 +125,9 @@ body {
|
||||
胶囊态用 0 0 0:硬轮廓投影正好压在路径底下,肉眼等同无投影,与 WinIsland
|
||||
"只有展开态有投影"的观感一致。
|
||||
*/
|
||||
filter: drop-shadow(0 var(--card-shadow-y, 0px) var(--card-shadow-blur, 0px) rgba(0, 0, 0, 0.11));
|
||||
filter: drop-shadow(
|
||||
0 var(--card-shadow-y, 0px) var(--card-shadow-blur, 0px) color-mix(in srgb, black 11%, transparent)
|
||||
);
|
||||
}
|
||||
|
||||
/* 内容层裁切到同一形状内;内部两层(胶囊层 / 展开层)交叉淡入 */
|
||||
@@ -145,7 +152,7 @@ body {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* 展开态投影(WinIsland: rgba(0,0,0,.11)、y+2、σ=3 → CSS 0 2px 3px)。
|
||||
/* 展开态投影(WinIsland: 11% 黑、y+2、σ=3 → CSS 0 2px 3px)。
|
||||
只改参数、不动 filter 声明本身,理由见上面的 .shape path。 */
|
||||
.island-card.expanded .shape path {
|
||||
--card-shadow-y: 2px;
|
||||
@@ -155,7 +162,7 @@ body {
|
||||
/* 状态色:只做"内层微染 + 描边",不外溢(保持桌面干净,也不会有光晕硬边) */
|
||||
.island-card.urgent .shape path,
|
||||
.island-card.call .shape path {
|
||||
stroke: color-mix(in srgb, var(--state-color) 62%, rgba(255, 255, 255, 0.2));
|
||||
stroke: color-mix(in srgb, var(--state-color) 62%, var(--ci-stroke-control));
|
||||
}
|
||||
|
||||
.island-card .tint {
|
||||
@@ -167,12 +174,20 @@ body {
|
||||
|
||||
.island-card.urgent .tint {
|
||||
opacity: 1;
|
||||
background: radial-gradient(120% 90% at 50% 0%, rgba(255, 69, 58, 0.22), transparent 68%);
|
||||
background: radial-gradient(
|
||||
120% 90% at 50% 0%,
|
||||
color-mix(in srgb, var(--ci-danger) 22%, transparent),
|
||||
transparent 68%
|
||||
);
|
||||
}
|
||||
|
||||
.island-card.call .tint {
|
||||
opacity: 1;
|
||||
background: radial-gradient(120% 90% at 50% 0%, rgba(255, 159, 10, 0.2), transparent 68%);
|
||||
background: radial-gradient(
|
||||
120% 90% at 50% 0%,
|
||||
color-mix(in srgb, var(--ci-warning-caution) 20%, transparent),
|
||||
transparent 68%
|
||||
);
|
||||
}
|
||||
|
||||
.island-card[data-style='tinted'] .tint {
|
||||
@@ -242,7 +257,7 @@ body {
|
||||
flex: 0 0 auto;
|
||||
width: calc(var(--island-font, 13px) * 1.24);
|
||||
height: calc(var(--island-font, 13px) * 1.24);
|
||||
border-radius: 50%;
|
||||
border-radius: var(--ci-radius-pill);
|
||||
background: var(--wn-surface);
|
||||
color: var(--wn-text-1);
|
||||
}
|
||||
@@ -253,11 +268,11 @@ body {
|
||||
}
|
||||
|
||||
.pill-icon.call {
|
||||
color: #ff9f0a;
|
||||
color: var(--ci-warning-caution);
|
||||
}
|
||||
|
||||
.pill-icon.urgent {
|
||||
color: #ff453a;
|
||||
color: var(--ci-danger);
|
||||
}
|
||||
|
||||
.pill-icon.homework {
|
||||
@@ -305,8 +320,8 @@ body {
|
||||
font-size: calc(var(--island-font, 13px) * 0.6);
|
||||
line-height: 1.4;
|
||||
padding: 0 calc(var(--island-font, 13px) * 0.36);
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
border-radius: var(--ci-radius-pill);
|
||||
background: var(--ci-fill-secondary);
|
||||
color: var(--wn-text-2);
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -314,7 +329,7 @@ body {
|
||||
.pill-chevron {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
color: rgba(255, 255, 255, 0.34);
|
||||
color: var(--ci-text-5);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
@@ -386,7 +401,7 @@ body {
|
||||
padding: 0 calc(var(--island-font, 13px) * 0.6);
|
||||
border: none;
|
||||
border-radius: calc(var(--island-font, 13px) * 0.5);
|
||||
background: rgba(255, 255, 255, 0.045);
|
||||
background: var(--ci-accent-soft);
|
||||
color: var(--wn-text-1);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
@@ -411,7 +426,7 @@ body {
|
||||
}
|
||||
|
||||
.row-icon.call {
|
||||
color: #ff9f0a;
|
||||
color: var(--ci-warning-caution);
|
||||
}
|
||||
|
||||
.row-icon.homework {
|
||||
@@ -451,11 +466,11 @@ body {
|
||||
flex: 0 0 auto;
|
||||
height: calc(var(--island-font, 13px) * 1.25);
|
||||
padding: 0 calc(var(--island-font, 13px) * 0.5);
|
||||
border-radius: 999px;
|
||||
border-radius: var(--ci-radius-pill);
|
||||
font-size: calc(var(--island-font, 13px) * 0.68);
|
||||
font-weight: 600;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
color: rgba(255, 255, 255, 0.78);
|
||||
background: var(--ci-fill-secondary);
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
|
||||
/* 列表底部的提示行:能展开时是按钮,屏幕到任务栏了就是一句"去应用里看" */
|
||||
@@ -511,13 +526,13 @@ body {
|
||||
}
|
||||
|
||||
.head-icon.urgent {
|
||||
background: rgba(255, 69, 58, 0.2);
|
||||
color: #ff453a;
|
||||
background: color-mix(in srgb, var(--ci-danger) 20%, transparent);
|
||||
color: var(--ci-danger);
|
||||
}
|
||||
|
||||
.head-icon.call {
|
||||
background: rgba(255, 159, 10, 0.2);
|
||||
color: #ff9f0a;
|
||||
background: color-mix(in srgb, var(--ci-warning-caution) 20%, transparent);
|
||||
color: var(--ci-warning-caution);
|
||||
}
|
||||
|
||||
.head-icon.homework {
|
||||
@@ -538,39 +553,39 @@ body {
|
||||
align-items: center;
|
||||
height: calc(var(--island-font, 13px) * 1.5);
|
||||
padding: 0 calc(var(--island-font, 13px) * 0.62);
|
||||
border-radius: 999px;
|
||||
border-radius: var(--ci-radius-pill);
|
||||
font-size: calc(var(--island-font, 13px) * 0.76);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
background: color-mix(in srgb, var(--island-accent) 26%, transparent);
|
||||
color: color-mix(in srgb, var(--island-accent) 70%, #ffffff);
|
||||
color: color-mix(in srgb, var(--island-accent) 70%, var(--ci-text-1));
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.badge-urgent {
|
||||
background: rgba(255, 69, 58, 0.24);
|
||||
color: #ff6961;
|
||||
background: color-mix(in srgb, var(--ci-danger) 24%, transparent);
|
||||
color: var(--ci-danger);
|
||||
}
|
||||
|
||||
.badge-high {
|
||||
background: rgba(255, 159, 10, 0.22);
|
||||
color: #ffb340;
|
||||
background: color-mix(in srgb, var(--ci-warning-caution) 22%, transparent);
|
||||
color: var(--ci-warning-caution);
|
||||
}
|
||||
|
||||
.badge-low,
|
||||
.badge-normal {
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
color: rgba(255, 255, 255, 0.78);
|
||||
background: var(--ci-fill-secondary);
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
|
||||
.badge-call {
|
||||
background: rgba(255, 159, 10, 0.24);
|
||||
color: #ffb340;
|
||||
background: color-mix(in srgb, var(--ci-warning-caution) 24%, transparent);
|
||||
color: var(--ci-warning-caution);
|
||||
}
|
||||
|
||||
.badge-homework {
|
||||
background: color-mix(in srgb, var(--island-accent) 26%, transparent);
|
||||
color: color-mix(in srgb, var(--island-accent) 72%, #ffffff);
|
||||
color: color-mix(in srgb, var(--island-accent) 72%, var(--ci-text-1));
|
||||
}
|
||||
|
||||
.live-dot {
|
||||
@@ -578,12 +593,12 @@ body {
|
||||
align-items: center;
|
||||
gap: calc(var(--island-font, 13px) * 0.32);
|
||||
font-size: calc(var(--island-font, 13px) * 0.76);
|
||||
color: #ff6961;
|
||||
color: var(--ci-danger);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.live-dot.call {
|
||||
color: #ffb340;
|
||||
color: var(--ci-warning-caution);
|
||||
}
|
||||
|
||||
.live-dot.muted {
|
||||
@@ -605,9 +620,9 @@ body {
|
||||
width: calc(var(--island-font, 13px) * 1.7);
|
||||
height: calc(var(--island-font, 13px) * 1.7);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
border-radius: var(--ci-radius-pill);
|
||||
background: var(--wn-surface);
|
||||
color: rgba(255, 255, 255, 0.72);
|
||||
color: var(--ci-text-3);
|
||||
cursor: pointer;
|
||||
flex: 0 0 auto;
|
||||
transition:
|
||||
@@ -625,7 +640,7 @@ body {
|
||||
font-size: calc(var(--island-font, 13px) * 1.08);
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
color: #fff;
|
||||
color: var(--ci-text-1);
|
||||
flex: 0 0 auto;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
@@ -654,7 +669,7 @@ body {
|
||||
margin: 0;
|
||||
font-size: calc(var(--island-font, 13px) * 0.85);
|
||||
line-height: 1.4;
|
||||
color: color-mix(in srgb, var(--state-color) 66%, #ffffff);
|
||||
color: color-mix(in srgb, var(--state-color) 66%, var(--ci-text-1));
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -691,7 +706,7 @@ body {
|
||||
height: calc(var(--island-font, 13px) * 2.05);
|
||||
padding: 0 calc(var(--island-font, 13px) * 0.9);
|
||||
border: none;
|
||||
border-radius: 999px;
|
||||
border-radius: var(--ci-radius-pill);
|
||||
font-size: calc(var(--island-font, 13px) * 0.76);
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
@@ -707,18 +722,18 @@ body {
|
||||
}
|
||||
|
||||
.solid-btn {
|
||||
background: #ffffff;
|
||||
color: #0b0b0f;
|
||||
background: var(--ci-text-1);
|
||||
color: var(--ci-bg-base);
|
||||
}
|
||||
|
||||
.island-card.call .solid-btn {
|
||||
background: #ff9f0a;
|
||||
color: #1a1205;
|
||||
background: var(--ci-warning-caution);
|
||||
color: var(--ci-brand-dark);
|
||||
}
|
||||
|
||||
.island-card.urgent .solid-btn {
|
||||
background: #ff453a;
|
||||
color: #ffffff;
|
||||
background: var(--ci-danger);
|
||||
color: var(--ci-text-on-accent);
|
||||
}
|
||||
|
||||
.ghost-btn:active,
|
||||
@@ -745,7 +760,7 @@ body {
|
||||
|
||||
.icon-btn:hover {
|
||||
background: var(--wn-surface-hover);
|
||||
color: #ffffff;
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
box-sizing: border-box;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
background: var(--custom-color);
|
||||
border-radius: var(--custom-radius);
|
||||
background: var(--resident-background, var(--ci-island-bg-custom));
|
||||
color: var(--ci-text-1);
|
||||
border-radius: var(--resident-radius, var(--ci-radius-island));
|
||||
box-shadow:
|
||||
inset 0 0 0 1px #ffffff1e,
|
||||
0 2px 3px #0000001c;
|
||||
inset 0 0 0 var(--ci-stroke-island-w) var(--ci-stroke-island),
|
||||
var(--ci-shadow-island);
|
||||
}
|
||||
.custom-inner {
|
||||
width: max-content;
|
||||
@@ -63,7 +64,7 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
.custom-card[role='button']:focus-visible {
|
||||
outline: 2px solid #8dafff;
|
||||
outline: 2px solid var(--ci-stroke-drag);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
.custom-card .resident-bell {
|
||||
@@ -76,16 +77,16 @@
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
border-radius: var(--ci-radius-popup);
|
||||
background: transparent;
|
||||
color: #ffda8b;
|
||||
color: var(--ci-warning-caution);
|
||||
cursor: pointer;
|
||||
}
|
||||
.custom-card .resident-bell:hover {
|
||||
background: #ffffff1a;
|
||||
background: var(--ci-fill-secondary);
|
||||
}
|
||||
.custom-card .resident-bell.bell-empty {
|
||||
color: #ffffff60;
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
.custom-card .resident-bell svg {
|
||||
width: 18px;
|
||||
@@ -100,13 +101,11 @@
|
||||
min-width: 14px;
|
||||
height: 14px;
|
||||
padding: 0 3px;
|
||||
border-radius: 7px;
|
||||
background: #f45b58;
|
||||
color: white;
|
||||
font:
|
||||
600 9px/1 'Segoe UI',
|
||||
sans-serif;
|
||||
box-shadow: 0 0 0 2px var(--custom-color);
|
||||
border-radius: var(--ci-radius-pill);
|
||||
background: var(--ci-danger);
|
||||
color: var(--ci-text-on-accent);
|
||||
font: var(--ci-fw-semi-bold) var(--ci-fs-version) / 1 var(--ci-font);
|
||||
box-shadow: 0 0 0 2px var(--resident-background, var(--ci-island-bg-custom));
|
||||
}
|
||||
.custom-card .resident-panel-heading {
|
||||
display: flex;
|
||||
@@ -114,17 +113,17 @@
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
padding: 4px 6px 12px;
|
||||
border-bottom: 1px solid #ffffff1a;
|
||||
border-bottom: var(--ci-stroke-island-w) solid var(--ci-stroke-divider);
|
||||
margin-bottom: 4px;
|
||||
color: #ffffff94;
|
||||
font-size: 12px;
|
||||
color: var(--ci-text-2);
|
||||
font-size: var(--ci-fs-caption);
|
||||
}
|
||||
.custom-card .resident-panel-heading button {
|
||||
min-height: 30px;
|
||||
padding: 4px 10px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: #ffffff0d;
|
||||
border-radius: var(--ci-radius-control);
|
||||
background: var(--ci-fill-secondary);
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
@@ -135,12 +134,12 @@
|
||||
gap: 6px;
|
||||
}
|
||||
.layout-editor .surface-tabs button {
|
||||
font-size: 12px;
|
||||
font-size: var(--ci-fs-caption);
|
||||
}
|
||||
.layout-editor .surface-tabs button.active {
|
||||
color: var(--editor-accent);
|
||||
background: #edf2ff;
|
||||
border-color: #b6c8f0;
|
||||
color: var(--ci-accent-text);
|
||||
background: var(--ci-accent-fill-tertiary);
|
||||
border-color: var(--ci-stroke-drag);
|
||||
}
|
||||
.custom-card .layout-row {
|
||||
display: flex;
|
||||
@@ -168,8 +167,8 @@
|
||||
}
|
||||
.custom-card.has-alert {
|
||||
box-shadow:
|
||||
inset 0 0 0 1px #ffffff2b,
|
||||
0 2px 3px #0000001c;
|
||||
inset 0 0 0 var(--ci-stroke-island-w) var(--ci-stroke-control),
|
||||
var(--ci-shadow-mask);
|
||||
}
|
||||
.custom-card.separated {
|
||||
background: transparent;
|
||||
@@ -177,10 +176,10 @@
|
||||
padding: 0;
|
||||
}
|
||||
.custom-card.separated .layout-row {
|
||||
background: var(--custom-color);
|
||||
border-radius: var(--custom-radius);
|
||||
padding: 12px;
|
||||
box-shadow: inset 0 0 0 1px #ffffff1e;
|
||||
background: var(--resident-background, var(--ci-island-bg-custom));
|
||||
border-radius: var(--resident-radius, var(--ci-radius-island));
|
||||
padding: var(--ci-island-pad-x);
|
||||
box-shadow: inset 0 0 0 var(--ci-stroke-island-w) var(--ci-stroke-island);
|
||||
}
|
||||
/* 自定义模式只保留一个岛壳。原提醒渲染器继续负责内容、动画和按钮。 */
|
||||
.custom-card .island-root.embedded .shape,
|
||||
@@ -198,7 +197,7 @@
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.custom-card .island-root.embedded {
|
||||
border-top: 1px solid #ffffff1a;
|
||||
border-top: var(--ci-stroke-island-w) solid var(--ci-stroke-divider);
|
||||
}
|
||||
.custom-window .preview-stage {
|
||||
width: max-content;
|
||||
|
||||
@@ -16,14 +16,48 @@
|
||||
max-width: none;
|
||||
max-height: none;
|
||||
overflow: hidden;
|
||||
clip-path: var(--card-path);
|
||||
isolation: isolate;
|
||||
pointer-events: auto;
|
||||
background: none;
|
||||
background: var(--resident-background);
|
||||
border: var(--ci-stroke-island-w) solid var(--ci-stroke-island);
|
||||
border-radius: var(--resident-radius);
|
||||
color: var(--ci-text-1);
|
||||
font-family: var(--ci-font-island);
|
||||
font-size: var(--island-font);
|
||||
font-weight: var(--ci-font-weight);
|
||||
line-height: 1.4;
|
||||
box-shadow: none;
|
||||
z-index: var(--ci-z-content);
|
||||
transition: background-color var(--ci-duration) linear;
|
||||
}
|
||||
.resident-window .resident-shadow {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0;
|
||||
transform: translateX(-50%);
|
||||
pointer-events: none;
|
||||
box-shadow: var(--ci-shadow-island);
|
||||
z-index: var(--ci-z-window);
|
||||
transition: opacity var(--ci-duration) linear;
|
||||
}
|
||||
.resident-window[data-anchor='left'] .resident-shadow {
|
||||
left: 0;
|
||||
transform: none;
|
||||
}
|
||||
.resident-window[data-anchor='right'] .resident-shadow {
|
||||
left: auto;
|
||||
right: 0;
|
||||
transform: none;
|
||||
}
|
||||
.resident-window[data-bottom='true'] .resident-shadow {
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
.resident-window .resident-shadow-hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
.resident-window .resident-card > .shape {
|
||||
display: none;
|
||||
}
|
||||
.resident-window[data-anchor='left'] .resident-card {
|
||||
left: 0;
|
||||
@@ -72,10 +106,10 @@
|
||||
.resident-card .resident-compact {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0 12px;
|
||||
min-height: max(40px, calc(var(--island-font) * 2.5));
|
||||
font-size: var(--ci-body-font, 16px);
|
||||
gap: calc(var(--ci-component-gap) / 2);
|
||||
padding: 0 var(--ci-island-pad-x);
|
||||
min-height: var(--ci-island-height);
|
||||
font-size: var(--ci-fs-body);
|
||||
}
|
||||
.resident-window .resident-card.resident-separated {
|
||||
background: transparent;
|
||||
@@ -88,7 +122,7 @@
|
||||
align-items: center;
|
||||
}
|
||||
.resident-separated .resident-compact .layout-row {
|
||||
padding: 0 12px;
|
||||
padding: 0 var(--ci-island-pad-x);
|
||||
background: var(--resident-background);
|
||||
border-radius: var(--resident-radius);
|
||||
}
|
||||
@@ -107,10 +141,10 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0;
|
||||
min-height: max(40px, calc(var(--island-font) * 2.5));
|
||||
min-height: var(--ci-island-height);
|
||||
}
|
||||
.resident-card .resident-compact .component-node:not(.container) {
|
||||
min-height: max(40px, calc(var(--island-font) * 2.5));
|
||||
min-height: var(--ci-island-height);
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -129,7 +163,7 @@
|
||||
}
|
||||
.resident-card .resident-compact .schedule {
|
||||
flex-direction: row;
|
||||
gap: 12px;
|
||||
gap: var(--ci-component-gap);
|
||||
}
|
||||
.resident-card .resident-compact .schedule > div + div {
|
||||
margin-top: 0;
|
||||
@@ -142,14 +176,14 @@
|
||||
color: inherit;
|
||||
}
|
||||
.resident-card .resident-bell.bell-empty {
|
||||
color: #ffffff80;
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
.resident-card .resident-bell span {
|
||||
animation: resident-indicator-in var(--resident-fade-duration) cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
.resident-card .resident-details {
|
||||
min-width: 160px;
|
||||
padding: 0 12px 12px;
|
||||
padding: 0 var(--ci-island-pad-x) var(--ci-island-pad-x);
|
||||
text-align: center;
|
||||
}
|
||||
.resident-card .resident-panel-heading {
|
||||
@@ -157,12 +191,12 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
height: 40px;
|
||||
height: var(--ci-island-height);
|
||||
padding: 0 6px;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
color: #ffffff94;
|
||||
font-size: 12px;
|
||||
color: var(--ci-text-2);
|
||||
font-size: var(--ci-fs-caption);
|
||||
}
|
||||
.resident-card .resident-panel-heading .icon-btn {
|
||||
min-height: 28px;
|
||||
@@ -176,24 +210,25 @@
|
||||
display: block;
|
||||
}
|
||||
.resident-card .resident-expanded-rows {
|
||||
font-size: var(--ci-body-font, 16px);
|
||||
border-top: 1px solid #ffffff1a;
|
||||
padding-top: 8px;
|
||||
font-size: var(--ci-fs-body);
|
||||
border-top: var(--ci-stroke-island-w) solid var(--ci-stroke-divider);
|
||||
padding-top: calc(var(--ci-component-gap) / 2);
|
||||
}
|
||||
.resident-card .resident-expanded-rows .row-components {
|
||||
gap: var(--row-gap, 12px);
|
||||
gap: var(--row-gap, var(--ci-component-gap));
|
||||
}
|
||||
.resident-card #custom-alert-host {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
.resident-card button:focus-visible {
|
||||
outline: 2px solid #adc4ff;
|
||||
outline: 2px solid var(--ci-stroke-drag);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.resident-card button:hover {
|
||||
filter: brightness(1.18);
|
||||
background: var(--ci-accent-soft);
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
}
|
||||
@keyframes resident-indicator-in {
|
||||
@@ -240,8 +275,14 @@
|
||||
}
|
||||
/* ClassIsland Fluent MainWindowLine:半透明底、1px 边框,强调遮罩只在提醒时播放。 */
|
||||
.resident-window .resident-card {
|
||||
--wn-bg: #20202080;
|
||||
--wn-border: #ffffff26;
|
||||
--wn-bg: var(--resident-background);
|
||||
--wn-border: var(--ci-stroke-island);
|
||||
--wn-text-1: var(--ci-text-1);
|
||||
--wn-text-2: var(--ci-text-2);
|
||||
--wn-text-3: var(--ci-text-3);
|
||||
--wn-surface: var(--ci-fill-secondary);
|
||||
--wn-surface-hover: var(--ci-accent-soft);
|
||||
--wn-divider: var(--ci-stroke-divider);
|
||||
}
|
||||
.resident-window .resident-card > .tint {
|
||||
display: none;
|
||||
@@ -250,6 +291,9 @@
|
||||
fill: transparent;
|
||||
stroke: none;
|
||||
}
|
||||
.resident-window .resident-card.message-surface {
|
||||
--wn-bg: #202020;
|
||||
.resident-card.resident-lesson {
|
||||
border-color: transparent;
|
||||
}
|
||||
.resident-window .resident-card.message-surface {
|
||||
--resident-background: var(--ci-brand-dark);
|
||||
}
|
||||
@@ -6,11 +6,11 @@
|
||||
flex: 0 0 auto;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
background: #0a84ff;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
border-radius: var(--ci-radius-pill);
|
||||
color: var(--ci-text-on-accent);
|
||||
background: var(--ci-accent-fill);
|
||||
font-size: var(--ci-fs-caption);
|
||||
font-weight: var(--ci-fw-semi-bold);
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1;
|
||||
}
|
||||
@@ -136,6 +136,14 @@ function normalizeIslandAppearance(input?: Partial<IslandAppearance>): IslandApp
|
||||
'bottom-right',
|
||||
];
|
||||
const styles: IslandAppearance['style'][] = ['black', 'glass', 'tinted'];
|
||||
const accentPalette = Array.isArray(input?.accentPalette)
|
||||
? input.accentPalette
|
||||
.filter((value): value is string => typeof value === 'string' && /^#[0-9a-fA-F]{6}$/.test(value))
|
||||
.slice(0, 32)
|
||||
: [...DEFAULT_ISLAND_APPEARANCE.accentPalette];
|
||||
const accentSource = [0, 1, 2, 3].includes(input?.accentSource as number)
|
||||
? (input?.accentSource as IslandAppearance['accentSource'])
|
||||
: DEFAULT_ISLAND_APPEARANCE.accentSource;
|
||||
return {
|
||||
height: clamp(input?.height, 36, 72, DEFAULT_ISLAND_APPEARANCE.height),
|
||||
width: clamp(input?.width, 220, 420, DEFAULT_ISLAND_APPEARANCE.width),
|
||||
@@ -145,6 +153,11 @@ function normalizeIslandAppearance(input?: Partial<IslandAppearance>): IslandApp
|
||||
typeof input?.accent === 'string' && /^#[0-9a-fA-F]{6}$/.test(input.accent)
|
||||
? input.accent
|
||||
: DEFAULT_ISLAND_APPEARANCE.accent,
|
||||
accentSource,
|
||||
accentPalette: accentPalette.length ? accentPalette : [...DEFAULT_ISLAND_APPEARANCE.accentPalette],
|
||||
accentPaletteIndex: Math.round(
|
||||
clamp(input?.accentPaletteIndex, 0, Math.max(0, accentPalette.length - 1), 0),
|
||||
),
|
||||
fontSize: clamp(input?.fontSize, 11, 20, DEFAULT_ISLAND_APPEARANCE.fontSize),
|
||||
animations: input?.animations !== false,
|
||||
speed: clamp(input?.speed, 0.5, 2, DEFAULT_ISLAND_APPEARANCE.speed),
|
||||
|
||||
@@ -40,6 +40,7 @@ export function registerIpcHandlers(): void {
|
||||
delete allowed.pendingUpdateVersion;
|
||||
const saved = saveConfig(allowed);
|
||||
if (allowed.islandLayout) island.syncCustomLayout();
|
||||
if (allowed.theme !== undefined) island.syncTheme();
|
||||
return saved;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -4,9 +4,10 @@ import type {
|
||||
} from '@classhelper/shared';
|
||||
import path from 'node:path';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { BrowserWindow, ipcMain, screen } from 'electron';
|
||||
import { BrowserWindow, ipcMain, screen, systemPreferences } from 'electron';
|
||||
import {
|
||||
COURSEWARE_ISLAND_SIZE,
|
||||
CLASSISLAND_TOKENS,
|
||||
type CoursewareTransfer,
|
||||
DEFAULT_ISLAND_APPEARANCE,
|
||||
CLASSISLAND_ISLAND_METRICS,
|
||||
@@ -336,6 +337,13 @@ class IslandController {
|
||||
this.syncResidentShape(true);
|
||||
this.syncWindow();
|
||||
}
|
||||
|
||||
/** 主题独立于外观补丁,主窗口切肤时实时同步给岛渲染进程。 */
|
||||
syncTheme(): void {
|
||||
if (!this.win || this.win.isDestroyed()) return;
|
||||
this.win.webContents.send('island:theme', getConfig().theme);
|
||||
}
|
||||
|
||||
/** 仅用于首次切换布局、启动与退出编辑;日常常驻岛开合保持窗口可见。 */
|
||||
private settleCustomLayout(): void {
|
||||
if (this.layoutSettleTimer) clearTimeout(this.layoutSettleTimer);
|
||||
@@ -623,6 +631,7 @@ class IslandController {
|
||||
}
|
||||
// 首次进入时同步一次外观与状态,保证渲染进程不会停在初始默认值
|
||||
this.emitAppearance();
|
||||
this.syncTheme();
|
||||
this.win?.webContents.send('island:schedules', this.schedules);
|
||||
this.win?.webContents.send('island:time-points', this.timePoints);
|
||||
this.emit();
|
||||
@@ -774,7 +783,7 @@ class IslandController {
|
||||
private refreshViewport(): void {
|
||||
const area = this.targetDisplay().workArea;
|
||||
const anchor = this.resolveAnchor();
|
||||
const marginY = Math.round(this.appearance.marginY ?? ISLAND_MARGIN);
|
||||
const marginY = this.verticalMargin();
|
||||
const available =
|
||||
anchor.vMode === 'bottom'
|
||||
? anchor.vValue - (area.y + marginY)
|
||||
@@ -1333,7 +1342,7 @@ class IslandController {
|
||||
const display = this.targetDisplay();
|
||||
const area = display.workArea;
|
||||
const marginX = Math.round(this.appearance.marginX ?? ISLAND_MARGIN);
|
||||
const marginY = Math.round(this.appearance.marginY ?? ISLAND_MARGIN);
|
||||
const marginY = this.verticalMargin();
|
||||
const center = Math.round(area.x + area.width / 2);
|
||||
|
||||
// 6 个停靠位置(顶/底 × 左/中/右),与 WinIsland 的 DockPosition 一一对应
|
||||
@@ -1350,6 +1359,12 @@ class IslandController {
|
||||
return { hMode, hValue, vMode, vValue };
|
||||
}
|
||||
|
||||
/** 自定义岛遵循 ClassIsland Fluent 的 20px 竖直安全区;经典岛保留原有外观边距。 */
|
||||
private verticalMargin(): number {
|
||||
const configured = Math.round(this.appearance.marginY ?? ISLAND_MARGIN);
|
||||
return this.customLayout ? Math.max(configured, CLASSISLAND_TOKENS.dpi.verticalSafeArea) : configured;
|
||||
}
|
||||
|
||||
/** 当前应该把岛放在哪块屏上:跟随鼠标时用光标所在屏,否则用主屏 */
|
||||
private targetDisplay(cursor?: { x: number; y: number } | null): Electron.Display {
|
||||
return this.appearance.followCursorDisplay
|
||||
@@ -1524,7 +1539,7 @@ class IslandController {
|
||||
// 与 ClassIsland 一样,让背景/内容在固定画布内过渡。预留一帧绘制边界,避免过冲裁切。
|
||||
return {
|
||||
width: Math.min(960, area.width),
|
||||
height: Math.min(640, Math.max(60, area.height - this.appearance.marginY)),
|
||||
height: Math.min(640, Math.max(60, area.height - this.verticalMargin())),
|
||||
};
|
||||
}
|
||||
if (this.customLayout)
|
||||
@@ -1735,14 +1750,14 @@ class IslandController {
|
||||
* 2. 材质的明暗跟随**应用主题**:本客户端是浅色 Fluent 主题,亚克力必然是浅色,
|
||||
* 无法像 WinIsland 那样自带深色 tint(`Color::from_argb(150, 10, 10, 14)`)。
|
||||
* 3. 更糟的是:只要调用过一次(**包括 `'none'`**),窗口就再也不是逐像素透明的了 ——
|
||||
* Electron 会让它回落到默认不透明底色(`backgroundColor` 默认 `#FFF`),
|
||||
* Electron 会让它回落到默认不透明白色底,
|
||||
* 于是从 `glass` 切到 `black` / `tinted` 之后,卡片周围会永久留一圈**纯白**。
|
||||
* 这正好对应"毛玻璃和主题色渐变会出现白底"的现象。
|
||||
* 4. CSS `backdrop-filter: blur()` 也不能替代:透明窗口里 Chromium 采样不到窗口之后的桌面,
|
||||
* 真机实测与不加模糊的像素完全一致(卡片区域离散度都是 12.7)。
|
||||
*
|
||||
* 结论:`glass` 风格改为**纯 CSS 半透明深色卡片**(取 WinIsland 拿不到 host backdrop 时的
|
||||
* 官方降级色 `rgba(32,32,36,0.804)`,见 `docs/dev/winisland-design-tokens.md`),
|
||||
* 官方 80.4% 深色降级底,见 `docs/dev/winisland-design-tokens.md`),
|
||||
* 桌面透过率由卡片自身 alpha 决定,窗口始终保持 `transparent: true` 的逐像素透明。
|
||||
* 回归用例:「个性设置:卡片外圈透出桌面(三种风格都没有白底面板)」。
|
||||
*/
|
||||
@@ -2173,7 +2188,40 @@ class IslandController {
|
||||
}
|
||||
|
||||
getAppearance(): IslandAppearance {
|
||||
return { ...this.appearance };
|
||||
return { ...this.appearance, resolvedAccent: this.effectiveAccent() };
|
||||
}
|
||||
|
||||
/** ClassIsland ColorSource 分支;1/3 取已选调色板,2 取系统强调色。 */
|
||||
private effectiveAccent(): string {
|
||||
const fallback = CLASSISLAND_TOKENS.colors.light.accentPaletteFallback;
|
||||
const { accentSource, accent, accentPalette, accentPaletteIndex } = this.appearance;
|
||||
if (accentSource === 0) return accent || fallback;
|
||||
if (accentSource === 1 || accentSource === 3) {
|
||||
return accentPalette[accentPaletteIndex] ?? fallback;
|
||||
}
|
||||
if (accentSource === 2) {
|
||||
try {
|
||||
let value: string | boolean | undefined;
|
||||
try {
|
||||
value = systemPreferences.getAccentColor?.();
|
||||
} catch {
|
||||
// Windows 旧系统可能只在窗口 API 暴露系统强调色。
|
||||
}
|
||||
if (typeof value !== 'string' && process.platform === 'win32') value = this.win?.getAccentColor();
|
||||
if (typeof value === 'string') {
|
||||
const hex = value.replace('#', '');
|
||||
return `#${hex.length === 8 ? hex.slice(0, 6) : hex.slice(-6)}`;
|
||||
}
|
||||
} catch {
|
||||
// 平台不提供系统强调色时走 ClassIsland 的 DodgerBlue 兜底。
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/** 系统强调色变化时仅刷新“跟随系统”来源,不影响自定义色和其他来源。 */
|
||||
syncSystemAccent(): void {
|
||||
if (this.appearance.accentSource === 2) this.emitAppearance();
|
||||
}
|
||||
|
||||
/** 把外观同步给灵动岛渲染进程(CSS 变量) */
|
||||
@@ -2243,12 +2291,22 @@ const clamp = (value: number, min: number, max: number, fallback: number): numbe
|
||||
/** 夹紧外观取值(越界值直接收敛,避免用户配置破坏布局) */
|
||||
export function normalizeAppearance(input: IslandAppearance): IslandAppearance {
|
||||
const fallbackOf = DEFAULT_ISLAND_APPEARANCE;
|
||||
const accentPalette = Array.isArray(input.accentPalette)
|
||||
? input.accentPalette
|
||||
.filter((value) => typeof value === 'string' && /^#[0-9a-fA-F]{6}$/.test(value))
|
||||
.slice(0, 32)
|
||||
: [...fallbackOf.accentPalette];
|
||||
return {
|
||||
height: clamp(input.height, 36, 72, fallbackOf.height),
|
||||
width: clamp(input.width, 220, 420, fallbackOf.width),
|
||||
radius: clamp(input.radius, 8, 32, fallbackOf.radius),
|
||||
opacity: clamp(input.opacity, 0.4, 1, fallbackOf.opacity),
|
||||
accent: /^#[0-9a-fA-F]{6}$/.test(input.accent) ? input.accent : DEFAULT_ISLAND_APPEARANCE.accent,
|
||||
accentSource: [0, 1, 2, 3].includes(input.accentSource) ? input.accentSource : fallbackOf.accentSource,
|
||||
accentPalette: accentPalette.length ? accentPalette : [...fallbackOf.accentPalette],
|
||||
accentPaletteIndex: Math.round(
|
||||
clamp(input.accentPaletteIndex, 0, Math.max(0, accentPalette.length - 1), 0),
|
||||
),
|
||||
fontSize: clamp(input.fontSize, 11, 20, fallbackOf.fontSize),
|
||||
animations: input.animations !== false,
|
||||
speed: clamp(input.speed, 0.5, 2, fallbackOf.speed),
|
||||
@@ -2336,6 +2394,8 @@ export const island = new IslandController();
|
||||
|
||||
/** 注册灵动岛相关 IPC(主窗口渲染进程 -> 主进程;灵动岛渲染进程 -> 主进程) */
|
||||
export function registerIslandIpc(): void {
|
||||
systemPreferences.on('accent-color-changed', () => island.syncSystemAccent());
|
||||
ipcMain.handle('island:get-theme', () => getConfig().theme);
|
||||
ipcMain.handle('island:get-schedules', (event) =>
|
||||
event.sender === island.getWindow()?.webContents ? island.getSchedules() : [],
|
||||
);
|
||||
|
||||
@@ -403,8 +403,10 @@ export async function verifyLayoutSmoke(
|
||||
await pause();
|
||||
const result = await win.webContents.executeJavaScript(`(() => {
|
||||
const card=document.querySelector('.resident-card'), content=card?.querySelector('.classic-notifications'),r=card?.getBoundingClientRect(),c=content?.getBoundingClientRect();
|
||||
const valid=Boolean(content&&content.textContent.includes('组件化提醒验收')&&card.querySelectorAll('.shape').length===1&&c.left>=r.left-1&&c.right<=r.right+1&&c.bottom<=r.bottom+1);
|
||||
return {valid,card:r?.toJSON(),content:c?.toJSON(),shape:card?.querySelectorAll('.shape').length};
|
||||
const shape=card?.querySelectorAll('.shape').length;
|
||||
const radius=parseFloat(card ? getComputedStyle(card).borderTopLeftRadius : '0');
|
||||
const valid=Boolean(content&&content.textContent.includes('组件化提醒验收')&&shape===0&&radius>0&&c.left>=r.left-1&&c.right<=r.right+1&&c.bottom<=r.bottom+1);
|
||||
return {valid,card:r?.toJSON(),content:c?.toJSON(),shape,radius};
|
||||
})()`);
|
||||
if (!result.valid) throw Error(JSON.stringify(result));
|
||||
return island.getState().mode === 'expanded';
|
||||
|
||||
@@ -910,9 +910,12 @@ export async function verifyResidentSmoke(
|
||||
const solid = await win.webContents.executeJavaScript(`(() => {
|
||||
const card=document.querySelector('${layout === 'custom' ? '.resident-card' : '.island-card'}');
|
||||
if (!card?.classList.contains('message-surface')) return false;
|
||||
const probe=document.createElement('span');probe.style.background='var(--wn-bg)';card.append(probe);
|
||||
const color=getComputedStyle(probe).backgroundColor;probe.remove();
|
||||
return color==='rgb(32, 32, 32)'&&!!card.querySelector('.classic-notifications');
|
||||
let color=getComputedStyle(card).backgroundColor;
|
||||
if (${JSON.stringify(layout)} === 'fixed') {
|
||||
const probe=document.createElement('span');probe.style.background='var(--wn-bg)';card.append(probe);
|
||||
color=getComputedStyle(probe).backgroundColor;probe.remove();
|
||||
}
|
||||
return color!=='transparent'&&!color.includes('rgba')&&!!card.querySelector('.classic-notifications');
|
||||
})()`);
|
||||
if (!solid || Math.abs(win.getOpacity() - 1) > 0.01 || island.getAppearance().opacity !== 0.45)
|
||||
return false;
|
||||
@@ -933,12 +936,15 @@ export async function verifyResidentSmoke(
|
||||
island.setClassState({ inClass: false, currentPeriodEnd: null, week: 1 });
|
||||
saveConfig({ islandLayout: defaultIslandLayouts() });
|
||||
island.syncCustomLayout();
|
||||
await pause();
|
||||
return (
|
||||
!win.isVisible() &&
|
||||
!getConfig().islandLayout.residentEnabled &&
|
||||
(await win.webContents.executeJavaScript(`!document.querySelector('.custom-card')`))
|
||||
await pause(400);
|
||||
const visible = win.isVisible();
|
||||
const residentEnabled = getConfig().islandLayout.residentEnabled;
|
||||
const customDom = await win.webContents.executeJavaScript(
|
||||
`Boolean(document.querySelector('.custom-card'))`,
|
||||
);
|
||||
if (visible || residentEnabled || customDom)
|
||||
throw new Error(JSON.stringify({ visible, residentEnabled, customDom }));
|
||||
return true;
|
||||
});
|
||||
island.setHitTestCursor(null);
|
||||
island.setTouchMode(originalTouchMode);
|
||||
|
||||
@@ -2659,7 +2659,7 @@ async function runIslandChecks(
|
||||
h: style.getPropertyValue('--island-h').trim(),
|
||||
w: style.getPropertyValue('--island-w').trim(),
|
||||
font: style.getPropertyValue('--island-font').trim(),
|
||||
accent: style.getPropertyValue('--island-accent').trim(),
|
||||
accent: style.getPropertyValue('--ci-accent').trim(),
|
||||
};
|
||||
})()`,
|
||||
)
|
||||
@@ -2716,7 +2716,7 @@ async function runIslandChecks(
|
||||
w: style.getPropertyValue('--island-w').trim(),
|
||||
radius: style.getPropertyValue('--island-radius').trim(),
|
||||
font: style.getPropertyValue('--island-font').trim(),
|
||||
accent: style.getPropertyValue('--island-accent').trim(),
|
||||
accent: style.getPropertyValue('--ci-accent').trim(),
|
||||
cardHeight: card ? Math.round(card.getBoundingClientRect().height) : 0,
|
||||
};
|
||||
})()`,
|
||||
@@ -3302,9 +3302,9 @@ async function runIslandChecks(
|
||||
island.setAppearance({ ...appearanceBefore, accent: '#ff7043' });
|
||||
await sleep(200);
|
||||
const accentVar = await islandWindow?.webContents.executeJavaScript(
|
||||
`getComputedStyle(document.documentElement).getPropertyValue('--island-accent').trim()`,
|
||||
`getComputedStyle(document.documentElement).getPropertyValue('--ci-accent').trim()`,
|
||||
);
|
||||
record('个性设置:主题色生效(CSS 变量)', accentVar === '#ff7043', `CSS --island-accent=${accentVar}`);
|
||||
record('个性设置:主题色生效(CSS 变量)', accentVar === '#ff7043', `CSS --ci-accent=${accentVar}`);
|
||||
|
||||
// 11.2b) 三种视觉风格的**底色**:黑 / 毛玻璃 / 主题色渐变都必须是深色卡片
|
||||
// 并且卡片**外面那一圈**必须完全透明(用户反馈:毛玻璃与主题色渐变会出现白底 ——
|
||||
|
||||
@@ -12,6 +12,8 @@ import type { IslandAppearance, IslandState } from '@classhelper/shared';
|
||||
* 只暴露「订阅状态/外观」与「发送用户操作」两件事,渲染进程不接触任何 Node 能力。
|
||||
*/
|
||||
export interface IslandBridge {
|
||||
getTheme(): Promise<'light' | 'dark'>;
|
||||
onTheme(handler: (theme: 'light' | 'dark') => void): void;
|
||||
getIslandWeather(coordinates: { latitude: number; longitude: number }): Promise<IslandWeather>;
|
||||
getLayout(): Promise<ContractIslandLayoutSettings>;
|
||||
saveLayout(value: ContractIslandLayoutSettings): Promise<ContractIslandLayoutSettings>;
|
||||
@@ -62,6 +64,10 @@ export interface IslandBridge {
|
||||
}
|
||||
|
||||
const bridge: IslandBridge = {
|
||||
getTheme: () => ipcRenderer.invoke('island:get-theme'),
|
||||
onTheme: (handler) => {
|
||||
ipcRenderer.on('island:theme', (_event, theme: 'light' | 'dark') => handler(theme));
|
||||
},
|
||||
getIslandWeather: (coordinates) => ipcRenderer.invoke('island:weather', coordinates),
|
||||
getLayout: () => ipcRenderer.invoke('island:get-layout'),
|
||||
saveLayout: (value) => ipcRenderer.invoke('island:save-layout', value),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import {
|
||||
CLASSISLAND_TOKENS,
|
||||
ISLAND_COMPONENT_LABELS,
|
||||
type IslandComponentNode,
|
||||
type IslandComponentKind,
|
||||
@@ -180,8 +181,9 @@ const containers = ['group', 'stack', 'slide', 'rolling'] as const;
|
||||
<el-input-number
|
||||
v-model="node.appearance[key]"
|
||||
:disabled="!node.appearance.resourceOverridingEnabled"
|
||||
:min="8"
|
||||
:max="96"
|
||||
:min="CLASSISLAND_TOKENS.fontSizes.inputMin"
|
||||
:max="CLASSISLAND_TOKENS.fontSizes.inputMax"
|
||||
:step="CLASSISLAND_TOKENS.fontSizes.inputStep"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -234,7 +236,8 @@ const containers = ['group', 'stack', 'slide', 'rolling'] as const;
|
||||
v-if="node.appearance.customCornerRadiusEnabled"
|
||||
v-model="node.appearance.cornerRadius"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:max="CLASSISLAND_TOKENS.radii.islandMax"
|
||||
:step="CLASSISLAND_TOKENS.radii.islandStep"
|
||||
@change="emit('change')"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
@@ -195,10 +195,12 @@
|
||||
flex-direction: column;
|
||||
gap: var(--preview-gap);
|
||||
width: max-content;
|
||||
color: #ffffffeb;
|
||||
padding: 12px;
|
||||
color: var(--ci-text-1);
|
||||
padding: var(--ci-island-pad-x);
|
||||
border-radius: var(--preview-radius);
|
||||
background: #202024;
|
||||
background: var(--preview-background);
|
||||
font-family: var(--ci-font-island);
|
||||
font-weight: var(--ci-font-weight);
|
||||
}
|
||||
.preview-row {
|
||||
display: flex;
|
||||
@@ -212,14 +214,14 @@
|
||||
padding: 0;
|
||||
}
|
||||
.separated .preview-row {
|
||||
padding: 12px;
|
||||
background: #202024;
|
||||
padding: var(--ci-island-pad-x);
|
||||
background: var(--preview-background);
|
||||
}
|
||||
.empty-preview {
|
||||
color: #ffffffb8;
|
||||
color: var(--ci-text-2);
|
||||
background: transparent;
|
||||
border: 1px dashed #ffffff60;
|
||||
border-radius: 5px;
|
||||
border: var(--ci-stroke-island-w) dashed var(--ci-stroke-control);
|
||||
border-radius: var(--ci-radius-control);
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
@@ -246,6 +248,19 @@
|
||||
line-height: 1.6;
|
||||
font-size: 12px;
|
||||
}
|
||||
.font-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: calc(var(--ci-line-gap) * 2);
|
||||
margin: 0 0 18px;
|
||||
padding: var(--ci-popup-pad);
|
||||
border: var(--ci-stroke-island-w) solid var(--ci-stroke-island);
|
||||
border-radius: var(--ci-radius-card);
|
||||
background: var(--ci-island-bg-custom);
|
||||
line-height: var(--ci-line-height-body);
|
||||
overflow: auto;
|
||||
}
|
||||
.component-library {
|
||||
border-top: 1px solid var(--ch-border);
|
||||
margin: 0 -24px;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { onBeforeRouteLeave, useRouter } from 'vue-router';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import {
|
||||
CLASSISLAND_ISLAND_METRICS as METRICS,
|
||||
CLASSISLAND_TOKENS,
|
||||
DEFAULT_ISLAND_APPEARANCE,
|
||||
ISLAND_COMPONENT_LABELS,
|
||||
defaultIslandLayouts,
|
||||
@@ -44,6 +45,63 @@ const scheme = computed(() =>
|
||||
);
|
||||
const rows = computed(() => (surface.value === 'expanded' ? scheme.value.expandedRows : scheme.value.rows));
|
||||
const activeRow = computed(() => rows.value.find((row) => row.id === rowId.value) ?? rows.value[0]!);
|
||||
const fontFields = [
|
||||
{ key: 'secondaryFontSize', label: '辅助文字' },
|
||||
{ key: 'bodyFontSize', label: '正文' },
|
||||
{ key: 'emphasizedFontSize', label: '强调文字' },
|
||||
{ key: 'largeFontSize', label: '大号文字' },
|
||||
] as const;
|
||||
const fontWeights = [
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.thin, label: '100 Thin' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.extraLight, label: '200 ExtraLight' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.light, label: '300 Light' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.normal, label: '400 Normal' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.medium, label: '500 Medium(默认)' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.semiBold, label: '600 SemiBold' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.bold, label: '700 Bold' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.extraBold, label: '800 ExtraBold' },
|
||||
{ value: CLASSISLAND_TOKENS.fontWeights.black, label: '900 Black' },
|
||||
] as const;
|
||||
function rowStyle(row: IslandLayoutRow): Record<string, string> {
|
||||
const style: Record<string, string> = {
|
||||
'--row-gap': `${row.gap}px`,
|
||||
opacity: String(row.opacity),
|
||||
};
|
||||
if (row.fontOverridesEnabled) {
|
||||
style['--ci-fs-secondary'] = `${row.secondaryFontSize}px`;
|
||||
style['--ci-fs-body'] = `${row.bodyFontSize}px`;
|
||||
style['--ci-fs-emphasized'] = `${row.emphasizedFontSize}px`;
|
||||
style['--ci-fs-large'] = `${row.largeFontSize}px`;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
function previewStyle(): Record<string, string> {
|
||||
const foreground: Record<string, string> = scheme.value.customForegroundEnabled
|
||||
? {
|
||||
'--ci-text-1': scheme.value.foreground,
|
||||
'--ci-text-2': `color-mix(in srgb, ${scheme.value.foreground} 85.5%, transparent)`,
|
||||
'--ci-text-3': `color-mix(in srgb, ${scheme.value.foreground} 77.3%, transparent)`,
|
||||
'--ci-text-4': `color-mix(in srgb, ${scheme.value.foreground} 52.9%, transparent)`,
|
||||
'--ci-text-5': `color-mix(in srgb, ${scheme.value.foreground} 36.5%, transparent)`,
|
||||
}
|
||||
: {};
|
||||
return {
|
||||
zoom: String(scheme.value.scale * zoom.value),
|
||||
'--preview-gap': `${scheme.value.spacing}px`,
|
||||
'--preview-radius': `${scheme.value.radius}px`,
|
||||
'--preview-background': scheme.value.customBackgroundEnabled
|
||||
? `color-mix(in srgb, ${scheme.value.color} ${scheme.value.opacity * 100}%, transparent)`
|
||||
: 'var(--ci-bg-secondary)',
|
||||
'--ci-fs-secondary': `${scheme.value.secondaryFontSize}px`,
|
||||
'--ci-fs-body': `${scheme.value.bodyFontSize}px`,
|
||||
'--ci-fs-emphasized': `${scheme.value.emphasizedFontSize}px`,
|
||||
'--ci-fs-large': `${scheme.value.largeFontSize}px`,
|
||||
'--ci-font-weight': String(scheme.value.fontWeight),
|
||||
'--ci-accent': appearance.value.resolvedAccent ?? appearance.value.accent,
|
||||
fontSize: `${scheme.value.bodyFontSize}px`,
|
||||
...foreground,
|
||||
};
|
||||
}
|
||||
const state: IslandState = {
|
||||
mode: 'hidden',
|
||||
active: null,
|
||||
@@ -150,6 +208,12 @@ function addRow() {
|
||||
main: false,
|
||||
allowNotifications: true,
|
||||
gap: 8,
|
||||
opacity: CLASSISLAND_TOKENS.opacity.line,
|
||||
fontOverridesEnabled: false,
|
||||
secondaryFontSize: CLASSISLAND_TOKENS.fontSizes.secondary,
|
||||
bodyFontSize: CLASSISLAND_TOKENS.fontSizes.body,
|
||||
emphasizedFontSize: CLASSISLAND_TOKENS.fontSizes.emphasized,
|
||||
largeFontSize: CLASSISLAND_TOKENS.fontSizes.large,
|
||||
nodes: [],
|
||||
};
|
||||
rows.value.push(row);
|
||||
@@ -693,27 +757,14 @@ function dropPreview(event: PointerEvent) {
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="island-preview"
|
||||
:class="{ separated: scheme.separated }"
|
||||
:style="{
|
||||
zoom: scheme.scale * zoom,
|
||||
'--preview-gap': `${scheme.spacing}px`,
|
||||
'--preview-radius': `${scheme.radius}px`,
|
||||
'--secondary': `${(appearance.fontSize / 13) * 14}px`,
|
||||
'--emphasized': `${(appearance.fontSize / 13) * 18}px`,
|
||||
'--large': `${(appearance.fontSize / 13) * 20}px`,
|
||||
fontSize: `${(appearance.fontSize / 13) * 16}px`,
|
||||
}"
|
||||
>
|
||||
<div v-else class="island-preview" :class="{ separated: scheme.separated }" :style="previewStyle()">
|
||||
<section
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
class="preview-row"
|
||||
:class="{ 'drop-row': drop?.row.id === row.id && !drop.node }"
|
||||
:data-row="row.id"
|
||||
:style="{ gap: `${row.gap}px` }"
|
||||
:style="rowStyle(row)"
|
||||
@click.self="selectRow(row.id)"
|
||||
>
|
||||
<ComponentNode
|
||||
@@ -814,6 +865,30 @@ function dropPreview(event: PointerEvent) {
|
||||
<el-form-item label="组件间距">
|
||||
<el-input-number v-model="activeRow.gap" :min="0" :max="64" @change="save" />
|
||||
</el-form-item>
|
||||
<el-form-item label="整行透明度">
|
||||
<el-slider
|
||||
v-model="activeRow.opacity"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.05"
|
||||
:format-tooltip="(value: number) => value.toFixed(2)"
|
||||
@change="save"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="行级字号覆盖">
|
||||
<el-switch v-model="activeRow.fontOverridesEnabled" @change="save" />
|
||||
</el-form-item>
|
||||
<el-form-item v-for="field in fontFields" :key="field.key" :label="`${field.label}字号(px)`">
|
||||
<el-input-number
|
||||
v-model="activeRow[field.key]"
|
||||
:disabled="!activeRow.fontOverridesEnabled"
|
||||
:min="CLASSISLAND_TOKENS.fontSizes.inputMin"
|
||||
:max="CLASSISLAND_TOKENS.fontSizes.inputMax"
|
||||
:step="CLASSISLAND_TOKENS.fontSizes.inputStep"
|
||||
@change="save"
|
||||
/>
|
||||
</el-form-item>
|
||||
<p class="hint">行级字号只写到当前行根元素;关闭覆盖后回落到方案字号。</p>
|
||||
<el-form-item label="允许显示提醒">
|
||||
<el-switch v-model="activeRow.allowNotifications" @change="save" />
|
||||
</el-form-item>
|
||||
@@ -839,20 +914,81 @@ function dropPreview(event: PointerEvent) {
|
||||
v-model="scheme.scale"
|
||||
:min="METRICS.scaleMin"
|
||||
:max="METRICS.scaleMax"
|
||||
:step="0.05"
|
||||
:step="CLASSISLAND_TOKENS.dpi.scaleStep"
|
||||
@change="save"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="字体字重">
|
||||
<el-select v-model="scheme.fontWeight" @change="save">
|
||||
<el-option
|
||||
v-for="weight in fontWeights"
|
||||
:key="weight.value"
|
||||
:label="weight.label"
|
||||
:value="weight.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-for="field in fontFields" :key="field.key" :label="`${field.label}字号(px)`">
|
||||
<el-input-number
|
||||
v-model="scheme[field.key]"
|
||||
:min="CLASSISLAND_TOKENS.fontSizes.inputMin"
|
||||
:max="CLASSISLAND_TOKENS.fontSizes.inputMax"
|
||||
:step="CLASSISLAND_TOKENS.fontSizes.inputStep"
|
||||
@change="save"
|
||||
/>
|
||||
</el-form-item>
|
||||
<div class="font-preview" aria-label="四档字号预览">
|
||||
<span class="l1" :style="{ fontSize: `${scheme.secondaryFontSize}px` }">辅助文字</span>
|
||||
<span class="l2" :style="{ fontSize: `${scheme.bodyFontSize}px` }">正文示例</span>
|
||||
<span
|
||||
class="l1"
|
||||
:style="{ fontSize: `${scheme.emphasizedFontSize}px`, fontWeight: scheme.fontWeight }"
|
||||
>
|
||||
强调文字
|
||||
</span>
|
||||
<span class="l1" :style="{ fontSize: `${scheme.largeFontSize}px`, fontWeight: scheme.fontWeight }">
|
||||
大号标题
|
||||
</span>
|
||||
</div>
|
||||
<el-form-item label="行间距">
|
||||
<el-slider v-model="scheme.spacing" :min="0" :max="METRICS.rowSpacingMax" @change="save" />
|
||||
</el-form-item>
|
||||
<el-form-item label="常态圆角">
|
||||
<el-slider v-model="scheme.radius" :min="0" :max="METRICS.radiusMax" @change="save" />
|
||||
<el-slider
|
||||
v-model="scheme.radius"
|
||||
:min="0"
|
||||
:max="METRICS.radiusMax"
|
||||
:step="CLASSISLAND_TOKENS.radii.islandStep"
|
||||
@change="save"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义背景色">
|
||||
<el-switch v-model="scheme.customBackgroundEnabled" @change="save" />
|
||||
<el-color-picker v-if="scheme.customBackgroundEnabled" v-model="scheme.color" @change="save" />
|
||||
</el-form-item>
|
||||
<el-form-item label="背景不透明度">
|
||||
<el-slider
|
||||
v-model="scheme.opacity"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.05"
|
||||
:show-tooltip="true"
|
||||
:format-tooltip="(value: number) => value.toFixed(2)"
|
||||
@change="save"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="自定义前景色">
|
||||
<el-switch v-model="scheme.customForegroundEnabled" @change="save" />
|
||||
<el-color-picker v-if="scheme.customForegroundEnabled" v-model="scheme.foreground" @change="save" />
|
||||
</el-form-item>
|
||||
<p class="hint">
|
||||
关闭自定义前景色后回落当前亮/暗主题的五级文字色;开启后按 100% / 85.5% / 77.3% / 52.9% / 36.5%
|
||||
生成颜色 alpha。
|
||||
</p>
|
||||
<el-form-item label="各行分离显示">
|
||||
<el-switch v-model="scheme.separated" @change="save" />
|
||||
</el-form-item>
|
||||
<p class="hint">字体、透明度、位置和动画与灵动岛共用设置。</p>
|
||||
<p class="hint">位置与动画与灵动岛共用设置。</p>
|
||||
<el-button link type="primary" @click="router.push('/settings/island')">前往灵动岛外观设置</el-button>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
@@ -4,14 +4,17 @@ import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { useRouter } from 'vue-router';
|
||||
import {
|
||||
CLASSISLAND_TOKENS,
|
||||
DEFAULT_ISLAND_APPEARANCE,
|
||||
defaultIslandLayouts,
|
||||
ISLAND_APPEARANCE_RANGES as RANGES,
|
||||
ISLAND_ACCENT_SOURCES,
|
||||
ISLAND_POSITION_LABELS,
|
||||
ISLAND_POSITIONS,
|
||||
ISLAND_STYLE_LABELS,
|
||||
ISLAND_STYLES,
|
||||
type IslandAppearance,
|
||||
type IslandAccentColorSource,
|
||||
type IslandPosition,
|
||||
type IslandStyle,
|
||||
} from '@classhelper/shared';
|
||||
@@ -121,6 +124,13 @@ function applyIslandAppearance(patch: Partial<IslandAppearance> = {}): void {
|
||||
window.desktop?.islandSetAppearance({ ...island.value });
|
||||
}
|
||||
|
||||
function setAccentPaletteColor(value: string | null): void {
|
||||
if (!value) return;
|
||||
const palette = [...island.value.accentPalette];
|
||||
palette[island.value.accentPaletteIndex] = value;
|
||||
applyIslandAppearance({ accentPalette: palette });
|
||||
}
|
||||
|
||||
async function saveIslandAppearance(): Promise<void> {
|
||||
if (!window.desktop?.saveConfig) return;
|
||||
savingIsland.value = true;
|
||||
@@ -281,13 +291,49 @@ onMounted(async () => {
|
||||
@input="(value: number) => applyIslandAppearance({ speed: value })"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="主题色">
|
||||
<el-form-item label="强调色来源">
|
||||
<el-select
|
||||
:model-value="island.accentSource"
|
||||
style="width: 180px"
|
||||
@change="(value: IslandAccentColorSource) => applyIslandAppearance({ accentSource: value })"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in ISLAND_ACCENT_SOURCES"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<span class="text-muted ml-8">自定义 / 壁纸 / 跟随系统 / 屏幕主题色,未知来源回落 DodgerBlue</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="island.accentSource === 0" label="主题色">
|
||||
<el-color-picker
|
||||
:model-value="island.accent"
|
||||
@change="(value: string | null) => applyIslandAppearance({ accent: value ?? '#0a84ff' })"
|
||||
@change="
|
||||
(value: string | null) =>
|
||||
applyIslandAppearance({ accent: value ?? CLASSISLAND_TOKENS.colors.light.primaryColor })
|
||||
"
|
||||
/>
|
||||
<span class="text-muted ml-8">用于高亮、按钮与进度条</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-else-if="island.accentSource === 1 || island.accentSource === 3" label="调色板颜色">
|
||||
<el-color-picker
|
||||
:model-value="island.accentPalette[island.accentPaletteIndex]"
|
||||
@change="setAccentPaletteColor"
|
||||
/>
|
||||
<el-input-number
|
||||
:model-value="island.accentPaletteIndex"
|
||||
:min="0"
|
||||
:max="Math.max(0, island.accentPalette.length - 1)"
|
||||
@change="
|
||||
(value: number | undefined) => applyIslandAppearance({ accentPaletteIndex: Number(value ?? 0) })
|
||||
"
|
||||
/>
|
||||
<span class="text-muted ml-8">按 SelectedPlatteIndex 取当前候选颜色</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="主题色">
|
||||
<span class="text-muted">跟随操作系统强调色;不可用时回落 DodgerBlue</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="视觉风格">
|
||||
<span v-if="layoutMode === 'custom'">ClassIsland · 半透明横条</span>
|
||||
<el-select
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { isDayKey } from './utils.js';
|
||||
import { CLASSISLAND_TOKENS, classislandFontWeight } from './constants.js';
|
||||
|
||||
export const ISLAND_COMPONENTS = [
|
||||
'date',
|
||||
@@ -18,21 +19,21 @@ export const ISLAND_COMPONENTS = [
|
||||
] as const;
|
||||
/** ClassIsland master:MainWindowLine 与 Models/Settings.cs(2026-10-17 核对)。 */
|
||||
export const CLASSISLAND_ISLAND_METRICS = {
|
||||
rowHeight: 40,
|
||||
horizontalPadding: 12,
|
||||
radius: 8,
|
||||
opacity: 0.5,
|
||||
scale: 1,
|
||||
scaleMin: 0.75,
|
||||
scaleMax: 2.5,
|
||||
radiusMax: 20,
|
||||
rowHeight: CLASSISLAND_TOKENS.spacing.islandHeight,
|
||||
horizontalPadding: CLASSISLAND_TOKENS.spacing.islandPadX,
|
||||
radius: CLASSISLAND_TOKENS.radii.island,
|
||||
opacity: CLASSISLAND_TOKENS.opacity.islandBackground,
|
||||
scale: CLASSISLAND_TOKENS.dpi.scale,
|
||||
scaleMin: CLASSISLAND_TOKENS.dpi.scaleMin,
|
||||
scaleMax: CLASSISLAND_TOKENS.dpi.scaleMax,
|
||||
radiusMax: CLASSISLAND_TOKENS.radii.islandMax,
|
||||
rowSpacingMax: 150,
|
||||
secondaryFontSize: 14,
|
||||
bodyFontSize: 16,
|
||||
emphasizedFontSize: 18,
|
||||
largeFontSize: 20,
|
||||
rowSpacing: 5,
|
||||
fadedOpacity: 0.05,
|
||||
secondaryFontSize: CLASSISLAND_TOKENS.fontSizes.secondary,
|
||||
bodyFontSize: CLASSISLAND_TOKENS.fontSizes.body,
|
||||
emphasizedFontSize: CLASSISLAND_TOKENS.fontSizes.emphasized,
|
||||
largeFontSize: CLASSISLAND_TOKENS.fontSizes.large,
|
||||
rowSpacing: CLASSISLAND_TOKENS.spacing.lineGap,
|
||||
fadedOpacity: CLASSISLAND_TOKENS.opacity.pointerFaded,
|
||||
} as const;
|
||||
export type IslandComponentKind = (typeof ISLAND_COMPONENTS)[number];
|
||||
export interface IslandWeather {
|
||||
@@ -74,6 +75,13 @@ export interface ComponentAppearance {
|
||||
cornerRadius: number;
|
||||
opacity: number;
|
||||
}
|
||||
/** 四档核心字号;组件与行级覆盖共用同一字段名。 */
|
||||
export interface IslandFontSizes {
|
||||
secondaryFontSize: number;
|
||||
bodyFontSize: number;
|
||||
emphasizedFontSize: number;
|
||||
largeFontSize: number;
|
||||
}
|
||||
export interface IslandComponentNode {
|
||||
id: string;
|
||||
kind: IslandComponentKind;
|
||||
@@ -112,6 +120,14 @@ export interface IslandLayoutRow {
|
||||
main: boolean;
|
||||
allowNotifications: boolean;
|
||||
gap: number;
|
||||
/** 整行透明度,默认 1;不再与背景 alpha 相乘。 */
|
||||
opacity: number;
|
||||
/** 是否把四档字号写到这一行根元素,只影响本行。 */
|
||||
fontOverridesEnabled: boolean;
|
||||
secondaryFontSize: number;
|
||||
bodyFontSize: number;
|
||||
emphasizedFontSize: number;
|
||||
largeFontSize: number;
|
||||
nodes: IslandComponentNode[];
|
||||
}
|
||||
export interface IslandLayoutScheme {
|
||||
@@ -123,8 +139,17 @@ export interface IslandLayoutScheme {
|
||||
scale: number;
|
||||
color: string;
|
||||
foreground: string;
|
||||
/** false 时回落当前亮/暗主题背景。 */
|
||||
customBackgroundEnabled: boolean;
|
||||
/** false 时回落当前亮/暗主题的 5 级前景色。 */
|
||||
customForegroundEnabled: boolean;
|
||||
opacity: number;
|
||||
radius: number;
|
||||
fontWeight: number;
|
||||
secondaryFontSize: number;
|
||||
bodyFontSize: number;
|
||||
emphasizedFontSize: number;
|
||||
largeFontSize: number;
|
||||
separated: boolean;
|
||||
spacing: number;
|
||||
}
|
||||
@@ -166,10 +191,21 @@ function defaultExpandedRows(): IslandLayoutRow[] {
|
||||
main: true,
|
||||
allowNotifications: false,
|
||||
gap: 12,
|
||||
opacity: CLASSISLAND_TOKENS.opacity.line,
|
||||
fontOverridesEnabled: false,
|
||||
...defaultCoreFontSizes(),
|
||||
nodes: [islandNode('date', 'expanded-date'), course],
|
||||
},
|
||||
];
|
||||
}
|
||||
function defaultCoreFontSizes(): IslandFontSizes {
|
||||
return {
|
||||
secondaryFontSize: CLASSISLAND_TOKENS.fontSizes.secondary,
|
||||
bodyFontSize: CLASSISLAND_TOKENS.fontSizes.body,
|
||||
emphasizedFontSize: CLASSISLAND_TOKENS.fontSizes.emphasized,
|
||||
largeFontSize: CLASSISLAND_TOKENS.fontSizes.large,
|
||||
};
|
||||
}
|
||||
export function islandNode(kind: IslandComponentKind, id: string): IslandComponentNode {
|
||||
return {
|
||||
id,
|
||||
@@ -197,19 +233,16 @@ export function islandNode(kind: IslandComponentKind, id: string): IslandCompone
|
||||
},
|
||||
appearance: {
|
||||
resourceOverridingEnabled: false,
|
||||
secondaryFontSize: 14,
|
||||
bodyFontSize: 16,
|
||||
emphasizedFontSize: 18,
|
||||
largeFontSize: 20,
|
||||
...defaultCoreFontSizes(),
|
||||
customForegroundEnabled: false,
|
||||
foreground: '#ffffff',
|
||||
foreground: CLASSISLAND_TOKENS.colors.light.textOnAccent,
|
||||
customBackgroundEnabled: false,
|
||||
background: '#202024',
|
||||
background: CLASSISLAND_TOKENS.colors.light.islandBgCustom,
|
||||
customBackgroundOpacityEnabled: false,
|
||||
backgroundOpacity: 0.5,
|
||||
backgroundOpacity: CLASSISLAND_TOKENS.opacity.islandBackground,
|
||||
customCornerRadiusEnabled: false,
|
||||
cornerRadius: 16,
|
||||
opacity: 1,
|
||||
cornerRadius: CLASSISLAND_TOKENS.radii.island,
|
||||
opacity: CLASSISLAND_TOKENS.opacity.line,
|
||||
},
|
||||
advanced: { hideRules: [], align: 'stretch', width: 0, maxWidth: 0 },
|
||||
};
|
||||
@@ -234,6 +267,9 @@ export function defaultIslandLayouts(): IslandLayoutSettings {
|
||||
main: true,
|
||||
allowNotifications: true,
|
||||
gap: 12,
|
||||
opacity: CLASSISLAND_TOKENS.opacity.line,
|
||||
fontOverridesEnabled: false,
|
||||
...defaultCoreFontSizes(),
|
||||
nodes: [
|
||||
islandNode('date', 'date'),
|
||||
islandNode('clock', 'clock'),
|
||||
@@ -243,12 +279,16 @@ export function defaultIslandLayouts(): IslandLayoutSettings {
|
||||
},
|
||||
],
|
||||
scale: 1,
|
||||
color: '#000000',
|
||||
foreground: '#ffffff',
|
||||
opacity: 0.5,
|
||||
radius: 8,
|
||||
color: CLASSISLAND_TOKENS.colors.light.islandBgCustom,
|
||||
foreground: CLASSISLAND_TOKENS.colors.light.textOnAccent,
|
||||
customBackgroundEnabled: true,
|
||||
customForegroundEnabled: true,
|
||||
opacity: CLASSISLAND_TOKENS.opacity.islandBackground,
|
||||
radius: CLASSISLAND_TOKENS.radii.island,
|
||||
fontWeight: CLASSISLAND_TOKENS.fontWeights.medium,
|
||||
...defaultCoreFontSizes(),
|
||||
separated: false,
|
||||
spacing: 5,
|
||||
spacing: CLASSISLAND_TOKENS.spacing.lineGap,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -304,19 +344,44 @@ export function normalizeIslandLayouts(input: unknown): IslandLayoutSettings {
|
||||
},
|
||||
appearance: {
|
||||
resourceOverridingEnabled: a.resourceOverridingEnabled === true,
|
||||
secondaryFontSize: clamp(a.secondaryFontSize, 8, 96, 14),
|
||||
bodyFontSize: clamp(a.bodyFontSize, 8, 96, 16),
|
||||
emphasizedFontSize: clamp(a.emphasizedFontSize, 8, 96, 18),
|
||||
largeFontSize: clamp(a.largeFontSize, 8, 128, 20),
|
||||
secondaryFontSize: clamp(
|
||||
a.secondaryFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.secondary,
|
||||
),
|
||||
bodyFontSize: clamp(
|
||||
a.bodyFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.body,
|
||||
),
|
||||
emphasizedFontSize: clamp(
|
||||
a.emphasizedFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.emphasized,
|
||||
),
|
||||
largeFontSize: clamp(
|
||||
a.largeFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.large,
|
||||
),
|
||||
customForegroundEnabled: a.customForegroundEnabled === true,
|
||||
foreground: color(a.foreground, '#ffffff'),
|
||||
foreground: color(a.foreground, CLASSISLAND_TOKENS.colors.light.textOnAccent),
|
||||
customBackgroundEnabled: a.customBackgroundEnabled === true,
|
||||
background: color(a.background, '#202024'),
|
||||
background: color(a.background, CLASSISLAND_TOKENS.colors.light.islandBgCustom),
|
||||
customBackgroundOpacityEnabled: a.customBackgroundOpacityEnabled === true,
|
||||
backgroundOpacity: clamp(a.backgroundOpacity, 0, 1, 0.5),
|
||||
backgroundOpacity: clamp(a.backgroundOpacity, 0, 1, CLASSISLAND_TOKENS.opacity.islandBackground),
|
||||
customCornerRadiusEnabled: a.customCornerRadiusEnabled === true,
|
||||
cornerRadius: clamp(a.cornerRadius, 0, 100, 16),
|
||||
opacity: clamp(a.opacity, 0, 1, 1),
|
||||
cornerRadius: clamp(
|
||||
a.cornerRadius,
|
||||
0,
|
||||
CLASSISLAND_TOKENS.radii.islandMax,
|
||||
CLASSISLAND_TOKENS.radii.island,
|
||||
),
|
||||
opacity: clamp(a.opacity, 0, 1, CLASSISLAND_TOKENS.opacity.line),
|
||||
},
|
||||
advanced: {
|
||||
hideRules: Array.isArray(adv.hideRules)
|
||||
@@ -341,6 +406,32 @@ export function normalizeIslandLayouts(input: unknown): IslandLayoutSettings {
|
||||
main: r.main === true,
|
||||
allowNotifications: r.allowNotifications !== false,
|
||||
gap: clamp(r.gap, 0, 64, 8),
|
||||
opacity: clamp(r.opacity, 0, 1, CLASSISLAND_TOKENS.opacity.line),
|
||||
fontOverridesEnabled: r.fontOverridesEnabled === true,
|
||||
secondaryFontSize: clamp(
|
||||
r.secondaryFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.secondary,
|
||||
),
|
||||
bodyFontSize: clamp(
|
||||
r.bodyFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.body,
|
||||
),
|
||||
emphasizedFontSize: clamp(
|
||||
r.emphasizedFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.emphasized,
|
||||
),
|
||||
largeFontSize: clamp(
|
||||
r.largeFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.large,
|
||||
),
|
||||
nodes: (Array.isArray(r.nodes) ? r.nodes : [])
|
||||
.map((n) => node(n, 0))
|
||||
.filter((n): n is IslandComponentNode => Boolean(n)),
|
||||
@@ -373,12 +464,49 @@ export function normalizeIslandLayouts(input: unknown): IslandLayoutSettings {
|
||||
resident ? CLASSISLAND_ISLAND_METRICS.scaleMax : 3,
|
||||
1,
|
||||
),
|
||||
color: color(scheme.color, '#000000'),
|
||||
foreground: color(scheme.foreground, '#ffffff'),
|
||||
opacity: clamp(scheme.opacity, resident ? 0 : 0.1, 1, 0.5),
|
||||
radius: clamp(scheme.radius, 0, resident ? CLASSISLAND_ISLAND_METRICS.radiusMax : 100, 8),
|
||||
color: color(scheme.color, CLASSISLAND_TOKENS.colors.light.islandBgCustom),
|
||||
foreground: color(scheme.foreground, CLASSISLAND_TOKENS.colors.light.textOnAccent),
|
||||
customBackgroundEnabled: scheme.customBackgroundEnabled !== false,
|
||||
customForegroundEnabled: scheme.customForegroundEnabled !== false,
|
||||
opacity: clamp(scheme.opacity, resident ? 0 : 0.1, 1, CLASSISLAND_TOKENS.opacity.islandBackground),
|
||||
radius: clamp(
|
||||
scheme.radius,
|
||||
0,
|
||||
resident ? CLASSISLAND_ISLAND_METRICS.radiusMax : 100,
|
||||
CLASSISLAND_TOKENS.radii.island,
|
||||
),
|
||||
fontWeight: classislandFontWeight(scheme.fontWeight),
|
||||
secondaryFontSize: clamp(
|
||||
scheme.secondaryFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.secondary,
|
||||
),
|
||||
bodyFontSize: clamp(
|
||||
scheme.bodyFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.body,
|
||||
),
|
||||
emphasizedFontSize: clamp(
|
||||
scheme.emphasizedFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.emphasized,
|
||||
),
|
||||
largeFontSize: clamp(
|
||||
scheme.largeFontSize,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMin,
|
||||
CLASSISLAND_TOKENS.fontSizes.inputMax,
|
||||
CLASSISLAND_TOKENS.fontSizes.large,
|
||||
),
|
||||
separated: scheme.separated === true,
|
||||
spacing: clamp(scheme.spacing, 0, resident ? CLASSISLAND_ISLAND_METRICS.rowSpacingMax : 100, 5),
|
||||
spacing: clamp(
|
||||
scheme.spacing,
|
||||
0,
|
||||
resident ? CLASSISLAND_ISLAND_METRICS.rowSpacingMax : 100,
|
||||
CLASSISLAND_TOKENS.spacing.lineGap,
|
||||
),
|
||||
});
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -1143,6 +1143,8 @@ export interface IslandNotification {
|
||||
}
|
||||
|
||||
/** 灵动岛外观设置(设置页可调,主进程持久化并按此驱动窗口与渲染进程) */
|
||||
export type IslandAccentColorSource = 0 | 1 | 2 | 3;
|
||||
|
||||
export interface IslandAppearance {
|
||||
/** 胶囊高度(px,36~72):展开卡高度按比例联动,保证布局不错乱 */
|
||||
height: number;
|
||||
@@ -1154,6 +1156,16 @@ export interface IslandAppearance {
|
||||
opacity: number;
|
||||
/** 主题色(强调色,用于高亮与按钮) */
|
||||
accent: string;
|
||||
/**
|
||||
* ClassIsland 强调色来源:
|
||||
* 0=自定义、1=壁纸主题色、2=跟随系统、3=屏幕主题色。
|
||||
*/
|
||||
accentSource: IslandAccentColorSource;
|
||||
/** 壁纸/屏幕主题色候选;来源为 1 或 3 时按索引取色。 */
|
||||
accentPalette: string[];
|
||||
accentPaletteIndex: number;
|
||||
/** 主进程按 accentSource 解析出的只读实际颜色,不参与用户选择。 */
|
||||
resolvedAccent?: string;
|
||||
/**
|
||||
* 基础字号(px,11~20)——参考 WinIsland 的 font_size:
|
||||
* 岛内**所有文本**都由它乘以各自的排版系数得出,因此改字号会整体等比缩放。
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
@import './tokens.css';
|
||||
:root:root {
|
||||
--el-color-primary: var(--ch-ui-primary);
|
||||
--el-color-primary-light-3: color-mix(in srgb, var(--ch-ui-primary) 70%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-5: color-mix(in srgb, var(--ch-ui-primary) 50%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-7: color-mix(in srgb, var(--ch-ui-primary) 30%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-8: color-mix(in srgb, var(--ch-ui-primary) 20%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-9: color-mix(in srgb, var(--ch-ui-primary) 10%, var(--ch-ui-surface));
|
||||
--el-color-primary-dark-2: color-mix(in srgb, var(--ch-ui-primary) 80%, #000);
|
||||
/* ClassIsland accent 的单一入口;改 --ci-accent 时 Element Plus 同步派生。 */
|
||||
--el-color-primary: var(--ci-accent);
|
||||
--el-color-primary-light-3: color-mix(in srgb, var(--ci-accent) 70%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-5: color-mix(in srgb, var(--ci-accent) 50%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-7: color-mix(in srgb, var(--ci-accent) 30%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-8: color-mix(in srgb, var(--ci-accent) 20%, var(--ch-ui-surface));
|
||||
--el-color-primary-light-9: color-mix(in srgb, var(--ci-accent) 10%, var(--ch-ui-surface));
|
||||
--el-color-primary-dark-2: color-mix(in srgb, var(--ci-accent) 80%, black);
|
||||
--el-border-radius-base: var(--ch-ui-radius);
|
||||
--el-bg-color: var(--ch-ui-surface);
|
||||
--el-bg-color-overlay: var(--ch-ui-surface);
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
/*
|
||||
* 设计 token 分两层:
|
||||
* - --ch-ui-*:应用外壳(设置中心、管理页);
|
||||
* - --ci-*:ClassIsland 岛与课程信息层。
|
||||
*
|
||||
* --ci-* 的亮/暗键集合必须完全一致。组件只消费 token,不在局部重定义颜色;
|
||||
* 行级字号与自定义前景色是唯一允许的元素级覆盖。
|
||||
* ClassIsland 源值使用 AARRGGBB;CSS 统一转换为 RRGGBBAA。
|
||||
*/
|
||||
:root {
|
||||
--ch-ui-primary: #5d6bfa;
|
||||
--ch-ui-bg: #f7f8fa;
|
||||
@@ -9,7 +18,164 @@
|
||||
--ch-ui-radius: 8px;
|
||||
--ch-ui-gap: 16px;
|
||||
--ch-ui-shadow: 0 8px 30px rgb(30 40 70 / 8%);
|
||||
--ch-z-guide: 10000;
|
||||
--ch-z-view-old: 1;
|
||||
--ch-z-view-new: 2;
|
||||
|
||||
--ci-accent: #00bfff;
|
||||
--ci-accent-2: #7fffd4;
|
||||
--ci-accent-fallback: #1e90ff;
|
||||
--ci-accent-palette-fallback: #1e90ff;
|
||||
--ci-accent-fill: var(--ci-accent);
|
||||
--ci-accent-fill-tertiary: color-mix(in srgb, var(--ci-accent) 16%, transparent);
|
||||
--ci-accent-text: var(--ci-accent);
|
||||
--ci-text-on-accent: #ffffff;
|
||||
--ci-accent-soft: color-mix(in srgb, var(--ci-accent) 10%, transparent);
|
||||
|
||||
--ci-text-1: #000000e4;
|
||||
--ci-text-2: #000000c0;
|
||||
--ci-text-3: #00000072;
|
||||
--ci-text-4: #0000005c;
|
||||
--ci-text-5: #0000002e;
|
||||
|
||||
--ci-bg-base: #f3f3f3;
|
||||
--ci-bg-secondary: #eeeeee;
|
||||
--ci-bg-tertiary: #f9f9f9;
|
||||
--ci-fill-secondary: #0000000a;
|
||||
--ci-smoke: #00000066;
|
||||
--ci-island-bg-custom: #000000;
|
||||
--ci-island-opacity: 0.5;
|
||||
--ci-island-bg-opacity: var(--ci-island-opacity);
|
||||
--ci-line-opacity: 1;
|
||||
--ci-pointer-faded-opacity: 0.05;
|
||||
|
||||
--ci-stroke-island: color-mix(in srgb, var(--ci-accent) 24%, transparent);
|
||||
--ci-stroke-island-w: 1px;
|
||||
--ci-stroke-control: #00000024;
|
||||
--ci-stroke-divider: #00000014;
|
||||
--ci-stroke-flyout: #0000001b;
|
||||
--ci-fill-strong: #00000072;
|
||||
--ci-stroke-card: #00000016;
|
||||
--ci-stroke-drag: var(--ci-accent-text);
|
||||
--ci-stroke-tutorial: var(--ci-accent-text);
|
||||
--ci-stroke-tutorial-w: 2.5px;
|
||||
--ci-stroke-tutorial-corner-w: 3px;
|
||||
|
||||
--ci-aqi-1: #228b22;
|
||||
--ci-aqi-2: #cccc00;
|
||||
--ci-aqi-3: #ff8c00;
|
||||
--ci-aqi-4: #cd5c5c;
|
||||
--ci-aqi-5: #8b0000;
|
||||
--ci-aqi-6: #800080;
|
||||
--ci-weather-rain: #0000ff;
|
||||
--ci-glow-class: #ffff00;
|
||||
--ci-glow-class-blur: 6px;
|
||||
--ci-danger: #cd5c5c;
|
||||
--ci-warning-critical: #c42b1c;
|
||||
--ci-warning-caution: #9d5d00;
|
||||
--ci-warning-caution-bg: #fff4ce;
|
||||
|
||||
--ci-shadow-island: 0 4px 8px 2px #00000048;
|
||||
--ci-shadow-mask: 0 8px 32px 0 #00000066;
|
||||
--ci-shadow-drawer: 0 8px 32px 0 #00000066;
|
||||
--ci-shadow-drawer-x: 0 0 8px #00000033;
|
||||
--ci-shadow-classic-mask: 0 0 8px #000000;
|
||||
--ci-shadow-adorn: 0 0 8px #00000066;
|
||||
--ci-mask-fade: linear-gradient(to bottom, #ffffff00, #ffffff00 65%, #ffffff);
|
||||
--ci-scrim-tutorial: #00000099;
|
||||
--ci-debug-bg: #22222277;
|
||||
--ci-splash-bg: #11111188;
|
||||
--ci-brand-gradient-a: #0c0e1f;
|
||||
--ci-brand-gradient-b: #0d1111;
|
||||
--ci-brand-dark: #0d1111;
|
||||
--ci-ripple: var(--ci-accent-fill);
|
||||
--ci-ripple-stroke: 200;
|
||||
|
||||
--ci-font:
|
||||
'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;
|
||||
--ci-font-island: var(--ci-font);
|
||||
--ci-font-harmony: 'HarmonyOS Sans SC', 'Microsoft YaHei UI', SimHei;
|
||||
--ci-font-backend: 'Microsoft YaHei UI';
|
||||
--ci-font-icon-fluent: 'FluentSystemIcons-Resizable';
|
||||
--ci-font-icon-lucide: 'lucide';
|
||||
--ci-font-icon-sf: 'SF-Symbols';
|
||||
--ci-fw-thin: 100;
|
||||
--ci-fw-extra-light: 200;
|
||||
--ci-fw-light: 300;
|
||||
--ci-fw-normal: 400;
|
||||
--ci-fw-medium: 500;
|
||||
--ci-fw-semi-bold: 600;
|
||||
--ci-fw-bold: 700;
|
||||
--ci-fw-extra-bold: 800;
|
||||
--ci-fw-black: 900;
|
||||
--ci-font-weight: var(--ci-fw-medium);
|
||||
--ci-line-height-body: 1.25;
|
||||
--ci-line-height-caption: 1.6;
|
||||
|
||||
--ci-fs-secondary: 14px;
|
||||
--ci-fs-body: 16px;
|
||||
--ci-fs-emphasized: 18px;
|
||||
--ci-fs-large: 20px;
|
||||
--ci-fs-version: 9px;
|
||||
--ci-fs-caption: 12px;
|
||||
--ci-fs-control-base: 13px;
|
||||
--ci-fs-label: 14px;
|
||||
--ci-fs-title: 16px;
|
||||
--ci-fs-rolling: 17px;
|
||||
--ci-fs-oobe-body: 18px;
|
||||
--ci-fs-brand: 20px;
|
||||
--ci-fs-weather: 22px;
|
||||
--ci-fs-oobe-title: 32px;
|
||||
|
||||
--ci-radius-island: 8px;
|
||||
--ci-radius-island-local: 0;
|
||||
--ci-radius-popup: 6px;
|
||||
--ci-radius-card: 4px;
|
||||
--ci-radius-control: 4px;
|
||||
--ci-radius-drawer: 8px 8px 0 0;
|
||||
--ci-radius-pill: 999px;
|
||||
--ci-radius-icon-btn: 14px;
|
||||
--ci-radius-oobe-btn: 24px;
|
||||
|
||||
--ci-island-height: 40px;
|
||||
--ci-island-pad-x: 12px;
|
||||
--ci-island-min-w: 20px;
|
||||
--ci-component-gap: 12px;
|
||||
--ci-line-gap: 5px;
|
||||
--ci-settings-pad: 12px 12px 18px 12px;
|
||||
--ci-settings-max-w: 960px;
|
||||
--ci-component-settings-pad: 4px 0 4px 12px;
|
||||
--ci-popup-pad: 12px;
|
||||
--ci-theme-card-h: 150px;
|
||||
--ci-theme-card-w: 328px;
|
||||
--ci-editbar-bottom: 64px;
|
||||
--ci-splash-w: 400px;
|
||||
--ci-splash-h: 100px;
|
||||
--ci-progress-height: 3px;
|
||||
--ci-island-pad-factor: 0.78;
|
||||
--ci-island-gap-factor: 0.62;
|
||||
|
||||
--ci-window-transparent: transparent;
|
||||
--ci-edit-blur: 16px;
|
||||
--ci-effect-scale: 1;
|
||||
|
||||
--ci-z-window: 0;
|
||||
--ci-z-window-top: 1;
|
||||
--ci-z-content: 0;
|
||||
--ci-z-mask: 1;
|
||||
--ci-z-drag: 1;
|
||||
--ci-z-drawer: 10;
|
||||
--ci-z-timeline-adorn: 9999;
|
||||
--ci-z-sentinel: 2147483647;
|
||||
|
||||
--ci-dpi-basis: 96;
|
||||
--ci-scale: 1;
|
||||
--ci-vertical-safe-area: 20px;
|
||||
--ci-tutorial-safe-area: 150;
|
||||
--ci-duration: 200ms;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
--ch-ui-bg: #14161a;
|
||||
--ch-ui-surface: #1d2027;
|
||||
@@ -18,4 +184,182 @@ html.dark {
|
||||
--ch-ui-text: #e9edf5;
|
||||
--ch-ui-muted: #a2abbd;
|
||||
--ch-ui-shadow: 0 8px 30px rgb(0 0 0 / 25%);
|
||||
|
||||
--ci-accent: #00bfff;
|
||||
--ci-accent-2: #7fffd4;
|
||||
--ci-accent-fallback: #1e90ff;
|
||||
--ci-accent-palette-fallback: #1e90ff;
|
||||
--ci-accent-fill: var(--ci-accent);
|
||||
--ci-accent-fill-tertiary: color-mix(in srgb, var(--ci-accent) 16%, transparent);
|
||||
--ci-accent-text: var(--ci-accent);
|
||||
--ci-text-on-accent: #ffffff;
|
||||
--ci-accent-soft: color-mix(in srgb, var(--ci-accent) 10%, transparent);
|
||||
|
||||
--ci-text-1: #ffffffff;
|
||||
--ci-text-2: #ffffffda;
|
||||
--ci-text-3: #ffffffc5;
|
||||
--ci-text-4: #ffffff87;
|
||||
--ci-text-5: #ffffff5d;
|
||||
|
||||
--ci-bg-base: #202020;
|
||||
--ci-bg-secondary: #1c1c1c;
|
||||
--ci-bg-tertiary: #282828;
|
||||
--ci-fill-secondary: #ffffff14;
|
||||
--ci-smoke: #00000066;
|
||||
--ci-island-bg-custom: #000000;
|
||||
--ci-island-opacity: 0.5;
|
||||
--ci-island-bg-opacity: var(--ci-island-opacity);
|
||||
--ci-line-opacity: 1;
|
||||
--ci-pointer-faded-opacity: 0.05;
|
||||
|
||||
--ci-stroke-island: color-mix(in srgb, var(--ci-accent) 28%, transparent);
|
||||
--ci-stroke-island-w: 1px;
|
||||
--ci-stroke-control: #ffffff3d;
|
||||
--ci-stroke-divider: #ffffff26;
|
||||
--ci-stroke-flyout: #ffffff33;
|
||||
--ci-fill-strong: #ffffff8a;
|
||||
--ci-stroke-card: #ffffff26;
|
||||
--ci-stroke-drag: var(--ci-accent-text);
|
||||
--ci-stroke-tutorial: var(--ci-accent-text);
|
||||
--ci-stroke-tutorial-w: 2.5px;
|
||||
--ci-stroke-tutorial-corner-w: 3px;
|
||||
|
||||
--ci-aqi-1: #3cb371;
|
||||
--ci-aqi-2: #ffff00;
|
||||
--ci-aqi-3: #ffa500;
|
||||
--ci-aqi-4: #cd5c5c;
|
||||
--ci-aqi-5: #8b0000;
|
||||
--ci-aqi-6: #9370db;
|
||||
--ci-weather-rain: #00bfff;
|
||||
--ci-glow-class: #ffff00;
|
||||
--ci-glow-class-blur: 2px;
|
||||
--ci-danger: #cd5c5c;
|
||||
--ci-warning-critical: #ff99a4;
|
||||
--ci-warning-caution: #fce100;
|
||||
--ci-warning-caution-bg: #433519;
|
||||
|
||||
--ci-shadow-island: 0 4px 8px 2px #00000048;
|
||||
--ci-shadow-mask: 0 8px 32px 0 #00000066;
|
||||
--ci-shadow-drawer: 0 8px 32px 0 #00000066;
|
||||
--ci-shadow-drawer-x: 0 0 8px #00000033;
|
||||
--ci-shadow-classic-mask: 0 0 8px #000000;
|
||||
--ci-shadow-adorn: 0 0 8px #00000066;
|
||||
--ci-mask-fade: linear-gradient(to bottom, #ffffff00, #ffffff00 65%, #ffffff);
|
||||
--ci-scrim-tutorial: #00000099;
|
||||
--ci-debug-bg: #22222277;
|
||||
--ci-splash-bg: #11111188;
|
||||
--ci-brand-gradient-a: #0c0e1f;
|
||||
--ci-brand-gradient-b: #0d1111;
|
||||
--ci-brand-dark: #0d1111;
|
||||
--ci-ripple: var(--ci-accent-fill);
|
||||
--ci-ripple-stroke: 200;
|
||||
|
||||
--ci-font:
|
||||
'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;
|
||||
--ci-font-island: var(--ci-font);
|
||||
--ci-font-harmony: 'HarmonyOS Sans SC', 'Microsoft YaHei UI', SimHei;
|
||||
--ci-font-backend: 'Microsoft YaHei UI';
|
||||
--ci-font-icon-fluent: 'FluentSystemIcons-Resizable';
|
||||
--ci-font-icon-lucide: 'lucide';
|
||||
--ci-font-icon-sf: 'SF-Symbols';
|
||||
--ci-fw-thin: 100;
|
||||
--ci-fw-extra-light: 200;
|
||||
--ci-fw-light: 300;
|
||||
--ci-fw-normal: 400;
|
||||
--ci-fw-medium: 500;
|
||||
--ci-fw-semi-bold: 600;
|
||||
--ci-fw-bold: 700;
|
||||
--ci-fw-extra-bold: 800;
|
||||
--ci-fw-black: 900;
|
||||
--ci-font-weight: var(--ci-fw-medium);
|
||||
--ci-line-height-body: 1.25;
|
||||
--ci-line-height-caption: 1.6;
|
||||
|
||||
--ci-fs-secondary: 14px;
|
||||
--ci-fs-body: 16px;
|
||||
--ci-fs-emphasized: 18px;
|
||||
--ci-fs-large: 20px;
|
||||
--ci-fs-version: 9px;
|
||||
--ci-fs-caption: 12px;
|
||||
--ci-fs-control-base: 13px;
|
||||
--ci-fs-label: 14px;
|
||||
--ci-fs-title: 16px;
|
||||
--ci-fs-rolling: 17px;
|
||||
--ci-fs-oobe-body: 18px;
|
||||
--ci-fs-brand: 20px;
|
||||
--ci-fs-weather: 22px;
|
||||
--ci-fs-oobe-title: 32px;
|
||||
|
||||
--ci-radius-island: 8px;
|
||||
--ci-radius-island-local: 0;
|
||||
--ci-radius-popup: 6px;
|
||||
--ci-radius-card: 4px;
|
||||
--ci-radius-control: 4px;
|
||||
--ci-radius-drawer: 8px 8px 0 0;
|
||||
--ci-radius-pill: 999px;
|
||||
--ci-radius-icon-btn: 14px;
|
||||
--ci-radius-oobe-btn: 24px;
|
||||
|
||||
--ci-island-height: 40px;
|
||||
--ci-island-pad-x: 12px;
|
||||
--ci-island-min-w: 20px;
|
||||
--ci-component-gap: 12px;
|
||||
--ci-line-gap: 5px;
|
||||
--ci-settings-pad: 12px 12px 18px 12px;
|
||||
--ci-settings-max-w: 960px;
|
||||
--ci-component-settings-pad: 4px 0 4px 12px;
|
||||
--ci-popup-pad: 12px;
|
||||
--ci-theme-card-h: 150px;
|
||||
--ci-theme-card-w: 328px;
|
||||
--ci-editbar-bottom: 64px;
|
||||
--ci-splash-w: 400px;
|
||||
--ci-splash-h: 100px;
|
||||
--ci-progress-height: 3px;
|
||||
--ci-island-pad-factor: 0.78;
|
||||
--ci-island-gap-factor: 0.62;
|
||||
|
||||
--ci-window-transparent: transparent;
|
||||
--ci-edit-blur: 16px;
|
||||
--ci-effect-scale: 1;
|
||||
|
||||
--ci-z-window: 0;
|
||||
--ci-z-window-top: 1;
|
||||
--ci-z-content: 0;
|
||||
--ci-z-mask: 1;
|
||||
--ci-z-drag: 1;
|
||||
--ci-z-drawer: 10;
|
||||
--ci-z-timeline-adorn: 9999;
|
||||
--ci-z-sentinel: 2147483647;
|
||||
|
||||
--ci-dpi-basis: 96;
|
||||
--ci-scale: 1;
|
||||
--ci-vertical-safe-area: 20px;
|
||||
--ci-tutorial-safe-area: 150;
|
||||
--ci-duration: 200ms;
|
||||
}
|
||||
|
||||
.l-primary,
|
||||
.l1 {
|
||||
color: var(--ci-text-1);
|
||||
}
|
||||
|
||||
.l-secondary,
|
||||
.l2 {
|
||||
color: var(--ci-text-2);
|
||||
}
|
||||
|
||||
.l-instructive,
|
||||
.l3 {
|
||||
color: var(--ci-text-3);
|
||||
}
|
||||
|
||||
.l-decoration,
|
||||
.l4 {
|
||||
color: var(--ci-text-4);
|
||||
}
|
||||
|
||||
.l-inactive,
|
||||
.l5 {
|
||||
color: var(--ci-text-5);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
|
||||
const root = process.cwd();
|
||||
const tokenFile = path.join(root, 'packages/ui/src/tokens.css');
|
||||
const islandRoot = path.join(root, 'packages/desktop-client/src/island');
|
||||
const scopedFiles = [
|
||||
islandRoot,
|
||||
path.join(root, 'packages/desktop-client/src/main/island.ts'),
|
||||
path.join(root, 'packages/desktop-client/src/main/config.ts'),
|
||||
path.join(root, 'packages/desktop-client/src/preload/island.ts'),
|
||||
path.join(root, 'packages/desktop-client/src/renderer/components/IslandComponentSettings.vue'),
|
||||
path.join(root, 'packages/desktop-client/src/renderer/styles/island-editor.css'),
|
||||
path.join(root, 'packages/desktop-client/src/renderer/views/settings/IslandEditorView.vue'),
|
||||
path.join(root, 'packages/desktop-client/src/renderer/views/settings/IslandSettingsView.vue'),
|
||||
];
|
||||
const source = fs.readFileSync(tokenFile, 'utf8');
|
||||
const rootBlock = source.match(/:root\s*\{([\s\S]*?)\n\}/)?.[1] ?? '';
|
||||
const darkBlock = source.match(/html\.dark\s*\{([\s\S]*?)\n\}/)?.[1] ?? '';
|
||||
|
||||
function tokenNames(block) {
|
||||
return [...block.matchAll(/(--ci-[a-z0-9-]+)\s*:/g)].map((match) => match[1]);
|
||||
}
|
||||
|
||||
const light = new Set(tokenNames(rootBlock));
|
||||
const dark = new Set(tokenNames(darkBlock));
|
||||
const errors = [];
|
||||
if (!light.size || !dark.size) errors.push('无法解析 :root 或 html.dark 的 --ci-* token');
|
||||
for (const name of light) if (!dark.has(name)) errors.push(`深色主题缺少 ${name}`);
|
||||
for (const name of dark) if (!light.has(name)) errors.push(`亮色主题缺少 ${name}`);
|
||||
|
||||
const required = [
|
||||
'--ci-accent',
|
||||
'--ci-accent-2',
|
||||
'--ci-accent-fallback',
|
||||
'--ci-accent-palette-fallback',
|
||||
'--ci-accent-fill',
|
||||
'--ci-accent-fill-tertiary',
|
||||
'--ci-accent-text',
|
||||
'--ci-text-on-accent',
|
||||
'--ci-accent-soft',
|
||||
'--ci-text-1',
|
||||
'--ci-text-2',
|
||||
'--ci-text-3',
|
||||
'--ci-text-4',
|
||||
'--ci-text-5',
|
||||
'--ci-bg-base',
|
||||
'--ci-bg-secondary',
|
||||
'--ci-bg-tertiary',
|
||||
'--ci-island-bg-custom',
|
||||
'--ci-island-opacity',
|
||||
'--ci-island-bg-opacity',
|
||||
'--ci-line-opacity',
|
||||
'--ci-stroke-island',
|
||||
'--ci-stroke-control',
|
||||
'--ci-stroke-divider',
|
||||
'--ci-stroke-flyout',
|
||||
'--ci-stroke-card',
|
||||
'--ci-stroke-drag',
|
||||
'--ci-stroke-tutorial',
|
||||
'--ci-shadow-island',
|
||||
'--ci-shadow-mask',
|
||||
'--ci-shadow-drawer',
|
||||
'--ci-shadow-drawer-x',
|
||||
'--ci-shadow-classic-mask',
|
||||
'--ci-shadow-adorn',
|
||||
'--ci-font',
|
||||
'--ci-font-island',
|
||||
'--ci-font-backend',
|
||||
'--ci-font-icon-fluent',
|
||||
'--ci-font-icon-lucide',
|
||||
'--ci-font-icon-sf',
|
||||
'--ci-fs-secondary',
|
||||
'--ci-fs-body',
|
||||
'--ci-fs-emphasized',
|
||||
'--ci-fs-large',
|
||||
'--ci-radius-island',
|
||||
'--ci-radius-island-local',
|
||||
'--ci-radius-popup',
|
||||
'--ci-radius-card',
|
||||
'--ci-radius-control',
|
||||
'--ci-radius-drawer',
|
||||
'--ci-radius-pill',
|
||||
'--ci-island-height',
|
||||
'--ci-island-pad-x',
|
||||
'--ci-island-min-w',
|
||||
'--ci-component-gap',
|
||||
'--ci-line-gap',
|
||||
'--ci-progress-height',
|
||||
'--ci-z-window',
|
||||
'--ci-z-window-top',
|
||||
'--ci-z-mask',
|
||||
'--ci-z-drag',
|
||||
'--ci-z-timeline-adorn',
|
||||
'--ci-z-sentinel',
|
||||
'--ci-dpi-basis',
|
||||
'--ci-scale',
|
||||
'--ci-vertical-safe-area',
|
||||
];
|
||||
for (const name of required) if (!light.has(name)) errors.push(`缺少基础 token ${name}`);
|
||||
|
||||
function files(directory) {
|
||||
return fs.readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
||||
const target = path.join(directory, entry.name);
|
||||
return entry.isDirectory() ? files(target) : [target];
|
||||
});
|
||||
}
|
||||
|
||||
const scoped = scopedFiles.flatMap((file) => (fs.statSync(file).isDirectory() ? files(file) : [file]));
|
||||
for (const file of scoped.filter((value) => /\.(css|vue|ts)$/.test(value))) {
|
||||
const text = fs.readFileSync(file, 'utf8');
|
||||
const relative = path.relative(root, file);
|
||||
if (/#[0-9a-f]{3,8}\b/i.test(text)) errors.push(`${relative} 含裸颜色字面量`);
|
||||
if (/(?<![\w-])rgba?\(/i.test(text)) errors.push(`${relative} 含裸 rgb/rgba 色值`);
|
||||
for (const match of text.matchAll(/--ci-([A-Za-z0-9_-]+)/g)) {
|
||||
if (/[A-Z_]/.test(match[1])) errors.push(`${relative} 的 token 名不是 kebab-case:--ci-${match[1]}`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const file of files(path.join(root, 'packages/desktop-client/src')).filter((value) =>
|
||||
value.endsWith('.css'),
|
||||
)) {
|
||||
const text = fs.readFileSync(file, 'utf8');
|
||||
if (/^\s*--ci-[a-z0-9-]+\s*:/m.test(text)) {
|
||||
errors.push(`${path.relative(root, file)} 在 tokens.css 之外定义了 --ci-*`);
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error(`设计 token 检查失败(${errors.length} 项):`);
|
||||
for (const error of errors) console.error(`- ${error}`);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`设计 token 检查通过:亮/暗各 ${light.size} 个 --ci-*,岛相关文件无裸颜色。`);
|
||||
}
|
||||