comfy-ts 2.14.0 → 2.15.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-CUeo843w.js → LogsSt-C3UIWR-o.js} +2 -2
- package/dist/{LogsSt-CUeo843w.js.map → LogsSt-C3UIWR-o.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +213 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +123 -21
- package/dist/index.d.ts +123 -21
- package/dist/index.js +207 -54
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-DUqcn0h3.js → run-serve-B5PfIuhK.js} +108 -38
- package/dist/run-serve-B5PfIuhK.js.map +1 -0
- package/dist/{run-tui-D-LaSqgB.js → run-tui-D-N4_yyX.js} +15 -9
- package/dist/run-tui-D-N4_yyX.js.map +1 -0
- package/dist/{schemaDrift-E95iTF7E.js → schemaDrift-BkN8rLiZ.js} +163 -25
- package/dist/schemaDrift-BkN8rLiZ.js.map +1 -0
- package/dist/serve-web.js +62 -48
- package/dist/{state-BytbdZ8s.js → state-CZsYJqB6.js} +45 -35
- package/dist/state-CZsYJqB6.js.map +1 -0
- package/dist/web.d.ts +120 -21
- package/dist/web.js +196 -51
- package/dist/web.js.map +1 -1
- package/examples/media/README.md +8 -0
- package/examples/media/sine_440hz_3s.flac +0 -0
- package/examples/media/testsrc_256x256_3s.mp4 +0 -0
- package/examples/rvion/14-video-soundtrack.cflow.ts +47 -0
- package/guide-for-agents.md +2 -1
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +101 -30
- package/src/cli/serve/applyVarPayload.ts +5 -3
- package/src/cli/serve/describeVar.ts +5 -3
- package/src/cli/serve/resultHistory.ts +22 -6
- package/src/cli/serve/run-serve.ts +4 -1
- package/src/cli/serve/web/api.ts +4 -0
- package/src/cli/serve/web/components/Gallery.tsx +84 -4
- package/src/cli/serve/web/components/VarsForm.tsx +5 -3
- package/src/cli/serve/web/components/controls/MediaControl.tsx +111 -0
- package/src/cli/serve/web/state/FormSt.ts +70 -2
- package/src/cli/serve/web/state/host.ts +2 -0
- package/src/cli/serve/web/state/mediaDrop.ts +76 -0
- package/src/cli/serve/web/styles.ts +16 -2
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +4 -1
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +15 -6
- package/src/cli/tui/state/TuiSt.ts +1 -1
- package/src/coreExports.ts +10 -0
- package/src/exampleAssets.ts +13 -3
- package/src/host/ComfyUploader.ts +34 -27
- package/src/index.ts +1 -1
- package/src/runner/ComfyExecution.ts +38 -20
- package/src/runner/ComfyWsApi.ts +3 -0
- package/src/runner/mediaKinds.ts +51 -0
- package/src/vars/ComfyVars.ts +96 -22
- package/dist/run-serve-DUqcn0h3.js.map +0 -1
- package/dist/run-tui-D-LaSqgB.js.map +0 -1
- package/dist/schemaDrift-E95iTF7E.js.map +0 -1
- package/dist/state-BytbdZ8s.js.map +0 -1
- package/src/cli/serve/web/components/controls/ImageControl.tsx +0 -72
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// image: a path/url input the api already accepts, plus a browser upload
|
|
2
|
-
// (POST /upload → local file under outputs/serve-inputs/) and a preview when
|
|
3
|
-
// the value is browser-reachable
|
|
4
|
-
import { Icon } from 'src/cli/serve/web/components/Icon.tsx'
|
|
5
|
-
import { observer } from 'mobx-react-lite'
|
|
6
|
-
import { useRef } from 'react'
|
|
7
|
-
import { uploadFile } from 'src/cli/serve/web/api.ts'
|
|
8
|
-
import type { VarSt } from 'src/cli/serve/web/state/FormSt.ts'
|
|
9
|
-
|
|
10
|
-
export const ImageControl = observer(function ImageControl(p: { v: VarSt }) {
|
|
11
|
-
const fileInput = useRef<HTMLInputElement>(null)
|
|
12
|
-
const value = typeof p.v.value === 'string' ? p.v.value : ''
|
|
13
|
-
const previewUrl = /^https?:\/\//.test(value) ? value : p.v.uploadedUrl
|
|
14
|
-
const extensions = p.v.desc.extensions ?? []
|
|
15
|
-
const onFile = async (file: File | undefined): Promise<void> => {
|
|
16
|
-
if (file == null) return
|
|
17
|
-
try {
|
|
18
|
-
const reply = await uploadFile({ file })
|
|
19
|
-
p.v.set(reply.path)
|
|
20
|
-
p.v.setUploadedUrl(reply.url)
|
|
21
|
-
} catch (e) {
|
|
22
|
-
// loud both ways: the row hint cannot show async errors, alert can
|
|
23
|
-
alert(`upload failed: ${e instanceof Error ? e.message : String(e)}`)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return (
|
|
27
|
-
<div>
|
|
28
|
-
<div className="row-inline">
|
|
29
|
-
<input
|
|
30
|
-
type="text"
|
|
31
|
-
style={{ flex: 1 }}
|
|
32
|
-
placeholder="local path or http(s) url"
|
|
33
|
-
value={value}
|
|
34
|
-
onChange={(e) => {
|
|
35
|
-
p.v.set(e.target.value)
|
|
36
|
-
p.v.setUploadedUrl(null)
|
|
37
|
-
}}
|
|
38
|
-
/>
|
|
39
|
-
<button type="button" onClick={() => fileInput.current?.click()}>
|
|
40
|
-
upload…
|
|
41
|
-
</button>
|
|
42
|
-
{value !== '' ? (
|
|
43
|
-
<button
|
|
44
|
-
type="button"
|
|
45
|
-
data-tip="clear the image"
|
|
46
|
-
onClick={() => {
|
|
47
|
-
p.v.set('')
|
|
48
|
-
p.v.setUploadedUrl(null)
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
<Icon name="close" />
|
|
52
|
-
</button>
|
|
53
|
-
) : null}
|
|
54
|
-
<input
|
|
55
|
-
ref={fileInput}
|
|
56
|
-
type="file"
|
|
57
|
-
accept={extensions.map((ext) => `.${ext}`).join(',')}
|
|
58
|
-
style={{ display: 'none' }}
|
|
59
|
-
onChange={(e) => {
|
|
60
|
-
void onFile(e.target.files?.[0])
|
|
61
|
-
e.target.value = ''
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
</div>
|
|
65
|
-
{previewUrl != null && previewUrl !== '' ? (
|
|
66
|
-
<div className="img-preview">
|
|
67
|
-
<img src={previewUrl} alt={value} />
|
|
68
|
-
</div>
|
|
69
|
-
) : null}
|
|
70
|
-
</div>
|
|
71
|
-
)
|
|
72
|
-
})
|