-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10451 from element-plus/dev
D2M
- Loading branch information
Showing
110 changed files
with
1,925 additions
and
941 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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import markdown from 'markdown-it' | ||
|
||
import type MarkdownIt from 'markdown-it' | ||
|
||
const ApiMd = new markdown() | ||
|
||
export const ApiTableContainer = (md: MarkdownIt) => { | ||
const fence = md.renderer.rules.fence! | ||
|
||
ApiMd.renderer.rules = md.renderer.rules | ||
md.renderer.rules.fence = (...args) => { | ||
const [tokens, idx, ...rest] = args | ||
const [options, env] = rest | ||
const token = tokens[idx] | ||
if (token.info === 'api') { | ||
const newTokens = md.parse(token.content, env) | ||
|
||
let result = '' | ||
const { rules } = md.renderer | ||
newTokens.forEach((newToken, idx) => { | ||
const { type } = newToken | ||
if (type === 'inline') { | ||
result += md.renderer.renderInline(newToken.children!, options, env) | ||
} else if (typeof rules[type] !== 'undefined') { | ||
result += rules[newToken.type]!( | ||
newTokens, | ||
idx, | ||
options, | ||
env, | ||
md.renderer | ||
) | ||
} else { | ||
result += md.renderer.renderToken(newTokens, idx, options) | ||
} | ||
}) | ||
return result | ||
} | ||
return fence.call(md, ...args) | ||
} | ||
} |
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,29 @@ | ||
import type MarkdownIt from 'markdown-it' | ||
|
||
export default (md: MarkdownIt): void => { | ||
md.renderer.rules.tooltip = (tokens, idx) => { | ||
const token = tokens[idx] | ||
|
||
return `<api-typing type="${token.content}" details="${token.info}" />` | ||
} | ||
|
||
md.inline.ruler.before('emphasis', 'tooltip', (state, silent) => { | ||
const tooltipRegExp = /^\^\[([^\]]*)\](`[^`]*`)?/ | ||
const str = state.src.slice(state.pos, state.posMax) | ||
|
||
if (!tooltipRegExp.test(str)) return false | ||
if (silent) return true | ||
|
||
const result = str.match(tooltipRegExp) | ||
|
||
if (!result) return false | ||
|
||
const token = state.push('tooltip', 'tooltip', 0) | ||
token.content = result[1].replace(/\\\|/g, '|') | ||
token.info = (result[2] || '').replace(/^`(.*)`$/, '$1') | ||
token.level = state.level | ||
state.pos += result[0].length | ||
|
||
return true | ||
}) | ||
} |
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,7 @@ | ||
<script setup lang="ts"> | ||
import Primitive from './vp-api-primitive.vue' | ||
</script> | ||
|
||
<template> | ||
<Primitive type="boolean" /> | ||
</template> |
20 changes: 20 additions & 0 deletions
20
docs/.vitepress/vitepress/components/globals/vp-api-enum.vue
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,20 @@ | ||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import { isString } from '@vue/shared' | ||
import ApiTyping from './vp-api-typing.vue' | ||
const props = defineProps({ | ||
values: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}) | ||
const processString = (s: unknown) => (isString(s) ? `'${s}'` : s) | ||
const details = computed(() => props.values.map(processString).join(' | ')) | ||
</script> | ||
|
||
<template> | ||
<api-typing type="enum" :details="details" /> | ||
</template> |
33 changes: 33 additions & 0 deletions
33
docs/.vitepress/vitepress/components/globals/vp-api-external.vue
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,33 @@ | ||
<script setup lang="ts"> | ||
import VpLink from '../common/vp-link.vue' | ||
defineProps({ | ||
text: { | ||
type: String, | ||
required: true, | ||
}, | ||
url: { | ||
type: String, | ||
required: true, | ||
}, | ||
prefix: { | ||
type: String, | ||
default: '', | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<slot> | ||
<span v-if="prefix" class="mr-1">{{ prefix }}</span> | ||
<VpLink :href="url"> | ||
{{ text }} | ||
</VpLink> | ||
</slot> | ||
</template> | ||
|
||
<style scoped> | ||
:deep(.el-icon) { | ||
font-size: 18px; | ||
} | ||
</style> |
Oops, something went wrong.