comfy-ts 2.7.0 → 2.8.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 (101) hide show
  1. package/README.md +20 -13
  2. package/dist/{DefinedWorkflow-BJgt5t0x.js → DefinedWorkflow-BatWaZO1.js} +199 -16
  3. package/dist/DefinedWorkflow-BatWaZO1.js.map +1 -0
  4. package/dist/{DraftsSt-dizp3VcC.js → LogsSt-DFxzQfDc.js} +152 -4
  5. package/dist/LogsSt-DFxzQfDc.js.map +1 -0
  6. package/dist/cli.js +7 -5
  7. package/dist/cli.js.map +1 -1
  8. package/dist/index.cjs +284 -35
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +125 -7
  11. package/dist/index.d.ts +125 -7
  12. package/dist/index.js +282 -37
  13. package/dist/index.js.map +1 -1
  14. package/dist/run-serve-_nrvJYyt.js +1948 -0
  15. package/dist/run-serve-_nrvJYyt.js.map +1 -0
  16. package/dist/{run-tui-JxlEbb_f.js → run-tui-BPw-SZYW.js} +106 -157
  17. package/dist/run-tui-BPw-SZYW.js.map +1 -0
  18. package/dist/serve-web.js +432 -72
  19. package/dist/{state-CaHeDL-0.js → state-B-boDz-Z.js} +180 -45
  20. package/dist/state-B-boDz-Z.js.map +1 -0
  21. package/dist/web.d.ts +109 -7
  22. package/dist/web.js +235 -36
  23. package/dist/web.js.map +1 -1
  24. package/examples/README.md +1 -0
  25. package/examples/comfy-cloud/sdk.d.ts +4066 -321
  26. package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +18 -2
  27. package/examples/rvion/07-local-llm-text-gen.cflow.ts +220 -0
  28. package/examples/web/tsconfig.json +3 -0
  29. package/extra/README.md +32 -0
  30. package/extra/comfyui-textgen-stream/README.md +35 -0
  31. package/extra/comfyui-textgen-stream/__init__.py +166 -0
  32. package/extra/scripts/fetch_text_encoder.py +137 -0
  33. package/package.json +6 -3
  34. package/src/cli/comfy-ts-cli.ts +3 -1
  35. package/src/cli/serve/ServeApp.ts +754 -40
  36. package/src/cli/serve/applyVarPayload.ts +10 -3
  37. package/src/cli/serve/describeVar.ts +47 -7
  38. package/src/cli/serve/managerOnlyLoras.ts +27 -0
  39. package/src/cli/serve/run-serve.ts +35 -38
  40. package/src/cli/serve/serveSettings.ts +86 -0
  41. package/src/cli/serve/startupPrint.ts +111 -0
  42. package/src/cli/serve/web/api.ts +97 -1
  43. package/src/cli/serve/web/components/App.tsx +61 -22
  44. package/src/cli/serve/web/components/Gallery.tsx +243 -30
  45. package/src/cli/serve/web/components/Icon.tsx +160 -0
  46. package/src/cli/serve/web/components/PromptEnhancer.tsx +12 -9
  47. package/src/cli/serve/web/components/Sidebar.tsx +43 -19
  48. package/src/cli/serve/web/components/VarsForm.tsx +440 -91
  49. package/src/cli/serve/web/components/controls/BasicControls.tsx +38 -5
  50. package/src/cli/serve/web/components/controls/ImageControl.tsx +3 -2
  51. package/src/cli/serve/web/components/controls/LorasControl.tsx +498 -81
  52. package/src/cli/serve/web/components/controls/PresetPicker.tsx +60 -0
  53. package/src/cli/serve/web/components/controls/SeedControl.tsx +38 -20
  54. package/src/cli/serve/web/components/controls/SizeControl.tsx +3 -2
  55. package/src/cli/serve/web/llm.ts +1 -1
  56. package/src/cli/serve/web/logWeb.ts +6 -0
  57. package/src/cli/serve/web/state/EnhancerSt.ts +8 -15
  58. package/src/cli/serve/web/state/FormSt.ts +66 -17
  59. package/src/cli/serve/web/state/RunSt.ts +22 -1
  60. package/src/cli/serve/web/state/WebSt.ts +518 -14
  61. package/src/cli/serve/web/state/lightbox.ts +44 -0
  62. package/src/cli/serve/web/state/moduleTree.ts +52 -0
  63. package/src/cli/serve/web/state/payload.ts +44 -2
  64. package/src/cli/serve/web/state/urlSelection.ts +53 -0
  65. package/src/cli/serve/web/styles.ts +413 -57
  66. package/src/cli/serve/web/tsconfig.json +4 -0
  67. package/src/cli/tui/components/PickerOverlays.tsx +37 -0
  68. package/src/cli/tui/components/StatusBar.tsx +14 -1
  69. package/src/cli/tui/components/TuiApp.tsx +5 -2
  70. package/src/cli/tui/state/HostSt.ts +3 -2
  71. package/src/cli/tui/state/PickerSt.ts +48 -2
  72. package/src/cli/tui/state/TreeSt.ts +1 -1
  73. package/src/cli/tui/state/TuiSt.ts +2 -1
  74. package/src/coreExports.ts +8 -1
  75. package/src/graph/ComfyNode.ts +58 -1
  76. package/src/host/ComfyHost.ts +13 -2
  77. package/src/host/ComfyManager.ts +31 -13
  78. package/src/host/loraInfoCache.ts +35 -1
  79. package/src/host/loraManagerApi.ts +94 -0
  80. package/src/index.ts +2 -0
  81. package/src/promptEnhancers.ts +102 -0
  82. package/src/runner/ComfyExecution.ts +61 -6
  83. package/src/runner/ComfyWorkflow.ts +18 -4
  84. package/src/runner/ComfyWsApi.ts +3 -0
  85. package/src/runner/describePromptRejection.ts +34 -0
  86. package/src/sdk-generator/ComfySchema.ts +17 -4
  87. package/src/sdk-generator/comfyui-sdk-codegen.ts +56 -2
  88. package/src/utils/ansi.ts +13 -0
  89. package/src/utils/matchesRegex.ts +13 -0
  90. package/src/utils/safeName.ts +29 -0
  91. package/src/utils/stringMap.ts +9 -0
  92. package/src/vars/ComfyVars.ts +61 -10
  93. package/src/vars/presets.ts +17 -0
  94. package/dist/DefinedWorkflow-BJgt5t0x.js.map +0 -1
  95. package/dist/DraftsSt-dizp3VcC.js.map +0 -1
  96. package/dist/run-serve-D1Tsuru9.js +0 -1162
  97. package/dist/run-serve-D1Tsuru9.js.map +0 -1
  98. package/dist/run-tui-JxlEbb_f.js.map +0 -1
  99. package/dist/state-CaHeDL-0.js.map +0 -1
  100. package/src/cli/serve/promptEnhancers.ts +0 -69
  101. package/src/cli/serve/safeName.ts +0 -12
