feat(schema-diff): professional DDL diff view with deployment-aware colors and custom themes (#1112)
Co-authored-by: Sam <14344444@@qq.com>
This commit is contained in:
1 parent
2554ed95be
commit
ef5ed05ae7
41 files changed
+5695
-1215
No files matched your search
@@ -213,13 +213,36 @@ export const DEFAULT_CUSTOM_THEME_COLORS: CustomThemeColors = {
|
||||
builtin: "#f38ba8",
|
||||
};
|
||||
|
||||
export interface CustomThemeDdlColors {
|
||||
addedRowBg: string;
|
||||
addedRowBgAlpha: number;
|
||||
removedRowBg: string;
|
||||
removedRowBgAlpha: number;
|
||||
modifiedRowBg: string;
|
||||
modifiedRowBgAlpha: number;
|
||||
modifiedCharBg: string;
|
||||
modifiedCharBgAlpha: number;
|
||||
}
|
||||
|
||||
export const DEFAULT_CUSTOM_THEME_DDL_COLORS: CustomThemeDdlColors = {
|
||||
addedRowBg: "#22c55e",
|
||||
addedRowBgAlpha: 10,
|
||||
removedRowBg: "#ef4444",
|
||||
removedRowBgAlpha: 10,
|
||||
modifiedRowBg: "#eab308",
|
||||
modifiedRowBgAlpha: 10,
|
||||
modifiedCharBg: "#f59e0b",
|
||||
modifiedCharBgAlpha: 50,
|
||||
};
|
||||
|
||||
export interface CustomTheme {
|
||||
id: string;
|
||||
name: string;
|
||||
colors: CustomThemeColors;
|
||||
ddlColors: CustomThemeDdlColors;
|
||||
}
|
||||
|
||||
export const DEFAULT_CUSTOM_THEMES: CustomTheme[] = [{ id: "default", name: "Custom", colors: { ...DEFAULT_CUSTOM_THEME_COLORS } }];
|
||||
export const DEFAULT_CUSTOM_THEMES: CustomTheme[] = [{ id: "default", name: "Custom", colors: { ...DEFAULT_CUSTOM_THEME_COLORS }, ddlColors: { ...DEFAULT_CUSTOM_THEME_DDL_COLORS } }];
|
||||
|
||||
export interface EditorSettings {
|
||||
fontFamily: string;
|
||||
@@ -465,7 +488,14 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
},
|
||||
customThemes: (() => {
|
||||
if (Array.isArray(settings.customThemes) && settings.customThemes.length > 0) {
|
||||
return settings.customThemes.map((theme) => (theme.name === "默认" ? { ...theme, name: "Custom" } : theme));
|
||||
return settings.customThemes.map((theme) => {
|
||||
const renamed = theme.name === "默认" ? { ...theme, name: "Custom" } : { ...theme };
|
||||
return {
|
||||
...renamed,
|
||||
colors: { ...DEFAULT_CUSTOM_THEME_COLORS, ...renamed.colors },
|
||||
ddlColors: { ...DEFAULT_CUSTOM_THEME_DDL_COLORS, ...(renamed as any).ddlColors },
|
||||
};
|
||||
});
|
||||
}
|
||||
return [
|
||||
...(settings.customThemeColors
|
||||
@@ -474,10 +504,10 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
id: "migrated",
|
||||
name: "Migrated",
|
||||
colors: { ...DEFAULT_CUSTOM_THEME_COLORS, ...settings.customThemeColors },
|
||||
ddlColors: { ...DEFAULT_CUSTOM_THEME_DDL_COLORS },
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...DEFAULT_CUSTOM_THEMES,
|
||||
];
|
||||
})(),
|
||||
activeCustomThemeId: settings.activeCustomThemeId ?? "default",
|
||||
|
||||
Reference in new issue
Block a user