schyma 1.0.0
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/LICENSE +201 -0
- package/README.md +80 -0
- package/dist/cjs/components/App.d.ts +9 -0
- package/dist/cjs/components/App.js +37 -0
- package/dist/cjs/components/App.js.map +1 -0
- package/dist/cjs/components/Code.d.ts +3 -0
- package/dist/cjs/components/Code.js +15 -0
- package/dist/cjs/components/Code.js.map +1 -0
- package/dist/cjs/components/Nodes.d.ts +14 -0
- package/dist/cjs/components/Nodes.js +178 -0
- package/dist/cjs/components/Nodes.js.map +1 -0
- package/dist/cjs/components/Panel.d.ts +12 -0
- package/dist/cjs/components/Panel.js +40 -0
- package/dist/cjs/components/Panel.js.map +1 -0
- package/dist/cjs/components/Tables.d.ts +8 -0
- package/dist/cjs/components/Tables.js +19 -0
- package/dist/cjs/components/Tables.js.map +1 -0
- package/dist/cjs/config.d.ts +0 -0
- package/dist/cjs/config.js +99 -0
- package/dist/cjs/config.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/scripts/buildtree.d.ts +34 -0
- package/dist/cjs/scripts/buildtree.js +181 -0
- package/dist/cjs/scripts/buildtree.js.map +1 -0
- package/dist/cjs/scripts/index.d.ts +1 -0
- package/dist/cjs/scripts/index.js +23 -0
- package/dist/cjs/scripts/index.js.map +1 -0
- package/dist/cjs/types/nodes.d.ts +24 -0
- package/dist/cjs/types/nodes.js +3 -0
- package/dist/cjs/types/nodes.js.map +1 -0
- package/dist/cjs/types.d.ts +24 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/reusables.d.ts +6 -0
- package/dist/cjs/utils/reusables.js +111 -0
- package/dist/cjs/utils/reusables.js.map +1 -0
- package/dist/cjs/utils/types.d.ts +34 -0
- package/dist/cjs/utils/types.js +4 -0
- package/dist/cjs/utils/types.js.map +1 -0
- package/dist/esm/components/App.d.ts +9 -0
- package/dist/esm/components/App.js +34 -0
- package/dist/esm/components/App.js.map +1 -0
- package/dist/esm/components/Code.d.ts +3 -0
- package/dist/esm/components/Code.js +12 -0
- package/dist/esm/components/Code.js.map +1 -0
- package/dist/esm/components/Nodes.d.ts +14 -0
- package/dist/esm/components/Nodes.js +176 -0
- package/dist/esm/components/Nodes.js.map +1 -0
- package/dist/esm/components/Panel.d.ts +12 -0
- package/dist/esm/components/Panel.js +37 -0
- package/dist/esm/components/Panel.js.map +1 -0
- package/dist/esm/components/Tables.d.ts +8 -0
- package/dist/esm/components/Tables.js +16 -0
- package/dist/esm/components/Tables.js.map +1 -0
- package/dist/esm/components/worker.d.ts +1 -0
- package/dist/esm/components/worker.js +12 -0
- package/dist/esm/components/worker.js.map +1 -0
- package/dist/esm/config.d.ts +0 -0
- package/dist/esm/config.js +99 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/scripts/buildtree.d.ts +34 -0
- package/dist/esm/scripts/buildtree.js +178 -0
- package/dist/esm/scripts/buildtree.js.map +1 -0
- package/dist/esm/scripts/index.d.ts +1 -0
- package/dist/esm/scripts/index.js +19 -0
- package/dist/esm/scripts/index.js.map +1 -0
- package/dist/esm/types/nodes.d.ts +24 -0
- package/dist/esm/types/nodes.js +2 -0
- package/dist/esm/types/nodes.js.map +1 -0
- package/dist/esm/types.d.ts +24 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/reusables.d.ts +6 -0
- package/dist/esm/utils/reusables.js +102 -0
- package/dist/esm/utils/reusables.js.map +1 -0
- package/dist/esm/utils/types.d.ts +34 -0
- package/dist/esm/utils/types.js +4 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/worker.d.ts +1 -0
- package/dist/esm/worker.js +12 -0
- package/dist/esm/worker.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import Panel from "./Panel";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import Nodes from "./Nodes";
|
|
5
|
+
import Ajv from "ajv";
|
|
6
|
+
function Schyma({ title, description, schema }) {
|
|
7
|
+
const ajv = new Ajv();
|
|
8
|
+
const [currentNode, setCurrentNode] = useState();
|
|
9
|
+
const [nNodes, setnNodes] = useState({});
|
|
10
|
+
const [render, setRender] = useState(false);
|
|
11
|
+
const position = { x: 0, y: 0 };
|
|
12
|
+
const initialNode = {
|
|
13
|
+
id: '1',
|
|
14
|
+
data: {
|
|
15
|
+
label: title,
|
|
16
|
+
description,
|
|
17
|
+
properties: schema.properties,
|
|
18
|
+
relations: {},
|
|
19
|
+
},
|
|
20
|
+
position,
|
|
21
|
+
};
|
|
22
|
+
const validate = ajv.validateSchema(schema);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (validate) {
|
|
25
|
+
setRender(true);
|
|
26
|
+
}
|
|
27
|
+
}, [validate]);
|
|
28
|
+
return (React.createElement("div", null, render ? React.createElement("div", { className: "body-wrapper" },
|
|
29
|
+
React.createElement("div", { className: "node-container" },
|
|
30
|
+
React.createElement(Nodes, { setnNodes: setnNodes, nNodes: nNodes, setCurrentNode: setCurrentNode, initialNode: initialNode, schema: schema })),
|
|
31
|
+
React.createElement(Panel, { title: title, description: description, node: currentNode, nodes: nNodes })) : React.createElement("div", null, "loading")));
|
|
32
|
+
}
|
|
33
|
+
export default Schyma;
|
|
34
|
+
//# sourceMappingURL=App.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../../src/components/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,QAAQ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ACZ,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACb,CACE,CAAC,CAAC,CAAC,2CAAkB,CACvB,CACP,CAAC;AACJ,CAAC;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
3
|
+
import { dracula } from "react-syntax-highlighter/dist/cjs/styles/hljs";
|
|
4
|
+
const CodeComponent = ({ children }) => {
|
|
5
|
+
return (React.createElement(SyntaxHighlighter, { language: "javascript", style: dracula, customStyle: {
|
|
6
|
+
background: "#1E293B",
|
|
7
|
+
borderRadius: "10px",
|
|
8
|
+
color: "#94A3B8"
|
|
9
|
+
}, showLineNumbers: true }, children));
|
|
10
|
+
};
|
|
11
|
+
export default CodeComponent;
|
|
12
|
+
//# sourceMappingURL=Code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../../src/components/Code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAO,EAAE,EAAE;IAC1C,OAAQ,CACN,oBAAC,iBAAiB,IAChB,QAAQ,EAAC,YAAY,EACrB,KAAK,EAAE,OAAO,EACd,WAAW,EAAE;YACX,UAAU,EAAE,SAAS;YACrB,YAAY,EAAE,MAAM;YACpB,KAAK,EAAE,SAAS;SACjB,EACD,eAAe,EAAE,IAAI,IAGpB,QAAQ,CACS,CACrB,CAAA;AACH,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Node } from 'reactflow';
|
|
3
|
+
import { JSONSchema7Object } from 'json-schema';
|
|
4
|
+
type NodeProps = {
|
|
5
|
+
setCurrentNode: (node: Node) => void;
|
|
6
|
+
setnNodes: any;
|
|
7
|
+
nNodes: {
|
|
8
|
+
[x: string]: Node;
|
|
9
|
+
};
|
|
10
|
+
initialNode: Node;
|
|
11
|
+
schema: JSONSchema7Object;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: ({ setCurrentNode, setnNodes, nNodes, initialNode, schema }: NodeProps) => React.JSX.Element;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
/* eslint-disable import/no-anonymous-default-export */
|
|
3
|
+
import React, { useCallback, useEffect } from 'react';
|
|
4
|
+
import { SmartBezierEdge } from '@tisoap/react-flow-smart-edge';
|
|
5
|
+
import ReactFlow, { useNodesState, useEdgesState, addEdge, ReactFlowProvider, MarkerType, useReactFlow, ConnectionLineType, Position, } from 'reactflow';
|
|
6
|
+
import dagre from 'dagre';
|
|
7
|
+
import { propMerge, removeElementsByParent, resolveRef } from '../utils/reusables';
|
|
8
|
+
const position = { x: 0, y: 50 };
|
|
9
|
+
const initialEdges = [
|
|
10
|
+
{
|
|
11
|
+
id: 'edges-e5-7',
|
|
12
|
+
source: '0',
|
|
13
|
+
target: '1',
|
|
14
|
+
label: '+',
|
|
15
|
+
labelBgPadding: [8, 4],
|
|
16
|
+
labelBgBorderRadius: 4,
|
|
17
|
+
animated: true,
|
|
18
|
+
markerEnd: {
|
|
19
|
+
type: MarkerType.ArrowClosed,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
const dagreGraph = new dagre.graphlib.Graph();
|
|
24
|
+
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
|
25
|
+
const nodeWidth = 172;
|
|
26
|
+
const nodeHeight = 36;
|
|
27
|
+
const getLayoutedElements = (nodes, edges, direction = 'LR') => {
|
|
28
|
+
dagreGraph.setGraph({ rankdir: direction });
|
|
29
|
+
nodes.forEach(node => {
|
|
30
|
+
dagreGraph.setNode(node.id, { width: nodeWidth, height: nodeHeight });
|
|
31
|
+
});
|
|
32
|
+
edges.forEach((edge) => {
|
|
33
|
+
dagreGraph.setEdge(edge.source, edge.target);
|
|
34
|
+
});
|
|
35
|
+
dagre.layout(dagreGraph);
|
|
36
|
+
nodes.forEach((node) => {
|
|
37
|
+
const nodeId = node.id;
|
|
38
|
+
const nodeWithPosition = dagreGraph.node(nodeId);
|
|
39
|
+
node.sourcePosition = Position.Right;
|
|
40
|
+
node.targetPosition = Position.Left;
|
|
41
|
+
node.position = {
|
|
42
|
+
x: nodeWithPosition.x - nodeWidth / 3,
|
|
43
|
+
y: nodeWithPosition.y - nodeHeight / 3,
|
|
44
|
+
};
|
|
45
|
+
return node;
|
|
46
|
+
});
|
|
47
|
+
return { nodes, edges };
|
|
48
|
+
};
|
|
49
|
+
const Nodes = ({ setCurrentNode, setnNodes, initialNode, nNodes, schema }) => {
|
|
50
|
+
const { nodes: layoutedNodes, edges: layoutedEdges } = getLayoutedElements([initialNode], initialEdges);
|
|
51
|
+
const { setCenter } = useReactFlow();
|
|
52
|
+
const [nodes, setNodes, onNodesChange] = useNodesState(layoutedNodes);
|
|
53
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState(layoutedEdges);
|
|
54
|
+
const onConnect = useCallback((connection) => setEdges((eds) => addEdge(Object.assign(Object.assign({}, connection), { type: ConnectionLineType.SmoothStep, animated: true }), eds)),
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
[]);
|
|
57
|
+
const focusNode = (x, y, zoom) => {
|
|
58
|
+
setCenter(x, y, { zoom, duration: 1000 });
|
|
59
|
+
};
|
|
60
|
+
let initialNodes = [initialNode];
|
|
61
|
+
const extractChildren = (props, parent) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
const children = [];
|
|
63
|
+
for (const prop in props) {
|
|
64
|
+
const id = String(Math.floor(Math.random() * 1000000));
|
|
65
|
+
if (props[prop].$ref) {
|
|
66
|
+
const res = yield resolveRef(props[prop].$ref, schema);
|
|
67
|
+
children.push(Object.assign(Object.assign(Object.assign(Object.assign({}, props[prop]), { label: prop, id, parent: parent.id, relations: Object.assign(Object.assign({}, parent.relations), { [parent.id]: 'node' }) }), res), { children: [] }));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
children.push(Object.assign(Object.assign({}, props[prop]), { label: prop, id, parent: parent.id, relations: Object.assign(Object.assign({}, parent.relations), { [parent.id]: 'node' }), children: [] }));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return children;
|
|
74
|
+
});
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const newNodes = [];
|
|
77
|
+
initialNodes.map((item) => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
const children = yield extractChildren(item.data.properties, item);
|
|
79
|
+
newNodes.push({
|
|
80
|
+
id: item.id,
|
|
81
|
+
type: "input",
|
|
82
|
+
data: {
|
|
83
|
+
children,
|
|
84
|
+
label: item.data.label,
|
|
85
|
+
description: item.data.description,
|
|
86
|
+
properties: Object.assign({}, item.data.properties),
|
|
87
|
+
relations: item.data.relations
|
|
88
|
+
},
|
|
89
|
+
position: { x: 0, y: 0 },
|
|
90
|
+
sourcePosition: Position.Right,
|
|
91
|
+
targetPosition: Position.Left,
|
|
92
|
+
});
|
|
93
|
+
}));
|
|
94
|
+
setNodes(newNodes);
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
}, []);
|
|
97
|
+
const nodeClick = (_event, node) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
const findChildren = nodes.filter((item) => { var _a; return ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.parent) === node.id; });
|
|
99
|
+
if (!findChildren.length) {
|
|
100
|
+
const itemChildren = node.data.children;
|
|
101
|
+
const newEdges = [
|
|
102
|
+
...edges,
|
|
103
|
+
...node.data.children.map((item) => {
|
|
104
|
+
var _a;
|
|
105
|
+
return {
|
|
106
|
+
id: String(Math.floor(Math.random() * 1000000)),
|
|
107
|
+
source: (_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.parent,
|
|
108
|
+
target: item === null || item === void 0 ? void 0 : item.id,
|
|
109
|
+
markerEnd: {
|
|
110
|
+
type: MarkerType.ArrowClosed,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}),
|
|
114
|
+
];
|
|
115
|
+
//TODO: Fix nodes type error
|
|
116
|
+
const newNodes = nodes.concat(node.data.children);
|
|
117
|
+
const { nodes: layoutedNodes, edges: layoutedEdges } = getLayoutedElements(newNodes, newEdges, "LR");
|
|
118
|
+
setNodes([...layoutedNodes]);
|
|
119
|
+
setEdges([...layoutedEdges]);
|
|
120
|
+
if (itemChildren.length) {
|
|
121
|
+
focusNode(itemChildren[0].position.x, itemChildren[0].position.y, 0.9);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const newNodes = removeElementsByParent(nodes, node.id);
|
|
126
|
+
setNodes([...newNodes]);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
function handleMouseEnter(_e, node) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (!nNodes[node.id]) {
|
|
132
|
+
const itemChildren = [];
|
|
133
|
+
yield Promise.all(node.data.children.map((item) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
let children = [];
|
|
135
|
+
const extractProps = propMerge(item);
|
|
136
|
+
if (Object.keys(extractProps).length > 0) {
|
|
137
|
+
const res = yield extractChildren(extractProps, item);
|
|
138
|
+
children = res;
|
|
139
|
+
}
|
|
140
|
+
itemChildren.push({
|
|
141
|
+
id: item.id,
|
|
142
|
+
type: (children === null || children === void 0 ? void 0 : children.length) > 0 ? "default" : "output",
|
|
143
|
+
data: {
|
|
144
|
+
label: item.label,
|
|
145
|
+
children: children,
|
|
146
|
+
parent: item.parent,
|
|
147
|
+
examples: item.examples,
|
|
148
|
+
description: item.description,
|
|
149
|
+
relations: item.relations,
|
|
150
|
+
},
|
|
151
|
+
position: position,
|
|
152
|
+
sourcePosition: Position.Right,
|
|
153
|
+
targetPosition: Position.Left,
|
|
154
|
+
draggable: false,
|
|
155
|
+
});
|
|
156
|
+
})));
|
|
157
|
+
node.data.children = itemChildren;
|
|
158
|
+
nNodes[node.id] = node;
|
|
159
|
+
setnNodes(nNodes);
|
|
160
|
+
}
|
|
161
|
+
setCurrentNode(node);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const edgeTypes = {
|
|
165
|
+
smart: SmartBezierEdge,
|
|
166
|
+
};
|
|
167
|
+
return (React.createElement("div", { className: 'wrapper', style: {
|
|
168
|
+
width: '100%',
|
|
169
|
+
height: '95vh',
|
|
170
|
+
} },
|
|
171
|
+
React.createElement(ReactFlow, { nodes: nodes, edges: edges, edgeTypes: edgeTypes, onNodesChange: onNodesChange, connectionLineType: ConnectionLineType.SmoothStep, onEdgesChange: onEdgesChange, onConnect: onConnect, onNodeClick: nodeClick, onNodeMouseEnter: handleMouseEnter, fitView: true, defaultViewport: { x: 1, y: 1, zoom: 0.9 } })));
|
|
172
|
+
};
|
|
173
|
+
// eslint-disable-next-line react/display-name
|
|
174
|
+
export default ({ setCurrentNode, setnNodes, nNodes, initialNode, schema }) => (React.createElement(ReactFlowProvider, null,
|
|
175
|
+
React.createElement(Nodes, { setnNodes: setnNodes, nNodes: nNodes, setCurrentNode: setCurrentNode, initialNode: initialNode, schema: schema })));
|
|
176
|
+
//# sourceMappingURL=Nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nodes.js","sourceRoot":"","sources":["../../../src/components/Nodes.tsx"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,M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AAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAG,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAI,CACxG,CACrB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Node } from 'reactflow';
|
|
3
|
+
type Props = {
|
|
4
|
+
node: Node | undefined;
|
|
5
|
+
nodes: {
|
|
6
|
+
[x: string]: Node;
|
|
7
|
+
};
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
declare function Panel({ node, nodes, title, description }: Props): React.JSX.Element;
|
|
12
|
+
export default Panel;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import Tables from './Tables';
|
|
3
|
+
import CodeComponent from './Code';
|
|
4
|
+
function Panel({ node, nodes, title, description }) {
|
|
5
|
+
var _a;
|
|
6
|
+
const [view, setView] = useState();
|
|
7
|
+
const [children, setChildren] = useState([]);
|
|
8
|
+
const [activeNode, setActiveNode] = useState(node);
|
|
9
|
+
const data = node === null || node === void 0 ? void 0 : node.data;
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (node) {
|
|
12
|
+
setView(true);
|
|
13
|
+
if (data.children.length > 0) {
|
|
14
|
+
setChildren(data.children);
|
|
15
|
+
setActiveNode(node);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
setActiveNode(nodes[data.parent]);
|
|
19
|
+
setChildren(nodes[data.parent].data.children);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, [node]);
|
|
23
|
+
if (view) {
|
|
24
|
+
return (React.createElement("div", { className: 'panel' },
|
|
25
|
+
React.createElement("h1", null, (activeNode === null || activeNode === void 0 ? void 0 : activeNode.data.title) || (activeNode === null || activeNode === void 0 ? void 0 : activeNode.data.label)),
|
|
26
|
+
React.createElement("p", null, activeNode === null || activeNode === void 0 ? void 0 : activeNode.data.description),
|
|
27
|
+
children.length > 0 && React.createElement(Tables, { nodes: children, active: node }),
|
|
28
|
+
((_a = activeNode === null || activeNode === void 0 ? void 0 : activeNode.data) === null || _a === void 0 ? void 0 : _a.examples) && (React.createElement("div", { className: 'examples-wrapper' },
|
|
29
|
+
React.createElement("h1", { className: 'font-bold' }, "Examples"), activeNode === null || activeNode === void 0 ? void 0 :
|
|
30
|
+
activeNode.data.examples.map((example) => (React.createElement(CodeComponent, { key: example.title }, JSON.stringify(example, null, 2))))))));
|
|
31
|
+
}
|
|
32
|
+
return (React.createElement("div", { className: 'panel' },
|
|
33
|
+
React.createElement("h1", null, title),
|
|
34
|
+
React.createElement("p", null, description)));
|
|
35
|
+
}
|
|
36
|
+
export default Panel;
|
|
37
|
+
//# sourceMappingURL=Panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Panel.js","sourceRoot":"","sources":["../../../src/components/Panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,aAAa,MAAM,QAAQ,CAAA;AASlC,SAAS,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAS;;IACvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,EAAW,CAAA;IAC3C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAkB,IAAI,CAAC,CAAA;IACnE,MAAM,IAAI,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC;IACxB,SAAS,CAAC,GAAG,EAAE;QACb,IAAG,IAAI,EAAC;YACN,OAAO,CAAC,IAAI,CAAC,CAAC;YACd,IAAG,IAAI,CAAC,Q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,OAAO;QACpB,gCAAK,KAAK,CAAM;QAChB,+BAAI,WAAW,CAAK,CAChB,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function Tables({ nodes, active }) {
|
|
3
|
+
return (React.createElement("div", { className: "panel_table-wrapper" },
|
|
4
|
+
React.createElement("table", null,
|
|
5
|
+
React.createElement("thead", null,
|
|
6
|
+
React.createElement("tr", null,
|
|
7
|
+
React.createElement("th", { scope: "" }, "Name"),
|
|
8
|
+
React.createElement("th", { scope: "" }, "Description"))),
|
|
9
|
+
React.createElement("tbody", null, nodes.map((node) => {
|
|
10
|
+
return React.createElement("tr", { key: node.data.id, className: `panel_table-wrapper_tbody ${(active === null || active === void 0 ? void 0 : active.data.label) === node.data.label ? "panel_table-wrapper_tbody_active" : ""}` },
|
|
11
|
+
React.createElement("th", { scope: "" }, node.data.label),
|
|
12
|
+
React.createElement("td", null, node.data.description));
|
|
13
|
+
})))));
|
|
14
|
+
}
|
|
15
|
+
export default Tables;
|
|
16
|
+
//# sourceMappingURL=Tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tables.js","sourceRoot":"","sources":["../../../src/components/Tables.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAY;IACvC,OAAO,CACH,6BAAK,SAAS,EAAC,qBAAqB;QAChC;YACI;gBACI;oBACI,4BAAI,KAAK,EAAC,EAAE,WAEP;oBACL,4BAAI,KAAK,EAAC,EAAE,kBAEP,CACJ,CACD;YACR,mCACK,KAAK,CAAC,GAAG,CAAC,CAAC,IAAU,EAAE,EAAE;gBACtB,OAAO,4BAAI,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,6BAA6B,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,KAAK,MAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE,EAAE;oBACpJ,4BAAI,KAAK,EAAC,EAAE,IACP,IAAI,CAAC,IAAI,CAAC,KAAK,CACf;oBACL,gCACK,IAAI,CAAC,IAAI,CAAC,WAAW,CACrB,CACJ,CAAA;YACT,CAAC,CAAC,CACN,CACJ,CACN,CAEH,CAAA;AACH,CAAC;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
self.onmessage = function (e) {
|
|
2
|
+
const data = e.data;
|
|
3
|
+
const result = simulateTimeConsumingTask(data);
|
|
4
|
+
postMessage(result);
|
|
5
|
+
};
|
|
6
|
+
function simulateTimeConsumingTask(data) {
|
|
7
|
+
// Simulate a time-consuming task here
|
|
8
|
+
const result = data; // Replace with actual computation
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/components/worker.ts"],"names":[],"mappings":"AAEA,IAAI,CAAC,SAAS,GAAG,UAAS,CAAC;IACvB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;IAEpB,MAAM,MAAM,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAE/C,WAAW,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,SAAS,yBAAyB,CAAC,IAAS;IAC1C,sCAAsC;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,kCAAkC;IACvD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// const nodeClick = async (_event: React.MouseEvent, node: MyObject) => {
|
|
3
|
+
// if(nodeState[node.id]){
|
|
4
|
+
// const res:any = removeElementsByParent(nodes, node.id);
|
|
5
|
+
// setNodes([...res])
|
|
6
|
+
// setNodeState({});
|
|
7
|
+
// }else{
|
|
8
|
+
// const data = node.data
|
|
9
|
+
// const label = data.label;
|
|
10
|
+
// let props = data.properties;
|
|
11
|
+
// const newLabel = `${label}${data.parentLabel}`
|
|
12
|
+
// const nodeProps:any = {};
|
|
13
|
+
// if(refStorage[newLabel]){
|
|
14
|
+
// props = refStorage[newLabel].properties
|
|
15
|
+
// }else{
|
|
16
|
+
// if(label && refStorage[label]){
|
|
17
|
+
// if(label === data.parentLabel && refStorage[`${label}child`]){
|
|
18
|
+
// props = refStorage[`${label}child`].properties
|
|
19
|
+
// }else{
|
|
20
|
+
// props = refStorage[label].properties
|
|
21
|
+
// }
|
|
22
|
+
// }
|
|
23
|
+
// }
|
|
24
|
+
// if(props){
|
|
25
|
+
// for(let prop in props){
|
|
26
|
+
// if(refStorage[prop]){
|
|
27
|
+
// nodeProps[prop] = refStorage[prop]
|
|
28
|
+
// }else{
|
|
29
|
+
// nodeProps[prop] = props[prop]
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// props = nodeProps
|
|
33
|
+
// }
|
|
34
|
+
// const children: any = [];
|
|
35
|
+
// for (const prop in props){
|
|
36
|
+
// const id = String(Math.floor(Math.random() * 1000000));
|
|
37
|
+
// const newProp = {
|
|
38
|
+
// id: id,
|
|
39
|
+
// data: {
|
|
40
|
+
// ...props[prop],
|
|
41
|
+
// label: prop,
|
|
42
|
+
// parent: node.id,
|
|
43
|
+
// parentLabel: label,
|
|
44
|
+
// relations: {
|
|
45
|
+
// ...data.relations,
|
|
46
|
+
// [node.id]: 'node'
|
|
47
|
+
// }
|
|
48
|
+
// },
|
|
49
|
+
// type: "output",
|
|
50
|
+
// }
|
|
51
|
+
// const checkNodeType = typeCheck(newProp.data)
|
|
52
|
+
// if(checkNodeType){
|
|
53
|
+
// newProp.type = "default"
|
|
54
|
+
// }
|
|
55
|
+
// children.push(newProp)
|
|
56
|
+
// }
|
|
57
|
+
// if(children){
|
|
58
|
+
// const itemChildren = [
|
|
59
|
+
// ...children.map((item: MyObject) => {
|
|
60
|
+
// return {
|
|
61
|
+
// id: item.id,
|
|
62
|
+
// data: item.data,
|
|
63
|
+
// style: { padding: 10, background: '#1E293B', color: 'white' },
|
|
64
|
+
// sourcePosition: 'right',
|
|
65
|
+
// targetPosition: 'left',
|
|
66
|
+
// position,
|
|
67
|
+
// draggable: false,
|
|
68
|
+
// }
|
|
69
|
+
// }),
|
|
70
|
+
// ]
|
|
71
|
+
// const newEdges:any = [
|
|
72
|
+
// ...edges,
|
|
73
|
+
// ...itemChildren.map((item) => {
|
|
74
|
+
// return {
|
|
75
|
+
// id: String(Math.floor(Math.random() * 1000000)),
|
|
76
|
+
// source: item?.data.parent,
|
|
77
|
+
// target: item?.id,
|
|
78
|
+
// animated: true,
|
|
79
|
+
// // style: { stroke: required && required.includes(item.data.label) ? '#EB38AB' : 'gray' },
|
|
80
|
+
// markerEnd: {
|
|
81
|
+
// type: MarkerType.ArrowClosed,
|
|
82
|
+
// },
|
|
83
|
+
// }
|
|
84
|
+
// }),
|
|
85
|
+
// ]
|
|
86
|
+
// const newNodes: any = nodes.concat(children)
|
|
87
|
+
// const { nodes: layoutedNodes, edges: layoutedEdges } = getLayoutedElements(newNodes, newEdges, 'LR')
|
|
88
|
+
// setNodes([...layoutedNodes])
|
|
89
|
+
// setEdges([...layoutedEdges])
|
|
90
|
+
// if (itemChildren.length > 3) {
|
|
91
|
+
// focusNode(itemChildren[3].position.x, itemChildren[3].position.y, 0.9)
|
|
92
|
+
// }
|
|
93
|
+
// }else{
|
|
94
|
+
// console.log('no children please')
|
|
95
|
+
// }
|
|
96
|
+
// setNodeState({...nodeState, [node.id]: 'node'})
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAEE,0EAA0E;AAC1E,4BAA4B;AAC5B,8DAA8D;AAC9D,yBAAyB;AACzB,wBAAwB;AACxB,WAAW;AACX,6BAA6B;AAC7B,gCAAgC;AAChC,mCAAmC;AACnC,qDAAqD;AACrD,gCAAgC;AAChC,gCAAgC;AAChC,gDAAgD;AAChD,aAAa;AACb,wCAAwC;AACxC,yEAAyE;AACzE,2DAA2D;AAC3D,iBAAiB;AACjB,iDAAiD;AACjD,YAAY;AACZ,UAAU;AACV,QAAQ;AAER,iBAAiB;AACjB,gCAAgC;AAChC,gCAAgC;AAChC,+CAA+C;AAC/C,iBAAiB;AACjB,0CAA0C;AAC1C,YAAY;AACZ,UAAU;AACV,0BAA0B;AAC1B,QAAQ;AACR,gCAAgC;AAChC,iCAAiC;AACjC,gEAAgE;AAChE,0BAA0B;AAC1B,kBAAkB;AAClB,kBAAkB;AAClB,4BAA4B;AAC5B,yBAAyB;AACzB,6BAA6B;AAC7B,gCAAgC;AAChC,yBAAyB;AACzB,iCAAiC;AACjC,gCAAgC;AAChC,cAAc;AACd,aAAa;AACb,0BAA0B;AAC1B,UAAU;AACV,sDAAsD;AACtD,2BAA2B;AAC3B,mCAAmC;AACnC,UAAU;AACV,+BAA+B;AAC/B,QAAQ;AACR,oBAAoB;AACpB,+BAA+B;AAC/B,gDAAgD;AAChD,oBAAoB;AACpB,2BAA2B;AAC3B,+BAA+B;AAC/B,6EAA6E;AAC7E,uCAAuC;AACvC,sCAAsC;AACtC,wBAAwB;AACxB,gCAAgC;AAChC,cAAc;AACd,cAAc;AACd,UAAU;AACV,+BAA+B;AAC/B,oBAAoB;AACpB,0CAA0C;AAC1C,qBAAqB;AACrB,+DAA+D;AAC/D,yCAAyC;AACzC,gCAAgC;AAChC,8BAA8B;AAC9B,yGAAyG;AACzG,2BAA2B;AAC3B,8CAA8C;AAC9C,iBAAiB;AACjB,cAAc;AACd,cAAc;AACd,UAAU;AACV,qDAAqD;AACrD,6GAA6G;AAC7G,qCAAqC;AACrC,qCAAqC;AACrC,uCAAuC;AACvC,iFAAiF;AACjF,UAAU;AACV,aAAa;AACb,0CAA0C;AAC1C,QAAQ;AACR,sDAAsD;AACtD,MAAM;AACN,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAA;AAErC,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type TreeInterface = {
|
|
2
|
+
required: any;
|
|
3
|
+
examples: any;
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
parent: number;
|
|
7
|
+
description: string;
|
|
8
|
+
children: Array<TreeInterface>;
|
|
9
|
+
$ref?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
};
|
|
12
|
+
type MyObject = {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
};
|
|
15
|
+
interface PropertiesInterface extends TreeInterface {
|
|
16
|
+
properties?: MyObject;
|
|
17
|
+
additionalProperties?: AdditionalProperties | Boolean;
|
|
18
|
+
patternProperties?: MyObject;
|
|
19
|
+
$id?: string;
|
|
20
|
+
allOf?: Array<PropertiesInterface>;
|
|
21
|
+
anyOf?: Array<PropertiesInterface>;
|
|
22
|
+
oneOf?: Array<PropertiesInterface>;
|
|
23
|
+
items?: any;
|
|
24
|
+
definitions?: any;
|
|
25
|
+
}
|
|
26
|
+
interface AdditionalProperties extends TreeInterface {
|
|
27
|
+
items?: Array<TreeInterface>;
|
|
28
|
+
$ref?: string;
|
|
29
|
+
allOf?: Array<TreeInterface>;
|
|
30
|
+
anyOf?: Array<TreeInterface>;
|
|
31
|
+
oneOf?: Array<TreeInterface>;
|
|
32
|
+
}
|
|
33
|
+
export default function buildTree(schemaObject: PropertiesInterface): Promise<TreeInterface[]>;
|
|
34
|
+
export {};
|