Skip to content

Commit 592e9f7

Browse files
authored
feat(ui): added ui package (#98)
Signed-off-by: Neko Ayaka <neko@ayaka.moe>
1 parent ae39f0e commit 592e9f7

14 files changed

Lines changed: 218 additions & 3 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"graymatter",
1111
"iconify",
1212
"Logseq",
13-
"Nólëbase",
13+
"mkdist",
1414
"nolebase",
15+
"Nólëbase",
1516
"quotepath"
1617
],
1718
"prettier.enable": false,

docs/.vitepress/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default defineConfig({
4848
nav: [
4949
{ text: 'Guide', link: '/pages/en/guide/getting-started' },
5050
{ text: 'Integrations', link: '/pages/en/integrations/' },
51+
{ text: 'UI Components', link: '/pages/en/ui/' },
5152
],
5253
sidebar: [
5354
{
@@ -98,6 +99,7 @@ export default defineConfig({
9899
nav: [
99100
{ text: '指南', link: '/pages/zh-CN/guide/getting-started' },
100101
{ text: '集成', link: '/pages/zh-CN/integrations/' },
102+
{ text: 'UI 组件', link: '/pages/zh-CN/ui/' },
101103
],
102104
sidebar: [
103105
{

docs/.vitepress/theme/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { h } from 'vue'
2+
import type { Theme } from 'vitepress'
23
import DefaultTheme from 'vitepress/theme'
34

5+
import {
6+
install as installNolebaseUI,
7+
} from '@nolebase/ui'
8+
49
import {
510
LayoutMode as NolebaseEnhancedReadabilitiesLayoutMode,
611
NolebaseEnhancedReadabilitiesMenu,
@@ -35,7 +40,6 @@ import '@nolebase/vitepress-plugin-page-properties/client/style.css'
3540
import './styles/vars.css'
3641
import './styles/main.css'
3742

38-
import type { Theme } from 'vitepress'
3943
import IntegrationCard from './components/IntegrationCard.vue'
4044
import HomeContent from './components/HomeContent.vue'
4145
import RiveCanvas from './components/LazyRiveDataCanvas.vue'
@@ -57,6 +61,8 @@ export default {
5761
})
5862
},
5963
enhanceApp({ app }) {
64+
installNolebaseUI(app)
65+
6066
app.component('IntegrationCard', IntegrationCard)
6167
app.component('HomeContent', HomeContent)
6268

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"devDependencies": {
1313
"@nolebase/markdown-it-bi-directional-links": "workspace:^",
1414
"@nolebase/markdown-it-element-transform": "workspace:^",
15+
"@nolebase/ui": "workspace:^",
1516
"@nolebase/vitepress-plugin-enhanced-readabilities": "workspace:^",
1617
"@nolebase/vitepress-plugin-git-changelog": "workspace:^",
1718
"@nolebase/vitepress-plugin-highlight-targeted-heading": "workspace:^",

docs/pages/en/ui/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# UI Components
2+
3+
::: warning 🚧 Constructing
4+
Nice to meet you! But sorry, this page is still under construction. If you don’t find the information you are interested in, you can first find the content you are interested in in the navigation in the sidebar to start reading.
5+
:::
6+
7+
## Buttons
8+
9+
<div>
10+
<NuButton>
11+
ABCD
12+
</NuButton>
13+
</div>

docs/pages/zh-CN/ui/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# UI 组件
2+
3+
::: warning 🚧 施工中
4+
很高兴见到你!但很抱歉,这个页面还在施工中,如果没有找到你感兴趣的信息,你可以先在侧边栏的导航中寻找你感兴趣的内容来开始阅读
5+
:::
6+
7+
## 按钮
8+
9+
<div>
10+
<NuButton>
11+
ABCD
12+
</NuButton>
13+
</div>

docs/vite.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from 'node:path'
1+
import { join, resolve } from 'node:path'
22
import { defineConfig } from 'vite'
33
import UnoCSS from 'unocss/vite'
44
import Inspect from 'vite-plugin-inspect'
@@ -11,6 +11,11 @@ export default defineConfig({
1111
'**/*.mp4',
1212
'**/*.riv',
1313
],
14+
resolve: {
15+
alias: {
16+
'@nolebase/ui': resolve(__dirname, '../packages/ui/src/'),
17+
},
18+
},
1419
plugins: [
1520
Inspect(),
1621
UnoCSS(),

packages/ui/build.config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Thanks to https://github.com/wobsoriano/vue-sfc-unbuild
2+
// and all the discussions in https://github.com/unjs/unbuild/issues/80
3+
// for the following configuration.
4+
5+
import { defineBuildConfig } from 'unbuild'
6+
7+
export default defineBuildConfig({
8+
entries: [
9+
{
10+
builder: 'mkdist',
11+
input: './src',
12+
pattern: ['**/*.vue'],
13+
loaders: ['vue'],
14+
},
15+
{
16+
builder: 'mkdist',
17+
input: './src',
18+
pattern: ['**/*.ts'],
19+
format: 'cjs',
20+
loaders: ['js'],
21+
},
22+
{
23+
builder: 'mkdist',
24+
input: './src',
25+
pattern: ['**/*.ts'],
26+
format: 'esm',
27+
loaders: ['js'],
28+
},
29+
],
30+
declaration: true,
31+
clean: true,
32+
})

packages/ui/package.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "@nolebase/ui",
3+
"type": "module",
4+
"version": "1.22.4",
5+
"description": "A collection of Vue components Nolebase uses.",
6+
"author": {
7+
"name": "Nólëbase",
8+
"email": "nolebase@ayaka.moe",
9+
"url": "https://github.com/nolebase"
10+
},
11+
"license": "MIT",
12+
"homepage": "https://nolebase-integrations.ayaka.io/pages/en/ui/",
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/nolebase/integrations.git",
16+
"directory": "packages/ui"
17+
},
18+
"keywords": [
19+
"unjs",
20+
"vue",
21+
"vite",
22+
"vitepress",
23+
"vitepress-plugin",
24+
"components",
25+
"component-library",
26+
"markdown",
27+
"frontmatter",
28+
"nolebase",
29+
"nolebase-integration"
30+
],
31+
"sideEffects": false,
32+
"exports": {
33+
".": {
34+
"types": "./dist/index.d.ts",
35+
"import": "./dist/index.mjs",
36+
"require": "./dist/index.js"
37+
}
38+
},
39+
"main": "./dist/index.js",
40+
"module": "./dist/index.mjs",
41+
"types": "./dist/index.d.ts",
42+
"typesVersions": {
43+
"*": {
44+
"*": [
45+
"*",
46+
"dist/*",
47+
"dist/*.d.ts",
48+
"dist/*/index.d.ts"
49+
]
50+
}
51+
},
52+
"files": [
53+
"README.md",
54+
"dist",
55+
"package.json"
56+
],
57+
"scripts": {
58+
"build": "unbuild"
59+
},
60+
"peerDependencies": {
61+
"vue": "^3.2.0"
62+
},
63+
"devDependencies": {
64+
"@vue/tsconfig": "^0.5.1"
65+
}
66+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
4+
const count = ref(0)
5+
6+
function onClick() {
7+
count.value++
8+
// eslint-disable-next-line no-console
9+
console.log('Button clicked')
10+
}
11+
</script>
12+
13+
<template>
14+
<div>
15+
<button
16+
bg="blue" rounded="md" text="white" p="2" shadow="md" transition="all 0.3s ease"
17+
@click="onClick"
18+
>
19+
<span>
20+
Count is: {{ count }}
21+
</span>
22+
<div>
23+
<slot />
24+
</div>
25+
</button>
26+
</div>
27+
</template>

0 commit comments

Comments
 (0)