mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 19:56:02 +00:00
theme could be in plugin
This commit is contained in:
@@ -26,6 +26,12 @@
|
||||
$: currentThemeType = $currentThemeDefinition?.themeType == 'dark' ? 'theme-type-dark' : 'theme-type-light';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
{#if $currentThemeDefinition?.themeCss}
|
||||
{@html `<style id="themePlugin">${$currentThemeDefinition?.themeCss}</style>`}
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
||||
<div
|
||||
class={`${$currentTheme} ${currentThemeType} root dbgate-screen`}
|
||||
use:dragDropFileTarget
|
||||
|
||||
@@ -30,7 +30,7 @@ import runCommand from './runCommand';
|
||||
function themeCommand(theme: ThemeDefinition) {
|
||||
return {
|
||||
text: theme.themeName,
|
||||
onClick: () => currentTheme.set(theme.className),
|
||||
onClick: () => currentTheme.set(theme.themeClassName),
|
||||
// onPreview: () => {
|
||||
// const old = get(currentTheme);
|
||||
// currentTheme.set(css);
|
||||
|
||||
@@ -695,13 +695,17 @@
|
||||
if (css) css += '\n';
|
||||
css += cssItem;
|
||||
}
|
||||
if ($currentThemeDefinition?.themeCss) {
|
||||
if (css) css += '\n';
|
||||
css += $currentThemeDefinition?.themeCss;
|
||||
}
|
||||
saveFileToDisk(async filePath => {
|
||||
await apiCall('files/export-diagram', {
|
||||
filePath,
|
||||
html: domCanvas.outerHTML,
|
||||
css,
|
||||
themeType: $currentThemeDefinition?.themeType,
|
||||
themeClassName: $currentThemeDefinition?.className,
|
||||
themeClassName: $currentThemeDefinition?.themeClassName,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script context="module">
|
||||
export const className = 'theme-dark';
|
||||
export const themeClassName = 'theme-dark';
|
||||
export const themeName = 'Dark';
|
||||
export const themeType = 'dark';
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script context="module">
|
||||
export const className = 'theme-light';
|
||||
export const themeClassName = 'theme-light';
|
||||
export const themeName = 'Light';
|
||||
export const themeType = 'light';
|
||||
</script>
|
||||
|
||||
@@ -73,7 +73,7 @@ export const loadingPluginStore = writable({
|
||||
});
|
||||
|
||||
export const currentThemeDefinition = derived([currentTheme, extensions], ([$currentTheme, $extensions]) =>
|
||||
$extensions.themes.find(x => x.className == $currentTheme)
|
||||
$extensions.themes.find(x => x.themeClassName == $currentTheme)
|
||||
);
|
||||
|
||||
subscribeCssVariable(selectedWidget, x => (x ? 1 : 0), '--dim-visible-left-panel');
|
||||
|
||||
Reference in New Issue
Block a user