Merge branch 'fix-style-editors' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2025-07-02 23:26:59 +03:00
commit 17348b9823
3 changed files with 12 additions and 13 deletions

View file

@ -31,6 +31,7 @@ import {
getCssRules, getCssRules,
getScopedVersion getScopedVersion
} from 'src/services/theme_data/css_utils.js' } from 'src/services/theme_data/css_utils.js'
import { createStyleSheet, adoptStyleSheets } from 'src/services/style_setter/style_setter.js'
import ColorInput from 'src/components/color_input/color_input.vue' import ColorInput from 'src/components/color_input/color_input.vue'
import RangeInput from 'src/components/range_input/range_input.vue' import RangeInput from 'src/components/range_input/range_input.vue'
@ -68,7 +69,6 @@ const colorConvert = (color) => {
export default { export default {
data () { data () {
return { return {
themeV3Preview: [],
themeImporter: newImporter({ themeImporter: newImporter({
validator: this.importValidator, validator: this.importValidator,
onImport: this.onImport, onImport: this.onImport,
@ -697,10 +697,15 @@ export default {
liteMode: true liteMode: true
}) })
this.themeV3Preview = getScopedVersion( const sheet = createStyleSheet('theme-tab-overall-preview')
const rule = getScopedVersion(
getCssRules(theme3.eager), getCssRules(theme3.eager),
'#theme-preview' '&'
).join('\n') ).join('\n')
sheet.addRule('#theme-preview {\n' + rule + '\n}')
sheet.ready = true
adoptStyleSheets()
} }
}, },
watch: { watch: {

View file

@ -123,12 +123,6 @@
</div> </div>
</div> </div>
<!-- eslint-disable vue/no-v-html vue/no-v-text-v-html-on-component -->
<component
:is="'style'"
v-html="themeV3Preview"
/>
<!-- eslint-enable vue/no-v-html vue/no-v-text-v-html-on-component -->
<preview id="theme-preview" /> <preview id="theme-preview" />
<div> <div>

View file

@ -115,8 +115,8 @@ export const tryLoadCache = async () => {
const eagerStyles = createStyleSheet(EAGER_STYLE_ID) const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
const lazyStyles = createStyleSheet(LAZY_STYLE_ID) const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
cache.data[0].forEach(rule => eagerStyles.addRule(rule, 'index-max')) cache.data[0].forEach(rule => eagerStyles.addRule(rule))
cache.data[1].forEach(rule => lazyStyles.addRule(rule, 'index-max')) cache.data[1].forEach(rule => lazyStyles.addRule(rule))
eagerStyles.ready = true eagerStyles.ready = true
lazyStyles.ready = true lazyStyles.ready = true
@ -234,13 +234,13 @@ export const applyConfig = (input) => {
const styleSheet = createStyleSheet('theme-holder') const styleSheet = createStyleSheet('theme-holder')
styleSheet.addRule(`:root { ${rules} }`, 'index-max') styleSheet.addRule(`:root { ${rules} }`)
// TODO find a way to make this not apply to theme previews // TODO find a way to make this not apply to theme previews
if (Object.prototype.hasOwnProperty.call(config, 'forcedRoundness')) { if (Object.prototype.hasOwnProperty.call(config, 'forcedRoundness')) {
styleSheet.addRule(` *:not(.preview-block) { styleSheet.addRule(` *:not(.preview-block) {
--roundness: var(--forcedRoundness) !important; --roundness: var(--forcedRoundness) !important;
}`, 'index-max') }`)
} }
styleSheet.ready = true styleSheet.ready = true
adoptStyleSheets() adoptStyleSheets()