From d2cce990863725634653baf5cda86505e12a6b41 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Sep 2024 21:14:31 +0300 Subject: [PATCH] palette editor done --- src/components/color_input/color_input.vue | 2 +- .../tabs/style_tab/style_tab.js | 67 +++++++++++++---- .../tabs/style_tab/style_tab.scss | 20 ++++- .../tabs/style_tab/style_tab.vue | 74 +++++++++++++++++++ src/i18n/en.json | 17 +++++ 5 files changed, 160 insertions(+), 20 deletions(-) diff --git a/src/components/color_input/color_input.vue b/src/components/color_input/color_input.vue index b6e84629..31dfa23e 100644 --- a/src/components/color_input/color_input.vue +++ b/src/components/color_input/color_input.vue @@ -15,7 +15,7 @@ :model-value="present" :disabled="disabled" class="opt" - @update:modelValue="update(typeof modelValue === 'undefined' ? fallback : undefined)" + @update:modelValue="updateValue(typeof modelValue === 'undefined' ? fallback : undefined)" />
`settings.style.themes3.editor.components.${componentName}` const getFriendlyNamePath = (componentName) => getI18nPath(componentName) + '.friendlyName' @@ -85,6 +109,7 @@ export default { : `${getI18nPath(componentName)}.states.${state}` } + // ### Initialization stuff // Getting existing components const componentsContext = require.context('src', true, /\.style.js(on)?$/) const componentKeysAll = componentsContext.keys() @@ -356,7 +381,7 @@ export default { previewRules.push(...init({ inputRuleset: editorFriendlyToOriginal.value, initialStaticVars: { - ...palette + ...palette.value }, ultimateBackgroundColor: '#000000', rootComponentName: selectedComponentName.value, @@ -377,6 +402,16 @@ export default { updatePreview ) + watch( + palettes, + updatePreview + ) + + watch( + editedPalette, + updatePreview + ) + watch( selectedComponentName, updateSelectedComponent @@ -417,6 +452,8 @@ export default { author, license, website, + palette, + editedPalette, componentKeys, componentsMap, selectedComponent, diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.scss b/src/components/settings_modal/tabs/style_tab/style_tab.scss index 4c439cf2..f93c8ae3 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.scss +++ b/src/components/settings_modal/tabs/style_tab/style_tab.scss @@ -9,16 +9,13 @@ margin-right: 0.5em; flex: 1 1 0; line-height: 2; + min-height: 2em; } &.suboption { margin-left: 1em; } - .opt { - margin: 0.5em; - } - .color-input { flex: 0 0 0; } @@ -90,6 +87,21 @@ } } + .palette-editor { + > label:not(.Select) { + font-weight: bold; + justify-self: right; + } + + .colors { + display: grid; + justify-content: space-around; + grid-template-columns: repeat(4, min-content); + grid-template-rows: repeat(auto-fit, min-content); + grid-gap: 0.5em; + } + } + .component-editor { display: grid; grid-template-columns: 6fr 3fr 4fr; diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.vue b/src/components/settings_modal/tabs/style_tab/style_tab.vue index e4c7d6d4..4674d093 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.vue +++ b/src/components/settings_modal/tabs/style_tab/style_tab.vue @@ -51,6 +51,80 @@
+
+
+ + +
+
+ + + + + + + + + + + + +
+