@@ -23,20 +23,21 @@ body {
23
23
  }
24
24
  #root { height: 100%; }
25
25
  .app { display: flex; flex-direction: column; height: 100%; }
26
- .topbar {
27
- display: flex; align-items: baseline; gap: 12px;
28
- padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel);
29
- }
30
- .topbar h1 { font-size: 15px; margin: 0; font-weight: 600; }
31
- .topbar .dim { color: var(--dim); font-size: 12px; }
32
- .burger { font-size: 16px; padding: 3px 10px; align-self: center; }
33
26
  .cols { display: flex; flex: 1; min-height: 0; position: relative; }
34
27
  .backdrop { display: none; }
35
28
 
36
29
  .sidebar {
37
30
  width: 240px; flex-shrink: 0; overflow-y: auto;
38
- border-right: 1px solid var(--border); background: var(--panel); padding: 8px 0;
31
+ border-right: 1px solid var(--border); background: var(--panel); padding: 6px 0;
32
+ }
33
+ /* the way OUT, from inside: the drawer opens from the workflow head box, which nothing
34
+ advertises, so a visible close is what teaches where it lives */
35
+ .side-head {
36
+ display: flex; align-items: center; justify-content: space-between; gap: 8px;
37
+ padding: 2px 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
38
+ color: var(--dim); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
39
39
  }
40
+ .side-head button { padding: 2px 6px; }
40
41
  .side-module { padding: 6px 12px 2px; }
41
42
  .side-module .name { font-weight: 600; }
42
43
  .side-module .host { color: var(--dim); font-size: 11px; margin-left: 6px; }
@@ -50,25 +51,88 @@ body {
50
51
  .side-errors .file { color: var(--dim); word-break: break-all; }
51
52
  .side-errors .msg { color: var(--red); }
52
53
 
53
- .main { flex: 1; overflow-y: auto; padding: 16px 20px 60px; }
54
+ /* the ONE scrolling element. --main-pad-y is its own top+bottom padding, published so the
55
+ sticky results column can subtract exactly that: a column sized to the full VIEWPORT inside
56
+ a padded scrollport is always taller than the room it has, which is a scrollbar on a page
57
+ that fits. The bottom padding is small on purpose — everything that floats here (the run
58
+ bar, the pinned preview) is position:sticky, so it occupies flow space and needs no
59
+ clearance; the old 48px was left from a fixed bar and was pure phantom scroll height */
60
+ .main { --main-pad-y: 26px; flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 14px; }
54
61
  .main h2 { font-size: 14px; margin: 0; color: var(--dim); font-weight: 500; }
55
62
  .main h2 b { color: var(--text); }
56
- .form-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; }
57
63
 
