diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2022-05-28 21:59:23 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-28 21:59:23 +0900 |
| commit | 4a50c49211654758d391b39d78fe4d171afc1f19 (patch) | |
| tree | bcc064a990683b4b604b92c422e736fc7441c95e /packages/client/src/scripts | |
| parent | feat(tests): add e2e tests for widgets (#8735) (diff) | |
| download | sharkey-4a50c49211654758d391b39d78fe4d171afc1f19.tar.gz sharkey-4a50c49211654758d391b39d78fe4d171afc1f19.tar.bz2 sharkey-4a50c49211654758d391b39d78fe4d171afc1f19.zip | |
Fix theme import (#8749)
Diffstat (limited to 'packages/client/src/scripts')
| -rw-r--r-- | packages/client/src/scripts/theme.ts | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/packages/client/src/scripts/theme.ts b/packages/client/src/scripts/theme.ts index b61b1684a8..e2b272405a 100644 --- a/packages/client/src/scripts/theme.ts +++ b/packages/client/src/scripts/theme.ts @@ -1,3 +1,4 @@ +import { ref } from 'vue'; import { globalEvents } from '@/events'; import tinycolor from 'tinycolor2'; @@ -10,30 +11,38 @@ export type Theme = { props: Record<string, string>; }; -export const lightTheme: Theme = await import('@/themes/_light.json5'); -export const darkTheme: Theme = await import('@/themes/_dark.json5'); +import lightTheme from '@/themes/_light.json5'; +import darkTheme from '@/themes/_dark.json5'; export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X')); -export const builtinThemes = [ - await import('@/themes/l-light.json5'), - await import('@/themes/l-coffee.json5'), - await import('@/themes/l-apricot.json5'), - await import('@/themes/l-rainy.json5'), - await import('@/themes/l-vivid.json5'), - await import('@/themes/l-cherry.json5'), - await import('@/themes/l-sushi.json5'), +export const getBuiltinThemes = () => Promise.all( + [ + 'l-light', + 'l-coffee', + 'l-apricot', + 'l-rainy', + 'l-vivid', + 'l-cherry', + 'l-sushi', - await import('@/themes/d-dark.json5'), - await import('@/themes/d-persimmon.json5'), - await import('@/themes/d-astro.json5'), - await import('@/themes/d-future.json5'), - await import('@/themes/d-botanical.json5'), - await import('@/themes/d-cherry.json5'), - await import('@/themes/d-ice.json5'), - await import('@/themes/d-pumpkin.json5'), - await import('@/themes/d-black.json5'), -] as Theme[]; + 'd-dark', + 'd-persimmon', + 'd-astro', + 'd-future', + 'd-botanical', + 'd-cherry', + 'd-ice', + 'd-pumpkin', + 'd-black', + ].map(name => import(`../themes/${name}.json5`).then(({ default: _default }): Theme => _default)) +); + +export const getBuiltinThemesRef = () => { + const builtinThemes = ref<Theme[]>([]); + getBuiltinThemes().then(themes => builtinThemes.value = themes); + return builtinThemes; +} let timeout = null; |