Skip to content

Commit 48c789a

Browse files
committed
feat: remove nuxt/ui-pro and enable unocss for editor
1 parent b893c20 commit 48c789a

File tree

8 files changed

+50
-101
lines changed

8 files changed

+50
-101
lines changed

app.vue

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
2-
<UApp>
3-
<NuxtLayout>
4-
<NuxtPage />
5-
</NuxtLayout>
6-
</UApp>
2+
<NuxtLayout>
3+
<NuxtPage />
4+
</NuxtLayout>
75
</template>

app/assets/css/main.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
@import "tailwindcss";
2-
@import "@nuxt/ui-pro";
2+
@import "@nuxt/ui";
3+
4+
:root {
5+
--header-height: 4rem;
6+
}

app/layouts/default.vue

+21-9
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,31 @@ const vueUseVersions = computed(() => {
4040
const vueUseVersionsSorted = useSorted(vueUseVersions, (a, b) => semver.compare(b, a))
4141
4242
provide('vueVersion', vueVersion)
43+
44+
const colorMode = useColorMode()
45+
46+
function toggleColorMode() {
47+
colorMode.value = colorMode.value === 'dark' ? 'light' : 'dark'
48+
}
4349
</script>
4450

4551
<template>
4652
<UApp>
47-
<UHeader>
48-
<template #title>
53+
<header class="flex items-center justify-around h-(--header-height)">
54+
<div class="flex gap-2 items-center">
4955
<UIcon name="i-logos-vueuse" class="size-8" />VueUse Playground
50-
</template>
51-
<template #right>
56+
</div>
57+
58+
<div class="flex gap-2 items-center">
5259
<USelectMenu v-model="vueUseVersion" :items="vueUseVersionsSorted" class="w-32" icon="i-logos-vueuse" :loading="loadingVersions" />
5360
<USelectMenu v-model="vueVersion" :items="vueVersionsSorted" class="w-32" icon="i-logos-vue" :loading="loadingVersions" />
5461
<UButton icon="i-lucide-refresh-ccw" size="md" color="primary" variant="soft" @click="fetchVersions" />
55-
<UColorModeButton />
62+
<UButton
63+
color="neutral" variant="ghost"
64+
:icon="colorMode.value === 'dark' ? 'i-heroicons-moon' : 'i-heroicons-sun'"
65+
aria-label="color mode"
66+
@click="toggleColorMode"
67+
/>
5668

5769
<UTooltip text="Open on GitHub" :kbds="['meta', 'G']">
5870
<UButton
@@ -64,11 +76,11 @@ provide('vueVersion', vueVersion)
6476
aria-label="GitHub"
6577
/>
6678
</UTooltip>
67-
</template>
68-
</UHeader>
79+
</div>
80+
</header>
6981

70-
<UMain class="h-[calc(100vh-var(--ui-header-height))]">
82+
<main class="h-[calc(100vh-var(--header-height))]">
7183
<NuxtPage />
72-
</UMain>
84+
</main>
7385
</UApp>
7486
</template>

app/pages/index.vue

+16-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,23 @@ const theme = computed(() => {
8888
else
8989
return 'light'
9090
})
91+
92+
const previewOptions = {
93+
headHTML: `
94+
<script src="https://cdn.jsdelivr.net/npm/@unocss/runtime"><\/script>
95+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unocss/reset/tailwind.min.css" />
96+
<script>
97+
window.__unocss = {
98+
rules: [],
99+
presets: [],
100+
}
101+
<\/script>
102+
`,
103+
}
91104
</script>
92105

93106
<template>
94-
<Repl :store="store" :editor="MonacoEditor" :show-compile-output="true" :theme="theme" :preview-theme="true" />
107+
<client-only>
108+
<Repl :store="store" :editor="MonacoEditor" :show-compile-output="true" :theme="theme" :preview-theme="true" :preview-options="previewOptions" />
109+
</client-only>
95110
</template>

app/template/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const timeago = useTimeAgo(ms)
88
</script>
99

1010
<template>
11-
<div>
11+
<div class="flex items-center justify-center w-screen h-screen">
1212
<input v-model="input" type="text" placeholder="Type anything...">
1313
<div>
1414
Last changed: <span class="text-primary">{{ timeago }}</span>

nuxt.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineNuxtConfig({
66
future: {
77
compatibilityVersion: 4,
88
},
9-
modules: ['@nuxt/ui-pro', '@nuxt/eslint', '@vueuse/nuxt'],
9+
modules: ['@nuxt/ui', '@nuxt/eslint', '@vueuse/nuxt'],
1010
eslint: {
1111
config: {
1212
standalone: false,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@antfu/eslint-config": "^4.11.0",
1717
"@iconify-json/logos": "^1.2.4",
1818
"@nuxt/eslint": "^1.3.0",
19-
"@nuxt/ui-pro": "^3.0.2",
19+
"@nuxt/ui": "^3.0.2",
2020
"@types/semver": "^7.7.0",
2121
"@vue/repl": "^4.5.1",
2222
"@vueuse/nuxt": "13.0.0",

pnpm-lock.yaml

+2-82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)