Skip to content

Commit

Permalink
chore: improve playground (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Feb 6, 2024
1 parent ddc9e32 commit f527fb9
Show file tree
Hide file tree
Showing 65 changed files with 562 additions and 1,138 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"build:devtools-api": "nr -C packages/devtools-api build",
"dev:browser-extension": "nr -C packages/browser-extension dev",
"dev:ui-story": "nr -C packages/ui story:dev",
"dev:ui-play": "nr -C packages/ui-playground dev",
"prepare:type": "pnpm -r --filter='./packages/**' run prepare:type",
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" nr prepare:type && nr build:ui && pnpm -r --parallel --filter='./packages/**' run stub",
"build": "pnpm -r --filter='./packages/{shared,core,ui,devtools-kit,vite}' run build && pnpm build:client && pnpm build:overlay && pnpm build:browser-extension && pnpm build:electron && pnpm build:devtools && pnpm build:devtools-api",
Expand All @@ -56,8 +55,11 @@
"dep:up": "taze -I major -r",
"prepare": "simple-git-hooks",
"test": "vitest --environment jsdom",
"play": "nr -C packages/playground dev",
"play:webpack": "nr -C packages/webpack-playground dev",
"play": "nr -C packages/playground/basic dev",
"play:ui": "nr -C packages/playground/ui dev",
"play:multi-app": "nr -C packages/playground/multi-app dev",
"play:webpack": "nr -C packages/playground/webpack dev",
"play:termui": "nr -C packages/playground/termui dev",
"docs": "pnpm -C docs run docs:dev",
"docs:build": "pnpm -C docs run docs:build",
"zip": "tsx ./scripts/extension-zip.ts",
Expand Down
13 changes: 13 additions & 0 deletions packages/playground/basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vue DevTools Basic Playground</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
{
"name": "@vue/devtools-playground",
"name": "playground-basic",
"type": "module",
"version": "7.0.14",
"private": true,
"scripts": {
"app": "vue-devtools",
"build:playground": "vite build",
"dev": "vite",
"preview": "vite preview"
"dev": "vite"
},
"dependencies": {
"@vueuse/core": "^10.7.2",
"pinia": "^2.1.7",
"unplugin-auto-import": "^0.17.5",
"vue": "^3.4.15",
"vue-i18n": "^9.9.1",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/devtools": "workspace:*",
"@vue/devtools-api": "workspace:*",
"sass": "^1.70.0",
"serve": "^14.2.1",
"typescript": "^5.3.3",
Expand Down
File renamed without changes
25 changes: 25 additions & 0 deletions packages/playground/basic/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup lang="ts">
</script>

<template>
<div class="flex flex-col justify-center">
<div class="text-center">
<RouterView />
</div>
<div class="text-center">
Router Navgation:
<RouterLink to="/">
<span>
/
</span>
</RouterLink>
|
<RouterLink to="/hello">
<span>
/hello
</span>
</RouterLink>
</div>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

<template>
<div>
Foo
Foo Component
</div>
</template>
44 changes: 44 additions & 0 deletions packages/playground/basic/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { createPinia } from 'pinia'
import type { RouteRecordRaw } from 'vue-router'
import { createRouter, createWebHistory } from 'vue-router'

import App from './App.vue'

import Home from './pages/Home.vue'
import Hey from './pages/Hey.vue'
import './style.css'
import 'uno.css'

const pinia = createPinia()

const app = createApp(App)

const routes: RouteRecordRaw[] = [
{
path: '/',
component: Home,
name: 'home',
alias: '/index',
},
{
path: '/hello',
// component: Hello,
component: () => import('./pages/Hello.vue'),
name: 'hello',
},
{
path: '/hey/:id',
component: Hey,
name: 'hey',
},
]

const router = createRouter({
history: createWebHistory(),
routes,
})

app.use(router)
app.use(pinia)

app.mount('#app')
23 changes: 23 additions & 0 deletions packages/playground/basic/src/pages/Hello.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { useAppStore } from '../stores'
const app = useAppStore()
</script>

<template>
<div class="m-auto mt-3 h-80 w-120 flex flex-col items-center justify-center rounded bg-[#363636]">
Hello {{ app.count }}
<button class="w-30 cursor-pointer" @click="app.increment()">
Increment count
</button>
</div>
</template>

<style lang="scss" scoped>
.container {
width: 250px;
height: 150px;
background: #363636;
border-radius: 4px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { useRoute } from 'vue-router'
const route = useRoute()
</script>

Expand Down
19 changes: 19 additions & 0 deletions packages/playground/basic/src/pages/Home.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup lang="ts">
import Foo from '../components/Foo.vue'
const visible = ref(false)
</script>

<template>
<div class="m-auto mt-3 h-80 w-120 flex flex-col items-center justify-center rounded bg-[#363636]">
Home
<Foo v-if="visible" />
<button class="w-30 cursor-pointer" @click="visible = !visible">
Toggle Foo
</button>
</div>
</template>

<style lang="scss" scoped>
</style>
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions packages/playground/basic/uno.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {
defineConfig,
presetAttributify,
presetTypography,
presetUno,
transformerDirectives,
transformerVariantGroup,
} from 'unocss'

export default defineConfig({
presets: [
presetUno(),
presetAttributify(),
presetTypography(),
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
],
})
25 changes: 25 additions & 0 deletions packages/playground/basic/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import VueDevtools from 'vite-plugin-vue-devtools'
import Unocss from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
VueDevtools(),
Unocss(),
AutoImport({
imports: [
'vue',
'vue-router',
'@vueuse/core',
],
}),
],
server: {
port: 3000,
},
})
14 changes: 0 additions & 14 deletions packages/playground/locales/en.yml

This file was deleted.

14 changes: 0 additions & 14 deletions packages/playground/locales/es.yml

This file was deleted.

14 changes: 0 additions & 14 deletions packages/playground/locales/fr.yml

This file was deleted.

13 changes: 0 additions & 13 deletions packages/playground/locales/ja.yml

This file was deleted.

14 changes: 0 additions & 14 deletions packages/playground/locales/zh-CN.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vue DevTools Playground</title>
<!-- <script>
window.__VUE_DEVTOOLS_PORT__ = 8080
</script>
<script src="http://localhost:8080"></script> -->
<title>Vue DevTools Basic Playground</title>
</head>
<body>
<div id="app2"></div>
<div id="app"></div>
<div id="app2"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions packages/playground/multi-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "playground-basic",
"type": "module",
"private": true,
"scripts": {
"dev": "vite"
},
"dependencies": {
"@vueuse/core": "^10.7.2",
"pinia": "^2.1.7",
"unplugin-auto-import": "^0.17.5",
"vue": "^3.4.15",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.3",
"sass": "^1.70.0",
"serve": "^14.2.1",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite-plugin-inspect": "^0.8.3",
"vite-plugin-vue-devtools": "workspace:*"
}
}
1 change: 1 addition & 0 deletions packages/playground/multi-app/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions packages/playground/multi-app/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script setup lang="ts">
const count = ref(0)
</script>

<template>
<div class="m-auto mt-3 h-30 w-60 flex flex-col items-center justify-center rounded bg-[#363636]">
App
<div>Count: {{ count }}</div>
<button @click="count++">
++
</button>
</div>
</template>
13 changes: 13 additions & 0 deletions packages/playground/multi-app/src/App2.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script setup lang="ts">
const count = ref(0)
</script>

<template>
<div class="m-auto mt-3 h-30 w-60 flex flex-col items-center justify-center rounded bg-[#363636]">
App2
<div>Count: {{ count }}</div>
<button @click="count++">
++
</button>
</div>
</template>
Loading

0 comments on commit f527fb9

Please sign in to comment.