itube-specs 0.0.844 → 0.0.845
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,14 +9,10 @@
|
|
|
9
9
|
<LayoutFooterLanguage />
|
|
10
10
|
<p class="layout-footer__copyright">{{ copyrightText }}</p>
|
|
11
11
|
</div>
|
|
12
|
-
|
|
13
|
-
<LazyDevThemeSwitch v-if="isDev" />
|
|
14
12
|
</footer>
|
|
15
13
|
</template>
|
|
16
14
|
|
|
17
15
|
<script setup lang="ts">
|
|
18
|
-
const isDev = import.meta.dev;
|
|
19
|
-
|
|
20
16
|
const copyrightText = useAppConfig().copyrightText;
|
|
21
17
|
|
|
22
18
|
const { t } = useI18n();
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button
|
|
3
|
-
class="dev-theme-switch"
|
|
4
|
-
type="button"
|
|
5
|
-
@click="toggle"
|
|
6
|
-
>
|
|
7
|
-
{{ label }}
|
|
8
|
-
</button>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
type ThemeName = 'dark' | 'light';
|
|
13
|
-
|
|
14
|
-
const { data, refresh } = await useFetch<{ theme: ThemeName }>('/api/dev/theme', { server: false });
|
|
15
|
-
|
|
16
|
-
const label = computed(() => (data.value?.theme === 'light' ? 'theme: light' : 'theme: dark'));
|
|
17
|
-
|
|
18
|
-
const toggle = async () => {
|
|
19
|
-
const theme: ThemeName = data.value?.theme === 'light' ? 'dark' : 'light';
|
|
20
|
-
|
|
21
|
-
await $fetch('/api/dev/theme', { method: 'POST', body: { theme } });
|
|
22
|
-
await refresh();
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<style lang="scss">
|
|
27
|
-
.dev-theme-switch {
|
|
28
|
-
justify-self: center;
|
|
29
|
-
padding: 6px 12px;
|
|
30
|
-
border: 1px solid #888;
|
|
31
|
-
border-radius: 6px;
|
|
32
|
-
background-color: #222;
|
|
33
|
-
color: #fff;
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
|
|
36
|
-
@include font-xs;
|
|
37
|
-
}
|
|
38
|
-
</style>
|
package/server/api/dev/theme.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
type ThemeName = 'dark' | 'light';
|
|
5
|
-
|
|
6
|
-
const THEME_FILE = resolve(process.cwd(), 'assets/scss/vars/_theme.scss');
|
|
7
|
-
|
|
8
|
-
export default defineEventHandler(async (event) => {
|
|
9
|
-
if (!import.meta.dev) {
|
|
10
|
-
throw createError({ statusCode: 404, statusMessage: 'Not Found' });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (event.method === 'GET') {
|
|
14
|
-
const content = await readFile(THEME_FILE, 'utf8');
|
|
15
|
-
|
|
16
|
-
return { theme: (content.includes('themes/light') ? 'light' : 'dark') as ThemeName };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const body = await readBody<{ theme?: ThemeName }>(event);
|
|
20
|
-
const theme: ThemeName = body?.theme === 'light' ? 'light' : 'dark';
|
|
21
|
-
|
|
22
|
-
await writeFile(
|
|
23
|
-
THEME_FILE,
|
|
24
|
-
'// Active theme. Switch by pointing the forward at another file in themes/.\n'
|
|
25
|
-
+ '// The dev-only footer toggle rewrites exactly this line.\n'
|
|
26
|
-
+ `@forward 'themes/${theme}';\n`,
|
|
27
|
-
'utf8',
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return { theme };
|
|
31
|
-
});
|