64
+ /* the TUI header on the web: one labelled box per thing you are editing, actions below */
65
+ /* the boxes measure the FORM COLUMN, not the window: a results panel on the side halves the
66
+ space they have while the viewport is unchanged, so a media query would answer the wrong
67
+ question. Three variants, and EVEN ones: flex-wrap could leave 3 boxes on one line and 1
68
+ alone on the next, which reads as a bug rather than as a layout */
69
+ .head-shell { container-type: inline-size; }
70
+ .head-boxes { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 4px 0 0; align-items: stretch; }
71
+ @container (min-width: 380px) {
72
+ .head-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
73
+ }
74
+ @container (min-width: 780px) {
75
+ .head-boxes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
76
+ }
77
+ /* no container-query support: fall back to the old wrapping row rather than a stack of four */
78
+ @supports not (container-type: inline-size) {
79
+ .head-boxes { display: flex; flex-wrap: wrap; }
80
+ .head-boxes > .head-box { flex: 1 1 auto; min-width: 150px; }
81
+ }
82
+ .head-box {
83
+ position: relative; border: 1px solid var(--border); border-radius: 8px;
84
+ padding: 5px 9px; background: var(--panel); min-width: 0;
85
+ }
86
+ .head-label {
87
+ position: absolute; top: -7px; left: 9px; padding: 0 5px; background: var(--bg);
88
+ color: var(--dim); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
89
+ }
90
+ .head-value { font-weight: 600; overflow-wrap: anywhere; }
91
+ .head-value.app { color: var(--amber); }
92
+ .head-value.draft { color: var(--accent); }
93
+ .head-value.host { color: var(--green); }
94
+ .head-select { padding: 2px 6px; font-size: 13px; font-weight: 600; color: var(--green); max-width: 220px; }
95
+ .head-select.draft { color: var(--accent); }
96
+ /* a head value that acts: reads like the text beside it, behaves like a button */
97
+ .head-value.as-link {
98
+ border: 0; background: none; padding: 0; font: inherit; font-weight: 600; cursor: pointer;
99
+ color: var(--amber); display: inline-flex; align-items: center; gap: 5px;
100
+ }
101
+ .head-value.as-link:hover { color: var(--accent); text-decoration: underline; }
102
+ button.danger { color: var(--dim); }
103
+ button.danger:hover { color: var(--red); border-color: var(--red); }
104
+
105
+ /* the sidebar is a tree: folder → workflows → drafts, the branch line makes the nesting readable */
106
+ .side-group { margin-bottom: 7px; }
107
+ .side-folder { padding: 4px 12px 2px; color: var(--dim); font-size: 11px; overflow-wrap: anywhere; }
108
+ .side-branch { margin-left: 10px; border-left: 1px solid var(--border); }
109
+
110
+ /* the label column is fit-content CAPPED, not a fixed slab: with short labels the controls
111
+ start right after them. Rows are subgrids of .vars so the column still lines up across
112
+ rows — a per-row grid would give every row its own width. The 150px track is the
113
+ pre-subgrid fallback, kept first so an old engine still gets aligned columns */
114
+ /* the form needs air under the head boxes: the first var sat flush against them */
115
+ .vars { display: grid; grid-template-columns: fit-content(150px) 1fr; margin-top: 14px; }
58
116
  .var-row {
59
- display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start;
60
- padding: 8px 0; border-bottom: 1px solid var(--border);
117
+ display: grid; grid-template-columns: 150px 1fr; grid-column: 1 / -1;
118
+ grid-template-columns: subgrid; gap: 8px; align-items: start;
119
+ padding: 3px 0; border-bottom: 1px solid var(--border);
61
120
  }
