feat(builder): 添加 SchemeSelect 支持并更新默认设置

fix(preview): 更新 PreviewBlock 组件的前景色属性
This commit is contained in:
徐涛
2026-01-15 10:56:14 +08:00
parent 0bccda2c01
commit d91a8eb341
2 changed files with 5 additions and 3 deletions

View File

@@ -140,10 +140,10 @@ const PreviewBlock: FC<PreviewBlockProps> = ({ baseline, title }) => {
<PreviewCell bg={baseline.overlay} fg={baseline.neutralVariant.onRoot}> <PreviewCell bg={baseline.overlay} fg={baseline.neutralVariant.onRoot}>
Overlay Overlay
</PreviewCell> </PreviewCell>
<PreviewCell bg={baseline.outline} fg={baseline.surface.onRoot}> <PreviewCell bg={baseline.outline} fg={baseline.foreground}>
Outline Outline
</PreviewCell> </PreviewCell>
<PreviewCell bg={baseline.outlineVariant} fg={baseline.surface.onRoot}> <PreviewCell bg={baseline.outlineVariant} fg={baseline.foreground}>
Outline Variant Outline Variant
</PreviewCell> </PreviewCell>
</div> </div>

View File

@@ -1,4 +1,4 @@
import { ColorExpand, ColorShifting, SchemeSetting, WACGSetting } from 'color-module'; import { ColorExpand, ColorShifting, SchemeSelect, SchemeSetting, WACGSetting } from 'color-module';
import { every, isEmpty, isNil } from 'lodash-es'; import { every, isEmpty, isNil } from 'lodash-es';
import { useActionState, useMemo } from 'react'; import { useActionState, useMemo } from 'react';
import { useColorFunction } from '../../../ColorFunctionContext'; import { useColorFunction } from '../../../ColorFunctionContext';
@@ -53,6 +53,7 @@ export function QSchemeBuilder({ scheme, onBuildCompleted }: QSchemeBuilderProps
), ),
scheme.schemeStorage.source?.setting?.expand_method ?? defaultValues.expand_method, scheme.schemeStorage.source?.setting?.expand_method ?? defaultValues.expand_method,
scheme.schemeStorage.source?.setting?.wacg_follows ?? defaultValues.wacg_follows, scheme.schemeStorage.source?.setting?.wacg_follows ?? defaultValues.wacg_follows,
scheme.schemeStorage.source?.setting?.scheme_select ?? defaultValues.scheme_select,
); );
return defaultValues; return defaultValues;
} catch (e) { } catch (e) {
@@ -103,6 +104,7 @@ export function QSchemeBuilder({ scheme, onBuildCompleted }: QSchemeBuilderProps
), ),
Number(formData.get('expanding')) as ColorExpand, Number(formData.get('expanding')) as ColorExpand,
Number(formData.get('wacg')) as WACGSetting, Number(formData.get('wacg')) as WACGSetting,
SchemeSelect.Both,
); );
const dumpedSetting = schemeSetting.toJsValue() as QSchemeSetting; const dumpedSetting = schemeSetting.toJsValue() as QSchemeSetting;
return [ return [