@rkmodules/rules 0.0.29 → 0.0.31

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.css CHANGED
@@ -1,3 +1,79 @@
1
+ /** port */
2
+ .Port_XWl7K,
3
+ .Port_XWl7K.react-flow__handle {
4
+ position: relative;
5
+ border: 1px solid red;
6
+ border: initial;
7
+ width:auto;
8
+ border-radius: 0;
9
+ height: initial;
10
+ transform: initial;
11
+ left: initial;
12
+ right: initial;
13
+ background: initial;
14
+ padding: 2px 8px;
15
+ display: flex;
16
+ gap: 8px;
17
+ align-items: center;
18
+ min-height: 22px;
19
+ }
20
+ .Port_XWl7K.required_ofB6J {
21
+ font-weight: bold;
22
+ }
23
+
24
+ .Port_XWl7K.react-flow__handle-right {
25
+ text-align: right;
26
+ }
27
+
28
+ .Port_XWl7K.react-flow__handle::after {
29
+ content: "";
30
+ position: absolute;
31
+ top: 50%;
32
+ width: 6px;
33
+ height: 6px;
34
+ border-radius: 50%;
35
+ border: 1px solid white;
36
+ background-color: var(--type-color, black);
37
+ }
38
+
39
+ .Port_XWl7K.react-flow__handle-left::after,
40
+ .Port_XWl7K.react-flow__handle-left .Icon_YJDC5 {
41
+ left: -1px;
42
+ transform: translate(-50%, -50%);
43
+ }
44
+
45
+ .Port_XWl7K.react-flow__handle-right::after,
46
+ .Port_XWl7K.react-flow__handle-right .Icon_YJDC5 {
47
+ right: -1px;
48
+ transform: translate(50%, -50%);
49
+ }
50
+
51
+ .Input_PHp3D {
52
+ color: var(--type-color);
53
+ --xy-handle-background-color: var(--type-color);
54
+ }
55
+
56
+ .Output_FMRNv {
57
+ text-align: right;
58
+ color: var(--type-color);
59
+ --xy-handle-background-color: var(--type-color);
60
+ justify-content: right;
61
+ }
62
+
63
+
64
+ /** edges */
65
+
66
+ .ConnectionPath_XkXr1.valid_LGNvc {
67
+ stroke: var(--connection-color, #333);
68
+ stroke-width: 2;
69
+ }
70
+
71
+ .react-flow__edge.selected .Edge_aNtpH .react-flow__edge-path,
72
+ .react-flow__edge .Edge_aNtpH.Hover_1v8QT .react-flow__edge-path {
73
+ stroke: var(--connection-color, #333);
74
+ stroke-width: 2;
75
+ }
76
+
1
77
  .DefaultNode_R2P6c {
2
78
  --ln: var(--node-line);
3
79
  --bg: var(--node-background);
package/dist/index.js CHANGED
@@ -946,9 +946,9 @@ var series = {
946
946
  label: "Series",
947
947
  description: "Create a series of numbers.",
948
948
  inputs: {
949
- start: "number",
950
- step: "number",
951
- count: "number",
949
+ start: { type: "number", default: 1 },
950
+ step: { type: "number", default: 1 },
951
+ count: { type: "number", default: 10 },
952
952
  },
953
953
  outputs: {
954
954
  series: "number",
@@ -1060,6 +1060,7 @@ var primitives$1 = (_a = {},
1060
1060
  _a[groupOr.name] = groupOr,
1061
1061
  _a);
1062
1062
 
1063
+ var Lib = { Util: primitives$6, Math: primitives$5, List: primitives$4, Sequence: primitives$3, Tree: primitives$2, Logic: primitives$1 };
1063
1064
  var primitives = __assign(__assign(__assign(__assign(__assign(__assign({}, primitives$6), primitives$5), primitives$4), primitives$3), primitives$2), primitives$1);
1064
1065
 
1065
1066
  function isPrimitive(node) {
@@ -1482,7 +1483,7 @@ function Control(_a) {
1482
1483
  }
1483
1484
  }
1484
1485
 
1485
- var styles = {"DefaultNode":"DefaultNode_R2P6c","selected":"selected_VmB-F","active":"active_zjUzx","Log":"Log_dsq5e","Label":"Label_wBwWA","Description":"Description_f9s4l","Input":"Input_Yhvzf","Output":"Output_e4yF-","PreviewHead":"PreviewHead_oFT4K","expanded":"expanded_3vnbi","Preview":"Preview_HbkZ6","Duration":"Duration_0jqWx","Table":"Table_aZyRT","GroupHead":"GroupHead_QJhST","GroupChildren":"GroupChildren_NKx-B","GroupLeaf":"GroupLeaf_eliT8"};
1486
+ var styles$1 = {"Port":"Port_XWl7K","required":"required_ofB6J","Icon":"Icon_YJDC5","Input":"Input_PHp3D","Output":"Output_FMRNv","ConnectionPath":"ConnectionPath_XkXr1","valid":"valid_LGNvc","Edge":"Edge_aNtpH","Hover":"Hover_1v8QT"};
1486
1487
 
1487
1488
  var Input = function (_a) {
1488
1489
  var _b;
@@ -1496,13 +1497,11 @@ var Input = function (_a) {
1496
1497
  inputs: __assign(__assign({}, data.inputs), (_a = {}, _a[param] = value, _a)),
1497
1498
  });
1498
1499
  }; };
1499
- return (React.createElement("tr", { key: name, className: classNames(styles.Input, styles["type-".concat(normalized.type)]), style: {
1500
+ return (React.createElement(react.Handle, { type: "target", position: react.Position.Left, id: "".concat(id, "-").concat(name), className: classNames(styles$1.Input, styles$1.Port, styles$1["type-".concat(normalized.type)]), style: {
1500
1501
  "--type-color": "var(--color-".concat(normalized.type, ")"),
1501
1502
  }, onClick: onClick },
1502
- React.createElement("td", null,
1503
- normalized.label || name,
1504
- React.createElement(react.Handle, { type: "target", position: react.Position.Left, id: "".concat(id, "-").concat(name) })),
1505
- React.createElement("td", null, !isRef && (React.createElement(Control, { type: normalized.type, value: value, onChange: handleInputChange(name) })))));
1503
+ normalized.label || name,
1504
+ !isRef && (React.createElement(Control, { type: normalized.type, value: value, onChange: handleInputChange(name) }))));
1506
1505
  };
1507
1506
 
1508
1507
  var Param = function (_a) {
@@ -1517,23 +1516,22 @@ var Param = function (_a) {
1517
1516
  params: __assign(__assign({}, data.params), (_a = {}, _a[param] = value, _a)),
1518
1517
  });
1519
1518
  }; };
1520
- return (React.createElement("tr", { key: name, className: classNames(styles.Input, styles["type-".concat(normalized.type)]), style: {
1519
+ return (React.createElement("div", { className: classNames(styles$1.Input, styles$1.Port, styles$1["type-".concat(normalized.type)]), style: {
1521
1520
  "--type-color": "var(--color-".concat(normalized.type, ")"),
1522
1521
  }, onClick: onClick },
1523
- React.createElement("td", null, normalized.label || name),
1524
- React.createElement("td", null, !isRef && (React.createElement(Control, { type: normalized.type, options: normalized.options, value: value, onChange: handleParamChange(name) })))));
1522
+ React.createElement("span", null, normalized.label || name),
1523
+ !isRef && (React.createElement(Control, { type: normalized.type, options: normalized.options, value: value, onChange: handleParamChange(name) }))));
1525
1524
  };
1526
1525
 
1527
1526
  var Output = function (_a) {
1528
1527
  var name = _a.name, varDef = _a.varDef, id = _a.id, onClick = _a.onClick, focus = _a.focus;
1529
1528
  var normalized = normalizeVarDef(varDef);
1530
- return (React.createElement("tr", { key: name, className: classNames(styles.Output, styles["type-".concat(normalized.type)]), style: {
1529
+ return (React.createElement(react.Handle, { type: "source", position: react.Position.Right, id: "".concat(id, "-").concat(name), className: classNames(styles$1.Output, styles$1.Port, styles$1["type-".concat(normalized.type)]), style: {
1531
1530
  "--type-color": "var(--color-".concat(normalized.type, ")"),
1532
1531
  }, onClick: onClick },
1533
- React.createElement("td", { colSpan: 2 },
1532
+ React.createElement("span", null,
1534
1533
  focus && "👁 ",
1535
- normalized.label || name,
1536
- React.createElement(react.Handle, { type: "source", position: react.Position.Right, id: "".concat(id, "-").concat(name) }))));
1534
+ normalized.label || name)));
1537
1535
  };
1538
1536
 
1539
1537
  var dummyEngine = new Engine();
@@ -1542,6 +1540,8 @@ var useEngine = function () {
1542
1540
  return React.useContext(EngineContext);
1543
1541
  };
1544
1542
 
1543
+ var styles = {"DefaultNode":"DefaultNode_R2P6c","selected":"selected_VmB-F","active":"active_zjUzx","Log":"Log_dsq5e","Label":"Label_wBwWA","Description":"Description_f9s4l","PreviewHead":"PreviewHead_oFT4K","expanded":"expanded_3vnbi","Preview":"Preview_HbkZ6","Duration":"Duration_0jqWx","GroupHead":"GroupHead_QJhST","GroupChildren":"GroupChildren_NKx-B","GroupLeaf":"GroupLeaf_eliT8"};
1544
+
1545
1545
  function NodeContainer(_a) {
1546
1546
  var _b;
1547
1547
  var id = _a.id, label = _a.label, className = _a.className, selected = _a.selected, children = _a.children;
@@ -1663,20 +1663,19 @@ function GenericNode(_a) {
1663
1663
  return (React.createElement(NodeContainer, { label: data.label, selected: selected, id: id },
1664
1664
  React.createElement("div", { className: styles.Description }, data.description),
1665
1665
  children,
1666
- React.createElement("table", null,
1667
- React.createElement("tbody", null,
1668
- outputEntries.map(function (_a) {
1669
- var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1670
- return (React.createElement(Output, { key: name, name: name, varDef: varDef, id: id, onClick: function () { return setFocus(name); }, focus: showPreview && focus === name }));
1671
- }),
1672
- inputEntries.map(function (_a) {
1673
- var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1674
- return (React.createElement(Input, { key: name, name: name, varDef: varDef, id: id, data: data }));
1675
- }),
1676
- paramEntries.map(function (_a) {
1677
- var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1678
- return (React.createElement(Param, { key: name, name: name, varDef: varDef, id: id, data: data }));
1679
- }))),
1666
+ React.createElement("div", { className: styles.Ports },
1667
+ outputEntries.map(function (_a) {
1668
+ var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1669
+ return (React.createElement(Output, { key: name, name: name, varDef: varDef, id: id, onClick: function () { return setFocus(name); }, focus: showPreview && focus === name }));
1670
+ }),
1671
+ inputEntries.map(function (_a) {
1672
+ var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1673
+ return (React.createElement(Input, { key: name, name: name, varDef: varDef, id: id, data: data }));
1674
+ }),
1675
+ paramEntries.map(function (_a) {
1676
+ var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1677
+ return (React.createElement(Param, { key: name, name: name, varDef: varDef, id: id, data: data }));
1678
+ })),
1680
1679
  React.createElement("div", { className: classNames(styles.PreviewHead, (_b = {},
1681
1680
  _b[styles.expanded] = showPreview,
1682
1681
  _b)), onClick: function () { return setShowPreview(!showPreview); } }, "Preview"),
@@ -1963,6 +1962,35 @@ function createEdge(nodeId, ref) {
1963
1962
  };
1964
1963
  }
1965
1964
 
1965
+ var ConnectionLine = (function (_a) {
1966
+ var _b;
1967
+ var fromX = _a.fromX, fromY = _a.fromY, toX = _a.toX, toY = _a.toY, fromHandle = _a.fromHandle, fromNode = _a.fromNode, connectionStatus = _a.connectionStatus;
1968
+ var _c = react.useConnection(), toNode = _c.toNode, toHandle = _c.toHandle;
1969
+ // correcting the start point as we moved the nodes in our custom ports
1970
+ if (fromNode && fromHandle) {
1971
+ fromX = (fromNode === null || fromNode === void 0 ? void 0 : fromNode.position.x) + fromHandle.x;
1972
+ if (fromHandle.position === "right") {
1973
+ fromX += fromHandle.width;
1974
+ }
1975
+ }
1976
+ if (toNode && toHandle) {
1977
+ toX = toHandle.x - toHandle.width / 2; // align to left side of the handle
1978
+ if (toHandle.position === "right") {
1979
+ toX += toHandle.width;
1980
+ }
1981
+ }
1982
+ var d = react.getSimpleBezierPath({
1983
+ sourceX: fromX,
1984
+ sourceY: fromY,
1985
+ targetX: toX,
1986
+ targetY: toY,
1987
+ sourcePosition: react.Position.Right,
1988
+ targetPosition: react.Position.Left,
1989
+ });
1990
+ return (React.createElement("g", { className: classNames(styles$1.ConnectionPath, "react-flow__connection-path", (_b = {}, _b[styles$1.valid] = connectionStatus === "valid", _b)) },
1991
+ React.createElement("path", { d: d[0] })));
1992
+ });
1993
+
1966
1994
  function FlowInner(_a) {
1967
1995
  var fn = _a.function, engine = _a.engine, onChange = _a.onChange, onClick = _a.onClick, onSelect = _a.onSelect;
1968
1996
  var _b = __read(React.useState(null), 2), instance = _b[0], setInstance = _b[1];
@@ -2073,7 +2101,7 @@ function FlowInner(_a) {
2073
2101
  }, []);
2074
2102
  return (React.createElement(react.ReactFlow, { ref: drop, nodes: nodes, edges: edges, nodeTypes: nodeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onNodeDragStop: function (e, n) { return updatePosition(n.id, n.position); }, onConnect: onConnect, onInit: setInstance, onPaneClick: handleClick, fitView: true,
2075
2103
  // panOnDrag={false}
2076
- selectionOnDrag: true, minZoom: 0.1, maxZoom: 4, deleteKeyCode: "Delete" },
2104
+ selectionOnDrag: true, minZoom: 0.1, maxZoom: 4, deleteKeyCode: "Delete", connectionLineComponent: ConnectionLine },
2077
2105
  React.createElement(react.Background, { color: "#ccc", variant: react.BackgroundVariant.Dots }),
2078
2106
  React.createElement(react.Controls, null)));
2079
2107
  }
@@ -2137,6 +2165,7 @@ function useFunction(engine, fn, mount) {
2137
2165
 
2138
2166
  exports.Engine = Engine;
2139
2167
  exports.Flow = Flow;
2168
+ exports.Lib = Lib;
2140
2169
  exports.binaryOnTree = binaryOnTree;
2141
2170
  exports.binaryOnTreeBranch = binaryOnTreeBranch;
2142
2171
  exports.broadCast = broadCast;