@joinezco/codeblock 0.0.8 → 0.0.10
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/dist/editor.d.ts +30 -3
- package/dist/editor.js +416 -43
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/lsps/index.d.ts +5 -0
- package/dist/lsps/index.js +9 -2
- package/dist/lsps/typescript.d.ts +3 -1
- package/dist/lsps/typescript.js +8 -17
- package/dist/panels/settings.d.ts +22 -0
- package/dist/panels/settings.js +267 -0
- package/dist/panels/terminal.d.ts +3 -0
- package/dist/panels/terminal.js +76 -0
- package/dist/panels/toolbar.d.ts +53 -3
- package/dist/panels/toolbar.js +1336 -164
- package/dist/panels/toolbar.test.js +20 -14
- package/dist/rpc/transport.d.ts +2 -11
- package/dist/rpc/transport.js +19 -35
- package/dist/themes/index.js +226 -13
- package/dist/themes/vscode.js +3 -2
- package/dist/types.d.ts +5 -0
- package/dist/utils/fs.d.ts +22 -3
- package/dist/utils/fs.js +126 -21
- package/dist/utils/lsp.d.ts +26 -15
- package/dist/utils/lsp.js +79 -44
- package/dist/utils/search.d.ts +2 -0
- package/dist/utils/search.js +13 -4
- package/dist/utils/typescript-defaults.d.ts +57 -0
- package/dist/utils/typescript-defaults.js +208 -0
- package/dist/utils/typescript-defaults.test.d.ts +1 -0
- package/dist/utils/typescript-defaults.test.js +197 -0
- package/dist/workers/fs.worker.d.ts +4 -8
- package/dist/workers/fs.worker.js +30 -60
- package/dist/workers/javascript.worker.js +11 -9
- package/package.json +8 -4
- package/dist/assets/clike-C8IJ2oj_.js +0 -1
- package/dist/assets/cmake-BQqOBYOt.js +0 -1
- package/dist/assets/dockerfile-C_y-rIpk.js +0 -1
- package/dist/assets/fs.worker-BwEqZcql.ts +0 -109
- package/dist/assets/go-CTD25R5P.js +0 -1
- package/dist/assets/haskell-BWDZoCOh.js +0 -1
- package/dist/assets/index-9HdhmM_Y.js +0 -1
- package/dist/assets/index-C-QhPFHP.js +0 -3
- package/dist/assets/index-C3BnE2cG.js +0 -222
- package/dist/assets/index-CGx5MZO7.js +0 -6
- package/dist/assets/index-CIuq3uTk.js +0 -1
- package/dist/assets/index-CXFONXS8.js +0 -1
- package/dist/assets/index-D5Z27j1C.js +0 -1
- package/dist/assets/index-DWOBdRjn.js +0 -1
- package/dist/assets/index-Dvu-FFzd.js +0 -1
- package/dist/assets/index-Dx_VuNNd.js +0 -1
- package/dist/assets/index-I0dlv-r3.js +0 -1
- package/dist/assets/index-MGle_v2x.js +0 -1
- package/dist/assets/index-N-GE7HTU.js +0 -1
- package/dist/assets/index-aEsF5o-7.js +0 -2
- package/dist/assets/index-as7ELo0J.js +0 -1
- package/dist/assets/index-gUUzXNuP.js +0 -1
- package/dist/assets/index-pGm0qkrJ.js +0 -13
- package/dist/assets/javascript.worker-C1zGArKk.js +0 -527
- package/dist/assets/lua-BgMRiT3U.js +0 -1
- package/dist/assets/perl-CdXCOZ3F.js +0 -1
- package/dist/assets/process-Dw9K5EnD.js +0 -1357
- package/dist/assets/properties-C78fOPTZ.js +0 -1
- package/dist/assets/ruby-B2Rjki9n.js +0 -1
- package/dist/assets/shell-CjFT_Tl9.js +0 -1
- package/dist/assets/swift-BzpIVaGY.js +0 -1
- package/dist/assets/toml-BXUEaScT.js +0 -1
- package/dist/assets/vb-CmGdzxic.js +0 -1
- package/dist/e2e/example.spec.d.ts +0 -5
- package/dist/e2e/example.spec.js +0 -44
- package/dist/index.html +0 -16
- package/dist/resources/config.json +0 -13
- package/dist/snapshot.bin +0 -0
- package/dist/styles.css +0 -7
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
1
2
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
3
|
import { EditorState } from '@codemirror/state';
|
|
3
4
|
import { EditorView } from '@codemirror/view';
|
|
@@ -13,19 +14,25 @@ vi.mock('../lsps', () => ({
|
|
|
13
14
|
'go': 'go'
|
|
14
15
|
}
|
|
15
16
|
}));
|
|
16
|
-
vi.mock('../editor', () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
vi.mock('../editor', async () => {
|
|
18
|
+
const { Facet, StateField, StateEffect } = await import('@codemirror/state');
|
|
19
|
+
return {
|
|
20
|
+
CodeblockFacet: Facet.define({
|
|
21
|
+
combine: (values) => values[0],
|
|
22
|
+
}),
|
|
23
|
+
currentFileField: StateField.define({
|
|
24
|
+
create() {
|
|
25
|
+
return { path: null, content: '', language: null, loading: false };
|
|
26
|
+
},
|
|
27
|
+
update(value) {
|
|
28
|
+
return value;
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
openFileEffect: StateEffect.define(),
|
|
32
|
+
};
|
|
33
|
+
});
|
|
27
34
|
describe('Toolbar Panel', () => {
|
|
28
|
-
|
|
35
|
+
const ctx = { view: null };
|
|
29
36
|
let mockFs;
|
|
30
37
|
beforeEach(() => {
|
|
31
38
|
mockFs = {
|
|
@@ -49,11 +56,10 @@ describe('Toolbar Panel', () => {
|
|
|
49
56
|
currentFileField
|
|
50
57
|
]
|
|
51
58
|
});
|
|
52
|
-
view = new EditorView({
|
|
59
|
+
ctx.view = new EditorView({
|
|
53
60
|
state,
|
|
54
61
|
parent: document.createElement('div')
|
|
55
62
|
});
|
|
56
|
-
console.log(view);
|
|
57
63
|
});
|
|
58
64
|
describe('Command Results Generation', () => {
|
|
59
65
|
it('should generate create file command for any query', () => {
|
package/dist/rpc/transport.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import { Transport } from "@
|
|
2
|
-
|
|
3
|
-
export default class MessagePortTransport extends Transport {
|
|
4
|
-
port: MessagePort;
|
|
5
|
-
postMessageID: string;
|
|
6
|
-
constructor(port: MessagePort);
|
|
7
|
-
private messageHandler;
|
|
8
|
-
connect(): Promise<void>;
|
|
9
|
-
sendData(data: JSONRPCRequestData): Promise<any>;
|
|
10
|
-
close(): void;
|
|
11
|
-
}
|
|
1
|
+
import type { Transport } from "@codemirror/lsp-client";
|
|
2
|
+
export declare function messagePortTransport(port: MessagePort): Transport;
|
package/dist/rpc/transport.js
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/// Creates a Transport adapter that bridges a MessagePort (which
|
|
2
|
+
/// sends/receives JSON objects) to lsp-client's Transport interface
|
|
3
|
+
/// (which sends/receives JSON strings).
|
|
4
|
+
export function messagePortTransport(port) {
|
|
5
|
+
let handlers = [];
|
|
6
|
+
port.addEventListener("message", (ev) => {
|
|
7
|
+
let msg = typeof ev.data === "string" ? ev.data : JSON.stringify(ev.data);
|
|
8
|
+
for (let handler of handlers)
|
|
9
|
+
handler(msg);
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
send(message) {
|
|
13
|
+
port.postMessage(JSON.parse(message));
|
|
14
|
+
},
|
|
15
|
+
subscribe(handler) {
|
|
16
|
+
handlers.push(handler);
|
|
17
|
+
},
|
|
18
|
+
unsubscribe(handler) {
|
|
19
|
+
handlers = handlers.filter(h => h !== handler);
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
|
-
connect() {
|
|
22
|
-
return new Promise(async (resolve) => {
|
|
23
|
-
this.port.addEventListener("message", this.messageHandler);
|
|
24
|
-
resolve();
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async sendData(data) {
|
|
28
|
-
console.debug("LSP ->>", data);
|
|
29
|
-
const prom = this.transportRequestManager.addRequest(data, null);
|
|
30
|
-
const notifications = getNotifications(data);
|
|
31
|
-
if (this.port) {
|
|
32
|
-
this.port.postMessage(data.request);
|
|
33
|
-
this.transportRequestManager.settlePendingRequest(notifications);
|
|
34
|
-
}
|
|
35
|
-
return prom;
|
|
36
|
-
}
|
|
37
|
-
close() { }
|
|
38
22
|
}
|
package/dist/themes/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
|
+
// Font size helpers — all relative to --cm-font-size so changing the
|
|
3
|
+
// base font size in settings automatically scales the entire UI.
|
|
4
|
+
const FS = 'var(--cm-font-size, 16px)';
|
|
5
|
+
const FS_75 = `calc(${FS} * 0.75)`; // 12px at base 16
|
|
6
|
+
const FS_85 = `calc(${FS} * 0.85)`; // ~14px at base 16
|
|
7
|
+
const FS_875 = `calc(${FS} * 0.875)`; // 14px at base 16
|
|
2
8
|
export const codeblockTheme = EditorView.theme({
|
|
3
9
|
"&:not(.cm-focused)": {
|
|
4
10
|
'& .cm-activeLine, & .cm-activeLineGutter': {
|
|
@@ -12,7 +18,7 @@ export const codeblockTheme = EditorView.theme({
|
|
|
12
18
|
border: 'none',
|
|
13
19
|
background: 'transparent',
|
|
14
20
|
outline: 'none',
|
|
15
|
-
fontSize:
|
|
21
|
+
fontSize: FS,
|
|
16
22
|
color: 'var(--cm-toolbar-color)',
|
|
17
23
|
padding: '0 2px 0 6px',
|
|
18
24
|
width: '100%',
|
|
@@ -37,17 +43,20 @@ export const codeblockTheme = EditorView.theme({
|
|
|
37
43
|
color: 'var(--cm-search-result-color)',
|
|
38
44
|
display: 'flex',
|
|
39
45
|
cursor: 'pointer',
|
|
46
|
+
lineHeight: 1.4,
|
|
40
47
|
'&.cm-command-result': {
|
|
41
48
|
color: 'var(--cm-command-result-color)'
|
|
42
49
|
},
|
|
43
50
|
'& > .cm-search-result-icon-container': {
|
|
44
51
|
width: 'var(--cm-gutter-width)',
|
|
52
|
+
minWidth: 'var(--cm-icon-col-width, 2ch)',
|
|
45
53
|
'& > .cm-search-result-icon': {
|
|
46
|
-
fontSize:
|
|
54
|
+
fontSize: FS,
|
|
47
55
|
textAlign: 'right',
|
|
56
|
+
paddingRight: 'calc(1ch + 3px)',
|
|
48
57
|
boxSizing: 'border-box',
|
|
49
|
-
padding: '0 3px 0 5px',
|
|
50
58
|
width: 'var(--cm-gutter-lineno-width)',
|
|
59
|
+
minWidth: 'var(--cm-icon-col-width, 2ch)',
|
|
51
60
|
}
|
|
52
61
|
},
|
|
53
62
|
'&:hover': {
|
|
@@ -69,14 +78,24 @@ export const codeblockTheme = EditorView.theme({
|
|
|
69
78
|
},
|
|
70
79
|
'.cm-toolbar-state-icon-container': {
|
|
71
80
|
width: 'var(--cm-gutter-width)',
|
|
81
|
+
minWidth: 'var(--cm-icon-col-width, 2ch)',
|
|
82
|
+
display: 'flex',
|
|
72
83
|
},
|
|
84
|
+
// Icon right-aligned to match CM's right-aligned line numbers.
|
|
85
|
+
// padding-right: 3px matches CM's .cm-gutterElement right padding.
|
|
73
86
|
'.cm-toolbar-state-icon': {
|
|
74
|
-
fontSize:
|
|
87
|
+
fontSize: FS,
|
|
88
|
+
color: 'var(--cm-foreground)',
|
|
89
|
+
fontFamily: 'var(--cm-icon-font-family)',
|
|
90
|
+
paddingRight: 'calc(1ch + 3px)',
|
|
75
91
|
textAlign: 'right',
|
|
76
92
|
boxSizing: 'border-box',
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
93
|
+
width: 'var(--cm-gutter-lineno-width)',
|
|
94
|
+
minWidth: 'var(--cm-icon-col-width, 2ch)',
|
|
95
|
+
transition: 'opacity 0.15s ease',
|
|
96
|
+
},
|
|
97
|
+
'&': {
|
|
98
|
+
fontSize: FS,
|
|
80
99
|
},
|
|
81
100
|
'.cm-content': {
|
|
82
101
|
padding: 0,
|
|
@@ -86,7 +105,7 @@ export const codeblockTheme = EditorView.theme({
|
|
|
86
105
|
flexDirection: 'column',
|
|
87
106
|
fontFamily: 'var(--cm-font-family)',
|
|
88
107
|
boxShadow: '-12px 12px 1px rgba(0,0,0,0.3)',
|
|
89
|
-
fontSize:
|
|
108
|
+
fontSize: FS,
|
|
90
109
|
maxWidth: 'min(calc(100% - 2rem), 62ch)',
|
|
91
110
|
border: '2px solid var(--cm-tooltip-border)',
|
|
92
111
|
overflow: 'auto',
|
|
@@ -126,7 +145,7 @@ export const codeblockTheme = EditorView.theme({
|
|
|
126
145
|
'.documentation > *': {
|
|
127
146
|
margin: 0,
|
|
128
147
|
padding: '0.25rem 6px',
|
|
129
|
-
fontSize:
|
|
148
|
+
fontSize: FS,
|
|
130
149
|
},
|
|
131
150
|
'.documentation > p > code': {
|
|
132
151
|
backgroundColor: 'var(--cm-comment-bg)',
|
|
@@ -154,16 +173,210 @@ export const codeblockTheme = EditorView.theme({
|
|
|
154
173
|
padding: 0,
|
|
155
174
|
background: 'var(--cm-toolbar-background)',
|
|
156
175
|
fontFamily: 'var(--cm-font-family)',
|
|
157
|
-
fontSize:
|
|
176
|
+
fontSize: FS,
|
|
158
177
|
listStyleType: 'none',
|
|
159
178
|
width: '100%',
|
|
160
|
-
maxHeight:
|
|
179
|
+
maxHeight: `calc(${FS} * 1.4 * 10)`,
|
|
161
180
|
overflowY: 'auto',
|
|
181
|
+
zIndex: 200,
|
|
162
182
|
},
|
|
163
183
|
'.cm-gutters': {
|
|
164
184
|
borderRight: 'none',
|
|
165
185
|
},
|
|
166
186
|
'.cm-panels-top': {
|
|
167
|
-
borderBottom: 'none'
|
|
168
|
-
|
|
187
|
+
borderBottom: 'none',
|
|
188
|
+
zIndex: 301,
|
|
189
|
+
},
|
|
190
|
+
// CSS border spinner for file loading indicator.
|
|
191
|
+
// Rendered as a separate element inside .cm-toolbar-state-icon-container,
|
|
192
|
+
// so it has fixed dimensions and doesn't inherit gutter-width sizing.
|
|
193
|
+
'.cm-loading': {
|
|
194
|
+
display: 'inline-block',
|
|
195
|
+
width: FS,
|
|
196
|
+
height: FS,
|
|
197
|
+
border: '2px solid var(--cm-foreground, currentColor)',
|
|
198
|
+
borderTopColor: 'transparent',
|
|
199
|
+
borderRadius: '50%',
|
|
200
|
+
boxSizing: 'border-box',
|
|
201
|
+
animation: 'cm-spin 0.8s linear infinite',
|
|
202
|
+
transition: 'opacity 0.15s ease-out',
|
|
203
|
+
margin: 'auto',
|
|
204
|
+
},
|
|
205
|
+
'@keyframes cm-spin': {
|
|
206
|
+
'0%': { transform: 'rotate(0deg)' },
|
|
207
|
+
'100%': { transform: 'rotate(360deg)' },
|
|
208
|
+
},
|
|
209
|
+
// LSP log button in toolbar (far right)
|
|
210
|
+
'.cm-toolbar-lsp-log': {
|
|
211
|
+
border: 'none',
|
|
212
|
+
background: 'transparent',
|
|
213
|
+
color: 'var(--cm-toolbar-color)',
|
|
214
|
+
cursor: 'pointer',
|
|
215
|
+
padding: '0 6px',
|
|
216
|
+
fontSize: FS_875,
|
|
217
|
+
lineHeight: 'inherit',
|
|
218
|
+
flexShrink: '0',
|
|
219
|
+
},
|
|
220
|
+
// Settings / log overlay — anchored at top, grows downward
|
|
221
|
+
'.cm-settings-overlay': {
|
|
222
|
+
position: 'absolute',
|
|
223
|
+
top: 0,
|
|
224
|
+
left: 0,
|
|
225
|
+
right: 0,
|
|
226
|
+
overflowY: 'auto',
|
|
227
|
+
background: 'var(--cm-background)',
|
|
228
|
+
color: 'var(--cm-toolbar-color)',
|
|
229
|
+
zIndex: 1000,
|
|
230
|
+
fontFamily: 'var(--cm-font-family)',
|
|
231
|
+
fontSize: FS,
|
|
232
|
+
},
|
|
233
|
+
'.cm-settings-section': {
|
|
234
|
+
padding: '8px 6px',
|
|
235
|
+
},
|
|
236
|
+
'.cm-settings-section-title': {
|
|
237
|
+
fontWeight: 'bold',
|
|
238
|
+
marginBottom: '6px',
|
|
239
|
+
fontSize: FS_85,
|
|
240
|
+
opacity: '0.7',
|
|
241
|
+
},
|
|
242
|
+
'.cm-settings-row': {
|
|
243
|
+
display: 'flex',
|
|
244
|
+
alignItems: 'center',
|
|
245
|
+
marginBottom: '6px',
|
|
246
|
+
gap: '8px',
|
|
247
|
+
},
|
|
248
|
+
'.cm-settings-row > label': {
|
|
249
|
+
flex: '0 0 auto',
|
|
250
|
+
whiteSpace: 'nowrap',
|
|
251
|
+
},
|
|
252
|
+
'.cm-settings-control': {
|
|
253
|
+
display: 'flex',
|
|
254
|
+
alignItems: 'center',
|
|
255
|
+
gap: '4px',
|
|
256
|
+
},
|
|
257
|
+
// Fixed pixel width so font-size changes don't relayout the slider
|
|
258
|
+
'.cm-settings-font-size-range': {
|
|
259
|
+
width: '120px',
|
|
260
|
+
flexShrink: '0',
|
|
261
|
+
},
|
|
262
|
+
'.cm-settings-font-size-input': {
|
|
263
|
+
background: 'var(--cm-background)',
|
|
264
|
+
color: 'inherit',
|
|
265
|
+
border: '1px solid var(--cm-tooltip-border)',
|
|
266
|
+
borderRadius: '2px',
|
|
267
|
+
padding: '2px 4px',
|
|
268
|
+
fontSize: 'inherit',
|
|
269
|
+
fontFamily: 'var(--cm-font-family)',
|
|
270
|
+
width: '3em',
|
|
271
|
+
textAlign: 'right',
|
|
272
|
+
},
|
|
273
|
+
'.cm-settings-select': {
|
|
274
|
+
background: 'var(--cm-background)',
|
|
275
|
+
color: 'inherit',
|
|
276
|
+
border: '1px solid var(--cm-tooltip-border)',
|
|
277
|
+
borderRadius: '2px',
|
|
278
|
+
padding: '2px 4px',
|
|
279
|
+
fontSize: 'inherit',
|
|
280
|
+
fontFamily: 'var(--cm-font-family)',
|
|
281
|
+
},
|
|
282
|
+
'.cm-settings-radio-group': {
|
|
283
|
+
display: 'flex',
|
|
284
|
+
gap: '4px',
|
|
285
|
+
alignItems: 'center',
|
|
286
|
+
},
|
|
287
|
+
'.cm-settings-radio-group label': {
|
|
288
|
+
marginRight: '6px',
|
|
289
|
+
},
|
|
290
|
+
'.cm-settings-input': {
|
|
291
|
+
background: 'var(--cm-background)',
|
|
292
|
+
color: 'inherit',
|
|
293
|
+
border: '1px solid var(--cm-tooltip-border)',
|
|
294
|
+
borderRadius: '2px',
|
|
295
|
+
padding: '2px 6px',
|
|
296
|
+
fontSize: 'inherit',
|
|
297
|
+
fontFamily: 'var(--cm-font-family)',
|
|
298
|
+
flex: 1,
|
|
299
|
+
minWidth: 0,
|
|
300
|
+
},
|
|
301
|
+
'.cm-settings-button': {
|
|
302
|
+
background: 'var(--cm-background)',
|
|
303
|
+
color: 'inherit',
|
|
304
|
+
border: '1px solid var(--cm-tooltip-border)',
|
|
305
|
+
borderRadius: '2px',
|
|
306
|
+
padding: '4px 8px',
|
|
307
|
+
fontSize: 'inherit',
|
|
308
|
+
cursor: 'pointer',
|
|
309
|
+
},
|
|
310
|
+
'.cm-settings-button-disabled': {
|
|
311
|
+
opacity: '0.5',
|
|
312
|
+
cursor: 'not-allowed',
|
|
313
|
+
},
|
|
314
|
+
// LSP log content
|
|
315
|
+
'.cm-lsp-log-content': {
|
|
316
|
+
padding: '8px 12px',
|
|
317
|
+
fontFamily: 'var(--cm-font-family)',
|
|
318
|
+
fontSize: FS_75,
|
|
319
|
+
lineHeight: 1.5,
|
|
320
|
+
whiteSpace: 'pre-wrap',
|
|
321
|
+
wordBreak: 'break-all',
|
|
322
|
+
overflowY: 'auto',
|
|
323
|
+
flex: 1,
|
|
324
|
+
},
|
|
325
|
+
'.cm-lsp-log-entry': {
|
|
326
|
+
padding: '1px 0',
|
|
327
|
+
},
|
|
328
|
+
'.cm-lsp-log-error': {
|
|
329
|
+
color: 'var(--cm-diagnostic-error-bg)',
|
|
330
|
+
},
|
|
331
|
+
'.cm-lsp-log-warn': {
|
|
332
|
+
color: '#e5a100',
|
|
333
|
+
},
|
|
334
|
+
'.cm-lsp-log-info': {
|
|
335
|
+
opacity: '0.8',
|
|
336
|
+
},
|
|
337
|
+
'.cm-lsp-log-log': {
|
|
338
|
+
opacity: '0.6',
|
|
339
|
+
},
|
|
340
|
+
// Terminal panel
|
|
341
|
+
'.cm-terminal-panel': {
|
|
342
|
+
borderTop: '1px solid var(--cm-tooltip-border)',
|
|
343
|
+
display: 'flex',
|
|
344
|
+
flexDirection: 'column',
|
|
345
|
+
height: '200px',
|
|
346
|
+
minHeight: '80px',
|
|
347
|
+
},
|
|
348
|
+
'.cm-terminal-header': {
|
|
349
|
+
display: 'flex',
|
|
350
|
+
alignItems: 'center',
|
|
351
|
+
justifyContent: 'space-between',
|
|
352
|
+
padding: '2px 6px',
|
|
353
|
+
background: 'var(--cm-toolbar-background)',
|
|
354
|
+
fontSize: FS_85,
|
|
355
|
+
flexShrink: '0',
|
|
356
|
+
},
|
|
357
|
+
'.cm-terminal-title': {
|
|
358
|
+
opacity: '0.7',
|
|
359
|
+
fontFamily: 'var(--cm-font-family)',
|
|
360
|
+
},
|
|
361
|
+
'.cm-terminal-close': {
|
|
362
|
+
border: 'none',
|
|
363
|
+
background: 'transparent',
|
|
364
|
+
color: 'var(--cm-toolbar-color)',
|
|
365
|
+
cursor: 'pointer',
|
|
366
|
+
padding: '2px 4px',
|
|
367
|
+
fontSize: FS_875,
|
|
368
|
+
lineHeight: '1',
|
|
369
|
+
},
|
|
370
|
+
'.cm-terminal-container': {
|
|
371
|
+
flex: 1,
|
|
372
|
+
overflow: 'hidden',
|
|
373
|
+
},
|
|
374
|
+
// Auto-hide toolbar: JS manages retract/expand by toggling
|
|
375
|
+
// .cm-toolbar-retracted on .cm-panels-top (see toolbar.ts).
|
|
376
|
+
// The transition makes expand/retract feel smooth.
|
|
377
|
+
'& .cm-panels-top.cm-toolbar-retracted': {
|
|
378
|
+
maxHeight: '0px',
|
|
379
|
+
overflow: 'hidden',
|
|
380
|
+
transition: 'max-height 0.15s ease-out',
|
|
381
|
+
},
|
|
169
382
|
});
|
package/dist/themes/vscode.js
CHANGED
|
@@ -113,7 +113,7 @@ const darkModeStyles = {
|
|
|
113
113
|
"--cm-comment": "#6a9955",
|
|
114
114
|
"--cm-link": "#4078f2",
|
|
115
115
|
"--cm-invalid": "#ff0000",
|
|
116
|
-
"--cm-search-result-color": "var(--cm-
|
|
116
|
+
"--cm-search-result-color": "var(--cm-foreground)",
|
|
117
117
|
"--cm-search-result-color-hover": "#ffffff",
|
|
118
118
|
"--cm-command-result-color": "var(--cm-search-result-color-hover)",
|
|
119
119
|
"--cm-toolbar-background": "var(--cm-toolbar-bg-dark)",
|
|
@@ -129,6 +129,7 @@ export const vscodeStyleMod = new StyleModule({
|
|
|
129
129
|
":root, .cm-editor[data-theme='light'], [data-theme='light'] .cm-editor": {
|
|
130
130
|
/* Shared */
|
|
131
131
|
"--cm-font-family": 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
|
|
132
|
+
"--cm-icon-font-family": '"UbuntuMono NF", var(--cm-font-family)',
|
|
132
133
|
/* Defaults to light theme */
|
|
133
134
|
"--cm-background": "#ffffff",
|
|
134
135
|
"--cm-foreground": "#383a42",
|
|
@@ -155,7 +156,7 @@ export const vscodeStyleMod = new StyleModule({
|
|
|
155
156
|
"--cm-link": "#4078f2",
|
|
156
157
|
"--cm-invalid": "#e45649",
|
|
157
158
|
/* Additional UI colors */
|
|
158
|
-
"--cm-search-result-color": "
|
|
159
|
+
"--cm-search-result-color": "var(--cm-foreground)",
|
|
159
160
|
"--cm-search-result-color-hover": "var(--cm-toolbar-color)",
|
|
160
161
|
"--cm-search-result-bg-hover": "#2490e94f",
|
|
161
162
|
"--cm-search-result-color-selected": "#ffffff",
|
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ export interface VfsInterface {
|
|
|
41
41
|
*/
|
|
42
42
|
exists: (path: string) => Promise<boolean>;
|
|
43
43
|
stat: (path: string) => Promise<any | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Deletes a file
|
|
46
|
+
* @param path A path to a file
|
|
47
|
+
*/
|
|
48
|
+
unlink: (path: string) => Promise<void>;
|
|
44
49
|
}
|
|
45
50
|
export type FsMountOptions = {
|
|
46
51
|
mount: (args: {
|
package/dist/utils/fs.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ export declare namespace Vfs {
|
|
|
10
10
|
const fromJswasiFs: (jswasiFs: TopLevelFs) => Promise<VfsInterface>;
|
|
11
11
|
const fromMemfs: (fs: FsApi) => VfsInterface;
|
|
12
12
|
const fromNodelike: (fs: typeof promises) => VfsInterface;
|
|
13
|
+
/**
|
|
14
|
+
* Create an FSA (File System Access / OPFS) backed filesystem.
|
|
15
|
+
* Data persists across page reloads via the browser's Origin Private File System.
|
|
16
|
+
*
|
|
17
|
+
* @param name - Unique name for the FSA storage bucket (default: 'codeblock')
|
|
18
|
+
*/
|
|
19
|
+
const fsa: (name?: string) => Promise<VfsInterface>;
|
|
13
20
|
/**
|
|
14
21
|
* Create a filesystem worker with optional snapshot data.
|
|
15
22
|
*
|
|
@@ -23,7 +30,19 @@ export declare namespace Vfs {
|
|
|
23
30
|
export declare class VolarFs implements FileSystem {
|
|
24
31
|
#private;
|
|
25
32
|
constructor(fs: VfsInterface);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Synchronously populate the cache from a pre-resolved map of path → content.
|
|
35
|
+
* This bypasses async VFS reads entirely, ensuring TypeScript gets lib files
|
|
36
|
+
* immediately on first program creation.
|
|
37
|
+
*/
|
|
38
|
+
preloadFromMap(files: Record<string, string>): void;
|
|
39
|
+
stat(uri: URI): Promise<any> | {
|
|
40
|
+
type: FileType;
|
|
41
|
+
ctime: number;
|
|
42
|
+
mtime: number;
|
|
43
|
+
size: number;
|
|
44
|
+
};
|
|
45
|
+
readDirectory(uri: URI): [string, FileType][] | Promise<[string, FileType][]>;
|
|
46
|
+
readFile(uri: URI): string | Promise<string>;
|
|
47
|
+
getCacheSize(): number;
|
|
29
48
|
}
|