comfy-ts 2.12.0 → 2.13.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 (69) hide show
  1. package/dist/{LogsSt-U1H0mP1m.js → LogsSt-CUeo843w.js} +18 -4
  2. package/dist/LogsSt-CUeo843w.js.map +1 -0
  3. package/dist/cli.js +4 -4
  4. package/dist/index.cjs +123 -12
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +96 -16
  7. package/dist/index.d.ts +96 -16
  8. package/dist/index.js +123 -12
  9. package/dist/index.js.map +1 -1
  10. package/dist/{run-serve-BeAznay5.js → run-serve-DlRBv_Nk.js} +281 -19
  11. package/dist/run-serve-DlRBv_Nk.js.map +1 -0
  12. package/dist/{run-tui-BTGjvnKk.js → run-tui-B5uxm2_l.js} +4 -4
  13. package/dist/{run-tui-BTGjvnKk.js.map → run-tui-B5uxm2_l.js.map} +1 -1
  14. package/dist/{schemaDrift-Cg39vs53.js → schemaDrift-E95iTF7E.js} +4 -1
  15. package/dist/{schemaDrift-Cg39vs53.js.map → schemaDrift-E95iTF7E.js.map} +1 -1
  16. package/dist/serve-web.js +291 -129
  17. package/dist/{state-C7REnHan.js → state-CUp2J1Zy.js} +122 -14
  18. package/dist/state-CUp2J1Zy.js.map +1 -0
  19. package/dist/web.d.ts +96 -16
  20. package/dist/web.js +123 -12
  21. package/dist/web.js.map +1 -1
  22. package/examples/comfy-cloud/sdk.d.ts +163 -163
  23. package/examples/rvion/10-anima-t2i.cflow.ts +48 -25
  24. package/examples/rvion/11-yue2-t2a.cflow.ts +105 -0
  25. package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +78 -0
  26. package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +153 -0
  27. package/examples/rvion/stableAudio3Prompts.ts +19 -0
  28. package/package.json +2 -2
  29. package/src/cli/serve/ServeApp.ts +157 -18
  30. package/src/cli/serve/byteRange.ts +48 -0
  31. package/src/cli/serve/run-serve.ts +12 -3
  32. package/src/cli/serve/web/api.ts +24 -0
  33. package/src/cli/serve/web/components/App.tsx +305 -156
  34. package/src/cli/serve/web/components/DraftTabs.tsx +167 -0
  35. package/src/cli/serve/web/components/Gallery.tsx +44 -19
  36. package/src/cli/serve/web/components/Icon.tsx +40 -0
  37. package/src/cli/serve/web/components/Omnibox.tsx +70 -20
  38. package/src/cli/serve/web/components/SideMenu.tsx +414 -0
  39. package/src/cli/serve/web/components/TooltipLayer.tsx +3 -2
  40. package/src/cli/serve/web/components/VarsForm.tsx +70 -351
  41. package/src/cli/serve/web/components/controls/LorasControl.tsx +24 -22
  42. package/src/cli/serve/web/promptEditor/promptExtensions.ts +6 -3
  43. package/src/cli/serve/web/state/EnhancerSt.ts +17 -2
  44. package/src/cli/serve/web/state/FormSt.ts +22 -2
  45. package/src/cli/serve/web/state/OmniboxSt.ts +3 -1
  46. package/src/cli/serve/web/state/WebSt.ts +172 -33
  47. package/src/cli/serve/web/state/draftNames.ts +16 -0
  48. package/src/cli/serve/web/state/draftTabs.ts +75 -0
  49. package/src/cli/serve/web/state/generateButton.ts +1 -1
  50. package/src/cli/serve/web/state/omnibox.ts +82 -18
  51. package/src/cli/serve/web/state/shortcuts.ts +56 -7
  52. package/src/cli/serve/web/styles.ts +242 -82
  53. package/src/cli/serve/workflowTags.ts +42 -0
  54. package/src/cli/serve/workspaceLabels.ts +23 -0
  55. package/src/cli/tui/state/DraftsSt.ts +10 -6
  56. package/src/coreExports.ts +1 -0
  57. package/src/host/ComfyHost.ts +17 -2
  58. package/src/host/ResilientWebsocket.ts +54 -4
  59. package/src/runner/ComfyExecution.ts +60 -0
  60. package/src/runner/ComfyWorkflow.ts +4 -0
  61. package/src/runner/ComfyWsApi.ts +2 -0
  62. package/src/runner/MediaImage.ts +2 -2
  63. package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +5 -5
  64. package/src/sdk-generator/comfyui-sdk-codegen.ts +1 -1
  65. package/src/utils/copyName.ts +12 -0
  66. package/src/vars/DefinedWorkflow.ts +7 -1
  67. package/dist/LogsSt-U1H0mP1m.js.map +0 -1
  68. package/dist/run-serve-BeAznay5.js.map +0 -1
  69. package/dist/state-C7REnHan.js.map +0 -1
