Skip to content

Commit d49f7a7

Browse files
authored
docs: add vue-note.liangmi.dev (#3)
1 parent bcf7732 commit d49f7a7

24 files changed

+2301
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ lib-cov
99
logs
1010
node_modules
1111
temp
12+
packages/docs/.vitepress/cache

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
# vue-note
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/liangmiQwQ/vue-note/main/packages/docs/src/public/favicon.svg" style="width:100px;" />
3+
</p>
4+
5+
# Vue Note
26

37
State: **🚧 Work in progress**
48

59
vue-note is another style to write Vue. It's light, easy and fast!
610

11+
## Getting Started
12+
13+
Use the follwing command to install Vue Note exist project
14+
15+
```
16+
npm install -D vue-note
17+
```
18+
19+
Learn more at [vue-note.liangmi.dev](https://vue-note.liangmi.dev/)!
20+
21+
## Contribute Guide
22+
23+
We're so excited that you are willing to help improve Vue Note, before starting your contribution, please take a moment to read the [Contribute Guide](https://vue-note.liangmi.dev/extra/contribute)
24+
725
## License
826

927
[MIT](./LICENSE) License, 2025 - Present [Liang Mi](https://github.com/liangmiqwq)

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"dev": "tsdown --watch",
1010
"play": "pnpm -C playground dev",
1111
"lint": "eslint",
12+
"docs": "pnpm -r --filter vue-note-docs docs:dev",
13+
"docs:build": "pnpm -r --filter vue-note-docs docs:build",
1214
"prepublishOnly": "nr build",
1315
"release": "bumpp -r",
1416
"test": "vitest",

packages/docs/.vitepress/config.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import UnoCSS from 'unocss/vite'
2+
import { defineConfig } from 'vitepress'
3+
4+
const SidebarNav = [
5+
{ text: 'Guide', items: [
6+
{ text: 'Introduction', link: '/guide/introduction' },
7+
{ text: 'Quick Start', link: '/guide/quick-start' },
8+
{ text: 'Flexibility', link: '/guide/flexibility' },
9+
] },
10+
{ text: 'Advenced', items: [
11+
{ text: 'Linter & Formatter', link: '/advenced/linter-formatter' },
12+
{ text: 'TypeScript', link: '/advenced/typescript' },
13+
{ text: 'API Reference', link: '/advenced/api-reference' },
14+
15+
] },
16+
{ text: 'Extra Topic', items: [
17+
{ text: 'Design Philosophy', link: '/extra/design-philosophy' },
18+
{ text: 'Contribute Guide', link: '/extra/contribute' },
19+
{ text: 'Credits', link: '/extra/credits' },
20+
] },
21+
]
22+
23+
export default defineConfig({
24+
title: 'Vue Note',
25+
description: 'Write Vue template in code comment?',
26+
srcDir: './src',
27+
head: [
28+
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
29+
],
30+
themeConfig: {
31+
logo: '/favicon.svg',
32+
nav: SidebarNav,
33+
search: {
34+
provider: 'local',
35+
},
36+
sidebar: {
37+
'/': SidebarNav,
38+
},
39+
socialLinks: [
40+
{ icon: 'github', link: 'https://github.com/liangmiQwQ/vue-note' },
41+
],
42+
editLink: {
43+
pattern: 'https://github.com/liangmiQwQ/vue-note/edit/main/packages/docs/src/:path',
44+
text: 'Suggest changes to this page',
45+
},
46+
footer: {
47+
message: 'Released under the MIT License.',
48+
copyright: 'Copyright 2025 - Present Liang Mi',
49+
},
50+
},
51+
vite: {
52+
plugins: [
53+
UnoCSS(),
54+
],
55+
},
56+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
:root {
2+
--vp-home-hero-name-color: transparent;
3+
--vp-c-brand-1: hsla(120, 60%, 40%);
4+
--vp-c-brand-2: hsl(120, 50%, 50%);
5+
--vp-c-brand-3: hsl(120, 60%, 42%);
6+
--vp-home-hero-image-background-image: url('/favicon.svg');
7+
--vp-home-hero-image-filter: blur(15px);
8+
--vp-home-hero-name-background: linear-gradient(
9+
170deg,
10+
var(--vp-c-brand-2) 40%,
11+
var(--vp-c-brand-3) 60%
12+
);
13+
}
14+
15+
.dark {
16+
--vp-home-hero-image-background-image: url('/favicon.svg');
17+
--vp-home-hero-image-filter: blur(0px);
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
import './custom.css'
3+
import 'uno.css'
4+
5+
export default DefaultTheme

packages/docs/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "vue-note-docs",
3+
"type": "module",
4+
"private": true,
5+
"description": "Document for Vue Note",
6+
"author": "Liang Mi",
7+
"license": "MIT",
8+
"scripts": {
9+
"docs:dev": "vitepress dev",
10+
"docs:build": "vitepress build",
11+
"docs:preview": "vitepress preview"
12+
},
13+
"devDependencies": {
14+
"@iconify-json/carbon": "catalog:docs",
15+
"unocss": "catalog:docs",
16+
"vitepress": "catalog:docs"
17+
}
18+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Api Reference
2+
3+
## Macros
4+
5+
::: warning
6+
Please only call the macro in `.ts` file but not `.vue` or `.tsx` file, otherwise something unexpected may get happended.
7+
:::
8+
9+
### `defineCommentComponent`
10+
11+
```typescript
12+
import { defineCommentComponent } from 'vue-note'
13+
14+
declare function defineCommentComponent(component: () => void): Component
15+
```
16+
17+
Can be used to define a component with Vue Note.
18+
19+
```typescript
20+
import { defineCommentComponent, defineTemplate } from 'vue-note'
21+
22+
export default defineCommentComponent(() => {
23+
// Function body will turn into <script setup> part
24+
const msg = ref('Hello World')
25+
26+
defineTemplate(/* @template
27+
<h1>{{ msg }}</h1>
28+
*/)
29+
})
30+
```
31+
32+
The above code has the same behavior as the following SFC
33+
34+
```vue
35+
<script setup lang='ts'>
36+
const msg = ref('Hello World')
37+
</script>
38+
39+
<template>
40+
<h1>{{ msg }}</h1>
41+
</template>
42+
```
43+
44+
### `defineTemplate`
45+
46+
```typescript
47+
import { defineTemplate } from 'vue-note'
48+
49+
declare function defineTemplate(): void
50+
```
51+
52+
Can be used to define template in a comment component. **Can be ONLY called in [`defineCommentComponent`](#definecommentcomponent) function body and for only ONE time**.
53+
54+
And although there is no params requires, you need to write the component with a JavaScript block comment(multi-line comment) in the following struct
55+
56+
```typescript
57+
defineTemplate(/* @template<!--any template you want--> */)
58+
```
59+
60+
or with any format
61+
62+
```typescript
63+
defineTemplate(/* @template
64+
<!--any template you want-->
65+
*/)
66+
```
67+
68+
## Vite
69+
70+
### `VueNote`
71+
72+
Get the VueNote Vite plugin
73+
74+
```typescript
75+
declare function VueNote(): PluginOption
76+
```
77+
78+
and use it in [Vite Config](https://vite.dev/config/)
79+
80+
```typescript{3,7}
81+
import { defineConfig } from 'vite'
82+
import Vue from '@vitejs/plugin-vue'
83+
import { VueNote } from 'vue-note/vite'
84+
85+
export default defineConfig({
86+
plugins: [
87+
VueNote(),
88+
Vue(),
89+
],
90+
})
91+
92+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
State: **🚧 Work in progress**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
State: **🚧 Work in progress**

0 commit comments

Comments
 (0)