comfy-ts 2.15.0 → 2.16.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/dist/{LogsSt-C3UIWR-o.js → LogsSt-Ct7Le0S_.js} +2 -2
- package/dist/{LogsSt-C3UIWR-o.js.map → LogsSt-Ct7Le0S_.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +57 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -7
- package/dist/index.d.ts +55 -7
- package/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-B5PfIuhK.js → run-serve-C78hD7t9.js} +14 -5
- package/dist/run-serve-C78hD7t9.js.map +1 -0
- package/dist/{run-tui-D-N4_yyX.js → run-tui-nPETFRmk.js} +4 -4
- package/dist/{run-tui-D-N4_yyX.js.map → run-tui-nPETFRmk.js.map} +1 -1
- package/dist/{schemaDrift-BkN8rLiZ.js → schemaDrift-wb5XkrHV.js} +57 -4
- package/dist/schemaDrift-wb5XkrHV.js.map +1 -0
- package/dist/serve-web.js +48 -48
- package/dist/{state-CZsYJqB6.js → state-BMW57_M0.js} +3 -3
- package/dist/{state-CZsYJqB6.js.map → state-BMW57_M0.js.map} +1 -1
- package/dist/web.d.ts +55 -7
- package/dist/web.js +57 -4
- package/dist/web.js.map +1 -1
- package/examples/README.md +1 -0
- package/examples/media/README.md +6 -5
- package/examples/media/voice_en_6s.flac +0 -0
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +9 -1
- package/examples/rvion/10-anima-t2i.cflow.ts +8 -1
- package/examples/rvion/15-tts-voice-clone.cflow.ts +111 -0
- package/guide-for-agents.md +2 -1
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +15 -3
- package/src/cli/serve/web/components/DraftTabs.tsx +2 -1
- package/src/cli/serve/web/components/Gallery.tsx +2 -1
- package/src/cli/serve/web/components/HistoryPicker.tsx +5 -3
- package/src/cli/serve/web/components/MenuButton.tsx +2 -4
- package/src/cli/serve/web/components/Omnibox.tsx +2 -1
- package/src/cli/serve/web/components/PromptEnhancer.tsx +4 -3
- package/src/cli/serve/web/components/ShortcutsModal.tsx +2 -1
- package/src/cli/serve/web/components/SideMenu.tsx +2 -1
- package/src/cli/serve/web/components/controls/LorasControl.tsx +4 -3
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +2 -1
- package/src/cli/serve/web/components/controls/PromptControl.tsx +2 -1
- package/src/cli/serve/web/components/controls/SizeControl.tsx +2 -1
- package/src/cli/serve/web/state/escape.ts +16 -0
- package/src/coreExports.ts +10 -1
- package/src/vars/ComfyVars.ts +83 -13
- package/src/vars/DefinedWorkflow.ts +35 -2
- package/dist/run-serve-B5PfIuhK.js.map +0 -1
- package/dist/schemaDrift-BkN8rLiZ.js.map +0 -1
package/dist/web.d.ts
CHANGED
|
@@ -16385,20 +16385,33 @@ declare class ToggleVar extends ComfyVar<boolean> {
|
|
|
16385
16385
|
}
|
|
16386
16386
|
/** how many options a choice holds: exactly one (the default), one or none, or any number */
|
|
16387
16387
|
type ChoiceSelect = 'one' | 'zero-or-one' | 'many';
|
|
16388
|
+
/** where a host-bound choice reads its options: one loader input of the host's live schema,
|
|
16389
|
+
* optionally narrowed (`v.model`) */
|
|
16390
|
+
type HostSlotSource = {
|
|
16391
|
+
slot: string;
|
|
16392
|
+
filter?: RegExp;
|
|
16393
|
+
};
|
|
16388
16394
|
declare class ChoiceVar<T extends string> extends ComfyVar<T> {
|
|
16389
|
-
readonly choices: readonly T[];
|
|
16390
16395
|
readonly kind: 'choice';
|
|
16391
16396
|
readonly select: 'one';
|
|
16392
|
-
|
|
16397
|
+
private list;
|
|
16398
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T, label?: string);
|
|
16399
|
+
get choices(): readonly T[];
|
|
16400
|
+
/** set for `v.model`: the loader input this choice lists */
|
|
16401
|
+
get hostSlot(): HostSlotSource | null;
|
|
16402
|
+
bindHost(host: LorasHost): void;
|
|
16393
16403
|
next(delta?: number): this;
|
|
16394
16404
|
parse(raw: string): boolean;
|
|
16395
16405
|
}
|
|
16396
16406
|
/** one option or none: `null` is "nothing picked", clicking the lit option clears it */
|
|
16397
16407
|
declare class OptionalChoiceVar<T extends string> extends ComfyVar<T | null> {
|
|
16398
|
-
readonly choices: readonly T[];
|
|
16399
16408
|
readonly kind: 'choice';
|
|
16400
16409
|
readonly select: 'zero-or-one';
|
|
16401
|
-
|
|
16410
|
+
private list;
|
|
16411
|
+
constructor(choices: readonly T[] | HostSlotSource, defaultValue: T | null, label?: string);
|
|
16412
|
+
get choices(): readonly T[];
|
|
16413
|
+
get hostSlot(): HostSlotSource | null;
|
|
16414
|
+
bindHost(host: LorasHost): void;
|
|
16402
16415
|
/** pick `c`, or clear it when it is already the one picked */
|
|
16403
16416
|
toggle(c: T): this;
|
|
16404
16417
|
/** the TUI text form: a choice, or an empty line for none */
|
|
@@ -16435,6 +16448,22 @@ declare function choice<const T extends string>(choices: readonly T[], defaultVa
|
|
|
16435
16448
|
}): ChoiceVar<T>;
|
|
16436
16449
|
declare function choice<const T extends string>(choices: readonly T[], defaultValue: T | null, opts: ChoiceOpts<'zero-or-one'>): OptionalChoiceVar<T>;
|
|
16437
16450
|
declare function choice<const T extends string>(choices: readonly T[], defaultValue: readonly T[], opts: ChoiceOpts<'many'>): MultiChoiceVar<T>;
|
|
16451
|
+
type ModelVarOpts<T extends string> = {
|
|
16452
|
+
/** narrows the host's list: `/krea/i` */
|
|
16453
|
+
filter?: RegExp;
|
|
16454
|
+
label?: string;
|
|
16455
|
+
/** a file name, or null for "the workflow decides" (the build then reads null) */
|
|
16456
|
+
default: T | null;
|
|
16457
|
+
};
|
|
16458
|
+
/** a choice over the host's LIVE file list for one loader input (`'UNETLoader.unet_name'`),
|
|
16459
|
+
* resolved at define time and rebound by serve's refresh-schema: a downloaded model is picked
|
|
16460
|
+
* in the draft, never written into the workflow file */
|
|
16461
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
16462
|
+
default: T;
|
|
16463
|
+
}): ChoiceVar<T>;
|
|
16464
|
+
declare function model<T extends string>(slot: string, opts: ModelVarOpts<T> & {
|
|
16465
|
+
default: null;
|
|
16466
|
+
}): OptionalChoiceVar<T>;
|
|
16438
16467
|
type ActiveLora<T extends string> = {
|
|
16439
16468
|
lora_name: T;
|
|
16440
16469
|
strength_model: number;
|
|
@@ -16449,6 +16478,7 @@ type LorasHost = {
|
|
|
16449
16478
|
};
|
|
16450
16479
|
schema: {
|
|
16451
16480
|
getLoras(filter?: RegExp): string[];
|
|
16481
|
+
stringValues(slot: string): string[];
|
|
16452
16482
|
};
|
|
16453
16483
|
};
|
|
16454
16484
|
/**
|
|
@@ -16615,7 +16645,7 @@ declare class VideoVar extends MediaVar {
|
|
|
16615
16645
|
readonly kind: 'video';
|
|
16616
16646
|
loadInWorkflow<WID extends string>(wf: ComfyWorkflow<WID>): Promise<NodeOf<WID, 'LoadVideo'>>;
|
|
16617
16647
|
}
|
|
16618
|
-
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image / v.audio / v.video */
|
|
16648
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.model / v.loras / v.size / v.image / v.audio / v.video */
|
|
16619
16649
|
declare const v: {
|
|
16620
16650
|
text: (defaultValue: string, opts?: TextVarOpts | string) => TextVar;
|
|
16621
16651
|
prompt: (
|
|
@@ -16650,6 +16680,8 @@ declare const v: {
|
|
|
16650
16680
|
label?: string;
|
|
16651
16681
|
image?: ImageVar;
|
|
16652
16682
|
}) => SizeVar;
|
|
16683
|
+
/** host-bound: only inside defineWorkflow({ vars: (v) => … }), typed per slot there */
|
|
16684
|
+
model: typeof model;
|
|
16653
16685
|
image: (defaultValue: string, opts?: MediaVarOpts) => ImageVar;
|
|
16654
16686
|
audio: (defaultValue: string, opts?: MediaVarOpts) => AudioVar;
|
|
16655
16687
|
video: (defaultValue: string, opts?: MediaVarOpts) => VideoVar;
|
|
@@ -16692,10 +16724,26 @@ type LoraNameOf<ID extends string> = 'E_LoraName' extends keyof SdkForHost<ID>['
|
|
|
16692
16724
|
* the `v` handed to a vars LAMBDA: the global factory, host-typed —
|
|
16693
16725
|
* `v.loras(regex)` yields the host's lora-name union (resolved via bindHost)
|
|
16694
16726
|
*/
|
|
16695
|
-
type BoundVars<ID extends string> = Omit<typeof v, 'loras'> & {
|
|
16727
|
+
type BoundVars<ID extends string> = Omit<typeof v, 'loras' | 'model'> & {
|
|
16696
16728
|
loras(options: RegExp, initial?: LorasInput<LoraNameOf<ID>>, label?: string): LorasVar<LoraNameOf<ID>>;
|
|
16697
16729
|
loras<T extends string>(options: readonly T[], initial?: LorasInput<T>, label?: string): LorasVar<T>;
|
|
16730
|
+
/** the host's file list for one loader input: the slot autocompletes, the value is its union */
|
|
16731
|
+
model: ModelFactory<SdkForHost<ID>['Slots']>;
|
|
16698
16732
|
};
|
|
16733
|
+
/** `v.model` typed by a host's slot table S (`Slots`): its own interface, so the host id's
|
|
16734
|
+
* variance stays measurable (inlined into BoundVars, ComfyHost<ID> stopped being a ComfyHost<string>) */
|
|
16735
|
+
interface ModelFactory<S> {
|
|
16736
|
+
<K extends keyof S & string>(slot: K, opts: ModelVarOpts<S[K] & string> & {
|
|
16737
|
+
default: S[K] & string;
|
|
16738
|
+
}): ChoiceVar<S[K] & string>;
|
|
16739
|
+
<K extends keyof S & string>(slot: K, opts: ModelVarOpts<S[K] & string> & {
|
|
16740
|
+
default: null;
|
|
16741
|
+
}): OptionalChoiceVar<S[K] & string>;
|
|
16742
|
+
}
|
|
16743
|
+
/** every `Node.input` slot of the host's generated sdk (any string without one) */
|
|
16744
|
+
type SlotNameOf<ID extends string> = keyof SdkForHost<ID>['Slots'] & string;
|
|
16745
|
+
/** the value union of one slot, strings only (a loader file list) */
|
|
16746
|
+
type SlotValueOf<ID extends string, K extends string> = K extends keyof SdkForHost<ID>['Slots'] ? SdkForHost<ID>['Slots'][K] & string : string;
|
|
16699
16747
|
type DefineWorkflowSpec<ID extends string, V extends VarsSpec> = {
|
|
16700
16748
|
/** short id; also names the workflow instances */
|
|
16701
16749
|
id?: string;
|
|
@@ -18043,5 +18091,5 @@ type HostToPanel = {
|
|
|
18043
18091
|
comfyTs: 'get-state';
|
|
18044
18092
|
};
|
|
18045
18093
|
//#endregion
|
|
18046
|
-
export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyChoiceVar, type AnyVar, AudioVar, type AudioVarOpts, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, type ChoiceSelect, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, type ComfyAudioOutput, ComfyExecution, type ComfyExecutionData, type ComfyExecutionStatus, ComfyHost, ComfyHostAuthError, type ComfyHostData, type ComfyHostID, ComfyHostUnreachableError, type ComfyImageName, ComfyManager, ComfyNode, type ComfyNodeId, type ComfyNodeIdMode, type ComfyNodeMetadata, ComfyNodeOutput, type ComfyNodeSchemaJSON, ComfySchema, type ComfySchemaJSON, ComfySdkBase, ComfySdkShape, type ComfyStorage, ComfyTS, type ComfyTextOutput, type ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, type ComfyVideoOutput, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, type HostToPanel, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraEntry, type LoraLane, type LoraLanes, type LoraMirror, type LoraNameOf, type LoraRecord, type LoraStrength, type LoraSweep, type LorasHost, type LorasInput, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, MediaVar, MediaVarEmptyError, type MediaVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type PanelError, type PanelHostAction, type PanelRequest, type PanelResultAction, type PanelState, type PanelToHost, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptID, type PromptInput, type PromptLane, type PromptLanes, type PromptRelated_WsMsg, type PromptTagsOpts, type PromptValue, PromptVar, type PromptVarOpts, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SD15_SIZE_PRESETS, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, Tagged, TextVar, type TextVarOpts, ToggleVar, type VarKind, type VarPreset, type VarPresetSpec, type VarUi, type VarValues, type VarsSpec, VideoVar, type VideoVarOpts, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18094
|
+
export { AbsolutePath, type ActiveLora, type ActiveLoraSource, type AnyChoiceVar, type AnyVar, AudioVar, type AudioVarOpts, BaseNode, BaseNodeFactory, BaseNodeInputs, BaseNodeOutputs, type BoundVars, Branded, type CanonicalGroup, type CanonicalInput, type CanonicalLink, type CanonicalNode, type CanonicalOutput, type CanonicalWidgetValues, type CanonicalWorkflow, type ChoiceSelect, ChoiceVar, type CodegenOptions, type ComfyApiJson, type ComfyApiNodeJson, type ComfyAudioOutput, ComfyExecution, type ComfyExecutionData, type ComfyExecutionStatus, ComfyHost, ComfyHostAuthError, type ComfyHostData, type ComfyHostID, ComfyHostUnreachableError, type ComfyImageName, ComfyManager, ComfyNode, type ComfyNodeId, type ComfyNodeIdMode, type ComfyNodeMetadata, ComfyNodeOutput, type ComfyNodeSchemaJSON, ComfySchema, type ComfySchemaJSON, ComfySdkBase, ComfySdkShape, type ComfyStorage, ComfyTS, type ComfyTextOutput, type ComfyUnionValue, type ComfyUploadImageResult, ComfyUploader, ComfyVar, ComfyVarBase, type ComfyVideoOutput, ComfyWorkflow, ComfyWorkflowBuilder, type ComfyWorkflowData, type ComfyWorkflowID, type ConnectOptions, ConvertibleImageFormat, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, type DefineWorkflowSpec, DefinedWorkflow, Either, EmptyRecord, type ExecutionProgress, type ExecutionSnapshot, Flavor, FloatVar, HTMLContent, type HostSlotSource, type HostToPanel, ImageVar, ImageVarEmptyError, type ImageVarOpts, IntVar, InvalidPromptError, IsEqual, type LiteGraphJSON, type LmLoraItem, type LoraEntry, type LoraLane, type LoraLanes, type LoraMirror, type LoraNameOf, type LoraRecord, type LoraStrength, type LoraSweep, type LorasHost, type LorasInput, LorasVar, MDContent, Maybe, MediaImage, type MediaImageData, MediaVar, MediaVarEmptyError, type MediaVarOpts, type ModelVarOpts, MultiChoiceVar, type NodeMode, NodeOf, OptionalChoiceVar, type PanelError, type PanelHostAction, type PanelRequest, type PanelResultAction, type PanelState, type PanelToHost, type ParsedHostBase, PartialOmit, type PluginInstallStatus, type PluginSuggestion, type ProgressReport, type PromptID, type PromptInput, type PromptLane, type PromptLanes, type PromptRelated_WsMsg, type PromptTagsOpts, type PromptValue, PromptVar, type PromptVarOpts, type QualifiedNodeKey, RelativePath, type Requirements, ResilientWebSocketClient, Result, ResultFailure, type RunSettings, SD15_SIZE_PRESETS, SaveOptions, SdkForHost, SeedVar, type SizePreset, type SizeValue, SizeVar, type SlotNameOf, type SlotValueOf, Tagged, TextVar, type TextVarOpts, ToggleVar, type VarKind, type VarPreset, type VarPresetSpec, type VarUi, type VarValues, type VarsSpec, VideoVar, type VideoVarOpts, WorkflowConvertError, WorkflowNormalizeError, type WsLike, type WsMessageEvent, type WsMsg, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, number_Timestamp, parseHostBase, parseWorkflowJson, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
18047
18095
|
//# sourceMappingURL=web.d.ts.map
|
package/dist/web.js
CHANGED
|
@@ -101,7 +101,7 @@ function getComfyStorage() {
|
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region package.json
|
|
104
|
-
var version = "2.
|
|
104
|
+
var version = "2.16.0";
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
107
107
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -5013,12 +5013,46 @@ var ToggleVar = class extends ComfyVar {
|
|
|
5013
5013
|
return this.value ? "ON" : "OFF";
|
|
5014
5014
|
}
|
|
5015
5015
|
};
|
|
5016
|
+
/** a fixed list, or the host's list for one slot once bindHost ran */
|
|
5017
|
+
var ChoiceList = class {
|
|
5018
|
+
constructor(source) {
|
|
5019
|
+
this.source = source;
|
|
5020
|
+
this.resolved = null;
|
|
5021
|
+
}
|
|
5022
|
+
get slot() {
|
|
5023
|
+
return isChoiceList(this.source) ? null : this.source;
|
|
5024
|
+
}
|
|
5025
|
+
get choices() {
|
|
5026
|
+
if (isChoiceList(this.source)) return this.source;
|
|
5027
|
+
if (this.resolved == null) throw new Error(`v.model('${this.source.slot}') is host-bound — it only works inside defineWorkflow({ vars }) (pass a name list to v.choice otherwise)`);
|
|
5028
|
+
return this.resolved;
|
|
5029
|
+
}
|
|
5030
|
+
/** cast: whitelist family 1 (agent/coding.md) — stringValues() returns the runtime values of
|
|
5031
|
+
* the SAME object_info enum the generated slot union comes from */
|
|
5032
|
+
bind(host) {
|
|
5033
|
+
const src = this.slot;
|
|
5034
|
+
if (src == null) return;
|
|
5035
|
+
const all = host.schema.stringValues(src.slot);
|
|
5036
|
+
const filter = src.filter == null ? null : statelessRegex(src.filter);
|
|
5037
|
+
this.resolved = filter == null ? all : all.filter((n) => filter.test(n));
|
|
5038
|
+
}
|
|
5039
|
+
};
|
|
5016
5040
|
var ChoiceVar = class extends ComfyVar {
|
|
5017
5041
|
constructor(choices, defaultValue, label) {
|
|
5018
5042
|
super(defaultValue, label);
|
|
5019
|
-
this.choices = choices;
|
|
5020
5043
|
this.kind = "choice";
|
|
5021
5044
|
this.select = "one";
|
|
5045
|
+
this.list = new ChoiceList(choices);
|
|
5046
|
+
}
|
|
5047
|
+
get choices() {
|
|
5048
|
+
return this.list.choices;
|
|
5049
|
+
}
|
|
5050
|
+
/** set for `v.model`: the loader input this choice lists */
|
|
5051
|
+
get hostSlot() {
|
|
5052
|
+
return this.list.slot;
|
|
5053
|
+
}
|
|
5054
|
+
bindHost(host) {
|
|
5055
|
+
this.list.bind(host);
|
|
5022
5056
|
}
|
|
5023
5057
|
next(delta = 1) {
|
|
5024
5058
|
const nextIx = (this.choices.indexOf(this.value) + delta + this.choices.length) % this.choices.length;
|
|
@@ -5035,9 +5069,18 @@ var ChoiceVar = class extends ComfyVar {
|
|
|
5035
5069
|
var OptionalChoiceVar = class extends ComfyVar {
|
|
5036
5070
|
constructor(choices, defaultValue, label) {
|
|
5037
5071
|
super(defaultValue, label);
|
|
5038
|
-
this.choices = choices;
|
|
5039
5072
|
this.kind = "choice";
|
|
5040
5073
|
this.select = "zero-or-one";
|
|
5074
|
+
this.list = new ChoiceList(choices);
|
|
5075
|
+
}
|
|
5076
|
+
get choices() {
|
|
5077
|
+
return this.list.choices;
|
|
5078
|
+
}
|
|
5079
|
+
get hostSlot() {
|
|
5080
|
+
return this.list.slot;
|
|
5081
|
+
}
|
|
5082
|
+
bindHost(host) {
|
|
5083
|
+
this.list.bind(host);
|
|
5041
5084
|
}
|
|
5042
5085
|
/** pick `c`, or clear it when it is already the one picked */
|
|
5043
5086
|
toggle(c) {
|
|
@@ -5115,6 +5158,14 @@ function choice(choices, defaultValue, opts) {
|
|
|
5115
5158
|
if (defaultValue == null) throw new Error("a 'one' choice needs a default: use { select: 'zero-or-one' } for none");
|
|
5116
5159
|
return new ChoiceVar(choices, defaultValue, o.label);
|
|
5117
5160
|
}
|
|
5161
|
+
function model(slot, opts) {
|
|
5162
|
+
const source = {
|
|
5163
|
+
slot,
|
|
5164
|
+
filter: opts.filter
|
|
5165
|
+
};
|
|
5166
|
+
if (opts.default == null) return new OptionalChoiceVar(source, null, opts.label);
|
|
5167
|
+
return new ChoiceVar(source, opts.default, opts.label);
|
|
5168
|
+
}
|
|
5118
5169
|
/** normalize a loras record into what a standard LoraLoader chain consumes */
|
|
5119
5170
|
function activeLoras(loras) {
|
|
5120
5171
|
const out = [];
|
|
@@ -5529,7 +5580,7 @@ var VideoVar = class extends MediaVar {
|
|
|
5529
5580
|
return await this.loadVia(wf);
|
|
5530
5581
|
}
|
|
5531
5582
|
};
|
|
5532
|
-
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image / v.audio / v.video */
|
|
5583
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.model / v.loras / v.size / v.image / v.audio / v.video */
|
|
5533
5584
|
const v = {
|
|
5534
5585
|
text: (defaultValue, opts = {}) => new TextVar(defaultValue, typeof opts === "string" ? { label: opts } : opts),
|
|
5535
5586
|
prompt: (defaultValue, opts = {}) => new PromptVar(defaultValue, opts),
|
|
@@ -5544,6 +5595,8 @@ const v = {
|
|
|
5544
5595
|
choice,
|
|
5545
5596
|
loras: (options, initial = {}, label) => new LorasVar(options, initial, label),
|
|
5546
5597
|
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets ?? sizePresetsFor(defaultValue), opts.label, opts.image, opts.starred),
|
|
5598
|
+
/** host-bound: only inside defineWorkflow({ vars: (v) => … }), typed per slot there */
|
|
5599
|
+
model,
|
|
5547
5600
|
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts),
|
|
5548
5601
|
audio: (defaultValue, opts = {}) => new AudioVar(defaultValue, opts),
|
|
5549
5602
|
video: (defaultValue, opts = {}) => new VideoVar(defaultValue, opts)
|