@@ -1,17 +1,21 @@
1
- // layout root: form column + results column, placed by the preview panel's own buttons.
2
- // NO title bar and no menu: ⌘K / ⌘J or the workflow head box opens the omnibox
1
+ // layout root: the menu column (SideMenu.tsx), then the form and results columns placed by
2
+ // the preview panel's own buttons. At 760px and below the menu is a drawer behind ☰
3
3
  import { observer } from 'mobx-react-lite'
4
- import { useEffect, useState, type ReactNode } from 'react'
5
- import { Group, Panel, Separator, useDefaultLayout } from 'react-resizable-panels'
4
+ import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'
5
+ import { Group, Panel, Separator, useDefaultLayout, usePanelRef } from 'react-resizable-panels'
6
+ import { MenuCards, MenuHead, MenuRail } from 'src/cli/serve/web/components/SideMenu.tsx'
6
7
  import { Gallery } from 'src/cli/serve/web/components/Gallery.tsx'
7
8
  import { Icon, type IconName } from 'src/cli/serve/web/components/Icon.tsx'
8
9
  import { LATENT_MODES, type LatentMode } from 'src/cli/serve/web/state/latentMode.ts'
9
10
  import { Omnibox, useOmniboxShortcut } from 'src/cli/serve/web/components/Omnibox.tsx'
10
11
  import { TooltipLayer } from 'src/cli/serve/web/components/TooltipLayer.tsx'
11
12
  import { MOD_KEY } from 'src/cli/serve/web/components/modKey.ts'
13
+ import { SHORTCUT_KEYS, shortcutOf } from 'src/cli/serve/web/state/shortcuts.ts'
14
+ import { reaction } from 'mobx'
12
15
  import { collapsedPreview } from 'src/cli/serve/web/state/stableSlots.ts'
13
16
  import { GenerateButton, VarsForm } from 'src/cli/serve/web/components/VarsForm.tsx'
14
- import { LAYOUTS, type WebSt } from 'src/cli/serve/web/state/WebSt.ts'
17
+ import { DraftTabs, useTabShortcuts } from 'src/cli/serve/web/components/DraftTabs.tsx'
18
+ import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
15
19
 
16
20
  /** ⌘A / ctrl+A selects the field you are in. The browser does this on its own until something
17
21
  * on the page consumes the event, and this panel has several window-level key handlers plus a
@@ -43,6 +47,57 @@ function useSelectAllInFields(): void {
43
47
  /** the workflow's live previews (defineWorkflow({ previews })): text computed from the values
44
48
  * on screen, refreshed as you edit. Compact by default, the name inline and every line cut to
45
49
  * one; a click opens the full text, remembered. A `- ` line is the negative, as in a prompt */
