comfy-ts 2.17.0 → 2.17.1

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 (37) hide show
  1. package/dist/{ServeApp-BSA5yzxZ.js → ServeApp-qXcQfdgT.js} +3 -3
  2. package/dist/ServeApp-qXcQfdgT.js.map +1 -0
  3. package/dist/cli.js +58 -8
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.cjs +37 -11
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.js +37 -11
  8. package/dist/index.js.map +1 -1
  9. package/dist/{run-run-DnaMLCFn.js → run-run-tg82jUIk.js} +3 -3
  10. package/dist/{run-run-DnaMLCFn.js.map → run-run-tg82jUIk.js.map} +1 -1
  11. package/dist/{run-serve-CbKxIu6i.js → run-serve-DaXzoVTS.js} +58 -12
  12. package/dist/run-serve-DaXzoVTS.js.map +1 -0
  13. package/dist/{run-tui-B0AQWbad.js → run-tui-Bw7BA75d.js} +3 -3
  14. package/dist/{run-tui-B0AQWbad.js.map → run-tui-Bw7BA75d.js.map} +1 -1
  15. package/dist/serve-web.js +56 -48
  16. package/dist/{state-C2oDiQ26.js → state-zTow5ucI.js} +38 -12
  17. package/dist/state-zTow5ucI.js.map +1 -0
  18. package/dist/web.js +37 -11
  19. package/dist/web.js.map +1 -1
  20. package/package.json +2 -2
  21. package/src/cli/bunHop.ts +49 -0
  22. package/src/cli/comfy-ts-cli.ts +4 -4
  23. package/src/cli/serve/run-serve.ts +51 -13
  24. package/src/cli/serve/web/components/App.tsx +2 -0
  25. package/src/cli/serve/web/components/DialogLayer.tsx +55 -0
  26. package/src/cli/serve/web/components/DraftTabs.tsx +8 -3
  27. package/src/cli/serve/web/components/PromptEnhancer.tsx +15 -9
  28. package/src/cli/serve/web/components/SideMenu.tsx +16 -8
  29. package/src/cli/serve/web/state/WebSt.ts +10 -1
  30. package/src/cli/serve/web/state/dialog.ts +59 -0
  31. package/src/cli/serve/web/state/keptLines.ts +1 -1
  32. package/src/cli/serve/web/styles.ts +8 -0
  33. package/src/litegraph/convertFlowToLiteGraphJSON.ts +38 -20
  34. package/src/promptEnhancers.ts +1 -1
  35. package/dist/ServeApp-BSA5yzxZ.js.map +0 -1
  36. package/dist/run-serve-CbKxIu6i.js.map +0 -1
  37. package/dist/state-C2oDiQ26.js.map +0 -1
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ function createNodeStorage() {
110
110
  }
111
111
  //#endregion
112
112
  //#region package.json
113
- var version = "2.17.0";
113
+ var version = "2.17.1";
114
114
  //#endregion
115
115
  //#region src/litegraph/LiteGraphLinkID.ts
116
116
  const asLiteGraphLinkID = (id) => id;
@@ -1713,20 +1713,40 @@ const convertFlowToLiteGraphJSON = (graph) => {
1713
1713
  const convertNodeToLiteGraphNode = (ctx, node) => {
1714
1714
  const inputs = [];
1715
1715
  const widgets_values = [];
1716
+ const pushLinked = (name, type, link, shape) => {
1717
+ const nodeUidNumber = bang(ctx.graph.nodes.find((n) => n.uid === link[0])?.uidNumber, `link target node "${link[0]}" not found in graph`);
1718
+ const linkId = ctx.allocateLink(nodeUidNumber, link[1], node.uidNumber, asLiteGraphSlotIndex(inputs.length), type);
1719
+ inputs.push(shape == null ? {
1720
+ name,
1721
+ type,
1722
+ link: linkId
1723
+ } : {
1724
+ name,
1725
+ type,
1726
+ shape,
1727
+ link: linkId
1728
+ });
1729
+ };
1716
1730
  for (const ipt of node.$schema.inputs) {
1717
- const raw = node.serializeValue(ipt.nameInComfy, node.json.inputs[ipt.nameInComfy]);
1718
1731
  const kind = classifySchemaInput(ipt);
1719
- if (_isLink(raw)) {
1720
- const nodeUidNumber = bang(ctx.graph.nodes.find((n) => n.uid === raw[0])?.uidNumber, `link target node "${raw[0]}" not found in graph`);
1721
- inputs.push({
1722
- name: ipt.nameInComfy,
1723
- type: ipt.typeName,
1724
- link: ctx.allocateLink(nodeUidNumber, raw[1], node.uidNumber, asLiteGraphSlotIndex(inputs.length), ipt.typeName)
1725
- });
1726
- } else if (kind.kind === "widget") {
1732
+ if (kind.kind === "dynamic-container") {
1733
+ const type = containerInstanceSlotType(ipt.opts) ?? "*";
1734
+ for (const instance of kind.instanceNames) {
1735
+ const name = `${ipt.nameInComfy}.${instance}`;
1736
+ const value = node.json.inputs[name];
1737
+ if (value == null) continue;
1738
+ const raw = node.serializeValue(name, value);
1739
+ if (!_isLink(raw)) throw new Error(`🔴 [toWorkflowJson] ${node.$schema.nameInComfy}#${node.uid} "${name}" holds a literal; an autogrow instance is a link slot in the editor`);
1740
+ pushLinked(name, type, raw, 7);
1741
+ }
1742
+ continue;
1743
+ }
1744
+ const raw = node.serializeValue(ipt.nameInComfy, node.json.inputs[ipt.nameInComfy]);
1745
+ if (_isLink(raw)) pushLinked(ipt.nameInComfy, ipt.typeName, raw);
1746
+ else if (kind.kind === "widget") {
1727
1747
  widgets_values.push(...kind.prefixValues, raw);
1728
1748
  const phantoms = kind.consumes - 1 - kind.prefixValues.length;
1729
- for (let i = 0; i < phantoms; i++) widgets_values.push(false);
1749
+ for (let i = 0; i < phantoms; i++) widgets_values.push(controlMode(ipt.opts));
1730
1750
  } else inputs.push({
1731
1751
  name: ipt.nameInComfy,
1732
1752
  type: ipt.typeName,
@@ -1749,6 +1769,12 @@ const convertNodeToLiteGraphNode = (ctx, node) => {
1749
1769
  widgets_values
1750
1770
  };
1751
1771
  };
1772
+ /** the editor's control widget is a combo (fixed, increment, decrement, randomize):
1773
+ * a config naming a mode keeps it, anything else is `fixed`, the seed the code pinned */
1774
+ const controlMode = (opts) => {
1775
+ const mode = typeof opts === "object" && opts != null ? Reflect.get(opts, "control_after_generate") : null;
1776
+ return typeof mode === "string" ? mode : "fixed";
1777
+ };
1752
1778
  const _isLink = (v) => {
1753
1779
  return Array.isArray(v) && v.length === 2 && typeof v[0] === "string" && typeof v[1] === "number";
1754
1780
  };