@maple-design/cli-vue 0.0.0-stage → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +305 -2
- package/README.zh-CN.md +305 -0
- package/bin/cli.mjs +5 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/lib/client/appType.d.ts +4 -0
- package/lib/client/appType.js +7 -0
- package/lib/client/index.d.ts +29 -0
- package/lib/client/index.js +170 -0
- package/lib/client/language.d.ts +11 -0
- package/lib/client/language.js +52 -0
- package/lib/client/theme-state.d.ts +3 -0
- package/lib/client/theme-state.js +6 -0
- package/lib/node/bin.d.ts +2 -0
- package/lib/node/bin.js +154 -0
- package/lib/node/commands/build.d.ts +1 -0
- package/lib/node/commands/build.js +15 -0
- package/lib/node/commands/checklist.d.ts +6 -0
- package/lib/node/commands/checklist.js +59 -0
- package/lib/node/commands/compile.d.ts +3 -0
- package/lib/node/commands/compile.js +41 -0
- package/lib/node/commands/create.d.ts +8 -0
- package/lib/node/commands/create.js +91 -0
- package/lib/node/commands/dev.d.ts +6 -0
- package/lib/node/commands/dev.js +58 -0
- package/lib/node/commands/extension.d.ts +3 -0
- package/lib/node/commands/extension.js +5 -0
- package/lib/node/commands/gen.d.ts +24 -0
- package/lib/node/commands/gen.js +91 -0
- package/lib/node/commands/icons.d.ts +4 -0
- package/lib/node/commands/icons.js +15 -0
- package/lib/node/commands/preview.d.ts +4 -0
- package/lib/node/commands/preview.js +18 -0
- package/lib/node/commands/styleVars.d.ts +1 -0
- package/lib/node/commands/styleVars.js +6 -0
- package/lib/node/commands/test.d.ts +7 -0
- package/lib/node/commands/test.js +16 -0
- package/lib/node/commands/vite.d.ts +2 -0
- package/lib/node/commands/vite.js +14 -0
- package/lib/node/compiler/compileModule.d.ts +4 -0
- package/lib/node/compiler/compileModule.js +78 -0
- package/lib/node/compiler/compileSFC.d.ts +6 -0
- package/lib/node/compiler/compileSFC.js +119 -0
- package/lib/node/compiler/compileScript.d.ts +27 -0
- package/lib/node/compiler/compileScript.js +221 -0
- package/lib/node/compiler/compileSiteEntry.d.ts +19 -0
- package/lib/node/compiler/compileSiteEntry.js +164 -0
- package/lib/node/compiler/compileStyle.d.ts +14 -0
- package/lib/node/compiler/compileStyle.js +55 -0
- package/lib/node/compiler/compileStyleVars.d.ts +3 -0
- package/lib/node/compiler/compileStyleVars.js +46 -0
- package/lib/node/compiler/compileTemplateHighlight.d.ts +18 -0
- package/lib/node/compiler/compileTemplateHighlight.js +133 -0
- package/lib/node/compiler/compileTypes.d.ts +2 -0
- package/lib/node/compiler/compileTypes.js +58 -0
- package/lib/node/compiler/generateLibraryEntry.d.ts +3 -0
- package/lib/node/compiler/generateLibraryEntry.js +152 -0
- package/lib/node/compiler/siteRoutes.d.ts +4 -0
- package/lib/node/compiler/siteRoutes.js +9 -0
- package/lib/node/config/maple.config.d.ts +215 -0
- package/lib/node/config/maple.config.js +32 -0
- package/lib/node/config/maple.default.config.d.ts +2 -0
- package/lib/node/config/maple.default.config.js +386 -0
- package/lib/node/config/site-resolver.d.ts +25 -0
- package/lib/node/config/site-resolver.js +138 -0
- package/lib/node/config/vite.config.d.ts +28 -0
- package/lib/node/config/vite.config.js +209 -0
- package/lib/node/config/vitest.config.d.ts +2 -0
- package/lib/node/config/vitest.config.js +54 -0
- package/lib/node/config/vitest.setup.d.ts +1 -0
- package/lib/node/config/vitest.setup.js +8 -0
- package/lib/node/index.d.ts +13 -0
- package/lib/node/index.js +13 -0
- package/lib/node/release/index.d.ts +20 -0
- package/lib/node/release/index.js +147 -0
- package/lib/node/shared/constant.d.ts +47 -0
- package/lib/node/shared/constant.js +53 -0
- package/lib/node/shared/fsUtils.d.ts +18 -0
- package/lib/node/shared/fsUtils.js +57 -0
- package/lib/node/shared/logger.d.ts +8 -0
- package/lib/node/shared/logger.js +18 -0
- package/lib/node/shared/serial-task.d.ts +2 -0
- package/lib/node/shared/serial-task.js +9 -0
- package/package.json +111 -3
- package/site/documentation-sections.spec.ts +45 -0
- package/site/documentation-sections.ts +48 -0
- package/site/index.html +89 -0
- package/site/mobile/App.vue +437 -0
- package/site/mobile/AppHome.vue +154 -0
- package/site/mobile/main.ts +99 -0
- package/site/mobile/route-sync.spec.ts +34 -0
- package/site/mobile/route-sync.ts +10 -0
- package/site/mobile.html +70 -0
- package/site/module.d.ts +5 -0
- package/site/pc/App.vue +44 -0
- package/site/pc/Layout.vue +641 -0
- package/site/pc/components/AppAd.vue +117 -0
- package/site/pc/components/AppHeader.vue +459 -0
- package/site/pc/components/AppMobile.spec.ts +204 -0
- package/site/pc/components/AppMobile.vue +201 -0
- package/site/pc/components/AppOutline.spec.ts +89 -0
- package/site/pc/components/AppOutline.vue +161 -0
- package/site/pc/components/AppSidebar.vue +144 -0
- package/site/pc/components/code-example/CodeExample.spec.ts +36 -0
- package/site/pc/components/code-example/CodeExample.vue +164 -0
- package/site/pc/components/code-example/codeExample.less +88 -0
- package/site/pc/components/code-example/index.ts +10 -0
- package/site/pc/components/demo-preview/DemoPreview.vue +92 -0
- package/site/pc/components/demo-preview/index.ts +8 -0
- package/site/pc/components/mobile-preview-url.ts +17 -0
- package/site/pc/components/preview-section.spec.ts +24 -0
- package/site/pc/components/preview-section.ts +23 -0
- package/site/pc/main.ts +108 -0
- package/site/pc/pages/index/index.vue +421 -0
- package/site/pc/pages/index/locale/en-US.ts +1 -0
- package/site/pc/pages/index/locale/zh-CN.ts +1 -0
- package/site/pc/responsive-layout.spec.ts +40 -0
- package/site/pc/route-state.spec.ts +34 -0
- package/site/pc/route-state.ts +25 -0
- package/site/pc/scroll-hash.spec.ts +49 -0
- package/site/pc/scroll-hash.ts +25 -0
- package/site/route-recovery.spec.ts +51 -0
- package/site/route-recovery.ts +38 -0
- package/site/tsconfig.json +16 -0
- package/site/types.ts +6 -0
- package/site/utils.ts +45 -0
- package/template/create/[ComponentName].tsx.ejs +16 -0
- package/template/create/[ComponentName].vue.ejs +21 -0
- package/template/create/[componentName].d.ts.ejs +13 -0
- package/template/create/__tests__/index.spec.js.ejs +10 -0
- package/template/create/docs/en-US.md +0 -0
- package/template/create/docs/zh-CN.md +0 -0
- package/template/create/example/index.vue.ejs +17 -0
- package/template/create/example/locale/_index.ts +17 -0
- package/template/create/example/locale/en-US.ts +3 -0
- package/template/create/example/locale/index.ts +24 -0
- package/template/create/example/locale/zh-CN.ts +3 -0
- package/template/create/index.ts.ejs +12 -0
- package/template/create/props.ts +1 -0
- package/template/create/style/[componentName].less.ejs +5 -0
- package/template/create/style/index.less.ejs +1 -0
- package/template/create/style/index.ts.ejs +1 -0
- package/template/generators/base/.browserslistrc +2 -0
- package/template/generators/base/.prettierignore +14 -0
- package/template/generators/base/README.md +90 -0
- package/template/generators/base/_gitignore +19 -0
- package/template/generators/base/eslint.config.js +15 -0
- package/template/generators/base/package.json +97 -0
- package/template/generators/base/prettier.config.js +3 -0
- package/template/generators/base/public/logo.svg +30 -0
- package/template/generators/base/shims/shims-md.d.ts +4 -0
- package/template/generators/base/shims/shims-vue.d.ts +6 -0
- package/template/generators/base/tsconfig.declaration.json +21 -0
- package/template/generators/base/tsconfig.json +28 -0
- package/template/generators/base/ui-build.config.mjs +16 -0
- package/template/generators/config/default/base/docs/home.zh-CN.md +3 -0
- package/template/generators/config/default/base/maple.config.mjs +49 -0
- package/template/generators/config/default/sfc/src/button/Button.vue +34 -0
- package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/default/sfc/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/default/sfc/src/button/example/BasicUse.vue +7 -0
- package/template/generators/config/default/sfc/src/button/example/ModifyColor.vue +7 -0
- package/template/generators/config/default/sfc/src/button/example/index.vue +12 -0
- package/template/generators/config/default/sfc/src/button/index.ts +8 -0
- package/template/generators/config/default/sfc/src/button/style/button.less +14 -0
- package/template/generators/config/default/sfc/src/button/style/index.less +1 -0
- package/template/generators/config/default/sfc/src/button/style/index.ts +1 -0
- package/template/generators/config/default/sfc/src/utils/components.ts +20 -0
- package/template/generators/config/default/tsx/src/button/Button.tsx +30 -0
- package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/default/tsx/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/default/tsx/src/button/example/BasicUse.vue +7 -0
- package/template/generators/config/default/tsx/src/button/example/ModifyColor.vue +7 -0
- package/template/generators/config/default/tsx/src/button/example/index.vue +12 -0
- package/template/generators/config/default/tsx/src/button/index.ts +8 -0
- package/template/generators/config/default/tsx/src/button/style/button.less +14 -0
- package/template/generators/config/default/tsx/src/button/style/index.less +1 -0
- package/template/generators/config/default/tsx/src/button/style/index.ts +1 -0
- package/template/generators/config/default/tsx/src/utils/components.ts +20 -0
- package/template/generators/config/i18n/base/docs/home.en-US.md +3 -0
- package/template/generators/config/i18n/base/docs/home.zh-CN.md +3 -0
- package/template/generators/config/i18n/base/maple.config.mjs +51 -0
- package/template/generators/config/i18n/sfc/src/button/Button.vue +38 -0
- package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/i18n/sfc/src/button/docs/en-US.md +39 -0
- package/template/generators/config/i18n/sfc/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +11 -0
- package/template/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +11 -0
- package/template/generators/config/i18n/sfc/src/button/example/index.vue +15 -0
- package/template/generators/config/i18n/sfc/src/button/example/locale/en-US.ts +5 -0
- package/template/generators/config/i18n/sfc/src/button/example/locale/index.ts +23 -0
- package/template/generators/config/i18n/sfc/src/button/example/locale/zh-CN.ts +5 -0
- package/template/generators/config/i18n/sfc/src/button/index.ts +8 -0
- package/template/generators/config/i18n/sfc/src/button/style/button.less +14 -0
- package/template/generators/config/i18n/sfc/src/button/style/index.less +1 -0
- package/template/generators/config/i18n/sfc/src/button/style/index.ts +1 -0
- package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +52 -0
- package/template/generators/config/i18n/sfc/src/locale/docs/en-US.md +26 -0
- package/template/generators/config/i18n/sfc/src/locale/docs/zh-CN.md +25 -0
- package/template/generators/config/i18n/sfc/src/locale/en-US.d.ts +5 -0
- package/template/generators/config/i18n/sfc/src/locale/en-US.ts +7 -0
- package/template/generators/config/i18n/sfc/src/locale/index.ts +82 -0
- package/template/generators/config/i18n/sfc/src/locale/zh-CN.d.ts +5 -0
- package/template/generators/config/i18n/sfc/src/locale/zh-CN.ts +7 -0
- package/template/generators/config/i18n/sfc/src/utils/components.ts +20 -0
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +35 -0
- package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +8 -0
- package/template/generators/config/i18n/tsx/src/button/docs/en-US.md +39 -0
- package/template/generators/config/i18n/tsx/src/button/docs/zh-CN.md +39 -0
- package/template/generators/config/i18n/tsx/src/button/example/BasicUse.vue +11 -0
- package/template/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +11 -0
- package/template/generators/config/i18n/tsx/src/button/example/index.vue +15 -0
- package/template/generators/config/i18n/tsx/src/button/example/locale/en-US.ts +5 -0
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +23 -0
- package/template/generators/config/i18n/tsx/src/button/example/locale/zh-CN.ts +5 -0
- package/template/generators/config/i18n/tsx/src/button/index.ts +8 -0
- package/template/generators/config/i18n/tsx/src/button/style/button.less +14 -0
- package/template/generators/config/i18n/tsx/src/button/style/index.less +1 -0
- package/template/generators/config/i18n/tsx/src/button/style/index.ts +1 -0
- package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +52 -0
- package/template/generators/config/i18n/tsx/src/locale/docs/en-US.md +26 -0
- package/template/generators/config/i18n/tsx/src/locale/docs/zh-CN.md +25 -0
- package/template/generators/config/i18n/tsx/src/locale/en-US.d.ts +5 -0
- package/template/generators/config/i18n/tsx/src/locale/en-US.ts +7 -0
- package/template/generators/config/i18n/tsx/src/locale/index.ts +82 -0
- package/template/generators/config/i18n/tsx/src/locale/zh-CN.d.ts +5 -0
- package/template/generators/config/i18n/tsx/src/locale/zh-CN.ts +7 -0
- package/template/generators/config/i18n/tsx/src/utils/components.ts +20 -0
package/site/module.d.ts
ADDED
package/site/pc/App.vue
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, onMounted, ref } from 'vue'
|
|
3
|
+
import config from '@config'
|
|
4
|
+
import { getMobileIndex, getPCLocationInfo } from '@maple-design/cli-vue/client'
|
|
5
|
+
import { isPhone } from '../utils'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
setup() {
|
|
9
|
+
const useMobile = ref(config?.useMobile)
|
|
10
|
+
const defaultLanguage = config?.defaultLanguage
|
|
11
|
+
|
|
12
|
+
const init = () => {
|
|
13
|
+
const { language, menuName } = getPCLocationInfo()
|
|
14
|
+
|
|
15
|
+
if (isPhone() && useMobile.value) {
|
|
16
|
+
window.location.href = `${getMobileIndex()}#/${menuName}?language=${
|
|
17
|
+
language || defaultLanguage
|
|
18
|
+
}&platform=mobile`
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onMounted(init)
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<router-view></router-view>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style lang="less">
|
|
33
|
+
body {
|
|
34
|
+
transition:
|
|
35
|
+
background-color 0.25s,
|
|
36
|
+
box-shadow 0.25s;
|
|
37
|
+
|
|
38
|
+
* {
|
|
39
|
+
transition:
|
|
40
|
+
background-color 0.25s,
|
|
41
|
+
box-shadow 0.25s;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
|
3
|
+
import config from '@config'
|
|
4
|
+
import { Context } from '@maple-design/ui-vue'
|
|
5
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
6
|
+
import { getDocumentationSection, getSectionMenu, sectionRoute } from '../documentation-sections'
|
|
7
|
+
import { type SiteContext } from '../types'
|
|
8
|
+
import { MenuTypes, type Menu } from '../utils'
|
|
9
|
+
import AppAd from './components/AppAd.vue'
|
|
10
|
+
import AppHeader from './components/AppHeader.vue'
|
|
11
|
+
import AppMobile from './components/AppMobile.vue'
|
|
12
|
+
import AppSidebar from './components/AppSidebar.vue'
|
|
13
|
+
import { getPcSiteRoute } from './route-state'
|
|
14
|
+
import { createScrollHashSync } from './scroll-hash'
|
|
15
|
+
|
|
16
|
+
const context = Context as SiteContext
|
|
17
|
+
const menu: Menu[] = config?.pc?.menu ?? []
|
|
18
|
+
const mobileRedirect = config?.mobile?.redirect
|
|
19
|
+
const doc = ref<HTMLElement | null>(null)
|
|
20
|
+
const sidebarOpen = ref(false)
|
|
21
|
+
const sidebarToggle = ref<HTMLButtonElement | null>(null)
|
|
22
|
+
const route = useRoute()
|
|
23
|
+
const router = useRouter()
|
|
24
|
+
const scrollHashSync = createScrollHashSync(router)
|
|
25
|
+
const sections = config?.pc?.sections ?? []
|
|
26
|
+
const activeSection = computed(() => getDocumentationSection(route.path, sections))
|
|
27
|
+
const visibleMenu = computed(() => getSectionMenu(menu, activeSection.value, sections))
|
|
28
|
+
const switchSection = (section: (typeof sections)[number]) => router.push(sectionRoute(section, language.value))
|
|
29
|
+
const routeState = computed(() =>
|
|
30
|
+
getPcSiteRoute(route.path, route.hash, menu, mobileRedirect, config?.useMobile, config?.mobile?.docs),
|
|
31
|
+
)
|
|
32
|
+
const language = computed(() => routeState.value.language)
|
|
33
|
+
const menuName = computed(() => routeState.value.menuName)
|
|
34
|
+
const hash = ref(routeState.value.hash)
|
|
35
|
+
watch(
|
|
36
|
+
() => route.fullPath.split('#')[0],
|
|
37
|
+
() => {
|
|
38
|
+
hash.value = routeState.value.hash
|
|
39
|
+
},
|
|
40
|
+
{ flush: 'sync' },
|
|
41
|
+
)
|
|
42
|
+
const componentName = computed(() => routeState.value.componentName)
|
|
43
|
+
const useMobile = computed(() => routeState.value.useMobile)
|
|
44
|
+
|
|
45
|
+
const init = () => {
|
|
46
|
+
nextTick(() => {
|
|
47
|
+
const sidebar = document.querySelector('.maple-site-sidebar')
|
|
48
|
+
if (!sidebar) return
|
|
49
|
+
const children = sidebar.getElementsByClassName('mp-cell')
|
|
50
|
+
const index = visibleMenu.value.findIndex((item) => item.doc === menuName.value && item.type !== MenuTypes.TITLE)
|
|
51
|
+
|
|
52
|
+
if (index !== -1 && children[index]) {
|
|
53
|
+
children[index].scrollIntoView({
|
|
54
|
+
block: 'center',
|
|
55
|
+
inline: 'start',
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleSidebarChange = (menu: Menu) => {
|
|
62
|
+
if (doc.value) {
|
|
63
|
+
doc.value.scrollTop = 0
|
|
64
|
+
}
|
|
65
|
+
router.push({ path: `/${language.value}/${menu.doc}` })
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const navigateOutline = (id: string) => {
|
|
69
|
+
if (route.hash === `#${id}`) {
|
|
70
|
+
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
router.push({ hash: `#${id}`, query: route.query })
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const closeSidebar = async () => {
|
|
77
|
+
if (!sidebarOpen.value) {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
sidebarOpen.value = false
|
|
81
|
+
await nextTick()
|
|
82
|
+
sidebarToggle.value?.focus()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
watch(
|
|
86
|
+
() => route.fullPath,
|
|
87
|
+
async () => {
|
|
88
|
+
if (sidebarOpen.value) {
|
|
89
|
+
sidebarOpen.value = false
|
|
90
|
+
await nextTick()
|
|
91
|
+
doc.value?.focus()
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
const confirmClose = () => {
|
|
97
|
+
const key = 'MAPLE_UI_PLAYGROUND_HAS_BEEN_CLOSED'
|
|
98
|
+
|
|
99
|
+
if (
|
|
100
|
+
!localStorage.getItem(key) &&
|
|
101
|
+
!window.confirm('The code will no longer be saved after closing. Are you sure you want to close?')
|
|
102
|
+
) {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
localStorage.setItem(key, 'true')
|
|
107
|
+
context.showPlayground = false
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onMounted(() => {
|
|
111
|
+
init()
|
|
112
|
+
|
|
113
|
+
window.addEventListener('message', (event) => {
|
|
114
|
+
const { data } = event
|
|
115
|
+
|
|
116
|
+
if (data.action === 'playground-close') {
|
|
117
|
+
confirmClose()
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
watch(menuName, init, { flush: 'post' })
|
|
123
|
+
|
|
124
|
+
watch(
|
|
125
|
+
language,
|
|
126
|
+
(lang) => {
|
|
127
|
+
if (lang) {
|
|
128
|
+
document.title = config?.pc?.title[lang] as string
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{ immediate: true },
|
|
132
|
+
)
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<template>
|
|
136
|
+
<div class="maple-site">
|
|
137
|
+
<app-ad :language="language" />
|
|
138
|
+
|
|
139
|
+
<app-header
|
|
140
|
+
:language="language"
|
|
141
|
+
:sections="sections"
|
|
142
|
+
:active-section="activeSection?.id"
|
|
143
|
+
@section-change="switchSection"
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<button
|
|
147
|
+
ref="sidebarToggle"
|
|
148
|
+
class="maple-site-sidebar-toggle"
|
|
149
|
+
type="button"
|
|
150
|
+
aria-controls="maple-site-navigation"
|
|
151
|
+
:aria-expanded="sidebarOpen"
|
|
152
|
+
@click="sidebarOpen = !sidebarOpen"
|
|
153
|
+
>
|
|
154
|
+
{{ language === 'en-US' ? 'Documentation menu' : '文档目录' }}
|
|
155
|
+
</button>
|
|
156
|
+
|
|
157
|
+
<div class="maple-site-content" :class="{ 'maple-site-content--navigation-open': sidebarOpen }">
|
|
158
|
+
<app-sidebar
|
|
159
|
+
id="maple-site-navigation"
|
|
160
|
+
:language="language"
|
|
161
|
+
:menu="visibleMenu"
|
|
162
|
+
:menu-name="menuName"
|
|
163
|
+
@change="handleSidebarChange"
|
|
164
|
+
@keydown.esc="closeSidebar"
|
|
165
|
+
/>
|
|
166
|
+
|
|
167
|
+
<main
|
|
168
|
+
ref="doc"
|
|
169
|
+
class="maple-site-doc-container"
|
|
170
|
+
tabindex="-1"
|
|
171
|
+
:class="[!useMobile && 'maple-site-doc-container--pc-only']"
|
|
172
|
+
>
|
|
173
|
+
<router-view />
|
|
174
|
+
</main>
|
|
175
|
+
|
|
176
|
+
<app-mobile
|
|
177
|
+
v-if="useMobile"
|
|
178
|
+
:doc-root="doc"
|
|
179
|
+
:page-key="route.path"
|
|
180
|
+
@navigate="navigateOutline"
|
|
181
|
+
@active-change="scrollHashSync.replace($event ? `#${$event}` : '')"
|
|
182
|
+
:component-name="componentName"
|
|
183
|
+
:language="language"
|
|
184
|
+
:replace="menuName"
|
|
185
|
+
:hash="hash"
|
|
186
|
+
:query="route.query"
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<mp-popup placement="right" :open="context.showPlayground" @click-overlay="confirmClose">
|
|
192
|
+
<div class="maple-site-playground-container">
|
|
193
|
+
<iframe
|
|
194
|
+
v-if="context.showPlayground"
|
|
195
|
+
id="playground"
|
|
196
|
+
class="maple-site-playground-iframe"
|
|
197
|
+
:src="context.playgroundURL"
|
|
198
|
+
allow="clipboard-write"
|
|
199
|
+
>
|
|
200
|
+
</iframe>
|
|
201
|
+
</div>
|
|
202
|
+
</mp-popup>
|
|
203
|
+
</template>
|
|
204
|
+
|
|
205
|
+
<style lang="less">
|
|
206
|
+
.hljs {
|
|
207
|
+
background: var(--site-config-color-hl-background) !important;
|
|
208
|
+
padding: 0 !important;
|
|
209
|
+
transition: all 0.25s;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.hljs code {
|
|
213
|
+
line-height: 31px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.hljs-comment,
|
|
217
|
+
.hljs-meta,
|
|
218
|
+
.hljs-quote {
|
|
219
|
+
color: var(--site-config-color-hl-group-a);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.hljs-keyword,
|
|
223
|
+
.hljs-name,
|
|
224
|
+
.hljs-selector-tag,
|
|
225
|
+
.hljs-tag {
|
|
226
|
+
color: var(--site-config-color-hl-group-b);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.hljs-attribute,
|
|
230
|
+
.hljs-selector-id {
|
|
231
|
+
color: var(--site-config-color-hl-group-c);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.hljs-addition,
|
|
235
|
+
.hljs-selector-attr,
|
|
236
|
+
.hljs-selector-pseudo,
|
|
237
|
+
.hljs-string {
|
|
238
|
+
color: var(--site-config-color-hl-group-d);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.hljs-subst {
|
|
242
|
+
color: var(--site-config-color-hl-group-e);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.hljs-link,
|
|
246
|
+
.hljs-regexp {
|
|
247
|
+
color: var(--site-config-color-hl-group-f);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.hljs-doctag,
|
|
251
|
+
.hljs-section,
|
|
252
|
+
.hljs-title,
|
|
253
|
+
.hljs-type {
|
|
254
|
+
color: var(--site-config-color-hl-group-g);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.hljs-bullet,
|
|
258
|
+
.hljs-literal,
|
|
259
|
+
.hljs-symbol,
|
|
260
|
+
.hljs-template-variable,
|
|
261
|
+
.hljs-variable {
|
|
262
|
+
color: var(--site-config-color-hl-group-h);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.hljs-deletion,
|
|
266
|
+
.hljs-number {
|
|
267
|
+
color: var(--site-config-color-hl-group-i);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.mp-popup__content {
|
|
271
|
+
background-color: transparent;
|
|
272
|
+
}
|
|
273
|
+
</style>
|
|
274
|
+
|
|
275
|
+
<style lang="less">
|
|
276
|
+
@doc-active: {
|
|
277
|
+
display: inline;
|
|
278
|
+
font-family: inherit;
|
|
279
|
+
padding: 0;
|
|
280
|
+
white-space: pre-wrap;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
iframe {
|
|
284
|
+
display: block;
|
|
285
|
+
width: 100%;
|
|
286
|
+
height: 100%;
|
|
287
|
+
border: none;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.maple {
|
|
291
|
+
&-introduce {
|
|
292
|
+
display: flex;
|
|
293
|
+
flex-direction: column;
|
|
294
|
+
align-items: center;
|
|
295
|
+
margin: 20px 0;
|
|
296
|
+
padding: 90px 40px;
|
|
297
|
+
border-top: 6px solid var(--site-config-color-introduce-border);
|
|
298
|
+
border-radius: 2px;
|
|
299
|
+
background: var(--site-config-color-bar);
|
|
300
|
+
box-shadow:
|
|
301
|
+
0 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
302
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
|
303
|
+
0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
304
|
+
|
|
305
|
+
&__row {
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&__image {
|
|
311
|
+
width: 60px;
|
|
312
|
+
margin-right: 20px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&__name {
|
|
316
|
+
font-size: 60px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
&__des {
|
|
320
|
+
color: var(--site-config-color-sub-text);
|
|
321
|
+
font-size: 16px;
|
|
322
|
+
margin-top: 16px;
|
|
323
|
+
-webkit-font-smoothing: antialiased;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
&-component-preview {
|
|
328
|
+
margin-top: 20px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
&-site {
|
|
332
|
+
min-width: 0;
|
|
333
|
+
|
|
334
|
+
&-sidebar-toggle {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
&-content {
|
|
339
|
+
display: flex;
|
|
340
|
+
background: var(--site-config-color-body);
|
|
341
|
+
min-height: calc(100vh - 60px - var(--site-ad-height));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
&-doc-container {
|
|
345
|
+
flex: 1 0 0;
|
|
346
|
+
min-width: 0;
|
|
347
|
+
padding: 0 32px;
|
|
348
|
+
overflow-x: hidden;
|
|
349
|
+
|
|
350
|
+
&::-webkit-scrollbar {
|
|
351
|
+
display: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&--pc-only {
|
|
355
|
+
padding: 0 90px 0 30px;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&-doc {
|
|
360
|
+
h3 {
|
|
361
|
+
display: flex;
|
|
362
|
+
align-items: center;
|
|
363
|
+
|
|
364
|
+
.router-link-active {
|
|
365
|
+
font-size: 20px;
|
|
366
|
+
margin-right: 8px;
|
|
367
|
+
user-select: none;
|
|
368
|
+
text-decoration: none;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
a:not(.loca-doc-preview__example a) {
|
|
373
|
+
color: var(--site-config-color-text);
|
|
374
|
+
-webkit-font-smoothing: antialiased;
|
|
375
|
+
word-break: keep-all;
|
|
376
|
+
font-size: 15px;
|
|
377
|
+
@doc-active();
|
|
378
|
+
|
|
379
|
+
&:hover {
|
|
380
|
+
opacity: 0.8;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
h1,
|
|
385
|
+
h2,
|
|
386
|
+
h3,
|
|
387
|
+
h4,
|
|
388
|
+
h5,
|
|
389
|
+
h6 {
|
|
390
|
+
position: relative;
|
|
391
|
+
scroll-margin-top: 100px;
|
|
392
|
+
color: var(--site-config-color-text);
|
|
393
|
+
font-weight: normal;
|
|
394
|
+
line-height: 1.5;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
h1 {
|
|
398
|
+
line-height: 40px;
|
|
399
|
+
font-size: 30px;
|
|
400
|
+
cursor: default;
|
|
401
|
+
margin: 30px 0;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
h2 {
|
|
405
|
+
margin: 20px 0;
|
|
406
|
+
font-size: 25px;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
h3 {
|
|
410
|
+
font-size: 18px;
|
|
411
|
+
margin: 0;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
h4 {
|
|
415
|
+
margin: 18px 0 0;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
p,
|
|
419
|
+
ul,
|
|
420
|
+
ol {
|
|
421
|
+
-webkit-font-smoothing: antialiased;
|
|
422
|
+
color: var(--site-config-color-text);
|
|
423
|
+
font-size: 15px;
|
|
424
|
+
line-height: 26px;
|
|
425
|
+
border-radius: 4px;
|
|
426
|
+
background: var(--site-config-color-bar);
|
|
427
|
+
margin: 14px 0 0;
|
|
428
|
+
padding: 0;
|
|
429
|
+
|
|
430
|
+
li {
|
|
431
|
+
margin-bottom: 4px;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
ul,
|
|
436
|
+
ol {
|
|
437
|
+
padding: 0 0 0 18px;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
pre {
|
|
441
|
+
margin: 0;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
code {
|
|
445
|
+
position: relative;
|
|
446
|
+
display: block;
|
|
447
|
+
padding: 10px 16px;
|
|
448
|
+
overflow-x: auto;
|
|
449
|
+
font-size: 13px;
|
|
450
|
+
font-family: Consolas, Monaco, monospace;
|
|
451
|
+
white-space: pre-wrap;
|
|
452
|
+
word-wrap: break-word;
|
|
453
|
+
color: var(--site-config-color-hl-code);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
p code,
|
|
457
|
+
li code,
|
|
458
|
+
table code {
|
|
459
|
+
-webkit-font-smoothing: antialiased;
|
|
460
|
+
word-break: keep-all;
|
|
461
|
+
color: var(--site-config-color-text);
|
|
462
|
+
font-size: 15px;
|
|
463
|
+
@doc-active();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
table {
|
|
467
|
+
-webkit-font-smoothing: antialiased;
|
|
468
|
+
width: 100%;
|
|
469
|
+
margin-top: 12px;
|
|
470
|
+
color: var(--site-config-color-text);
|
|
471
|
+
background: var(--site-config-color-bar);
|
|
472
|
+
font-size: 14px;
|
|
473
|
+
line-height: 28px;
|
|
474
|
+
border-collapse: collapse;
|
|
475
|
+
border-radius: 4px;
|
|
476
|
+
|
|
477
|
+
th {
|
|
478
|
+
padding: 8px 16px;
|
|
479
|
+
font-weight: 500;
|
|
480
|
+
text-align: left;
|
|
481
|
+
color: var(--site-config-color-sub-text);
|
|
482
|
+
font-size: 13px;
|
|
483
|
+
-webkit-font-smoothing: antialiased;
|
|
484
|
+
border-bottom: 1px solid var(--site-config-color-border);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
td {
|
|
488
|
+
padding: 8px 16px;
|
|
489
|
+
border-bottom: 1px solid var(--site-config-color-border);
|
|
490
|
+
color: var(--site-config-color-text);
|
|
491
|
+
font-family: Consolas, Monaco, monospace;
|
|
492
|
+
|
|
493
|
+
code {
|
|
494
|
+
white-space: pre-wrap;
|
|
495
|
+
padding: 0;
|
|
496
|
+
font-size: 13px;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
a {
|
|
500
|
+
font-size: 13px;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
em {
|
|
505
|
+
color: var(--site-config-color-type);
|
|
506
|
+
font-style: normal;
|
|
507
|
+
-webkit-font-smoothing: antialiased;
|
|
508
|
+
font-size: 13px;
|
|
509
|
+
@doc-active();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
strong {
|
|
514
|
+
font-size: 12px;
|
|
515
|
+
font-weight: normal;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
table strong {
|
|
519
|
+
border: 1px solid currentColor;
|
|
520
|
+
padding: 2px 8px;
|
|
521
|
+
border-radius: 12px;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.card {
|
|
525
|
+
border-radius: var(--site-config-card-border-radius);
|
|
526
|
+
background: var(--site-config-color-bar);
|
|
527
|
+
padding: 20px;
|
|
528
|
+
margin-bottom: 30px;
|
|
529
|
+
box-shadow:
|
|
530
|
+
0 2px 1px -1px rgba(0, 0, 0, 0.2),
|
|
531
|
+
0 1px 1px 0 rgba(0, 0, 0, 0.14),
|
|
532
|
+
0 1px 3px 0 rgba(0, 0, 0, 0.12);
|
|
533
|
+
|
|
534
|
+
&:first-child {
|
|
535
|
+
margin-top: 30px;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
&--demo {
|
|
539
|
+
box-shadow: none;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
&-playground-container {
|
|
545
|
+
width: calc(100vw - 256px);
|
|
546
|
+
max-width: 1660px;
|
|
547
|
+
height: 100vh;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
&-playground-iframe {
|
|
551
|
+
width: 100%;
|
|
552
|
+
height: 100%;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
@media (max-width: 1199px) {
|
|
558
|
+
.maple-site-content {
|
|
559
|
+
display: grid;
|
|
560
|
+
grid-template-columns: 220px minmax(0, 1fr);
|
|
561
|
+
align-items: start;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.maple-site-sidebar {
|
|
565
|
+
width: 220px;
|
|
566
|
+
grid-column: 1;
|
|
567
|
+
grid-row: 1 / span 2;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.maple-site-doc-container {
|
|
571
|
+
grid-column: 2;
|
|
572
|
+
padding: 0 24px;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.maple-site-mobile {
|
|
576
|
+
grid-column: 2;
|
|
577
|
+
position: static;
|
|
578
|
+
width: calc(100% - 48px);
|
|
579
|
+
max-width: 375px;
|
|
580
|
+
height: 640px;
|
|
581
|
+
margin: 24px auto;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
@media (max-width: 767px) {
|
|
586
|
+
.maple-site-sidebar-toggle {
|
|
587
|
+
display: block;
|
|
588
|
+
min-height: 44px;
|
|
589
|
+
margin: 12px 16px;
|
|
590
|
+
padding: 8px 16px;
|
|
591
|
+
border: 1px solid var(--site-config-color-border);
|
|
592
|
+
border-radius: 4px;
|
|
593
|
+
background: var(--site-config-color-bar);
|
|
594
|
+
color: var(--site-config-color-text);
|
|
595
|
+
font: inherit;
|
|
596
|
+
cursor: pointer;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.maple-site-content {
|
|
600
|
+
display: block;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.maple-site-sidebar {
|
|
604
|
+
display: none;
|
|
605
|
+
position: static;
|
|
606
|
+
width: 100%;
|
|
607
|
+
height: auto;
|
|
608
|
+
max-height: 50vh;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.maple-site-content--navigation-open .maple-site-sidebar {
|
|
612
|
+
display: block;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.maple-site-doc-container {
|
|
616
|
+
padding: 0 16px;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.maple-site-doc {
|
|
620
|
+
overflow-wrap: anywhere;
|
|
621
|
+
|
|
622
|
+
table {
|
|
623
|
+
display: block;
|
|
624
|
+
overflow-x: auto;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.maple-site-playground-container {
|
|
629
|
+
width: 100vw;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
</style>
|
|
633
|
+
|
|
634
|
+
<style>
|
|
635
|
+
pre,
|
|
636
|
+
pre code {
|
|
637
|
+
direction: ltr;
|
|
638
|
+
text-align: left;
|
|
639
|
+
unicode-bidi: isolate;
|
|
640
|
+
}
|
|
641
|
+
</style>
|