comfy-ts 2.13.0 → 2.14.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 (37) hide show
  1. package/dist/cli.js +3 -3
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/{run-serve-DlRBv_Nk.js → run-serve-DUqcn0h3.js} +211 -59
  5. package/dist/run-serve-DUqcn0h3.js.map +1 -0
  6. package/dist/{run-tui-B5uxm2_l.js → run-tui-D-LaSqgB.js} +2 -2
  7. package/dist/{run-tui-B5uxm2_l.js.map → run-tui-D-LaSqgB.js.map} +1 -1
  8. package/dist/serve-web.js +146 -71
  9. package/dist/{state-CUp2J1Zy.js → state-BytbdZ8s.js} +2 -2
  10. package/dist/{state-CUp2J1Zy.js.map → state-BytbdZ8s.js.map} +1 -1
  11. package/dist/web.js +1 -1
  12. package/package.json +1 -1
  13. package/src/cli/serve/ServeApp.ts +90 -82
  14. package/src/cli/serve/resultHistory.ts +125 -0
  15. package/src/cli/serve/runError.ts +23 -0
  16. package/src/cli/serve/serveSettings.ts +17 -1
  17. package/src/cli/serve/web/api.ts +29 -2
  18. package/src/cli/serve/web/components/App.tsx +6 -4
  19. package/src/cli/serve/web/components/Gallery.tsx +33 -8
  20. package/src/cli/serve/web/components/Icon.tsx +4 -0
  21. package/src/cli/serve/web/components/MemoryBudget.tsx +98 -0
  22. package/src/cli/serve/web/components/RunError.tsx +19 -0
  23. package/src/cli/serve/web/components/ShortcutsModal.tsx +54 -0
  24. package/src/cli/serve/web/components/SideMenu.tsx +14 -0
  25. package/src/cli/serve/web/components/VarsForm.tsx +71 -53
  26. package/src/cli/serve/web/components/controls/BasicControls.tsx +8 -1
  27. package/src/cli/serve/web/components/controls/LorasControl.tsx +6 -3
  28. package/src/cli/serve/web/promptEditor/promptExtensions.ts +3 -1
  29. package/src/cli/serve/web/state/RunSt.ts +61 -3
  30. package/src/cli/serve/web/state/WebSt.ts +26 -2
  31. package/src/cli/serve/web/state/formRows.ts +9 -0
  32. package/src/cli/serve/web/state/keptResults.ts +26 -0
  33. package/src/cli/serve/web/state/lightbox.ts +17 -0
  34. package/src/cli/serve/web/state/shortcutCatalog.ts +100 -0
  35. package/src/cli/serve/web/state/shortcuts.ts +10 -0
  36. package/src/cli/serve/web/styles.ts +98 -24
  37. package/dist/run-serve-DlRBv_Nk.js.map +0 -1
@@ -3,10 +3,23 @@
3
3
  // ever reaches the host: queued prompts must be clearable, singly or
4
4
  // all). Progress + latent preview are polled ~700ms while a prompt is in flight
5
5
  import { makeAutoObservable, observableShallow, runInAction } from 'mobx'
6
- import { fetchRunStatus, postGenerate, type GenerateOk } from 'src/cli/serve/web/api.ts'
6
+ import {
7
+ deleteKeptResults,
8
+ fetchKeptResults,
9
+ fetchRunStatus,
10
+ postGenerate,
11
+ type GenerateOk,
12
+ type MemoryUsage,
13
+ } from 'src/cli/serve/web/api.ts'
14
+ import { mergeKept } from 'src/cli/serve/web/state/keptResults.ts'
15
+ import { logWebError } from 'src/cli/serve/web/logWeb.ts'
7
16
 
8
17
  export type RunResult = GenerateOk & { at: string }
9
18
 
19
+ function asRunResult(r: GenerateOk): RunResult {
20
+ return { ...r, at: new Date(r.finishedAt ?? Date.now()).toLocaleTimeString() }
21
+ }
22
+
10
23
  /** one enqueued prompt. `sent` marks the one on the host — that one is past cancelling */
