Skip to content

Commit

Permalink
feat: 🎸 website 基本内容
Browse files Browse the repository at this point in the history
  • Loading branch information
QiuShuiBai committed Nov 19, 2024
1 parent fc7853d commit 3b0773b
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 36 deletions.
20 changes: 0 additions & 20 deletions demo/docs/.vitepress/sidebar/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,6 @@ export default [
{
text: '介绍',
link: '/guide/intro'
},
{
text: '快速上手',
link: '/guide/quick-start'
},
{
text: '更新日志',
link: '/guide/changelog'
},
{
text: '主题与样式',
link: '/guide/theme'
},
{
text: '设计变量',
link: '/guide/design-tokens'
},
{
text: '联系我们',
link: '/guide/contact'
}
]
}
Expand Down
2 changes: 0 additions & 2 deletions demo/docs/.vitepress/theme/index.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import VueseWebsiteTheme from '@mpxjs/vuese-website/dist/theme/index'
import Layout from '../../../../packages/website/theme/layouts/Layout.vue'
import Card from '@mpxjs/vuese-website/dist/theme/global-components/Card.vue'
import { h } from 'vue'

export default {
extend: VueseWebsiteTheme,
Layout,
enhanceApp({ router, app }) {
router.go('/mpx-ui/guide/dialog.html'),
app.component('Card', Card)
},
themeConfig: {
Expand Down
8 changes: 6 additions & 2 deletions demo/docs/guide/basic-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@
<cube-button>默认按钮</cube-button>
<cube-button primary>主要按钮</cube-button>
<!-- @example: btn-bolder -> template no-wrap @code-block:name-->
<cube-button bolder>粗体文字</cube-button>
<cube-button outline>细框按钮</cube-button>
<cube-button inline>内联按钮</cube-button>
<cube-button light>明亮按钮</cube-button>
<cube-button outline primary>outline - primary</cube-button>
<cube-button inline outline>inline - outline</cube-button>
<cube-button inline primary>inline - primary</cube-button>
<!-- @example: btn-secondary-active -> template no-wrap @code-block:first-->
<cube-button active>激活态1234</cube-button>
<cube-button>
<div>12345hhhh</div>
</cube-button>
<div>1234</div>
```

</collapse-wrapper>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"vue-template-compiler": "^2.6.11"
},
"devDependencies": {
"vue3": "npm:[email protected]",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
Expand Down
6 changes: 5 additions & 1 deletion packages/website/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getFiles } from './get-files-list'
import { getCache } from './cache'

export type WebsiteConfig = {
command: 'dev'|'bulid',
srcDirPath: string
exampleDirPath: string
outputPath: string
Expand Down Expand Up @@ -72,7 +73,10 @@ export default function website(config: WebsiteConfig): void {
watch(config)

// 启动 VitePress 开发服务器
spawn('npx', ['vitepress', 'dev', config.doscPath || 'docs'], { stdio: 'inherit' });
const child = spawn('npx', ['vitepress', config.command || 'dev', config.doscPath || 'docs'], { stdio: 'inherit' });
child.on('close', (code) => {
if (code === 0) process.exit(0)
})
// 构建 VitePress 静态文件
// spawn('npx', ['vitepress', 'build', 'docs'], { stdio: 'inherit' });
}
6 changes: 3 additions & 3 deletions packages/website/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mpxjs/vuese-website",
"version": "0.0.2-beta.16",
"name": "@didi/vuese-website",
"version": "0.0.2-beta.22",
"description": "构建示例网站",
"author": "QiuShuiBai <[email protected]>",
"homepage": "",
Expand All @@ -23,7 +23,7 @@
"dependencies": {
"@mpxjs/vuese-parser": "~1.0.2",
"@mpxjs/vuese-markdown-render": "~1.0.0",
"vitepress": "^1.2.2",
"vitepress": "^1.3",
"vue": "^3.0.0",
"highlight.js": "^11.9.0",
"dirty-json": "^0.9.2",
Expand Down
11 changes: 6 additions & 5 deletions packages/website/theme/components/Preview.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div ref="containerRef" class="preview-container">
<div ref="containerRef" class="preview-container" v-if="showPreview">
<div class="preview" ref="previewRef">
<span class="current-time"></span>
<header class="header">
Expand Down Expand Up @@ -27,18 +27,19 @@

<script setup lang="ts">
import { throttle } from 'lodash-es'
import { useData } from 'vitepress'
import { ref, onMounted, computed, watch, onUnmounted } from 'vue'
import { useRouter, useRoute } from 'vitepress'
import { useRouter, useRoute, useData } from 'vitepress'
const route = useRoute()
const router = useRouter()
const back = () => {
window.history.back()
}
const { theme, site } = useData()
const { theme } = useData()
const iframeConfig = computed(() => theme.value.iframeConfig)
const showPreview = computed(() => {
return !iframeConfig.value.hide
})
const previewPath = (() => {
const baseUrl = process.env.NODE_ENV === 'development'
? iframeConfig.value?.path.dev
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import DefaultTheme from 'vitepress/theme'
// import { defineConfig } from 'vitepress'


export default {
extend: DefaultTheme
}
10 changes: 9 additions & 1 deletion packages/website/theme/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="main-container">
<div class="main"><VPDoc></VPDoc></div>
<ClientOnly>
<Preview ref="preview" class="show-absolute" >
<Preview ref="preview" class="show-absolute" v-if="showPreview">
<slot></slot>
</Preview>
</ClientOnly>
Expand All @@ -19,6 +19,14 @@
import Preview from '../components/Preview.vue'
import VPDoc from '../components/VPDoc.vue'
import Layout from '../components/Layout.vue'
import { useData } from 'vitepress'
import { computed } from 'vue'
const { theme } = useData()
const iframeConfig = computed(() => theme.value.iframeConfig)
const showPreview = computed(() => {
return !iframeConfig.value.hide
})
</script>

<style lang="stylus" scoped>
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"packages/declarations.d.ts",
"packages/**/index.d.ts",
"packages/*/lib",
"packages/*/__test__"
"packages/*/__test__",
"packages/**/*.mjs",
]
}
105 changes: 105 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,17 @@
estree-walker "^2.0.2"
source-map-js "^1.2.0"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/compiler-core/-/compiler-core-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fcompiler-core%2F-%2Fcompiler-core-3.4.38.tgz#326dfe3c92fa2b0f1dc9b39a948a231980253496"
integrity sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==
dependencies:
"@babel/parser" "^7.24.7"
"@vue/shared" "3.4.38"
entities "^4.5.0"
estree-walker "^2.0.2"
source-map-js "^1.2.0"

"@vue/[email protected]":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.29.tgz#c8f55528c8d8c8c36687d56a19e53b268c7d6c56"
Expand All @@ -1944,6 +1955,14 @@
"@vue/compiler-core" "3.4.29"
"@vue/shared" "3.4.29"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/compiler-dom/-/compiler-dom-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fcompiler-dom%2F-%2Fcompiler-dom-3.4.38.tgz#90348fac1130e0bbd408b650635cb626b3b9df06"
integrity sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==
dependencies:
"@vue/compiler-core" "3.4.38"
"@vue/shared" "3.4.38"

"@vue/[email protected]":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.29.tgz#da7927c5c736048995fe9c6604288633e0ac161a"
Expand All @@ -1959,6 +1978,21 @@
postcss "^8.4.38"
source-map-js "^1.2.0"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/compiler-sfc/-/compiler-sfc-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fcompiler-sfc%2F-%2Fcompiler-sfc-3.4.38.tgz#954c3f6777bbbcca28771ba59b795f12f76ef188"
integrity sha512-s5QfZ+9PzPh3T5H4hsQDJtI8x7zdJaew/dCGgqZ2630XdzaZ3AD8xGZfBqpT8oaD/p2eedd+pL8tD5vvt5ZYJQ==
dependencies:
"@babel/parser" "^7.24.7"
"@vue/compiler-core" "3.4.38"
"@vue/compiler-dom" "3.4.38"
"@vue/compiler-ssr" "3.4.38"
"@vue/shared" "3.4.38"
estree-walker "^2.0.2"
magic-string "^0.30.10"
postcss "^8.4.40"
source-map-js "^1.2.0"

"@vue/[email protected]":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.29.tgz#210b0267667fe1e5ec69ca4e3c473f94da6ac37f"
Expand All @@ -1967,6 +2001,14 @@
"@vue/compiler-dom" "3.4.29"
"@vue/shared" "3.4.29"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/compiler-ssr/-/compiler-ssr-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fcompiler-ssr%2F-%2Fcompiler-ssr-3.4.38.tgz#9ded18f6d9c8b2440039a58492cfff36fa1a7774"
integrity sha512-YXznKFQ8dxYpAz9zLuVvfcXhc31FSPFDcqr0kyujbOwNhlmaNvL2QfIy+RZeJgSn5Fk54CWoEUeW+NVBAogGaw==
dependencies:
"@vue/compiler-dom" "3.4.38"
"@vue/shared" "3.4.38"

"@vue/devtools-api@^7.2.1":
version "7.3.0"
resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.3.0.tgz#55623f9d0b956e718d5234ec39f254a820f5d832"
Expand Down Expand Up @@ -2001,6 +2043,13 @@
dependencies:
"@vue/shared" "3.4.29"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/reactivity/-/reactivity-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Freactivity%2F-%2Freactivity-3.4.38.tgz#ec2d549f4b831cd03d0baabf7d77e840b8536000"
integrity sha512-4vl4wMMVniLsSYYeldAKzbk72+D3hUnkw9z8lDeJacTxAkXeDAP1uE9xr2+aKIN0ipOL8EG2GPouVTH6yF7Gnw==
dependencies:
"@vue/shared" "3.4.38"

"@vue/[email protected]":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.29.tgz#3c7d5ef00aa8ab1e1de9de0a8656f21db3cd8367"
Expand All @@ -2009,6 +2058,14 @@
"@vue/reactivity" "3.4.29"
"@vue/shared" "3.4.29"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/runtime-core/-/runtime-core-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fruntime-core%2F-%2Fruntime-core-3.4.38.tgz#bead9085e9a1c5a446e27d74ffb450f9261cf097"
integrity sha512-21z3wA99EABtuf+O3IhdxP0iHgkBs1vuoCAsCKLVJPEjpVqvblwBnTj42vzHRlWDCyxu9ptDm7sI2ZMcWrQqlA==
dependencies:
"@vue/reactivity" "3.4.38"
"@vue/shared" "3.4.38"

"@vue/[email protected]":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.29.tgz#02d4199e8280b3f1332ec35e03bfcc244ce2bfdb"
Expand All @@ -2019,6 +2076,16 @@
"@vue/shared" "3.4.29"
csstype "^3.1.3"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/runtime-dom/-/runtime-dom-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fruntime-dom%2F-%2Fruntime-dom-3.4.38.tgz#52678ba0b85f94400a0a9c8dd23ddef4dd65657d"
integrity sha512-afZzmUreU7vKwKsV17H1NDThEEmdYI+GCAK/KY1U957Ig2NATPVjCROv61R19fjZNzMmiU03n79OMnXyJVN0UA==
dependencies:
"@vue/reactivity" "3.4.38"
"@vue/runtime-core" "3.4.38"
"@vue/shared" "3.4.38"
csstype "^3.1.3"

"@vue/[email protected]":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.29.tgz#7a6d322837d836dd3affa69553f9fba140f91723"
Expand All @@ -2027,11 +2094,24 @@
"@vue/compiler-ssr" "3.4.29"
"@vue/shared" "3.4.29"

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/server-renderer/-/server-renderer-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fserver-renderer%2F-%2Fserver-renderer-3.4.38.tgz#457401ef2b0f969156702061e56915acecc9fe2c"
integrity sha512-NggOTr82FbPEkkUvBm4fTGcwUY8UuTsnWC/L2YZBmvaQ4C4Jl/Ao4HHTB+l7WnFCt5M/dN3l0XLuyjzswGYVCA==
dependencies:
"@vue/compiler-ssr" "3.4.38"
"@vue/shared" "3.4.38"

"@vue/[email protected]", "@vue/shared@^3.4.27":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz#84908c284e88a269f8bceee59707b14eb4b2d284"
integrity sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==

"@vue/[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/@vue/shared/-/shared-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2F%40vue%2Fshared%2F-%2Fshared-3.4.38.tgz#552a6770098bfd556fa3e2c686c9d3b4f4cd94c2"
integrity sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==

"@vueuse/[email protected]", "@vueuse/core@^10.10.0":
version "10.11.0"
resolved "https://registry.npmjs.org/@vueuse/core/-/core-10.11.0.tgz#b042585a8bf98bb29c177b33999bd0e3fcd9e65d"
Expand Down Expand Up @@ -7592,6 +7672,11 @@ picocolors@^1.0.0:
resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1"
integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==

picocolors@^1.0.1:
version "1.1.0"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/picocolors/-/picocolors-1.1.0.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2Fpicocolors%2F-%2Fpicocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59"
integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==

picomatch@^2.2.2, picomatch@^2.3.1:
version "2.3.1"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/picomatch/-/picomatch-2.3.1.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2Fpicomatch%2F-%2Fpicomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
Expand Down Expand Up @@ -7673,6 +7758,15 @@ postcss@^8.4.38:
picocolors "^1.0.0"
source-map-js "^1.2.0"

postcss@^8.4.40:
version "8.4.45"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/postcss/-/postcss-8.4.45.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2Fpostcss%2F-%2Fpostcss-8.4.45.tgz#538d13d89a16ef71edbf75d895284ae06b79e603"
integrity sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==
dependencies:
nanoid "^3.3.7"
picocolors "^1.0.1"
source-map-js "^1.2.0"

preact@^10.0.0:
version "10.22.0"
resolved "https://registry.npmjs.org/preact/-/preact-10.22.0.tgz#a50f38006ae438d255e2631cbdaf7488e6dd4e16"
Expand Down Expand Up @@ -9446,6 +9540,17 @@ vue-template-compiler@^2.6.11:
de-indent "^1.0.2"
he "^1.1.0"

"vue3@npm:[email protected]":
version "3.4.38"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/vue/-/vue-3.4.38.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2Fvue%2F-%2Fvue-3.4.38.tgz#0ccbb64ed03ef3c4ab73e540793290b18e7c4236"
integrity sha512-f0ZgN+mZ5KFgVv9wz0f4OgVKukoXtS3nwET4c2vLBGQR50aI8G0cqbFtLlX9Yiyg3LFGBitruPHt2PxwTduJEw==
dependencies:
"@vue/compiler-dom" "3.4.38"
"@vue/compiler-sfc" "3.4.38"
"@vue/runtime-dom" "3.4.38"
"@vue/server-renderer" "3.4.38"
"@vue/shared" "3.4.38"

vue@^3.0.0, vue@^3.4.27:
version "3.4.29"
resolved "http://artifactory.intra.xiaojukeji.com/artifactory/api/npm/npm/vue/-/vue-3.4.29.tgz?dl=https%3A%2F%2Fregistry.npmmirror.com%2Fvue%2F-%2Fvue-3.4.29.tgz#fad5a0fe6dfa5c4a2cfbbc48c489e7989616a15b"
Expand Down

0 comments on commit 3b0773b

Please sign in to comment.