@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.
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { NodeProps } from "@xyflow/react";
3
3
  import { FunctionNode } from "../types";
4
- import "katex/dist/katex.min.css";
4
+ import "../style/katex.min.css";
5
5
  type MathProps = {
6
6
  expr: string;
7
7
  displayMode?: boolean;
@@ -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 "@xyflow/react/dist/style.css";
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.1",
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,2 +0,0 @@
1
- import { GraphedFunction } from "../../lib/Engine";
2
- export declare const calcTest: GraphedFunction;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export default function Index(): React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import { GraphedFunction } from "../../lib/Engine";
2
- export declare const entriesTest: GraphedFunction;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export default function Index(): React.JSX.Element;
@@ -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
- }[];
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import "./global.css";
3
- export declare const metadata: {
4
- title: string;
5
- description: string;
6
- };
7
- export default function RootLayout({ children, }: {
8
- children: React.ReactNode;
9
- }): React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export default function Index(): React.JSX.Element;
@@ -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 {};