1 parent
195ee3b90a
commit
4449fbd0a1
37 files changed
+1656
-356
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user