50
+ /** the console opens at its last line, and follows new ones while you are at the bottom, so a
51
+ * run's progress stays in view. Scrolled up to read, it stays where you put it */
52
+ function ConsoleLines(p: { text: string }): ReactNode {
53
+ const ref = useRef<HTMLPreElement>(null)
54
+ // measured on scroll, before the next lines land: after they land it is always false
55
+ const atBottom = useRef(true)
56
+ useLayoutEffect(() => {
57
+ const el = ref.current
58
+ if (el != null && atBottom.current) el.scrollTop = el.scrollHeight
59
+ }, [p.text])
60
+ return (
61
+ <pre
62
+ ref={ref}
63
+ onScroll={(e) => {
64
+ const el = e.currentTarget
65
+ atBottom.current = el.scrollHeight - el.scrollTop - el.clientHeight < 8
66
+ }}
67
+ >
68
+ {p.text}
69
+ </pre>
70
+ )
71
+ }
72
+
73
+ /** the whole preview text, negative lines included, as the prompt box takes it back. The
74
+ * clipboard needs a secure context: localhost is one, LAN http is not, and the button says so */
75
+ function PreviewCopy(p: { text: string }): ReactNode {
76
+ const [copied, setCopied] = useState(false)
77
+ const canCopy = typeof navigator !== 'undefined' && navigator.clipboard != null
78
+ useEffect(() => {
79
+ if (!copied) return
80
+ const t = setTimeout(() => setCopied(false), 1500)
81
+ return () => clearTimeout(t)
82
+ }, [copied])
83
+ return (
84
+ <button
85
+ type="button"
86
+ className="live-preview-copy"
87
+ disabled={!canCopy}
88
+ data-tip={canCopy ? (copied ? 'copied' : 'copy the full prompt') : 'copy needs localhost or https'}
89
+ onClick={() => {
90
+ navigator.clipboard.writeText(p.text).then(
91
+ () => setCopied(true),
92
+ (e: unknown) => console.error('[comfy-ts] 🔴 copy failed:', e),
93
+ )
94
+ }}
95
+ >
96
+ <Icon name={copied ? 'check' : 'copy'} />
97
+ </button>
98
+ )
99
+ }
100
+
46
101
  const LivePreviews = observer(function LivePreviews(p: { st: WebSt }) {
47
102
  const form = p.st.form
48
103
  const names = form == null ? [] : (p.st.moduleByKey(form.moduleKey)?.previews ?? [])
@@ -58,45 +113,47 @@ const LivePreviews = observer(function LivePreviews(p: { st: WebSt }) {
58
113
  // gallery; the full text is one click away
59
114
  const short = collapsedPreview(text)
60
115
  return (
61
- <button
62
- key={name}
63
- type="button"
64
- className={expanded ? 'live-preview expanded' : 'live-preview'}
65
- data-tip={expanded ? 'click to show one line each' : 'click for the full text'}
66
- onClick={() => p.st.togglePreviewExpanded(key)}
67
- >
68
- <span className="live-preview-name">
69
- {name}
70
- {form.previewError == null ? null : (
71
- <span className="live-preview-error" data-tip={`preview failed: ${form.previewError}`}>
72
- 🔴
73
- </span>
74
- )}
75
- </span>
76
- <span className="live-preview-lines">
77
- {!expanded ? (
78
- <>
79
- <span className="live-preview-line">{short.positive}</span>
80
- <span className="live-preview-line negative">
81
- {short.negative === '' ? '' : `− ${short.negative}`}
116
+ <div key={name} className="live-preview-row">
117
+ <button
118
+ type="button"
119
+ className={expanded ? 'live-preview expanded' : 'live-preview'}
120
+ data-tip={expanded ? 'click to show one line each' : 'click for the full text'}
121
+ onClick={() => p.st.togglePreviewExpanded(key)}
122
+ >
123
+ <span className="live-preview-name">
124
+ {name}
125
+ {form.previewError == null ? null : (
126
+ <span className="live-preview-error" data-tip={`preview failed: ${form.previewError}`}>
127
+ 🔴
82
128
  </span>
83
- </>
84
- ) : null}
85
- {expanded &&
86
- lines.map((line, ix) =>
87
- line.startsWith('- ') ? (
88
- // index keys: a preview's lines have no identity of their own
89
- <span key={ix} className="live-preview-line negative">
90
- − {line.slice(2)}
91
- </span>
92
- ) : (
93
- <span key={ix} className="live-preview-line">
94
- {line}
95
- </span>
96
- ),
97
129
  )}
98
- </span>
99
- </button>
130
+ </span>
131
+ <span className="live-preview-lines">
132
+ {!expanded ? (
133
+ <>
134
+ <span className="live-preview-line">{short.positive}</span>
135
+ <span className="live-preview-line negative">
136
+ {short.negative === '' ? '' : `− ${short.negative}`}
137
+ </span>
138
+ </>
139
+ ) : null}
140
+ {expanded &&
141
+ lines.map((line, ix) =>
142
+ line.startsWith('- ') ? (
143
+ // index keys: a preview's lines have no identity of their own
144
+ <span key={ix} className="live-preview-line negative">
145
+ − {line.slice(2)}
146
+ </span>
147
+ ) : (
148
+ <span key={ix} className="live-preview-line">
149
+ {line}
150
+ </span>
151
+ ),
152
+ )}
153
+ </span>
154
+ </button>
155
+ <PreviewCopy text={text} />
156
+ </div>
100
157
  )
101
158
  })}
102
159
  </div>
@@ -108,23 +165,8 @@ const LATENT_ICON: Record<LatentMode, IconName> = { full: 'image', corner: 'pane
108
165
  const ResultsHead = observer(function ResultsHead(p: { st: WebSt }) {
109
166
  return (
110
167
  <div className="results-head">
111
- {/* a caption over each group: three unlabelled icon strips read as one */}
112
- <div className="head-group-labeled">
113
- <span className="group-caption">preview</span>
114
- <span className="btn-group">
115
- {LAYOUTS.map((l) => (
116
- <button
117
- key={l.id}
118
- type="button"
119
- className={p.st.layout === l.id ? 'sel' : ''}
120
- data-tip={l.title}
121
- onClick={() => p.st.setLayout(l.id)}
122
- >
123
- <Icon name={l.icon} />
124
- </button>
125
- ))}
126
- </span>
127
- </div>
168
+ {/* a caption over each group: unlabelled icon strips read as one. Placement is page
169
+ layout, so it lives in the menu column */}
128
170
  <div className="head-group-labeled">
129
171
  <span className="group-caption">while running</span>
130
172
  <span className="row-inline head-row">
@@ -141,74 +183,41 @@ const ResultsHead = observer(function ResultsHead(p: { st: WebSt }) {
141
183
  </button>
142
184
  ))}
143
185
  </span>
144
- <span className="btn-group">
145
- <button
146
- type="button"
147
- className={p.st.showLogs ? 'sel' : ''}
148
- data-tip={p.st.showLogs ? 'hide the ComfyUI console' : 'show the ComfyUI console'}
149
- onClick={() => p.st.toggleLogs()}
150
- >
151
- <Icon name="terminal" />
152
- </button>
153
- </span>
154
186
  </span>
155
187
  </div>
156
- <div className="head-group-labeled">
157
- <span className="group-caption">results</span>
158
- <span className="row-inline results-view">
159
- <span className="btn-group">
160
- <button
161
- type="button"
162
- className={p.st.resultsView === 'fit' ? 'sel' : ''}
163
- data-tip="fit: one image per row, as wide as this panel"
164
- onClick={() => p.st.setResultsView('fit')}
165
- >
166
- <Icon name="rows" />
167
- </button>
168
- <button
169
- type="button"
170
- className={p.st.resultsView === 'grid' ? 'sel' : ''}
171
- data-tip="grid: images at the size you set, as many per row as fit"
172
- onClick={() => p.st.setResultsView('grid')}
173
- >
174
- <Icon name="grid" />
175
- </button>
188
+ <label className="cols-field" data-tip="results side by side: 1 is one image as wide as this panel">
189
+ <Icon name="grid" />
190
+ <input
191
+ type="number"
192
+ min={1}
193
+ max={8}
194
+ step={1}
195
+ value={p.st.resultsColumns}
196
+ onChange={(e) => {
197
+ const n = Number(e.target.value)
198
+ if (e.target.value !== '' && Number.isFinite(n)) p.st.setResultsColumns(n)
199
+ }}
200
+ />
201
+ cols
202
+ </label>
203
+ <span className="btn-group">
204
+ <button
205
+ type="button"
206
+ className={p.st.blurResults ? 'sel' : ''}
207
+ data-tip={
208
+ p.st.blurResults
209
+ ? 'blurred until you hover: click for always clear'
210
+ : 'always clear: click to blur until you hover'
211
+ }
212
+ onClick={() => p.st.toggleBlur()}
213
+ >
214
+ <Icon name={p.st.blurResults ? 'eye-off' : 'eye'} /> blur
215
+ <span className="kbd-hint">
216
+ {MOD_KEY}
217
+ {SHORTCUT_KEYS['toggle-blur']}
176
218
  </span>
177
- {/* always here, greyed out in fit: appearing with grid moved the groups beside it */}
178
- <input
179
- type="range"
180
- className="setting-range"
181
- min={120}
182
- max={640}
183
- step={20}
184
- disabled={p.st.resultsView !== 'grid'}
185
- value={p.st.resultsSize}
186
- data-tip={
187
- p.st.resultsView === 'grid' ? `image size ${p.st.resultsSize}px` : 'image size, for the grid view'
188
- }
189
- onChange={(e) => p.st.setResultsSize(Number(e.target.value))}
190
- />
191
- </span>
192
- </div>
193
- <div className="head-group-labeled">
194
- <span className="group-caption">
195
- blur <span className="kbd-hint">{MOD_KEY}B</span>
196
- </span>
197
- <span className="btn-group">
198
- <button
199
- type="button"
200
- className={p.st.blurResults ? 'sel' : ''}
201
- data-tip={
202
- p.st.blurResults
203
- ? `blurred until you hover: click (or ${MOD_KEY}B) for always clear`
204
- : `always clear: click (or ${MOD_KEY}B) to blur until you hover`
205
- }
206
- onClick={() => p.st.toggleBlur()}
207
- >
208
- <Icon name={p.st.blurResults ? 'eye-off' : 'eye'} />
209
- </button>
210
- </span>
211
- </div>
219
+ </button>
220
+ </span>
212
221
  </div>
213
222
  )
214
223
  })
@@ -280,8 +289,133 @@ const SplitWork = observer(function SplitWork(p: { st: WebSt; left: boolean; for
280
289
  )
281
290
  })
282
291
 
292
+ /** px: the rail is one icon wide, and a column dragged below MENU_MIN snaps to it */
293
+ const MENU_RAIL = 48
294
+ const MENU_MIN = 180
295
+
296
+ /** the menu as a resizable left Panel: its size and its collapsed state are kept in this
297
+ * browser, like the form and results split */
298
+ const MenuLayout = observer(function MenuLayout(p: { st: WebSt; main: ReactNode }) {
299
+ const saved = useDefaultLayout({ id: 'comfy-ts-menu', storage: splitStorage })
300
+ const menuRef = usePanelRef()
301
+ const [collapsed, setCollapsed] = useState(false)
302
+ // a rename (F2) types into the menu: a folded menu opens so the input is on screen
303
+ useEffect(
304
+ () =>
305
+ reaction(
306
+ () => p.st.renamingDraft != null,
307
+ (renaming) => {
308
+ const panel = menuRef.current
309
+ if (renaming && panel != null && panel.isCollapsed()) panel.expand()
310
+ },
311
+ ),
312
+ [p.st, menuRef],
313
+ )
314
+ // ⌘B and ☰ bump the tick; folding is the Panel's own state, so it is remembered with its size
315
+ useEffect(
316
+ () =>
317
+ reaction(
318
+ () => p.st.menuFoldTick,
319
+ () => {
320
+ const panel = menuRef.current
321
+ if (panel == null) return
322
+ if (panel.isCollapsed()) panel.expand()
323
+ else panel.collapse()
324
+ },
325
+ ),
326
+ [p.st, menuRef],
327
+ )
328
+ return (
329
+ <Group
330
+ id="comfy-ts-menu"
331
+ orientation="horizontal"
332
+ className="menu-layout"
333
+ defaultLayout={saved.defaultLayout}
334
+ onLayoutChanged={saved.onLayoutChanged}
335
+ >
336
+ <Panel
337
+ id="menu"
338
+ panelRef={menuRef}
339
+ defaultSize={220}
340
+ minSize={MENU_MIN}
341
+ maxSize={420}
342
+ collapsible
343
+ collapsedSize={MENU_RAIL}
344
+ groupResizeBehavior="preserve-pixel-size"
345
+ onResize={(size) => setCollapsed(size.inPixels < MENU_MIN - 1)}
346
+ className="menu-panel"
347
+ >
348
+ {collapsed ? (
349
+ <MenuRail st={p.st} onExpand={() => menuRef.current?.expand()} />
350
+ ) : (
351
+ <div className="menu-col">
352
+ <MenuHead
353
+ tip={`fold the menu to icons (${MOD_KEY}B), it stays folded in this browser`}
354
+ keyHint={`${MOD_KEY}${SHORTCUT_KEYS['toggle-menu']}`}
355
+ onBurger={() => menuRef.current?.collapse()}
356
+ />
357
+ <MenuCards st={p.st} />
358
+ </div>
359
+ )}
360
+ </Panel>
361
+ <Separator className="split-handle" />
362
+ <Panel id="main" minSize="40%" className="menu-main">
363
+ {p.main}
364
+ </Panel>
365
+ </Group>
366
+ )
367
+ })
368
+
369
+ /** phones: a slim bar naming where you are, the whole menu one tap away */
370
+ const MobileBar = observer(function MobileBar(p: { st: WebSt }) {
371
+ const form = p.st.form
372
+ return (
373
+ <div className="mobile-bar">
374
+ <button type="button" className="head-icon" aria-label="menu" onClick={() => p.st.setMenuOpen(true)}>
375
+ <Icon name="menu" />
376
+ </button>
377
+ <button type="button" className="mobile-where" onClick={() => p.st.omnibox.open()}>
378
+ <span className="menu-value mobile-workflow">{form?.moduleKey ?? 'no workflow'}</span>
379
+ {form == null ? null : <span className="mobile-draft"> · {form.draft}</span>}
380
+ </button>
381
+ </div>
382
+ )
383
+ })
384
+
385
+ const MenuDrawer = observer(function MenuDrawer(p: { st: WebSt }) {
386
+ if (!p.st.menuOpen) return null
387
+ return (
388
+ <div className="drawer-overlay" onClick={() => p.st.setMenuOpen(false)}>
389
+ <div className="drawer" onClick={(e) => e.stopPropagation()}>
390
+ <MenuHead
391
+ tip="close the menu"
392
+ keyHint={`${MOD_KEY}${SHORTCUT_KEYS['toggle-menu']}`}
393
+ onBurger={() => p.st.setMenuOpen(false)}
394
+ />
395
+ <MenuCards st={p.st} />
396
+ </div>
397
+ </div>
398
+ )
399
+ })
400
+
401
+ /** ⌘B (ctrl elsewhere) folds the menu column, or opens and closes the drawer on a phone */
402
+ function useMenuShortcut(st: WebSt, narrow: boolean): void {
403
+ useEffect(() => {
404
+ const onKey = (e: KeyboardEvent): void => {
405
+ if (shortcutOf(e) !== 'toggle-menu') return
406
+ e.preventDefault()
407
+ if (narrow) st.setMenuOpen(!st.menuOpen)
408
+ else st.requestMenuFold()
409
+ }
410
+ window.addEventListener('keydown', onKey)
411
+ return () => window.removeEventListener('keydown', onKey)
412
+ }, [st, narrow])
413
+ }
414
+
283
415
  export const App = observer(function App(p: { st: WebSt }) {
284
416
  const narrow = useNarrow()
417
+ useMenuShortcut(p.st, narrow)
418
+ useTabShortcuts(p.st)
285
419
  useSelectAllInFields()
286
420
  useOmniboxShortcut(p.st)
287
421
  if (p.st.phase === 'loading') return <div className="center">loading…</div>
@@ -307,7 +441,7 @@ export const App = observer(function App(p: { st: WebSt }) {
307
441
  </button>
308
442
  </div>
309
443
  {p.st.logsError != null ? <div className="error">🔴 {p.st.logsError}</div> : null}
310
- <pre>{p.st.logLines.join('\n')}</pre>
444
+ <ConsoleLines text={p.st.logLines.join('\n')} />
311
445
  </div>
312
446
  ) : null}
313
447
  </div>
@@ -338,45 +472,60 @@ export const App = observer(function App(p: { st: WebSt }) {
338
472
  // left / right on a screen wide enough: two FULL-HEIGHT panels, each scrolling on its own,
339
473
  // split by a handle you drag. Everything else is one scrolling page
340
474
  const split = (layout === 'side' || layout === 'left') && !narrow
475
+ const body = split ? (
476
+ <SplitWork
477
+ st={p.st}
478
+ left={layout === 'left'}
479
+ form={
480
+ <>
481
+ {notices}
482
+ {formCol}
483
+ </>
484
+ }
485
+ results={resultsCol}
486
+ />
487
+ ) : (
488
+ <div className="main">
489
+ {notices}
490
+ {/* the layout buttons drive ONE class, and it is the whole truth: the selected
491
+ button always names where the panel is */}
492
+ <div className={`work layout-${layout}`}>
493
+ {formCol}
494
+ {layout === 'off' ? (
495
+ // the panel took its buttons with it: this is the way back
496
+ <button
497
+ type="button"
498
+ className="show-preview"
499
+ data-tip="show the preview panel again"
500
+ onClick={() => p.st.showPreview()}
501
+ >
502
+ <Icon name="panel-side" /> preview
503
+ </button>
504
+ ) : (
505
+ resultsCol
506
+ )}
507
+ </div>
508
+ </div>
509
+ )
341
510
  return (
342
511
  <div className="app">
512
+ {narrow ? <MobileBar st={p.st} /> : null}
343
513
  <div className="cols">
344
- {split ? (
345
- <SplitWork
514
+ {narrow ? (
515
+ body
516
+ ) : (
517
+ <MenuLayout
346
518
  st={p.st}
347
- left={layout === 'left'}
348
- form={
349
- <>
350
- {notices}
351
- {formCol}
352
- </>
519
+ main={
520
+ <div className="tabs-col">
521
+ <DraftTabs st={p.st} />
522
+ <div className="tabs-body">{body}</div>
523
+ </div>
353
524
  }
354
- results={resultsCol}
355
525
  />
356
- ) : (
357
- <div className="main">
358
- {notices}
359
- {/* the layout buttons drive ONE class, and it is the whole truth: the selected
360
- button always names where the panel is */}
361
- <div className={`work layout-${layout}`}>
362
- {formCol}
363
- {layout === 'off' ? (
364
- // the panel took its buttons with it: this is the way back
365
- <button
366
- type="button"
367
- className="show-preview"
368
- data-tip="show the preview panel again"
369
- onClick={() => p.st.showPreview()}
370
- >
371
- <Icon name="panel-side" /> preview
372
- </button>
373
- ) : (
374
- resultsCol
375
- )}
376
- </div>
377
- </div>
378
526
  )}
379
527
  </div>
528
+ {narrow ? <MenuDrawer st={p.st} /> : null}
380
529
  <Omnibox st={p.st} />
381
530
  <TooltipLayer />
382
531
  </div>