@rkmodules/rules 0.0.30 → 0.0.32

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,83 @@
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
+ --xy-edge-stroke: var(--connection-color, #333);
68
+ --xy-edge-stroke-width: 2;
69
+ stroke: var(--connection-color, #333);
70
+ stroke-width: 2;
71
+ }
72
+
73
+ .react-flow__edge.selected .Edge_aNtpH .react-flow__edge-path,
74
+ .react-flow__edge .Edge_aNtpH.Hover_1v8QT .react-flow__edge-path {
75
+ --xy-edge-stroke: var(--connection-color, #333);
76
+ --xy-edge-stroke-width: 2;
77
+ stroke: var(--connection-color, #333);
78
+ stroke-width: 2;
79
+ }
80
+
1
81
  .DefaultNode_R2P6c {
2
82
  --ln: var(--node-line);
3
83
  --bg: var(--node-background);
@@ -60,15 +140,8 @@
60
140
  max-width: 200px;
61
141
  }
62
142
 
63
- .Input_Yhvzf {
64
- color: var(--type-color);
65
- --xy-handle-background-color: var(--type-color);
66
- }
67
- .Output_e4yF- {
68
- text-align: right;
69
- color: var(--type-color);
70
- --xy-handle-background-color: var(--type-color);
71
- }
143
+
144
+
72
145
 
73
146
 
74
147
  .PreviewHead_oFT4K {
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",
@@ -1483,7 +1483,7 @@ function Control(_a) {
1483
1483
  }
1484
1484
  }
1485
1485
 
1486
- 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"};
1487
1487
 
1488
1488
  var Input = function (_a) {
1489
1489
  var _b;
@@ -1497,13 +1497,11 @@ var Input = function (_a) {
1497
1497
  inputs: __assign(__assign({}, data.inputs), (_a = {}, _a[param] = value, _a)),
1498
1498
  });
1499
1499
  }; };
1500
- 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: {
1501
1501
  "--type-color": "var(--color-".concat(normalized.type, ")"),
1502
1502
  }, onClick: onClick },
1503
- React.createElement("td", null,
1504
- normalized.label || name,
1505
- React.createElement(react.Handle, { type: "target", position: react.Position.Left, id: "".concat(id, "-").concat(name) })),
1506
- 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) }))));
1507
1505
  };
1508
1506
 
1509
1507
  var Param = function (_a) {
@@ -1518,23 +1516,22 @@ var Param = function (_a) {
1518
1516
  params: __assign(__assign({}, data.params), (_a = {}, _a[param] = value, _a)),
1519
1517
  });
1520
1518
  }; };
1521
- 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: {
1522
1520
  "--type-color": "var(--color-".concat(normalized.type, ")"),
1523
1521
  }, onClick: onClick },
1524
- React.createElement("td", null, normalized.label || name),
1525
- 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) }))));
1526
1524
  };
1527
1525
 
1528
1526
  var Output = function (_a) {
1529
1527
  var name = _a.name, varDef = _a.varDef, id = _a.id, onClick = _a.onClick, focus = _a.focus;
1530
1528
  var normalized = normalizeVarDef(varDef);
1531
- 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: {
1532
1530
  "--type-color": "var(--color-".concat(normalized.type, ")"),
1533
1531
  }, onClick: onClick },
1534
- React.createElement("td", { colSpan: 2 },
1532
+ React.createElement("span", null,
1535
1533
  focus && "👁 ",
1536
- normalized.label || name,
1537
- React.createElement(react.Handle, { type: "source", position: react.Position.Right, id: "".concat(id, "-").concat(name) }))));
1534
+ normalized.label || name)));
1538
1535
  };
1539
1536
 
1540
1537
  var dummyEngine = new Engine();
@@ -1543,6 +1540,8 @@ var useEngine = function () {
1543
1540
  return React.useContext(EngineContext);
1544
1541
  };
1545
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
+
1546
1545
  function NodeContainer(_a) {
1547
1546
  var _b;
1548
1547
  var id = _a.id, label = _a.label, className = _a.className, selected = _a.selected, children = _a.children;
@@ -1664,20 +1663,19 @@ function GenericNode(_a) {
1664
1663
  return (React.createElement(NodeContainer, { label: data.label, selected: selected, id: id },
1665
1664
  React.createElement("div", { className: styles.Description }, data.description),
1666
1665
  children,
1667
- React.createElement("table", null,
1668
- React.createElement("tbody", null,
1669
- outputEntries.map(function (_a) {
1670
- var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1671
- return (React.createElement(Output, { key: name, name: name, varDef: varDef, id: id, onClick: function () { return setFocus(name); }, focus: showPreview && focus === name }));
1672
- }),
1673
- inputEntries.map(function (_a) {
1674
- var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1675
- return (React.createElement(Input, { key: name, name: name, varDef: varDef, id: id, data: data }));
1676
- }),
1677
- paramEntries.map(function (_a) {
1678
- var _b = __read(_a, 2), name = _b[0], varDef = _b[1];
1679
- return (React.createElement(Param, { key: name, name: name, varDef: varDef, id: id, data: data }));
1680
- }))),
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
+ })),
1681
1679
  React.createElement("div", { className: classNames(styles.PreviewHead, (_b = {},
1682
1680
  _b[styles.expanded] = showPreview,
1683
1681
  _b)), onClick: function () { return setShowPreview(!showPreview); } }, "Preview"),
@@ -1940,7 +1938,7 @@ function createNode(engine, id, fncall, options) {
1940
1938
  id: id,
1941
1939
  data: {
1942
1940
  name: fncall.name,
1943
- label: (calledFn === null || calledFn === void 0 ? void 0 : calledFn.label) || fncall.name,
1941
+ label: fncall.label || (calledFn === null || calledFn === void 0 ? void 0 : calledFn.label) || fncall.name,
1944
1942
  description: calledFn === null || calledFn === void 0 ? void 0 : calledFn.description,
1945
1943
  inputs: fncall.inputs,
1946
1944
  params: fncall.params,
@@ -1964,6 +1962,35 @@ function createEdge(nodeId, ref) {
1964
1962
  };
1965
1963
  }
1966
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
+
1967
1994
  function FlowInner(_a) {
1968
1995
  var fn = _a.function, engine = _a.engine, onChange = _a.onChange, onClick = _a.onClick, onSelect = _a.onSelect;
1969
1996
  var _b = __read(React.useState(null), 2), instance = _b[0], setInstance = _b[1];
@@ -2074,7 +2101,7 @@ function FlowInner(_a) {
2074
2101
  }, []);
2075
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,
2076
2103
  // panOnDrag={false}
2077
- selectionOnDrag: true, minZoom: 0.1, maxZoom: 4, deleteKeyCode: "Delete" },
2104
+ selectionOnDrag: true, minZoom: 0.1, maxZoom: 4, deleteKeyCode: "Delete", connectionLineComponent: ConnectionLine },
2078
2105
  React.createElement(react.Background, { color: "#ccc", variant: react.BackgroundVariant.Dots }),
2079
2106
  React.createElement(react.Controls, null)));
2080
2107
  }