lint fixes

This commit is contained in:
syuilo 2023-10-09 15:37:58 +09:00
parent 3a4039e2e1
commit 19a507633e
2 changed files with 9 additions and 18 deletions

View file

@ -286,8 +286,7 @@ definePageMetadata(computed(() => {
let title = i18n.ts._pages.newPage; let title = i18n.ts._pages.newPage;
if (props.initPageId) { if (props.initPageId) {
title = i18n.ts._pages.editPage; title = i18n.ts._pages.editPage;
} } else if (props.initPageName && props.initUser) {
else if (props.initPageName && props.initUser) {
title = i18n.ts._pages.readPage; title = i18n.ts._pages.readPage;
} }
return { return {

View file

@ -5,7 +5,11 @@
import { ref } from 'vue'; import { ref } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { globalEvents } from '@/events'; import { deepClone } from './clone.js';
import { globalEvents } from '@/events.js';
import lightTheme from '@/themes/_light.json5';
import darkTheme from '@/themes/_dark.json5';
import { miLocalStorage } from '@/local-storage.js';
export type Theme = { export type Theme = {
id: string; id: string;
@ -16,11 +20,6 @@ export type Theme = {
props: Record<string, string>; props: Record<string, string>;
}; };
import lightTheme from '@/themes/_light.json5';
import darkTheme from '@/themes/_dark.json5';
import { deepClone } from './clone';
import { miLocalStorage } from '@/local-storage.js';
export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X')); export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X'));
export const getBuiltinThemes = () => Promise.all( export const getBuiltinThemes = () => Promise.all(
@ -101,18 +100,11 @@ export function applyTheme(theme: Theme, persist = true) {
function compile(theme: Theme): Record<string, string> { function compile(theme: Theme): Record<string, string> {
function getColor(val: string): tinycolor.Instance { function getColor(val: string): tinycolor.Instance {
// ref (prop) if (val[0] === '@') { // ref (prop)
if (val[0] === '@') {
return getColor(theme.props[val.substring(1)]); return getColor(theme.props[val.substring(1)]);
} } else if (val[0] === '$') { // ref (const)
// ref (const)
else if (val[0] === '$') {
return getColor(theme.props[val]); return getColor(theme.props[val]);
} } else if (val[0] === ':') { // func
// func
else if (val[0] === ':') {
const parts = val.split('<'); const parts = val.split('<');
const func = parts.shift().substring(1); const func = parts.shift().substring(1);
const arg = parseFloat(parts.shift()); const arg = parseFloat(parts.shift());