11
24
  export type QueueEntry = {
12
25
  id: string
@@ -24,6 +37,8 @@ export class RunSt {
24
37
  queue: QueueEntry[] = []
25
38
  error: string | null = null
26
39
  results: RunResult[] = []
40
+ /** the serve process's unsaved outputs against its budget. null = not read yet */
41
+ memory: MemoryUsage | null = null
27
42
  progressPercent: number | null = null
28
43
  /** what the host is doing right now, in the node's own unit — `TextGenerate 427/1024`.
29
44
  * A text graph has no latent preview and no image, so this is all there is to watch */
@@ -71,16 +86,58 @@ export class RunSt {
71
86
  this.queue = this.queue.filter((e) => e.id !== id || e.sent)
72
87
  }
73
88
 
89
+ dismissError(): void {
90
+ this.error = null
91
+ }
92
+
74
93
  clearQueue(): void {
75
94
  this.queue = this.queue.filter((e) => e.sent)
76
95
  }
77
96
 
97
+ /** the server forgets it too: a reload must not bring back what was removed */
78
98
  remove(promptId: string): void {
79
99
  this.results = this.results.filter((r) => r.promptId !== promptId)
100
+ void this.forget({ promptId })
80
101
  }
81
102
 
82
103
  clear(): void {
83
104
  this.results = []
105
+ void this.forget({})
106
+ }
107
+
108
+ /** what the serve process kept: the last runs survive a page reload */
109
+ async loadKept(): Promise<void> {
110
+ try {
111
+ const kept = await fetchKeptResults()
112
+ runInAction(() => {
113
+ this.results = mergeKept(this.results, kept.runs.map(asRunResult))
114
+ this.memory = kept.memory
115
+ })
116
+ } catch (e) {
117
+ logWebError('could not read the kept results', e)
118
+ }
119
+ }
120
+
121
+ async refreshMemory(): Promise<void> {
122
+ try {
123
+ const kept = await fetchKeptResults()
124
+ runInAction(() => {
125
+ this.memory = kept.memory
126
+ })
127
+ } catch (e) {
128
+ logWebError('could not read the memory usage', e)
129
+ }
130
+ }
131
+
132
+ private async forget(p: { promptId?: string }): Promise<void> {
133
+ try {
134
+ const reply = await deleteKeptResults(p)
135
+ runInAction(() => {
136
+ this.memory = reply.memory
137
+ })
138
+ } catch (e) {
139
+ logWebError('could not delete the kept result', e)
140
+ }
84
141
  }
85
142
 
86
143
  /** one prompt at a time: a queued entry stays cancellable until its turn comes */
@@ -105,9 +162,10 @@ export class RunSt {
105
162
  try {
106
163
  const result = await postGenerate(next)
107
164
  runInAction(() => {
108
- // capped: full-size <img>s per run would eat the tab
109
- this.results = [{ ...result, at: new Date().toLocaleTimeString() }, ...this.results].slice(0, 20)
165
+ // capped like the server's list: full-size <img>s per run would eat the tab
166
+ this.results = mergeKept([asRunResult(result)], this.results)
110
167
  })
168
+ void this.refreshMemory()
111
169
  // named, because the panel may be on another draft by the time this resolves
112
170
  this.onSeeds?.({ module: next.module, draft: next.draft, seeds: result.seeds })
113
171
  } catch (e) {
@@ -35,6 +35,7 @@ import { logWebError } from 'src/cli/serve/web/logWeb.ts'
35
35
  import { asSeedForm } from 'src/cli/serve/web/state/payload.ts'
36
36
  import { readUrlSelection, resolveSelection, writeUrlSelection } from 'src/cli/serve/web/state/urlSelection.ts'
37
37
  import { RunSt } from 'src/cli/serve/web/state/RunSt.ts'
38
+ import { DEFAULT_MEMORY_BUDGET_MB } from 'src/cli/serve/resultHistory.ts'
38
39
  import { asLoraSort, type LoraSort } from 'src/cli/serve/web/state/loraSort.ts'
39
40
  import {
40
41
  coerceHostValue,
@@ -227,7 +228,13 @@ export class WebSt {
227
228
  omnibox: OmniboxSt
228
229
  /** SERVER settings, not browser ones: they decide whether a generation writes files at all
229
230
  * and where, so they are shared by every client and read back from GET /settings */
230
- settings: ServeSettings = { saveToDisk: true, hostOverride: {}, savePrefix: {}, effectivePrefix: {} }
231
+ settings: ServeSettings = {
232
+ saveToDisk: true,
233
+ hostOverride: {},
234
+ savePrefix: {},
235
+ memoryBudgetMb: DEFAULT_MEMORY_BUDGET_MB,
236
+ effectivePrefix: {},
237
+ }
231
238
  savingError: string | null = null
232
239
  /** what you are typing in a prefix field, before the debounced write lands */
233
240
  private prefixEdits: Record<string, string> = {}
@@ -521,6 +528,7 @@ export class WebSt {
521
528
  })
522
529
  void this.loadSettings()
523
530
  void this.loadHosts()
531
+ void this.run.loadKept()
524
532
  const stored = readStoredSelection()
525
533
  // the URL wins over the stored selection: a link someone sent is an instruction, the
526
534
  // stored one is only a memory of this browser's last visit
@@ -902,6 +910,13 @@ export class WebSt {
902
910
  /** results blurred until the pointer is on them: a screen someone else may see */
903
911
  blurResults = false
904
912
 
913
+ /** the popup listing every key the panel binds */
914
+ showShortcuts = false
915
+
916
+ setShowShortcuts(b: boolean): void {
917
+ this.showShortcuts = b
918
+ }
919
+
905
920
  /** the last ⌘P / ⌘O jump: the var it targets reacts to a NEW seq, so pressing it twice works */
906
921
  jump: { kind: 'prompt' | 'loras'; seq: number } | null = null
907
922
 
@@ -1198,7 +1213,16 @@ export class WebSt {
1198
1213
  )
1199
1214
  }
1200
1215
 
1201
- private async pushSettings(patch: { saveToDisk?: boolean; savePrefix?: Record<string, string> }): Promise<boolean> {
1216
+ /** the server evicts at once on a smaller budget, so the usage is re-read after */
1217
+ async setMemoryBudget(mb: number): Promise<void> {
1218
+ if (await this.pushSettings({ memoryBudgetMb: mb })) await this.run.refreshMemory()
1219
+ }
1220
+
1221
+ private async pushSettings(patch: {
1222
+ saveToDisk?: boolean
1223
+ savePrefix?: Record<string, string>
1224
+ memoryBudgetMb?: number
1225
+ }): Promise<boolean> {
1202
1226
  try {
1203
1227
  const next = await saveSettings(patch)
1204
1228
  runInAction(() => {
@@ -0,0 +1,9 @@
1
+ /** the output row's slot in the stored field order. A var name is a js identifier, so it can
2
+ * never collide with this */
3
+ export const OUTPUT_ROW = ':output'
4
+
5
+ /** every row the form draws, in the workflow's order: its vars, then the output. A stored order
6
+ * that predates the output slot keeps the output last (orderedVars appends unknown names) */
7
+ export function formRowNames(varNames: readonly string[]): string[] {
8
+ return [...varNames, OUTPUT_ROW]
9
+ }
@@ -0,0 +1,26 @@
1
+ // the page's results after a reload: what the serve process kept, merged with what this page
2
+ // already holds (a run can finish while the list is in flight). PURE, headless-tested
3
+ import { KEPT_RUNS } from 'src/cli/serve/resultHistory.ts'
4
+
5
+ type Run = { promptId: string; finishedAt?: number }
6
+
7
+ /** one entry per promptId, the page's own copy first, newest first, capped like the server */
8
+ export function mergeKept<R extends Run>(current: readonly R[], kept: readonly R[]): R[] {
9
+ const seen = new Set(current.map((r) => r.promptId))
10
+ const merged = [...current, ...kept.filter((r) => !seen.has(r.promptId))]
11
+ return merged
12
+ .map((r, ix) => ({ r, ix }))
13
+ .sort((a, b) => (b.r.finishedAt ?? 0) - (a.r.finishedAt ?? 0) || a.ix - b.ix)
14
+ .map((x) => x.r)
15
+ .slice(0, KEPT_RUNS)
16
+ }
17
+
18
+ /** an output that only the serve process holds: gone on a restart, or past the memory budget */
19
+ export function isEphemeral(out: { url: string | null; absPath: string | null }): boolean {
20
+ return out.absPath == null && out.url != null
21
+ }
22
+
23
+ export function formatMb(bytes: number): string {
24
+ const mb = bytes / (1024 * 1024)
25
+ return mb < 10 ? mb.toFixed(1) : String(Math.round(mb))
26
+ }
@@ -42,3 +42,20 @@ export function lightboxView(p: {
42
42
  return { url: image.url, title: image.filename, promptId: finished?.promptId ?? null }
43
43
  return { url: runPreviewSrc({ module, tick: p.previewTick }), title: 'latent preview', promptId: null }
44
44
  }
45
+
46
+ /** ↑ / ↓ in the lightbox: the image before or after the open one, in the gallery's order
47
+ * (newest first, then each run's own image order). Stops at both ends. Null = no move */
48
+ export function lightboxStep(p: {
49
+ /** newest first */
50
+ results: readonly LightboxRun[]
51
+ url: string
52
+ dir: 1 | -1
53
+ }): Extract<LightboxTarget, { kind: 'image' }> | null {
54
+ const all = p.results.flatMap((r) =>
55
+ r.images.flatMap((i) => (i.url == null ? [] : [{ url: i.url, title: i.filename, promptId: r.promptId }])),
56
+ )
57
+ const ix = all.findIndex((x) => x.url === p.url)
58
+ if (ix < 0) return null
59
+ const next = all[ix + p.dir]
60
+ return next == null ? null : { kind: 'image', ...next }
61
+ }
@@ -0,0 +1,100 @@
1
+ import { MOD_KEY } from 'src/cli/serve/web/components/modKey.ts'
2
+ import {
3
+ ENHANCER_KEYS,
4
+ SHORTCUT_KEYS,
5
+ type EnhancerShortcut,
6
+ type Shortcut,
7
+ } from 'src/cli/serve/web/state/shortcuts.ts'
8
+
9
+ /** every key the panel binds, as the shortcuts popup lists it. The jump and enhancer rows are
10
+ * DERIVED from their key tables (a Record, so a new shortcut without a line fails typecheck); the
11
+ * prompt editor rows name their codemirror bindings, which tests/serve-web-shortcut-catalog.test.ts
12
+ * checks against promptExtensions.ts */
13
+ export type ShortcutRow = { keys: string[]; what: string; cm?: string[] }
14
+ export type ShortcutGroup = { title: string; rows: ShortcutRow[] }
15
+
16
+ const JUMP_WHAT: Record<Shortcut, string> = {
17
+ 'focus-prompt': 'focus the first prompt',
18
+ 'open-loras': 'open the lora picker',
19
+ 'open-enhancer': 'open the prompt enhancer',
20
+ 'rename-draft': 'rename the draft',
21
+ 'duplicate-draft': 'duplicate the draft',
22
+ 'toggle-menu': 'fold or unfold the menu',
23
+ 'toggle-blur': 'blur or unblur the results',
24
+ }
25
+
26
+ const ENHANCER_WHAT: Record<EnhancerShortcut, string> = {
27
+ enhance: 'enhance the prompt',
28
+ apply: 'apply the rewrite to the prompt',
29
+ }
30
+
31
+ const cap = (mod: string, k: string): string => (/^F\d{1,2}$/.test(k) ? k : `${mod}${k}`)
32
+
33
+ export function shortcutCatalog(mod: string = MOD_KEY): ShortcutGroup[] {
34
+ const jumps = (Object.keys(JUMP_WHAT) as Shortcut[]).map((s) => ({
35
+ keys: [cap(mod, SHORTCUT_KEYS[s])],
36
+ what: JUMP_WHAT[s],
37
+ }))
38
+ const enhancer = (Object.keys(ENHANCER_WHAT) as EnhancerShortcut[]).map((s) => ({
39
+ keys: [cap(mod, ENHANCER_KEYS[s])],
40
+ what: ENHANCER_WHAT[s],
41
+ }))
42
+ return [
43
+ {
44
+ title: 'anywhere',
45
+ rows: [
46
+ { keys: [`${mod}⏎`], what: 'run the draft' },
47
+ { keys: [`${mod}K`, `${mod}J`], what: 'search every workflow and draft' },
48
+ { keys: [`${mod}1 … ${mod}8`], what: 'open tab 1 to 8' },
49
+ { keys: [`${mod}9`], what: 'open the last tab' },
50
+ { keys: [`${mod}PageUp`, `${mod}PageDown`], what: 'previous or next tab, wrapping' },
51
+ ...jumps,
52
+ { keys: [`${mod}A`], what: 'select all in the field you are in' },
53
+ { keys: ['Esc'], what: 'close the popup on top' },
54
+ ],
55
+ },
56
+ {
57
+ title: 'prompt editor',
58
+ rows: [
59
+ {
60
+ keys: [`${mod}↑`, `${mod}↓`],
61
+ what: 'weight of the word or selection up or down',
62
+ cm: ['Mod-ArrowUp', 'Mod-ArrowDown', 'Ctrl-ArrowUp', 'Ctrl-ArrowDown'],
63
+ },
64
+ { keys: [`${mod}/`], what: 'comment the line in or out', cm: ['Mod-/'] },
65
+ { keys: [`${mod}⇧-`], what: 'make the line negative, or positive again', cm: ['Mod-Shift--', 'Mod-_'] },
66
+ { keys: ['⌥↑', '⌥↓'], what: 'move the line up or down', cm: ['Alt-ArrowUp', 'Alt-ArrowDown'] },
67
+ { keys: [`${mod}Z`, `${mod}⇧Z`], what: 'undo, redo' },
68
+ { keys: ['↑', '↓', '⏎', 'Esc'], what: 'in the completion list: move, pick, dismiss' },
69
+ ],
70
+ },
71
+ {
72
+ title: 'prompt enhancer',
73
+ rows: [...enhancer, { keys: [`${mod}⏎`], what: 'run with the rewrite, the prompt stays as it is' }],
74
+ },
75
+ {
76
+ title: 'lightbox',
77
+ rows: [
78
+ { keys: ['↑', '↓'], what: 'previous or next image of the gallery' },
79
+ { keys: ['scroll'], what: 'zoom at the pointer, drag to pan' },
80
+ { keys: ['double click'], what: 'back to fit' },
81
+ { keys: ['Esc'], what: 'close' },
82
+ ],
83
+ },
84
+ {
85
+ title: 'search and history pickers',
86
+ rows: [
87
+ { keys: ['↑', '↓'], what: 'move' },
88
+ { keys: ['⏎'], what: 'open the pick' },
89
+ { keys: ['Esc'], what: 'close' },
90
+ ],
91
+ },
92
+ {
93
+ title: 'renaming',
94
+ rows: [
95
+ { keys: ['⏎'], what: 'keep the new name' },
96
+ { keys: ['Esc'], what: 'cancel' },
97
+ ],
98
+ },
99
+ ]
100
+ }
@@ -73,6 +73,16 @@ export function shortcutOf(e: {
73
73
  return null
74
74
  }
75
75
 
76
+ /** does this ⌘P / ⌘O press act on a var whose last seen press is `seenSeq`. The stored jump
77
+ * outlives the press: a var that mounts later (a tab switch rebuilds the form) must not replay it */
78
+ export function isNewJump(
79
+ jump: { kind: 'prompt' | 'loras'; seq: number } | null,
80
+ kind: 'prompt' | 'loras',
81
+ seenSeq: number,
82
+ ): boolean {
83
+ return jump != null && jump.kind === kind && jump.seq > seenSeq
84
+ }
85
+
76
86
  /** which var each jump lands on: the FIRST var of that kind in the order shown, skipping one
77
87
  * that is disabled (it takes no focus) */
78
88
  export function jumpTargets(vars: readonly { name: string; kind: string; inactive: boolean }[]): {
@@ -6,6 +6,15 @@ export const STYLES = /* css */ `
6
6
  --panel: #171a21;
7
7
  --panel-2: #1d2129;
8
8
  --border: #2a2f3a;
9
+ /* the chrome (menu, tabs bar, preview side): lifted off the work area by a cool tint and a
10
+ soft top light, split from it by hairlines instead of solid bands */
11
+ --chrome: linear-gradient(180deg, #1a1f2b 0%, #151922 40%, #13161d 100%);
12
+ --chrome-flat: #171b24;
13
+ --hairline: color-mix(in srgb, var(--border) 70%, transparent);
14
+ /* a picked option (segment, mode toggle): a tint of the accent, never a solid slab */
15
+ --sel-bg: color-mix(in srgb, var(--accent) 22%, var(--panel-2));
16
+ --sel-border: color-mix(in srgb, var(--accent) 55%, transparent);
17
+ --sel-text: #c3d3fb;
9
18
  --text: #e8eaf0;
10
19
  --dim: #8b93a7;
11
20
  --accent: #7aa2f7;
@@ -88,7 +97,7 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
88
97
 
89
98
  /* the menu column: the TUI header on the web, one labelled card per scope, stacked */
90
99
  .menu-layout { flex: 1; min-width: 0; height: 100%; }
91
- .menu-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border-right: 1px solid var(--border); }
100
+ .menu-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--chrome); }
92
101
  .menu-main { height: 100%; display: flex; min-width: 0; }
93
102
  .menu-main > .main { height: 100%; }
94
103
  /* the open drafts as tabs over the work area. The body below takes the rest: the panel group
@@ -97,20 +106,18 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
97
106
  .tabs-body { flex: 1; min-height: 0; display: flex; }
98
107
  .tabs-body > .main { height: 100%; }
99
108
  .draft-tabs {
100
- display: flex; gap: 0; padding: 4px 8px 0; overflow-x: auto; flex-shrink: 0;
101
- background: var(--panel); border-bottom: 1px solid var(--border);
109
+ display: flex; gap: 0; padding: 0; overflow-x: auto; flex-shrink: 0;
110
+ background: var(--chrome-flat); border-bottom: 1px solid var(--hairline);
102
111
  }
112
+ /* square segments split by hairlines, as tall as the menu head so both bottom lines meet. The
113
+ open one wears the btn-group pick: the accent tint and an accent underline */
103
114
  .draft-tab {
104
- display: inline-flex; align-items: center; gap: 3px; max-width: 220px; padding: 3px 4px 3px 9px;
105
- font-size: 13px; color: var(--dim); cursor: pointer; user-select: none; white-space: nowrap;
106
- border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; margin-bottom: -1px;
107
- position: relative;
115
+ display: inline-flex; align-items: center; gap: 4px; max-width: 240px; height: 44px; padding: 0 8px 0 14px;
116
+ font-size: 14px; color: var(--dim); cursor: pointer; user-select: none; white-space: nowrap;
117
+ border-right: 1px solid var(--hairline); position: relative;
108
118
  }
109
- /* neighbours share one border line, the open tab draws its own on top */
110
- .draft-tab + .draft-tab { margin-left: -1px; }
111
- .draft-tab.on { z-index: 1; }
112
119
  .draft-tab:hover { color: var(--text); background: var(--panel-2); }
113
- .draft-tab.on { color: var(--text); background: var(--bg); border-color: var(--border); }
120
+ .draft-tab.on { color: var(--sel-text); background: var(--sel-bg); box-shadow: inset 0 -2px 0 var(--accent); }
114
121
  .draft-tab-name { overflow: hidden; text-overflow: ellipsis; }
115
122
  .draft-tab-wf { color: var(--dim); font-size: 11px; }
116
123
  .draft-tab button.draft-tab-close {
@@ -128,7 +135,7 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
128
135
  .tab-menu .menu-action.danger:hover { color: var(--red); }
129
136
  .menu-col { padding: 0 0 14px; }
130
137
  /* ☰ + the name: the same height as the rail's first icon, so folding never moves it */
131
- .menu-head { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px; border-bottom: 1px solid var(--border); }
138
+ .menu-head { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px; border-bottom: 1px solid var(--hairline); }
132
139
  .menu-brand { font-weight: 700; letter-spacing: 0.01em; }
133
140
  .menu-head-key { margin-left: auto; }
134
141
  /* a full-row action (duplicate, new): reads as an entry of the list, its key at the end */
@@ -145,7 +152,7 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
145
152
  .layout-tile:hover { color: var(--text); background: var(--panel-2); }
146
153
  .layout-tile.sel { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); font-weight: 600; }
147
154
  .menu-sections { display: flex; flex-direction: column; }
148
- .menu-section { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
155
+ .menu-section { padding: 10px 10px 12px; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 2px; }
149
156
  .menu-title {
150
157
  display: flex; align-items: center; justify-content: space-between; min-height: 24px; padding: 0 4px;
151
158
  color: var(--dim); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
@@ -251,7 +258,12 @@ button.var-reset:disabled { opacity: 0.25; cursor: default; }
251
258
  /* the label IS the drag handle for its row: no separate grip to reveal or aim at */
252
259
  /* labels never wrap: one line at the height of a control, cut with an ellipsis, whole on hover.
253
260
  The icon and the (?) keep their size, only the name gives way */
254
- .var-label { display: flex; align-items: center; justify-content: flex-end; min-height: 28px; min-width: 0; cursor: grab; }
261
+ /* a drag handle never selects its text: WebKit starts a text selection instead of the drag
262
+ when the press lands on selectable text */
263
+ .var-label {
264
+ display: flex; align-items: center; justify-content: flex-end; min-height: 28px; min-width: 0; cursor: grab;
265
+ user-select: none; -webkit-user-select: none; -webkit-user-drag: element;
266
+ }
255
267
  .var-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
256
268
  /* the ⌘ key that jumps to this var, on its own line under the name */
257
269
  .var-label.has-kbd { flex-wrap: wrap; align-content: center; row-gap: 3px; }
@@ -259,7 +271,7 @@ button.var-reset:disabled { opacity: 0.25; cursor: default; }
259
271
  .var-row.inactive .var-control { opacity: 0.18; filter: grayscale(1); }
260
272
  .var-row.inactive .var-label { opacity: 0.45; }
261
273
  .var-label:active { cursor: grabbing; }
262
- .lora-chip[draggable='true'] { cursor: grab; }
274
+ .lora-chip[draggable='true'] { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-user-drag: element; }
263
275
  /* the card drags from anywhere, so its own controls must keep their cursor */
264
276
  .lora-chip input, .lora-chip label, .lora-chip button { cursor: pointer; }
265
277
  .lora-chip input[type='number'] { cursor: text; }
@@ -273,6 +285,9 @@ button.var-reset:disabled { opacity: 0.25; cursor: default; }
273
285
  }
274
286
  .var-label .dirty-dot:hover { background: var(--red); }
275
287
  .var-control { min-width: 0; }
288
+ /* a one-line control sits on the label's 28px line: rows align to the top, so a shorter line
289
+ (a toggle and its word) floated above the label's centre */
290
+ .var-control > .row-inline { min-height: 28px; }
276
291
  /* a workflow's own icons: beside a label, or inside a choice button */
277
292
  .var-icon { width: 15px; height: 15px; margin-right: 5px; flex-shrink: 0; }
278
293
  .btn-group button .var-icon { margin-right: 3px; }
@@ -295,7 +310,35 @@ input[type='range'] { width: 100%; accent-color: var(--accent); }
295
310
  /* a steps or cfg slider across a whole wide row is a long drag for a small number: 320px is
296
311
  still a fine grain for 1..60, and the number box keeps its place right after it */
297
312
  .var-control input[type='range'] { max-width: 320px; }
298
- input[type='checkbox'] { accent-color: var(--accent); width: 16px; height: 16px; }
313
+ /* a number var's slider: a thin dark track, the accent up to the value, a small dot */
314
+ input[type='range'].num-range {
315
+ appearance: none; height: 16px; margin: 0; padding: 0; cursor: pointer; border-radius: 2px;
316
+ background-color: transparent; background-size: 100% 4px; background-position: center; background-repeat: no-repeat;
317
+ }
318
+ input[type='range'].num-range::-webkit-slider-runnable-track { height: 4px; background: transparent; }
319
+ input[type='range'].num-range::-webkit-slider-thumb {
320
+ appearance: none; width: 14px; height: 14px; border-radius: 50%; margin-top: -5px;
321
+ background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent-dim);
322
+ }
323
+ input[type='range'].num-range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
324
+ input[type='range'].num-range::-moz-range-track { height: 4px; background: transparent; }
325
+ input[type='range'].num-range::-moz-range-thumb {
326
+ width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
327
+ }
328
+ /* every checkbox is drawn as a toggle, the same pill as .switch: the native box was the one
329
+ control on the page still in the browser's own chrome */
330
+ input[type='checkbox'] {
331
+ appearance: none; position: relative; flex-shrink: 0; width: 36px; height: 20px; margin: 0; align-self: center;
332
+ border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); cursor: pointer;
333
+ vertical-align: middle; transition: background 0.15s, border-color 0.15s;
334
+ }
335
+ input[type='checkbox']::before {
336
+ content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
337
+ background: var(--dim); transition: transform 0.15s, background 0.15s;
338
+ }
339
+ input[type='checkbox']:checked { background: var(--sel-bg); border-color: var(--sel-border); }
340
+ input[type='checkbox']:checked::before { transform: translateX(16px); background: var(--accent); }
341
+ input[type='checkbox']:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
299
342
  .row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
300
343
  /* lanes (src/vars/lanes.ts): named groups merged top to bottom. Each lane is a BAND: a tinted
301
344
  strip, its name as plain small text on the left (clickable, not dressed as a button: click
@@ -410,7 +453,7 @@ button.link { border: 0; background: none; color: var(--accent); padding: 0; }
410
453
  button.link.danger { color: var(--dim); }
411
454
  button.link.danger:hover { color: var(--red); }
412
455
  button.mode { padding: 2px 7px; font-size: 12px; }
413
- button.mode.sel { background: var(--accent); border-color: var(--accent); color: #0d1117; }
456
+ button.mode.sel { background: var(--sel-bg); border-color: var(--sel-border); color: var(--sel-text); }
414
457
  /* the actions that START something (new draft, add loras): accent outline, so the eye finds
415
458
  them before the neutral ones. The lit segment of a group is a solid accent fill */
416
459
  button.accent { color: var(--accent); border-color: var(--accent-dim); }
@@ -439,6 +482,12 @@ button.accent:hover { background: var(--accent-dim); color: #fff; }
439
482
  button.run-end { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: 13px; }
440
483
  button.run-end:not(:disabled):hover { color: #fff; background: var(--red); border-color: var(--red); }
441
484
  button.run-end:disabled { opacity: 0.45; cursor: default; }
485
+ .run-error-block {
486
+ display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; padding: 8px 10px;
487
+ border: 1px solid var(--red); border-radius: 8px; color: var(--red); font-size: 12px;
488
+ }
489
+ .run-error-block > .icon { flex-shrink: 0; margin-top: 2px; }
490
+ .run-error-text { flex: 1; min-width: 0; margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
442
491
  .run-error { flex: 1; min-width: 0; height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--red); font-size: 12px; }
443
492
  input[type='range'].setting-range:disabled { opacity: 0.3; }
444
493
  .live-preview-error { margin-left: 4px; }
@@ -650,6 +699,17 @@ button.live-preview-copy:not(:disabled):hover { color: var(--text); border-color
650
699
  height, so typing a filter or hiding images never moves it */
651
700
  .modal-overlay.top { align-items: flex-start; padding-top: 5vh; }
652
701
  .modal.loras-modal { height: min(86vh, 100%); max-height: none; }
702
+ .modal.shortcuts-modal { width: min(640px, 100%); max-height: min(86vh, 100%); }
703
+ .shortcuts-modal .modal-head { align-items: center; }
704
+ .shortcuts-title { flex: 1; font-weight: 600; }
705
+ .shortcuts-body { overflow-y: auto; padding: 4px 14px 14px; }
706
+ .shortcuts-group { padding-top: 10px; }
707
+ .shortcuts-row { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 13px; }
708
+ .shortcuts-keys { display: inline-flex; flex-wrap: wrap; gap: 4px; width: 200px; flex-shrink: 0; }
709
+ .shortcuts-row kbd {
710
+ font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 6px; border-radius: 5px;
711
+ background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px; color: var(--text);
712
+ }
653
713
  .modal.loras-modal { width: min(1180px, 100%); }
654
714
  /* the palette sits BESIDE the gallery, each scrolling alone: picking a lora grows the palette
655
715
  and never moves a card under the pointer. Narrow: a fixed-height strip above, same reason */
@@ -857,6 +917,17 @@ button.enh-big { font-size: 14px; padding: 8px 18px; }
857
917
  font-size: 13px; padding: 2px 8px; color: #fff; opacity: 0.85; background: rgba(0, 0, 0, 0.35);
858
918
  }
859
919
  .img-button:hover .blur-hint { display: none; }
920
+ /* an unsaved output: only the serve process holds it, so it says so where the eye lands */
921
+ .gallery .img-button, .audio-cell { position: relative; }
922
+ .ephemeral-pill {
923
+ position: absolute; left: 6px; bottom: 6px; pointer-events: auto; display: inline-flex; align-items: center; gap: 4px;
924
+ font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
925
+ color: #1a1400; background: var(--amber); opacity: 0.92;
926
+ }
927
+ .audio-cell .ephemeral-pill { position: static; align-self: flex-start; }
928
+ .memory-menu { max-width: 300px; }
929
+ .memory-note { margin: 0; padding: 2px 4px; font-size: 12px; line-height: 1.4; }
930
+ .memory-note.error { color: var(--red); }
860
931
  /* bigger control buttons: the preview head and the menu column, one size with the form rows */
861
932
  .results-head .btn-group > button, .menu-section .btn-group > button, .menu-panel button.head-icon, .drawer button.head-icon {
862
933
  height: 28px; min-width: 28px; font-size: 13px;
@@ -912,13 +983,16 @@ button.enh-big { font-size: 14px; padding: 8px 18px; }
912
983
  .work.split { flex: 1; min-width: 0; height: 100%; gap: 0; align-items: stretch; }
913
984
  .split-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
914
985
  .split-form { padding: 12px 14px 14px; }
915
- .split-results { background: var(--panel); padding: 10px 12px; }
986
+ .split-results { background: var(--chrome); padding: 10px 12px; }
916
987
  .work.split .results-col {
917
988
  position: static; width: auto; max-height: none; overflow: visible;
918
989
  background: none; border: 0; border-radius: 0; padding: 0;
919
990
  }
920
- .split-handle { width: 5px; background: var(--border); cursor: col-resize; transition: background 0.1s; }
921
- .split-handle:hover, .split-handle[data-separator-state='drag'] { background: var(--accent); }
991
+ .split-handle {
992
+ width: 5px; cursor: col-resize; transition: background 0.1s;
993
+ background: linear-gradient(90deg, transparent 2px, var(--hairline) 2px, var(--hairline) 3px, transparent 3px);
994
+ }
995
+ .split-handle:hover, .split-handle[data-separator-state='drag'] { background: var(--accent-dim); }
922
996
 
923
997
  /* the placements. Each one is a BUTTON and nothing else: there is no width rule that quietly
924
998
  moves the panel somewhere no button is showing */
@@ -985,11 +1059,11 @@ button.enh-big { font-size: 14px; padding: 8px 18px; }
985
1059
  }
986
1060
  .btn-group button:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
987
1061
  .btn-group button:last-child { border-right-width: 1px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
988
- .btn-group button.sel { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
1062
+ .btn-group button.sel { background: var(--sel-bg); border-color: var(--sel-border); color: var(--sel-text); font-weight: 600; }
989
1063
  /* the selected segment owns the divider on both sides, else its highlight looks clipped */
990
- .btn-group button.sel + button { border-left-color: var(--accent); }
1064
+ .btn-group button.sel + button { border-left-color: var(--sel-border); }
991
1065
  .btn-group button:hover { background: var(--panel); }
992
- .btn-group button.sel:hover { background: var(--accent); }
1066
+ .btn-group button.sel:hover { background: var(--sel-bg); }
993
1067
  /* ONE height for every button a var row shows in a group or an action line: a choice, the
994
1068
  lora toggles, a lane header, the seed modes. Before, each kind had its own padding and a
995
1069
  choice sat visibly smaller than the toggles beside it */
@@ -1043,7 +1117,7 @@ button.head-icon.danger:hover { color: var(--red); border-color: var(--red); }
1043
1117
  content: ''; position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%;
1044
1118
  background: var(--dim); transition: transform 0.15s, background 0.15s;
1045
1119
  }
1046
- .switch input:checked + .track { background: var(--accent-dim); border-color: var(--accent); }
1120
+ .switch input:checked + .track { background: var(--sel-bg); border-color: var(--sel-border); }
1047
1121
  .switch input:checked + .track::after { transform: translateX(12px); background: var(--accent); }
1048
1122
  .switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
1049
1123