@yl_lowcode/docs-theme 0.0.5 → 0.0.7
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/index.ts +1 -2
- package/layout.vue +72 -149
- package/package.json +1 -1
- package/styles/custom.css +0 -48
- package/styles/vars.css +0 -55
package/index.ts
CHANGED
package/layout.vue
CHANGED
|
@@ -3,7 +3,51 @@
|
|
|
3
3
|
import { useData } from "vitepress";
|
|
4
4
|
import DefaultTheme from "vitepress/theme";
|
|
5
5
|
import Playground from "./playground.vue";
|
|
6
|
-
import
|
|
6
|
+
import setTheme from "./color";
|
|
7
|
+
import { watch, nextTick, provide, onMounted } from "vue";
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import NiceDropdown from "./drop-down.vue";
|
|
10
|
+
|
|
11
|
+
const colorConfig = [
|
|
12
|
+
{
|
|
13
|
+
key: "blue",
|
|
14
|
+
label: "山药蓝",
|
|
15
|
+
color: "#197AFA",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "green",
|
|
19
|
+
label: "生机绿",
|
|
20
|
+
color: "#29CC97",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "orange",
|
|
24
|
+
label: "活力橙",
|
|
25
|
+
color: "#F75229",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "purple",
|
|
29
|
+
label: "科技紫",
|
|
30
|
+
color: "#6463D5",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "pink",
|
|
34
|
+
label: "魅力粉",
|
|
35
|
+
color: "#d84293",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "red",
|
|
39
|
+
label: "喜庆红",
|
|
40
|
+
color: "#eb4242",
|
|
41
|
+
},
|
|
42
|
+
].map((item: any) => {
|
|
43
|
+
return {
|
|
44
|
+
...item,
|
|
45
|
+
onClick: async () => {
|
|
46
|
+
localStorage?.setItem("color", item.key);
|
|
47
|
+
setTheme(isDark.value ? "dark" : "light", item.key);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
});
|
|
7
51
|
|
|
8
52
|
const { frontmatter, isDark } = useData();
|
|
9
53
|
|
|
@@ -40,6 +84,18 @@ provide("toggle-appearance", async ({ clientX: x, clientY: y }: MouseEvent) => {
|
|
|
40
84
|
}
|
|
41
85
|
);
|
|
42
86
|
});
|
|
87
|
+
|
|
88
|
+
onMounted(() => {
|
|
89
|
+
watch(isDark, async (dark) => {
|
|
90
|
+
setTheme(dark ? "dark" : "light", localStorage?.getItem("color") as any);
|
|
91
|
+
});
|
|
92
|
+
setTimeout(async () => {
|
|
93
|
+
setTheme(
|
|
94
|
+
isDark.value ? "dark" : "light",
|
|
95
|
+
localStorage?.getItem("color") as any
|
|
96
|
+
);
|
|
97
|
+
}, 800);
|
|
98
|
+
});
|
|
43
99
|
</script>
|
|
44
100
|
|
|
45
101
|
<template>
|
|
@@ -47,6 +103,21 @@ provide("toggle-appearance", async ({ clientX: x, clientY: y }: MouseEvent) => {
|
|
|
47
103
|
<DefaultTheme.Layout v-else>
|
|
48
104
|
<template #nav-bar-content-after>
|
|
49
105
|
<slot name="nav-bar-content-after" />
|
|
106
|
+
<NiceDropdown :options="colorConfig" width="90px">
|
|
107
|
+
<template #trigger>
|
|
108
|
+
<svg
|
|
109
|
+
viewBox="0 0 24 24"
|
|
110
|
+
width="16px"
|
|
111
|
+
height="16px"
|
|
112
|
+
fill="var(--soui-brand-6)"
|
|
113
|
+
style="margin-left: 20px"
|
|
114
|
+
>
|
|
115
|
+
<path
|
|
116
|
+
d="M8.36107 2.0003C8.55307 1.99563 8.74236 2.04634 8.9063 2.14639L13.4505 4.91945L18.472 3.15178C18.9929 2.96839 19.5639 3.24204 19.7473 3.76299C19.811 3.94415 19.8213 4.13984 19.7768 4.32667L18.5437 9.50539L21.7766 13.7348C22.112 14.1736 22.0282 14.8012 21.5894 15.1366C21.4368 15.2532 21.2538 15.3235 21.0624 15.3389L15.7561 15.7664L12.7327 20.1481C12.419 20.6026 11.7962 20.7169 11.3417 20.4032C11.1836 20.2941 11.0603 20.1418 10.9864 19.9645L9.20794 15.694L3.89851 21.0041C3.50799 21.3946 2.87482 21.3946 2.4843 21.0041C2.09378 20.6135 2.09378 19.9804 2.4843 19.5898L7.46294 14.61L3.83862 13.5286C3.30937 13.3708 3.00828 12.8138 3.16613 12.2845C3.22102 12.1005 3.32774 11.9361 3.47355 11.8111L7.51513 8.34624L7.38569 3.02432C7.37226 2.47219 7.80895 2.01372 8.36107 2.0003ZM9.52452 5.45242C9.47449 5.53441 9.44913 5.62908 9.45148 5.7251L9.53762 9.24671L6.86306 11.5395C6.65341 11.7192 6.62914 12.0348 6.80887 12.2445C6.87138 12.3174 6.95357 12.3708 7.04561 12.3982L10.4215 13.4048L11.775 16.6557C11.8811 16.9107 12.1738 17.0313 12.4288 16.9252C12.5174 16.8883 12.5935 16.8266 12.648 16.7476L14.6492 13.8492L18.1593 13.5657C18.4346 13.5435 18.6397 13.3023 18.6174 13.0271C18.6097 12.9314 18.5746 12.84 18.5163 12.7637L16.3782 9.96569L17.1935 6.5383C17.2574 6.26966 17.0914 6.00007 16.8228 5.93616C16.7294 5.91394 16.6315 5.91909 16.541 5.951L13.2191 7.12122L10.2118 5.28607C9.97606 5.14222 9.66836 5.21671 9.52452 5.45242Z"
|
|
117
|
+
/>
|
|
118
|
+
</svg>
|
|
119
|
+
</template>
|
|
120
|
+
</NiceDropdown>
|
|
50
121
|
</template>
|
|
51
122
|
<template #sidebar-nav-before>
|
|
52
123
|
<slot name="sidebar-nav-before" />
|
|
@@ -78,152 +149,4 @@ provide("toggle-appearance", async ({ clientX: x, clientY: y }: MouseEvent) => {
|
|
|
78
149
|
.VPSwitchAppearance .check {
|
|
79
150
|
transform: none !important;
|
|
80
151
|
}
|
|
81
|
-
|
|
82
|
-
/** 自定义样式 */
|
|
83
|
-
h3 {
|
|
84
|
-
margin-bottom: 16px !important;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
table {
|
|
88
|
-
display: table !important;
|
|
89
|
-
margin: 0 !important;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
a {
|
|
93
|
-
text-decoration: none !important;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.vp-doc li+li {
|
|
97
|
-
margin-top: 0 !important;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.vp-doc th,
|
|
101
|
-
.vp-doc td {
|
|
102
|
-
border: none;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.vp-doc ul,
|
|
106
|
-
.vp-doc ol {
|
|
107
|
-
padding-left: 0 !important;
|
|
108
|
-
margin: 0 !important;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.vp-doc blockquote {
|
|
112
|
-
border-left: 2px solid var(--primary-color);
|
|
113
|
-
padding-left: 10px;
|
|
114
|
-
color: var(--vp-c-text-1) !important;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
#api+table {
|
|
118
|
-
width: 100%;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
blockquote+table {
|
|
122
|
-
width: 100%;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
p.text {
|
|
126
|
-
margin-bottom: 1em;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
h2.text {
|
|
130
|
-
margin-top: 20px;
|
|
131
|
-
margin-bottom: 0.5em;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.VPDoc.has-aside .content-container {
|
|
135
|
-
max-width: 940px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.VPDoc .content {
|
|
139
|
-
min-width: 940px;
|
|
140
|
-
padding: 0;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.VPDoc .content .content-container {
|
|
144
|
-
max-width: 100% !important;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.VPDoc .prev-next {
|
|
148
|
-
padding-bottom: 40px !important;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.VPDocAside .content {
|
|
152
|
-
padding-left: 10px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.VPHomeHero .text {
|
|
156
|
-
margin-top: 12px !important;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
#VPContent.has-sidebar {
|
|
160
|
-
padding-right: 0;
|
|
161
|
-
padding-left: 260px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.VPSidebar {
|
|
165
|
-
padding-left: 60px !important;
|
|
166
|
-
width: 280px !important;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.VPNavBar.has-sidebar .container>.title {
|
|
170
|
-
padding-left: 60px !important;
|
|
171
|
-
width: 280px !important;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.VPNavBar.has-sidebar .content {
|
|
175
|
-
padding-left: 280px !important;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.VPNavBar.has-sidebar .divider {
|
|
179
|
-
padding-left: 300px !important;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.content-container {
|
|
183
|
-
margin-left: 30px !important;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.custom-block {
|
|
187
|
-
padding: 12px 30px !important;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.custom-block-title {
|
|
191
|
-
display: none;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.VPHomeHero .image-bg {
|
|
195
|
-
background-image: linear-gradient(-45deg, #646cffcc 50%, #ffd14785 50%);
|
|
196
|
-
filter: blur(68px);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.vp-doc tr:nth-child(2n) {
|
|
200
|
-
background-color: transparent;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.vp-doc h2 {
|
|
204
|
-
border-top: none;
|
|
205
|
-
margin: 10px;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
h2.text {
|
|
209
|
-
margin-top: 0;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
:root {
|
|
213
|
-
--soui-brand-6: #197afa;
|
|
214
|
-
--soui-font-14: 12px;
|
|
215
|
-
--soui-tabs-tab-font-size: 12px;
|
|
216
|
-
--soui-14-regular: 12px;
|
|
217
|
-
--vp-c-brand-1: var(--soui-brand-6);
|
|
218
|
-
--vp-c-brand-2: var(--soui-brand-6);
|
|
219
|
-
--vp-button-brand-bg: var(--soui-brand-6);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.VPNavBar.has-sidebar .content {
|
|
223
|
-
padding-right: 40px !important;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
h2 {
|
|
227
|
-
margin-left: 0 !important;
|
|
228
|
-
}
|
|
229
152
|
</style>
|
package/package.json
CHANGED
package/styles/custom.css
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* 覆盖 VitePress 默认变量,接入主题色 */
|
|
2
|
-
:root {
|
|
3
|
-
--vp-c-brand-1: var(--aui-accent);
|
|
4
|
-
--vp-c-brand-2: var(--aui-accent-light);
|
|
5
|
-
--vp-c-brand-3: var(--aui-accent-dark);
|
|
6
|
-
--vp-c-brand-soft: rgba(99, 102, 241, 0.1);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.dark .shiki span {
|
|
10
|
-
color: var(--shiki-dark, inherit);
|
|
11
|
-
font-size: 13px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
html:not(.dark) .shiki span {
|
|
15
|
-
color: var(--shiki-light, inherit);
|
|
16
|
-
font-size: 13px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.vp-doc .language-tsx {
|
|
20
|
-
margin: 0 !important;
|
|
21
|
-
border-radius: 0 !important;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.vp-doc .shiki-themes {
|
|
25
|
-
padding: 10px 0 !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.vp-doc img {
|
|
29
|
-
margin: 0 !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/* demo 代码展示区:复用 VitePress 代码块,隐藏多余 UI */
|
|
33
|
-
.aui-demo-code .language-tsx {
|
|
34
|
-
margin: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.aui-demo-code .copy,
|
|
38
|
-
.aui-demo-code .lang {
|
|
39
|
-
display: none !important;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.aui-demo-code pre.shiki {
|
|
43
|
-
margin: 0;
|
|
44
|
-
padding: 20px 24px;
|
|
45
|
-
font-size: 13px;
|
|
46
|
-
line-height: 1.7;
|
|
47
|
-
border-radius: 0;
|
|
48
|
-
}
|
package/styles/vars.css
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/* 文档主题 CSS 变量 */
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
/* 高亮色(可动态修改) */
|
|
5
|
-
--aui-accent: #197afa;
|
|
6
|
-
--aui-accent-light: #3891fb;
|
|
7
|
-
--aui-accent-dark: #0563da;
|
|
8
|
-
--aui-accent-bg: rgba(25, 122, 250, 0.1);
|
|
9
|
-
|
|
10
|
-
/* 亮色主题 */
|
|
11
|
-
--aui-bg: #ffffff;
|
|
12
|
-
--aui-bg-soft: #f6f6f7;
|
|
13
|
-
--aui-bg-mute: #ebebed;
|
|
14
|
-
--aui-border: #e2e2e3;
|
|
15
|
-
--aui-text: #213547;
|
|
16
|
-
--aui-text-2: #4a5270;
|
|
17
|
-
--aui-text-3: #8b8b8f;
|
|
18
|
-
|
|
19
|
-
/* 组件尺寸 */
|
|
20
|
-
--aui-radius-sm: 4px;
|
|
21
|
-
--aui-radius: 6px;
|
|
22
|
-
--aui-radius-lg: 10px;
|
|
23
|
-
|
|
24
|
-
/* 间距 */
|
|
25
|
-
--aui-space-1: 4px;
|
|
26
|
-
--aui-space-2: 8px;
|
|
27
|
-
--aui-space-3: 12px;
|
|
28
|
-
--aui-space-4: 16px;
|
|
29
|
-
|
|
30
|
-
/* 字体 */
|
|
31
|
-
--aui-font-sm: 13px;
|
|
32
|
-
--aui-font-base: 14px;
|
|
33
|
-
--aui-font-lg: 16px;
|
|
34
|
-
|
|
35
|
-
/* 阴影 */
|
|
36
|
-
--aui-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
|
37
|
-
--aui-shadow-md:
|
|
38
|
-
0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
39
|
-
--aui-shadow-focus: 0 0 0 3px rgba(25, 122, 250, 0.3);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.dark {
|
|
43
|
-
--aui-bg: #0c0e13;
|
|
44
|
-
--aui-bg-soft: #161b27;
|
|
45
|
-
--aui-bg-mute: #1e2536;
|
|
46
|
-
--aui-border: #2a3147;
|
|
47
|
-
--aui-text: #e8ecf8;
|
|
48
|
-
--aui-text-2: #9ba8c9;
|
|
49
|
-
--aui-text-3: #5a6480;
|
|
50
|
-
--aui-accent-bg: rgba(25, 122, 250, 0.18);
|
|
51
|
-
--aui-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
|
|
52
|
-
--aui-shadow-md:
|
|
53
|
-
0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
|
|
54
|
-
--aui-shadow-focus: 0 0 0 3px rgba(25, 122, 250, 0.4);
|
|
55
|
-
}
|