@handylib/kai-code 0.0.0-stage → 0.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.
- package/LICENSE +21 -0
- package/README.md +212 -2
- package/dist/index.cjs +1121 -0
- package/dist/index.css +599 -0
- package/dist/index.d.cts +65 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +1089 -0
- package/package.json +60 -4
package/dist/index.css
ADDED
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
/* src/KaiCode.css */
|
|
2
|
+
.kai-code {
|
|
3
|
+
--kc-background: #1e1e1e;
|
|
4
|
+
--kc-sidebar: #181818;
|
|
5
|
+
--kc-panel: #252526;
|
|
6
|
+
--kc-border: #333333;
|
|
7
|
+
--kc-muted: #858585;
|
|
8
|
+
--kc-text: #cccccc;
|
|
9
|
+
--kc-accent: #007acc;
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
min-width: 520px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
color: var(--kc-text);
|
|
16
|
+
background: var(--kc-background);
|
|
17
|
+
border: 1px solid #111;
|
|
18
|
+
border-radius: 6px;
|
|
19
|
+
font-family:
|
|
20
|
+
-apple-system,
|
|
21
|
+
BlinkMacSystemFont,
|
|
22
|
+
"Segoe UI",
|
|
23
|
+
sans-serif;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
line-height: 1.4;
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
.kai-code *,
|
|
29
|
+
.kai-code *::before,
|
|
30
|
+
.kai-code *::after {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
}
|
|
33
|
+
.kai-code button {
|
|
34
|
+
color: inherit;
|
|
35
|
+
font: inherit;
|
|
36
|
+
}
|
|
37
|
+
.kai-code__titlebar {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex: 0 0 38px;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 9px;
|
|
42
|
+
padding: 0 12px;
|
|
43
|
+
background: #181818;
|
|
44
|
+
border-bottom: 1px solid #111;
|
|
45
|
+
user-select: none;
|
|
46
|
+
}
|
|
47
|
+
.kai-code__brand-mark,
|
|
48
|
+
.kai-code__welcome-mark {
|
|
49
|
+
display: grid;
|
|
50
|
+
place-items: center;
|
|
51
|
+
color: white;
|
|
52
|
+
background: #0877c9;
|
|
53
|
+
border-radius: 5px;
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
}
|
|
56
|
+
.kai-code__brand-mark {
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
font-size: 13px;
|
|
60
|
+
}
|
|
61
|
+
.kai-code__brand {
|
|
62
|
+
color: #e6e6e6;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
}
|
|
65
|
+
.kai-code__title-divider {
|
|
66
|
+
width: 1px;
|
|
67
|
+
height: 17px;
|
|
68
|
+
margin: 0 3px;
|
|
69
|
+
background: #3b3b3b;
|
|
70
|
+
}
|
|
71
|
+
.kai-code__workspace-title {
|
|
72
|
+
color: #bcbcbc;
|
|
73
|
+
}
|
|
74
|
+
.kai-code__title-actions {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 6px;
|
|
77
|
+
margin-left: auto;
|
|
78
|
+
}
|
|
79
|
+
.kai-code__title-button {
|
|
80
|
+
padding: 3px 9px;
|
|
81
|
+
color: #ddd;
|
|
82
|
+
background: #333;
|
|
83
|
+
border: 1px solid #454545;
|
|
84
|
+
border-radius: 3px;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
}
|
|
87
|
+
.kai-code__title-button:disabled {
|
|
88
|
+
cursor: default;
|
|
89
|
+
opacity: 0.45;
|
|
90
|
+
}
|
|
91
|
+
.kai-code__workbench {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex: 1;
|
|
94
|
+
min-height: 0;
|
|
95
|
+
}
|
|
96
|
+
.kai-code__activity-bar {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex: 0 0 48px;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
align-items: center;
|
|
101
|
+
padding: 5px 0;
|
|
102
|
+
background: #181818;
|
|
103
|
+
border-right: 1px solid #242424;
|
|
104
|
+
}
|
|
105
|
+
.kai-code__activity-button {
|
|
106
|
+
position: relative;
|
|
107
|
+
display: grid;
|
|
108
|
+
width: 47px;
|
|
109
|
+
height: 48px;
|
|
110
|
+
place-items: center;
|
|
111
|
+
color: #858585;
|
|
112
|
+
background: transparent;
|
|
113
|
+
border: 0;
|
|
114
|
+
border-left: 2px solid transparent;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
}
|
|
117
|
+
.kai-code__activity-button.is-active {
|
|
118
|
+
color: #e7e7e7;
|
|
119
|
+
border-left-color: #e7e7e7;
|
|
120
|
+
}
|
|
121
|
+
.kai-code__activity-button svg {
|
|
122
|
+
width: 23px;
|
|
123
|
+
height: 23px;
|
|
124
|
+
fill: none;
|
|
125
|
+
stroke: currentColor;
|
|
126
|
+
stroke-linecap: round;
|
|
127
|
+
stroke-linejoin: round;
|
|
128
|
+
stroke-width: 1.5;
|
|
129
|
+
}
|
|
130
|
+
.kai-code__activity-spacer {
|
|
131
|
+
flex: 1;
|
|
132
|
+
}
|
|
133
|
+
.kai-code__activity-avatar {
|
|
134
|
+
display: grid;
|
|
135
|
+
width: 24px;
|
|
136
|
+
height: 24px;
|
|
137
|
+
place-items: center;
|
|
138
|
+
margin-bottom: 7px;
|
|
139
|
+
color: #ddd;
|
|
140
|
+
background: #454545;
|
|
141
|
+
border-radius: 50%;
|
|
142
|
+
font-size: 11px;
|
|
143
|
+
}
|
|
144
|
+
.kai-code__sidebar {
|
|
145
|
+
display: flex;
|
|
146
|
+
flex: 0 0 230px;
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
min-width: 160px;
|
|
149
|
+
overflow: auto;
|
|
150
|
+
background: var(--kc-sidebar);
|
|
151
|
+
border-right: 1px solid var(--kc-border);
|
|
152
|
+
}
|
|
153
|
+
.kai-code__sidebar-actions {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: 2px;
|
|
157
|
+
}
|
|
158
|
+
.kai-code__sidebar-heading {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex: 0 0 36px;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: space-between;
|
|
163
|
+
padding: 0 12px 0 18px;
|
|
164
|
+
color: #bbb;
|
|
165
|
+
font-size: 11px;
|
|
166
|
+
letter-spacing: 0.7px;
|
|
167
|
+
}
|
|
168
|
+
.kai-code__icon-button {
|
|
169
|
+
min-width: 24px;
|
|
170
|
+
height: 24px;
|
|
171
|
+
padding: 0 3px;
|
|
172
|
+
color: #bcbcbc;
|
|
173
|
+
background: transparent;
|
|
174
|
+
border: 0;
|
|
175
|
+
font-size: 17px !important;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
}
|
|
178
|
+
.kai-code__icon-button:hover {
|
|
179
|
+
color: #fff;
|
|
180
|
+
background: #333;
|
|
181
|
+
}
|
|
182
|
+
.kai-code__resizer {
|
|
183
|
+
z-index: 1;
|
|
184
|
+
flex: 0 0 4px;
|
|
185
|
+
cursor: col-resize;
|
|
186
|
+
touch-action: none;
|
|
187
|
+
}
|
|
188
|
+
.kai-code__resizer:hover,
|
|
189
|
+
.kai-code__resizer:focus-visible {
|
|
190
|
+
background: var(--kc-accent);
|
|
191
|
+
outline: 0;
|
|
192
|
+
}
|
|
193
|
+
.kai-code__workspace-row {
|
|
194
|
+
display: flex;
|
|
195
|
+
flex: 0 0 27px;
|
|
196
|
+
align-items: center;
|
|
197
|
+
gap: 6px;
|
|
198
|
+
padding: 0 9px;
|
|
199
|
+
color: #ddd;
|
|
200
|
+
font-size: 11px;
|
|
201
|
+
font-weight: 700;
|
|
202
|
+
letter-spacing: 0.35px;
|
|
203
|
+
}
|
|
204
|
+
.kai-code__file-tree {
|
|
205
|
+
padding: 2px 0 10px;
|
|
206
|
+
}
|
|
207
|
+
.kai-code__directory summary,
|
|
208
|
+
.kai-code__file {
|
|
209
|
+
display: flex;
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 24px;
|
|
212
|
+
align-items: center;
|
|
213
|
+
gap: 6px;
|
|
214
|
+
padding: 0 8px 0 calc(9px + var(--tree-depth, 0) * 13px);
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
color: #ccc;
|
|
217
|
+
background: transparent;
|
|
218
|
+
border: 0;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
list-style: none;
|
|
221
|
+
text-align: left;
|
|
222
|
+
white-space: nowrap;
|
|
223
|
+
}
|
|
224
|
+
.kai-code__directory summary::-webkit-details-marker {
|
|
225
|
+
display: none;
|
|
226
|
+
}
|
|
227
|
+
.kai-code__directory summary:hover,
|
|
228
|
+
.kai-code__file:hover {
|
|
229
|
+
background: #2a2d2e;
|
|
230
|
+
}
|
|
231
|
+
.kai-code__file.is-active {
|
|
232
|
+
color: #fff;
|
|
233
|
+
background: #37373d;
|
|
234
|
+
}
|
|
235
|
+
.kai-code__chevron {
|
|
236
|
+
display: inline-block;
|
|
237
|
+
width: 10px;
|
|
238
|
+
color: #aaa;
|
|
239
|
+
font-size: 10px;
|
|
240
|
+
transition: transform 100ms ease;
|
|
241
|
+
}
|
|
242
|
+
.kai-code__directory[open] > summary .kai-code__chevron {
|
|
243
|
+
transform: rotate(90deg);
|
|
244
|
+
}
|
|
245
|
+
.kai-code__folder-icon {
|
|
246
|
+
color: #dcb67a;
|
|
247
|
+
font-size: 12px;
|
|
248
|
+
}
|
|
249
|
+
.kai-code__file-icon {
|
|
250
|
+
display: inline-grid;
|
|
251
|
+
width: 15px;
|
|
252
|
+
flex: 0 0 15px;
|
|
253
|
+
place-items: center;
|
|
254
|
+
color: #8cacf2;
|
|
255
|
+
font-size: 11px;
|
|
256
|
+
}
|
|
257
|
+
.kai-code__editor-area {
|
|
258
|
+
display: flex;
|
|
259
|
+
flex: 1;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
min-width: 0;
|
|
262
|
+
background: var(--kc-background);
|
|
263
|
+
}
|
|
264
|
+
.kai-code__tabs {
|
|
265
|
+
display: flex;
|
|
266
|
+
flex: 0 0 35px;
|
|
267
|
+
overflow: auto hidden;
|
|
268
|
+
background: #181818;
|
|
269
|
+
scrollbar-width: none;
|
|
270
|
+
}
|
|
271
|
+
.kai-code__tabs::-webkit-scrollbar {
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
.kai-code__tab {
|
|
275
|
+
display: flex;
|
|
276
|
+
min-width: 120px;
|
|
277
|
+
max-width: 200px;
|
|
278
|
+
align-items: center;
|
|
279
|
+
background: #2d2d2d;
|
|
280
|
+
border-right: 1px solid #252525;
|
|
281
|
+
}
|
|
282
|
+
.kai-code__tab.is-active {
|
|
283
|
+
background: var(--kc-background);
|
|
284
|
+
border-top: 1px solid var(--kc-accent);
|
|
285
|
+
}
|
|
286
|
+
.kai-code__tab-label {
|
|
287
|
+
display: flex;
|
|
288
|
+
height: 100%;
|
|
289
|
+
min-width: 0;
|
|
290
|
+
flex: 1;
|
|
291
|
+
align-items: center;
|
|
292
|
+
gap: 6px;
|
|
293
|
+
padding: 0 5px 0 12px;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
color: #aaa;
|
|
296
|
+
background: transparent;
|
|
297
|
+
border: 0;
|
|
298
|
+
cursor: pointer;
|
|
299
|
+
text-overflow: ellipsis;
|
|
300
|
+
white-space: nowrap;
|
|
301
|
+
}
|
|
302
|
+
.kai-code__tab.is-active .kai-code__tab-label {
|
|
303
|
+
color: #e4e4e4;
|
|
304
|
+
}
|
|
305
|
+
.kai-code__tab-close {
|
|
306
|
+
display: grid;
|
|
307
|
+
width: 25px;
|
|
308
|
+
height: 25px;
|
|
309
|
+
flex: 0 0 25px;
|
|
310
|
+
place-items: center;
|
|
311
|
+
color: #aaa;
|
|
312
|
+
background: transparent;
|
|
313
|
+
border: 0;
|
|
314
|
+
border-radius: 4px;
|
|
315
|
+
cursor: pointer;
|
|
316
|
+
font-size: 17px !important;
|
|
317
|
+
}
|
|
318
|
+
.kai-code__tab-close:hover {
|
|
319
|
+
background: #444;
|
|
320
|
+
}
|
|
321
|
+
.kai-code__dirty-dot {
|
|
322
|
+
width: 7px;
|
|
323
|
+
height: 7px;
|
|
324
|
+
margin-left: auto;
|
|
325
|
+
background: #e7e7e7;
|
|
326
|
+
border-radius: 50%;
|
|
327
|
+
}
|
|
328
|
+
.kai-code__breadcrumbs {
|
|
329
|
+
display: flex;
|
|
330
|
+
flex: 0 0 28px;
|
|
331
|
+
align-items: center;
|
|
332
|
+
gap: 4px;
|
|
333
|
+
padding: 0 15px;
|
|
334
|
+
color: #aaa;
|
|
335
|
+
font-size: 11px;
|
|
336
|
+
}
|
|
337
|
+
.kai-code__breadcrumb-separator {
|
|
338
|
+
padding: 0 7px 0 3px;
|
|
339
|
+
color: #777;
|
|
340
|
+
}
|
|
341
|
+
.kai-code__monaco {
|
|
342
|
+
position: relative;
|
|
343
|
+
flex: 1;
|
|
344
|
+
min-height: 0;
|
|
345
|
+
}
|
|
346
|
+
.kai-code__monaco > section {
|
|
347
|
+
height: 100%;
|
|
348
|
+
}
|
|
349
|
+
.kai-code__statusbar {
|
|
350
|
+
display: flex;
|
|
351
|
+
flex: 0 0 22px;
|
|
352
|
+
align-items: center;
|
|
353
|
+
justify-content: space-between;
|
|
354
|
+
padding: 0 9px;
|
|
355
|
+
color: white;
|
|
356
|
+
background: #007acc;
|
|
357
|
+
font-size: 11px;
|
|
358
|
+
user-select: none;
|
|
359
|
+
}
|
|
360
|
+
.kai-code__status-left,
|
|
361
|
+
.kai-code__status-right {
|
|
362
|
+
display: flex;
|
|
363
|
+
height: 100%;
|
|
364
|
+
align-items: center;
|
|
365
|
+
gap: 13px;
|
|
366
|
+
}
|
|
367
|
+
.kai-code__status-branch {
|
|
368
|
+
font-weight: 600;
|
|
369
|
+
}
|
|
370
|
+
.kai-code__status-kai {
|
|
371
|
+
padding: 0 3px;
|
|
372
|
+
font-weight: 600;
|
|
373
|
+
}
|
|
374
|
+
.kai-code__empty {
|
|
375
|
+
padding: 12px;
|
|
376
|
+
color: var(--kc-muted);
|
|
377
|
+
}
|
|
378
|
+
.kai-code__retry {
|
|
379
|
+
padding: 0;
|
|
380
|
+
color: #4daafc !important;
|
|
381
|
+
background: transparent;
|
|
382
|
+
border: 0;
|
|
383
|
+
cursor: pointer;
|
|
384
|
+
text-decoration: underline;
|
|
385
|
+
}
|
|
386
|
+
.kai-code__welcome {
|
|
387
|
+
display: flex;
|
|
388
|
+
height: 100%;
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
align-items: center;
|
|
391
|
+
justify-content: center;
|
|
392
|
+
color: #858585;
|
|
393
|
+
text-align: center;
|
|
394
|
+
}
|
|
395
|
+
.kai-code__welcome-mark {
|
|
396
|
+
width: 48px;
|
|
397
|
+
height: 48px;
|
|
398
|
+
font-size: 28px;
|
|
399
|
+
}
|
|
400
|
+
.kai-code__welcome h1 {
|
|
401
|
+
margin: 14px 0 2px;
|
|
402
|
+
color: #ccc;
|
|
403
|
+
font-size: 20px;
|
|
404
|
+
font-weight: 500;
|
|
405
|
+
}
|
|
406
|
+
.kai-code__welcome p {
|
|
407
|
+
margin: 5px 0;
|
|
408
|
+
}
|
|
409
|
+
.kai-code__error {
|
|
410
|
+
z-index: 1;
|
|
411
|
+
display: flex;
|
|
412
|
+
min-height: 30px;
|
|
413
|
+
align-items: center;
|
|
414
|
+
justify-content: space-between;
|
|
415
|
+
gap: 12px;
|
|
416
|
+
padding: 4px 10px;
|
|
417
|
+
color: #f0caca;
|
|
418
|
+
background: #5a2727;
|
|
419
|
+
border-bottom: 1px solid #7d3939;
|
|
420
|
+
}
|
|
421
|
+
.kai-code__error button {
|
|
422
|
+
color: inherit;
|
|
423
|
+
background: transparent;
|
|
424
|
+
border: 0;
|
|
425
|
+
cursor: pointer;
|
|
426
|
+
font-size: 17px;
|
|
427
|
+
}
|
|
428
|
+
.kai-code__context-menu {
|
|
429
|
+
position: fixed;
|
|
430
|
+
z-index: 20;
|
|
431
|
+
min-width: 170px;
|
|
432
|
+
padding: 4px;
|
|
433
|
+
color: #ddd;
|
|
434
|
+
background: #252526;
|
|
435
|
+
border: 1px solid #454545;
|
|
436
|
+
border-radius: 5px;
|
|
437
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
|
|
438
|
+
}
|
|
439
|
+
.kai-code__context-menu button {
|
|
440
|
+
display: block;
|
|
441
|
+
width: 100%;
|
|
442
|
+
padding: 6px 9px;
|
|
443
|
+
color: inherit;
|
|
444
|
+
background: transparent;
|
|
445
|
+
border: 0;
|
|
446
|
+
border-radius: 3px;
|
|
447
|
+
cursor: pointer;
|
|
448
|
+
text-align: left;
|
|
449
|
+
}
|
|
450
|
+
.kai-code__context-menu button:hover {
|
|
451
|
+
background: #094771;
|
|
452
|
+
}
|
|
453
|
+
.kai-code__context-menu button.is-danger:hover {
|
|
454
|
+
background: #5a2727;
|
|
455
|
+
}
|
|
456
|
+
.kai-code__context-divider {
|
|
457
|
+
height: 1px;
|
|
458
|
+
margin: 4px 5px;
|
|
459
|
+
background: #454545;
|
|
460
|
+
}
|
|
461
|
+
.kai-code__dialog-backdrop {
|
|
462
|
+
position: absolute;
|
|
463
|
+
z-index: 30;
|
|
464
|
+
display: grid;
|
|
465
|
+
padding: 16px;
|
|
466
|
+
background: rgb(0 0 0 / 45%);
|
|
467
|
+
inset: 0;
|
|
468
|
+
place-items: center;
|
|
469
|
+
}
|
|
470
|
+
.kai-code__dialog {
|
|
471
|
+
width: min(360px, 100%);
|
|
472
|
+
padding: 18px;
|
|
473
|
+
color: #ddd;
|
|
474
|
+
background: #252526;
|
|
475
|
+
border: 1px solid #454545;
|
|
476
|
+
border-radius: 6px;
|
|
477
|
+
box-shadow: 0 12px 36px rgb(0 0 0 / 40%);
|
|
478
|
+
}
|
|
479
|
+
.kai-code__dialog h2 {
|
|
480
|
+
margin: 0 0 8px;
|
|
481
|
+
color: #f0f0f0;
|
|
482
|
+
font-size: 15px;
|
|
483
|
+
font-weight: 600;
|
|
484
|
+
}
|
|
485
|
+
.kai-code__dialog p {
|
|
486
|
+
margin: 0 0 14px;
|
|
487
|
+
color: #a9a9a9;
|
|
488
|
+
overflow-wrap: anywhere;
|
|
489
|
+
}
|
|
490
|
+
.kai-code__dialog p.kai-code__dialog-error {
|
|
491
|
+
margin: 10px 0 0;
|
|
492
|
+
color: #f0aaaa;
|
|
493
|
+
}
|
|
494
|
+
.kai-code__dialog label {
|
|
495
|
+
display: block;
|
|
496
|
+
margin-bottom: 5px;
|
|
497
|
+
color: #c8c8c8;
|
|
498
|
+
}
|
|
499
|
+
.kai-code__dialog input {
|
|
500
|
+
width: 100%;
|
|
501
|
+
padding: 7px 8px;
|
|
502
|
+
color: #eee;
|
|
503
|
+
background: #3c3c3c;
|
|
504
|
+
border: 1px solid #007fd4;
|
|
505
|
+
border-radius: 3px;
|
|
506
|
+
font: inherit;
|
|
507
|
+
outline: 0;
|
|
508
|
+
}
|
|
509
|
+
.kai-code__dialog-actions {
|
|
510
|
+
display: flex;
|
|
511
|
+
justify-content: flex-end;
|
|
512
|
+
gap: 8px;
|
|
513
|
+
margin-top: 16px;
|
|
514
|
+
}
|
|
515
|
+
.kai-code__dialog-actions button {
|
|
516
|
+
min-width: 70px;
|
|
517
|
+
padding: 5px 10px;
|
|
518
|
+
color: #ddd;
|
|
519
|
+
background: #3a3d41;
|
|
520
|
+
border: 1px solid #555;
|
|
521
|
+
border-radius: 3px;
|
|
522
|
+
cursor: pointer;
|
|
523
|
+
}
|
|
524
|
+
.kai-code__dialog-actions button.is-primary {
|
|
525
|
+
color: white;
|
|
526
|
+
background: #0e639c;
|
|
527
|
+
border-color: #1177bb;
|
|
528
|
+
}
|
|
529
|
+
.kai-code__dialog-actions button.is-danger {
|
|
530
|
+
color: white;
|
|
531
|
+
background: #8b3030;
|
|
532
|
+
border-color: #aa4141;
|
|
533
|
+
}
|
|
534
|
+
.kai-code--light {
|
|
535
|
+
--kc-background: #fff;
|
|
536
|
+
--kc-sidebar: #f3f3f3;
|
|
537
|
+
--kc-panel: #e8e8e8;
|
|
538
|
+
--kc-border: #dedede;
|
|
539
|
+
--kc-muted: #777;
|
|
540
|
+
--kc-text: #333;
|
|
541
|
+
--kc-accent: #007acc;
|
|
542
|
+
border-color: #d0d0d0;
|
|
543
|
+
}
|
|
544
|
+
.kai-code--light .kai-code__titlebar,
|
|
545
|
+
.kai-code--light .kai-code__activity-bar,
|
|
546
|
+
.kai-code--light .kai-code__tabs {
|
|
547
|
+
background: #f3f3f3;
|
|
548
|
+
}
|
|
549
|
+
.kai-code--light .kai-code__brand,
|
|
550
|
+
.kai-code--light .kai-code__workspace-title,
|
|
551
|
+
.kai-code--light .kai-code__sidebar-heading,
|
|
552
|
+
.kai-code--light .kai-code__workspace-row,
|
|
553
|
+
.kai-code--light .kai-code__directory summary,
|
|
554
|
+
.kai-code--light .kai-code__file,
|
|
555
|
+
.kai-code--light .kai-code__tab.is-active .kai-code__tab-label {
|
|
556
|
+
color: #333;
|
|
557
|
+
}
|
|
558
|
+
.kai-code--light .kai-code__tab {
|
|
559
|
+
background: #ececec;
|
|
560
|
+
}
|
|
561
|
+
.kai-code--light .kai-code__tab.is-active {
|
|
562
|
+
background: #fff;
|
|
563
|
+
}
|
|
564
|
+
.kai-code--light .kai-code__file.is-active {
|
|
565
|
+
color: #111;
|
|
566
|
+
background: #cce8ff;
|
|
567
|
+
}
|
|
568
|
+
.kai-code--light .kai-code__context-menu,
|
|
569
|
+
.kai-code--light .kai-code__dialog {
|
|
570
|
+
color: #333;
|
|
571
|
+
background: #f3f3f3;
|
|
572
|
+
border-color: #ccc;
|
|
573
|
+
}
|
|
574
|
+
.kai-code--light .kai-code__dialog h2,
|
|
575
|
+
.kai-code--light .kai-code__dialog label {
|
|
576
|
+
color: #222;
|
|
577
|
+
}
|
|
578
|
+
.kai-code--light .kai-code__dialog p {
|
|
579
|
+
color: #666;
|
|
580
|
+
}
|
|
581
|
+
.kai-code--light .kai-code__dialog input {
|
|
582
|
+
color: #222;
|
|
583
|
+
background: white;
|
|
584
|
+
border-color: #007acc;
|
|
585
|
+
}
|
|
586
|
+
@media (max-width: 760px) {
|
|
587
|
+
.kai-code {
|
|
588
|
+
min-width: 360px;
|
|
589
|
+
}
|
|
590
|
+
.kai-code__sidebar {
|
|
591
|
+
flex-basis: 185px;
|
|
592
|
+
}
|
|
593
|
+
.kai-code__activity-bar {
|
|
594
|
+
flex-basis: 40px;
|
|
595
|
+
}
|
|
596
|
+
.kai-code__activity-button {
|
|
597
|
+
width: 39px;
|
|
598
|
+
}
|
|
599
|
+
}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { editor } from 'monaco-editor';
|
|
3
|
+
|
|
4
|
+
interface KaiCodeFile {
|
|
5
|
+
type: "file";
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
language?: string;
|
|
9
|
+
}
|
|
10
|
+
interface KaiCodeDirectory {
|
|
11
|
+
type: "directory";
|
|
12
|
+
name: string;
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
type KaiCodeEntry = KaiCodeFile | KaiCodeDirectory;
|
|
16
|
+
/**
|
|
17
|
+
* The filesystem contract KaiCode uses to read and persist editor documents.
|
|
18
|
+
* Paths are adapter-defined strings; use the same format consistently across
|
|
19
|
+
* directory entries and file operations.
|
|
20
|
+
*/
|
|
21
|
+
interface KaiCodeFileSystem {
|
|
22
|
+
readDirectory(path?: string): Promise<readonly KaiCodeEntry[]>;
|
|
23
|
+
readFile(path: string): Promise<string>;
|
|
24
|
+
writeFile(path: string, contents: string): Promise<void>;
|
|
25
|
+
createFile?(path: string, contents?: string): Promise<void>;
|
|
26
|
+
/** Enables creating empty directories from the Explorer. */
|
|
27
|
+
createDirectory?(path: string): Promise<void>;
|
|
28
|
+
deleteFile?(path: string): Promise<void>;
|
|
29
|
+
/** Must delete the directory and all of its descendants. */
|
|
30
|
+
deleteDirectory?(path: string): Promise<void>;
|
|
31
|
+
renameFile?(oldPath: string, newPath: string): Promise<void>;
|
|
32
|
+
watch?(listener: () => void): () => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a small in-memory filesystem, useful for demos, tests, and
|
|
36
|
+
* applications that do not need to mount a persistent filesystem.
|
|
37
|
+
*/
|
|
38
|
+
declare function createMemoryFileSystem(initialFiles?: Record<string, string>): KaiCodeFileSystem;
|
|
39
|
+
declare function normalizePath(path: string): string;
|
|
40
|
+
|
|
41
|
+
interface KaiCodeProps {
|
|
42
|
+
/** Filesystem to mount. If omitted, KaiCode uses an in-memory filesystem. */
|
|
43
|
+
fileSystem?: KaiCodeFileSystem;
|
|
44
|
+
/** Initial files used by the built-in in-memory filesystem. */
|
|
45
|
+
initialFiles?: Record<string, string>;
|
|
46
|
+
/** Path to select after the filesystem has loaded. */
|
|
47
|
+
initialActiveFile?: string;
|
|
48
|
+
/** Monaco theme name. Defaults to `vs-dark`. */
|
|
49
|
+
theme?: string;
|
|
50
|
+
/** Additional Monaco editor options. */
|
|
51
|
+
options?: editor.IStandaloneEditorConstructionOptions;
|
|
52
|
+
/** Component height. Defaults to 640px. */
|
|
53
|
+
height?: string | number;
|
|
54
|
+
/** Makes the editor read-only. */
|
|
55
|
+
readOnly?: boolean;
|
|
56
|
+
/** Optional class applied to the outermost element. */
|
|
57
|
+
className?: string;
|
|
58
|
+
/** Called as the editor's in-memory document changes. */
|
|
59
|
+
onFileChange?: (path: string, contents: string) => void;
|
|
60
|
+
/** Called after a document is successfully saved to the filesystem. */
|
|
61
|
+
onSave?: (path: string, contents: string) => void;
|
|
62
|
+
}
|
|
63
|
+
declare function KaiCode({ fileSystem, initialFiles, initialActiveFile, theme, options, height, readOnly, className, onFileChange, onSave, }: KaiCodeProps): react.JSX.Element;
|
|
64
|
+
|
|
65
|
+
export { KaiCode, type KaiCodeDirectory, type KaiCodeEntry, type KaiCodeFile, type KaiCodeFileSystem, type KaiCodeProps, createMemoryFileSystem, KaiCode as default, normalizePath };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { editor } from 'monaco-editor';
|
|
3
|
+
|
|
4
|
+
interface KaiCodeFile {
|
|
5
|
+
type: "file";
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
language?: string;
|
|
9
|
+
}
|
|
10
|
+
interface KaiCodeDirectory {
|
|
11
|
+
type: "directory";
|
|
12
|
+
name: string;
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
type KaiCodeEntry = KaiCodeFile | KaiCodeDirectory;
|
|
16
|
+
/**
|
|
17
|
+
* The filesystem contract KaiCode uses to read and persist editor documents.
|
|
18
|
+
* Paths are adapter-defined strings; use the same format consistently across
|
|
19
|
+
* directory entries and file operations.
|
|
20
|
+
*/
|
|
21
|
+
interface KaiCodeFileSystem {
|
|
22
|
+
readDirectory(path?: string): Promise<readonly KaiCodeEntry[]>;
|
|
23
|
+
readFile(path: string): Promise<string>;
|
|
24
|
+
writeFile(path: string, contents: string): Promise<void>;
|
|
25
|
+
createFile?(path: string, contents?: string): Promise<void>;
|
|
26
|
+
/** Enables creating empty directories from the Explorer. */
|
|
27
|
+
createDirectory?(path: string): Promise<void>;
|
|
28
|
+
deleteFile?(path: string): Promise<void>;
|
|
29
|
+
/** Must delete the directory and all of its descendants. */
|
|
30
|
+
deleteDirectory?(path: string): Promise<void>;
|
|
31
|
+
renameFile?(oldPath: string, newPath: string): Promise<void>;
|
|
32
|
+
watch?(listener: () => void): () => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a small in-memory filesystem, useful for demos, tests, and
|
|
36
|
+
* applications that do not need to mount a persistent filesystem.
|
|
37
|
+
*/
|
|
38
|
+
declare function createMemoryFileSystem(initialFiles?: Record<string, string>): KaiCodeFileSystem;
|
|
39
|
+
declare function normalizePath(path: string): string;
|
|
40
|
+
|
|
41
|
+
interface KaiCodeProps {
|
|
42
|
+
/** Filesystem to mount. If omitted, KaiCode uses an in-memory filesystem. */
|
|
43
|
+
fileSystem?: KaiCodeFileSystem;
|
|
44
|
+
/** Initial files used by the built-in in-memory filesystem. */
|
|
45
|
+
initialFiles?: Record<string, string>;
|
|
46
|
+
/** Path to select after the filesystem has loaded. */
|
|
47
|
+
initialActiveFile?: string;
|
|
48
|
+
/** Monaco theme name. Defaults to `vs-dark`. */
|
|
49
|
+
theme?: string;
|
|
50
|
+
/** Additional Monaco editor options. */
|
|
51
|
+
options?: editor.IStandaloneEditorConstructionOptions;
|
|
52
|
+
/** Component height. Defaults to 640px. */
|
|
53
|
+
height?: string | number;
|
|
54
|
+
/** Makes the editor read-only. */
|
|
55
|
+
readOnly?: boolean;
|
|
56
|
+
/** Optional class applied to the outermost element. */
|
|
57
|
+
className?: string;
|
|
58
|
+
/** Called as the editor's in-memory document changes. */
|
|
59
|
+
onFileChange?: (path: string, contents: string) => void;
|
|
60
|
+
/** Called after a document is successfully saved to the filesystem. */
|
|
61
|
+
onSave?: (path: string, contents: string) => void;
|
|
62
|
+
}
|
|
63
|
+
declare function KaiCode({ fileSystem, initialFiles, initialActiveFile, theme, options, height, readOnly, className, onFileChange, onSave, }: KaiCodeProps): react.JSX.Element;
|
|
64
|
+
|
|
65
|
+
export { KaiCode, type KaiCodeDirectory, type KaiCodeEntry, type KaiCodeFile, type KaiCodeFileSystem, type KaiCodeProps, createMemoryFileSystem, KaiCode as default, normalizePath };
|