@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.
Files changed (48) hide show
  1. package/CLAUDE.md +475 -475
  2. package/README.md +190 -190
  3. package/bin/ccsm.js +194 -194
  4. package/lib/cliSessionWatcher.js +249 -249
  5. package/lib/config.js +185 -185
  6. package/lib/folders.js +96 -96
  7. package/lib/localCliSessions.js +489 -177
  8. package/lib/persistedSessions.js +134 -134
  9. package/lib/webTerminal.js +208 -208
  10. package/lib/workspace.js +230 -255
  11. package/package.json +57 -57
  12. package/public/css/base.css +99 -99
  13. package/public/css/cards.css +183 -183
  14. package/public/css/feedback.css +303 -303
  15. package/public/css/forms.css +405 -405
  16. package/public/css/layout.css +160 -160
  17. package/public/css/modal.css +190 -183
  18. package/public/css/responsive.css +10 -10
  19. package/public/css/sidebar.css +616 -601
  20. package/public/css/terminals.css +294 -294
  21. package/public/css/tokens.css +81 -79
  22. package/public/css/wco.css +98 -98
  23. package/public/css/widgets.css +1596 -1375
  24. package/public/index.html +105 -103
  25. package/public/js/api.js +272 -260
  26. package/public/js/components/AdoptModal.js +343 -171
  27. package/public/js/components/App.js +35 -35
  28. package/public/js/components/DirectoryPicker.js +203 -203
  29. package/public/js/components/EntityFormModal.js +105 -105
  30. package/public/js/components/Modal.js +51 -51
  31. package/public/js/components/OfflineBanner.js +93 -93
  32. package/public/js/components/PageTitleBar.js +13 -13
  33. package/public/js/components/Picker.js +179 -179
  34. package/public/js/components/Popover.js +55 -55
  35. package/public/js/components/Sidebar.js +270 -270
  36. package/public/js/components/TerminalView.js +298 -298
  37. package/public/js/components/useDragSort.js +67 -67
  38. package/public/js/dialog.js +67 -67
  39. package/public/js/icons.js +177 -177
  40. package/public/js/main.js +140 -140
  41. package/public/js/pages/AboutPage.js +165 -165
  42. package/public/js/pages/ConfigurePage.js +475 -487
  43. package/public/js/pages/LaunchPage.js +369 -369
  44. package/public/js/pages/SessionsPage.js +97 -97
  45. package/public/js/state.js +231 -231
  46. package/public/manifest.webmanifest +15 -15
  47. package/scripts/install.js +137 -137
  48. 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
