@linkdlab/funcnodes_react_flow 1.0.0 → 1.0.3
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/funcnodes_react_flow.css +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +19 -20
- package/dist/index.umd.js +6 -6
- package/package.json +89 -89
package/dist/index.d.ts
CHANGED
|
@@ -982,6 +982,12 @@ declare class NodeSpaceManager extends AbstractFuncNodesReactFlowHandleHandler i
|
|
|
982
982
|
_set_groups: (groups: NodeGroups) => void;
|
|
983
983
|
_add_node: (action: NodeActionAdd) => NodeType | undefined;
|
|
984
984
|
_update_node: (action: NodeActionUpdate) => NodeType | undefined;
|
|
985
|
+
/**
|
|
986
|
+
* Sync the nodes between the nodespace and the react zustand
|
|
987
|
+
* This is needed because e.g. deleting a node removes it from the react zustand but the nodespace still has it
|
|
988
|
+
* so we need to sync the nodes between the two
|
|
989
|
+
*/
|
|
990
|
+
_sync_nodes: () => void;
|
|
985
991
|
_delete_node: (action: NodeActionDelete) => undefined;
|
|
986
992
|
_error_action: (action: NodeActionError) => NodeType | undefined;
|
|
987
993
|
_trigger_action: (action: NodeActionTrigger) => NodeType | undefined;
|
package/dist/index.es.js
CHANGED
|
@@ -32911,11 +32911,7 @@ const nY = (e) => {
|
|
|
32911
32911
|
R.currentPage > 1 && (J.preventDefault(), J.stopPropagation(), U(R.currentPage - 1));
|
|
32912
32912
|
break;
|
|
32913
32913
|
case "ArrowRight":
|
|
32914
|
-
R.currentPage < R.totalPages && (
|
|
32915
|
-
"ArrowRight",
|
|
32916
|
-
R.currentPage,
|
|
32917
|
-
R.totalPages
|
|
32918
|
-
), J.preventDefault(), J.stopPropagation(), U(R.currentPage + 1));
|
|
32914
|
+
R.currentPage < R.totalPages && (J.preventDefault(), J.stopPropagation(), U(R.currentPage + 1));
|
|
32919
32915
|
break;
|
|
32920
32916
|
case "Home":
|
|
32921
32917
|
R.currentPage > 1 && (J.preventDefault(), J.stopPropagation(), U(1));
|
|
@@ -44398,7 +44394,7 @@ const bO = ({
|
|
|
44398
44394
|
ref: y,
|
|
44399
44395
|
src: w,
|
|
44400
44396
|
alt: n,
|
|
44401
|
-
className: `base64-image-renderer ${l.className || ""} ${h ? " loading" : ""}`,
|
|
44397
|
+
className: `base64-image-renderer image-renderer ${l.className || ""} ${h ? " loading" : ""}`,
|
|
44402
44398
|
...l
|
|
44403
44399
|
}
|
|
44404
44400
|
) : /* @__PURE__ */ T.jsx(bO, {});
|
|
@@ -44498,7 +44494,7 @@ const bO = ({
|
|
|
44498
44494
|
"img",
|
|
44499
44495
|
{
|
|
44500
44496
|
ref: l,
|
|
44501
|
-
className: `streaming-image ${a.className || ""} ${h ? " loading" : ""}`,
|
|
44497
|
+
className: `streaming-image image-renderer ${a.className || ""} ${h ? " loading" : ""}`,
|
|
44502
44498
|
alt: t,
|
|
44503
44499
|
...a
|
|
44504
44500
|
}
|
|
@@ -46641,7 +46637,7 @@ class Koe {
|
|
|
46641
46637
|
};
|
|
46642
46638
|
}
|
|
46643
46639
|
set_zustand(t) {
|
|
46644
|
-
t !== this._zustand && (this._zustand = t, t.set_worker(this), this._zustand.auto_progress(), this._syncManager.stepwise_fullsync());
|
|
46640
|
+
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());
|
|
46645
46641
|
}
|
|
46646
46642
|
get is_open() {
|
|
46647
46643
|
return this.state.getState().is_open;
|
|
@@ -48641,7 +48637,7 @@ class DL extends Koe {
|
|
|
48641
48637
|
}
|
|
48642
48638
|
class Oie {
|
|
48643
48639
|
constructor(t, n) {
|
|
48644
|
-
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) => {
|
|
48640
|
+
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) => {
|
|
48645
48641
|
this.zustand.set_worker(r);
|
|
48646
48642
|
}, this.connectionTimeout = setTimeout(() => {
|
|
48647
48643
|
this.connect();
|
|
@@ -56065,7 +56061,7 @@ function T0(e) {
|
|
|
56065
56061
|
throw new Error("No IO found");
|
|
56066
56062
|
return z.useCallback(
|
|
56067
56063
|
(r, a) => {
|
|
56068
|
-
|
|
56064
|
+
t?.set_io_value({
|
|
56069
56065
|
nid: e.node,
|
|
56070
56066
|
ioid: e.id,
|
|
56071
56067
|
value: r,
|
|
@@ -57968,7 +57964,6 @@ const pV = (e) => {
|
|
|
57968
57964
|
}
|
|
57969
57965
|
}, [n, u]), Et(() => {
|
|
57970
57966
|
if (r) {
|
|
57971
|
-
console.log("ungroupPressed");
|
|
57972
57967
|
const S = d(), { group_nodes: A } = h(S);
|
|
57973
57968
|
A.forEach((E) => {
|
|
57974
57969
|
v?.remove_group(E.id);
|
|
@@ -68688,9 +68683,9 @@ const zM = ({
|
|
|
68688
68683
|
library: r
|
|
68689
68684
|
}) => {
|
|
68690
68685
|
const [a, l] = Qe(
|
|
68691
|
-
e.options.worker
|
|
68686
|
+
e.options.worker || e.getWorkerManager().worker
|
|
68692
68687
|
), u = z.useRef(null);
|
|
68693
|
-
e.workermanager && (e.workermanager.on_setWorker = l),
|
|
68688
|
+
e.workermanager && (e.workermanager.on_setWorker = l), z.useEffect(() => {
|
|
68694
68689
|
e.auto_progress();
|
|
68695
68690
|
}, []), z.useEffect(() => {
|
|
68696
68691
|
e.local_state.setState({ funcnodescontainerRef: u.current });
|
|
@@ -68870,7 +68865,7 @@ class Pwe extends O0 {
|
|
|
68870
68865
|
this.context.rf.logger.error("Unknown group action", n);
|
|
68871
68866
|
}
|
|
68872
68867
|
}, this.clear_all = () => {
|
|
68873
|
-
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();
|
|
68868
|
+
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();
|
|
68874
68869
|
}, this.center_node = (n) => {
|
|
68875
68870
|
if (!this.reactFlowManager.rf_instance)
|
|
68876
68871
|
return;
|
|
@@ -69025,13 +69020,17 @@ class Pwe extends O0 {
|
|
|
69025
69020
|
return r.update(n.node), r.getState();
|
|
69026
69021
|
} else
|
|
69027
69022
|
this.workerManager.worker && this.workerManager.worker.api.node.locally_update_node(n);
|
|
69023
|
+
}, this._sync_nodes = () => {
|
|
69024
|
+
const n = this.reactFlowManager.useReactFlowStore.getState().getNodes(), r = this.nodespace.nodesstates;
|
|
69025
|
+
for (const a of r.keys())
|
|
69026
|
+
n.some((l) => l.id === a) || r.delete(a);
|
|
69028
69027
|
}, this._delete_node = (n) => {
|
|
69029
|
-
this.context.rf.logger.info("Deleting node", n.id), n.from_remote ? this.reactFlowManager.useReactFlowStore.getState().onNodesChange([
|
|
69028
|
+
this.context.rf.logger.info("Deleting node", n.id), n.from_remote ? (this.reactFlowManager.useReactFlowStore.getState().onNodesChange([
|
|
69030
69029
|
{
|
|
69031
69030
|
type: "remove",
|
|
69032
69031
|
id: n.id
|
|
69033
69032
|
}
|
|
69034
|
-
]) : this.workerManager.worker?.api.node.remove_node(n.id);
|
|
69033
|
+
]), this._sync_nodes()) : this.workerManager.worker?.api.node.remove_node(n.id);
|
|
69035
69034
|
}, this._error_action = (n) => (this.context.rf.logger.error("Error", new Error(JSON.stringify(n))), this.on_node_action({
|
|
69036
69035
|
type: "update",
|
|
69037
69036
|
id: n.id,
|
|
@@ -69076,14 +69075,14 @@ class Vwe extends O0 {
|
|
|
69076
69075
|
}
|
|
69077
69076
|
class Fwe extends O0 {
|
|
69078
69077
|
constructor(t) {
|
|
69079
|
-
super(t), this.workers = bl((n, r) => ({})), this.workerstate = bl((n, r) => ({
|
|
69078
|
+
super(t), t.rf.logger.debug("Initializing worker manager handler"), this.workers = bl((n, r) => ({})), this.workerstate = bl((n, r) => ({
|
|
69080
69079
|
is_open: !1
|
|
69081
69080
|
}));
|
|
69082
69081
|
}
|
|
69083
69082
|
set_worker(t) {
|
|
69084
|
-
t !== this.worker && (this._unsubscribeFromWorker && (this._unsubscribeFromWorker(), this._unsubscribeFromWorker = void 0), t
|
|
69083
|
+
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) => {
|
|
69085
69084
|
this.workerstate.setState(n);
|
|
69086
|
-
}), this.workerstate.setState(t.state.getState())), this.worker = t, t?.set_zustand(this.context.rf));
|
|
69085
|
+
}), 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));
|
|
69087
69086
|
}
|
|
69088
69087
|
}
|
|
69089
69088
|
class Gwe extends O0 {
|
|
@@ -69158,7 +69157,7 @@ class Xwe extends O0 {
|
|
|
69158
69157
|
super(t), this.plugins = bl((n, r) => ({})), this.render_options = bl((n, r) => ({}));
|
|
69159
69158
|
}
|
|
69160
69159
|
add_plugin(t, n) {
|
|
69161
|
-
if (
|
|
69160
|
+
if (n !== void 0)
|
|
69162
69161
|
try {
|
|
69163
69162
|
const r = $we(n);
|
|
69164
69163
|
this.plugins.setState((a) => ({ ...a, [t]: r }));
|