comfy-ts 2.11.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.
- package/README.md +1 -0
- package/dist/{LogsSt-qtFzOKpu.js → LogsSt-CUeo843w.js} +51 -7
- package/dist/LogsSt-CUeo843w.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/index.cjs +595 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +286 -46
- package/dist/index.d.ts +286 -46
- package/dist/index.js +591 -74
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-BK7BA2dn.js → run-serve-DlRBv_Nk.js} +738 -58
- package/dist/run-serve-DlRBv_Nk.js.map +1 -0
- package/dist/{run-tui-CQyvMf0N.js → run-tui-B5uxm2_l.js} +43 -18
- package/dist/run-tui-B5uxm2_l.js.map +1 -0
- package/dist/{schemaDrift-DjjEtwfx.js → schemaDrift-E95iTF7E.js} +473 -60
- package/dist/schemaDrift-E95iTF7E.js.map +1 -0
- package/dist/serve-web.js +710 -174
- package/dist/{state--wrz0BQc.js → state-CUp2J1Zy.js} +126 -14
- package/dist/state-CUp2J1Zy.js.map +1 -0
- package/dist/web.d.ts +286 -46
- package/dist/web.js +591 -74
- package/dist/web.js.map +1 -1
- package/examples/comfy-cloud/sdk.d.ts +163 -163
- package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
- package/examples/rvion/10-anima-t2i.cflow.ts +252 -0
- package/examples/rvion/11-yue2-t2a.cflow.ts +105 -0
- package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +78 -0
- package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +153 -0
- package/examples/rvion/stableAudio3Prompts.ts +19 -0
- package/extra/README.md +4 -0
- package/extra/comfyui-fresh-model-lists/README.md +25 -0
- package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
- package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
- package/package.json +15 -7
- package/src/cli/draftMeta.ts +39 -0
- package/src/cli/serve/ServeApp.ts +305 -30
- package/src/cli/serve/applyVarPayload.ts +50 -22
- package/src/cli/serve/byteRange.ts +48 -0
- package/src/cli/serve/describeVar.ts +42 -6
- package/src/cli/serve/llmConfigShape.ts +51 -0
- package/src/cli/serve/llmConfigs.ts +52 -0
- package/src/cli/serve/run-serve.ts +12 -3
- package/src/cli/serve/tagList.ts +92 -0
- package/src/cli/serve/tagSource.ts +69 -0
- package/src/cli/serve/web/api.ts +72 -0
- package/src/cli/serve/web/components/App.tsx +485 -44
- package/src/cli/serve/web/components/DraftTabs.tsx +167 -0
- package/src/cli/serve/web/components/Gallery.tsx +133 -31
- package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
- package/src/cli/serve/web/components/Icon.tsx +58 -2
- package/src/cli/serve/web/components/MenuButton.tsx +53 -0
- package/src/cli/serve/web/components/Omnibox.tsx +135 -0
- package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
- package/src/cli/serve/web/components/SideMenu.tsx +414 -0
- package/src/cli/serve/web/components/TooltipLayer.tsx +46 -0
- package/src/cli/serve/web/components/VarIcon.tsx +24 -0
- package/src/cli/serve/web/components/VarsForm.tsx +223 -351
- package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
- package/src/cli/serve/web/components/controls/LorasControl.tsx +646 -317
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
- package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
- package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
- package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
- package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
- package/src/cli/serve/web/components/modKey.ts +2 -0
- package/src/cli/serve/web/llm.ts +23 -12
- package/src/cli/serve/web/promptEditor/promptExtensions.ts +284 -0
- package/src/cli/serve/web/state/EnhancerSt.ts +431 -101
- package/src/cli/serve/web/state/FormSt.ts +214 -30
- package/src/cli/serve/web/state/OmniboxSt.ts +59 -0
- package/src/cli/serve/web/state/WebSt.ts +364 -80
- package/src/cli/serve/web/state/choiceButtons.ts +61 -0
- package/src/cli/serve/web/state/draftNames.ts +16 -0
- package/src/cli/serve/web/state/draftTabs.ts +75 -0
- package/src/cli/serve/web/state/generateButton.ts +16 -0
- package/src/cli/serve/web/state/history.ts +54 -0
- package/src/cli/serve/web/state/host.ts +5 -2
- package/src/cli/serve/web/state/keptLines.ts +53 -0
- package/src/cli/serve/web/state/latentMode.ts +20 -0
- package/src/cli/serve/web/state/loraSort.ts +18 -0
- package/src/cli/serve/web/state/moduleTree.ts +2 -2
- package/src/cli/serve/web/state/omnibox.ts +133 -0
- package/src/cli/serve/web/state/payload.ts +38 -58
- package/src/cli/serve/web/state/shortcuts.ts +103 -0
- package/src/cli/serve/web/state/sizeStars.ts +31 -0
- package/src/cli/serve/web/state/stableSlots.ts +21 -0
- package/src/cli/serve/web/state/varGroups.ts +24 -0
- package/src/cli/serve/web/styles.ts +653 -154
- package/src/cli/serve/webBundle.ts +54 -10
- package/src/cli/serve/workflowTags.ts +42 -0
- package/src/cli/serve/workspaceLabels.ts +23 -0
- package/src/cli/tui/components/PickerOverlays.tsx +9 -2
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
- package/src/cli/tui/state/DraftsSt.ts +28 -8
- package/src/cli/tui/state/EditorSt.ts +1 -1
- package/src/cli/tui/state/LorasSt.ts +1 -1
- package/src/cli/tui/state/PickerSt.ts +25 -7
- package/src/cli/tui/state/SettingsSt.ts +1 -1
- package/src/cli/tui/state/TuiSt.ts +10 -0
- package/src/coreExports.ts +21 -0
- package/src/host/ComfyHost.ts +17 -2
- package/src/host/ResilientWebsocket.ts +54 -4
- package/src/host/loraInfoCache.ts +6 -0
- package/src/runner/ComfyExecution.ts +60 -0
- package/src/runner/ComfyWorkflow.ts +4 -0
- package/src/runner/ComfyWsApi.ts +2 -0
- package/src/runner/MediaImage.ts +2 -2
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +5 -5
- package/src/sdk-generator/comfyui-sdk-codegen.ts +1 -1
- package/src/state.ts +5 -0
- package/src/utils/copyName.ts +12 -0
- package/src/vars/ComfyVars.ts +337 -67
- package/src/vars/DefinedWorkflow.ts +47 -20
- package/src/vars/lanes.ts +238 -0
- package/src/vars/loraEntry.ts +101 -0
- package/src/vars/promptSyntax.ts +382 -0
- package/dist/LogsSt-qtFzOKpu.js.map +0 -1
- package/dist/run-serve-BK7BA2dn.js.map +0 -1
- package/dist/run-tui-CQyvMf0N.js.map +0 -1
- package/dist/schemaDrift-DjjEtwfx.js.map +0 -1
- package/dist/state--wrz0BQc.js.map +0 -1
- package/src/cli/serve/web/components/Sidebar.tsx +0 -66
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// a ⋯ button and the small menu it opens: where the rarely used actions go, so a row shows its
|
|
2
|
+
// content instead of a strip of buttons. A backdrop under the menu closes it on any outside
|
|
3
|
+
// click, no document listener to leak
|
|
4
|
+
import { useState, type ReactNode } from 'react'
|
|
5
|
+
import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
|
|
6
|
+
|
|
7
|
+
export function MenuButton(p: {
|
|
8
|
+
tip: string
|
|
9
|
+
className?: string
|
|
10
|
+
/** the menu body; `close` is handed over so an item can shut the menu after acting */
|
|
11
|
+
children: (close: () => void) => ReactNode
|
|
12
|
+
}): ReactNode {
|
|
13
|
+
const [open, setOpen] = useState(false)
|
|
14
|
+
const close = (): void => setOpen(false)
|
|
15
|
+
return (
|
|
16
|
+
<span
|
|
17
|
+
className={`preset-box menu-box ${p.className ?? ''}`}
|
|
18
|
+
onKeyDown={(e) => (e.key === 'Escape' ? close() : undefined)}
|
|
19
|
+
>
|
|
20
|
+
<button
|
|
21
|
+
type="button"
|
|
22
|
+
className="menu-btn"
|
|
23
|
+
aria-expanded={open}
|
|
24
|
+
data-tip={p.tip}
|
|
25
|
+
onClick={() => setOpen(!open)}
|
|
26
|
+
>
|
|
27
|
+
<Icon name="more" />
|
|
28
|
+
</button>
|
|
29
|
+
{open ? (
|
|
30
|
+
<>
|
|
31
|
+
<div className="preset-backdrop" onClick={close} />
|
|
32
|
+
<div className="preset-menu menu-list">{p.children(close)}</div>
|
|
33
|
+
</>
|
|
34
|
+
) : null}
|
|
35
|
+
</span>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** one menu line: a button, or a checkbox line when `checked` is given */
|
|
40
|
+
export function MenuItem(p: {
|
|
41
|
+
label: ReactNode
|
|
42
|
+
onClick: () => void
|
|
43
|
+
checked?: boolean
|
|
44
|
+
disabled?: boolean
|
|
45
|
+
tip?: string
|
|
46
|
+
}): ReactNode {
|
|
47
|
+
return (
|
|
48
|
+
<button type="button" className="menu-item" disabled={p.disabled} data-tip={p.tip} onClick={p.onClick}>
|
|
49
|
+
<span className="menu-check">{p.checked == null ? '' : p.checked ? '✓' : ''}</span>
|
|
50
|
+
{p.label}
|
|
51
|
+
</button>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// ⌘K / ⌘J: type a few letters of any folder, workflow, draft or tag, Enter opens it.
|
|
2
|
+
// a workflow row (icon, path, tag chips) then its drafts indented. Modules that failed to
|
|
3
|
+
// load are listed under the matches, since nothing else shows them
|
|
4
|
+
import { observer } from 'mobx-react-lite'
|
|
5
|
+
import { useEffect, useRef } from 'react'
|
|
6
|
+
import { Icon, type IconName } from 'src/cli/serve/web/components/Icon.tsx'
|
|
7
|
+
import { entryKey, type OmniboxEntry } from 'src/cli/serve/web/state/omnibox.ts'
|
|
8
|
+
import { isOmniboxKey } from 'src/cli/serve/web/state/shortcuts.ts'
|
|
9
|
+
import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
|
|
10
|
+
|
|
11
|
+
/** the first media tag picks the icon: what the workflow makes */
|
|
12
|
+
const ICON_BY_TAG: Record<string, IconName> = { image: 'image', audio: 'audio', video: 'video', text: 'text' }
|
|
13
|
+
|
|
14
|
+
function workflowIcon(tags: readonly string[]): IconName {
|
|
15
|
+
for (const t of tags) {
|
|
16
|
+
const icon = ICON_BY_TAG[t]
|
|
17
|
+
if (icon != null) return icon
|
|
18
|
+
}
|
|
19
|
+
return 'workflow'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** the tags with their own color; any other tag is a neutral chip */
|
|
23
|
+
const TINTED = new Set(['image', 'audio', 'video', 'text', 'llm', 'edit'])
|
|
24
|
+
|
|
25
|
+
function OmniRow(p: { entry: OmniboxEntry; sel: boolean; open: boolean; words: string[]; onPick: () => void }) {
|
|
26
|
+
const e = p.entry
|
|
27
|
+
const cls = ['omni-row', e.kind, p.sel ? 'sel' : '', p.open ? 'open' : ''].join(' ')
|
|
28
|
+
if (e.kind === 'draft')
|
|
29
|
+
return (
|
|
30
|
+
<button type="button" className={cls} onClick={p.onPick}>
|
|
31
|
+
<Icon name="draft" size={0.95} />
|
|
32
|
+
<span className="omni-draft">{e.draft}</span>
|
|
33
|
+
{p.open ? <span className="omni-open">open</span> : null}
|
|
34
|
+
</button>
|
|
35
|
+
)
|
|
36
|
+
return (
|
|
37
|
+
<button type="button" className={cls} onClick={p.onPick}>
|
|
38
|
+
<span className={`omni-icon tint-${workflowIcon(e.tags)}`}>
|
|
39
|
+
<Icon name={workflowIcon(e.tags)} />
|
|
40
|
+
</span>
|
|
41
|
+
<span className="omni-path">
|
|
42
|
+
{e.folder === '' ? null : <span className="omni-folder">{e.folder} / </span>}
|
|
43
|
+
<span className="omni-name">{e.module}</span>
|
|
44
|
+
</span>
|
|
45
|
+
<span className="omni-tags">
|
|
46
|
+
{e.tags.map((t) => (
|
|
47
|
+
<span
|
|
48
|
+
key={t}
|
|
49
|
+
className={['omni-tag', TINTED.has(t) ? `tint-${t}` : '', p.words.includes(t) ? 'hit' : ''].join(' ')}
|
|
50
|
+
>
|
|
51
|
+
{t}
|
|
52
|
+
</span>
|
|
53
|
+
))}
|
|
54
|
+
<span className="omni-host">{e.host}</span>
|
|
55
|
+
</span>
|
|
56
|
+
</button>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** ⌘K and ⌘J (ctrl on other systems) from ANY focus, a text field included: it is a jump,
|
|
61
|
+
* not an edit, and the prompt textarea is where the focus usually is */
|
|
62
|
+
export function useOmniboxShortcut(st: WebSt): void {
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const onKey = (e: KeyboardEvent): void => {
|
|
65
|
+
if (!isOmniboxKey(e)) return
|
|
66
|
+
e.preventDefault()
|
|
67
|
+
st.omnibox.toggle()
|
|
68
|
+
}
|
|
69
|
+
window.addEventListener('keydown', onKey)
|
|
70
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
71
|
+
}, [st])
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const Omnibox = observer(function Omnibox(p: { st: WebSt }) {
|
|
75
|
+
const o = p.st.omnibox
|
|
76
|
+
const listRef = useRef<HTMLDivElement>(null)
|
|
77
|
+
// the lit row stays in view while arrowing through a long list
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
listRef.current?.querySelector('.omni-row.sel')?.scrollIntoView({ block: 'nearest' })
|
|
80
|
+
}, [o.cursor, o.query])
|
|
81
|
+
if (!o.isOpen) return null
|
|
82
|
+
const results = o.results
|
|
83
|
+
const errors = Object.entries(p.st.loadErrors)
|
|
84
|
+
const current = p.st.form
|
|
85
|
+
const words = o.query.trim().toLowerCase().split(/\s+/)
|
|
86
|
+
return (
|
|
87
|
+
<div className="modal-overlay omni-overlay" onClick={() => o.close()}>
|
|
88
|
+
<div className="modal omni" onClick={(e) => e.stopPropagation()}>
|
|
89
|
+
<div className="modal-head">
|
|
90
|
+
<input
|
|
91
|
+
type="text"
|
|
92
|
+
autoFocus
|
|
93
|
+
placeholder="workflow, draft or tag (audio, image, edit…)"
|
|
94
|
+
value={o.query}
|
|
95
|
+
onChange={(e) => o.setQuery(e.target.value)}
|
|
96
|
+
onKeyDown={(e) => {
|
|
97
|
+
if (e.key === 'ArrowDown') o.move(1)
|
|
98
|
+
else if (e.key === 'ArrowUp') o.move(-1)
|
|
99
|
+
else if (e.key === 'Enter') o.pick()
|
|
100
|
+
else if (e.key === 'Escape') o.close()
|
|
101
|
+
else return
|
|
102
|
+
e.preventDefault()
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
<div className="modal-body omni-list" ref={listRef}>
|
|
107
|
+
{results.length === 0 ? <div className="hint">no workflow or draft matches</div> : null}
|
|
108
|
+
{results.map((entry, ix) => (
|
|
109
|
+
<OmniRow
|
|
110
|
+
key={entryKey(entry)}
|
|
111
|
+
entry={entry}
|
|
112
|
+
sel={ix === o.cursor}
|
|
113
|
+
open={
|
|
114
|
+
entry.kind === 'draft' && current?.moduleKey === entry.module && current.draft === entry.draft
|
|
115
|
+
}
|
|
116
|
+
words={words}
|
|
117
|
+
onPick={() => o.pick(entry)}
|
|
118
|
+
/>
|
|
119
|
+
))}
|
|
120
|
+
{errors.length > 0 ? (
|
|
121
|
+
<div className="omni-errors">
|
|
122
|
+
<div className="section-title">failed to load</div>
|
|
123
|
+
{errors.map(([file, msg]) => (
|
|
124
|
+
<div key={file}>
|
|
125
|
+
<div className="file">{file}</div>
|
|
126
|
+
<div className="msg">{msg}</div>
|
|
127
|
+
</div>
|
|
128
|
+
))}
|
|
129
|
+
</div>
|
|
130
|
+
) : null}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
)
|
|
135
|
+
})
|