dsh-comfyui-canvas 0.1.8 → 0.1.9

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 (2) hide show
  1. package/lib/client.js +15 -7
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -524,8 +524,9 @@ function ComfyUISplitToggle(props) {
524
524
  var sessionId = String(props.sessionId ?? "root");
525
525
  var scope = props.scope;
526
526
  var snapshot = React.useSyncExternalStore(
527
- function (cb) { return scope.subscribe(cb); },
528
- function () { return scope.getSnapshot(); },
527
+ function (cb) { return scope && typeof scope.subscribe === "function" ? scope.subscribe(cb) : function () {}; },
528
+ function () { return scope && typeof scope.getSnapshot === "function" ? scope.getSnapshot() : null; },
529
+ function () { return scope && typeof scope.getSnapshot === "function" ? scope.getSnapshot() : null; },
529
530
  );
530
531
  var value = (snapshot && snapshot.value) || {};
531
532
  var map = value.splitEnabledBySession || {};
@@ -590,7 +591,9 @@ function ComfyUISplitToggle(props) {
590
591
  drag.lastW = w;
591
592
  // 即时生效(CSS 变量驱动挤压样式),并持久化 railWidth。
592
593
  applyRailWidth(w);
593
- scope.set("railWidth", w).catch(function () { /* recover handled by scope */ });
594
+ if (scope && typeof scope.set === "function") {
595
+ scope.set("railWidth", w).catch(function () { /* recover handled by scope */ });
596
+ }
594
597
  // 拖动中实时重算画布覆盖层与把手位置(rail 左缘随宽度变化),
595
598
  // 否则把手会停在起点,脱离 rail 边界。
596
599
  var st = canvasState();
@@ -667,14 +670,18 @@ function ComfyUISplitToggle(props) {
667
670
  var next = {};
668
671
  for (var k in map) next[k] = map[k];
669
672
  next[sessionId] = !enabled;
670
- scope.set("splitEnabledBySession", next).catch(function () { /* recover handled by scope */ });
673
+ if (scope && typeof scope.set === "function") {
674
+ scope.set("splitEnabledBySession", next).catch(function () { /* recover handled by scope */ });
675
+ }
671
676
  };
672
677
 
673
678
  var toggleRail = function () {
674
679
  var next = {};
675
680
  for (var k in railClosedMap) next[k] = railClosedMap[k];
676
681
  next[sessionId] = !railClosed;
677
- scope.set("railClosedBySession", next).catch(function () { /* recover handled by scope */ });
682
+ if (scope && typeof scope.set === "function") {
683
+ scope.set("railClosedBySession", next).catch(function () { /* recover handled by scope */ });
684
+ }
678
685
  };
679
686
 
680
687
  // 顶栏折叠图标(buildCanvas 里 #dsh-comfy-rail-toggle)的点击事件 →
@@ -774,8 +781,9 @@ function ComfyUISplitToggle(props) {
774
781
  function ComfyUISettingsRow(props) {
775
782
  var scope = props.scope;
776
783
  var snapshot = React.useSyncExternalStore(
777
- function (cb) { return scope.subscribe(cb); },
778
- function () { return scope.getSnapshot(); },
784
+ function (cb) { return scope && typeof scope.subscribe === "function" ? scope.subscribe(cb) : function () {}; },
785
+ function () { return scope && typeof scope.getSnapshot === "function" ? scope.getSnapshot() : null; },
786
+ function () { return scope && typeof scope.getSnapshot === "function" ? scope.getSnapshot() : null; },
779
787
  );
780
788
  var value = (snapshot && snapshot.value) || {};
781
789
  var baseUrl = typeof value.baseUrl === "string" && value.baseUrl ? value.baseUrl : DEFAULT_BASE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-comfyui-canvas",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Give DeepSeek Harness agents live control of your ComfyUI canvas (local or cloud): embed it as a split-screen tab, then read/edit/run workflows, debug errors, fetch output images, and batch-sweep parameters straight from the chat. Ships the ComfyUI-side bridge node.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",