62
- .var-label { padding-top: 5px; overflow-wrap: break-word; }
63
- .var-label .kind { color: var(--dim); font-size: 11px; display: block; }
121
+ /* the label IS the drag handle for its row: no separate grip to reveal or aim at */
122
+ .var-label { padding-top: 3px; overflow-wrap: break-word; cursor: grab; }
123
+ .var-label:active { cursor: grabbing; }
124
+ .lora-chip[draggable='true'] { cursor: grab; }
125
+ /* the card drags from anywhere, so its own controls must keep their cursor */
126
+ .lora-chip input, .lora-chip label, .lora-chip button { cursor: pointer; }
127
+ .lora-chip input[type='number'] { cursor: text; }
64
128
  .var-label .dirty-dot { color: var(--amber); margin-left: 4px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
65
129
  .var-label .dirty-dot:hover { color: var(--red); }
66
130
  .var-control { min-width: 0; }
67
- .hint { color: var(--dim); font-size: 11px; margin-top: 3px; }
131
+ .hint { color: var(--dim); font-size: 11px; margin-top: 2px; }
68
132
 
69
133
  input[type='text'], input[type='number'], textarea, select {
70
134
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
71
- border-radius: 6px; padding: 6px 8px; font: inherit; max-width: 100%;
135
+ border-radius: 6px; padding: 3px 7px; font: inherit; max-width: 100%;
72
136
  }
73
137
  input[type='text'] { width: 100%; }
74
138
  input[type='number'] { width: 110px; }
@@ -78,43 +142,107 @@ input[type='range'] { width: 100%; accent-color: var(--accent); }
78
142
  input[type='checkbox'] { accent-color: var(--accent); width: 16px; height: 16px; }
79
143
  .row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
80
144
 
145
+ /* presets menu (text + prompt vars). The backdrop sits UNDER the menu and over everything
146
+ else, so any outside click closes it without a document listener */
147
+ .preset-box { position: relative; }
148
+ .preset-btn { white-space: nowrap; }
149
+ .preset-backdrop { position: fixed; inset: 0; z-index: 40; }
150
+ .preset-menu {
151
+ position: absolute; top: calc(100% + 4px); left: 0; z-index: 41;
152
+ display: flex; flex-direction: column; min-width: 260px; max-width: min(520px, 90vw);
153
+ max-height: 320px; overflow-y: auto;
154
+ background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px;
155
+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
156
+ }
157
+ .preset-item {
158
+ display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
159
+ background: none; border: 0; border-radius: 6px; padding: 4px 7px; text-align: left; width: 100%;
160
+ }
161
+ .preset-item:hover { background: var(--accent-dim); border-color: transparent; }
162
+ .preset-item.on .preset-name { color: var(--accent); }
163
+ .preset-name { white-space: pre; }
164
+ .preset-peek {
165
+ color: var(--dim); font-size: 11px; max-width: 100%;
166
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
167
+ }
168
+
81
169
  button {
82
170
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
83
- border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer;
171
+ border-radius: 6px; padding: 3px 8px; font: inherit; cursor: pointer;
84
172
  }
85
173
  button:hover { border-color: var(--accent); }
86
174
  button:disabled { opacity: 0.5; cursor: default; }
87
- button.primary { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; padding: 8px 22px; }
175
+ /* the run button is the loudest thing on the page, it does not need to be the biggest */
176
+ button.primary {
177
+ background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600;
178
+ padding: 5px 14px; display: inline-flex; align-items: center; gap: 6px;
179
+ }
180
+ .kbd-hint {
181
+ font-size: 10px; opacity: 0.65; border: 1px solid currentColor; border-radius: 4px;
182
+ padding: 0 4px; line-height: 1.4;
183
+ }
88
184
  button.link { border: 0; background: none; color: var(--accent); padding: 0; }
89
185
  button.link.danger { color: var(--dim); }
90
186
  button.link.danger:hover { color: var(--red); }
91
- button.mode { padding: 4px 8px; font-size: 12px; }
187
+ button.mode { padding: 2px 7px; font-size: 12px; }
92
188
  button.mode.sel { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
93
189
 
190
+ /* the run line: button, queue count, result count — one row, each part appearing only when
191
+ it has something to say */
192
+ .run-line { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
193
+ .run-chip {
194
+ display: inline-flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12px;
195
+ border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px;
196
+ }
197
+ .run-chip .link { font-size: 12px; }
94
198
  .runbar {
95
199
  position: sticky; bottom: 0; display: flex; gap: 14px; align-items: center;
96
200
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
97
- padding: 10px 14px; margin-top: 14px;
201
+ padding: 8px 12px; margin-top: 10px;
98
202
  }
99
- .runbar .status { color: var(--dim); font-size: 12px; }
203
+ /* the changed-vars broom: FAR RIGHT of the draft box line and outside the button group, so
204
+ appearing and disappearing with the dirty count never shifts the buttons beside it */
205
+ .head-box .head-right { margin-left: auto; padding: 2px 5px; }
206
+ .head-box button.dirty { color: var(--amber); }
207
+ .head-box button.dirty:hover { color: var(--red); border-color: var(--red); }
100
208
  .runbar .error { color: var(--red); font-size: 12px; white-space: pre-wrap; }
101
209
  .pulse { animation: pulse 1.2s ease-in-out infinite; }
102
210
  @keyframes pulse { 50% { opacity: 0.45; } }
103
211
 
104
- .gallery { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
105
- .gallery-head { display: flex; gap: 12px; align-items: baseline; color: var(--dim); font-size: 12px; }
106
- .run-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
212
+ .gallery { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
213
+ .run-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
107
214
  .run-card .meta { color: var(--dim); font-size: 12px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
108
215
  .run-card .imgs { display: flex; flex-wrap: wrap; gap: 10px; }
109
216
  .run-card img { max-width: min(320px, 100%); max-height: 320px; border-radius: 6px; display: block; }
110
217
  .run-card .noimg { color: var(--dim); font-style: italic; }
111
218
  .run-card.running { border-color: var(--accent-dim); }
219
+ /* what the host is on, in the node's own unit — the live signal of a text run, which has
220
+ neither a latent frame nor an image to show */
221
+ .run-node { color: var(--accent); font-size: 12px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
222
+
223
+ /* a STRING output: the answer is prose, so it wraps and selects like prose. Monospace because
224
+ an expanded prompt is copied into another field verbatim */
225
+ .run-text { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
226
+ .run-text-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
227
+ .run-text-body, .run-thinking {
228
+ margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
229
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5;
230
+ background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px;
231
+ max-height: 40vh; overflow-y: auto;
232
+ }
233
+ .run-thinking { color: var(--dim); font-size: 12px; margin-bottom: 6px; }
234
+
235
+ /* the stream: pinned to its newest line, capped so a long answer never pushes the page around */
236
+ .run-live { margin-top: 6px; }
237
+ .run-live-body {
238
+ margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
239
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5;
240
+ background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
241
+ max-height: 30vh; overflow-y: auto;
242
+ }
243
+ .run-live-body.dim { color: var(--dim); }
112
244
  .progress-track { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
113
245
  .progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }
114
- .img-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
115
- .img-actions { display: flex; gap: 10px; align-items: baseline; font-size: 12px; }
116
- .img-actions a { color: var(--accent); text-decoration: none; }
117
- .img-actions button { padding: 2px 8px; font-size: 12px; }
118
246
 
119
247
  .lora-chip {
120
248
  display: inline-flex; gap: 6px; align-items: center; max-width: 100%;
@@ -124,10 +252,14 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
124
252
  .lora-chip button:hover { color: var(--red); }
125
253
  /* image mode: the row chip becomes the same preview card as the popup */
126
254
  .lora-chip.card {
255
+ position: relative;
127
256
  flex-direction: column; align-items: stretch; border-radius: 8px; padding: 6px;
128
- background: var(--panel-2); border: 1px solid var(--border); width: 132px;
257
+ background: var(--panel-2); border: 1px solid var(--border); width: 168px;
258
+ /* anything that still outgrows the card is clipped IN PLACE, never painted over its
259
+ neighbour. CLIP on x only: hidden on both axes would trap the tooltips too */
260
+ overflow-x: clip; overflow-y: visible;
129
261
  }
130
- .lora-chip.card .lora-thumb { height: 110px; }
262
+ .lora-chip.card .lora-thumb { height: 130px; }
131
263
  .lora-chip.card .chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
132
264
  .chip-title { min-width: 0; }
133
265
  /* the whole card is the pause/resume target — the palette gesture */
@@ -137,26 +269,66 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
137
269
  }
138
270
  .lora-chip:not(.card) .lora-toggle { flex-direction: row; align-items: center; gap: 6px; }
139
271
  .lora-toggle:hover .chip-title { color: var(--accent); }
140
- .chip-state { font-size: 10px; color: var(--green); letter-spacing: 0.04em; }
141
- .lora-chip.off .chip-state { color: var(--amber); }
142
- .chip-controls { display: flex; gap: 4px; align-items: center; }
143
- .chip-controls input[type='number'] { width: 52px; padding: 1px 4px; font-size: 11px; }
144
- .chip-controls button { border: 0; background: none; color: inherit; padding: 0 2px; font-size: 11px; }
145
- .chip-controls button:hover { color: var(--red); }
272
+ .chip-controls { display: flex; flex-direction: column; gap: 3px; }
273
+ /* a line: label button, slider, number. The label toggles m+c ↔ m / c */
274
+ .st-line { display: flex; gap: 5px; align-items: center; }
275
+ .st-line .st-label {
276
+ border: 0; background: none; padding: 0; cursor: pointer; font-size: 10px; letter-spacing: 0.03em;
277
+ color: var(--dim); width: 24px; text-align: left; flex-shrink: 0;
278
+ }
279
+ .st-line .st-label:hover { color: var(--accent); }
280
+ /* wide enough for a signed two-decimal value plus the spinner: -0.55 was clipping */
281
+ .st-line input[type='number'] { width: 58px; flex-shrink: 0; padding: 1px 5px; font-size: 11px; }
282
+
283
+ /* the sliders, drawn rather than left to the browser's default chrome */
284
+ .st-line input[type='range'] {
285
+ flex: 1; min-width: 40px; height: 14px; margin: 0; padding: 0;
286
+ appearance: none; background: none; cursor: pointer;
287
+ }
288
+ .st-line input[type='range']::-webkit-slider-runnable-track {
289
+ height: 3px; border-radius: 2px; background: var(--border);
290
+ }
291
+ .st-line input[type='range']::-webkit-slider-thumb {
292
+ appearance: none; width: 11px; height: 11px; border-radius: 50%; margin-top: -4px;
293
+ background: var(--accent); border: 0;
294
+ }
295
+ .st-line input[type='range']::-moz-range-track { height: 3px; border-radius: 2px; background: var(--border); }
296
+ .st-line input[type='range']::-moz-range-thumb {
297
+ width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--accent);
298
+ }
299
+ .lora-chip.off .st-line input[type='range']::-webkit-slider-thumb { background: var(--dim); }
300
+ .lora-chip.off .st-line input[type='range']::-moz-range-thumb { background: var(--dim); }
301
+
302
+ /* the head line: switch, then the name */
303
+ .chip-head { display: flex; gap: 6px; align-items: center; min-width: 0; }
304
+ .chip-title.as-text {
305
+ border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer;
306
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; min-width: 0;
307
+ }
308
+ .chip-title.as-text:hover { color: var(--accent); }
309
+
310
+ /* the picture's own box: the ✕ is positioned against THIS, so it never depends on which
311
+ ancestor happens to be positioned, and the image keeps the whole height */
312
+ .chip-media { position: relative; display: block; isolation: isolate; }
313
+ .chip-media .lora-toggle { display: block; width: 100%; }
314
+ /* ✕ is ALWAYS a corner overlay, on the card and in the popup row: it costs zero layout
315
+ width, and it is never hover-gated — a phone has no hover, so a hidden ✕ is no ✕.
316
+ The selector carries TWO classes on purpose: the .lora-chip button rule above is 0-1-1 and would
317
+ otherwise win, stripping the padding and the backdrop off this one.
318
+ width:auto because a stretch parent would otherwise pull it across the whole card */
319
+ .chip-media .chip-remove, .lora-active-row .chip-remove {
320
+ position: absolute; top: 4px; right: 4px; z-index: 1; width: auto; height: auto;
321
+ display: inline-flex; align-items: center; justify-content: center;
322
+ border: 0; border-radius: 6px; padding: 4px; line-height: 0; color: #fff; cursor: pointer;
323
+ background: rgba(16, 18, 23, 0.72); opacity: 0.85; transition: opacity 0.12s, color 0.12s;
324
+ }
325
+ .chip-media .chip-remove:hover, .lora-active-row .chip-remove:hover { opacity: 1; color: var(--red); }
326
+
146
327
  /* PAUSED: still in the palette, visibly not contributing to the graph */
147
328
  .lora-chip.off, .lora-active-row.off { opacity: 0.55; }
148
329
  .lora-chip.off { border-style: dashed; }
149
330
  .lora-chip.off .lora-thumb, .lora-active-row.off .lora-thumb { filter: grayscale(1); }
150
331
 
151
- .queue { margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
152
- .queue-head {
153
- display: flex; gap: 12px; align-items: baseline; justify-content: space-between;
154
- padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--dim); font-size: 12px;
155
- }
156
- .queue-row { display: flex; gap: 10px; align-items: center; padding: 4px 10px; font-size: 12px; }
157
- .queue-ix { color: var(--dim); width: 16px; }
158
- .queue-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
159
- .queue-row button { padding: 1px 8px; font-size: 11px; }
160
332
 
161
333
  .modal-overlay {
162
334
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55);
@@ -171,7 +343,7 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
171
343
  .modal-body { overflow-y: auto; padding: 10px; }
172
344
  .section-title { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 0 6px; }
173
345
 
174
- .lora-active-row { display: flex; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
346
+ .lora-active-row { position: relative; display: flex; gap: 10px; align-items: center; padding: 4px 22px 4px 0; border-bottom: 1px solid var(--border); }
175
347
  .lora-active-text { flex: 1; min-width: 0; }
176
348
  .lora-active-row input[type='number'] { width: 64px; padding: 2px 6px; font-size: 12px; }
177
349
  .lora-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
@@ -182,7 +354,11 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
182
354
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; min-width: 0;
183
355
  }
184
356
  .lora-card:hover { border-color: var(--accent); }
185
- .lora-thumb { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; }
357
+ /* CONTAIN, never cover: a cropped preview hides exactly what the lora looks like */
358
+ /* contain by default (nothing of the art is hidden); FILL crops to the card, which reads far
359
+ better for style loras — the toggle lives in the loras row and persists */
360
+ .lora-thumb { width: 100%; height: 110px; object-fit: contain; border-radius: 6px; display: block; background: var(--bg); }
361
+ .lora-thumb.fill { object-fit: cover; }
186
362
  .lora-active-row .lora-thumb { width: 48px; height: 48px; flex-shrink: 0; }
187
363
  div.lora-thumb.none {
188
364
  display: flex; align-items: center; justify-content: center;
@@ -195,11 +371,18 @@ div.lora-thumb.none {
195
371
  display: flex; flex-direction: column; gap: 8px; max-width: min(1100px, 100%); max-height: 100%;
196
372
  }
197
373
  .lightbox img { max-width: 100%; max-height: calc(90vh - 60px); object-fit: contain; border-radius: 8px; }
374
+ /* wheel zoom: the viewport CLIPS, the image inside is transformed. transform-origin stays
375
+ centred so the pan offsets computed from the cursor are the only thing moving it */
376
+ .zoom-view { overflow: hidden; border-radius: 8px; display: flex; justify-content: center; touch-action: none; }
377
+ .zoom-view img { transform-origin: center center; will-change: transform; }
378
+ .zoom-view.grabbing { cursor: grab; }
379
+ .zoom-view.grabbing:active { cursor: grabbing; }
198
380
  .lightbox-bar {
199
381
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
200
382
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
201
383
  }
202
384
  .lightbox-bar a { color: var(--accent); text-decoration: none; }
385
+ .loras-more input[type='number'] { width: 72px; margin: 0 5px; }
203
386
  .loras-more { color: var(--dim); font-size: 12px; padding: 4px 10px; }
204
387
 
205
388
  /* prompt enhancer modal */
@@ -222,13 +405,182 @@ div.lora-thumb.none {
222
405
  .center { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--dim); }
223
406
  .center .error { color: var(--red); max-width: 640px; white-space: pre-wrap; }
224
407
 
225
- /* results right of the form on wide screens ("bottom or right": right ≥1100px, bottom below) */
226
- @media (min-width: 1100px) {
227
- .work { display: flex; gap: 18px; align-items: flex-start; }
228
- .form-col { flex: 1; min-width: 0; }
229
- .results-col { width: 380px; flex-shrink: 0; }
230
- .results-col .gallery { margin-top: 0; }
408
+ /* the placements. Each one is a BUTTON and nothing else: there is no width rule that quietly
409
+ moves the panel somewhere no button is showing */
410
+ .work.layout-side { display: flex; gap: 18px; align-items: flex-start; }
411
+ .work.layout-side .form-col { flex: 1; min-width: 0; }
412
+ .work.layout-side .results-col { width: min(380px, 45vw); flex-shrink: 0; }
413
+ .work.layout-side .results-col .gallery { margin-top: 0; }
414
+ /* results LEFT of the form: same column, the other side. flex order rather than
415
+ row-reverse, so the dom order (form first) stays the reading and tab order */
416
+ .work.layout-left { display: flex; gap: 18px; align-items: flex-start; }
417
+ .work.layout-left .form-col { flex: 1; min-width: 0; order: 2; }
418
+ .work.layout-left .results-col { width: min(380px, 45vw); flex-shrink: 0; order: 1; }
419
+ .work.layout-left .results-col .gallery { margin-top: 0; }
420
+ .work.layout-left .results-col {
421
+ position: sticky; top: 0; align-self: flex-start;
422
+ max-height: calc(100dvh - var(--main-pad-y, 26px)); min-height: 0; overflow-y: auto; overscroll-behavior: contain;
423
+ }
424
+
425
+ /* a 380px column beside a form does not fit a phone: BOTH side placements stack there. This
426
+ is the chosen mode adapting, not a different mode — the button stays lit and still says
427
+ where the panel goes the moment there is room for it */
428
+ @media (max-width: 760px) {
429
+ .work.layout-side, .work.layout-left { display: block; }
430
+ .work.layout-side .results-col, .work.layout-left .results-col {
431
+ position: static; width: auto; max-height: none; overflow-y: visible; margin-top: 12px;
432
+ }
433
+ }
434
+
435
+ /* A COLUMN OF RESULTS IS NEVER TALLER THAN THE PAGE. Left to itself it grows with the run
436
+ history and drags the document down, so reading a var meant scrolling past a stack of
437
+ images. It sticks to the top of .main (the scroll container) and scrolls INSIDE itself,
438
+ so the form column stays where it is however many runs pile up */
439
+ .work.layout-side .results-col {
440
+ position: sticky; top: 0; align-self: flex-start;
441
+ max-height: calc(100dvh - var(--main-pad-y, 26px)); min-height: 0; overflow-y: auto; overscroll-behavior: contain;
442
+ }
443
+ /* PINNED: the newest result floats over the bottom, the form scrolls under it — the phone
444
+ answer to "I always have to scroll between them". Sticky, so it never covers the runbar.
445
+ It HUGS its content: fit-content width + auto height, so an empty run or a tall portrait
446
+ never leaves a band of dead space around the image */
447
+ .work.layout-pinned .results-col {
448
+ /* bottom RIGHT corner: it hugs the image, so anchoring it to a corner keeps the form's
449
+ left edge readable instead of splitting the page down the middle */
450
+ position: sticky; bottom: 0; z-index: 15; margin-top: 10px;
451
+ width: fit-content; max-width: 100%; margin-left: auto; margin-right: 0;
452
+ max-height: 46vh; overflow-y: auto;
453
+ background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
454
+ box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45); padding: 6px;
455
+ }
456
+ .work.layout-pinned .results-col .gallery { margin-top: 0; gap: 6px; }
457
+ /* the pinned card is the IMAGE plus its controls, nothing else: no meta line, no padding walls */
458
+ .work.layout-pinned .run-card { padding: 0; border: 0; background: none; }
459
+ .work.layout-pinned .run-card .meta { margin-bottom: 2px; font-size: 11px; }
460
+ .work.layout-pinned .run-card img { max-height: 34vh; width: auto; }
461
+ .results-run { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
462
+ .work.layout-pinned .results-run { margin-bottom: 6px; justify-content: flex-end; }
463
+ /* segmented control: ONE group, no gaps, only the outer corners rounded */
464
+ .btn-group { display: inline-flex; }
465
+ .btn-group button {
466
+ padding: 2px 6px; font-size: 13px; line-height: 1.3; border-radius: 0; margin: 0;
467
+ border-right-width: 0; background: var(--panel-2);
468
+ }
469
+ .btn-group button:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
470
+ .btn-group button:last-child { border-right-width: 1px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
471
+ .btn-group button.sel { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
472
+ /* the selected segment owns the divider on both sides, else its highlight looks clipped */
473
+ .btn-group button.sel + button { border-left-color: var(--accent); }
474
+ .btn-group button:hover { background: var(--panel); }
475
+ /* a group living inside a header box sits beside the value, not under it */
476
+ .head-group { margin-left: 8px; vertical-align: middle; }
477
+ .head-group button { padding: 2px 5px; }
478
+ /* rows that mix buttons and inputs: one height for both, so nothing steps over the line.
479
+ 32px is what an input with 6px padding and a 1px border measures at this font size */
480
+ /* everything on a var row is the SAME height as the input beside it, or the row steps.
481
+ 28px is what the slimmed input measures (14px text, 3px padding, 1px border) */
482
+ .field-height, .field-height button { height: 28px; }
483
+ .field-height button { display: inline-flex; align-items: center; justify-content: center; }
484
+ /* a one-character mode button still needs a target: = + ? are narrow glyphs */
485
+ .btn-group.field-height button { min-width: 28px; }
486
+ .head-input { padding: 2px 6px; font-size: 13px; font-weight: 600; color: var(--accent); max-width: 180px; }
487
+ .head-label .save-state { color: var(--dim); font-weight: 400; margin-left: 4px; }
488
+ .head-label .save-state.error { color: var(--red); }
489
+ /* every head box is two lines: what you are on, then what you can do to it */
490
+ .head-box { display: flex; flex-direction: column; gap: 5px; }
491
+ .head-line { display: flex; gap: 8px; align-items: center; min-height: 24px; }
492
+ .head-line .head-group { margin-left: 0; }
493
+
494
+ /* the lora controls sit above the palette, left aligned */
495
+ .lora-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
496
+ .lora-actions button { font-size: 12px; }
497
+ /* a lora the manager knows and comfy does not: flagged, never hidden */
498
+ .host-note {
499
+ margin: 8px 0; padding: 6px 10px; font-size: 12px; color: var(--text);
500
+ background: var(--panel); border: 1px solid var(--accent-dim); border-radius: 6px;
501
+ }
502
+ /* the keywords the active loras prepend to the prompt: shown, not guessed */
503
+ .kw-prefix { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
504
+ .kw-chip {
505
+ font-size: 11px; padding: 2px 8px; border-radius: 10px;
506
+ background: var(--accent-dim); color: #fff;
507
+ }
508
+ /* a real switch, not a word: the state is readable at a glance and hittable on a phone */
509
+ .switch { position: relative; display: inline-flex; width: 28px; height: 16px; flex-shrink: 0; cursor: pointer; }
510
+ .switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
511
+ .switch .track {
512
+ position: absolute; inset: 0; border-radius: 999px; background: var(--panel-2);
513
+ border: 1px solid var(--border); transition: background 0.15s, border-color 0.15s;
514
+ }
515
+ .switch .track::after {
516
+ content: ''; position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%;
517
+ background: var(--dim); transition: transform 0.15s, background 0.15s;
518
+ }
519
+ .switch input:checked + .track { background: var(--accent-dim); border-color: var(--accent); }
520
+ .switch input:checked + .track::after { transform: translateX(12px); background: var(--accent); }
521
+ .switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
522
+
523
+ /* the lora details sheet */
524
+ .lora-details { display: flex; gap: 14px; flex-wrap: wrap; }
525
+ .detail-thumb { width: 220px; max-width: 100%; border-radius: 8px; }
526
+ .detail-list { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
527
+ .detail-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 12px; }
528
+ .detail-key { color: var(--dim); }
529
+ .detail-val { overflow-wrap: anywhere; }
530
+ .detail-val a { color: var(--accent); text-decoration: none; }
531
+ /* civitai's own words about the model. PLAIN TEXT: the extension answers html, and third
532
+ party html is never injected into this page — the seam strips it to text */
533
+ .detail-desc {
534
+ white-space: pre-wrap; font-size: 12px; line-height: 1.5; color: var(--text);
535
+ background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
536
+ padding: 8px 10px; max-height: 220px; overflow-y: auto;
231
537
  }
538
+ .detail-examples { display: flex; gap: 8px; flex-wrap: wrap; }
539
+ .detail-examples img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; }
540
+
541
+ button.warn-action { color: var(--amber); border-color: var(--amber); }
542
+ button.warn-action:hover { background: var(--panel); }
543
+ .lora-warn { color: var(--amber); display: inline-flex; margin-left: 4px; vertical-align: -0.1em; }
544
+ /* an anchor that must read as a button (it opens the host's own page, so it IS a link) */
545
+ .button-link {
546
+ display: inline-flex; align-items: center; gap: 5px; text-decoration: none; font-size: 12px;
547
+ background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
548
+ border-radius: 6px; padding: 0 10px;
549
+ }
550
+ .button-link:hover { border-color: var(--accent); color: var(--accent); }
551
+
552
+ /* the ComfyUI console, only while asked for */
553
+ .logs { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
554
+ .logs-head {
555
+ display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
556
+ padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--dim); font-size: 12px;
557
+ }
558
+ .logs pre {
559
+ margin: 0; padding: 8px 10px; max-height: 240px; overflow: auto; white-space: pre-wrap;
560
+ font-size: 11px; line-height: 1.35; color: var(--dim);
561
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
562
+ }
563
+
564
+ /* INSTANT tooltips: the native title attribute waits about a second and cannot be styled, so
565
+ every affordance carries data-tip instead. No js, no library, and no delay, which is the point */
566
+ [data-tip] { position: relative; }
567
+ [data-tip]:hover::after, [data-tip]:focus-visible::after {
568
+ content: attr(data-tip);
569
+ /* anchored to the button's bottom LEFT, never centred: a centred tip on the leftmost
570
+ button hangs off the screen, and one below never covers the row you are reading */
571
+ position: absolute; top: calc(100% + 5px); left: 0;
572
+ z-index: 60; pointer-events: none; white-space: normal; max-width: 220px; width: max-content;
573
+ opacity: 0.8;
574
+ background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
575
+ border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 400; line-height: 1.3;
576
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
577
+ }
578
+ /* the pointer never crosses a tooltip, so hover cannot flicker between the two */
579
+ @media (hover: none) { [data-tip]:hover::after { display: none; } }
580
+
581
+ /* icons inherit the text they sit in, so a button never jumps when one is swapped in */
582
+ .icon { display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }
583
+ button .icon + * { margin-left: 4px; }
232
584
 
233
585
  /* the sidebar becomes a fixed drawer over a backdrop */
234
586
  @media (max-width: 800px) {
@@ -242,10 +594,14 @@ div.lora-thumb.none {
242
594
 
243
595
  /* phone: label over control, 16px inputs (below that iOS zooms the page on focus) */
244
596
  @media (max-width: 640px) {
245
- .main { padding: 12px 12px 60px; }
246
- .var-row { grid-template-columns: 1fr; gap: 4px; }
247
- .var-label { padding-top: 0; }
248
- .var-label .kind { display: inline; margin-left: 6px; }
597
+ .main { --main-pad-y: 22px; padding: 10px 10px 12px; }
598
+ /* labels stay BESIDE their control on a phone too: stacking them doubled the height of
599
+ every row and read as a wall. The column just gets narrower. A row that needs the whole
600
+ width (loras) opts out with .wide */
601
+ .vars { grid-template-columns: fit-content(96px) 1fr; }
602
+ .var-row { gap: 6px; }
603
+ .var-row.wide { grid-template-columns: 1fr; gap: 3px; }
604
+ .var-label { padding-top: 3px; font-size: 12px; }
249
605
  input[type='text'], input[type='number'], textarea, select { font-size: 16px; }
250
606
  input[type='number'] { width: 96px; }
251
607
  /* repeated at row specificity: the base 12px rule outranks the bare selector above,
@@ -11,5 +11,9 @@
11
11
  },
12
12
  "tsBuildInfoFile": "../../../../node_modules/.cache/tsbuildinfo-serve-web.json"
13
13
  },
14
+ // MUST override the root's exclude: it lists this very directory (so the dom-free
15
+ // rule holds there), and `extends` would otherwise make this config exclude the only
16
+ // files it exists to check, the app went unchecked until tests/tsconfig-covers.test.ts
17
+ "exclude": ["../../../../examples/web"],
14
18
  "include": [".", "../../../../src"]
15
19
  }
@@ -35,6 +35,43 @@ export const ChoiceOverlay = observer((p: { st: TuiSt }) => {
35
35
  )
36
36
  })
37
37
 
38
+ /** modal preset picker (`P` on a text/prompt var): the label, then a dim peek at the text it
39
+ * writes — two presets whose names are close are told apart by their first line, not by memory */
40
+ export const PresetOverlay = observer((p: { st: TuiSt }) => {
41
+ const s = p.st
42
+ const pk = s.picker
43
+ const options = pk.presetOptions
44
+ const current = pk.presetVar?.value.trim() ?? ''
45
+ return (
46
+ <OverlayList
47
+ title={
48
+ <>
49
+ presets {s.selected ? (s.selected[1].label ?? s.selected[0]) : ''}{' '}
50
+ <Text color="gray">· ⏎ replaces the text</Text>
51
+ </>
52
+ }
53
+ extraHeader={<Text color="yellow">filter: {pk.filter}▌</Text>}
54
+ selectedIx={pk.ix}
55
+ lines={s.overlayLines}
56
+ rows={options.map((opt, ix) => ({
57
+ key: opt.label,
58
+ node: (
59
+ <Text key={opt.label} inverse={ix === pk.ix} wrap="truncate">
60
+ {ix === pk.ix ? '▸ ' : ' '}
61
+ {opt.text.trim() === current ? '• ' : ' '}
62
+ {opt.label} <Text color="gray">{firstLine(opt.text)}</Text>
63
+ </Text>
64
+ ),
65
+ }))}
66
+ footer={options.length === 0 ? <Text color="red">no match</Text> : undefined}
67
+ />
68
+ )
69
+ })
70
+
71
+ function firstLine(text: string): string {
72
+ return text.split('\n').find((l) => l.trim() !== '') ?? ''
73
+ }
74
+
38
75
  /** modal size picker: presets, or type `WxH` and ⏎ for a custom size */
39
76
  export const SizeOverlay = observer((p: { st: TuiSt }) => {
40
77
  const s = p.st