sample-ui-component-library 0.0.46-dev → 0.0.47-dev

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sample-ui-component-library",
3
- "version": "0.0.46-dev",
3
+ "version": "0.0.47-dev",
4
4
  "description": "A library which contains sample UI elements that can be used for populating layouts.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,11 +46,13 @@
46
46
  "@storybook/test": "^8.6.11",
47
47
  "@storybook/theming": "^8.6.11",
48
48
  "css-loader": "^7.1.2",
49
+ "dal-engine-core-js-lib-dev": "^0.0.4",
49
50
  "gh-pages": "^6.3.0",
50
51
  "prop-types": "^15.8.1",
51
52
  "raw-loader": "^4.0.2",
52
53
  "react": "^18.2.0",
53
54
  "react-dom": "^18.2.0",
55
+ "reaflow": "^5.4.1",
54
56
  "rollup": "^4.37.0",
55
57
  "rollup-plugin-peer-deps-external": "^2.2.4",
56
58
  "rollup-plugin-postcss": "^4.0.2",
@@ -69,7 +71,6 @@
69
71
  "@dagrejs/dagre": "^1.1.4",
70
72
  "@monaco-editor/react": "^4.7.0",
71
73
  "@xyflow/react": "^12.6.0",
72
- "dal-engine-core-js-lib-dev": "^0.0.4",
73
74
  "react-bootstrap-icons": "^1.11.5"
74
75
  }
75
76
  }
package/rollup.config.mjs CHANGED
@@ -1,13 +1,19 @@
1
1
  import resolve from '@rollup/plugin-node-resolve';
2
2
  import commonjs from '@rollup/plugin-commonjs';
3
3
  import terser from '@rollup/plugin-terser';
4
- import external from 'rollup-plugin-peer-deps-external';
4
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external';
5
5
  import postcss from 'rollup-plugin-postcss';
6
6
  import json from '@rollup/plugin-json';
7
7
  import { babel } from '@rollup/plugin-babel';
8
8
 
9
9
  export default {
10
10
  input: 'src/index.js',
11
+ external: [
12
+ 'react',
13
+ 'react-dom',
14
+ '@dnd-kit/core',
15
+ "reaflow"
16
+ ],
11
17
  output: [
12
18
  {
13
19
  file: 'dist/cjs/index.js',
@@ -21,7 +27,7 @@ export default {
21
27
  },
22
28
  ],
23
29
  plugins: [
24
- external(['react', 'react-dom', '@dnd-kit/core',"reaflow"]),
30
+ peerDepsExternal(),
25
31
  resolve({
26
32
  extensions: ['.js', '.jsx'],
27
33
  }),
@@ -53,7 +53,9 @@ export const BehavioralGraphBuilder = forwardRef(({connectBehaviors, deleteTrans
53
53
 
54
54
  // Callbacks
55
55
  const handleWheel = useCallback((e) => {
56
- (e.deltaY < 0)?canvasRef.current.zoomIn():canvasRef.current.zoomOut();
56
+ if (canvasRef.current) {
57
+ (e.deltaY < 0)?canvasRef.current.zoomIn():canvasRef.current.zoomOut();
58
+ }
57
59
  }, [canvasRef]);
58
60
 
59
61
  const nodeClick = useCallback((e, node) => {
@@ -7,6 +7,6 @@
7
7
  overflow:hidden;
8
8
  }
9
9
 
10
- canvas {
10
+ .canvas-wrapper > canvas {
11
11
  overflow: hidden;
12
12
  }
@@ -1,11 +1,10 @@
1
1
 
2
2
  /**
3
- * Converts a DAL design specification object into React Flow elements (nodes and edges).
4
- * @param {Object} design
3
+ * Converts a DAL design specification object into nodes and edges for reaflow.
4
+ * @param {Object} engine - The engine instance containing the design specification.
5
5
  * @returns {Object} An object containing nodes and edges for React Flow
6
6
  */
7
7
  export const designToNodes = (engine) => {
8
-
9
8
  let edges = [];
10
9
  let nodes = [];
11
10
 
@@ -46,19 +46,19 @@ const Template = (args) => {
46
46
  activeTool: activeTool,
47
47
  design: design,
48
48
  });
49
- }, []);
49
+ }, [activeTool, design]);
50
50
 
51
51
  useEffect(() => {
52
52
  if (editorRef.current) {
53
53
  const engine = new DALEngine({ name: "testEngine" });
54
- // engine.deserialize(JSON.stringify(design));
55
54
  setEngine(engine);
56
55
  editorRef.current.updateEngine(engine);
57
- setTimeout(() => {
56
+ const timerId = setTimeout(() => {
58
57
  engine.addNode("testBehavior", []);
59
58
  engine.addNode("testBehavior2", []);
60
59
  editorRef.current.updateEngine(engine);
61
60
  }, 4000);
61
+ return () => clearTimeout(timerId);
62
62
  }
63
63
  }, [design, editorRef]);
64
64
 
@@ -30,12 +30,13 @@ export function ToolBar({ onSelectTool }) {
30
30
  className="icon"
31
31
  />
32
32
  </div>
33
- <div className="toolbarContainer bottom"></div>
33
+ <div className="toolbarContainer bottom">
34
34
  <Floppy
35
35
  onClick={(e) => selectTool("save")}
36
36
  title="Save Design"
37
37
  className="icon"
38
38
  />
39
+ </div>
39
40
  </div>
40
41
  );
41
42
  }