@oipage/cli 0.3.0 → 1.0.0-alpha.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.
Files changed (92) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +76 -47
  4. package/LICENSE +20 -20
  5. package/README.md +204 -132
  6. package/bin/WebSocket/decodeWsFrame.js +43 -43
  7. package/bin/WebSocket/encodeWsFrame.js +28 -28
  8. package/bin/WebSocket/headersToJSON.js +26 -26
  9. package/bin/WebSocket/index.js +106 -106
  10. package/bin/data/mineTypes.json +108 -104
  11. package/bin/disk.js +42 -42
  12. package/bin/help.js +63 -55
  13. package/bin/intercept.js +15 -15
  14. package/bin/network.js +21 -21
  15. package/bin/notebook/data.js +185 -0
  16. package/bin/notebook/index.js +168 -9
  17. package/bin/proxy.js +82 -82
  18. package/bin/run +146 -146
  19. package/bin/serve.js +455 -318
  20. package/bin/template/404.html +184 -184
  21. package/bin/tools/deleteEmptyFolder.js +33 -33
  22. package/bin/tools/format.js +75 -75
  23. package/bin/tools/isBinary.js +83 -83
  24. package/bin/tools/moduleForm.js +548 -0
  25. package/bin/tools/network.js +42 -42
  26. package/bin/tools/openBrowser.js +34 -34
  27. package/bin/tools/resolve404.js +98 -98
  28. package/bin/tools/resolveImport.js +278 -97
  29. package/bin/tools/resolvePackage.js +412 -0
  30. package/bin/website-htmls/components/ui-select-file/index.html +8 -8
  31. package/bin/website-htmls/components/ui-select-file/index.js +42 -42
  32. package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
  33. package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
  34. package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
  35. package/bin/website-htmls/dialogs/imageSize/index.scss +140 -140
  36. package/bin/website-htmls/dialogs/index.js +52 -52
  37. package/bin/website-htmls/images/addFile.svg +1 -1
  38. package/bin/website-htmls/images/img-to-pdf.svg +1 -1
  39. package/bin/website-htmls/index.html +17 -17
  40. package/bin/website-htmls/main.js +13 -13
  41. package/bin/website-htmls/pages/App/index.html +6 -6
  42. package/bin/website-htmls/pages/App/index.js +22 -22
  43. package/bin/website-htmls/pages/App/index.scss +43 -43
  44. package/bin/website-htmls/pages/appStore/index.html +7 -7
  45. package/bin/website-htmls/pages/appStore/index.js +19 -19
  46. package/bin/website-htmls/pages/appStore/index.scss +54 -54
  47. package/bin/website-htmls/pages/chart/index.html +8 -8
  48. package/bin/website-htmls/pages/chart/index.js +72 -72
  49. package/bin/website-htmls/pages/chart/index.scss +71 -71
  50. package/bin/website-htmls/pages/home/index.html +19 -19
  51. package/bin/website-htmls/pages/home/index.js +19 -19
  52. package/bin/website-htmls/pages/home/index.scss +87 -87
  53. package/bin/website-htmls/pages/image-editor/index.html +27 -27
  54. package/bin/website-htmls/pages/image-editor/index.js +106 -106
  55. package/bin/website-htmls/pages/image-editor/index.scss +69 -69
  56. package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
  57. package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
  58. package/bin/website-htmls/pages/img-to-pdf/index.scss +9 -9
  59. package/bin/website-htmls/pages/recorder-screen/index.html +15 -15
  60. package/bin/website-htmls/pages/recorder-screen/index.js +227 -227
  61. package/bin/website-htmls/pages/recorder-screen/index.scss +52 -52
  62. package/bin/website-htmls/router.config.js +29 -29
  63. package/bin/website-htmls/styles/common.css +44 -44
  64. package/bin/website-htmls/styles/normalize.css +94 -94
  65. package/bin/website-plugins/intercept/chart.js +33 -33
  66. package/bin/website-plugins/intercept/getPackage.js +17 -17
  67. package/bin/website-plugins/intercept/head.js +8 -8
  68. package/bin/website-plugins/intercept/index.js +4 -8
  69. package/bin/website-plugins/loader/index.js +11 -11
  70. package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
  71. package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
  72. package/docs/css/base.css +122 -0
  73. package/docs/css/components.css +180 -0
  74. package/docs/css/layout.css +295 -0
  75. package/docs/css/responsive.css +49 -0
  76. package/docs/images/file-list.webp +0 -0
  77. package/docs/images/logo-topbar.svg +5 -0
  78. package/docs/images/logo.png +0 -0
  79. package/docs/images/logo.svg +6 -0
  80. package/docs/images/manual.webp +0 -0
  81. package/docs/images/terminal-serve.webp +0 -0
  82. package/docs/index.html +1392 -0
  83. package/docs/js/copy.js +37 -0
  84. package/docs/js/nav.js +111 -0
  85. package/docs/js/search.js +241 -0
  86. package/docs/js/theme.js +17 -0
  87. package/package.json +42 -42
  88. package/src/index.js +26 -29
  89. package/types/serve.d.ts +83 -83
  90. package/bin/website-plugins/intercept/oipage-vislite-intercept.js +0 -56
  91. package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +0 -37
  92. package/docs/config.md +0 -107
