@rkmodules/rules 0.0.161 → 0.0.162

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.
@@ -30,7 +30,10 @@ export type RecOfTrees = Record<string, Tree<any>>;
30
30
  export type PrimitiveFunction = {
31
31
  name: string;
32
32
  label?: string;
33
- nodeType?: string;
33
+ nodeType?: string | {
34
+ name: string;
35
+ props: Record<string, any>;
36
+ };
34
37
  description?: string;
35
38
  params?: Record<string, VarDef>;
36
39
  inputs?: Record<string, VarDef>;
@@ -11,6 +11,7 @@ export type FunctionNode = Node<{
11
11
  outputDefs: Record<string, VarDef>;
12
12
  onChange: (newData: Partial<FunctionNode["data"]>) => void;
13
13
  onIOChange?: (callback: (fn: GraphedFunction) => Partial<GraphedFunction>) => void;
14
+ nodeProps?: Record<string, any>;
14
15
  }>;
15
16
  export type NodeDropItem = {
16
17
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rkmodules/rules",
3
- "version": "0.0.161",
3
+ "version": "0.0.162",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -41,6 +41,7 @@
41
41
  "react-dom": ">=17.0.1"
42
42
  },
43
43
  "dependencies": {
44
+ "@rkmodules/stringtemplate": "^0.1.3",
44
45
  "@rkmodules/use-inner": "^1.0.3",
45
46
  "@xyflow/react": "^12.8.3",
46
47
  "classnames": "^2.5.1",
package/readme.md CHANGED
@@ -142,6 +142,110 @@ custom contols can be passed into the `<Flow>` component with the `customControl
142
142
  />
143
143
  ```
144
144
 
145
+ # custom nodes
146
+
147
+ alternatively, the entire node can be customized. There are the following standard nodes `Default`, `Calc`, and
148
+
149
+ - `Default`: the default node
150
+ - `Calc`: specialized node for the Calc function that renders the expression and creates input ports based on variables in the expression
151
+ - `DynamicInput`: creates additional input ports, useful for allowing a dynamic number of inputs
152
+ - `DynamicOutput`: creates output ports on the fly based on the function result
153
+ - `NamedInput`: allows adding and renaming input ports by the user
154
+ - `Input` and `Output`: used for rule input and output
155
+
156
+ # Components / functions reference
157
+
158
+ ## List
159
+
160
+ - List Input: creates a list of strings or numbers based on textfield input
161
+ - List Item: selects items from a list based on their indices
162
+ - List Length: returns the length of a list
163
+ - Relative Item
164
+ - Relative Items
165
+ - Unique Items: removes duplicates from a list
166
+
167
+ ## Logic
168
+
169
+ - And: returns true if both inputs are true
170
+ - Or: returns true if one or both of the inputs are true
171
+ - Not: negates all elements in the list
172
+ - Group And: returns true if all elements in the list are true
173
+ - Group Or: returns true if some elements in the list are true
174
+ - Group stats: returns min, max, avg, std, sum and count of a list of numbers
175
+
176
+ ## Math
177
+
178
+ - Add
179
+ - Subtract
180
+ - Multiply
181
+ - Divide
182
+ - Modulo
183
+ - Pow
184
+ - Sqrt
185
+ - Round
186
+ - Floor
187
+ - Ceil
188
+ - Sin
189
+ - Cos
190
+ - Tan
191
+ - Sum
192
+ - Less Than
193
+ - Greater Than
194
+
195
+ ## String
196
+
197
+ - Join Strings
198
+ - String Equal To
199
+ - String Template
200
+ - To String
201
+
202
+ ## Date
203
+
204
+ - Duration
205
+ - Format Date
206
+ - Iso Date
207
+ - Parse Date
208
+ - Today
209
+
210
+ ## Util
211
+
212
+ - Get Type
213
+ - Get Value
214
+ - Log
215
+ - Value
216
+
217
+ ## Sequence
218
+
219
+ - Series
220
+
221
+ ## JSON
222
+
223
+ - Array To List
224
+ - Destructure Object
225
+ - Explode Object
226
+ - List To Array
227
+ - Merge Object
228
+ - Object
229
+ - Entries
230
+ - Set Field
231
+
232
+ ## Group
233
+
234
+ - Cartesian Groups
235
+ - Filter Tree
236
+ - Group All
237
+ - Merge Group
238
+ - Merge Tree
239
+ - Normalize Tree
240
+ - SimplifyTree
241
+ - Split Group
242
+ - Tree Item
243
+
244
+ ## IO
245
+
246
+ - Input
247
+ - Output
248
+
145
249
  TODO:
146
250
 
147
251
  - [ ] filtering of lists
@@ -153,20 +257,6 @@ TODO:
153
257
  - running flag
154
258
  - intermediate results
155
259
 
156
- Components / functions
157
-
158
- List
159
-
160
- - [x] listItem
161
- - [x] listLength
162
- - [x] graftTree
163
- - [x] trimTree
164
-
165
- Math
166
-
167
- - [x] lessThan
168
- - [x] greaterThan
169
-
170
260
  Text
171
261
 
172
262
  - formatting