funcnodes-react-flow 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl

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.
@@ -29924,7 +29924,7 @@ class VX {
29924
29924
  };
29925
29925
  }
29926
29926
  set_zustand(t) {
29927
- t !== this._zustand && (this._zustand = t, t.set_worker(this), this._zustand.auto_progress(), this._syncManager.stepwise_fullsync());
29927
+ t !== this._zustand && (t.logger.debug("Setting zustand for worker"), this._zustand = t, t.set_worker(this), this._zustand.auto_progress(), this._syncManager.stepwise_fullsync());
29928
29928
  }
29929
29929
  get is_open() {
29930
29930
  return this.state.getState().is_open;
@@ -31924,7 +31924,7 @@ class D3 extends VX {
31924
31924
  }
31925
31925
  class xZ {
31926
31926
  constructor(t, n) {
31927
- this.ws = null, this.reconnectAttempts = 0, this.maxReconnectAttempts = 999, this.initialTimeout = 200, this.maxTimeout = 2e3, this._wsuri = t, this.zustand = n, this.workers = {}, this.on_setWorker = (r) => {
31927
+ this.ws = null, this.reconnectAttempts = 0, this.maxReconnectAttempts = 999, this.initialTimeout = 200, this.maxTimeout = 2e3, n.logger.debug("Initializing worker manager"), this._wsuri = t, this.zustand = n, this.workers = {}, this.on_setWorker = (r) => {
31928
31928
  this.zustand.set_worker(r);
31929
31929
  }, this.connectionTimeout = setTimeout(() => {
31930
31930
  this.connect();
@@ -51954,9 +51954,9 @@ const Cw = ({
51954
51954
  library: r
51955
51955
  }) => {
51956
51956
  const [o, a] = _.useState(
51957
- e.options.worker
51957
+ e.options.worker || e.getWorkerManager().worker
51958
51958
  ), s = _.useRef(null);
51959
- e.workermanager && (e.workermanager.on_setWorker = a), e.set_worker(o), _.useEffect(() => {
51959
+ e.workermanager && (e.workermanager.on_setWorker = a), _.useEffect(() => {
51960
51960
  e.auto_progress();
51961
51961
  }, []), _.useEffect(() => {
51962
51962
  e.local_state.setState({ funcnodescontainerRef: s.current });
@@ -52136,7 +52136,7 @@ class Mpe extends ql {
52136
52136
  this.context.rf.logger.error("Unknown group action", n);
52137
52137
  }
52138
52138
  }, this.clear_all = () => {
52139
- this.workerManager.worker?.disconnect(), this.workerManager.set_worker(void 0), this.workerManager.workermanager?.setWorker(void 0), this.libManager.lib.libstate.getState().set({ lib: { shelves: [] }, external_worker: [] }), this.nodespace.nodesstates.clear(), this.reactFlowManager.useReactFlowStore.getState().update_nodes([]), this.reactFlowManager.useReactFlowStore.getState().update_edges([]), this.stateManager.auto_progress();
52139
+ this.context.rf.logger.debug("Clearing all nodespace"), this.workerManager.worker?.disconnect(), this.workerManager.set_worker(void 0), this.workerManager.workermanager?.setWorker(void 0), this.libManager.lib.libstate.getState().set({ lib: { shelves: [] }, external_worker: [] }), this.nodespace.nodesstates.clear(), this.reactFlowManager.useReactFlowStore.getState().update_nodes([]), this.reactFlowManager.useReactFlowStore.getState().update_edges([]), this.stateManager.auto_progress();
52140
52140
  }, this.center_node = (n) => {
52141
52141
  if (!this.reactFlowManager.rf_instance)
52142
52142
  return;
@@ -52291,13 +52291,17 @@ class Mpe extends ql {
52291
52291
  return r.update(n.node), r.getState();
52292
52292
  } else
52293
52293
  this.workerManager.worker && this.workerManager.worker.api.node.locally_update_node(n);
52294
+ }, this._sync_nodes = () => {
52295
+ const n = this.reactFlowManager.useReactFlowStore.getState().getNodes(), r = this.nodespace.nodesstates;
52296
+ for (const o of r.keys())
52297
+ n.some((a) => a.id === o) || r.delete(o);
52294
52298
  }, this._delete_node = (n) => {
52295
- this.context.rf.logger.info("Deleting node", n.id), n.from_remote ? this.reactFlowManager.useReactFlowStore.getState().onNodesChange([
52299
+ this.context.rf.logger.info("Deleting node", n.id), n.from_remote ? (this.reactFlowManager.useReactFlowStore.getState().onNodesChange([
52296
52300
  {
52297
52301
  type: "remove",
52298
52302
  id: n.id
52299
52303
  }
52300
- ]) : this.workerManager.worker?.api.node.remove_node(n.id);
52304
+ ]), this._sync_nodes()) : this.workerManager.worker?.api.node.remove_node(n.id);
52301
52305
  }, this._error_action = (n) => (this.context.rf.logger.error("Error", new Error(JSON.stringify(n))), this.on_node_action({
52302
52306
  type: "update",
52303
52307
  id: n.id,
@@ -52342,14 +52346,14 @@ class Npe extends ql {
52342
52346
  }
52343
52347
  class Dpe extends ql {
52344
52348
  constructor(t) {
52345
- super(t), this.workers = Er((n, r) => ({})), this.workerstate = Er((n, r) => ({
52349
+ super(t), t.rf.logger.debug("Initializing worker manager handler"), this.workers = Er((n, r) => ({})), this.workerstate = Er((n, r) => ({
52346
52350
  is_open: !1
52347
52351
  }));
52348
52352
  }
52349
52353
  set_worker(t) {
52350
- t !== this.worker && (this._unsubscribeFromWorker && (this._unsubscribeFromWorker(), this._unsubscribeFromWorker = void 0), t && (this._unsubscribeFromWorker = t.state.subscribe((n) => {
52354
+ t !== this.worker && (this._unsubscribeFromWorker && (this._unsubscribeFromWorker(), this._unsubscribeFromWorker = void 0), t ? (this.context.rf.logger.debug("Setting worker in worker manager"), this._unsubscribeFromWorker = t.state.subscribe((n) => {
52351
52355
  this.workerstate.setState(n);
52352
- }), this.workerstate.setState(t.state.getState())), this.worker = t, t?.set_zustand(this.context.rf));
52356
+ }), this.workerstate.setState(t.state.getState())) : this.context.rf.logger.debug("Removing worker in worker manager"), this.worker = t, t?.set_zustand(this.context.rf));
52353
52357
  }
52354
52358
  }
52355
52359
  class Ppe extends ql {
@@ -52794,7 +52798,7 @@ const Hpe = (e) => {
52794
52798
  );
52795
52799
  };
52796
52800
  window.FuncNodes = rj;
52797
- window.FuncNodes.version = "1.0.0";
52801
+ window.FuncNodes.version = "1.0.3";
52798
52802
  window.FuncNodes.utils = {
52799
52803
  logger: {
52800
52804
  ConsoleLogger: l1,