- // Refresh workspace list when the page mounts so sizes are fresh.
122
- useEffect(() => { loadWorkspaces().catch(() => {}); }, []);
123
-
124
- if (!cfg || !general) return null;
125
-
126
- const saveGeneral = async (patch) => {
127
- const merged = { ...general, ...patch };
128
- setGeneral(merged);
129
- try {
130
- const saved = await api('PUT', '/api/config', {
131
- ...cfg,
132
- workDir: (merged.workDir || '').trim(),
133
- });
134
- config.value = saved;
135
- setToast('saved');
136
- await loadWorkspaces();
137
- } catch (e) { setToast(e.message, 'error'); }
138
- };
139
-
140
- const close = () => setEdit(null);
141
-
142
- return html`
143
- <${PageTitleBar} title="Settings" />
144
- <div class="settings-scroll">
145
-
146
- <${Section} title="General">
147
- <div class="config-grid">
148
- <div class="field">
149
- <span class="label">Theme accent</span>
150
- <${AccentPicker} />
151
- </div>
152
- </div>
153
- </${Section}>
154
-
155
- <${Section} title="CLIs" meta=${html`Built-in entries (<code>claude</code>, <code>codex</code>) auto-probe your PATH.`}>
156
- <${EntityList}
157
- kind="cli"
158
- addLabel="Add CLI"
159
- items=${(cfg.clis || []).map((c) => {
160
- const tags = [];
161
- if (cfg.defaultCliId === c.id) tags.push({ label: 'default', tone: 'accent' });
162
- if (c.builtin) tags.push({ label: c.installed ? 'installed' : 'not found', tone: c.installed ? 'ok' : 'warn' });
163
- const Icon = IconForCliType(c.type);
164
- return {
165
- id: c.id,
166
- icon: html`<${Icon} />`,
167
- primary: c.name,
168
- secondary: html`<span class="mono">${c.command}${c.args?.length ? ' ' + c.args.join(' ') : ''}</span>${c.shell && c.shell !== 'direct' ? html` · ${c.shell}` : null}`,
169
- badges: tags,
170
- undeletable: c.builtin,
171
- raw: c,
172
- };
173
- })}
174
- onAdd=${() => setEdit({ kind: 'cli-new' })}
175
- onEdit=${(it) => setEdit({ kind: 'cli-edit', payload: it.raw })}
176
- onDelete=${async (it) => {
177
- if (it.undeletable) return setToast(`"${it.primary}" is built-in and can't be deleted`, 'error');
178
- if (cfg.clis.length === 1) return setToast('cannot delete the last CLI', 'error');
179
- const ok = await ccsmConfirm(`Delete CLI "${it.primary}"?`, { okLabel: 'Delete', danger: true });
180
- if (!ok) return;
181
- try { await deleteCli(it.id); setToast('deleted'); }
182
- catch (e) { setToast(e.message, 'error'); }
183
- }}
184
- onActivate=${async (it) => {
185
- if (cfg.defaultCliId === it.id) return;
186
- try { await setDefaultCli(it.id); setToast(`default · ${it.primary}`); }
187
- catch (e) { setToast(e.message, 'error'); }
188
- }}
189
- emptyHint="No CLIs configured."
190
- />
191
- </${Section}>
192
-
193
- <${Section} title="Repositories" meta="Available for clone-on-launch into a new workspace.">
194
- <${EntityList}
195
- kind="repo"
196
- addLabel="Add Repo"
197
- items=${(cfg.repos || []).map((r) => ({
198
- id: r.name,
199
- icon: html`<${IconBranch} />`,
200
- primary: r.name,
201
- secondary: html`<span class="mono">${r.url}</span>`,
202
- badge: r.defaultSelected ? 'auto' : null,
203
- raw: r,
204
- }))}
205
- onAdd=${() => setEdit({ kind: 'repo-new' })}
206
- onEdit=${(it) => setEdit({ kind: 'repo-edit', payload: it.raw })}
207
- onDelete=${async (it) => {
208
- const ok = await ccsmConfirm(`Remove repo "${it.primary}" from the list?`, { okLabel: 'Remove', danger: true });
209
- if (!ok) return;
210
- try { await deleteRepo(it.id); setToast('removed'); }
211
- catch (e) { setToast(e.message, 'error'); }
212
- }}
213
- emptyHint="No repos configured."
214
- />
215
- </${Section}>
216
-
217
- <${Section} title="Folders" meta="Buckets that group sessions in the sidebar.">
218
- <${EntityList}
219
- kind="folder"
220
- addLabel="Add Folder"
221
- dnd=${folderDnd}
222
- items=${folders.value.map((f) => ({
223
- id: f.id,
224
- icon: html`<${IconFolder} />`,
225
- primary: f.name,
226
- secondary: null,
227
- raw: f,
228
- }))}
229
- onAdd=${() => setEdit({ kind: 'folder-new' })}
230
- onEdit=${(it) => setEdit({ kind: 'folder-edit', payload: it.raw })}
231
- onDelete=${async (it) => {
232
- const ok = await ccsmConfirm(`Delete folder "${it.primary}"? Sessions inside move to Unsorted.`, { okLabel: 'Delete', danger: true });
233
- if (!ok) return;
234
- try { await deleteFolder(it.id); setToast('deleted'); }
235
- catch (e) { setToast(e.message, 'error'); }
236
- }}
237
- emptyHint="No folders yet."
238
- />
239
- </${Section}>
240
-
241
- <${Section} title="Workspaces"
242
- meta=${html`Auto-allocated <code>ws-N</code> folders under the work directory. Each holds one or more repo clones.`}>
243
- <div class="config-grid">
244
- <label class="field">
245
- <span class="label">Work directory</span>
246
- <input type="text" value=${general.workDir}
247
- onChange=${(e) => saveGeneral({ workDir: e.target.value })} />
248
- </label>
249
- </div>
250
- <${WorkspaceList} />
251
- </${Section}>
252
-
253
- </div>
254
-
255
- ${edit?.kind === 'cli-new' ? html`
256
- <${EntityFormModal} title="New CLI" fields=${cliFieldsFor({ creating: true })}
257
- onClose=${close} submitLabel="Create"
258
- onSubmit=${async (v) => {
259
- try { await createCli(v); setToast(`created CLI · ${v.name}`); }
260
- catch (e) { setToast(e.message, 'error'); throw e; }
261
- }} />` : null}
262
-
263
- ${edit?.kind === 'cli-edit' ? html`
264
- <${EntityFormModal} title=${`Edit ${edit.payload.name}`} fields=${cliFieldsFor()}
265
- readOnlyKeys=${edit.payload.builtin ? ['type', 'command'] : []}
266
- initial=${{
267
- ...edit.payload,
268
- args: (edit.payload.args || []).join(' '),
269
- resumeArgs: (edit.payload.resumeArgs || []).join(' '),
270
- resumeIdArgs: (edit.payload.resumeIdArgs || []).join(' '),
271
- }}
272
- onClose=${close}
273
- onSubmit=${async (v) => {
274
- try {
275
- const patch = {
276
- ...v,
277
- args: typeof v.args === 'string' ? v.args.split(/\s+/).filter(Boolean) : v.args,
278
- resumeArgs: typeof v.resumeArgs === 'string' ? v.resumeArgs.split(/\s+/).filter(Boolean) : v.resumeArgs,
279
- resumeIdArgs: typeof v.resumeIdArgs === 'string' ? v.resumeIdArgs.split(/\s+/).filter(Boolean) : v.resumeIdArgs,
280
- };
281
- // command is locked on builtins — drop any tampered value.
282
- if (edit.payload.builtin) delete patch.command;
283
- await updateCli(edit.payload.id, patch);
284
- setToast('saved');
285
- } catch (e) { setToast(e.message, 'error'); throw e; }
286
- }} />` : null}
287
-
288
- ${edit?.kind === 'repo-new' ? html`
289
- <${EntityFormModal} title="New repo" fields=${repoFields}
290
- onClose=${close} submitLabel="Add"
291
- onSubmit=${async (v) => {
292
- try { await createRepo(v); setToast(`added repo · ${v.name}`); }
293
- catch (e) { setToast(e.message, 'error'); throw e; }
294
- }} />` : null}
295
-
296
- ${edit?.kind === 'repo-edit' ? html`
297
- <${EntityFormModal} title=${`Edit ${edit.payload.name}`} fields=${repoFields}
298
- initial=${edit.payload}
299
- onClose=${close}
300
- onSubmit=${async (v) => {
301
- try { await updateRepo(edit.payload.name, v); setToast('saved'); }
302
- catch (e) { setToast(e.message, 'error'); throw e; }
303
- }} />` : null}
304
-
305
- ${edit?.kind === 'folder-new' ? html`
306
- <${EntityFormModal} title="New folder" fields=${folderFields}
307
- onClose=${close} submitLabel="Create"
308
- onSubmit=${async (v) => {
309
- try { await createFolder(v.name); await loadFolders(); setToast(`created folder · ${v.name}`); }
310
- catch (e) { setToast(e.message, 'error'); throw e; }
311
- }} />` : null}
312
-
313
- ${edit?.kind === 'folder-edit' ? html`
314
- <${EntityFormModal} title=${`Rename ${edit.payload.name}`} fields=${folderFields}
315
- initial=${edit.payload}
316
- onClose=${close}
317
- onSubmit=${async (v) => {
318
- try { await renameFolder(edit.payload.id, v.name.trim()); await loadFolders(); setToast('renamed'); }
319
- catch (e) { setToast(e.message, 'error'); throw e; }
320
- }} />` : null}
321
- `;
322
- }
323
-
324
- // Generic "list of rows + Add button" used by all three sections.
325
- function EntityList({ items, onAdd, onEdit, onDelete, onActivate, emptyHint, dnd, addLabel = 'Add' }) {
326
- return html`
327
- <div class="entity-list">
328
- ${items.length === 0
329
- ? html`<div class="entity-empty">${emptyHint}</div>`
330
- : items.map((it) => {
331
- const rowProps = dnd ? dnd.rowProps(it.id) : {};
332
- const handleProps = dnd ? dnd.handleProps(it.id) : {};
333
- const badges = it.badges || (it.badge ? [{ label: it.badge, tone: 'accent' }] : []);
334
- return html`
335
- <div class=${`entity-row${dnd ? ' is-draggable' : ''}`} key=${it.id}
336
- ...${rowProps} ...${handleProps}>
337
- ${dnd ? html`<span class="entity-row-grip" aria-hidden="true">⋮⋮</span>` : null}
338
- <span class="entity-row-icon">${it.icon}</span>
339
- <span class="entity-row-main">
340
- <span class="entity-row-primary">
341
- ${it.primary}
342
- ${badges.map((b) => html`
343
- <span class=${`entity-row-badge tone-${b.tone || 'accent'}`}>${b.label}</span>`)}
344
- </span>
345
- ${it.secondary ? html`<span class="entity-row-secondary">${it.secondary}</span>` : null}
346
- </span>
347
- <span class="entity-row-actions">
348
- ${onActivate ? html`
349
- <button class="entity-row-action" title="Set default"
350
- onClick=${() => onActivate(it)}>★</button>` : null}
351
- <button class="entity-row-action" title="Edit"
352
- onClick=${() => onEdit(it)}><${IconPencil} /></button>
353
- ${it.undeletable ? null : html`
354
- <button class="entity-row-action danger" title="Delete"
355
- onClick=${() => onDelete(it)}><${IconClose} /></button>`}
356
- </span>
357
- </div>`;
358
- })}
359
- <button class="entity-add" type="button" onClick=${onAdd}>
360
- <span>${addLabel}</span>
361
- </button>
362
- </div>`;
363
- }
364
-
365
- // ── Workspace list ───────────────────────────────────────────────────
366
- function fmtBytes(n) {
367
- if (n == null) return '—';
368
- if (n < 1024) return `${n} B`;
369
- if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
370
- if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
371
- return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
372
- }
373
-
374
- function WorkspaceList() {
375
- const ws = workspaces.value || [];
376
- if (ws.length === 0) {
377
- return html`<div class="entity-empty">No workspaces yet — they're created automatically on launch.</div>`;
378
- }
379
- const onDelete = async (w) => {
380
- if (w.inUse) return setToast(`"${w.name}" is in use by a running session`, 'error');
381
- const ok = await ccsmConfirm(
382
- `Delete workspace "${w.name}"? This removes the directory and all repo clones inside (${fmtBytes(w.size)}).`,
383
- { okLabel: 'Delete', danger: true },
384
- );
385
- if (!ok) return;
386
- try {
387
- await deleteWorkspace(w.name);
388
- await loadWorkspaces();
389
- setToast(`deleted · ${w.name}`);
390
- } catch (e) { setToast(e.message, 'error'); }
391
- };
392
- return html`
393
- <div class="entity-list">
394
- ${ws.map((w) => {
395
- const repoCount = (w.repos || []).filter((r) => r.exists).length;
396
- return html`
397
- <div class="entity-row" key=${w.path}>
398
- <span class="entity-row-icon"><${IconFolder} /></span>
399
- <span class="entity-row-main">
400
- <span class="entity-row-primary">
401
- ${w.name}
402
- ${w.inUse ? html`<span class="entity-row-badge tone-warn">in use</span>` : null}
403
- </span>
404
- <span class="entity-row-secondary">
405
- <span class="mono">${w.path}</span>
406
- · ${fmtBytes(w.size)}
407
- ${repoCount > 0 ? html` · ${repoCount} ${repoCount === 1 ? 'repo' : 'repos'}` : null}
408
- </span>
409
- </span>
410
- <span class="entity-row-actions">
411
- <button class=${`entity-row-action danger${w.inUse ? ' is-disabled' : ''}`}
412
- title=${w.inUse ? 'In use by a running session' : 'Delete'}
413
- disabled=${w.inUse}
414
- onClick=${() => onDelete(w)}><${IconClose} /></button>
415
- </span>
416
- </div>`;
417
- })}
418
- </div>`;
419
- }
420
-
421
- // ── Accent picker (unchanged) ────────────────────────────────────────
422
- const PRESETS = [
423
- { name: 'Ocean', hex: '#2f6fa3' },
424
- { name: 'Claude copper', hex: '#b3614a' },
425
- { name: 'Anthropic ink', hex: '#1a1815' },
426
- { name: 'Forest', hex: '#3f7a4a' },
427
- { name: 'Amber', hex: '#c4892b' },
428
- { name: 'Berry', hex: '#a44b78' },
429
- { name: 'Slate', hex: '#4a5563' },
430
- { name: 'Crimson', hex: '#b73f3f' },
431
- ];
432
-
433
- function AccentPicker() {
434
- const current = (accentColor.value || '').toLowerCase();
435
- const matchedPreset = PRESETS.find((p) => p.hex.toLowerCase() === current);
436
- const [customOpen, setCustomOpen] = useState(!matchedPreset);
437
- const [text, setText] = useState(current);
438
- useEffect(() => { setText(current); }, [current]);
439
-
440
- const pickPreset = (hex) => {
441
- setAccentColor(hex);
442
- setCustomOpen(false);
443
- };
444
- const onText = (e) => {
445
- const v = e.target.value.trim();
446
- setText(v);
447
- if (/^#[0-9a-fA-F]{6}$/.test(v)) setAccentColor(v);
448
- };
449
- return html`
450
- <div class="accent-picker">
451
- <div class="accent-chips">
452
- ${PRESETS.map((p) => {
453
- const active = current === p.hex.toLowerCase();
454
- return html`
455
- <button key=${p.hex} type="button"
456
- class=${`accent-chip${active ? ' is-active' : ''}`}
457
- style=${`--c:${p.hex}`}
458
- title=${p.hex}
459
- onClick=${() => pickPreset(p.hex)}>
460
- <span class="accent-chip-dot" aria-hidden="true"></span>
461
- <span class="accent-chip-name">${p.name}</span>
462
- </button>`;
463
- })}
464
- <button type="button"
465
- class=${`accent-chip accent-chip-custom${customOpen ? ' is-open' : ''}${!matchedPreset ? ' is-active' : ''}`}
466
- style=${!matchedPreset ? `--c:${current}` : ''}
467
- onClick=${() => setCustomOpen((v) => !v)}>
468
- ${!matchedPreset
469
- ? html`<span class="accent-chip-dot" aria-hidden="true"></span>`
470
- : html`<span class="accent-chip-plus" aria-hidden="true">+</span>`}
471
- <span class="accent-chip-name">Custom</span>
472
- </button>
473
- </div>
474
- ${customOpen ? html`
475
- <div class="accent-custom">
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
+ }