-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c56c57e
commit 02b96c4
Showing
8 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import DocCard from './src/doc-card.vue' | ||
|
||
export {DocCard} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<h2>Props : {{ api.propsExtends?.join(',') }}</h2> | ||
<table data-fill-width> | ||
<thead> | ||
<tr> | ||
<th>属性</th> | ||
<th>说明</th> | ||
<th>类型</th> | ||
<th>默认</th> | ||
</tr> | ||
</thead> | ||
<tr v-for="p in api.props"> | ||
<td>{{ p.name }}</td> | ||
<td>{{ p.description }}</td> | ||
<td>{{ p.type }}</td> | ||
<td></td> | ||
</tr> | ||
</table> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
table { | ||
border-collapse: collapse; | ||
} | ||
|
||
td, th { | ||
border-bottom: 1px solid var(--h-color-primary); | ||
border-left: 1px solid grey; | ||
border-right: 1px solid grey; | ||
border-top: 1px solid var(--h-color-primary); | ||
|
||
&:first-child { | ||
border-left: none; | ||
} | ||
|
||
&:last-child { | ||
border-right: none; | ||
} | ||
|
||
} | ||
|
||
</style> | ||
|
||
<script lang="ts" setup> | ||
import type {VueComponent} from '../../../../../packages/build-utils/webtypes' | ||
|
||
defineProps<{ | ||
api: VueComponent | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './case-card' | ||
export * from './code-box' | ||
export * from './doc-card' | ||
export * from './page-header' | ||
export * from './side-bar' | ||
export * from './statistics-chart' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import MarkdownIt from 'markdown-it' | ||
|
||
import {getVueComponent, setPathRoot} from '../../../../packages/build-utils/webtypes' | ||
|
||
import {filter} from './utils' | ||
import {VueMdEnv} from './vue-tool' | ||
|
||
const CASE_REG = /\[:api=(?<name>.+?)]/ | ||
|
||
setPathRoot('../packages') | ||
|
||
export function mdDocCardPlugin(md: MarkdownIt): void { | ||
md.core.ruler.push('doc-card', (state) => { | ||
let {imports, components, codes} = state.env as VueMdEnv | ||
filter(state.tokens, 'text').forEach((t) => { | ||
if (t.content.includes('[:api=')) { | ||
let parts = t.content.split(CASE_REG) | ||
if (parts.length > 1) { | ||
t.type = 'doc-card' | ||
t.block = true | ||
t.children = [] | ||
components.add('DocCard') | ||
let c = getVueComponent(parts[1]) | ||
imports.add('const api=' + JSON.stringify(c)) | ||
} | ||
} | ||
}) | ||
}) | ||
|
||
md.renderer.rules['doc-card'] = (tokens, idx, options, env, self) => { | ||
return `<doc-card :api="api"/>` | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,5 @@ title: H-UI-Button | |
禁用只需加上`disabled`属性即可。 | ||
|
||
[.shadows] | ||
|
||
[:api=button] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ title: H-UI-Checkbox | |
- `xlarge` | ||
|
||
[.sizes] | ||
|
||
[:api=check-box] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ title: H-UI-Switch | |
## 大小 | ||
|
||
[.sizes] | ||
|
||
[:api=switch] |