@rkmodules/rules 0.0.1 → 0.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/index.css +625 -0
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/Flow/Nodes/Calc.d.ts +1 -1
- package/dist/lib/Flow/index.d.ts +1 -1
- package/package.json +6 -2
- package/readme.md +49 -0
- package/dist/app/editor/calcTestFunction.d.ts +0 -2
- package/dist/app/editor/page.d.ts +0 -2
- package/dist/app/finance/entriesTestFunction.d.ts +0 -2
- package/dist/app/finance/page.d.ts +0 -2
- package/dist/app/finance/testEntries.d.ts +0 -40
- package/dist/app/layout.d.ts +0 -9
- package/dist/app/page.d.ts +0 -2
- package/dist/app/supalipu/page.d.ts +0 -13
package/dist/lib/Flow/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { GraphedFunction } from "../Engine/types";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Engine } from "../Engine";
|
|
5
5
|
import { FunctionNode } from "./types";
|
|
6
|
-
import "
|
|
6
|
+
import "./style/xyflow.css";
|
|
7
7
|
export * from "./types";
|
|
8
8
|
export type PositionData = Record<string, {
|
|
9
9
|
x: number;
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rkmodules/rules",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
-
"dist"
|
|
7
|
+
"dist/index.js",
|
|
8
|
+
"dist/index.js.map",
|
|
9
|
+
"dist/index.d.ts",
|
|
10
|
+
"dist/index.css",
|
|
11
|
+
"dist/lib"
|
|
8
12
|
],
|
|
9
13
|
"exports": {
|
|
10
14
|
".": "./dist/index.js",
|
package/readme.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
# Usage
|
|
2
|
+
|
|
3
|
+
`npm install @rkmodules/rules`
|
|
4
|
+
|
|
5
|
+
## Engine
|
|
6
|
+
|
|
7
|
+
An engine creates a namespace for functions, so create an engine to start with:
|
|
8
|
+
|
|
9
|
+
`const engine = new Engine()`
|
|
10
|
+
|
|
11
|
+
## Specifying a function
|
|
12
|
+
|
|
13
|
+
A function definition is just a json object. It can be assembled together via code or just hardcoded. It is of type `GraphedFunction` and at least has to have a `name` and `body` field. The latter defines a graph with calls to primitives or other graphed functions:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const testFunction: GraphedFunction = {
|
|
17
|
+
name: "test",
|
|
18
|
+
body: {
|
|
19
|
+
myVal: {
|
|
20
|
+
name: "value",
|
|
21
|
+
params: {
|
|
22
|
+
type: "string"
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
myLog: {
|
|
26
|
+
name: "log",
|
|
27
|
+
inputs: {
|
|
28
|
+
data: "<myVal.value>"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
We get back to function definitions later
|
|
36
|
+
|
|
37
|
+
## Running the function
|
|
38
|
+
|
|
39
|
+
- build all the custom functions
|
|
40
|
+
- run the one you need
|
|
41
|
+
|
|
42
|
+
## use in react
|
|
43
|
+
|
|
44
|
+
`useFunction`
|
|
45
|
+
|
|
46
|
+
## editor
|
|
47
|
+
|
|
48
|
+
`<Flow>`
|
|
49
|
+
|
|
1
50
|
TODO:
|
|
2
51
|
|
|
3
52
|
- [ ] filtering of lists
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export declare const EntryA: {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
lines: {
|
|
5
|
-
db: string;
|
|
6
|
-
cr: string;
|
|
7
|
-
amt: number;
|
|
8
|
-
}[];
|
|
9
|
-
toString: () => string;
|
|
10
|
-
};
|
|
11
|
-
export declare const EntryB: {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
lines: {
|
|
15
|
-
db: string;
|
|
16
|
-
cr: string;
|
|
17
|
-
amt: number;
|
|
18
|
-
}[];
|
|
19
|
-
toString: () => string;
|
|
20
|
-
};
|
|
21
|
-
export declare const EntryC: {
|
|
22
|
-
name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
lines: {
|
|
25
|
-
db: string;
|
|
26
|
-
cr: string;
|
|
27
|
-
amt: number;
|
|
28
|
-
}[];
|
|
29
|
-
toString: () => string;
|
|
30
|
-
};
|
|
31
|
-
export declare const entries: {
|
|
32
|
-
name: string;
|
|
33
|
-
description: string;
|
|
34
|
-
lines: {
|
|
35
|
-
db: string;
|
|
36
|
-
cr: string;
|
|
37
|
-
amt: number;
|
|
38
|
-
}[];
|
|
39
|
-
toString: () => string;
|
|
40
|
-
}[];
|
package/dist/app/layout.d.ts
DELETED
package/dist/app/page.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { GraphedFunction } from "../../lib/Engine";
|
|
3
|
-
interface PropObject<P = any> {
|
|
4
|
-
_id: string;
|
|
5
|
-
type: string;
|
|
6
|
-
props: P;
|
|
7
|
-
onChange?: string;
|
|
8
|
-
}
|
|
9
|
-
type Function = PropObject<GraphedFunction>;
|
|
10
|
-
/** propobject for the change handler */
|
|
11
|
-
export declare const handleChange: Function;
|
|
12
|
-
export default function Index(): React.JSX.Element;
|
|
13
|
-
export {};
|