@varlet/cli 1.22.0-alpha.6 → 1.22.0-alpha.64
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.en-US.md +11 -0
- package/README.md +11 -0
- package/generators/sfc/package.json +3 -3
- package/generators/sfc/varlet.config.js +5 -0
- package/generators/tsx/package.json +3 -3
- package/generators/tsx/varlet.config.js +5 -0
- package/lib/commands/dev.js +14 -3
- package/lib/commands/preview.d.ts +1 -0
- package/lib/commands/preview.js +65 -0
- package/lib/compiler/compileSiteEntry.d.ts +1 -4
- package/lib/compiler/compileSiteEntry.js +10 -20
- package/lib/config/jest.config.js +0 -1
- package/lib/config/vite.config.js +6 -6
- package/lib/index.js +2 -0
- package/lib/shared/constant.d.ts +1 -9
- package/lib/shared/constant.js +2 -10
- package/lib/site/components/app-bar/index.d.ts +3 -0
- package/lib/site/components/app-bar/index.js +12 -0
- package/lib/site/components/app-bar/props.d.ts +21 -0
- package/lib/site/components/app-bar/props.js +28 -0
- package/lib/site/components/button/index.d.ts +3 -0
- package/lib/site/components/button/index.js +12 -0
- package/lib/site/components/button/props.d.ts +62 -0
- package/lib/site/components/button/props.js +69 -0
- package/lib/site/components/cell/index.d.ts +3 -0
- package/lib/site/components/cell/index.js +12 -0
- package/lib/site/components/cell/props.d.ts +27 -0
- package/lib/site/components/cell/props.js +30 -0
- package/lib/site/components/context/index.d.ts +15 -0
- package/lib/site/components/context/index.js +11 -0
- package/lib/site/components/context/lock.d.ts +10 -0
- package/lib/site/components/context/lock.js +94 -0
- package/lib/site/components/context/zIndex.d.ts +4 -0
- package/lib/site/components/context/zIndex.js +19 -0
- package/lib/site/components/icon/index.d.ts +3 -0
- package/lib/site/components/icon/index.js +12 -0
- package/lib/site/components/icon/props.d.ts +23 -0
- package/lib/site/components/icon/props.js +25 -0
- package/lib/site/components/loading/index.d.ts +3 -0
- package/lib/site/components/loading/index.js +12 -0
- package/lib/site/components/loading/props.d.ts +26 -0
- package/lib/site/components/loading/props.js +34 -0
- package/lib/site/components/menu/index.d.ts +3 -0
- package/lib/site/components/menu/index.js +12 -0
- package/lib/site/components/menu/props.d.ts +40 -0
- package/lib/site/components/menu/props.js +43 -0
- package/lib/site/components/progress/index.d.ts +3 -0
- package/lib/site/components/progress/index.js +12 -0
- package/lib/site/components/progress/props.d.ts +43 -0
- package/lib/site/components/progress/props.js +57 -0
- package/lib/site/components/ripple/index.d.ts +8 -0
- package/lib/site/components/ripple/index.js +125 -0
- package/lib/site/components/utils/components.d.ts +53 -0
- package/lib/site/components/utils/components.js +279 -0
- package/lib/site/components/utils/elements.d.ts +30 -0
- package/lib/site/components/utils/elements.js +240 -0
- package/lib/site/components/utils/shared.d.ts +36 -0
- package/lib/site/components/utils/shared.js +181 -0
- package/lib/site/mobile/main.d.ts +3 -0
- package/lib/site/mobile/main.js +93 -0
- package/lib/site/pc/main.d.ts +3 -0
- package/lib/site/pc/main.js +69 -0
- package/lib/site/useProgress.d.ts +4 -0
- package/lib/site/useProgress.js +58 -0
- package/lib/site/utils.d.ts +24 -0
- package/lib/site/utils.js +133 -0
- package/package.json +9 -9
- package/site/.DS_Store +0 -0
- package/site/components/app-bar/AppBar.vue +45 -0
- package/site/components/app-bar/appBar.less +66 -0
- package/site/components/app-bar/index.ts +10 -0
- package/site/components/app-bar/props.ts +25 -0
- package/site/components/button/Button.vue +84 -0
- package/site/components/button/button.less +183 -0
- package/site/components/button/index.ts +10 -0
- package/site/components/button/props.ts +70 -0
- package/site/components/cell/Cell.vue +42 -0
- package/site/components/cell/cell.less +74 -0
- package/site/components/cell/index.ts +10 -0
- package/site/components/cell/props.ts +27 -0
- package/site/components/context/index.ts +17 -0
- package/site/components/context/lock.ts +103 -0
- package/site/components/context/zIndex.ts +20 -0
- package/site/components/icon/Icon.vue +68 -0
- package/site/components/icon/icon.less +25 -0
- package/site/components/icon/index.ts +10 -0
- package/site/components/icon/props.ts +24 -0
- package/site/components/loading/Loading.vue +55 -0
- package/site/components/loading/index.ts +10 -0
- package/site/components/loading/loading.less +420 -0
- package/site/components/loading/props.ts +37 -0
- package/site/components/menu/Menu.vue +113 -0
- package/site/components/menu/index.ts +10 -0
- package/site/components/menu/menu.less +27 -0
- package/site/components/menu/props.ts +43 -0
- package/site/components/progress/Progress.vue +108 -0
- package/site/components/progress/index.ts +10 -0
- package/site/components/progress/progress.less +98 -0
- package/site/components/progress/props.ts +55 -0
- package/site/components/ripple/index.ts +167 -0
- package/site/components/ripple/ripple.less +17 -0
- package/site/components/styles/common.less +64 -0
- package/site/components/styles/elevation.less +126 -0
- package/site/components/styles/var.less +27 -0
- package/site/components/utils/components.ts +53 -0
- package/site/components/utils/elements.ts +83 -0
- package/site/components/utils/shared.ts +27 -0
- package/site/mobile/App.vue +20 -16
- package/site/mobile/components/AppHome.vue +6 -6
- package/site/mobile/main.ts +14 -7
- package/site/pc/App.vue +15 -10
- package/site/pc/components/AppHeader.vue +14 -10
- package/site/pc/components/AppMobile.vue +3 -3
- package/site/pc/components/AppSidebar.vue +16 -20
- package/site/pc/main.ts +7 -4
- package/site/useProgress.ts +10 -8
- package/site/utils.ts +13 -2
- package/varlet.default.config.js +3 -2
- package/generators/sfc/yarn.lock +0 -11231
- package/generators/tsx/yarn.lock +0 -11231
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createApp, h } from 'vue'
|
|
2
|
+
import type { Component } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface MountInstance {
|
|
5
|
+
instance: any
|
|
6
|
+
unmount: () => void
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function pickProps(props: any, propsKey: string): any
|
|
10
|
+
export function pickProps(props: any, propsKey: string[]): any
|
|
11
|
+
export function pickProps(props: any, propsKey: any): any {
|
|
12
|
+
return Array.isArray(propsKey)
|
|
13
|
+
? propsKey.reduce((pickedProps: any, key) => {
|
|
14
|
+
pickedProps[key] = props[key]
|
|
15
|
+
return pickedProps
|
|
16
|
+
}, {})
|
|
17
|
+
: props[propsKey]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function mount(component: Component): MountInstance {
|
|
21
|
+
const app = createApp(component)
|
|
22
|
+
const host = document.createElement('div')
|
|
23
|
+
document.body.appendChild(host)
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
instance: app.mount(host),
|
|
27
|
+
unmount() {
|
|
28
|
+
app.unmount()
|
|
29
|
+
document.body.removeChild(host)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function mountInstance(
|
|
35
|
+
component: any,
|
|
36
|
+
props: Record<string, any> = {},
|
|
37
|
+
eventListener: Record<string, any> = {}
|
|
38
|
+
): {
|
|
39
|
+
unmountInstance: () => void
|
|
40
|
+
} {
|
|
41
|
+
const Host = {
|
|
42
|
+
setup() {
|
|
43
|
+
return () =>
|
|
44
|
+
h(component, {
|
|
45
|
+
...props,
|
|
46
|
+
...eventListener
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const { unmount } = mount(Host)
|
|
52
|
+
return { unmountInstance: unmount }
|
|
53
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isNumber, isString, toNumber, kebabCase } from './shared'
|
|
2
|
+
import type { StyleVars } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export function getLeft(element: HTMLElement): number {
|
|
5
|
+
const { left } = element.getBoundingClientRect()
|
|
6
|
+
|
|
7
|
+
return left + (document.body.scrollLeft || document.documentElement.scrollLeft)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getTop(element: HTMLElement): number {
|
|
11
|
+
const { top } = element.getBoundingClientRect()
|
|
12
|
+
|
|
13
|
+
return top + (document.body.scrollTop || document.documentElement.scrollTop)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const isRem = (value: unknown) => isString(value) && value.endsWith('rem')
|
|
17
|
+
|
|
18
|
+
// example 1 || 1px
|
|
19
|
+
export const isPx = (value: unknown) => (isString(value) && value.endsWith('px')) || isNumber(value)
|
|
20
|
+
|
|
21
|
+
// example 1%
|
|
22
|
+
export const isPercent = (value: unknown) => isString(value) && value.endsWith('%')
|
|
23
|
+
|
|
24
|
+
// example 1vw
|
|
25
|
+
export const isVw = (value: unknown) => isString(value) && value.endsWith('vw')
|
|
26
|
+
|
|
27
|
+
// example 1vh
|
|
28
|
+
export const isVh = (value: unknown) => isString(value) && value.endsWith('vh')
|
|
29
|
+
|
|
30
|
+
// example return 1
|
|
31
|
+
export const toPxNum = (value: unknown): number => {
|
|
32
|
+
if (isNumber(value)) {
|
|
33
|
+
return value
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (isPx(value)) {
|
|
37
|
+
return +(value as string).replace('px', '')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (isVw(value)) {
|
|
41
|
+
return (+(value as string).replace('vw', '') * window.innerWidth) / 100
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (isVh(value)) {
|
|
45
|
+
return (+(value as string).replace('vh', '') * window.innerHeight) / 100
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isRem(value)) {
|
|
49
|
+
const num = +(value as string).replace('rem', '')
|
|
50
|
+
const rootFontSize = window.getComputedStyle(document.documentElement).fontSize
|
|
51
|
+
|
|
52
|
+
return num * parseFloat(rootFontSize)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (isString(value)) {
|
|
56
|
+
return toNumber(value)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// % and other
|
|
60
|
+
return 0
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// example return 1px 1% 1vw 1vh 1rem null
|
|
64
|
+
export const toSizeUnit = (value: unknown) => {
|
|
65
|
+
if (value == null) {
|
|
66
|
+
return null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (isPercent(value) || isVw(value) || isVh(value) || isRem(value)) {
|
|
70
|
+
return value
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return `${toPxNum(value)}px`
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function formatStyleVars(styleVars: StyleVars) {
|
|
77
|
+
return Object.entries(styleVars).reduce((styles, [key, value]) => {
|
|
78
|
+
const cssVar = key.startsWith('--') ? key : `--${kebabCase(key)}`
|
|
79
|
+
styles[cssVar] = value
|
|
80
|
+
|
|
81
|
+
return styles
|
|
82
|
+
}, {} as StyleVars)
|
|
83
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const toNumber = (val: number | string | boolean | undefined | null): number => {
|
|
2
|
+
if (val == null) return 0
|
|
3
|
+
|
|
4
|
+
if (isString(val)) {
|
|
5
|
+
val = parseFloat(val)
|
|
6
|
+
val = Number.isNaN(val) ? 0 : val
|
|
7
|
+
return val
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (isBool(val)) return Number(val)
|
|
11
|
+
|
|
12
|
+
return val
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function kebabCase(str: string): string {
|
|
16
|
+
const reg = /([^-])([A-Z])/g
|
|
17
|
+
|
|
18
|
+
return str.replace(reg, '$1-$2').replace(reg, '$1-$2').toLowerCase()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const isString = (val: unknown): val is string => typeof val === 'string'
|
|
22
|
+
|
|
23
|
+
export const isBool = (val: unknown): val is boolean => typeof val === 'boolean'
|
|
24
|
+
|
|
25
|
+
export const isNumber = (val: unknown): val is number => typeof val === 'number'
|
|
26
|
+
|
|
27
|
+
export const isURL = (val: string) => /^(http)|(\.*\/)/.test(val)
|
package/site/mobile/App.vue
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div style="position: relative">
|
|
3
3
|
<header>
|
|
4
|
-
<var-app-bar
|
|
4
|
+
<var-site-app-bar
|
|
5
5
|
class="app-bar"
|
|
6
6
|
:title="bigCamelizeComponentName"
|
|
7
7
|
title-position="center"
|
|
8
8
|
>
|
|
9
9
|
<template #left v-if="showBackIcon">
|
|
10
|
-
<var-button round @click="back" color="transparent" text-color="#fff" text>
|
|
11
|
-
<var-icon name="chevron-left" :size="28" />
|
|
12
|
-
</var-button>
|
|
10
|
+
<var-site-button round @click="back" color="transparent" text-color="#fff" text>
|
|
11
|
+
<var-site-icon name="chevron-left" :size="28" />
|
|
12
|
+
</var-site-button>
|
|
13
13
|
</template>
|
|
14
14
|
<template #right>
|
|
15
|
-
<var-menu
|
|
15
|
+
<var-site-menu
|
|
16
16
|
style="background: transparent"
|
|
17
17
|
:offset-y="38"
|
|
18
18
|
v-model:show="showMenu"
|
|
19
19
|
v-if="languages"
|
|
20
20
|
>
|
|
21
|
-
<var-button text color="transparent" text-color="#fff" @click="showMenu = true">
|
|
22
|
-
<var-icon name="translate" :size="24" />
|
|
23
|
-
<var-icon name="chevron-down" :size="24" />
|
|
24
|
-
</var-button>
|
|
21
|
+
<var-site-button text color="transparent" text-color="#fff" @click="showMenu = true">
|
|
22
|
+
<var-site-icon name="translate" :size="24" />
|
|
23
|
+
<var-site-icon name="chevron-down" :size="24" />
|
|
24
|
+
</var-site-button>
|
|
25
25
|
|
|
26
26
|
<template #menu>
|
|
27
27
|
<div style="background: #fff">
|
|
28
|
-
<var-cell
|
|
28
|
+
<var-site-cell
|
|
29
29
|
v-for="(value, key) in nonEmptyLanguages"
|
|
30
30
|
:key="key"
|
|
31
31
|
class="mobile-language-cell"
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
@click="changeLanguage(key)"
|
|
35
35
|
>
|
|
36
36
|
{{ value }}
|
|
37
|
-
</var-cell>
|
|
37
|
+
</var-site-cell>
|
|
38
38
|
</div>
|
|
39
39
|
</template>
|
|
40
|
-
</var-menu>
|
|
40
|
+
</var-site-menu>
|
|
41
41
|
</template>
|
|
42
|
-
</var-app-bar>
|
|
42
|
+
</var-site-app-bar>
|
|
43
43
|
</header>
|
|
44
44
|
<div class="router-view__block">
|
|
45
45
|
<router-view />
|
|
@@ -107,6 +107,10 @@ export default defineComponent({
|
|
|
107
107
|
</script>
|
|
108
108
|
|
|
109
109
|
<style lang="less">
|
|
110
|
+
* {
|
|
111
|
+
-webkit-font-smoothing: antialiased;
|
|
112
|
+
}
|
|
113
|
+
|
|
110
114
|
body {
|
|
111
115
|
margin: 0;
|
|
112
116
|
padding: 0;
|
|
@@ -130,7 +134,7 @@ header {
|
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
.app-bar {
|
|
133
|
-
background: var(--site-color-app-bar) !important;
|
|
137
|
+
background: var(--site-config-color-app-bar) !important;
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
.router-view__block {
|
|
@@ -146,8 +150,8 @@ header {
|
|
|
146
150
|
cursor: pointer;
|
|
147
151
|
|
|
148
152
|
&--active {
|
|
149
|
-
color: var(--site-color-mobile-language-active);
|
|
150
|
-
background: var(--site-color-mobile-language-active-background);
|
|
153
|
+
color: var(--site-config-color-mobile-language-active);
|
|
154
|
+
background: var(--site-config-color-mobile-language-active-background);
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
</style>
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
</h1>
|
|
7
7
|
<h2 class="varlet-home__desc">{{ description[lang] }}</h2>
|
|
8
8
|
</div>
|
|
9
|
-
<var-cell
|
|
9
|
+
<var-site-cell
|
|
10
10
|
v-for="component in components"
|
|
11
11
|
:key="component.text"
|
|
12
12
|
@click="toComponent(component)"
|
|
13
13
|
v-ripple
|
|
14
14
|
>
|
|
15
15
|
<template #extra>
|
|
16
|
-
<var-icon name="chevron-right" size="14" />
|
|
16
|
+
<var-site-icon name="chevron-right" size="14" />
|
|
17
17
|
</template>
|
|
18
18
|
<template #default>
|
|
19
19
|
{{ component.text[lang] }}
|
|
20
20
|
</template>
|
|
21
|
-
</var-cell>
|
|
21
|
+
</var-site-cell>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script>
|
|
@@ -112,15 +112,15 @@ export default {
|
|
|
112
112
|
margin-left: 16px;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
.var-cell {
|
|
115
|
+
.var-site-cell {
|
|
116
116
|
cursor: pointer;
|
|
117
117
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
118
118
|
transition: all 0.3s;
|
|
119
119
|
color: #555;
|
|
120
120
|
|
|
121
121
|
&:hover {
|
|
122
|
-
color: var(--site-color-mobile-cell-hover);
|
|
123
|
-
background: var(--site-color-mobile-cell-hover-background);
|
|
122
|
+
color: var(--site-config-color-mobile-cell-hover);
|
|
123
|
+
background: var(--site-config-color-mobile-cell-hover-background);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
</style>
|
package/site/mobile/main.ts
CHANGED
|
@@ -7,13 +7,14 @@ import '@varlet/touch-emulator'
|
|
|
7
7
|
import { createApp } from 'vue'
|
|
8
8
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import '
|
|
12
|
-
import '
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
10
|
+
import Icon from '../components/icon'
|
|
11
|
+
import AppBar from '../components/app-bar'
|
|
12
|
+
import Button from '../components/button'
|
|
13
|
+
import Menu from '../components/menu'
|
|
14
|
+
import Cell from '../components/cell'
|
|
15
|
+
import Ripple from '../components/ripple'
|
|
16
|
+
import '../components/styles/common.less'
|
|
17
|
+
import '../components/styles/elevation.less'
|
|
17
18
|
|
|
18
19
|
import { get } from 'lodash-es'
|
|
19
20
|
import { inIframe, isPhone } from '../utils'
|
|
@@ -61,12 +62,18 @@ router.beforeEach((to, from) => {
|
|
|
61
62
|
}
|
|
62
63
|
})
|
|
63
64
|
|
|
65
|
+
// @ts-ignore
|
|
64
66
|
createApp(App)
|
|
65
67
|
.use(router)
|
|
68
|
+
// @ts-ignore
|
|
66
69
|
.use(Icon)
|
|
70
|
+
// @ts-ignore
|
|
67
71
|
.use(AppBar)
|
|
72
|
+
// @ts-ignore
|
|
68
73
|
.use(Cell)
|
|
69
74
|
.use(Ripple)
|
|
75
|
+
// @ts-ignore
|
|
70
76
|
.use(Button)
|
|
77
|
+
// @ts-ignore
|
|
71
78
|
.use(Menu)
|
|
72
79
|
.mount('#app')
|
package/site/pc/App.vue
CHANGED
|
@@ -82,7 +82,7 @@ export default defineComponent({
|
|
|
82
82
|
nextTick(() => {
|
|
83
83
|
const children = document
|
|
84
84
|
.querySelector('.varlet-site-sidebar')
|
|
85
|
-
.getElementsByClassName('var-cell')
|
|
85
|
+
.getElementsByClassName('var-site-cell')
|
|
86
86
|
const index = menu.value.findIndex((item) => item.doc === menuName)
|
|
87
87
|
|
|
88
88
|
if (index !== -1) {
|
|
@@ -142,13 +142,17 @@ export default defineComponent({
|
|
|
142
142
|
</style>
|
|
143
143
|
|
|
144
144
|
<style lang="less">
|
|
145
|
-
@import '@varlet/ui/es/progress/progress';
|
|
146
|
-
|
|
147
145
|
@doc-active: {
|
|
148
146
|
display: inline;
|
|
149
147
|
font-family: inherit;
|
|
150
148
|
padding: 0 4px;
|
|
151
|
-
white-space:
|
|
149
|
+
white-space: pre-wrap;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
::-webkit-scrollbar {
|
|
153
|
+
display: none;
|
|
154
|
+
width: 0;
|
|
155
|
+
background: transparent;
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
body {
|
|
@@ -172,7 +176,7 @@ iframe {
|
|
|
172
176
|
align-items: center;
|
|
173
177
|
margin: 20px 4px 20px;
|
|
174
178
|
padding: 40px;
|
|
175
|
-
border-top: 7px solid var(--site-color-primary);
|
|
179
|
+
border-top: 7px solid var(--site-config-color-primary);
|
|
176
180
|
border-radius: 4px;
|
|
177
181
|
box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
|
|
178
182
|
|
|
@@ -199,9 +203,10 @@ iframe {
|
|
|
199
203
|
|
|
200
204
|
&-site {
|
|
201
205
|
&-content {
|
|
202
|
-
height: calc(100vh - 60px);
|
|
203
206
|
display: flex;
|
|
204
207
|
background: #fff;
|
|
208
|
+
margin-top: 60px;
|
|
209
|
+
margin-left: 220px;
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
&-doc-container {
|
|
@@ -222,7 +227,7 @@ iframe {
|
|
|
222
227
|
|
|
223
228
|
&-doc {
|
|
224
229
|
a {
|
|
225
|
-
color: var(--site-color-link);
|
|
230
|
+
color: var(--site-config-color-link);
|
|
226
231
|
-webkit-font-smoothing: antialiased;
|
|
227
232
|
word-break: keep-all;
|
|
228
233
|
font-size: 15px;
|
|
@@ -295,7 +300,7 @@ iframe {
|
|
|
295
300
|
table code {
|
|
296
301
|
-webkit-font-smoothing: antialiased;
|
|
297
302
|
word-break: keep-all;
|
|
298
|
-
color: var(--site-color-primary);
|
|
303
|
+
color: var(--site-config-color-primary);
|
|
299
304
|
font-size: 15px;
|
|
300
305
|
@doc-active();
|
|
301
306
|
}
|
|
@@ -327,14 +332,14 @@ iframe {
|
|
|
327
332
|
font-family: Consolas, Monaco, monospace;
|
|
328
333
|
|
|
329
334
|
code {
|
|
330
|
-
white-space:
|
|
335
|
+
white-space: pre-wrap;
|
|
331
336
|
padding: 0;
|
|
332
337
|
font-size: 13px;
|
|
333
338
|
}
|
|
334
339
|
}
|
|
335
340
|
|
|
336
341
|
em {
|
|
337
|
-
color: var(--site-color-type);
|
|
342
|
+
color: var(--site-config-color-type);
|
|
338
343
|
font-style: normal;
|
|
339
344
|
-webkit-font-smoothing: antialiased;
|
|
340
345
|
font-size: 13px;
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
@mouseleave="isOpenMenu = false"
|
|
13
13
|
v-if="languages"
|
|
14
14
|
>
|
|
15
|
-
<var-icon name="translate" size="26px" color="#666" />
|
|
16
|
-
<var-icon name="chevron-down" color="#666" />
|
|
15
|
+
<var-site-icon name="translate" size="26px" color="#666" />
|
|
16
|
+
<var-site-icon name="chevron-down" color="#666" />
|
|
17
17
|
<transition name="fade">
|
|
18
18
|
<div
|
|
19
19
|
class="varlet-site-header__language-list var-elevation--5"
|
|
20
20
|
v-show="isOpenMenu"
|
|
21
21
|
:style="{ pointerEvents: isOpenMenu ? 'auto' : 'none' }"
|
|
22
22
|
>
|
|
23
|
-
<var-cell
|
|
23
|
+
<var-site-cell
|
|
24
24
|
v-for="(value, key) in nonEmptyLanguages"
|
|
25
25
|
v-ripple
|
|
26
26
|
:key="key"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
@click="handleLanguageChange(key)"
|
|
29
29
|
>
|
|
30
30
|
{{ value }}
|
|
31
|
-
</var-cell>
|
|
31
|
+
</var-site-cell>
|
|
32
32
|
</div>
|
|
33
33
|
</transition>
|
|
34
34
|
</div>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
:href="github"
|
|
39
39
|
v-if="github"
|
|
40
40
|
>
|
|
41
|
-
<var-icon name="github" color="#666" :size="28" />
|
|
41
|
+
<var-site-icon name="github" color="#666" :size="28" />
|
|
42
42
|
</a>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
|
@@ -124,15 +124,19 @@ export default {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.varlet-site-header {
|
|
127
|
+
position: fixed;
|
|
128
|
+
top: 0;
|
|
129
|
+
left: 0;
|
|
127
130
|
display: flex;
|
|
128
131
|
align-items: center;
|
|
129
132
|
color: #555;
|
|
133
|
+
width: 100%;
|
|
130
134
|
height: 60px;
|
|
131
135
|
padding: 0 30px;
|
|
132
136
|
justify-content: space-between;
|
|
133
137
|
user-select: none;
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
z-index: 996;
|
|
139
|
+
background: #fff;
|
|
136
140
|
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
|
137
141
|
box-sizing: border-box;
|
|
138
142
|
|
|
@@ -200,13 +204,13 @@ export default {
|
|
|
200
204
|
top: 40px;
|
|
201
205
|
left: -20px;
|
|
202
206
|
|
|
203
|
-
.var-cell {
|
|
207
|
+
.var-site-cell {
|
|
204
208
|
width: 100px;
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
&--active {
|
|
208
|
-
background: var(--site-color-pc-language-active-background);
|
|
209
|
-
color: var(--site-color-pc-language-active);
|
|
212
|
+
background: var(--site-config-color-pc-language-active-background);
|
|
213
|
+
color: var(--site-config-color-pc-language-active);
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="varlet-site-mobile var-elevation--3">
|
|
2
|
+
<div class="varlet-site-mobile var-site-elevation--3">
|
|
3
3
|
<div class="varlet-site-mobile-content">
|
|
4
4
|
<iframe :src="`./mobile.html#/${componentName}?language=${language}&platform=pc&replace=${replace}`"></iframe>
|
|
5
5
|
</div>
|
|
@@ -25,10 +25,10 @@ export default {
|
|
|
25
25
|
|
|
26
26
|
<style scoped lang="less">
|
|
27
27
|
.varlet-site-mobile {
|
|
28
|
+
position: sticky;
|
|
28
29
|
flex: 0 0 325px;
|
|
29
|
-
|
|
30
|
+
top: 80px;
|
|
30
31
|
height: calc(100vh - 100px);
|
|
31
|
-
align-self: center;
|
|
32
32
|
margin-right: 38px;
|
|
33
33
|
overflow: hidden;
|
|
34
34
|
border-radius: 8px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="varlet-site-sidebar var-elevation--3">
|
|
3
|
-
<var-cell
|
|
3
|
+
<var-site-cell
|
|
4
4
|
class="varlet-site-sidebar__item"
|
|
5
5
|
:class="{
|
|
6
6
|
'varlet-site-sidebar__item--active': item.doc === menuName,
|
|
@@ -17,15 +17,14 @@
|
|
|
17
17
|
@click="changeRoute(item)"
|
|
18
18
|
>
|
|
19
19
|
<span class="varlet-site-sidebar__item--title" v-if="item.type === menuTypes.TITLE">{{ item.text[language] }}</span>
|
|
20
|
-
<span
|
|
21
|
-
</var-cell>
|
|
20
|
+
<span v-else>{{ item.text[language] }}</span>
|
|
21
|
+
</var-site-cell>
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script lang="ts">
|
|
26
26
|
// @ts-ignore
|
|
27
27
|
import config from '@config'
|
|
28
|
-
import '@varlet/ui/es/styles/elevation.less'
|
|
29
28
|
import { MenuTypes } from '../../utils'
|
|
30
29
|
import { reactive, ref } from 'vue'
|
|
31
30
|
import type { PropType } from 'vue'
|
|
@@ -70,9 +69,9 @@ export default {
|
|
|
70
69
|
<style scoped lang="less">
|
|
71
70
|
.varlet-site-sidebar {
|
|
72
71
|
padding: 0 0 15px;
|
|
73
|
-
position:
|
|
74
|
-
|
|
75
|
-
top:
|
|
72
|
+
position: fixed;
|
|
73
|
+
width: 220px;
|
|
74
|
+
top: 60px;
|
|
76
75
|
bottom: 0;
|
|
77
76
|
left: 0;
|
|
78
77
|
z-index: 1;
|
|
@@ -97,28 +96,18 @@ export default {
|
|
|
97
96
|
padding: 8px 0 8px;
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
&--link {
|
|
101
|
-
font-size: 14px;
|
|
102
|
-
color: #455a64;
|
|
103
|
-
transition: color 0.2s;
|
|
104
|
-
|
|
105
|
-
&:hover {
|
|
106
|
-
color: var(--site-color-side-bar);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
99
|
&--active {
|
|
111
100
|
position: relative;
|
|
112
|
-
background: var(--site-color-side-bar-active-background);
|
|
101
|
+
background: var(--site-config-color-side-bar-active-background);
|
|
113
102
|
|
|
114
103
|
span {
|
|
115
|
-
color: var(--site-color-side-bar);
|
|
104
|
+
color: var(--site-config-color-side-bar);
|
|
116
105
|
}
|
|
117
106
|
|
|
118
107
|
&::before {
|
|
119
108
|
display: block;
|
|
120
109
|
content: '';
|
|
121
|
-
background: var(--site-color-side-bar);
|
|
110
|
+
background: var(--site-config-color-side-bar);
|
|
122
111
|
width: 4px;
|
|
123
112
|
height: 40px;
|
|
124
113
|
position: absolute;
|
|
@@ -129,6 +118,13 @@ export default {
|
|
|
129
118
|
|
|
130
119
|
&__link {
|
|
131
120
|
cursor: pointer;
|
|
121
|
+
font-size: 14px;
|
|
122
|
+
color: #455a64;
|
|
123
|
+
transition: color 0.2s;
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
color: var(--site-config-color-side-bar);
|
|
127
|
+
}
|
|
132
128
|
}
|
|
133
129
|
|
|
134
130
|
&__title {
|
package/site/pc/main.ts
CHANGED
|
@@ -5,10 +5,11 @@ import routes from '@pc-routes'
|
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import config from '@config'
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
8
|
+
import Icon from '../components/icon'
|
|
9
|
+
import Cell from '../components/cell'
|
|
10
|
+
import Ripple from '../components/ripple'
|
|
11
|
+
import '../components/styles/common.less'
|
|
12
|
+
import '../components/styles/elevation.less'
|
|
12
13
|
|
|
13
14
|
import { createApp } from 'vue'
|
|
14
15
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
@@ -68,7 +69,9 @@ Object.defineProperty(window, 'onMobileRouteChange', {
|
|
|
68
69
|
|
|
69
70
|
createApp(App)
|
|
70
71
|
.use(router)
|
|
72
|
+
// @ts-ignore
|
|
71
73
|
.use(Cell)
|
|
72
74
|
.use(Ripple)
|
|
75
|
+
// @ts-ignore
|
|
73
76
|
.use(Icon)
|
|
74
77
|
.mount('#app')
|
package/site/useProgress.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import Progress from './components/progress'
|
|
1
2
|
import { reactive } from 'vue'
|
|
2
|
-
import { Progress } from '@varlet/ui'
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import config from '@config'
|
|
5
5
|
// @ts-ignore
|
|
6
|
-
import { mountInstance } from '
|
|
6
|
+
import { mountInstance } from './utils'
|
|
7
7
|
import { get } from 'lodash-es'
|
|
8
8
|
|
|
9
9
|
export function useProgress() {
|
|
10
|
+
let timer: number
|
|
11
|
+
const trackColor = get(config, 'themes.color-progress-track')
|
|
12
|
+
const color = get(config, 'themes.color-progress')
|
|
13
|
+
|
|
10
14
|
const props = reactive({
|
|
11
15
|
style: {
|
|
12
16
|
position: 'fixed',
|
|
@@ -15,14 +19,12 @@ export function useProgress() {
|
|
|
15
19
|
top: 0,
|
|
16
20
|
zIndex: 10086,
|
|
17
21
|
},
|
|
18
|
-
trackColor
|
|
19
|
-
color
|
|
22
|
+
trackColor,
|
|
23
|
+
color,
|
|
20
24
|
lineWidth: 3,
|
|
21
25
|
value: 0,
|
|
22
26
|
})
|
|
23
27
|
|
|
24
|
-
let timer: number
|
|
25
|
-
|
|
26
28
|
const changeValue = () => {
|
|
27
29
|
timer = window.setTimeout(() => {
|
|
28
30
|
if (props.value >= 95) return
|
|
@@ -37,13 +39,13 @@ export function useProgress() {
|
|
|
37
39
|
|
|
38
40
|
const start = () => {
|
|
39
41
|
props.value = 0
|
|
40
|
-
setTimeout(() => (props.color =
|
|
42
|
+
setTimeout(() => (props.color = color), 200)
|
|
41
43
|
changeValue()
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
const end = () => {
|
|
45
47
|
props.value = 100
|
|
46
|
-
setTimeout(() => (props.color =
|
|
48
|
+
setTimeout(() => (props.color = trackColor), 300)
|
|
47
49
|
window.clearTimeout(timer)
|
|
48
50
|
}
|
|
49
51
|
|