koa3-cli 1.0.8 → 1.1.0

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.
@@ -0,0 +1,323 @@
1
+ /* ============================================
2
+ Koa3 CLI 文档样式文件
3
+ 修改此文件来调整文档的外观样式
4
+ ============================================ */
5
+
6
+ * {
7
+ margin: 0;
8
+ padding: 0;
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
14
+ font-size: 16px;
15
+ line-height: 1.6;
16
+ color: #2c3e50;
17
+ background: #fff;
18
+ }
19
+
20
+ /* 顶部导航栏 */
21
+ .navbar {
22
+ position: fixed;
23
+ top: 0;
24
+ left: 0;
25
+ right: 0;
26
+ height: 3.6rem;
27
+ background: #fff;
28
+ border-bottom: 1px solid #eaecef;
29
+ z-index: 1000;
30
+ display: flex;
31
+ align-items: center;
32
+ padding: 0 1.5rem;
33
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
34
+ }
35
+
36
+ .navbar-brand {
37
+ font-size: 1.5rem;
38
+ font-weight: 600;
39
+ color: #3eaf7c;
40
+ text-decoration: none;
41
+ }
42
+
43
+ /* 侧边栏 */
44
+ .sidebar {
45
+ position: fixed;
46
+ top: 3.6rem;
47
+ left: 0;
48
+ bottom: 0;
49
+ width: 20rem;
50
+ background: #fff;
51
+ border-right: 1px solid #eaecef;
52
+ overflow-y: auto;
53
+ padding: 1.5rem 0;
54
+ z-index: 100;
55
+ }
56
+
57
+ .sidebar-group {
58
+ margin-bottom: 1.5rem;
59
+ }
60
+
61
+ .sidebar-group-title {
62
+ padding: 0 1.5rem;
63
+ font-size: 0.75rem;
64
+ font-weight: 600;
65
+ color: #999;
66
+ text-transform: uppercase;
67
+ letter-spacing: 0.05em;
68
+ margin-bottom: 0.5rem;
69
+ }
70
+
71
+ .sidebar-link {
72
+ display: block;
73
+ padding: 0.35rem 1.5rem;
74
+ color: #2c3e50;
75
+ text-decoration: none;
76
+ font-size: 0.95rem;
77
+ transition: color 0.15s;
78
+ border-left: 3px solid transparent;
79
+ }
80
+
81
+ .sidebar-link:hover {
82
+ color: #3eaf7c;
83
+ }
84
+
85
+ .sidebar-link.active {
86
+ color: #3eaf7c;
87
+ border-left-color: #3eaf7c;
88
+ font-weight: 600;
89
+ }
90
+
91
+ /* 主内容区 */
92
+ .main {
93
+ margin-left: 20rem;
94
+ margin-top: 3.6rem;
95
+ padding: 2rem;
96
+ min-height: calc(100vh - 3.6rem);
97
+ }
98
+
99
+ .content {
100
+ max-width: 740px;
101
+ margin: 0 auto;
102
+ }
103
+
104
+ /* 首页样式 */
105
+ .home {
106
+ text-align: center;
107
+ padding: 1rem 0;
108
+ }
109
+
110
+ .hero {
111
+ margin-bottom: 3rem;
112
+ }
113
+
114
+ .hero h1 {
115
+ font-size: 3rem;
116
+ font-weight: 700;
117
+ margin-bottom: 1rem;
118
+ color: #2c3e50;
119
+ }
120
+
121
+ .hero p {
122
+ font-size: 1.5rem;
123
+ color: #666;
124
+ margin-bottom: 2rem;
125
+ }
126
+
127
+ .hero p.info-text {
128
+ font-size: 1rem;
129
+ color: #666;
130
+ }
131
+
132
+ .action-button {
133
+ display: inline-block;
134
+ padding: 0.8rem 2rem;
135
+ background: #3eaf7c;
136
+ color: #fff;
137
+ text-decoration: none;
138
+ border-radius: 4px;
139
+ font-size: 1.1rem;
140
+ font-weight: 500;
141
+ transition: background 0.3s;
142
+ }
143
+
144
+ .action-button:hover {
145
+ background: #2d8f5f;
146
+ }
147
+
148
+ .features {
149
+ display: grid;
150
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
151
+ gap: 2rem;
152
+ margin-top: 4rem;
153
+ }
154
+
155
+ .feature {
156
+ text-align: left;
157
+ }
158
+
159
+ .feature h3 {
160
+ font-size: 1.2rem;
161
+ margin-bottom: 0.5rem;
162
+ color: #2c3e50;
163
+ }
164
+
165
+ .feature p {
166
+ color: #666;
167
+ font-size: 0.95rem;
168
+ }
169
+
170
+ /* 文档内容样式 */
171
+ h1 {
172
+ font-size: 2.5rem;
173
+ font-weight: 600;
174
+ margin-bottom: 1rem;
175
+ padding-bottom: 0.5rem;
176
+ border-bottom: 2px solid #eaecef;
177
+ }
178
+
179
+ h2 {
180
+ font-size: 1.75rem;
181
+ font-weight: 600;
182
+ margin-top: 2rem;
183
+ margin-bottom: 1rem;
184
+ padding-bottom: 0.5rem;
185
+ border-bottom: 1px solid #eaecef;
186
+ }
187
+
188
+ h3 {
189
+ font-size: 1.35rem;
190
+ font-weight: 600;
191
+ margin-top: 1.5rem;
192
+ margin-bottom: 0.75rem;
193
+ }
194
+
195
+ h4 {
196
+ font-size: 1.1rem;
197
+ font-weight: 600;
198
+ margin-top: 1.25rem;
199
+ margin-bottom: 0.5rem;
200
+ }
201
+
202
+ p {
203
+ margin-bottom: 1rem;
204
+ }
205
+
206
+ ul,
207
+ ol {
208
+ margin-bottom: 1rem;
209
+ padding-left: 2rem;
210
+ }
211
+
212
+ li {
213
+ margin-bottom: 0.5rem;
214
+ }
215
+
216
+ code {
217
+ background: #f4f4f4;
218
+ padding: 0.2rem 0.4rem;
219
+ border-radius: 3px;
220
+ font-size: 0.9em;
221
+ color: #e83e8c;
222
+ font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
223
+ }
224
+
225
+ pre {
226
+ background: #282c34;
227
+ padding: 1.25rem;
228
+ border-radius: 6px;
229
+ overflow-x: auto;
230
+ margin-bottom: 1.5rem;
231
+ }
232
+
233
+ pre code {
234
+ background: transparent;
235
+ padding: 0;
236
+ color: #abb2bf;
237
+ font-size: 0.9rem;
238
+ }
239
+
240
+ blockquote {
241
+ border-left: 4px solid #3eaf7c;
242
+ padding-left: 1rem;
243
+ margin: 1rem 0;
244
+ color: #666;
245
+ }
246
+
247
+ table {
248
+ width: 100%;
249
+ border-collapse: collapse;
250
+ margin: 1rem 0;
251
+ }
252
+
253
+ th,
254
+ td {
255
+ border: 1px solid #eaecef;
256
+ padding: 0.75rem;
257
+ text-align: left;
258
+ }
259
+
260
+ th {
261
+ background: #f6f8fa;
262
+ font-weight: 600;
263
+ }
264
+
265
+ a {
266
+ color: #3eaf7c;
267
+ text-decoration: none;
268
+ }
269
+
270
+ a:hover {
271
+ text-decoration: underline;
272
+ }
273
+
274
+ /* 响应式 */
275
+ @media (max-width: 959px) {
276
+ .sidebar {
277
+ transform: translateX(-100%);
278
+ transition: transform 0.3s;
279
+ }
280
+
281
+ .sidebar.open {
282
+ transform: translateX(0);
283
+ }
284
+
285
+ .main {
286
+ margin-left: 0;
287
+ }
288
+
289
+ .navbar {
290
+ padding-left: 3.5rem;
291
+ }
292
+
293
+ .menu-toggle {
294
+ position: fixed;
295
+ left: 1rem;
296
+ top: 1rem;
297
+ z-index: 1001;
298
+ background: none;
299
+ border: none;
300
+ font-size: 1.5rem;
301
+ cursor: pointer;
302
+ color: #2c3e50;
303
+ }
304
+ }
305
+
306
+ .menu-toggle {
307
+ display: none;
308
+ }
309
+
310
+ @media (max-width: 959px) {
311
+ .menu-toggle {
312
+ display: block;
313
+ }
314
+ }
315
+
316
+ /* 隐藏内容 */
317
+ .content-section {
318
+ display: none;
319
+ }
320
+
321
+ .content-section.active {
322
+ display: block;
323
+ }
@@ -0,0 +1,78 @@
1
+ /* ============================================
2
+ Koa3 CLI 文档 JavaScript 逻辑文件
3
+ 修改此文件来调整文档的交互行为
4
+ ============================================ */
5
+
6
+ /**
7
+ * 显示指定的内容区域
8
+ * @param {string} id - 内容区域的 ID
9
+ */
10
+ function showContent(id) {
11
+ // 隐藏所有内容
12
+ document.querySelectorAll('.content-section').forEach(section => {
13
+ section.classList.remove('active');
14
+ });
15
+
16
+ // 显示选中的内容
17
+ const target = document.getElementById(id);
18
+ if (target) {
19
+ target.classList.add('active');
20
+ }
21
+
22
+ // 更新侧边栏活动状态
23
+ document.querySelectorAll('.sidebar-link').forEach(link => {
24
+ link.classList.remove('active');
25
+ });
26
+ if (event && event.target) {
27
+ event.target.classList.add('active');
28
+ }
29
+
30
+ // 滚动到顶部
31
+ window.scrollTo(0, 0);
32
+
33
+ // 移动端关闭侧边栏
34
+ if (window.innerWidth <= 959) {
35
+ document.getElementById('sidebar').classList.remove('open');
36
+ }
37
+ }
38
+
39
+ /**
40
+ * 显示首页
41
+ */
42
+ function showHome() {
43
+ showContent('home');
44
+ const firstLink = document.querySelectorAll('.sidebar-link')[0];
45
+ if (firstLink) {
46
+ firstLink.classList.add('active');
47
+ }
48
+ }
49
+
50
+ /**
51
+ * 切换侧边栏显示/隐藏(移动端)
52
+ */
53
+ function toggleSidebar() {
54
+ document.getElementById('sidebar').classList.toggle('open');
55
+ }
56
+
57
+ // 页面加载完成后初始化
58
+ document.addEventListener('DOMContentLoaded', function() {
59
+ // 点击外部关闭侧边栏(移动端)
60
+ document.addEventListener('click', function(e) {
61
+ const sidebar = document.getElementById('sidebar');
62
+ const menuToggle = document.querySelector('.menu-toggle');
63
+
64
+ if (window.innerWidth <= 959 &&
65
+ sidebar &&
66
+ sidebar.classList.contains('open') &&
67
+ !sidebar.contains(e.target) &&
68
+ menuToggle &&
69
+ !menuToggle.contains(e.target)) {
70
+ sidebar.classList.remove('open');
71
+ }
72
+ });
73
+
74
+ // 初始化 Prism 代码高亮
75
+ if (typeof Prism !== 'undefined' && Prism.plugins && Prism.plugins.autoloader) {
76
+ Prism.plugins.autoloader.languages_path = 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/';
77
+ }
78
+ });
package/public/index.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <!-- Prism.js 代码高亮 -->
8
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
9
9
  <!-- 文档样式文件 - 修改 docs.css 来调整样式 -->
10
- <link rel="stylesheet" href="/docs/docs.css">
10
+ <link rel="stylesheet" href="./docs/docs.css">
11
11
  </head>
12
12
  <body>
13
13
  <!-- 顶部导航栏 -->
@@ -235,6 +235,10 @@ PORT=3000
235
235
  # 应用密钥(多个密钥用逗号分隔)
236
236
  KEYS=your-secret-key-1,your-secret-key-2
237
237
 
238
+ # 跨域配置
239
+ CORS_ENABLE=false
240
+ CORS_ORIGIN=*
241
+
238
242
  # 数据库配置
239
243
  DB_HOST=localhost
240
244
  DB_PORT=3306
@@ -712,9 +716,9 @@ Content-Type: application/json</code></pre>
712
716
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
713
717
 
714
718
  <!-- 文档内容配置 - 修改 docs-content.js 来更新导航菜单 -->
715
- <script src="/docs/docs-content.js"></script>
719
+ <script src="./docs/docs-content.js"></script>
716
720
 
717
721
  <!-- 文档逻辑文件 - 修改 docs.js 来调整交互行为 -->
718
- <script src="/docs/docs.js"></script>
722
+ <script src="./docs/docs.js"></script>
719
723
  </body>
720
724
  </html>