@@ -0,0 +1,295 @@
1
+ /* ============================================================
2
+ @oipage/cli 参考手册 · 顶栏、标签栏、骨架、目录树、正文容器、首页
3
+ 顶栏与标签栏吸顶,侧栏在它们下方吸顶;1080px 以下侧栏收起,见 responsive.css。
4
+ ============================================================ */
5
+
6
+ /* ---------- 顶栏 ---------- */
7
+ .topbar {
8
+ position: sticky; top: 0; z-index: 50;
9
+ height: var(--topbar-h);
10
+ background: var(--topbar);
11
+ color: var(--topbar-text);
12
+ border-bottom: 1px solid rgba(0, 0, 0, .18);
13
+ }
14
+ .topbar-inner {
15
+ max-width: 1440px; height: 100%; margin: 0 auto;
16
+ padding: 0 22px 0 26px;
17
+ display: flex; align-items: center; gap: 24px;
18
+ }
19
+ .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--topbar-text); flex: 0 0 auto; }
20
+ .brand .mark { width: 28px; height: 28px; border-radius: 6px; display: block; }
21
+ .brand .name { font-size: 19px; font-weight: 600; letter-spacing: .2px; }
22
+ .brand .name b { font-weight: 400; color: var(--topbar-dim); }
23
+
24
+ .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; min-width: 0; }
25
+ .topnav { display: flex; align-items: center; gap: 22px; }
26
+ .topnav a {
27
+ color: var(--topbar-dim); text-decoration: none;
28
+ font-size: 14.5px; white-space: nowrap;
29
+ transition: color .15s;
30
+ }
31
+ .topnav a:hover { color: #fff; }
32
+
33
+ .theme {
34
+ display: grid; place-items: center; padding: 0;
35
+ width: 30px; height: 30px; flex: 0 0 30px;
36
+ border: 1px solid var(--topbar-line); border-radius: 7px;
37
+ background: transparent; color: var(--topbar-dim); cursor: pointer;
38
+ transition: color .15s, border-color .15s;
39
+ }
40
+ .theme:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }
41
+ .theme:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
42
+ .theme svg { width: 15px; height: 15px; display: block; }
43
+ .theme .i-moon { display: none; }
44
+ html[data-theme="dark"] .theme .i-sun { display: none; }
45
+ html[data-theme="dark"] .theme .i-moon { display: block; }
46
+
47
+ /* ---------- 搜索框 ---------- */
48
+ .search {
49
+ position: relative; flex: 0 1 260px; min-width: 170px;
50
+ display: flex; align-items: center; gap: 8px;
51
+ height: 36px; padding: 0 10px;
52
+ border-radius: 6px;
53
+ background: rgba(255, 255, 255, .10);
54
+ border: 1px solid var(--topbar-line);
55
+ color: var(--topbar-dim);
56
+ }
57
+ .search svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .8; }
58
+ .search input {
59
+ flex: 1 1 auto; min-width: 0;
60
+ border: 0; outline: 0; background: transparent;
61
+ color: #fff; font-size: 13px; letter-spacing: .2px;
62
+ }
63
+ .search input::placeholder { color: rgba(255, 255, 255, .55); }
64
+ .search kbd {
65
+ flex: 0 0 auto; padding: 0 4px;
66
+ font-family: inherit; font-size: 11px; line-height: 18px;
67
+ color: rgba(255, 255, 255, .7);
68
+ border: 1px solid rgba(255, 255, 255, .22); border-radius: 3px;
69
+ }
70
+
71
+ /* 搜索结果面板 */
72
+ .search-pop {
73
+ position: absolute; top: calc(100% + 8px); right: 0; left: auto;
74
+ width: 340px; max-height: 342px; overflow-y: auto;
75
+ padding: 6px;
76
+ background: var(--panel);
77
+ border: 1px solid var(--line-strong); border-radius: 8px;
78
+ box-shadow: 0 10px 30px rgba(16, 32, 43, .16);
79
+ z-index: 60;
80
+ }
81
+ html[data-theme="dark"] .search-pop { box-shadow: 0 14px 34px rgba(0, 0, 0, .5); }
82
+ .search-pop[hidden] { display: none; }
83
+ .q-item {
84
+ display: block;
85
+ width: 100%; padding: 8px 10px;
86
+ font-family: inherit; text-align: left;
87
+ background: transparent; border: 0; border-radius: 5px;
88
+ cursor: pointer; color: var(--text);
89
+ }
90
+ .q-item:hover, .q-item.on { background: var(--accent-soft); }
91
+ .q-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
92
+ .q-item .q-t { font-size: 13.5px; line-height: 1.5; color: var(--text); }
93
+ .q-item .q-g { flex: 0 0 auto; font-size: 11.5px; color: var(--faint); }
94
+ .q-item .q-s { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.7; color: var(--faint); }
95
+ .q-item mark { background: rgba(26, 111, 212, .16); color: var(--ink); border-radius: 2px; padding: 0 1px; }
96
+ html[data-theme="dark"] .q-item mark { background: rgba(90, 169, 255, .22); color: #fff; }
97
+ .q-empty { padding: 10px 12px 12px; font-size: 12.5px; color: var(--faint); }
98
+ .q-hint { padding: 6px 12px 10px; font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--rule); margin-top: 4px; }
99
+
100
+ /* ---------- 标签栏 ---------- */
101
+ .tabs {
102
+ position: sticky; top: var(--topbar-h); z-index: 45;
103
+ height: var(--tabs-h);
104
+ background: var(--page);
105
+ border-bottom: 1px solid var(--line);
106
+ }
107
+ .tabs-inner {
108
+ max-width: 1440px; height: 100%; margin: 0 auto;
109
+ padding: 0 26px;
110
+ display: flex; align-items: center; justify-content: flex-end; gap: 30px;
111
+ }
112
+ .tabs a {
113
+ display: flex; align-items: center; height: 100%;
114
+ color: var(--accent); text-decoration: none;
115
+ font-size: 15px; white-space: nowrap;
116
+ border-bottom: 2px solid transparent;
117
+ }
118
+ .tabs a:hover { border-bottom-color: var(--accent-line); }
119
+ .tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
120
+
121
+ /* ---------- 骨架 ---------- */
122
+ .shell {
123
+ display: grid;
124
+ grid-template-columns: var(--sidebar) minmax(0, 1fr);
125
+ max-width: 1440px;
126
+ margin: 0 auto;
127
+ }
128
+
129
+ /* ---------- 侧栏 ---------- */
130
+ .side {
131
+ position: sticky; top: calc(var(--topbar-h) + var(--tabs-h));
132
+ align-self: start;
133
+ height: calc(100vh - var(--topbar-h) - var(--tabs-h));
134
+ padding: 22px 20px 22px 26px;
135
+ border-right: 1px solid var(--line);
136
+ background: var(--panel);
137
+ overflow-y: auto; min-width: 0;
138
+ }
139
+ .side-head {
140
+ display: flex; align-items: center; justify-content: space-between;
141
+ padding: 0 4px 10px;
142
+ border-bottom: 1px solid var(--rule);
143
+ }
144
+ .side-head span {
145
+ font-size: 12px; letter-spacing: 1px; color: var(--faint);
146
+ text-transform: uppercase;
147
+ }
148
+ .side-head .print {
149
+ font-size: 12px; color: var(--muted); text-decoration: none;
150
+ border-bottom: 1px dotted var(--line-strong);
151
+ }
152
+ .side-head .print:hover { color: var(--accent); border-color: var(--accent); }
153
+
154
+ /* ---------- 目录树 ---------- */
155
+ .tree { margin-top: 12px; }
156
+ .tree-root { list-style: none; margin: 0; padding: 0; }
157
+ .tree-single > a,
158
+ .tree-cap {
159
+ display: flex; align-items: center; gap: 8px;
160
+ width: 100%; padding: 5px 6px;
161
+ border: 0; background: transparent;
162
+ color: var(--text); font-size: 14.5px; font-weight: 600; text-align: left;
163
+ text-decoration: none; cursor: pointer;
164
+ border-radius: 5px;
165
+ }
166
+ .tree-single > a:hover,
167
+ .tree-cap:hover { background: var(--surface-2); }
168
+ .tree-cap:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
169
+ .tree-cap .caret {
170
+ flex: 0 0 12px; width: 12px; height: 12px;
171
+ display: grid; place-items: center;
172
+ color: var(--muted);
173
+ transform: rotate(0deg); transition: transform .18s;
174
+ }
175
+ .tree-cap .caret::before {
176
+ content: "";
177
+ width: 0; height: 0;
178
+ border-left: 5px solid currentColor;
179
+ border-top: 4px solid transparent;
180
+ border-bottom: 4px solid transparent;
181
+ }
182
+ .tree-sec.open .tree-cap .caret { transform: rotate(90deg); }
183
+
184
+ .tree-list {
185
+ list-style: none; margin: 2px 0 6px 10px; padding: 0 0 0 12px;
186
+ border-left: 1px solid var(--line);
187
+ }
188
+ .tree-sec:not(.open) .tree-list { display: none; }
189
+ .tree-list li { position: relative; }
190
+ .tree-list li::before {
191
+ content: ""; position: absolute; left: -12px; top: 16px;
192
+ width: 8px; height: 1px; background: var(--line);
193
+ }
194
+ .tree-list a {
195
+ display: block; padding: 3px 8px;
196
+ color: var(--text-dim); text-decoration: none;
197
+ font-size: 14px; line-height: 1.75; border-radius: 5px;
198
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
199
+ }
200
+ .tree-list a:hover { color: var(--text); background: var(--surface-2); }
201
+ .tree-list a.on { color: var(--accent); background: var(--accent-soft); }
202
+
203
+ .side .foot {
204
+ margin-top: 22px; padding-top: 16px;
205
+ border-top: 1px solid var(--rule);
206
+ font-size: 12px; color: var(--faint); line-height: 1.8;
207
+ }
208
+ .side .foot a { color: var(--text-dim); text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
209
+ .side .foot a:hover { color: var(--accent); }
210
+
211
+ /* ---------- 正文 ---------- */
212
+ .main { min-width: 0; padding: 0 0 96px; }
213
+ .inner { max-width: 1020px; margin: 0 auto; padding: 0 56px; }
214
+
215
+ /* ---------- 首页 ---------- */
216
+ .welcome { padding: 56px 0 8px; }
217
+ .welcome .kicker {
218
+ display: inline-flex; align-items: center; gap: 10px;
219
+ padding: 2px 10px;
220
+ font-size: 12px; letter-spacing: .4px; color: var(--muted);
221
+ background: var(--surface-2); border-radius: 999px;
222
+ }
223
+ .welcome h1 {
224
+ margin: 18px 0 0;
225
+ font-size: clamp(34px, 3.6vw, 46px);
226
+ line-height: 1.45; font-weight: 600; letter-spacing: .5px;
227
+ color: var(--ink);
228
+ }
229
+ .welcome h1 span { color: var(--accent); }
230
+ .welcome .lede {
231
+ margin: 14px 0 0; max-width: 40em;
232
+ font-size: 18px; color: var(--text-dim);
233
+ }
234
+ .welcome .lede code,
235
+ .sec-lede code, .prose code, .note code, .field .d code, .lede code, .chips code {
236
+ font-size: .9em; color: var(--text);
237
+ background: var(--surface-3);
238
+ padding: 1px 6px; border-radius: 4px;
239
+ }
240
+
241
+ /* ---------- 首页示意图 ---------- */
242
+ .diagram {
243
+ margin: 34px 0 0;
244
+ padding: 26px 18px 8px;
245
+ border: 1px solid var(--line);
246
+ border-radius: 10px;
247
+ background: var(--surface);
248
+ overflow: hidden;
249
+ }
250
+ .diagram svg { display: block; width: 100%; height: auto; }
251
+ .diagram .cap-row {
252
+ display: flex; justify-content: space-between;
253
+ padding: 6px 6% 12px;
254
+ font-size: 12.5px; color: var(--muted);
255
+ }
256
+
257
+ /* ---------- 首页命令卡 ---------- */
258
+ .cards {
259
+ margin: 26px 0 0;
260
+ display: grid;
261
+ grid-template-columns: repeat(5, minmax(0, 1fr));
262
+ gap: 12px;
263
+ }
264
+ .card {
265
+ display: block; padding: 14px 16px 16px;
266
+ border: 1px solid var(--line); border-radius: 8px;
267
+ background: var(--panel); text-decoration: none;
268
+ transition: border-color .15s, box-shadow .15s, transform .15s;
269
+ }
270
+ .card:hover {
271
+ border-color: var(--accent-line);
272
+ box-shadow: 0 4px 14px rgba(26, 111, 212, .10);
273
+ transform: translateY(-1px);
274
+ }
275
+ .card .name {
276
+ font-family: "SFMono-Regular", Menlo, Consolas, monospace;
277
+ font-size: 14px; font-weight: 600; color: var(--accent);
278
+ }
279
+ .card .desc { margin-top: 4px; font-size: 13px; line-height: 1.7; color: var(--text-dim); }
280
+
281
+ /* ---------- 概览数字 ---------- */
282
+ .facts {
283
+ margin: 30px 0 0;
284
+ display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
285
+ border: 1px solid var(--line); border-radius: 8px;
286
+ background: var(--panel);
287
+ overflow: hidden;
288
+ }
289
+ .facts > div { padding: 14px 18px; min-width: 0; }
290
+ .facts > div + div { border-left: 1px solid var(--line); }
291
+ .facts .k { font-size: 12px; color: var(--muted); }
292
+ .facts .v {
293
+ margin-top: 2px; font-size: 14px; color: var(--text);
294
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
295
+ }
@@ -0,0 +1,49 @@
1
+ /* ============================================================
2
+ @oipage/cli 参考手册 · 响应式断点
3
+ 1240px 收窄间距,1080px 侧栏改为块状目录,720px 进一步压缩。
4
+ 放最后,用来覆盖前面各文件的规则。
5
+ ============================================================ */
6
+
7
+ @media (max-width: 1240px) {
8
+ .topnav { gap: 16px; }
9
+ .topnav a:nth-child(n+3) { display: none; }
10
+ .search { flex-basis: 210px; }
11
+ .inner { padding: 0 36px; }
12
+ }
13
+
14
+ @media (max-width: 1080px) {
15
+ .shell { grid-template-columns: minmax(0, 1fr); }
16
+ .side {
17
+ position: static; height: auto; overflow: visible;
18
+ border-right: 0; border-bottom: 1px solid var(--line);
19
+ padding: 18px 24px 16px;
20
+ }
21
+ .side-head { display: none; }
22
+ .tree { margin-top: 0; }
23
+ .tree-root { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
24
+ .tree-list { margin-left: 8px; padding-left: 12px; }
25
+ .side .foot { display: none; }
26
+ .inner { padding: 0 28px; }
27
+ .welcome { padding-top: 40px; }
28
+ .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
29
+ .tabs-inner { padding: 0 24px; gap: 22px; justify-content: flex-start; }
30
+ .tabs a { font-size: 14.5px; }
31
+ }
32
+
33
+ @media (max-width: 720px) {
34
+ :root { --topbar-h: 56px; --tabs-h: 42px; }
35
+ .topnav, .search kbd, .search { display: none; }
36
+ .brand .name { font-size: 17px; }
37
+ .tabs-inner { gap: 18px; padding: 0 18px; overflow-x: auto; }
38
+ .inner { padding: 0 18px; }
39
+ .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
40
+ .facts > div:nth-child(3) { border-left: 0; }
41
+ .facts > div:nth-child(n+3) { border-top: 1px solid var(--line); }
42
+ .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
43
+ .diagram { padding: 16px 8px 4px; }
44
+ .sec > h2 { font-size: 25px; }
45
+ .sec > h2 .path, .sec > h2 .cmd { font-size: 22px; }
46
+ .code pre { font-size: 12.5px; padding: 13px; }
47
+ .prose p, .prose ul, .sec-lede, .note, .field .d { font-size: 15.5px; }
48
+ .tree-root { grid-template-columns: minmax(0, 1fr); }
49
+ }
Binary file
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48" role="img" aria-label="@oipage/cli">
2
+ <rect width="48" height="48" rx="10" fill="#1a6fd4"/>
3
+ <path d="M14.2 16.8 L21.8 24 L14.2 31.2" fill="none" stroke="#ffffff" stroke-width="3.6" stroke-linecap="square"/>
4
+ <rect x="24" y="27.8" width="10.4" height="3.6" fill="#ffffff" fill-opacity="0.92"/>
5
+ </svg>
Binary file
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48" role="img" aria-label="@oipage/cli">
2
+ <rect width="48" height="48" rx="11" fill="#0f1319"/>
3
+ <rect x="1" y="1" width="46" height="46" rx="10" fill="none" stroke="#ffffff" stroke-opacity="0.08"/>
4
+ <path d="M13.6 16.6 L21.2 24 L13.6 31.4" fill="none" stroke="#4aa8ff" stroke-width="3.6" stroke-linecap="square"/>
5
+ <rect x="23.4" y="27.8" width="11" height="3.6" fill="#dfe5ee"/>
6
+ </svg>
Binary file
Binary file