This commit is contained in:
syuilo
2020-09-06 12:30:27 +09:00
parent 256307f1a9
commit e33f2398f5
270 changed files with 1173 additions and 961 deletions

View File

@@ -81,14 +81,15 @@
import { defineComponent } from 'vue';
import { faPalette, faDownload, faFolderOpen, faCheck, faTrashAlt, faEye } from '@fortawesome/free-solid-svg-icons';
import * as JSON5 from 'json5';
import MkButton from '../../components/ui/button.vue';
import MkSelect from '../../components/ui/select.vue';
import MkSwitch from '../../components/ui/switch.vue';
import MkTextarea from '../../components/ui/textarea.vue';
import { Theme, builtinThemes, applyTheme, validateTheme } from '../../scripts/theme';
import { selectFile } from '../../scripts/select-file';
import { isDeviceDarkmode } from '../../scripts/is-device-darkmode';
import copyToClipboard from '../../scripts/copy-to-clipboard';
import MkButton from '@/components/ui/button.vue';
import MkSelect from '@/components/ui/select.vue';
import MkSwitch from '@/components/ui/switch.vue';
import MkTextarea from '@/components/ui/textarea.vue';
import { Theme, builtinThemes, applyTheme, validateTheme } from '@/scripts/theme';
import { selectFile } from '@/scripts/select-file';
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import * as os from '@/os';
export default defineComponent({
components: {
@@ -194,7 +195,7 @@ export default defineComponent({
copyThemeCode() {
copyToClipboard(this.selectedThemeCode);
this.$store.dispatch('showDialog', {
os.dialog({
type: 'success',
iconOnly: true, autoClose: true
});
@@ -206,21 +207,21 @@ export default defineComponent({
try {
theme = JSON5.parse(code);
} catch (e) {
this.$store.dispatch('showDialog', {
os.dialog({
type: 'error',
text: this.$t('_theme.invalid')
});
return false;
}
if (!validateTheme(theme)) {
this.$store.dispatch('showDialog', {
os.dialog({
type: 'error',
text: this.$t('_theme.invalid')
});
return false;
}
if (this.$store.state.device.themes.some(t => t.id === theme.id)) {
this.$store.dispatch('showDialog', {
os.dialog({
type: 'info',
text: this.$t('_theme.alreadyInstalled')
});
@@ -242,7 +243,7 @@ export default defineComponent({
this.$store.commit('device/set', {
key: 'themes', value: themes
});
this.$store.dispatch('showDialog', {
os.dialog({
type: 'success',
text: this.$t('_theme.installed', { name: theme.name })
});
@@ -254,7 +255,7 @@ export default defineComponent({
this.$store.commit('device/set', {
key: 'themes', value: themes
});
this.$store.dispatch('showDialog', {
os.dialog({
type: 'success',
iconOnly: true, autoClose: true
});