@varlet/cli 2.15.1 → 2.16.0-alpha.1693852004525
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/lib/node/config/varlet.config.js +2 -1
- package/lib/node/config/varlet.default.config.js +264 -7
- package/package.json +8 -7
- package/site/mobile/App.vue +25 -22
- package/site/mobile/{components/AppHome.vue → AppHome.vue} +6 -6
- package/site/mobile/main.ts +6 -21
- package/site/pc/App.vue +0 -5
- package/site/pc/Layout.vue +24 -28
- package/site/pc/components/AppHeader.vue +123 -122
- package/site/pc/components/AppMobile.vue +9 -2
- package/site/pc/components/AppSidebar.vue +18 -17
- package/site/{components → pc/components}/code-example/CodeExample.vue +8 -15
- package/site/pc/main.ts +6 -23
- package/site/pc/pages/index/index.vue +316 -47
- package/site/types.ts +6 -0
- package/template/generators/base/package.json +1 -0
- package/site/components/button/Button.vue +0 -106
- package/site/components/button/button.less +0 -183
- package/site/components/button/index.ts +0 -10
- package/site/components/button/props.ts +0 -78
- package/site/components/cell/Cell.vue +0 -54
- package/site/components/cell/cell.less +0 -78
- package/site/components/cell/index.ts +0 -10
- package/site/components/cell/props.ts +0 -27
- package/site/components/context/index.ts +0 -21
- package/site/components/context/lock.ts +0 -92
- package/site/components/context/zIndex.ts +0 -20
- package/site/components/icon/Icon.vue +0 -75
- package/site/components/icon/icon.less +0 -38
- package/site/components/icon/index.ts +0 -10
- package/site/components/icon/props.ts +0 -24
- package/site/components/loading/Loading.vue +0 -84
- package/site/components/loading/index.ts +0 -10
- package/site/components/loading/loading.less +0 -505
- package/site/components/loading/props.ts +0 -42
- package/site/components/popup/Popup.tsx +0 -102
- package/site/components/popup/index.ts +0 -10
- package/site/components/popup/popup.less +0 -125
- package/site/components/popup/props.ts +0 -63
- package/site/components/ripple/index.ts +0 -188
- package/site/components/ripple/ripple.less +0 -20
- package/site/components/snackbar/Snackbar.vue +0 -41
- package/site/components/snackbar/core.vue +0 -132
- package/site/components/snackbar/index.tsx +0 -270
- package/site/components/snackbar/props.ts +0 -97
- package/site/components/snackbar/snackbar.less +0 -135
- package/site/components/styles/common.less +0 -64
- package/site/components/styles/elevation.less +0 -126
- package/site/components/styles/var.less +0 -27
- package/site/components/utils/components.ts +0 -114
- package/site/components/utils/elements.ts +0 -104
- package/site/mobile/components/app-bar/AppBar.vue +0 -65
- package/site/mobile/components/app-bar/appBar.less +0 -57
- package/site/mobile/components/app-bar/index.ts +0 -10
- package/site/mobile/components/app-bar/props.ts +0 -25
- package/site/pc/components/AnimationBox.vue +0 -62
- package/site/pc/components/LogoAnimation.vue +0 -119
- package/site/pc/pages/index/index.less +0 -204
- /package/site/{components → pc/components}/code-example/codeExample.less +0 -0
- /package/site/{components → pc/components}/code-example/index.ts +0 -0
package/site/pc/Layout.vue
CHANGED
|
@@ -3,20 +3,20 @@ import config from '@config'
|
|
|
3
3
|
import AppMobile from './components/AppMobile.vue'
|
|
4
4
|
import AppHeader from './components/AppHeader.vue'
|
|
5
5
|
import AppSidebar from './components/AppSidebar.vue'
|
|
6
|
-
import
|
|
7
|
-
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
6
|
+
import { Context } from '@varlet/ui'
|
|
7
|
+
import { nextTick, onMounted, ref, watch, type Ref } from 'vue'
|
|
8
8
|
import { useRoute } from 'vue-router'
|
|
9
9
|
import { get } from 'lodash-es'
|
|
10
10
|
import { getPCLocationInfo } from '@varlet/cli/client'
|
|
11
11
|
import { MenuTypes, type Menu } from '../utils'
|
|
12
|
-
import type
|
|
12
|
+
import { type SiteContext } from '../types'
|
|
13
13
|
|
|
14
|
+
const context = Context as SiteContext
|
|
14
15
|
const menu: Ref<Menu[]> = ref(get(config, 'pc.menu', []))
|
|
15
16
|
const useMobile = ref(get(config, 'useMobile'))
|
|
16
17
|
const mobileRedirect = get(config, 'mobile.redirect')
|
|
17
|
-
|
|
18
18
|
const language: Ref<string> = ref('')
|
|
19
|
-
const componentName: Ref<
|
|
19
|
+
const componentName: Ref<string | undefined> = ref()
|
|
20
20
|
const menuName: Ref<string> = ref('')
|
|
21
21
|
const hash: Ref<string> = ref('')
|
|
22
22
|
const doc: Ref<HTMLElement | null> = ref(null)
|
|
@@ -33,7 +33,7 @@ const init = () => {
|
|
|
33
33
|
nextTick(() => {
|
|
34
34
|
const children = document
|
|
35
35
|
.querySelector('.varlet-site-sidebar')!
|
|
36
|
-
.getElementsByClassName('var-
|
|
36
|
+
.getElementsByClassName('var-cell')
|
|
37
37
|
const index = menu.value.findIndex((item) => item.doc === menuName)
|
|
38
38
|
|
|
39
39
|
if (index !== -1) {
|
|
@@ -133,28 +133,13 @@ watch(
|
|
|
133
133
|
@click-overlay="confirmClose"
|
|
134
134
|
>
|
|
135
135
|
<div class="varlet-site-playground-container">
|
|
136
|
-
<iframe id="playground" class="varlet-site-playground-iframe" :src="context.playgroundURL" allow="clipboard-write">
|
|
136
|
+
<iframe v-if="context.showPlayground" id="playground" class="varlet-site-playground-iframe" :src="context.playgroundURL" allow="clipboard-write">
|
|
137
137
|
</iframe>
|
|
138
138
|
</div>
|
|
139
139
|
</var-popup>
|
|
140
140
|
</template>
|
|
141
141
|
|
|
142
|
-
<style>
|
|
143
|
-
.varlet-site-playground-container {
|
|
144
|
-
width: calc(100vw - 256px);
|
|
145
|
-
max-width: 1660px;
|
|
146
|
-
height: 100vh;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.varlet-site-playground-iframe {
|
|
150
|
-
width: 100%;
|
|
151
|
-
height: 100%;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.var-site-popup__content {
|
|
155
|
-
background-color: rgba(0, 0, 0, 0)
|
|
156
|
-
}
|
|
157
|
-
|
|
142
|
+
<style lang="less">
|
|
158
143
|
.hljs {
|
|
159
144
|
background: var(--site-config-color-hl-background) !important;
|
|
160
145
|
padding: 0 !important;
|
|
@@ -200,6 +185,10 @@ watch(
|
|
|
200
185
|
.hljs-deletion, .hljs-number {
|
|
201
186
|
color: var(--site-config-color-hl-group-i)
|
|
202
187
|
}
|
|
188
|
+
|
|
189
|
+
.var-popup__content {
|
|
190
|
+
background-color: rgba(0, 0, 0, 0)
|
|
191
|
+
}
|
|
203
192
|
</style>
|
|
204
193
|
|
|
205
194
|
<style lang="less">
|
|
@@ -210,10 +199,6 @@ watch(
|
|
|
210
199
|
white-space: pre-wrap;
|
|
211
200
|
}
|
|
212
201
|
|
|
213
|
-
* {
|
|
214
|
-
transition: background-color .25s, box-shadow .25s;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
202
|
iframe {
|
|
218
203
|
display: block;
|
|
219
204
|
width: 100%;
|
|
@@ -266,7 +251,7 @@ iframe {
|
|
|
266
251
|
&-content {
|
|
267
252
|
display: flex;
|
|
268
253
|
background: var(--site-config-color-body);
|
|
269
|
-
margin-left:
|
|
254
|
+
margin-left: 246px;
|
|
270
255
|
min-height: calc(100vh - 60px);
|
|
271
256
|
}
|
|
272
257
|
|
|
@@ -454,6 +439,17 @@ iframe {
|
|
|
454
439
|
}
|
|
455
440
|
}
|
|
456
441
|
}
|
|
442
|
+
|
|
443
|
+
&-playground-container {
|
|
444
|
+
width: calc(100vw - 256px);
|
|
445
|
+
max-width: 1660px;
|
|
446
|
+
height: 100vh;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
&-playground-iframe {
|
|
450
|
+
width: 100%;
|
|
451
|
+
height: 100%;
|
|
452
|
+
}
|
|
457
453
|
}
|
|
458
454
|
}
|
|
459
455
|
</style>
|
|
@@ -1,6 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="varlet-site-header">
|
|
3
|
+
<div class="varlet-site-header__lead">
|
|
4
|
+
<img class="varlet-site-header__logo" :src="config.logo" @click="backRoot"/>
|
|
5
|
+
<div class="varlet-site-header__title" v-if="title" @click="backRoot">{{ title }}</div>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="varlet-site-header__tail">
|
|
9
|
+
<div
|
|
10
|
+
class="varlet-site-header__versions"
|
|
11
|
+
@mouseenter="isOpenVersionsMenu = true"
|
|
12
|
+
@mouseleave="isOpenVersionsMenu = false"
|
|
13
|
+
v-if="nonEmptyVersions && Object.keys(nonEmptyVersions).length"
|
|
14
|
+
>
|
|
15
|
+
<span style="font-size: 14px;">{{ currentVersion }}</span>
|
|
16
|
+
<var-icon name="chevron-down"/>
|
|
17
|
+
<transition name="fade">
|
|
18
|
+
<div
|
|
19
|
+
class="varlet-site-header__animation-list varlet-site-header__animation-versions var-elevation--5"
|
|
20
|
+
v-show="isOpenVersionsMenu"
|
|
21
|
+
:style="{ pointerEvents: isOpenVersionsMenu ? 'auto' : 'none' }"
|
|
22
|
+
>
|
|
23
|
+
<var-cell
|
|
24
|
+
v-for="(value, key) in nonEmptyVersions"
|
|
25
|
+
v-ripple
|
|
26
|
+
:key="key"
|
|
27
|
+
:class="{ 'varlet-site-header__animation-list--active': currentVersion === key }"
|
|
28
|
+
@click="open(value)"
|
|
29
|
+
>{{ key }}
|
|
30
|
+
</var-cell>
|
|
31
|
+
</div>
|
|
32
|
+
</transition>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<a class="varlet-site-header__link" target="_blank" :href="playground" v-ripple v-if="playground">
|
|
36
|
+
<var-icon name="code-json" :size="24"/>
|
|
37
|
+
</a>
|
|
38
|
+
<a class="varlet-site-header__link" target="_blank" :href="github" v-ripple v-if="github">
|
|
39
|
+
<var-icon name="github" :size="28"/>
|
|
40
|
+
</a>
|
|
41
|
+
<div class="varlet-site-header__theme" v-ripple v-if="darkMode" @click="toggleTheme">
|
|
42
|
+
<var-icon
|
|
43
|
+
size="26px"
|
|
44
|
+
:name="currentTheme === 'lightTheme' ? 'white-balance-sunny' : 'weather-night'"
|
|
45
|
+
:style="{
|
|
46
|
+
marginBottom: currentTheme === 'darkTheme' && '2px',
|
|
47
|
+
marginTop: currentTheme === 'lightTheme' && '2px',
|
|
48
|
+
}"
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
<div
|
|
52
|
+
class="varlet-site-header__language"
|
|
53
|
+
@mouseenter="isOpenLanguageMenu = true"
|
|
54
|
+
@mouseleave="isOpenLanguageMenu = false"
|
|
55
|
+
v-if="languages"
|
|
56
|
+
>
|
|
57
|
+
<var-icon name="translate" :size="26"/>
|
|
58
|
+
<var-icon name="chevron-down"/>
|
|
59
|
+
<transition name="fade">
|
|
60
|
+
<div
|
|
61
|
+
class="varlet-site-header__animation-list var-elevation--5"
|
|
62
|
+
v-show="isOpenLanguageMenu"
|
|
63
|
+
:style="{ pointerEvents: isOpenLanguageMenu ? 'auto' : 'none' }"
|
|
64
|
+
>
|
|
65
|
+
<var-cell
|
|
66
|
+
v-for="(value, key) in nonEmptyLanguages"
|
|
67
|
+
v-ripple
|
|
68
|
+
:key="key"
|
|
69
|
+
:class="{ 'varlet-site-header__animation-list--active': language === key }"
|
|
70
|
+
@click="handleLanguageChange(key)"
|
|
71
|
+
>{{ value }}
|
|
72
|
+
</var-cell>
|
|
73
|
+
</div>
|
|
74
|
+
</transition>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
1
81
|
<script lang="ts">
|
|
2
82
|
import config from '@config'
|
|
3
|
-
import AnimationBox from './AnimationBox.vue'
|
|
4
83
|
import { ref, computed, defineComponent } from 'vue'
|
|
5
84
|
import { get } from 'lodash-es'
|
|
6
85
|
import { getBrowserTheme, getPCLocationInfo, Theme, watchTheme } from '@varlet/cli/client'
|
|
@@ -11,7 +90,6 @@ import type { Ref, ComputedRef } from 'vue'
|
|
|
11
90
|
|
|
12
91
|
export default defineComponent({
|
|
13
92
|
name: 'AppHeader',
|
|
14
|
-
components: { AnimationBox },
|
|
15
93
|
props: {
|
|
16
94
|
language: {
|
|
17
95
|
type: String,
|
|
@@ -89,6 +167,7 @@ export default defineComponent({
|
|
|
89
167
|
|
|
90
168
|
return {
|
|
91
169
|
logo,
|
|
170
|
+
config,
|
|
92
171
|
title,
|
|
93
172
|
currentVersion,
|
|
94
173
|
languages,
|
|
@@ -110,119 +189,7 @@ export default defineComponent({
|
|
|
110
189
|
})
|
|
111
190
|
</script>
|
|
112
191
|
|
|
113
|
-
<
|
|
114
|
-
<div class="varlet-site-header">
|
|
115
|
-
<div class="varlet-site-header__lead">
|
|
116
|
-
<animation-box class="varlet-site-header__logo" @click="backRoot"/>
|
|
117
|
-
<div class="varlet-site-header__title" v-if="title" @click="backRoot">{{ title }}</div>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<div class="varlet-site-header__tail">
|
|
121
|
-
<div
|
|
122
|
-
class="varlet-site-header__versions"
|
|
123
|
-
@mouseenter="isOpenVersionsMenu = true"
|
|
124
|
-
@mouseleave="isOpenVersionsMenu = false"
|
|
125
|
-
v-if="nonEmptyVersions && Object.keys(nonEmptyVersions).length"
|
|
126
|
-
>
|
|
127
|
-
<span style="font-size: 14px;">{{ currentVersion }}</span>
|
|
128
|
-
<var-icon name="chevron-down"/>
|
|
129
|
-
<transition name="fade">
|
|
130
|
-
<div
|
|
131
|
-
class="varlet-site-header__animation-list varlet-site-header__animation-versions var-site-elevation--5"
|
|
132
|
-
v-show="isOpenVersionsMenu"
|
|
133
|
-
:style="{ pointerEvents: isOpenVersionsMenu ? 'auto' : 'none' }"
|
|
134
|
-
>
|
|
135
|
-
<var-cell
|
|
136
|
-
v-for="(value, key) in nonEmptyVersions"
|
|
137
|
-
v-ripple
|
|
138
|
-
:key="key"
|
|
139
|
-
:class="{ 'varlet-site-header__animation-list--active': currentVersion === key }"
|
|
140
|
-
@click="open(value)"
|
|
141
|
-
>{{ key }}
|
|
142
|
-
</var-cell>
|
|
143
|
-
</div>
|
|
144
|
-
</transition>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
<a class="varlet-site-header__link" target="_blank" :href="playground" v-ripple v-if="playground">
|
|
148
|
-
<var-icon name="code-json" :size="24"/>
|
|
149
|
-
</a>
|
|
150
|
-
<a class="varlet-site-header__link" target="_blank" :href="github" v-ripple v-if="github">
|
|
151
|
-
<var-icon name="github" :size="28"/>
|
|
152
|
-
</a>
|
|
153
|
-
<div class="varlet-site-header__theme" v-ripple v-if="darkMode" @click="toggleTheme">
|
|
154
|
-
<var-icon
|
|
155
|
-
size="26px"
|
|
156
|
-
:name="currentTheme === 'lightTheme' ? 'white-balance-sunny' : 'weather-night'"
|
|
157
|
-
:style="{
|
|
158
|
-
marginBottom: currentTheme === 'darkTheme' && '2px',
|
|
159
|
-
marginTop: currentTheme === 'lightTheme' && '2px',
|
|
160
|
-
}"
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
<div
|
|
164
|
-
class="varlet-site-header__language"
|
|
165
|
-
@mouseenter="isOpenLanguageMenu = true"
|
|
166
|
-
@mouseleave="isOpenLanguageMenu = false"
|
|
167
|
-
v-if="languages"
|
|
168
|
-
>
|
|
169
|
-
<var-icon name="translate" size="26px"/>
|
|
170
|
-
<var-icon name="chevron-down"/>
|
|
171
|
-
<transition name="fade">
|
|
172
|
-
<div
|
|
173
|
-
class="varlet-site-header__animation-list var-site-elevation--5"
|
|
174
|
-
v-show="isOpenLanguageMenu"
|
|
175
|
-
:style="{ pointerEvents: isOpenLanguageMenu ? 'auto' : 'none' }"
|
|
176
|
-
>
|
|
177
|
-
<var-cell
|
|
178
|
-
v-for="(value, key) in nonEmptyLanguages"
|
|
179
|
-
v-ripple
|
|
180
|
-
:key="key"
|
|
181
|
-
:class="{ 'varlet-site-header__animation-list--active': language === key }"
|
|
182
|
-
@click="handleLanguageChange(key)"
|
|
183
|
-
>{{ value }}
|
|
184
|
-
</var-cell>
|
|
185
|
-
</div>
|
|
186
|
-
</transition>
|
|
187
|
-
</div>
|
|
188
|
-
|
|
189
|
-
</div>
|
|
190
|
-
</div>
|
|
191
|
-
</template>
|
|
192
|
-
|
|
193
|
-
<style scoped lang="less">
|
|
194
|
-
.fade-enter-active {
|
|
195
|
-
animation-name: fade-in;
|
|
196
|
-
animation-duration: 0.3s;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.fade-leave-active {
|
|
200
|
-
animation-name: fade-leave;
|
|
201
|
-
animation-duration: 0.3s;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
@keyframes fade-in {
|
|
205
|
-
0% {
|
|
206
|
-
top: 30px;
|
|
207
|
-
opacity: 0;
|
|
208
|
-
}
|
|
209
|
-
100% {
|
|
210
|
-
top: 40px;
|
|
211
|
-
opacity: 1;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
@keyframes fade-leave {
|
|
216
|
-
0% {
|
|
217
|
-
top: 40px;
|
|
218
|
-
opacity: 1;
|
|
219
|
-
}
|
|
220
|
-
100% {
|
|
221
|
-
top: 30px;
|
|
222
|
-
opacity: 0;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
192
|
+
<style lang="less">
|
|
226
193
|
.varlet-site-header {
|
|
227
194
|
position: fixed;
|
|
228
195
|
top: 0;
|
|
@@ -348,18 +315,18 @@ export default defineComponent({
|
|
|
348
315
|
top: 40px;
|
|
349
316
|
left: -20px;
|
|
350
317
|
|
|
351
|
-
.var-
|
|
352
|
-
width: 100px;
|
|
318
|
+
.var-cell {
|
|
319
|
+
width: 100px !important;
|
|
320
|
+
color: var(--site-config-color-text);
|
|
353
321
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
color: var(--site-config-color-pc-language-active);
|
|
322
|
+
&__content {
|
|
323
|
+
color: inherit !important;
|
|
357
324
|
}
|
|
358
325
|
}
|
|
359
326
|
|
|
360
327
|
&--active {
|
|
361
|
-
background: var(--site-config-color-pc-language-active-background);
|
|
362
|
-
color: var(--site-config-color-pc-language-active);
|
|
328
|
+
background: var(--site-config-color-pc-language-active-background) !important;
|
|
329
|
+
color: var(--site-config-color-pc-language-active) !important;
|
|
363
330
|
}
|
|
364
331
|
}
|
|
365
332
|
|
|
@@ -368,3 +335,37 @@ export default defineComponent({
|
|
|
368
335
|
}
|
|
369
336
|
}
|
|
370
337
|
</style>
|
|
338
|
+
|
|
339
|
+
<style lang="less" scoped>
|
|
340
|
+
.fade-enter-active {
|
|
341
|
+
animation-name: fade-in;
|
|
342
|
+
animation-duration: 0.3s;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.fade-leave-active {
|
|
346
|
+
animation-name: fade-leave;
|
|
347
|
+
animation-duration: 0.3s;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@keyframes fade-in {
|
|
351
|
+
0% {
|
|
352
|
+
top: 30px;
|
|
353
|
+
opacity: 0;
|
|
354
|
+
}
|
|
355
|
+
100% {
|
|
356
|
+
top: 40px;
|
|
357
|
+
opacity: 1;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@keyframes fade-leave {
|
|
362
|
+
0% {
|
|
363
|
+
top: 40px;
|
|
364
|
+
opacity: 1;
|
|
365
|
+
}
|
|
366
|
+
100% {
|
|
367
|
+
top: 30px;
|
|
368
|
+
opacity: 0;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
</style>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
|
-
<script>
|
|
9
|
+
<script lang="ts">
|
|
10
10
|
export default {
|
|
11
11
|
name: 'AppMobile',
|
|
12
12
|
props: {
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
}
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
|
-
<style
|
|
29
|
+
<style lang="less">
|
|
30
30
|
.varlet-site-mobile {
|
|
31
31
|
position: sticky;
|
|
32
32
|
flex: 0 0 330px;
|
|
@@ -59,5 +59,12 @@ export default {
|
|
|
59
59
|
height: 100%;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
iframe {
|
|
64
|
+
display: block;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
border: none;
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
</style>
|
|
@@ -38,7 +38,8 @@ export default defineComponent({
|
|
|
38
38
|
type: String
|
|
39
39
|
},
|
|
40
40
|
language: {
|
|
41
|
-
type: String
|
|
41
|
+
type: String,
|
|
42
|
+
default: ''
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
emits: ['change'],
|
|
@@ -61,7 +62,7 @@ export default defineComponent({
|
|
|
61
62
|
})
|
|
62
63
|
</script>
|
|
63
64
|
|
|
64
|
-
<style
|
|
65
|
+
<style lang="less">
|
|
65
66
|
@keyframes indicator-fade-in {
|
|
66
67
|
from {
|
|
67
68
|
transform: scaleY(0);
|
|
@@ -77,7 +78,7 @@ export default defineComponent({
|
|
|
77
78
|
.varlet-site-sidebar {
|
|
78
79
|
padding: 0 0 15px;
|
|
79
80
|
position: fixed;
|
|
80
|
-
width:
|
|
81
|
+
width: 246px;
|
|
81
82
|
top: 60px;
|
|
82
83
|
bottom: 0;
|
|
83
84
|
left: 0;
|
|
@@ -91,16 +92,16 @@ export default defineComponent({
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
&__item {
|
|
94
|
-
margin: 0;
|
|
95
|
-
user-select: none;
|
|
96
|
-
padding: 10px 28px;
|
|
95
|
+
margin: 0 !important;
|
|
96
|
+
user-select: none !important;
|
|
97
|
+
padding: 10px 28px !important;
|
|
97
98
|
|
|
98
99
|
&--title {
|
|
99
|
-
font-size: 16px;
|
|
100
|
-
font-weight: 600;
|
|
101
|
-
color: var(--site-config-color-text);
|
|
102
|
-
line-height: 28px;
|
|
103
|
-
padding: 8px 0 8px;
|
|
100
|
+
font-size: 16px !important;
|
|
101
|
+
font-weight: 600 !important;
|
|
102
|
+
color: var(--site-config-color-text) !important;
|
|
103
|
+
line-height: 28px !important;
|
|
104
|
+
padding: 8px 0 8px !important;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
&--active {
|
|
@@ -125,18 +126,18 @@ export default defineComponent({
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
&__link {
|
|
128
|
-
cursor: pointer;
|
|
129
|
-
font-size: 14px;
|
|
130
|
-
color: var(--site-config-color-text);
|
|
131
|
-
transition: color 0.2s;
|
|
129
|
+
cursor: pointer !important;
|
|
130
|
+
font-size: 14px !important;
|
|
131
|
+
color: var(--site-config-color-text) !important;
|
|
132
|
+
transition: color 0.2s !important;
|
|
132
133
|
|
|
133
134
|
&:hover {
|
|
134
|
-
color: var(--site-config-color-side-bar);
|
|
135
|
+
color: var(--site-config-color-side-bar) !important;
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
&__title {
|
|
139
|
-
margin-top: 10px;
|
|
140
|
+
margin-top: 10px !important;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
</style>
|
|
@@ -34,28 +34,23 @@
|
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script lang="ts">
|
|
37
|
-
import Icon from '../icon'
|
|
38
|
-
import Button from '../button'
|
|
39
|
-
import Snackbar from '../snackbar'
|
|
40
|
-
import Clipboard from 'clipboard'
|
|
41
|
-
import context from '../context'
|
|
42
37
|
import config from '@config'
|
|
43
|
-
import
|
|
44
|
-
import {
|
|
38
|
+
import Clipboard from 'clipboard'
|
|
39
|
+
import { Context, Snackbar } from '@varlet/ui'
|
|
40
|
+
import { defineComponent, nextTick, ref, onMounted, type Ref } from 'vue'
|
|
41
|
+
import { doubleRaf } from '@varlet/shared'
|
|
45
42
|
import { get } from 'lodash-es'
|
|
46
43
|
import { getBrowserTheme, getPCLocationInfo } from '@varlet/cli/client'
|
|
47
|
-
import { utoa } from '
|
|
48
|
-
import type
|
|
44
|
+
import { utoa } from '../../../utils'
|
|
45
|
+
import { type SiteContext } from '../../../types'
|
|
46
|
+
|
|
47
|
+
const context = Context as SiteContext
|
|
49
48
|
|
|
50
49
|
let clipId = 0
|
|
51
50
|
const offset = 10
|
|
52
51
|
|
|
53
52
|
export default defineComponent({
|
|
54
53
|
name: 'VarSiteCodeExample',
|
|
55
|
-
components: {
|
|
56
|
-
[Button.name]: Button,
|
|
57
|
-
[Icon.name]: Icon
|
|
58
|
-
},
|
|
59
54
|
props: {
|
|
60
55
|
playgroundIgnore: {
|
|
61
56
|
type: Boolean,
|
|
@@ -97,9 +92,7 @@ export default defineComponent({
|
|
|
97
92
|
|
|
98
93
|
const toPlayground = () => {
|
|
99
94
|
const codeText = code.value?.innerText ?? ''
|
|
100
|
-
|
|
101
95
|
const file = { 'App.vue': codeText }
|
|
102
|
-
|
|
103
96
|
const initialTheme = getBrowserTheme().replace('Theme', '')
|
|
104
97
|
|
|
105
98
|
context.showPlayground = true
|
package/site/pc/main.ts
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import App from './App.vue'
|
|
2
|
-
import '@varlet/touch-emulator'
|
|
3
2
|
import routes from '@pc-routes'
|
|
4
3
|
import config from '@config'
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import Cell from '../components/cell'
|
|
8
|
-
import Ripple from '../components/ripple'
|
|
9
|
-
import Button from '../components/button'
|
|
10
|
-
import Popup from '../components/popup'
|
|
11
|
-
import CodeExample from '../components/code-example'
|
|
12
|
-
import Snackbar from '../components/snackbar'
|
|
13
|
-
|
|
14
|
-
import '../components/styles/common.less'
|
|
15
|
-
import '../components/styles/elevation.less'
|
|
16
|
-
|
|
4
|
+
import Varlet, { Snackbar } from '@varlet/ui'
|
|
5
|
+
import CodeExample from './components/code-example'
|
|
17
6
|
import { createApp } from 'vue'
|
|
18
7
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
19
8
|
import { get } from 'lodash-es'
|
|
20
9
|
|
|
10
|
+
import '@varlet/ui/es/style'
|
|
11
|
+
import '@varlet/touch-emulator'
|
|
12
|
+
|
|
21
13
|
const defaultLanguage = get(config, 'defaultLanguage')
|
|
22
14
|
const redirect = get(config, 'pc.redirect')
|
|
23
15
|
const mobileRedirect = get(config, 'mobile.redirect')
|
|
@@ -83,17 +75,8 @@ Object.defineProperty(window, 'scrollToMenu', {
|
|
|
83
75
|
})
|
|
84
76
|
|
|
85
77
|
createApp(App)
|
|
78
|
+
.use(Varlet)
|
|
86
79
|
.use(router)
|
|
87
80
|
// @ts-ignore
|
|
88
|
-
.use(Cell)
|
|
89
|
-
.use(Ripple)
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
.use(Icon)
|
|
92
|
-
// @ts-ignore
|
|
93
81
|
.use(CodeExample)
|
|
94
|
-
.use(Snackbar)
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
.use(Popup)
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
.use(Button)
|
|
99
82
|
.mount('#app')
|