@bakapiano/ccsm 0.10.3 → 0.11.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/CLAUDE.md +475 -475
- package/README.md +190 -190
- package/bin/ccsm.js +194 -194
- package/lib/cliSessionWatcher.js +249 -249
- package/lib/config.js +185 -185
- package/lib/folders.js +96 -96
- package/lib/localCliSessions.js +489 -177
- package/lib/persistedSessions.js +134 -134
- package/lib/webTerminal.js +208 -208
- package/lib/workspace.js +230 -255
- package/package.json +57 -57
- package/public/css/base.css +99 -99
- package/public/css/cards.css +183 -183
- package/public/css/feedback.css +303 -303
- package/public/css/forms.css +405 -405
- package/public/css/layout.css +160 -160
- package/public/css/modal.css +190 -183
- package/public/css/responsive.css +10 -10
- package/public/css/sidebar.css +616 -601
- package/public/css/terminals.css +294 -294
- package/public/css/tokens.css +81 -79
- package/public/css/wco.css +98 -98
- package/public/css/widgets.css +1596 -1375
- package/public/index.html +105 -103
- package/public/js/api.js +272 -260
- package/public/js/components/AdoptModal.js +343 -171
- package/public/js/components/App.js +35 -35
- package/public/js/components/DirectoryPicker.js +203 -203
- package/public/js/components/EntityFormModal.js +105 -105
- package/public/js/components/Modal.js +51 -51
- package/public/js/components/OfflineBanner.js +93 -93
- package/public/js/components/PageTitleBar.js +13 -13
- package/public/js/components/Picker.js +179 -179
- package/public/js/components/Popover.js +55 -55
- package/public/js/components/Sidebar.js +270 -270
- package/public/js/components/TerminalView.js +298 -298
- package/public/js/components/useDragSort.js +67 -67
- package/public/js/dialog.js +67 -67
- package/public/js/icons.js +177 -177
- package/public/js/main.js +140 -140
- package/public/js/pages/AboutPage.js +165 -165
- package/public/js/pages/ConfigurePage.js +475 -487
- package/public/js/pages/LaunchPage.js +369 -369
- package/public/js/pages/SessionsPage.js +97 -97
- package/public/js/state.js +231 -231
- package/public/manifest.webmanifest +15 -15
- package/scripts/install.js +137 -137
- package/server.js +1126 -1117
|
@@ -1,487 +1,475 @@
|
|
|
1
|
-
// Settings page · summary lists of CLIs / Repos / Folders + General
|
|
2
|
-
// (port / work dir / theme). Each row has Edit + Delete; "+ Add"
|
|
3
|
-
// opens the same modal form used inline-from-launch.
|
|
4
|
-
|
|
5
|
-
import { html } from '../html.js';
|
|
6
|
-
import { useEffect, useState } from 'preact/hooks';
|
|
7
|
-
import {
|
|
8
|
-
config, configDirty, accentColor, folders, workspaces,
|
|
9
|
-
setAccentColor, ACCENT_DEFAULT,
|
|
10
|
-
} from '../state.js';
|
|
11
|
-
import {
|
|
12
|
-
api, loadConfig, loadWorkspaces, loadFolders,
|
|
13
|
-
createCli, updateCli, deleteCli, setDefaultCli,
|
|
14
|
-
createRepo, updateRepo, deleteRepo,
|
|
15
|
-
createFolder, renameFolder, deleteFolder, reorderFolders,
|
|
16
|
-
deleteWorkspace,
|
|
17
|
-
} from '../api.js';
|
|
18
|
-
import { setToast } from '../toast.js';
|
|
19
|
-
import { ccsmConfirm } from '../dialog.js';
|
|
20
|
-
import { Card } from '../components/Card.js';
|
|
21
|
-
import { PageTitleBar } from '../components/PageTitleBar.js';
|
|
22
|
-
import { EntityFormModal } from '../components/EntityFormModal.js';
|
|
23
|
-
import { useDragSort } from '../components/useDragSort.js';
|
|
24
|
-
import { IconPlus, IconPencil, IconClose, IconTerminal, IconFolder, IconBranch, IconForCliType, IconClaudeColor, IconCodexColor, IconCopilotColor } from '../icons.js';
|
|
25
|
-
|
|
26
|
-
// Type → smart defaults. Choosing a type in the form auto-fills resumeArgs
|
|
27
|
-
// (and command if blank) so users don't need to remember the per-CLI flag.
|
|
28
|
-
const CLI_TYPE_DEFAULTS = {
|
|
29
|
-
claude: { command: 'claude', resumeArgs: '--continue', resumeIdArgs: '--resume <id>' },
|
|
30
|
-
codex: { command: 'codex', resumeArgs: 'resume --last', resumeIdArgs: 'resume <id>' },
|
|
31
|
-
copilot: { command: 'copilot', resumeArgs: '--continue', resumeIdArgs: '--resume <id>' },
|
|
32
|
-
other: { resumeArgs: '', resumeIdArgs: '' },
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
function cliFieldsFor({ creating } = {}) {
|
|
36
|
-
return [
|
|
37
|
-
{ key: 'type', label: 'Type', type: 'iconRadio', default: 'other', options: [
|
|
38
|
-
{ value: 'claude', label: 'Claude CLI', icon: html`<${IconClaudeColor} />` },
|
|
39
|
-
{ value: 'codex', label: 'Codex CLI', icon: html`<${IconCodexColor} />` },
|
|
40
|
-
{ value: 'copilot', label: 'GitHub Copilot', icon: html`<${IconCopilotColor} />` },
|
|
41
|
-
{ value: 'other', label: 'Other', icon: html`<${IconTerminal} />` },
|
|
42
|
-
],
|
|
43
|
-
// When user picks a type while creating, prefill command + resumeArgs.
|
|
44
|
-
// For edit mode we don't override what the user already has.
|
|
45
|
-
onChange: creating ? (v, next) => {
|
|
46
|
-
const d = CLI_TYPE_DEFAULTS[v];
|
|
47
|
-
if (!d) return null;
|
|
48
|
-
const patch = { resumeArgs: d.resumeArgs, resumeIdArgs: d.resumeIdArgs };
|
|
49
|
-
if (!next.command || !next.command.trim()) patch.command = d.command || '';
|
|
50
|
-
if (!next.name || !next.name.trim()) {
|
|
51
|
-
patch.name = v === 'claude' ? 'Claude Code'
|
|
52
|
-
: v === 'codex' ? 'OpenAI Codex'
|
|
53
|
-
: v === 'copilot' ? 'GitHub Copilot'
|
|
54
|
-
: '';
|
|
55
|
-
}
|
|
56
|
-
return patch;
|
|
57
|
-
} : undefined,
|
|
58
|
-
},
|
|
59
|
-
{ key: 'name', label: 'Name', placeholder: 'My CLI', required: true },
|
|
60
|
-
{ key: 'command', label: 'Command', mono: true, placeholder: 'ccp / claude / ...', required: true },
|
|
61
|
-
{ key: 'args', label: 'Args (space-separated)', mono: true, placeholder: '',
|
|
62
|
-
hint: 'Used on every launch.' },
|
|
63
|
-
{ key: 'resumeArgs', label: 'Resume args (fallback)', mono: true, placeholder: '--continue',
|
|
64
|
-
hint: 'Used when ccsm has no captured upstream session id — usually "open last session in cwd".' },
|
|
65
|
-
{ key: 'resumeIdArgs', label: 'Resume by id args', mono: true, placeholder: '--resume <id>',
|
|
66
|
-
hint: 'Use <id> as the placeholder for the captured upstream session UUID. Leave empty to always use the fallback.' },
|
|
67
|
-
{ key: 'shell', label: 'Shell', type: 'select', default: 'direct', options: [
|
|
68
|
-
{ value: 'direct', label: 'direct (real .exe / .cmd)' },
|
|
69
|
-
{ value: 'pwsh', label: 'pwsh (PowerShell aliases & functions)' },
|
|
70
|
-
{ value: 'cmd', label: 'cmd (doskey)' },
|
|
71
|
-
] },
|
|
72
|
-
];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function Section({ title, meta, children }) {
|
|
76
|
-
return html`
|
|
77
|
-
<section class="settings-section">
|
|
78
|
-
<header class="settings-section-head">
|
|
79
|
-
<h2 class="settings-section-title">${title}</h2>
|
|
80
|
-
${meta ? html`<p class="settings-section-meta">${meta}</p>` : null}
|
|
81
|
-
</header>
|
|
82
|
-
<div class="settings-section-body">${children}</div>
|
|
83
|
-
</section>`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// ── Field definitions shared with Launch picker ──────────────────────
|
|
87
|
-
// (CLI fields built lazily via cliFieldsFor — see above.)
|
|
88
|
-
|
|
89
|
-
const repoFields = [
|
|
90
|
-
{ key: 'name', label: 'Name', placeholder: 'my-repo', autoFocus: true, required: true },
|
|
91
|
-
{ key: 'url', label: 'URL', mono: true, placeholder: 'https://github.com/me/foo.git', required: true },
|
|
92
|
-
{ key: 'defaultSelected', label: 'Pre-select on launch', type: 'checkbox',
|
|
93
|
-
hint: 'Auto-checked in the Repos picker for new sessions' },
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
const folderFields = [
|
|
97
|
-
{ key: 'name', label: 'Folder name', placeholder: 'Work / Personal / ...', autoFocus: true, required: true },
|
|
98
|
-
];
|
|
99
|
-
|
|
100
|
-
// ── Page ─────────────────────────────────────────────────────────────
|
|
101
|
-
export function ConfigurePage() {
|
|
102
|
-
const cfg = config.value;
|
|
103
|
-
const [edit, setEdit] = useState(null); // { kind, payload? }
|
|
104
|
-
const [general, setGeneral] = useState(null);
|
|
105
|
-
const [savedAt, setSavedAt] = useState('');
|
|
106
|
-
|
|
107
|
-
const folderDnd = useDragSort(
|
|
108
|
-
folders.value.map((f) => f.id),
|
|
109
|
-
async (nextIds) => {
|
|
110
|
-
try { await reorderFolders(nextIds); }
|
|
111
|
-
catch (e) { setToast(e.message, 'error'); }
|
|
112
|
-
},
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
if (cfg && !general) {
|
|
117
|
-
setGeneral({ workDir: cfg.workDir });
|
|
118
|
-
}
|
|
119
|
-
}, [cfg]);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<${
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
${
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
{
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
<span class="entity-row-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
<input type="color" value=${current}
|
|
477
|
-
onInput=${(e) => setAccentColor(e.target.value)} />
|
|
478
|
-
<input type="text" class="accent-hex mono" value=${text}
|
|
479
|
-
spellcheck="false" maxlength="7"
|
|
480
|
-
onInput=${onText} placeholder="#rrggbb" />
|
|
481
|
-
<button type="button" class="accent-reset"
|
|
482
|
-
onClick=${() => { setAccentColor(ACCENT_DEFAULT); setCustomOpen(false); }}>
|
|
483
|
-
Reset
|
|
484
|
-
</button>
|
|
485
|
-
</div>` : null}
|
|
486
|
-
</div>`;
|
|
487
|
-
}
|
|
1
|
+
// Settings page · summary lists of CLIs / Repos / Folders + General
|
|
2
|
+
// (port / work dir / theme). Each row has Edit + Delete; "+ Add"
|
|
3
|
+
// opens the same modal form used inline-from-launch.
|
|
4
|
+
|
|
5
|
+
import { html } from '../html.js';
|
|
6
|
+
import { useEffect, useState } from 'preact/hooks';
|
|
7
|
+
import {
|
|
8
|
+
config, configDirty, accentColor, folders, workspaces,
|
|
9
|
+
setAccentColor, ACCENT_DEFAULT,
|
|
10
|
+
} from '../state.js';
|
|
11
|
+
import {
|
|
12
|
+
api, loadConfig, loadWorkspaces, loadFolders,
|
|
13
|
+
createCli, updateCli, deleteCli, setDefaultCli,
|
|
14
|
+
createRepo, updateRepo, deleteRepo,
|
|
15
|
+
createFolder, renameFolder, deleteFolder, reorderFolders,
|
|
16
|
+
deleteWorkspace,
|
|
17
|
+
} from '../api.js';
|
|
18
|
+
import { setToast } from '../toast.js';
|
|
19
|
+
import { ccsmConfirm } from '../dialog.js';
|
|
20
|
+
import { Card } from '../components/Card.js';
|
|
21
|
+
import { PageTitleBar } from '../components/PageTitleBar.js';
|
|
22
|
+
import { EntityFormModal } from '../components/EntityFormModal.js';
|
|
23
|
+
import { useDragSort } from '../components/useDragSort.js';
|
|
24
|
+
import { IconPlus, IconPencil, IconClose, IconTerminal, IconFolder, IconBranch, IconForCliType, IconClaudeColor, IconCodexColor, IconCopilotColor } from '../icons.js';
|
|
25
|
+
|
|
26
|
+
// Type → smart defaults. Choosing a type in the form auto-fills resumeArgs
|
|
27
|
+
// (and command if blank) so users don't need to remember the per-CLI flag.
|
|
28
|
+
const CLI_TYPE_DEFAULTS = {
|
|
29
|
+
claude: { command: 'claude', resumeArgs: '--continue', resumeIdArgs: '--resume <id>' },
|
|
30
|
+
codex: { command: 'codex', resumeArgs: 'resume --last', resumeIdArgs: 'resume <id>' },
|
|
31
|
+
copilot: { command: 'copilot', resumeArgs: '--continue', resumeIdArgs: '--resume <id>' },
|
|
32
|
+
other: { resumeArgs: '', resumeIdArgs: '' },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function cliFieldsFor({ creating } = {}) {
|
|
36
|
+
return [
|
|
37
|
+
{ key: 'type', label: 'Type', type: 'iconRadio', default: 'other', options: [
|
|
38
|
+
{ value: 'claude', label: 'Claude CLI', icon: html`<${IconClaudeColor} />` },
|
|
39
|
+
{ value: 'codex', label: 'Codex CLI', icon: html`<${IconCodexColor} />` },
|
|
40
|
+
{ value: 'copilot', label: 'GitHub Copilot', icon: html`<${IconCopilotColor} />` },
|
|
41
|
+
{ value: 'other', label: 'Other', icon: html`<${IconTerminal} />` },
|
|
42
|
+
],
|
|
43
|
+
// When user picks a type while creating, prefill command + resumeArgs.
|
|
44
|
+
// For edit mode we don't override what the user already has.
|
|
45
|
+
onChange: creating ? (v, next) => {
|
|
46
|
+
const d = CLI_TYPE_DEFAULTS[v];
|
|
47
|
+
if (!d) return null;
|
|
48
|
+
const patch = { resumeArgs: d.resumeArgs, resumeIdArgs: d.resumeIdArgs };
|
|
49
|
+
if (!next.command || !next.command.trim()) patch.command = d.command || '';
|
|
50
|
+
if (!next.name || !next.name.trim()) {
|
|
51
|
+
patch.name = v === 'claude' ? 'Claude Code'
|
|
52
|
+
: v === 'codex' ? 'OpenAI Codex'
|
|
53
|
+
: v === 'copilot' ? 'GitHub Copilot'
|
|
54
|
+
: '';
|
|
55
|
+
}
|
|
56
|
+
return patch;
|
|
57
|
+
} : undefined,
|
|
58
|
+
},
|
|
59
|
+
{ key: 'name', label: 'Name', placeholder: 'My CLI', required: true },
|
|
60
|
+
{ key: 'command', label: 'Command', mono: true, placeholder: 'ccp / claude / ...', required: true },
|
|
61
|
+
{ key: 'args', label: 'Args (space-separated)', mono: true, placeholder: '',
|
|
62
|
+
hint: 'Used on every launch.' },
|
|
63
|
+
{ key: 'resumeArgs', label: 'Resume args (fallback)', mono: true, placeholder: '--continue',
|
|
64
|
+
hint: 'Used when ccsm has no captured upstream session id — usually "open last session in cwd".' },
|
|
65
|
+
{ key: 'resumeIdArgs', label: 'Resume by id args', mono: true, placeholder: '--resume <id>',
|
|
66
|
+
hint: 'Use <id> as the placeholder for the captured upstream session UUID. Leave empty to always use the fallback.' },
|
|
67
|
+
{ key: 'shell', label: 'Shell', type: 'select', default: 'direct', options: [
|
|
68
|
+
{ value: 'direct', label: 'direct (real .exe / .cmd)' },
|
|
69
|
+
{ value: 'pwsh', label: 'pwsh (PowerShell aliases & functions)' },
|
|
70
|
+
{ value: 'cmd', label: 'cmd (doskey)' },
|
|
71
|
+
] },
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function Section({ title, meta, children }) {
|
|
76
|
+
return html`
|
|
77
|
+
<section class="settings-section">
|
|
78
|
+
<header class="settings-section-head">
|
|
79
|
+
<h2 class="settings-section-title">${title}</h2>
|
|
80
|
+
${meta ? html`<p class="settings-section-meta">${meta}</p>` : null}
|
|
81
|
+
</header>
|
|
82
|
+
<div class="settings-section-body">${children}</div>
|
|
83
|
+
</section>`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ── Field definitions shared with Launch picker ──────────────────────
|
|
87
|
+
// (CLI fields built lazily via cliFieldsFor — see above.)
|
|
88
|
+
|
|
89
|
+
const repoFields = [
|
|
90
|
+
{ key: 'name', label: 'Name', placeholder: 'my-repo', autoFocus: true, required: true },
|
|
91
|
+
{ key: 'url', label: 'URL', mono: true, placeholder: 'https://github.com/me/foo.git', required: true },
|
|
92
|
+
{ key: 'defaultSelected', label: 'Pre-select on launch', type: 'checkbox',
|
|
93
|
+
hint: 'Auto-checked in the Repos picker for new sessions' },
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
const folderFields = [
|
|
97
|
+
{ key: 'name', label: 'Folder name', placeholder: 'Work / Personal / ...', autoFocus: true, required: true },
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
// ── Page ─────────────────────────────────────────────────────────────
|
|
101
|
+
export function ConfigurePage() {
|
|
102
|
+
const cfg = config.value;
|
|
103
|
+
const [edit, setEdit] = useState(null); // { kind, payload? }
|
|
104
|
+
const [general, setGeneral] = useState(null);
|
|
105
|
+
const [savedAt, setSavedAt] = useState('');
|
|
106
|
+
|
|
107
|
+
const folderDnd = useDragSort(
|
|
108
|
+
folders.value.map((f) => f.id),
|
|
109
|
+
async (nextIds) => {
|
|
110
|
+
try { await reorderFolders(nextIds); }
|
|
111
|
+
catch (e) { setToast(e.message, 'error'); }
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (cfg && !general) {
|
|
117
|
+
setGeneral({ workDir: cfg.workDir });
|
|
118
|
+
}
|
|
119
|
+
}, [cfg]);
|
|
120
|
+
|
|
121
|
+
if (!cfg || !general) return null;
|
|
122
|
+
|
|
123
|
+
const saveGeneral = async (patch) => {
|
|
124
|
+
const merged = { ...general, ...patch };
|
|
125
|
+
setGeneral(merged);
|
|
126
|
+
try {
|
|
127
|
+
const saved = await api('PUT', '/api/config', {
|
|
128
|
+
...cfg,
|
|
129
|
+
workDir: (merged.workDir || '').trim(),
|
|
130
|
+
});
|
|
131
|
+
config.value = saved;
|
|
132
|
+
setToast('saved');
|
|
133
|
+
await loadWorkspaces();
|
|
134
|
+
} catch (e) { setToast(e.message, 'error'); }
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const close = () => setEdit(null);
|
|
138
|
+
|
|
139
|
+
return html`
|
|
140
|
+
<${PageTitleBar} title="Settings" />
|
|
141
|
+
<div class="settings-scroll">
|
|
142
|
+
|
|
143
|
+
<${Section} title="General">
|
|
144
|
+
<div class="config-grid">
|
|
145
|
+
<div class="field">
|
|
146
|
+
<span class="label">Theme accent</span>
|
|
147
|
+
<${AccentPicker} />
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</${Section}>
|
|
151
|
+
|
|
152
|
+
<${Section} title="CLIs" meta=${html`Built-in entries (<code>claude</code>, <code>codex</code>) auto-probe your PATH.`}>
|
|
153
|
+
<${EntityList}
|
|
154
|
+
kind="cli"
|
|
155
|
+
addLabel="Add CLI"
|
|
156
|
+
items=${(cfg.clis || []).map((c) => {
|
|
157
|
+
const tags = [];
|
|
158
|
+
if (cfg.defaultCliId === c.id) tags.push({ label: 'default', tone: 'accent' });
|
|
159
|
+
if (c.builtin) tags.push({ label: c.installed ? 'installed' : 'not found', tone: c.installed ? 'ok' : 'warn' });
|
|
160
|
+
const Icon = IconForCliType(c.type);
|
|
161
|
+
return {
|
|
162
|
+
id: c.id,
|
|
163
|
+
icon: html`<${Icon} />`,
|
|
164
|
+
primary: c.name,
|
|
165
|
+
secondary: html`<span class="mono">${c.command}${c.args?.length ? ' ' + c.args.join(' ') : ''}</span>${c.shell && c.shell !== 'direct' ? html` · ${c.shell}` : null}`,
|
|
166
|
+
badges: tags,
|
|
167
|
+
undeletable: c.builtin,
|
|
168
|
+
raw: c,
|
|
169
|
+
};
|
|
170
|
+
})}
|
|
171
|
+
onAdd=${() => setEdit({ kind: 'cli-new' })}
|
|
172
|
+
onEdit=${(it) => setEdit({ kind: 'cli-edit', payload: it.raw })}
|
|
173
|
+
onDelete=${async (it) => {
|
|
174
|
+
if (it.undeletable) return setToast(`"${it.primary}" is built-in and can't be deleted`, 'error');
|
|
175
|
+
if (cfg.clis.length === 1) return setToast('cannot delete the last CLI', 'error');
|
|
176
|
+
const ok = await ccsmConfirm(`Delete CLI "${it.primary}"?`, { okLabel: 'Delete', danger: true });
|
|
177
|
+
if (!ok) return;
|
|
178
|
+
try { await deleteCli(it.id); setToast('deleted'); }
|
|
179
|
+
catch (e) { setToast(e.message, 'error'); }
|
|
180
|
+
}}
|
|
181
|
+
onActivate=${async (it) => {
|
|
182
|
+
if (cfg.defaultCliId === it.id) return;
|
|
183
|
+
try { await setDefaultCli(it.id); setToast(`default · ${it.primary}`); }
|
|
184
|
+
catch (e) { setToast(e.message, 'error'); }
|
|
185
|
+
}}
|
|
186
|
+
emptyHint="No CLIs configured."
|
|
187
|
+
/>
|
|
188
|
+
</${Section}>
|
|
189
|
+
|
|
190
|
+
<${Section} title="Repositories" meta="Available for clone-on-launch into a new workspace.">
|
|
191
|
+
<${EntityList}
|
|
192
|
+
kind="repo"
|
|
193
|
+
addLabel="Add Repo"
|
|
194
|
+
items=${(cfg.repos || []).map((r) => ({
|
|
195
|
+
id: r.name,
|
|
196
|
+
icon: html`<${IconBranch} />`,
|
|
197
|
+
primary: r.name,
|
|
198
|
+
secondary: html`<span class="mono">${r.url}</span>`,
|
|
199
|
+
badge: r.defaultSelected ? 'auto' : null,
|
|
200
|
+
raw: r,
|
|
201
|
+
}))}
|
|
202
|
+
onAdd=${() => setEdit({ kind: 'repo-new' })}
|
|
203
|
+
onEdit=${(it) => setEdit({ kind: 'repo-edit', payload: it.raw })}
|
|
204
|
+
onDelete=${async (it) => {
|
|
205
|
+
const ok = await ccsmConfirm(`Remove repo "${it.primary}" from the list?`, { okLabel: 'Remove', danger: true });
|
|
206
|
+
if (!ok) return;
|
|
207
|
+
try { await deleteRepo(it.id); setToast('removed'); }
|
|
208
|
+
catch (e) { setToast(e.message, 'error'); }
|
|
209
|
+
}}
|
|
210
|
+
emptyHint="No repos configured."
|
|
211
|
+
/>
|
|
212
|
+
</${Section}>
|
|
213
|
+
|
|
214
|
+
<${Section} title="Folders" meta="Buckets that group sessions in the sidebar.">
|
|
215
|
+
<${EntityList}
|
|
216
|
+
kind="folder"
|
|
217
|
+
addLabel="Add Folder"
|
|
218
|
+
dnd=${folderDnd}
|
|
219
|
+
items=${folders.value.map((f) => ({
|
|
220
|
+
id: f.id,
|
|
221
|
+
icon: html`<${IconFolder} />`,
|
|
222
|
+
primary: f.name,
|
|
223
|
+
secondary: null,
|
|
224
|
+
raw: f,
|
|
225
|
+
}))}
|
|
226
|
+
onAdd=${() => setEdit({ kind: 'folder-new' })}
|
|
227
|
+
onEdit=${(it) => setEdit({ kind: 'folder-edit', payload: it.raw })}
|
|
228
|
+
onDelete=${async (it) => {
|
|
229
|
+
const ok = await ccsmConfirm(`Delete folder "${it.primary}"? Sessions inside move to Unsorted.`, { okLabel: 'Delete', danger: true });
|
|
230
|
+
if (!ok) return;
|
|
231
|
+
try { await deleteFolder(it.id); setToast('deleted'); }
|
|
232
|
+
catch (e) { setToast(e.message, 'error'); }
|
|
233
|
+
}}
|
|
234
|
+
emptyHint="No folders yet."
|
|
235
|
+
/>
|
|
236
|
+
</${Section}>
|
|
237
|
+
|
|
238
|
+
<${Section} title="Workspaces"
|
|
239
|
+
meta=${html`Auto-allocated <code>ws-N</code> folders under the work directory. Each holds one or more repo clones.`}>
|
|
240
|
+
<div class="config-grid">
|
|
241
|
+
<label class="field">
|
|
242
|
+
<span class="label">Work directory</span>
|
|
243
|
+
<input type="text" value=${general.workDir}
|
|
244
|
+
onChange=${(e) => saveGeneral({ workDir: e.target.value })} />
|
|
245
|
+
</label>
|
|
246
|
+
</div>
|
|
247
|
+
<${WorkspaceList} />
|
|
248
|
+
</${Section}>
|
|
249
|
+
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
${edit?.kind === 'cli-new' ? html`
|
|
253
|
+
<${EntityFormModal} title="New CLI" fields=${cliFieldsFor({ creating: true })}
|
|
254
|
+
onClose=${close} submitLabel="Create"
|
|
255
|
+
onSubmit=${async (v) => {
|
|
256
|
+
try { await createCli(v); setToast(`created CLI · ${v.name}`); }
|
|
257
|
+
catch (e) { setToast(e.message, 'error'); throw e; }
|
|
258
|
+
}} />` : null}
|
|
259
|
+
|
|
260
|
+
${edit?.kind === 'cli-edit' ? html`
|
|
261
|
+
<${EntityFormModal} title=${`Edit ${edit.payload.name}`} fields=${cliFieldsFor()}
|
|
262
|
+
readOnlyKeys=${edit.payload.builtin ? ['type', 'command'] : []}
|
|
263
|
+
initial=${{
|
|
264
|
+
...edit.payload,
|
|
265
|
+
args: (edit.payload.args || []).join(' '),
|
|
266
|
+
resumeArgs: (edit.payload.resumeArgs || []).join(' '),
|
|
267
|
+
resumeIdArgs: (edit.payload.resumeIdArgs || []).join(' '),
|
|
268
|
+
}}
|
|
269
|
+
onClose=${close}
|
|
270
|
+
onSubmit=${async (v) => {
|
|
271
|
+
try {
|
|
272
|
+
const patch = {
|
|
273
|
+
...v,
|
|
274
|
+
args: typeof v.args === 'string' ? v.args.split(/\s+/).filter(Boolean) : v.args,
|
|
275
|
+
resumeArgs: typeof v.resumeArgs === 'string' ? v.resumeArgs.split(/\s+/).filter(Boolean) : v.resumeArgs,
|
|
276
|
+
resumeIdArgs: typeof v.resumeIdArgs === 'string' ? v.resumeIdArgs.split(/\s+/).filter(Boolean) : v.resumeIdArgs,
|
|
277
|
+
};
|
|
278
|
+
// command is locked on builtins — drop any tampered value.
|
|
279
|
+
if (edit.payload.builtin) delete patch.command;
|
|
280
|
+
await updateCli(edit.payload.id, patch);
|
|
281
|
+
setToast('saved');
|
|
282
|
+
} catch (e) { setToast(e.message, 'error'); throw e; }
|
|
283
|
+
}} />` : null}
|
|
284
|
+
|
|
285
|
+
${edit?.kind === 'repo-new' ? html`
|
|
286
|
+
<${EntityFormModal} title="New repo" fields=${repoFields}
|
|
287
|
+
onClose=${close} submitLabel="Add"
|
|
288
|
+
onSubmit=${async (v) => {
|
|
289
|
+
try { await createRepo(v); setToast(`added repo · ${v.name}`); }
|
|
290
|
+
catch (e) { setToast(e.message, 'error'); throw e; }
|
|
291
|
+
}} />` : null}
|
|
292
|
+
|
|
293
|
+
${edit?.kind === 'repo-edit' ? html`
|
|
294
|
+
<${EntityFormModal} title=${`Edit ${edit.payload.name}`} fields=${repoFields}
|
|
295
|
+
initial=${edit.payload}
|
|
296
|
+
onClose=${close}
|
|
297
|
+
onSubmit=${async (v) => {
|
|
298
|
+
try { await updateRepo(edit.payload.name, v); setToast('saved'); }
|
|
299
|
+
catch (e) { setToast(e.message, 'error'); throw e; }
|
|
300
|
+
}} />` : null}
|
|
301
|
+
|
|
302
|
+
${edit?.kind === 'folder-new' ? html`
|
|
303
|
+
<${EntityFormModal} title="New folder" fields=${folderFields}
|
|
304
|
+
onClose=${close} submitLabel="Create"
|
|
305
|
+
onSubmit=${async (v) => {
|
|
306
|
+
try { await createFolder(v.name); await loadFolders(); setToast(`created folder · ${v.name}`); }
|
|
307
|
+
catch (e) { setToast(e.message, 'error'); throw e; }
|
|
308
|
+
}} />` : null}
|
|
309
|
+
|
|
310
|
+
${edit?.kind === 'folder-edit' ? html`
|
|
311
|
+
<${EntityFormModal} title=${`Rename ${edit.payload.name}`} fields=${folderFields}
|
|
312
|
+
initial=${edit.payload}
|
|
313
|
+
onClose=${close}
|
|
314
|
+
onSubmit=${async (v) => {
|
|
315
|
+
try { await renameFolder(edit.payload.id, v.name.trim()); await loadFolders(); setToast('renamed'); }
|
|
316
|
+
catch (e) { setToast(e.message, 'error'); throw e; }
|
|
317
|
+
}} />` : null}
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Generic "list of rows + Add button" used by all three sections.
|
|
322
|
+
function EntityList({ items, onAdd, onEdit, onDelete, onActivate, emptyHint, dnd, addLabel = 'Add' }) {
|
|
323
|
+
return html`
|
|
324
|
+
<div class="entity-list">
|
|
325
|
+
${items.length === 0
|
|
326
|
+
? html`<div class="entity-empty">${emptyHint}</div>`
|
|
327
|
+
: items.map((it) => {
|
|
328
|
+
const rowProps = dnd ? dnd.rowProps(it.id) : {};
|
|
329
|
+
const handleProps = dnd ? dnd.handleProps(it.id) : {};
|
|
330
|
+
const badges = it.badges || (it.badge ? [{ label: it.badge, tone: 'accent' }] : []);
|
|
331
|
+
return html`
|
|
332
|
+
<div class=${`entity-row${dnd ? ' is-draggable' : ''}`} key=${it.id}
|
|
333
|
+
...${rowProps} ...${handleProps}>
|
|
334
|
+
${dnd ? html`<span class="entity-row-grip" aria-hidden="true">⋮⋮</span>` : null}
|
|
335
|
+
<span class="entity-row-icon">${it.icon}</span>
|
|
336
|
+
<span class="entity-row-main">
|
|
337
|
+
<span class="entity-row-primary">
|
|
338
|
+
${it.primary}
|
|
339
|
+
${badges.map((b) => html`
|
|
340
|
+
<span class=${`entity-row-badge tone-${b.tone || 'accent'}`}>${b.label}</span>`)}
|
|
341
|
+
</span>
|
|
342
|
+
${it.secondary ? html`<span class="entity-row-secondary">${it.secondary}</span>` : null}
|
|
343
|
+
</span>
|
|
344
|
+
<span class="entity-row-actions">
|
|
345
|
+
${onActivate ? html`
|
|
346
|
+
<button class="entity-row-action" title="Set default"
|
|
347
|
+
onClick=${() => onActivate(it)}>★</button>` : null}
|
|
348
|
+
<button class="entity-row-action" title="Edit"
|
|
349
|
+
onClick=${() => onEdit(it)}><${IconPencil} /></button>
|
|
350
|
+
${it.undeletable ? null : html`
|
|
351
|
+
<button class="entity-row-action danger" title="Delete"
|
|
352
|
+
onClick=${() => onDelete(it)}><${IconClose} /></button>`}
|
|
353
|
+
</span>
|
|
354
|
+
</div>`;
|
|
355
|
+
})}
|
|
356
|
+
<button class="entity-add" type="button" onClick=${onAdd}>
|
|
357
|
+
<span>${addLabel}</span>
|
|
358
|
+
</button>
|
|
359
|
+
</div>`;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// ── Workspace list ───────────────────────────────────────────────────
|
|
363
|
+
function WorkspaceList() {
|
|
364
|
+
const ws = workspaces.value || [];
|
|
365
|
+
if (ws.length === 0) {
|
|
366
|
+
return html`<div class="entity-empty">No workspaces yet — they're created automatically on launch.</div>`;
|
|
367
|
+
}
|
|
368
|
+
const onDelete = async (w) => {
|
|
369
|
+
if (w.inUse) return setToast(`"${w.name}" is in use by a running session`, 'error');
|
|
370
|
+
const ok = await ccsmConfirm(
|
|
371
|
+
`Delete workspace "${w.name}"? This removes the directory and all repo clones inside.`,
|
|
372
|
+
{ okLabel: 'Delete', danger: true },
|
|
373
|
+
);
|
|
374
|
+
if (!ok) return;
|
|
375
|
+
try {
|
|
376
|
+
await deleteWorkspace(w.name);
|
|
377
|
+
await loadWorkspaces();
|
|
378
|
+
setToast(`deleted · ${w.name}`);
|
|
379
|
+
} catch (e) { setToast(e.message, 'error'); }
|
|
380
|
+
};
|
|
381
|
+
return html`
|
|
382
|
+
<div class="entity-list">
|
|
383
|
+
${ws.map((w) => {
|
|
384
|
+
const repoCount = (w.repos || []).filter((r) => r.exists).length;
|
|
385
|
+
return html`
|
|
386
|
+
<div class="entity-row" key=${w.path}>
|
|
387
|
+
<span class="entity-row-icon"><${IconFolder} /></span>
|
|
388
|
+
<span class="entity-row-main">
|
|
389
|
+
<span class="entity-row-primary">
|
|
390
|
+
${w.name}
|
|
391
|
+
${w.inUse ? html`<span class="entity-row-badge tone-warn">in use</span>` : null}
|
|
392
|
+
</span>
|
|
393
|
+
<span class="entity-row-secondary">
|
|
394
|
+
<span class="mono">${w.path}</span>
|
|
395
|
+
${repoCount > 0 ? html` · ${repoCount} ${repoCount === 1 ? 'repo' : 'repos'}` : null}
|
|
396
|
+
</span>
|
|
397
|
+
</span>
|
|
398
|
+
<span class="entity-row-actions">
|
|
399
|
+
<button class=${`entity-row-action danger${w.inUse ? ' is-disabled' : ''}`}
|
|
400
|
+
title=${w.inUse ? 'In use by a running session' : 'Delete'}
|
|
401
|
+
disabled=${w.inUse}
|
|
402
|
+
onClick=${() => onDelete(w)}><${IconClose} /></button>
|
|
403
|
+
</span>
|
|
404
|
+
</div>`;
|
|
405
|
+
})}
|
|
406
|
+
</div>`;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// ── Accent picker (unchanged) ────────────────────────────────────────
|
|
410
|
+
const PRESETS = [
|
|
411
|
+
{ name: 'Ocean', hex: '#2f6fa3' },
|
|
412
|
+
{ name: 'Claude copper', hex: '#b3614a' },
|
|
413
|
+
{ name: 'Anthropic ink', hex: '#1a1815' },
|
|
414
|
+
{ name: 'Forest', hex: '#3f7a4a' },
|
|
415
|
+
{ name: 'Amber', hex: '#c4892b' },
|
|
416
|
+
{ name: 'Berry', hex: '#a44b78' },
|
|
417
|
+
{ name: 'Slate', hex: '#4a5563' },
|
|
418
|
+
{ name: 'Crimson', hex: '#b73f3f' },
|
|
419
|
+
];
|
|
420
|
+
|
|
421
|
+
function AccentPicker() {
|
|
422
|
+
const current = (accentColor.value || '').toLowerCase();
|
|
423
|
+
const matchedPreset = PRESETS.find((p) => p.hex.toLowerCase() === current);
|
|
424
|
+
const [customOpen, setCustomOpen] = useState(!matchedPreset);
|
|
425
|
+
const [text, setText] = useState(current);
|
|
426
|
+
useEffect(() => { setText(current); }, [current]);
|
|
427
|
+
|
|
428
|
+
const pickPreset = (hex) => {
|
|
429
|
+
setAccentColor(hex);
|
|
430
|
+
setCustomOpen(false);
|
|
431
|
+
};
|
|
432
|
+
const onText = (e) => {
|
|
433
|
+
const v = e.target.value.trim();
|
|
434
|
+
setText(v);
|
|
435
|
+
if (/^#[0-9a-fA-F]{6}$/.test(v)) setAccentColor(v);
|
|
436
|
+
};
|
|
437
|
+
return html`
|
|
438
|
+
<div class="accent-picker">
|
|
439
|
+
<div class="accent-chips">
|
|
440
|
+
${PRESETS.map((p) => {
|
|
441
|
+
const active = current === p.hex.toLowerCase();
|
|
442
|
+
return html`
|
|
443
|
+
<button key=${p.hex} type="button"
|
|
444
|
+
class=${`accent-chip${active ? ' is-active' : ''}`}
|
|
445
|
+
style=${`--c:${p.hex}`}
|
|
446
|
+
title=${p.hex}
|
|
447
|
+
onClick=${() => pickPreset(p.hex)}>
|
|
448
|
+
<span class="accent-chip-dot" aria-hidden="true"></span>
|
|
449
|
+
<span class="accent-chip-name">${p.name}</span>
|
|
450
|
+
</button>`;
|
|
451
|
+
})}
|
|
452
|
+
<button type="button"
|
|
453
|
+
class=${`accent-chip accent-chip-custom${customOpen ? ' is-open' : ''}${!matchedPreset ? ' is-active' : ''}`}
|
|
454
|
+
style=${!matchedPreset ? `--c:${current}` : ''}
|
|
455
|
+
onClick=${() => setCustomOpen((v) => !v)}>
|
|
456
|
+
${!matchedPreset
|
|
457
|
+
? html`<span class="accent-chip-dot" aria-hidden="true"></span>`
|
|
458
|
+
: html`<span class="accent-chip-plus" aria-hidden="true">+</span>`}
|
|
459
|
+
<span class="accent-chip-name">Custom</span>
|
|
460
|
+
</button>
|
|
461
|
+
</div>
|
|
462
|
+
${customOpen ? html`
|
|
463
|
+
<div class="accent-custom">
|
|
464
|
+
<input type="color" value=${current}
|
|
465
|
+
onInput=${(e) => setAccentColor(e.target.value)} />
|
|
466
|
+
<input type="text" class="accent-hex mono" value=${text}
|
|
467
|
+
spellcheck="false" maxlength="7"
|
|
468
|
+
onInput=${onText} placeholder="#rrggbb" />
|
|
469
|
+
<button type="button" class="accent-reset"
|
|
470
|
+
onClick=${() => { setAccentColor(ACCENT_DEFAULT); setCustomOpen(false); }}>
|
|
471
|
+
Reset
|
|
472
|
+
</button>
|
|
473
|
+
</div>` : null}
|
|
474
|
+
</div>`;
|
|
475
|
+
}
|