Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #22 from mikinovation/feature/vite-vue3
Browse files Browse the repository at this point in the history
Add Vite-Vue3 example project
  • Loading branch information
mikinovation authored Aug 5, 2022
2 parents d1caffb + 8cd0e34 commit 8edf663
Show file tree
Hide file tree
Showing 80 changed files with 20,290 additions and 123 deletions.
24 changes: 24 additions & 0 deletions example/vite-vue3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
19 changes: 19 additions & 0 deletions example/vite-vue3/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"storybook-addon-vuetify3"
],
"framework": "@storybook/vue3",
"core": {
"builder": "@storybook/builder-vite"
},
"features": {
"storyStoreV7": true
}
}
3 changes: 3 additions & 0 deletions example/vite-vue3/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
window.global = window;
</script>
15 changes: 15 additions & 0 deletions example/vite-vue3/.storybook/preview.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { withVuetify } from 'storybook-addon-vuetify3/dist/decorators'

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}

export const decorators = [
withVuetify
]
16 changes: 16 additions & 0 deletions example/vite-vue3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)

## Type Support For `.vue` Imports in TS

Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:

1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.

You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
16 changes: 16 additions & 0 deletions example/vite-vue3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vuetify 3 Vite Preview</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>

</html>
40 changes: 40 additions & 0 deletions example/vite-vue3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "vite-vue3",
"version": "0.0.0",
"private": true,
"scripts": {
"serve": "vite preview",
"build": "vite build",
"build-storybook": "build-storybook",
"dev": "vite",
"preview": "vite preview",
"storybook": "start-storybook -p 6006"
},
"dependencies": {
"@mdi/font": "5.9.55",
"roboto-fontface": "*",
"vue": "^3.2.37",
"vuetify": "^3.0.0-beta.0",
"webfontloader": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.10",
"@storybook/addon-links": "^6.5.10",
"@storybook/builder-vite": "^0.2.2",
"@storybook/testing-library": "^0.0.13",
"@storybook/vue3": "^6.5.10",
"@types/webfontloader": "^1.0.0",
"@vitejs/plugin-vue": "^3.0.0",
"babel-loader": "^8.2.5",
"typescript": "^4.6.4",
"vite": "^3.0.0",
"vite-plugin-vuetify": "^1.0.0-alpha.0",
"vue-cli-plugin-vuetify": "~2.5.1",
"vue-loader": "^16.8.3",
"vue-tsc": "^0.38.4"
},
"type": "module"
}
Empty file.
1 change: 1 addition & 0 deletions example/vite-vue3/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.
26 changes: 26 additions & 0 deletions example/vite-vue3/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<v-app>
<v-main>
<HelloWorld/>
</v-main>
</v-app>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import HelloWorld from './components/HelloWorld.vue'
export default defineComponent({
name: 'App',
components: {
HelloWorld,
},
data () {
return {
//
}
},
})
</script>
File renamed without changes
1 change: 1 addition & 0 deletions example/vite-vue3/src/assets/vue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 157 additions & 0 deletions example/vite-vue3/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<template>
<v-container>
<v-row class="text-center">
<v-col cols="12">
<v-img
:src="logo"
class="my-3"
contain
height="200"
/>
</v-col>

<v-col class="mb-4">
<h1 class="display-2 font-weight-bold mb-3">
Welcome to Vuetify 3 Beta
</h1>

<h4>Vite Preview</h4>

<p class="subheading font-weight-regular">
For help and collaboration with other Vuetify developers,
<br>please join our online
<a
href="https://community.vuetifyjs.com"
target="_blank"
>Discord Community</a>
</p>
</v-col>

<v-col
class="mb-5"
cols="12"
>
<h2 class="headline font-weight-bold mb-5">
What's next?
</h2>

<v-row justify="center">
<a
v-for="(next, i) in whatsNext"
:key="i"
:href="next.href"
class="subheading mx-3"
target="_blank"
>
{{ next.text }}
</a>
</v-row>
</v-col>

<v-col
class="mb-5"
cols="12"
>
<h2 class="headline font-weight-bold mb-5">
Important Links
</h2>

<v-row justify="center">
<a
v-for="(link, i) in importantLinks"
:key="i"
:href="link.href"
class="subheading mx-3"
target="_blank"
>
{{ link.text }}
</a>
</v-row>
</v-col>

<v-col
class="mb-5"
cols="12"
>
<h2 class="headline font-weight-bold mb-5">
Ecosystem
</h2>

<v-row justify="center">
<a
v-for="(eco, i) in ecosystem"
:key="i"
:href="eco.href"
class="subheading mx-3"
target="_blank"
>
{{ eco.text }}
</a>
</v-row>
</v-col>
</v-row>
</v-container>
</template>

<script lang='ts'>
import { defineComponent } from 'vue'
// Logo
import logo from '../assets/logo.svg'
export default defineComponent({
name: 'HelloWorld',
data () {
return {
ecosystem: [
{
text: 'vuetify-loader',
href: 'https://github.com/vuetifyjs/vuetify-loader',
},
{
text: 'github',
href: 'https://github.com/vuetifyjs/vuetify',
},
{
text: 'awesome-vuetify',
href: 'https://github.com/vuetifyjs/awesome-vuetify',
},
],
importantLinks: [
{
text: 'Chat',
href: 'https://community.vuetifyjs.com',
},
{
text: 'Made with Vuetify',
href: 'https://madewithvuejs.com/vuetify',
},
{
text: 'Twitter',
href: 'https://twitter.com/vuetifyjs',
},
{
text: 'Articles',
href: 'https://medium.com/vuetify',
},
],
logo,
whatsNext: [
{
text: 'Explore components',
href: 'https://vuetifyjs.com',
},
{
text: 'Roadmap',
href: 'https://vuetifyjs.com/en/introduction/roadmap/',
},
{
text: 'Frequently Asked Questions',
href: 'https://vuetifyjs.com/getting-started/frequently-asked-questions',
},
],
}
},
})
</script>
File renamed without changes.
34 changes: 34 additions & 0 deletions example/vite-vue3/src/plugins/vuetify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Styles
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'

// Vuetify
import { createVuetify } from 'vuetify'

export const myCustomLightTheme = {
dark: false,
colors: {
background: '#FFFFFF',
surface: '#FFFFFF',
primary: '#620',
'primary-darken-1': '#3700B3',
secondary: '#03DAC6',
'secondary-darken-1': '#018786',
error: '#B00020',
info: '#2196F3',
success: '#4CAF50',
warning: '#FB8C00',
}
}

export default createVuetify(
// https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides
{
theme: {
defaultTheme: 'myCustomLightTheme',
themes: {
myCustomLightTheme,
}
}
}
)
3 changes: 3 additions & 0 deletions example/vite-vue3/src/shims-vuetify.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'vuetify'
declare module 'vuetify/lib/components'
declare module 'vuetify/lib/directives'
Loading

0 comments on commit 8edf663

Please sign in to comment.