@rkmodules/rules 0.0.145 → 0.0.146
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/index.cjs.js +21 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -11
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -607,9 +607,14 @@ function getValue$1(obj, path) {
|
|
|
607
607
|
return;
|
|
608
608
|
}
|
|
609
609
|
var parts = path.split(".");
|
|
610
|
-
var
|
|
611
|
-
|
|
612
|
-
|
|
610
|
+
var key = parts.shift() || "";
|
|
611
|
+
var safeObj = Object.fromEntries(Object.entries(obj).map(function (_a) {
|
|
612
|
+
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
|
613
|
+
return [safeName(k), v];
|
|
614
|
+
}));
|
|
615
|
+
var value = safeObj[key];
|
|
616
|
+
if (parts.length) {
|
|
617
|
+
return getValue$1(value, parts.join("."));
|
|
613
618
|
}
|
|
614
619
|
return value;
|
|
615
620
|
}
|
|
@@ -2575,7 +2580,6 @@ var explodeObject = {
|
|
|
2575
2580
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
2576
2581
|
if (key[0] === "_")
|
|
2577
2582
|
return;
|
|
2578
|
-
key = safeName(key);
|
|
2579
2583
|
if (!outputs[key]) {
|
|
2580
2584
|
outputs[key] = {};
|
|
2581
2585
|
}
|
|
@@ -6292,13 +6296,14 @@ var Input = function (_a) {
|
|
|
6292
6296
|
var normalized = normalizeVarDef(varDef);
|
|
6293
6297
|
var value = (_b = data.inputs) === null || _b === void 0 ? void 0 : _b[name];
|
|
6294
6298
|
var isRef = isReference(value);
|
|
6299
|
+
var portId = "".concat(id, "-").concat(safeName(name));
|
|
6295
6300
|
var handleInputChange = function (param) { return function (value) {
|
|
6296
6301
|
var _a;
|
|
6297
6302
|
data.onChange({
|
|
6298
6303
|
inputs: __assign(__assign({}, data.inputs), (_a = {}, _a[param] = value, _a)),
|
|
6299
6304
|
});
|
|
6300
6305
|
}; };
|
|
6301
|
-
return (React.createElement(Handle, { type: "target", position: Position.Left, id:
|
|
6306
|
+
return (React.createElement(Handle, { type: "target", position: Position.Left, id: portId, className: classNames(styles$1.Input, styles$1.Port, styles$1["type-".concat(normalized.type)]), style: {
|
|
6302
6307
|
"--type-color": "var(--color-".concat(normalized.type, ")"),
|
|
6303
6308
|
}, onClick: onClick },
|
|
6304
6309
|
React.createElement("span", { className: styles$1.PortLabel }, normalized.label || name),
|
|
@@ -6327,7 +6332,8 @@ var Param = function (_a) {
|
|
|
6327
6332
|
var Output = function (_a) {
|
|
6328
6333
|
var name = _a.name, varDef = _a.varDef, id = _a.id, onClick = _a.onClick, focus = _a.focus;
|
|
6329
6334
|
var normalized = normalizeVarDef(varDef);
|
|
6330
|
-
|
|
6335
|
+
var portId = "".concat(id, "-").concat(safeName(name));
|
|
6336
|
+
return (React.createElement(Handle, { type: "source", position: Position.Right, id: portId, className: classNames(styles$1.Output, styles$1.Port, styles$1["type-".concat(normalized.type)]), style: {
|
|
6331
6337
|
"--type-color": "var(--color-".concat(normalized.type, ")"),
|
|
6332
6338
|
}, onClick: onClick },
|
|
6333
6339
|
React.createElement("span", { className: styles$1.PortLabel },
|
|
@@ -6803,6 +6809,8 @@ var OutputNode = React.memo(function (_a) {
|
|
|
6803
6809
|
}
|
|
6804
6810
|
});
|
|
6805
6811
|
}); };
|
|
6812
|
+
// TODO: this seems specifically for the output node only, adjusting the main rule IO spec,
|
|
6813
|
+
// we need to change the current function spec instead
|
|
6806
6814
|
var onAdd = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
6807
6815
|
var newName;
|
|
6808
6816
|
var _a;
|
|
@@ -6822,6 +6830,8 @@ var OutputNode = React.memo(function (_a) {
|
|
|
6822
6830
|
}
|
|
6823
6831
|
});
|
|
6824
6832
|
}); };
|
|
6833
|
+
// TODO: this seems specifically for the output node only, adjusting the main rule IO spec,
|
|
6834
|
+
// we need to change the current function spec instead
|
|
6825
6835
|
var onDelete = function (name) {
|
|
6826
6836
|
var _a;
|
|
6827
6837
|
(_a = data.onIOChange) === null || _a === void 0 ? void 0 : _a.call(data, function (fn) {
|
|
@@ -6875,7 +6885,7 @@ var DynamicOutput = React.memo(function (_a) {
|
|
|
6875
6885
|
if (event.name === id) {
|
|
6876
6886
|
var result = event.result || {};
|
|
6877
6887
|
setOutputs(Object.fromEntries(Object.keys(result).map(function (name, i) { return [
|
|
6878
|
-
|
|
6888
|
+
name,
|
|
6879
6889
|
{ type: "any", label: name },
|
|
6880
6890
|
]; })));
|
|
6881
6891
|
}
|
|
@@ -6981,9 +6991,9 @@ function updateNodeArguments(node, inputs, params) {
|
|
|
6981
6991
|
* returns an object with the source node id, target node id, source field name and target field name
|
|
6982
6992
|
*/
|
|
6983
6993
|
function deRefEdgeHandle(handle) {
|
|
6984
|
-
var match = handle.match(/^(
|
|
6994
|
+
var match = handle.match(/^(.+?)-(.+)$/);
|
|
6985
6995
|
if (!match) {
|
|
6986
|
-
throw new Error("Invalid handle format");
|
|
6996
|
+
throw new Error("Invalid handle format" + handle);
|
|
6987
6997
|
}
|
|
6988
6998
|
return { node: match[1], field: match[2] };
|
|
6989
6999
|
}
|
|
@@ -7015,8 +7025,8 @@ function createEdge(nodeId, ref) {
|
|
|
7015
7025
|
id: "".concat(ref.path, "-").concat(nodeId, ".").concat(ref.name),
|
|
7016
7026
|
source: ref.refNode,
|
|
7017
7027
|
target: nodeId,
|
|
7018
|
-
sourceHandle: "".concat(ref.refNode, "-").concat(ref.refField),
|
|
7019
|
-
targetHandle: "".concat(nodeId, "-").concat(ref.name),
|
|
7028
|
+
sourceHandle: "".concat(ref.refNode, "-").concat(safeName(ref.refField)),
|
|
7029
|
+
targetHandle: "".concat(nodeId, "-").concat(safeName(ref.name)),
|
|
7020
7030
|
};
|
|
7021
7031
|
}
|
|
7022
7032
|
/**
|