From a69c86adc14cbf15610c8df4216e57fb5b4c75d5 Mon Sep 17 00:00:00 2001 From: afonso Date: Mon, 1 Aug 2022 14:16:40 +0100 Subject: [PATCH] #9 chore: Add group movement --- dist/meta-diagram.cjs.development.js | 106 +++++++++++++------- dist/meta-diagram.cjs.development.js.map | 2 +- dist/meta-diagram.cjs.production.min.js | 2 +- dist/meta-diagram.cjs.production.min.js.map | 2 +- dist/meta-diagram.esm.js | 106 +++++++++++++------- dist/meta-diagram.esm.js.map | 2 +- dist/react-diagrams/MetaNodeModel.d.ts | 3 + example/index.tsx | 4 +- src/helpers/engineHelper.ts | 16 +++ src/helpers/nodesHelper.ts | 3 +- src/index.tsx | 15 ++- src/react-diagrams/MetaNodeModel.ts | 15 +++ 12 files changed, 197 insertions(+), 79 deletions(-) create mode 100644 src/helpers/engineHelper.ts diff --git a/dist/meta-diagram.cjs.development.js b/dist/meta-diagram.cjs.development.js index 8f295dc..a82a793 100644 --- a/dist/meta-diagram.cjs.development.js +++ b/dist/meta-diagram.cjs.development.js @@ -22,6 +22,42 @@ var ReactDiagramMetaTypes; ReactDiagramMetaTypes["META_LINK"] = "meta-link-type"; })(ReactDiagramMetaTypes || (ReactDiagramMetaTypes = {})); +class Position { + constructor(x, y) { + this.x = x; + this.y = y; + } + + add(otherPosition) { + return new Position(this.x + otherPosition.x, this.y + otherPosition.y); + } + + sub(otherPosition) { + return new Position(this.x - otherPosition.x, this.y - otherPosition.y); + } + +} + +function getNode(id, nodes) { + return nodes.find(n => n.getOptions().id === id); +} +function processNodes(metaNodes, callback) { + const metaNodeModels = []; + + for (const mn of metaNodes) { + const metaNodeModel = mn.toModel(); + const position = mn.getWorldPosition(); + metaNodeModel.setPosition(position.x, position.y); // @ts-ignore + + metaNodeModel.registerListener({ + positionChanged: event => callback(event) + }); + metaNodeModels.push(metaNodeModel); + } + + return metaNodeModels; +} + class MetaNodeModel extends createEngine.NodeModel { constructor(options = {}) { super({ ...options, @@ -38,6 +74,19 @@ class MetaNodeModel extends createEngine.NodeModel { })); } + getLocalPosition(nodes) { + const worldPosition = new Position(this.getX(), this.getY()); // @ts-ignore + + const parentId = this.options['parentId']; + const parent = getNode(parentId, nodes); + return parent ? worldPosition.sub(parent.getLocalPosition(nodes)) : worldPosition; + } + + updateLocalPosition(nodes) { + // @ts-ignore + this.options['position'] = this.getLocalPosition(nodes); + } + } class MetaNode { @@ -192,25 +241,6 @@ class MetaLinkFactory extends createEngine.DefaultLinkFactory { } -function getNode(id, nodes) { - return nodes.find(n => n.getOptions().id === id); -} // @ts-ignore - -function processNodes(metaNodes, callback) { - const metaNodeModels = []; - - for (const mn of metaNodes) { - const metaNodeModel = mn.toModel(); - const position = mn.getWorldPosition(); - metaNodeModel.setPosition(position.x, position.y); // @ts-ignore - //metaNodeModel.registerListener({positionChanged: (event => callback(event))}) - - metaNodeModels.push(metaNodeModel); - } - - return metaNodeModels; -} - function getLinkModel(metaLink, nodes) { const link = metaLink.toModel(); const source = getNode(metaLink.getSourceId(), nodes); @@ -449,20 +479,14 @@ var theme = (customVariables => applicationTheme({ ...vars, ...customVariables })); -class Position { - constructor(x, y) { - this.x = x; - this.y = y; - } - - add(otherPosition) { - return new Position(this.x + otherPosition.x, this.y + otherPosition.y); - } - - sub(otherPosition) { - return new Position(this.x - otherPosition.x, this.y - otherPosition.y); - } - +function updateChildrenPosition(nodes, parent) { + // @ts-ignore + const children = nodes.filter(n => n.options['parentId'] == parent.options['id']); + children.forEach(n => { + // @ts-ignore + n.setPosition(parent.getX() + n.options['position'].x, parent.getY() + n.options['position'].y); // TODO: Fix nested position update + // updateChildrenPosition(nodes, n) + }); } const useStyles$1 = /*#__PURE__*/styles.makeStyles(_ => ({ @@ -490,10 +514,22 @@ const MetaDiagram = ({ engine.getNodeFactories() // @ts-ignore .registerFactory(new MetaNodeFactory(componentsMap.nodes)); engine.getLinkFactories() // @ts-ignore - .registerFactory(new MetaLinkFactory(componentsMap.links)); // set up the diagram model + .registerFactory(new MetaLinkFactory(componentsMap.links)); // @ts-ignore + + const repaintCanvas = event => { + let model = engine.getModel(); + const node = event.entity; + const nodes = model.getNodes(); // @ts-ignore + + updateChildrenPosition(nodes, node); // @ts-ignore + // updateNodeLocalPosition(nodes, node) + + engine.repaintCanvas(); + }; // set up the diagram model + const model = new createEngine.DiagramModel(); - const nodes = processNodes(metaNodes); + const nodes = processNodes(metaNodes, repaintCanvas); const links = metaLinks.map(ml => getLinkModel(ml, nodes)).filter(mlm => mlm !== undefined); // @ts-ignore model.addAll(...nodes, ...links); // load model into engine diff --git a/dist/meta-diagram.cjs.development.js.map b/dist/meta-diagram.cjs.development.js.map index f31d2b9..d247877 100644 --- a/dist/meta-diagram.cjs.development.js.map +++ b/dist/meta-diagram.cjs.development.js.map @@ -1 +1 @@ -{"version":3,"file":"meta-diagram.cjs.development.js","sources":["../src/constants.ts","../src/react-diagrams/MetaNodeModel.ts","../src/models/MetaNode.ts","../src/react-diagrams/MetaLinkModel.ts","../src/models/MetaLink.ts","../src/models/ComponentsMap.ts","../src/components/UnknownTypeWidget.tsx","../src/react-diagrams/MetaNodeFactory.tsx","../src/react-diagrams/MetaLinkFactory.tsx","../src/helpers/nodesHelper.ts","../src/helpers/linksHelper.ts","../src/components/assets/styles/variables.ts","../src/components/Sidebar.tsx","../src/theme.ts","../src/models/Position.ts","../src/index.tsx"],"sourcesContent":["export enum ReactDiagramMetaTypes {\n META_NODE = 'meta-node-type',\n META_LINK = 'meta-link-type',\n}\n","import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeModel extends NodeModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_NODE,\n });\n\n // set up an in and out port\n\n this.addPort(\n new DefaultPortModel({\n in: true,\n name: 'in',\n })\n );\n this.addPort(\n new DefaultPortModel({\n in: false,\n name: 'out',\n })\n );\n }\n}\n","import { Position } from './Position';\nimport {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport class MetaNode {\n private readonly parent: MetaNode | undefined;\n private readonly position: Position;\n private readonly options: Map;;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n position: Position,\n parent: MetaNode | undefined,\n options: Map\n ) {\n this.parent = parent\n this.position = position\n this.options = options\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getId() : string{\n return this.options.get('id')\n }\n\n getParentId() : string | undefined {\n return this.parent?.getId()\n }\n\n getWorldPosition() : Position {\n return this.parent ? this.position.add(this.parent?.getWorldPosition()) : this.position\n }\n\n toModel() : MetaNodeModel {\n const optionsMap = this.options\n optionsMap.set('parentId', this.getParentId())\n optionsMap.set('position', this.position)\n return new MetaNodeModel(Object.fromEntries(optionsMap))\n }\n\n}\n","import { DefaultLinkModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaLinkModel extends DefaultLinkModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_LINK,\n });\n }\n}\n","import { ILink } from './ILink';\nimport {MetaLinkModel} from \"../react-diagrams/MetaLinkModel\";\n\nexport class MetaLink implements ILink {\n sourceId: string;\n sourcePortId: string;\n targetId: string;\n targetPortId: string;\n options: Map;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n sourceId: string,\n sourcePortId: string,\n targetId: string,\n targetPortId: string,\n options: Map\n ) {\n this.sourceId = sourceId;\n this.sourcePortId = sourcePortId;\n this.targetId = targetId;\n this.targetPortId = targetPortId;\n this.options = options;\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getSourceId(): string {\n return this.sourceId;\n }\n\n getSourcePortId(): string {\n return this.sourcePortId;\n }\n\n getTargetId(): string {\n return this.targetId;\n }\n\n getTargetPortId(): string {\n return this.targetPortId;\n }\n\n toModel(): MetaLinkModel {\n return new MetaLinkModel(Object.fromEntries(this.options))\n }\n}\n","import React from 'react';\n\nexport class ComponentsMap {\n nodes: Map;\n links: Map;\n\n constructor(\n nodesMap: Map,\n linksMap: Map\n ) {\n this.nodes = nodesMap;\n this.links = linksMap;\n }\n}\n","import React from 'react';\n\nexport const UnknownTypeWidget = () => {\n return
Unknown Type
;\n};\n","import { AbstractReactFactory } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './MetaNodeModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport React from 'react';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeFactory extends AbstractReactFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_NODE);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaNodeModel();\n }\n\n generateReactWidget(event: any): JSX.Element {\n if (this.componentsMap.has(event.model.options.shape)) {\n const ReactComponentType = this.componentsMap.get(\n event.model.options.shape\n );\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default node instead\n return ;\n }\n}\n","import { MetaLinkModel } from './MetaLinkModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport React from 'react';\nimport { DefaultLinkFactory } from '@projectstorm/react-diagrams';\n\nexport class MetaLinkFactory extends DefaultLinkFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_LINK);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaLinkModel();\n }\n\n generateLinkSegment(\n model: MetaLinkModel,\n selected: boolean,\n path: string\n ): JSX.Element {\n // @ts-ignore\n if (this.componentsMap.has(model.getOptions()?.shape)) {\n const ReactComponentType = this.componentsMap.get(\n // @ts-ignore\n model.getOptions().shape\n );\n\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default link instead\n return ;\n }\n}\n","import { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport {MetaNode} from \"../models/MetaNode\";\nimport {BaseEntityEvent} from \"@projectstorm/react-canvas-core\";\nimport {NodeModel, NodeModelGenerics} from \"@projectstorm/react-diagrams\";\n\nexport function getNode(\n id: string,\n nodes: MetaNodeModel[]\n): MetaNodeModel | undefined {\n return nodes.find(n => n.getOptions().id === id);\n}\n\n// @ts-ignore\nexport function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] {\n const metaNodeModels = []\n for(const mn of metaNodes){\n const metaNodeModel = mn.toModel()\n const position = mn.getWorldPosition()\n metaNodeModel.setPosition(position.x, position.y)\n // @ts-ignore\n //metaNodeModel.registerListener({positionChanged: (event => callback(event))})\n metaNodeModels.push(metaNodeModel)\n }\n return metaNodeModels\n}\n","import { MetaLink } from '../models/MetaLink';\nimport { MetaLinkModel } from '../react-diagrams/MetaLinkModel';\nimport { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport { getNode } from './nodesHelper';\n\nexport function getLinkModel(\n metaLink: MetaLink,\n nodes: MetaNodeModel[]\n): MetaLinkModel | undefined {\n const link = metaLink.toModel();\n const source = getNode(metaLink.getSourceId(), nodes);\n const target = getNode(metaLink.getTargetId(), nodes);\n if (source && target) {\n link.setSourcePort(source.getPort(metaLink.getSourcePortId()));\n link.setTargetPort(target.getPort(metaLink.getTargetPortId()));\n return link;\n }\n return undefined;\n}\n","const vars = {\n fontFamily: 'Inter, sans-serif',\n primaryBg: '#f1f1f1',\n textWhite: '#FFFFFF',\n chipTextColor: '#F2F2F7',\n chipBgColor: 'rgba(60, 60, 67, 0.4)',\n\n chipPrimaryTextColor: 'rgba(255, 255, 255, 0.8)',\n chipPrimaryBgColor: 'rgba(0, 122, 255, 0.6)',\n\n breadcrumbLinkColor: '#A2A2A2',\n breadcrumbTextColor: '#292929',\n\n buttonPrimaryBgColor: '4353FF',\n buttonPrimaryBgHoverColor: '#3443E1',\n buttonPrimaryDisabledBgColor: 'rgba(0, 122, 255, 0.4)',\n\n listItemActiveBg: '#007AFF',\n listSelectedTextColor: '#3C3C43',\n listBoxShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)',\n listBorderColor: 'rgba(0, 0, 0, 0.04)',\n\n dividerColor: 'rgba(118, 120, 125, 0.12)',\n\n dropdownBg: 'rgba(246, 246, 248, 0.8)',\n dropdownTextColor: 'rgba(60, 60, 67, 0.6)',\n\n overlayColor: 'rgba(0, 0, 0, 0.4)',\n\n progressBg: '#E5E5E5',\n progressBar: '#017AFF',\n progressShadow: 'inset 0 0 0.0625rem #E3E3E3',\n\n switchShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',\n};\n\nexport default vars;\n","import React from 'react';\nimport { Box } from '@mui/system';\nimport { makeStyles } from '@mui/styles';\nimport vars from './assets/styles/variables';\nimport { Divider, List, ListItemButton, ListItemIcon } from '@mui/material';\nimport Move from './assets/svg/move.svg';\nimport Icon from './assets/svg/icon.svg';\nimport Node from './assets/svg/node.svg';\nimport Cursor from './assets/svg/cursor.svg';\nimport Fullscreen from './assets/svg/fullscreen.svg';\n\nconst { textWhite, dividerColor } = vars;\n\nconst useStyles = makeStyles(() => ({\n root: {\n zIndex: '5',\n width: '4rem',\n background: textWhite,\n boxShadow:\n '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)',\n borderRadius: '2rem',\n position: 'fixed',\n left: '1rem',\n top: '50%',\n transform: 'translateY(-50%)',\n\n '&.right': {\n left: 'auto',\n right: '1rem',\n },\n\n '& .MuiList-root': {\n padding: '0.75rem',\n },\n },\n\n node: {\n margin: '0.25rem 0',\n '& .MuiDivider-root': {\n borderColor: dividerColor,\n width: 'calc(100% - 1.5rem)',\n margin: '0 auto',\n border: 'none',\n borderTop: '0.0625rem solid',\n },\n\n '& img': {\n display: 'block',\n margin: '1rem 0',\n },\n },\n}));\n\nconst Sidebar = () => {\n const classes = useStyles();\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n );\n};\n\nexport default Sidebar;\n","import vars from './components/assets/styles/variables';\n\ntype ThemeVars = {\n [key: string]: any;\n};\n\nconst applicationTheme = (params: ThemeVars) => {\n const {\n primaryBg,\n fontFamily,\n chipTextColor,\n chipBgColor,\n textWhite,\n listItemActiveBg,\n listSelectedTextColor,\n listBoxShadow,\n listBorderColor,\n } = params;\n return {\n components: {\n MuiCssBaseline: {\n styleOverrides: `\n html {\n background: ${primaryBg};\n font-family: ${fontFamily};\n }\n body {\n background-color:${primaryBg};\n font-family: ${fontFamily};\n font-size: 1rem;\n }\n `,\n },\n MuiList: {\n styleOverrides: {\n root: {\n '&.customSwitch': {\n padding: '0.125rem',\n background: chipTextColor,\n borderRadius: '0.5rem',\n display: 'flex',\n '& .MuiListItemButton-root': {\n padding: '0.25rem 0.75rem',\n borderRadius: '0.4375rem',\n width: '10.59375rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n '&:not(:last-child)': {\n marginBottom: '0',\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n '&.Mui-selected': {\n background: textWhite,\n boxShadow: listBoxShadow,\n border: `0.03125rem solid ${listBorderColor}`,\n '& .MuiTypography-root': {\n color: listSelectedTextColor,\n },\n },\n },\n '& .MuiChip-root': {\n marginLeft: '0.25rem',\n },\n '& .MuiTypography-root': {\n fontWeight: 500,\n fontSize: '0.8125rem',\n lineHeight: '1.25rem',\n letterSpacing: '-0.005rem',\n color: chipBgColor,\n margin: 0,\n },\n },\n },\n },\n },\n MuiListItemIcon: {\n styleOverrides: {\n root: {\n minWidth: 'inherit',\n },\n },\n },\n MuiListItemButton: {\n styleOverrides: {\n root: {\n padding: 0,\n width: '2.5rem',\n height: '2.5rem',\n borderRadius: '50%',\n justifyContent: 'center',\n backgroundColor: chipTextColor,\n '&:hover': {\n backgroundColor: chipTextColor,\n },\n '&:not(:last-child)': {\n marginBottom: '0.75rem',\n },\n '&.Mui-selected': {\n backgroundColor: listItemActiveBg,\n '&:hover': {\n backgroundColor: listItemActiveBg,\n },\n },\n '&.Mui-disabled': {\n opacity: 0.8,\n },\n },\n },\n },\n },\n };\n};\n\nexport default (customVariables: ThemeVars) =>\n applicationTheme({\n ...vars,\n ...customVariables,\n });\n","export class Position {\n x: number;\n y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n add(otherPosition: Position) : Position {\n return new Position(this.x+ otherPosition.x, this.y + otherPosition.y)\n }\n\n sub(otherPosition: Position) : Position {\n return new Position(this.x - otherPosition.x, this.y - otherPosition.y)\n }\n}\n","import * as React from 'react';\nimport { MetaNode } from './models/MetaNode';\nimport { MetaLink } from './models/MetaLink';\nimport { ComponentsMap } from './models/ComponentsMap';\nimport createEngine, { DiagramModel } from '@projectstorm/react-diagrams';\nimport { MetaNodeFactory } from './react-diagrams/MetaNodeFactory';\nimport { MetaLinkFactory } from './react-diagrams/MetaLinkFactory';\nimport { CanvasWidget } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './react-diagrams/MetaNodeModel';\nimport { getLinkModel } from './helpers/linksHelper';\nimport { makeStyles } from '@mui/styles';\nimport Sidebar from './components/Sidebar';\nimport { ThemeProvider, createTheme } from '@mui/material/styles';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport theme from './theme';\nimport { Box } from '@mui/material';\nimport {processNodes} from \"./helpers/nodesHelper\";\n\nconst useStyles = makeStyles(_ => ({\n container: {\n height: '100%',\n width: '100%',\n },\n canvasContainer: {\n height: '100%',\n width: '100%',\n background: '#fffff',\n },\n}));\n\ninterface MetaDiagramProps {\n metaNodes: MetaNode[];\n metaLinks: MetaLink[];\n componentsMap: ComponentsMap;\n wrapperClassName?: string;\n canvasClassName?: string;\n metaTheme: {\n customThemeVariables: {};\n canvasClassName: string;\n };\n}\n\nconst MetaDiagram = ({\n metaNodes,\n metaLinks,\n componentsMap,\n wrapperClassName,\n metaTheme,\n}: MetaDiagramProps) => {\n const classes = useStyles();\n\n // set up the diagram engine\n const engine = createEngine();\n\n engine\n .getNodeFactories()\n // @ts-ignore\n .registerFactory(new MetaNodeFactory(componentsMap.nodes));\n\n engine\n .getLinkFactories()\n // @ts-ignore\n .registerFactory(new MetaLinkFactory(componentsMap.links));\n\n // set up the diagram model\n\n const model = new DiagramModel();\n const nodes = processNodes(metaNodes, () => console.log(\"repaint canvas\"))\n\n const links = metaLinks\n .map(ml => getLinkModel(ml, nodes))\n .filter(mlm => mlm !== undefined);\n // @ts-ignore\n model.addAll(...nodes, ...links);\n\n // load model into engine\n engine.setModel(model);\n\n const containerClassName = wrapperClassName\n ? wrapperClassName\n : classes.container;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default MetaDiagram;\nexport { MetaNode, MetaLink, MetaNodeModel, ComponentsMap };\nexport { MetaLinkModel } from './react-diagrams/MetaLinkModel';\nexport { Position } from './models/Position';\n"],"names":["ReactDiagramMetaTypes","MetaNodeModel","NodeModel","constructor","options","type","META_NODE","addPort","DefaultPortModel","in","name","MetaNode","id","shape","position","parent","set","getId","get","getParentId","getWorldPosition","add","toModel","optionsMap","Object","fromEntries","MetaLinkModel","DefaultLinkModel","META_LINK","MetaLink","sourceId","sourcePortId","targetId","targetPortId","getSourceId","getSourcePortId","getTargetId","getTargetPortId","ComponentsMap","nodesMap","linksMap","nodes","links","UnknownTypeWidget","React","MetaNodeFactory","AbstractReactFactory","componentsMap","generateModel","generateReactWidget","event","has","model","ReactComponentType","key","getOptions","engine","MetaLinkFactory","DefaultLinkFactory","generateLinkSegment","selected","path","getNode","find","n","processNodes","metaNodes","callback","metaNodeModels","mn","metaNodeModel","setPosition","x","y","push","getLinkModel","metaLink","link","source","target","setSourcePort","getPort","setTargetPort","undefined","vars","fontFamily","primaryBg","textWhite","chipTextColor","chipBgColor","chipPrimaryTextColor","chipPrimaryBgColor","breadcrumbLinkColor","breadcrumbTextColor","buttonPrimaryBgColor","buttonPrimaryBgHoverColor","buttonPrimaryDisabledBgColor","listItemActiveBg","listSelectedTextColor","listBoxShadow","listBorderColor","dividerColor","dropdownBg","dropdownTextColor","overlayColor","progressBg","progressBar","progressShadow","switchShadow","useStyles","makeStyles","root","zIndex","width","background","boxShadow","borderRadius","left","top","transform","right","padding","node","margin","borderColor","border","borderTop","display","Sidebar","classes","Box","className","List","disablePadding","component","ListItemButton","ListItemIcon","src","Buffer","Cursor","toString","alt","Move","Divider","Node","disabled","Icon","Fullscreen","applicationTheme","params","components","MuiCssBaseline","styleOverrides","MuiList","alignItems","justifyContent","marginBottom","opacity","color","marginLeft","fontWeight","fontSize","lineHeight","letterSpacing","MuiListItemIcon","minWidth","MuiListItemButton","height","backgroundColor","customVariables","Position","otherPosition","sub","_","container","canvasContainer","MetaDiagram","metaLinks","wrapperClassName","metaTheme","createEngine","getNodeFactories","registerFactory","getLinkFactories","DiagramModel","map","ml","filter","mlm","addAll","setModel","containerClassName","ThemeProvider","theme","createTheme","customThemeVariables","CssBaseline","CanvasWidget","canvasClassName"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAYA,qBAAZ;;AAAA,WAAYA;EACVA,kCAAA,mBAAA;EACAA,kCAAA,mBAAA;AACD,CAHD,EAAYA,qBAAqB,KAArBA,qBAAqB,KAAA,CAAjC;;MCGaC,sBAAsBC;EACjCC,YAAYC,OAAO,GAAG;IACpB,MAAM,EACJ,GAAGA,OADC;MAEJC,IAAI,EAAEL,qBAAqB,CAACM;KAF9B;;IAOA,KAAKC,OAAL,CACE,IAAIC,6BAAJ,CAAqB;MACnBC,EAAE,EAAE,IADe;MAEnBC,IAAI,EAAE;KAFR,CADF;IAMA,KAAKH,OAAL,CACE,IAAIC,6BAAJ,CAAqB;MACnBC,EAAE,EAAE,KADe;MAEnBC,IAAI,EAAE;KAFR,CADF;;;;;MCfSC;EAKXR,YACES,IACAF,MACAG,OACAC,UACAC,QACAX;IAEA,KAAKW,MAAL,GAAcA,MAAd;IACA,KA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nB;EAKAe,MAAM,CACH+H,gBADH;GAGGD,eAHH,CAGmB,IAAI7H,eAAJ,CAAoBV,aAAa,CAACL,KAAlC,CAHnB;;EAOA,MAAMU,KAAK,GAAG,IAAIoI,yBAAJ,EAAd;EACA,MAAM/I,KAAK,GAAGwB,YAAY,CAACC,SAAD,AAAA,CAA1B;EAEA,MAAMxB,KAAK,GAAGuI,SAAS,CACpBQ,GADW,CACPC,EAAE,IAAI/G,YAAY,CAAC+G,EAAD,EAAKjJ,KAAL,CADX,EAEXkJ,MAFW,CAEJC,GAAG,IAAIA,GAAG,KAAKzG,SAFX,CAAd;;EAIA/B,KAAK,CAACyI,MAAN,CAAa,GAAGpJ,KAAhB,EAAuB,GAAGC,KAA1B;;EAGAc,MAAM,CAACsI,QAAP,CAAgB1I,KAAhB;EAEA,MAAM2I,kBAAkB,GAAGb,gBAAgB,GACvCA,gBADuC,GAEvCjD,OAAO,CAAC6C,SAFZ;EAIA,OACElI,mBAAA,CAACoJ,sBAAD;IAAeC,KAAK,EAAEC,oBAAW,CAACD,KAAK,CAACd,SAAD,oBAACA,SAAS,CAAEgB,oBAAZ,CAAN;GAAjC,EACEvJ,mBAAA,CAACwJ,WAAD,MAAA,CADF,EAEExJ,mBAAA,CAACsF,YAAD;IAAKC,SAAS,EAAE4D;GAAhB,EACEnJ,mBAAA,CAACoF,OAAD,MAAA,CADF,EAEEpF,mBAAA,CAACyJ,4BAAD;IACElE,SAAS,KAAKF,OAAO,CAAC8C,mBAAmBI,SAA9B,oBAA8BA,SAAS,CAAEmB;IACpD9I,MAAM,EAAEA;GAFV,CAFF,CAFF,CADF;AAYD,CApDD;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"meta-diagram.cjs.development.js","sources":["../src/constants.ts","../src/models/Position.ts","../src/helpers/nodesHelper.ts","../src/react-diagrams/MetaNodeModel.ts","../src/models/MetaNode.ts","../src/react-diagrams/MetaLinkModel.ts","../src/models/MetaLink.ts","../src/models/ComponentsMap.ts","../src/components/UnknownTypeWidget.tsx","../src/react-diagrams/MetaNodeFactory.tsx","../src/react-diagrams/MetaLinkFactory.tsx","../src/helpers/linksHelper.ts","../src/components/assets/styles/variables.ts","../src/components/Sidebar.tsx","../src/theme.ts","../src/helpers/engineHelper.ts","../src/index.tsx"],"sourcesContent":["export enum ReactDiagramMetaTypes {\n META_NODE = 'meta-node-type',\n META_LINK = 'meta-link-type',\n}\n","export class Position {\n x: number;\n y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n add(otherPosition: Position) : Position {\n return new Position(this.x+ otherPosition.x, this.y + otherPosition.y)\n }\n\n sub(otherPosition: Position) : Position {\n return new Position(this.x - otherPosition.x, this.y - otherPosition.y)\n }\n}\n","import { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport {MetaNode} from \"../models/MetaNode\";\nimport {BaseEntityEvent} from \"@projectstorm/react-canvas-core\";\nimport {NodeModel, NodeModelGenerics} from \"@projectstorm/react-diagrams\";\n\nexport function getNode(\n id: string,\n nodes: MetaNodeModel[]\n): MetaNodeModel | undefined {\n return nodes.find(n => n.getOptions().id === id);\n}\n\nexport function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] {\n const metaNodeModels = []\n for(const mn of metaNodes){\n const metaNodeModel = mn.toModel()\n const position = mn.getWorldPosition()\n metaNodeModel.setPosition(position.x, position.y)\n // @ts-ignore\n metaNodeModel.registerListener({positionChanged: (event => callback(event))})\n metaNodeModels.push(metaNodeModel)\n }\n return metaNodeModels\n}\n","import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport {Position} from \"../models/Position\";\nimport {getNode} from \"../helpers/nodesHelper\";\n\nexport class MetaNodeModel extends NodeModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_NODE,\n });\n\n // set up an in and out port\n\n this.addPort(\n new DefaultPortModel({\n in: true,\n name: 'in',\n })\n );\n this.addPort(\n new DefaultPortModel({\n in: false,\n name: 'out',\n })\n );\n }\n\n getLocalPosition(nodes: MetaNodeModel[]): Position {\n const worldPosition = new Position(this.getX(), this.getY())\n // @ts-ignore\n const parentId = this.options['parentId']\n const parent = getNode(parentId, nodes)\n return parent ? worldPosition.sub(parent.getLocalPosition(nodes)) : worldPosition\n }\n\n updateLocalPosition(nodes: MetaNodeModel[]) : void {\n // @ts-ignore\n this.options['position'] = this.getLocalPosition(nodes)\n }\n}\n","import { Position } from './Position';\nimport {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport class MetaNode {\n private readonly parent: MetaNode | undefined;\n private readonly position: Position;\n private readonly options: Map;;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n position: Position,\n parent: MetaNode | undefined,\n options: Map\n ) {\n this.parent = parent\n this.position = position\n this.options = options\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getId() : string{\n return this.options.get('id')\n }\n\n getParentId() : string | undefined {\n return this.parent?.getId()\n }\n\n getWorldPosition() : Position {\n return this.parent ? this.position.add(this.parent?.getWorldPosition()) : this.position\n }\n\n toModel() : MetaNodeModel {\n const optionsMap = this.options\n optionsMap.set('parentId', this.getParentId())\n optionsMap.set('position', this.position)\n return new MetaNodeModel(Object.fromEntries(optionsMap))\n }\n\n}\n","import { DefaultLinkModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaLinkModel extends DefaultLinkModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_LINK,\n });\n }\n}\n","import { ILink } from './ILink';\nimport {MetaLinkModel} from \"../react-diagrams/MetaLinkModel\";\n\nexport class MetaLink implements ILink {\n sourceId: string;\n sourcePortId: string;\n targetId: string;\n targetPortId: string;\n options: Map;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n sourceId: string,\n sourcePortId: string,\n targetId: string,\n targetPortId: string,\n options: Map\n ) {\n this.sourceId = sourceId;\n this.sourcePortId = sourcePortId;\n this.targetId = targetId;\n this.targetPortId = targetPortId;\n this.options = options;\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getSourceId(): string {\n return this.sourceId;\n }\n\n getSourcePortId(): string {\n return this.sourcePortId;\n }\n\n getTargetId(): string {\n return this.targetId;\n }\n\n getTargetPortId(): string {\n return this.targetPortId;\n }\n\n toModel(): MetaLinkModel {\n return new MetaLinkModel(Object.fromEntries(this.options))\n }\n}\n","import React from 'react';\n\nexport class ComponentsMap {\n nodes: Map;\n links: Map;\n\n constructor(\n nodesMap: Map,\n linksMap: Map\n ) {\n this.nodes = nodesMap;\n this.links = linksMap;\n }\n}\n","import React from 'react';\n\nexport const UnknownTypeWidget = () => {\n return
Unknown Type
;\n};\n","import { AbstractReactFactory } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './MetaNodeModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport React from 'react';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeFactory extends AbstractReactFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_NODE);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaNodeModel();\n }\n\n generateReactWidget(event: any): JSX.Element {\n if (this.componentsMap.has(event.model.options.shape)) {\n const ReactComponentType = this.componentsMap.get(\n event.model.options.shape\n );\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default node instead\n return ;\n }\n}\n","import { MetaLinkModel } from './MetaLinkModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport React from 'react';\nimport { DefaultLinkFactory } from '@projectstorm/react-diagrams';\n\nexport class MetaLinkFactory extends DefaultLinkFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_LINK);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaLinkModel();\n }\n\n generateLinkSegment(\n model: MetaLinkModel,\n selected: boolean,\n path: string\n ): JSX.Element {\n // @ts-ignore\n if (this.componentsMap.has(model.getOptions()?.shape)) {\n const ReactComponentType = this.componentsMap.get(\n // @ts-ignore\n model.getOptions().shape\n );\n\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default link instead\n return ;\n }\n}\n","import { MetaLink } from '../models/MetaLink';\nimport { MetaLinkModel } from '../react-diagrams/MetaLinkModel';\nimport { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport { getNode } from './nodesHelper';\n\nexport function getLinkModel(\n metaLink: MetaLink,\n nodes: MetaNodeModel[]\n): MetaLinkModel | undefined {\n const link = metaLink.toModel();\n const source = getNode(metaLink.getSourceId(), nodes);\n const target = getNode(metaLink.getTargetId(), nodes);\n if (source && target) {\n link.setSourcePort(source.getPort(metaLink.getSourcePortId()));\n link.setTargetPort(target.getPort(metaLink.getTargetPortId()));\n return link;\n }\n return undefined;\n}\n","const vars = {\n fontFamily: 'Inter, sans-serif',\n primaryBg: '#f1f1f1',\n textWhite: '#FFFFFF',\n chipTextColor: '#F2F2F7',\n chipBgColor: 'rgba(60, 60, 67, 0.4)',\n\n chipPrimaryTextColor: 'rgba(255, 255, 255, 0.8)',\n chipPrimaryBgColor: 'rgba(0, 122, 255, 0.6)',\n\n breadcrumbLinkColor: '#A2A2A2',\n breadcrumbTextColor: '#292929',\n\n buttonPrimaryBgColor: '4353FF',\n buttonPrimaryBgHoverColor: '#3443E1',\n buttonPrimaryDisabledBgColor: 'rgba(0, 122, 255, 0.4)',\n\n listItemActiveBg: '#007AFF',\n listSelectedTextColor: '#3C3C43',\n listBoxShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)',\n listBorderColor: 'rgba(0, 0, 0, 0.04)',\n\n dividerColor: 'rgba(118, 120, 125, 0.12)',\n\n dropdownBg: 'rgba(246, 246, 248, 0.8)',\n dropdownTextColor: 'rgba(60, 60, 67, 0.6)',\n\n overlayColor: 'rgba(0, 0, 0, 0.4)',\n\n progressBg: '#E5E5E5',\n progressBar: '#017AFF',\n progressShadow: 'inset 0 0 0.0625rem #E3E3E3',\n\n switchShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',\n};\n\nexport default vars;\n","import React from 'react';\nimport { Box } from '@mui/system';\nimport { makeStyles } from '@mui/styles';\nimport vars from './assets/styles/variables';\nimport { Divider, List, ListItemButton, ListItemIcon } from '@mui/material';\nimport Move from './assets/svg/move.svg';\nimport Icon from './assets/svg/icon.svg';\nimport Node from './assets/svg/node.svg';\nimport Cursor from './assets/svg/cursor.svg';\nimport Fullscreen from './assets/svg/fullscreen.svg';\n\nconst { textWhite, dividerColor } = vars;\n\nconst useStyles = makeStyles(() => ({\n root: {\n zIndex: '5',\n width: '4rem',\n background: textWhite,\n boxShadow:\n '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)',\n borderRadius: '2rem',\n position: 'fixed',\n left: '1rem',\n top: '50%',\n transform: 'translateY(-50%)',\n\n '&.right': {\n left: 'auto',\n right: '1rem',\n },\n\n '& .MuiList-root': {\n padding: '0.75rem',\n },\n },\n\n node: {\n margin: '0.25rem 0',\n '& .MuiDivider-root': {\n borderColor: dividerColor,\n width: 'calc(100% - 1.5rem)',\n margin: '0 auto',\n border: 'none',\n borderTop: '0.0625rem solid',\n },\n\n '& img': {\n display: 'block',\n margin: '1rem 0',\n },\n },\n}));\n\nconst Sidebar = () => {\n const classes = useStyles();\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n );\n};\n\nexport default Sidebar;\n","import vars from './components/assets/styles/variables';\n\ntype ThemeVars = {\n [key: string]: any;\n};\n\nconst applicationTheme = (params: ThemeVars) => {\n const {\n primaryBg,\n fontFamily,\n chipTextColor,\n chipBgColor,\n textWhite,\n listItemActiveBg,\n listSelectedTextColor,\n listBoxShadow,\n listBorderColor,\n } = params;\n return {\n components: {\n MuiCssBaseline: {\n styleOverrides: `\n html {\n background: ${primaryBg};\n font-family: ${fontFamily};\n }\n body {\n background-color:${primaryBg};\n font-family: ${fontFamily};\n font-size: 1rem;\n }\n `,\n },\n MuiList: {\n styleOverrides: {\n root: {\n '&.customSwitch': {\n padding: '0.125rem',\n background: chipTextColor,\n borderRadius: '0.5rem',\n display: 'flex',\n '& .MuiListItemButton-root': {\n padding: '0.25rem 0.75rem',\n borderRadius: '0.4375rem',\n width: '10.59375rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n '&:not(:last-child)': {\n marginBottom: '0',\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n '&.Mui-selected': {\n background: textWhite,\n boxShadow: listBoxShadow,\n border: `0.03125rem solid ${listBorderColor}`,\n '& .MuiTypography-root': {\n color: listSelectedTextColor,\n },\n },\n },\n '& .MuiChip-root': {\n marginLeft: '0.25rem',\n },\n '& .MuiTypography-root': {\n fontWeight: 500,\n fontSize: '0.8125rem',\n lineHeight: '1.25rem',\n letterSpacing: '-0.005rem',\n color: chipBgColor,\n margin: 0,\n },\n },\n },\n },\n },\n MuiListItemIcon: {\n styleOverrides: {\n root: {\n minWidth: 'inherit',\n },\n },\n },\n MuiListItemButton: {\n styleOverrides: {\n root: {\n padding: 0,\n width: '2.5rem',\n height: '2.5rem',\n borderRadius: '50%',\n justifyContent: 'center',\n backgroundColor: chipTextColor,\n '&:hover': {\n backgroundColor: chipTextColor,\n },\n '&:not(:last-child)': {\n marginBottom: '0.75rem',\n },\n '&.Mui-selected': {\n backgroundColor: listItemActiveBg,\n '&:hover': {\n backgroundColor: listItemActiveBg,\n },\n },\n '&.Mui-disabled': {\n opacity: 0.8,\n },\n },\n },\n },\n },\n };\n};\n\nexport default (customVariables: ThemeVars) =>\n applicationTheme({\n ...vars,\n ...customVariables,\n });\n","import {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport function updateChildrenPosition(nodes: MetaNodeModel[], parent: MetaNodeModel): void {\n // @ts-ignore\n const children = nodes.filter(n => n.options['parentId'] == parent.options['id']);\n children.forEach(n => {\n // @ts-ignore\n n.setPosition(parent.getX() + n.options['position'].x, parent.getY() + n.options['position'].y)\n // TODO: Fix nested position update\n // updateChildrenPosition(nodes, n)\n })\n}\n\nexport function updateNodeLocalPosition(nodes: MetaNodeModel[], node: MetaNodeModel): void {\n node.updateLocalPosition(nodes)\n}","import * as React from 'react';\nimport { MetaNode } from './models/MetaNode';\nimport { MetaLink } from './models/MetaLink';\nimport { ComponentsMap } from './models/ComponentsMap';\nimport createEngine, { DiagramModel } from '@projectstorm/react-diagrams';\nimport { MetaNodeFactory } from './react-diagrams/MetaNodeFactory';\nimport { MetaLinkFactory } from './react-diagrams/MetaLinkFactory';\nimport { CanvasWidget } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './react-diagrams/MetaNodeModel';\nimport { getLinkModel } from './helpers/linksHelper';\nimport { makeStyles } from '@mui/styles';\nimport Sidebar from './components/Sidebar';\nimport { ThemeProvider, createTheme } from '@mui/material/styles';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport theme from './theme';\nimport { Box } from '@mui/material';\nimport {processNodes} from \"./helpers/nodesHelper\";\nimport {updateChildrenPosition} from \"./helpers/engineHelper\";\n\nconst useStyles = makeStyles(_ => ({\n container: {\n height: '100%',\n width: '100%',\n },\n canvasContainer: {\n height: '100%',\n width: '100%',\n background: '#fffff',\n },\n}));\n\ninterface MetaDiagramProps {\n metaNodes: MetaNode[];\n metaLinks: MetaLink[];\n componentsMap: ComponentsMap;\n wrapperClassName?: string;\n canvasClassName?: string;\n metaTheme: {\n customThemeVariables: {};\n canvasClassName: string;\n };\n}\n\nconst MetaDiagram = ({\n metaNodes,\n metaLinks,\n componentsMap,\n wrapperClassName,\n metaTheme,\n}: MetaDiagramProps) => {\n const classes = useStyles();\n\n // set up the diagram engine\n const engine = createEngine();\n\n engine\n .getNodeFactories()\n // @ts-ignore\n .registerFactory(new MetaNodeFactory(componentsMap.nodes));\n\n engine\n .getLinkFactories()\n // @ts-ignore\n .registerFactory(new MetaLinkFactory(componentsMap.links));\n\n // @ts-ignore\n const repaintCanvas = (event: any) => {\n let model = engine.getModel();\n const node = event.entity\n const nodes = model.getNodes()\n // @ts-ignore\n updateChildrenPosition(nodes, node)\n // @ts-ignore\n // updateNodeLocalPosition(nodes, node)\n engine.repaintCanvas();\n }\n\n // set up the diagram model\n\n const model = new DiagramModel();\n const nodes = processNodes(metaNodes, repaintCanvas)\n\n const links = metaLinks\n .map(ml => getLinkModel(ml, nodes))\n .filter(mlm => mlm !== undefined);\n // @ts-ignore\n model.addAll(...nodes, ...links);\n\n // load model into engine\n engine.setModel(model);\n\n const containerClassName = wrapperClassName\n ? wrapperClassName\n : classes.container;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default MetaDiagram;\nexport { MetaNode, MetaLink, MetaNodeModel, ComponentsMap };\nexport { MetaLinkModel } from './react-diagrams/MetaLinkModel';\nexport { Position } from './models/Position';\n"],"names":["ReactDiagramMetaTypes","Position","constructor","x","y","add","otherPosition","sub","getNode","id","nodes","find","n","getOptions","processNodes","metaNodes","callback","metaNodeModels","mn","metaNodeModel","toModel","position","getWorldPosition","setPosition","registerListener","positionChanged","event","push","MetaNodeModel","NodeModel","options","type","META_NODE","addPort","DefaultPortModel","in","name","getLocalPosition","worldPosition","getX","getY","parentId","parent","updateLocalPosition","MetaNode","shape","set","getId","get","getParentId","optionsMap","Object","fromEntries","MetaLinkModel","DefaultLinkModel","META_LINK","MetaLink","sourceId","sourcePortId","targetId","targetPortId","getSourceId","getSourcePortId","getTargetId","getTargetPortId","ComponentsMap","nodesMap","linksMap","links","UnknownTypeWidget","React","MetaNodeFactory","AbstractReactFactory","componentsMap","generateModel","generateReactWidget","has","model","ReactComponentType","key","engine","MetaLinkFactory","DefaultLinkFactory","generateLinkSegment","selected","path","getLinkModel","metaLink","link","source","target","setSourcePort","getPort","setTargetPort","undefined","vars","fontFamily","primaryBg","textWhite","chipTextColor","chipBgColor","chipPrimaryTextColor","chipPrimaryBgColor","breadcrumbLinkColor","breadcrumbTextColor","buttonPrimaryBgColor","buttonPrimaryBgHoverColor","buttonPrimaryDisabledBgColor","listItemActiveBg","listSelectedTextColor","listBoxShadow","listBorderColor","dividerColor","dropdownBg","dropdownTextColor","overlayColor","progressBg","progressBar","progressShadow","switchShadow","useStyles","makeStyles","root","zIndex","width","background","boxShadow","borderRadius","left","top","transform","right","padding","node","margin","borderColor","border","borderTop","display","Sidebar","classes","Box","className","List","disablePadding","component","ListItemButton","ListItemIcon","src","Buffer","Cursor","toString","alt","Move","Divider","Node","disabled","Icon","Fullscreen","applicationTheme","params","components","MuiCssBaseline","styleOverrides","MuiList","alignItems","justifyContent","marginBottom","opacity","color","marginLeft","fontWeight","fontSize","lineHeight","letterSpacing","MuiListItemIcon","minWidth","MuiListItemButton","height","backgroundColor","customVariables","updateChildrenPosition","children","filter","forEach","_","container","canvasContainer","MetaDiagram","metaLinks","wrapperClassName","metaTheme","createEngine","getNodeFactories","registerFactory","getLinkFactories","repaintCanvas","getModel","entity","getNodes","DiagramModel","map","ml","mlm","addAll","setModel","containerClassName","ThemeProvider","theme","createTheme","customThemeVariables","CssBaseline","CanvasWidget","canvasClassName"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAYA,qBAAZ;;AAAA,WAAYA;EACVA,kCAAA,mBAAA;EACAA,kCAAA,mBAAA;AACD,CAHD,EAAYA,qBAAqB,KAArBA,qBAAqB,KAAA,CAAjC;;MCAaC;EAIXC,YAAYC,GAAWC;IACrB,KAAKD,CAAL,GAASA,CAAT;IACA,KAAKC,CAAL,GAASA,CAAT;;;EAGFC,GAAG,CAACC,aAAD;IACD,OAAO,IAAIL,QA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AEErE,mBAAA,CAAC8I,4BAAD;IACEtE,SAAS,KAAKF,OAAO,CAAC+C,mBAAmBI,SAA9B,oBAA8BA,SAAS,CAAEsB;IACpDrI,MAAM,EAAEA;GAFV,CAFF,CAFF,CADF;AAYD,CAhED;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/meta-diagram.cjs.production.min.js b/dist/meta-diagram.cjs.production.min.js index 2a580ec..eeda280 100644 --- a/dist/meta-diagram.cjs.production.min.js +++ b/dist/meta-diagram.cjs.production.min.js @@ -1,2 +1,2 @@ -"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=require("react"),o=e(r),n=require("@projectstorm/react-diagrams"),i=e(n),s=require("@projectstorm/react-canvas-core"),a=require("@mui/styles"),l=require("@mui/system"),d=require("@mui/material"),c=require("@mui/material/styles"),m=e(require("@mui/material/CssBaseline"));!function(e){e.META_NODE="meta-node-type",e.META_LINK="meta-link-type"}(t||(t={}));class g extends n.NodeModel{constructor(e={}){super({...e,type:t.META_NODE}),this.addPort(new n.DefaultPortModel({in:!0,name:"in"})),this.addPort(new n.DefaultPortModel({in:!1,name:"out"}))}}class u extends n.DefaultLinkModel{constructor(e={}){super({...e,type:t.META_LINK})}}const C=()=>o.createElement("div",null,"Unknown Type");class h extends s.AbstractReactFactory{constructor(e){super(t.META_NODE),this.componentsMap=e}generateModel(){return new g}generateReactWidget(e){if(this.componentsMap.has(e.model.options.shape)){const t=this.componentsMap.get(e.model.options.shape);return o.createElement(t,{key:"node-factory-"+e.model.getOptions().id,engine:this.engine,model:e.model})}return o.createElement(C,null)}}class p extends n.DefaultLinkFactory{constructor(e){super(t.META_LINK),this.componentsMap=e}generateModel(){return new u}generateLinkSegment(e,t,r){var n;if(this.componentsMap.has(null==(n=e.getOptions())?void 0:n.shape)){const n=this.componentsMap.get(e.getOptions().shape);return o.createElement(n,{key:"link-factory-"+e.getOptions().id,engine:this.engine,model:e,path:r,selected:t})}return o.createElement(C,null)}}function f(e,t){return t.find(t=>t.getOptions().id===e)}const w={fontFamily:"Inter, sans-serif",primaryBg:"#f1f1f1",textWhite:"#FFFFFF",chipTextColor:"#F2F2F7",chipBgColor:"rgba(60, 60, 67, 0.4)",chipPrimaryTextColor:"rgba(255, 255, 255, 0.8)",chipPrimaryBgColor:"rgba(0, 122, 255, 0.6)",breadcrumbLinkColor:"#A2A2A2",breadcrumbTextColor:"#292929",buttonPrimaryBgColor:"4353FF",buttonPrimaryBgHoverColor:"#3443E1",buttonPrimaryDisabledBgColor:"rgba(0, 122, 255, 0.4)",listItemActiveBg:"#007AFF",listSelectedTextColor:"#3C3C43",listBoxShadow:"0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)",listBorderColor:"rgba(0, 0, 0, 0.04)",dividerColor:"rgba(118, 120, 125, 0.12)",dropdownBg:"rgba(246, 246, 248, 0.8)",dropdownTextColor:"rgba(60, 60, 67, 0.6)",overlayColor:"rgba(0, 0, 0, 0.4)",progressBg:"#E5E5E5",progressBar:"#017AFF",progressShadow:"inset 0 0 0.0625rem #E3E3E3",switchShadow:"0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)"},{textWhite:b,dividerColor:y}=w,M=a.makeStyles(()=>({root:{zIndex:"5",width:"4rem",background:b,boxShadow:"0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)",borderRadius:"2rem",position:"fixed",left:"1rem",top:"50%",transform:"translateY(-50%)","&.right":{left:"auto",right:"1rem"},"& .MuiList-root":{padding:"0.75rem"}},node:{margin:"0.25rem 0","& .MuiDivider-root":{borderColor:y,width:"calc(100% - 1.5rem)",margin:"0 auto",border:"none",borderTop:"0.0625rem solid"},"& img":{display:"block",margin:"1rem 0"}}})),v=()=>{const e=M();return o.createElement(l.Box,{className:e.root+" left"},o.createElement(d.List,{disablePadding:!0,component:"nav"},o.createElement(d.ListItemButton,{selected:!0},o.createElement(d.ListItemIcon,null,o.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"icon"}))),o.createElement(d.ListItemButton,null,o.createElement(d.ListItemIcon,null,o.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"move"})))),o.createElement(l.Box,{className:e.node},o.createElement(d.Divider,null),o.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n').toString("base64"),alt:"node"}),o.createElement(d.Divider,null)),o.createElement(d.List,{disablePadding:!0,component:"nav"},o.createElement(d.ListItemButton,{disabled:!0},o.createElement(d.ListItemIcon,null,o.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"icon"}))),o.createElement(d.ListItemButton,null,o.createElement(d.ListItemIcon,null,o.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"fullscreen"})))))};class x{constructor(e,t){this.x=e,this.y=t}add(e){return new x(this.x+e.x,this.y+e.y)}sub(e){return new x(this.x-e.x,this.y-e.y)}}const E=a.makeStyles(e=>({container:{height:"100%",width:"100%"},canvasContainer:{height:"100%",width:"100%",background:"#fffff"}}));exports.ComponentsMap=class{constructor(e,t){this.nodes=e,this.links=t}},exports.MetaLink=class{constructor(e,t,r,o,n,i,s,a){this.sourceId=o,this.sourcePortId=n,this.targetId=i,this.targetPortId=s,this.options=a,this.options.set("id",e),this.options.set("name",t),this.options.set("shape",r)}getSourceId(){return this.sourceId}getSourcePortId(){return this.sourcePortId}getTargetId(){return this.targetId}getTargetPortId(){return this.targetPortId}toModel(){return new u(Object.fromEntries(this.options))}},exports.MetaLinkModel=u,exports.MetaNode=class{constructor(e,t,r,o,n,i){this.parent=n,this.position=o,this.options=i,this.options.set("id",e),this.options.set("name",t),this.options.set("shape",r)}getId(){return this.options.get("id")}getParentId(){var e;return null==(e=this.parent)?void 0:e.getId()}getWorldPosition(){var e;return this.parent?this.position.add(null==(e=this.parent)?void 0:e.getWorldPosition()):this.position}toModel(){const e=this.options;return e.set("parentId",this.getParentId()),e.set("position",this.position),new g(Object.fromEntries(e))}},exports.MetaNodeModel=g,exports.Position=x,exports.default=({metaNodes:e,metaLinks:t,componentsMap:o,wrapperClassName:a,metaTheme:l})=>{const g=E(),u=i();u.getNodeFactories().registerFactory(new h(o.nodes)),u.getLinkFactories().registerFactory(new p(o.links));const C=new n.DiagramModel,b=function(e,t){const r=[];for(const t of e){const e=t.toModel(),o=t.getWorldPosition();e.setPosition(o.x,o.y),r.push(e)}return r}(e),y=t.map(e=>function(e,t){const r=e.toModel(),o=f(e.getSourceId(),t),n=f(e.getTargetId(),t);if(o&&n)return r.setSourcePort(o.getPort(e.getSourcePortId())),r.setTargetPort(n.getPort(e.getTargetPortId())),r}(e,b)).filter(e=>void 0!==e);C.addAll(...b,...y),u.setModel(C);const M=a||g.container;return r.createElement(c.ThemeProvider,{theme:c.createTheme((x=null==l?void 0:l.customThemeVariables,(e=>{const{primaryBg:t,fontFamily:r,chipTextColor:o,chipBgColor:n,textWhite:i,listItemActiveBg:s,listSelectedTextColor:a,listBoxShadow:l,listBorderColor:d}=e;return{components:{MuiCssBaseline:{styleOverrides:`\n html {\n background: ${t};\n font-family: ${r};\n }\n body {\n background-color:${t};\n font-family: ${r};\n font-size: 1rem;\n }\n `},MuiList:{styleOverrides:{root:{"&.customSwitch":{padding:"0.125rem",background:o,borderRadius:"0.5rem",display:"flex","& .MuiListItemButton-root":{padding:"0.25rem 0.75rem",borderRadius:"0.4375rem",width:"10.59375rem",display:"flex",alignItems:"center",justifyContent:"center","&:not(:last-child)":{marginBottom:"0"},"&.Mui-disabled":{opacity:1},"&.Mui-selected":{background:i,boxShadow:l,border:"0.03125rem solid "+d,"& .MuiTypography-root":{color:a}}},"& .MuiChip-root":{marginLeft:"0.25rem"},"& .MuiTypography-root":{fontWeight:500,fontSize:"0.8125rem",lineHeight:"1.25rem",letterSpacing:"-0.005rem",color:n,margin:0}}}}},MuiListItemIcon:{styleOverrides:{root:{minWidth:"inherit"}}},MuiListItemButton:{styleOverrides:{root:{padding:0,width:"2.5rem",height:"2.5rem",borderRadius:"50%",justifyContent:"center",backgroundColor:o,"&:hover":{backgroundColor:o},"&:not(:last-child)":{marginBottom:"0.75rem"},"&.Mui-selected":{backgroundColor:s,"&:hover":{backgroundColor:s}},"&.Mui-disabled":{opacity:.8}}}}}}})({...w,...x})))},r.createElement(m,null),r.createElement(d.Box,{className:M},r.createElement(v,null),r.createElement(s.CanvasWidget,{className:`${g.canvasContainer} ${null==l?void 0:l.canvasClassName}`,engine:u})));var x}; +"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,o=require("react"),r=e(o),i=require("@projectstorm/react-diagrams"),n=e(i),s=require("@projectstorm/react-canvas-core"),a=require("@mui/styles"),l=require("@mui/system"),d=require("@mui/material"),c=require("@mui/material/styles"),m=e(require("@mui/material/CssBaseline"));!function(e){e.META_NODE="meta-node-type",e.META_LINK="meta-link-type"}(t||(t={}));class g{constructor(e,t){this.x=e,this.y=t}add(e){return new g(this.x+e.x,this.y+e.y)}sub(e){return new g(this.x-e.x,this.y-e.y)}}function u(e,t){return t.find(t=>t.getOptions().id===e)}class C extends i.NodeModel{constructor(e={}){super({...e,type:t.META_NODE}),this.addPort(new i.DefaultPortModel({in:!0,name:"in"})),this.addPort(new i.DefaultPortModel({in:!1,name:"out"}))}getLocalPosition(e){const t=new g(this.getX(),this.getY()),o=u(this.options.parentId,e);return o?t.sub(o.getLocalPosition(e)):t}updateLocalPosition(e){this.options.position=this.getLocalPosition(e)}}class p extends i.DefaultLinkModel{constructor(e={}){super({...e,type:t.META_LINK})}}const h=()=>r.createElement("div",null,"Unknown Type");class f extends s.AbstractReactFactory{constructor(e){super(t.META_NODE),this.componentsMap=e}generateModel(){return new C}generateReactWidget(e){if(this.componentsMap.has(e.model.options.shape)){const t=this.componentsMap.get(e.model.options.shape);return r.createElement(t,{key:"node-factory-"+e.model.getOptions().id,engine:this.engine,model:e.model})}return r.createElement(h,null)}}class w extends i.DefaultLinkFactory{constructor(e){super(t.META_LINK),this.componentsMap=e}generateModel(){return new p}generateLinkSegment(e,t,o){var i;if(this.componentsMap.has(null==(i=e.getOptions())?void 0:i.shape)){const i=this.componentsMap.get(e.getOptions().shape);return r.createElement(i,{key:"link-factory-"+e.getOptions().id,engine:this.engine,model:e,path:o,selected:t})}return r.createElement(h,null)}}const b={fontFamily:"Inter, sans-serif",primaryBg:"#f1f1f1",textWhite:"#FFFFFF",chipTextColor:"#F2F2F7",chipBgColor:"rgba(60, 60, 67, 0.4)",chipPrimaryTextColor:"rgba(255, 255, 255, 0.8)",chipPrimaryBgColor:"rgba(0, 122, 255, 0.6)",breadcrumbLinkColor:"#A2A2A2",breadcrumbTextColor:"#292929",buttonPrimaryBgColor:"4353FF",buttonPrimaryBgHoverColor:"#3443E1",buttonPrimaryDisabledBgColor:"rgba(0, 122, 255, 0.4)",listItemActiveBg:"#007AFF",listSelectedTextColor:"#3C3C43",listBoxShadow:"0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)",listBorderColor:"rgba(0, 0, 0, 0.04)",dividerColor:"rgba(118, 120, 125, 0.12)",dropdownBg:"rgba(246, 246, 248, 0.8)",dropdownTextColor:"rgba(60, 60, 67, 0.6)",overlayColor:"rgba(0, 0, 0, 0.4)",progressBg:"#E5E5E5",progressBar:"#017AFF",progressShadow:"inset 0 0 0.0625rem #E3E3E3",switchShadow:"0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)"},{textWhite:y,dividerColor:M}=b,v=a.makeStyles(()=>({root:{zIndex:"5",width:"4rem",background:y,boxShadow:"0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)",borderRadius:"2rem",position:"fixed",left:"1rem",top:"50%",transform:"translateY(-50%)","&.right":{left:"auto",right:"1rem"},"& .MuiList-root":{padding:"0.75rem"}},node:{margin:"0.25rem 0","& .MuiDivider-root":{borderColor:M,width:"calc(100% - 1.5rem)",margin:"0 auto",border:"none",borderTop:"0.0625rem solid"},"& img":{display:"block",margin:"1rem 0"}}})),x=()=>{const e=v();return r.createElement(l.Box,{className:e.root+" left"},r.createElement(d.List,{disablePadding:!0,component:"nav"},r.createElement(d.ListItemButton,{selected:!0},r.createElement(d.ListItemIcon,null,r.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"icon"}))),r.createElement(d.ListItemButton,null,r.createElement(d.ListItemIcon,null,r.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"move"})))),r.createElement(l.Box,{className:e.node},r.createElement(d.Divider,null),r.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n').toString("base64"),alt:"node"}),r.createElement(d.Divider,null)),r.createElement(d.List,{disablePadding:!0,component:"nav"},r.createElement(d.ListItemButton,{disabled:!0},r.createElement(d.ListItemIcon,null,r.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"icon"}))),r.createElement(d.ListItemButton,null,r.createElement(d.ListItemIcon,null,r.createElement("img",{src:"data:image/svg+xml;base64,"+new Buffer('\n\n').toString("base64"),alt:"fullscreen"})))))},L=a.makeStyles(e=>({container:{height:"100%",width:"100%"},canvasContainer:{height:"100%",width:"100%",background:"#fffff"}}));exports.ComponentsMap=class{constructor(e,t){this.nodes=e,this.links=t}},exports.MetaLink=class{constructor(e,t,o,r,i,n,s,a){this.sourceId=r,this.sourcePortId=i,this.targetId=n,this.targetPortId=s,this.options=a,this.options.set("id",e),this.options.set("name",t),this.options.set("shape",o)}getSourceId(){return this.sourceId}getSourcePortId(){return this.sourcePortId}getTargetId(){return this.targetId}getTargetPortId(){return this.targetPortId}toModel(){return new p(Object.fromEntries(this.options))}},exports.MetaLinkModel=p,exports.MetaNode=class{constructor(e,t,o,r,i,n){this.parent=i,this.position=r,this.options=n,this.options.set("id",e),this.options.set("name",t),this.options.set("shape",o)}getId(){return this.options.get("id")}getParentId(){var e;return null==(e=this.parent)?void 0:e.getId()}getWorldPosition(){var e;return this.parent?this.position.add(null==(e=this.parent)?void 0:e.getWorldPosition()):this.position}toModel(){const e=this.options;return e.set("parentId",this.getParentId()),e.set("position",this.position),new C(Object.fromEntries(e))}},exports.MetaNodeModel=C,exports.Position=g,exports.default=({metaNodes:e,metaLinks:t,componentsMap:r,wrapperClassName:a,metaTheme:l})=>{const g=L(),C=n();C.getNodeFactories().registerFactory(new f(r.nodes)),C.getLinkFactories().registerFactory(new w(r.links));const p=new i.DiagramModel,h=function(e,t){const o=[];for(const r of e){const e=r.toModel(),i=r.getWorldPosition();e.setPosition(i.x,i.y),e.registerListener({positionChanged:e=>t(e)}),o.push(e)}return o}(e,e=>{let t=C.getModel();const o=e.entity;!function(e,t){e.filter(e=>e.options.parentId==t.options.id).forEach(e=>{e.setPosition(t.getX()+e.options.position.x,t.getY()+e.options.position.y)})}(t.getNodes(),o),C.repaintCanvas()}),y=t.map(e=>function(e,t){const o=e.toModel(),r=u(e.getSourceId(),t),i=u(e.getTargetId(),t);if(r&&i)return o.setSourcePort(r.getPort(e.getSourcePortId())),o.setTargetPort(i.getPort(e.getTargetPortId())),o}(e,h)).filter(e=>void 0!==e);p.addAll(...h,...y),C.setModel(p);const M=a||g.container;return o.createElement(c.ThemeProvider,{theme:c.createTheme((v=null==l?void 0:l.customThemeVariables,(e=>{const{primaryBg:t,fontFamily:o,chipTextColor:r,chipBgColor:i,textWhite:n,listItemActiveBg:s,listSelectedTextColor:a,listBoxShadow:l,listBorderColor:d}=e;return{components:{MuiCssBaseline:{styleOverrides:`\n html {\n background: ${t};\n font-family: ${o};\n }\n body {\n background-color:${t};\n font-family: ${o};\n font-size: 1rem;\n }\n `},MuiList:{styleOverrides:{root:{"&.customSwitch":{padding:"0.125rem",background:r,borderRadius:"0.5rem",display:"flex","& .MuiListItemButton-root":{padding:"0.25rem 0.75rem",borderRadius:"0.4375rem",width:"10.59375rem",display:"flex",alignItems:"center",justifyContent:"center","&:not(:last-child)":{marginBottom:"0"},"&.Mui-disabled":{opacity:1},"&.Mui-selected":{background:n,boxShadow:l,border:"0.03125rem solid "+d,"& .MuiTypography-root":{color:a}}},"& .MuiChip-root":{marginLeft:"0.25rem"},"& .MuiTypography-root":{fontWeight:500,fontSize:"0.8125rem",lineHeight:"1.25rem",letterSpacing:"-0.005rem",color:i,margin:0}}}}},MuiListItemIcon:{styleOverrides:{root:{minWidth:"inherit"}}},MuiListItemButton:{styleOverrides:{root:{padding:0,width:"2.5rem",height:"2.5rem",borderRadius:"50%",justifyContent:"center",backgroundColor:r,"&:hover":{backgroundColor:r},"&:not(:last-child)":{marginBottom:"0.75rem"},"&.Mui-selected":{backgroundColor:s,"&:hover":{backgroundColor:s}},"&.Mui-disabled":{opacity:.8}}}}}}})({...b,...v})))},o.createElement(m,null),o.createElement(d.Box,{className:M},o.createElement(x,null),o.createElement(s.CanvasWidget,{className:`${g.canvasContainer} ${null==l?void 0:l.canvasClassName}`,engine:C})));var v}; //# sourceMappingURL=meta-diagram.cjs.production.min.js.map diff --git a/dist/meta-diagram.cjs.production.min.js.map b/dist/meta-diagram.cjs.production.min.js.map index 576c0d1..23cce54 100644 --- a/dist/meta-diagram.cjs.production.min.js.map +++ b/dist/meta-diagram.cjs.production.min.js.map @@ -1 +1 @@ -{"version":3,"file":"meta-diagram.cjs.production.min.js","sources":["../src/constants.ts","../src/react-diagrams/MetaNodeModel.ts","../src/react-diagrams/MetaLinkModel.ts","../src/components/UnknownTypeWidget.tsx","../src/react-diagrams/MetaNodeFactory.tsx","../src/react-diagrams/MetaLinkFactory.tsx","../src/helpers/nodesHelper.ts","../src/components/assets/styles/variables.ts","../src/components/Sidebar.tsx","../src/models/Position.ts","../src/index.tsx","../src/models/ComponentsMap.ts","../src/models/MetaLink.ts","../src/models/MetaNode.ts","../src/helpers/linksHelper.ts","../src/theme.ts"],"sourcesContent":["export enum ReactDiagramMetaTypes {\n META_NODE = 'meta-node-type',\n META_LINK = 'meta-link-type',\n}\n","import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeModel extends NodeModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_NODE,\n });\n\n // set up an in and out port\n\n this.addPort(\n new DefaultPortModel({\n in: true,\n name: 'in',\n })\n );\n this.addPort(\n new DefaultPortModel({\n in: false,\n name: 'out',\n })\n );\n }\n}\n","import { DefaultLinkModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaLinkModel extends DefaultLinkModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_LINK,\n });\n }\n}\n","import React from 'react';\n\nexport const UnknownTypeWidget = () => {\n return
Unknown Type
;\n};\n","import { AbstractReactFactory } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './MetaNodeModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport React from 'react';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeFactory extends AbstractReactFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_NODE);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaNodeModel();\n }\n\n generateReactWidget(event: any): JSX.Element {\n if (this.componentsMap.has(event.model.options.shape)) {\n const ReactComponentType = this.componentsMap.get(\n event.model.options.shape\n );\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default node instead\n return ;\n }\n}\n","import { MetaLinkModel } from './MetaLinkModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport React from 'react';\nimport { DefaultLinkFactory } from '@projectstorm/react-diagrams';\n\nexport class MetaLinkFactory extends DefaultLinkFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_LINK);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaLinkModel();\n }\n\n generateLinkSegment(\n model: MetaLinkModel,\n selected: boolean,\n path: string\n ): JSX.Element {\n // @ts-ignore\n if (this.componentsMap.has(model.getOptions()?.shape)) {\n const ReactComponentType = this.componentsMap.get(\n // @ts-ignore\n model.getOptions().shape\n );\n\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default link instead\n return ;\n }\n}\n","import { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport {MetaNode} from \"../models/MetaNode\";\nimport {BaseEntityEvent} from \"@projectstorm/react-canvas-core\";\nimport {NodeModel, NodeModelGenerics} from \"@projectstorm/react-diagrams\";\n\nexport function getNode(\n id: string,\n nodes: MetaNodeModel[]\n): MetaNodeModel | undefined {\n return nodes.find(n => n.getOptions().id === id);\n}\n\n// @ts-ignore\nexport function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] {\n const metaNodeModels = []\n for(const mn of metaNodes){\n const metaNodeModel = mn.toModel()\n const position = mn.getWorldPosition()\n metaNodeModel.setPosition(position.x, position.y)\n // @ts-ignore\n //metaNodeModel.registerListener({positionChanged: (event => callback(event))})\n metaNodeModels.push(metaNodeModel)\n }\n return metaNodeModels\n}\n","const vars = {\n fontFamily: 'Inter, sans-serif',\n primaryBg: '#f1f1f1',\n textWhite: '#FFFFFF',\n chipTextColor: '#F2F2F7',\n chipBgColor: 'rgba(60, 60, 67, 0.4)',\n\n chipPrimaryTextColor: 'rgba(255, 255, 255, 0.8)',\n chipPrimaryBgColor: 'rgba(0, 122, 255, 0.6)',\n\n breadcrumbLinkColor: '#A2A2A2',\n breadcrumbTextColor: '#292929',\n\n buttonPrimaryBgColor: '4353FF',\n buttonPrimaryBgHoverColor: '#3443E1',\n buttonPrimaryDisabledBgColor: 'rgba(0, 122, 255, 0.4)',\n\n listItemActiveBg: '#007AFF',\n listSelectedTextColor: '#3C3C43',\n listBoxShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)',\n listBorderColor: 'rgba(0, 0, 0, 0.04)',\n\n dividerColor: 'rgba(118, 120, 125, 0.12)',\n\n dropdownBg: 'rgba(246, 246, 248, 0.8)',\n dropdownTextColor: 'rgba(60, 60, 67, 0.6)',\n\n overlayColor: 'rgba(0, 0, 0, 0.4)',\n\n progressBg: '#E5E5E5',\n progressBar: '#017AFF',\n progressShadow: 'inset 0 0 0.0625rem #E3E3E3',\n\n switchShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',\n};\n\nexport default vars;\n","import React from 'react';\nimport { Box } from '@mui/system';\nimport { makeStyles } from '@mui/styles';\nimport vars from './assets/styles/variables';\nimport { Divider, List, ListItemButton, ListItemIcon } from '@mui/material';\nimport Move from './assets/svg/move.svg';\nimport Icon from './assets/svg/icon.svg';\nimport Node from './assets/svg/node.svg';\nimport Cursor from './assets/svg/cursor.svg';\nimport Fullscreen from './assets/svg/fullscreen.svg';\n\nconst { textWhite, dividerColor } = vars;\n\nconst useStyles = makeStyles(() => ({\n root: {\n zIndex: '5',\n width: '4rem',\n background: textWhite,\n boxShadow:\n '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)',\n borderRadius: '2rem',\n position: 'fixed',\n left: '1rem',\n top: '50%',\n transform: 'translateY(-50%)',\n\n '&.right': {\n left: 'auto',\n right: '1rem',\n },\n\n '& .MuiList-root': {\n padding: '0.75rem',\n },\n },\n\n node: {\n margin: '0.25rem 0',\n '& .MuiDivider-root': {\n borderColor: dividerColor,\n width: 'calc(100% - 1.5rem)',\n margin: '0 auto',\n border: 'none',\n borderTop: '0.0625rem solid',\n },\n\n '& img': {\n display: 'block',\n margin: '1rem 0',\n },\n },\n}));\n\nconst Sidebar = () => {\n const classes = useStyles();\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n );\n};\n\nexport default Sidebar;\n","export class Position {\n x: number;\n y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n add(otherPosition: Position) : Position {\n return new Position(this.x+ otherPosition.x, this.y + otherPosition.y)\n }\n\n sub(otherPosition: Position) : Position {\n return new Position(this.x - otherPosition.x, this.y - otherPosition.y)\n }\n}\n","import * as React from 'react';\nimport { MetaNode } from './models/MetaNode';\nimport { MetaLink } from './models/MetaLink';\nimport { ComponentsMap } from './models/ComponentsMap';\nimport createEngine, { DiagramModel } from '@projectstorm/react-diagrams';\nimport { MetaNodeFactory } from './react-diagrams/MetaNodeFactory';\nimport { MetaLinkFactory } from './react-diagrams/MetaLinkFactory';\nimport { CanvasWidget } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './react-diagrams/MetaNodeModel';\nimport { getLinkModel } from './helpers/linksHelper';\nimport { makeStyles } from '@mui/styles';\nimport Sidebar from './components/Sidebar';\nimport { ThemeProvider, createTheme } from '@mui/material/styles';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport theme from './theme';\nimport { Box } from '@mui/material';\nimport {processNodes} from \"./helpers/nodesHelper\";\n\nconst useStyles = makeStyles(_ => ({\n container: {\n height: '100%',\n width: '100%',\n },\n canvasContainer: {\n height: '100%',\n width: '100%',\n background: '#fffff',\n },\n}));\n\ninterface MetaDiagramProps {\n metaNodes: MetaNode[];\n metaLinks: MetaLink[];\n componentsMap: ComponentsMap;\n wrapperClassName?: string;\n canvasClassName?: string;\n metaTheme: {\n customThemeVariables: {};\n canvasClassName: string;\n };\n}\n\nconst MetaDiagram = ({\n metaNodes,\n metaLinks,\n componentsMap,\n wrapperClassName,\n metaTheme,\n}: MetaDiagramProps) => {\n const classes = useStyles();\n\n // set up the diagram engine\n const engine = createEngine();\n\n engine\n .getNodeFactories()\n // @ts-ignore\n .registerFactory(new MetaNodeFactory(componentsMap.nodes));\n\n engine\n .getLinkFactories()\n // @ts-ignore\n .registerFactory(new MetaLinkFactory(componentsMap.links));\n\n // set up the diagram model\n\n const model = new DiagramModel();\n const nodes = processNodes(metaNodes, () => console.log(\"repaint canvas\"))\n\n const links = metaLinks\n .map(ml => getLinkModel(ml, nodes))\n .filter(mlm => mlm !== undefined);\n // @ts-ignore\n model.addAll(...nodes, ...links);\n\n // load model into engine\n engine.setModel(model);\n\n const containerClassName = wrapperClassName\n ? wrapperClassName\n : classes.container;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default MetaDiagram;\nexport { MetaNode, MetaLink, MetaNodeModel, ComponentsMap };\nexport { MetaLinkModel } from './react-diagrams/MetaLinkModel';\nexport { Position } from './models/Position';\n","import React from 'react';\n\nexport class ComponentsMap {\n nodes: Map;\n links: Map;\n\n constructor(\n nodesMap: Map,\n linksMap: Map\n ) {\n this.nodes = nodesMap;\n this.links = linksMap;\n }\n}\n","import { ILink } from './ILink';\nimport {MetaLinkModel} from \"../react-diagrams/MetaLinkModel\";\n\nexport class MetaLink implements ILink {\n sourceId: string;\n sourcePortId: string;\n targetId: string;\n targetPortId: string;\n options: Map;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n sourceId: string,\n sourcePortId: string,\n targetId: string,\n targetPortId: string,\n options: Map\n ) {\n this.sourceId = sourceId;\n this.sourcePortId = sourcePortId;\n this.targetId = targetId;\n this.targetPortId = targetPortId;\n this.options = options;\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getSourceId(): string {\n return this.sourceId;\n }\n\n getSourcePortId(): string {\n return this.sourcePortId;\n }\n\n getTargetId(): string {\n return this.targetId;\n }\n\n getTargetPortId(): string {\n return this.targetPortId;\n }\n\n toModel(): MetaLinkModel {\n return new MetaLinkModel(Object.fromEntries(this.options))\n }\n}\n","import { Position } from './Position';\nimport {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport class MetaNode {\n private readonly parent: MetaNode | undefined;\n private readonly position: Position;\n private readonly options: Map;;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n position: Position,\n parent: MetaNode | undefined,\n options: Map\n ) {\n this.parent = parent\n this.position = position\n this.options = options\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getId() : string{\n return this.options.get('id')\n }\n\n getParentId() : string | undefined {\n return this.parent?.getId()\n }\n\n getWorldPosition() : Position {\n return this.parent ? this.position.add(this.parent?.getWorldPosition()) : this.position\n }\n\n toModel() : MetaNodeModel {\n const optionsMap = this.options\n optionsMap.set('parentId', this.getParentId())\n optionsMap.set('position', this.position)\n return new MetaNodeModel(Object.fromEntries(optionsMap))\n }\n\n}\n","import { MetaLink } from '../models/MetaLink';\nimport { MetaLinkModel } from '../react-diagrams/MetaLinkModel';\nimport { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport { getNode } from './nodesHelper';\n\nexport function getLinkModel(\n metaLink: MetaLink,\n nodes: MetaNodeModel[]\n): MetaLinkModel | undefined {\n const link = metaLink.toModel();\n const source = getNode(metaLink.getSourceId(), nodes);\n const target = getNode(metaLink.getTargetId(), nodes);\n if (source && target) {\n link.setSourcePort(source.getPort(metaLink.getSourcePortId()));\n link.setTargetPort(target.getPort(metaLink.getTargetPortId()));\n return link;\n }\n return undefined;\n}\n","import vars from './components/assets/styles/variables';\n\ntype ThemeVars = {\n [key: string]: any;\n};\n\nconst applicationTheme = (params: ThemeVars) => {\n const {\n primaryBg,\n fontFamily,\n chipTextColor,\n chipBgColor,\n textWhite,\n listItemActiveBg,\n listSelectedTextColor,\n listBoxShadow,\n listBorderColor,\n } = params;\n return {\n components: {\n MuiCssBaseline: {\n styleOverrides: `\n html {\n background: ${primaryBg};\n font-family: ${fontFamily};\n }\n body {\n background-color:${primaryBg};\n font-family: ${fontFamily};\n font-size: 1rem;\n }\n `,\n },\n MuiList: {\n styleOverrides: {\n root: {\n '&.customSwitch': {\n padding: '0.125rem',\n background: chipTextColor,\n borderRadius: '0.5rem',\n display: 'flex',\n '& .MuiListItemButton-root': {\n padding: '0.25rem 0.75rem',\n borderRadius: '0.4375rem',\n width: '10.59375rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n '&:not(:last-child)': {\n marginBottom: '0',\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n '&.Mui-selected': {\n background: textWhite,\n boxShadow: listBoxShadow,\n border: `0.03125rem solid ${listBorderColor}`,\n '& .MuiTypography-root': {\n color: listSelectedTextColor,\n },\n },\n },\n '& .MuiChip-root': {\n marginLeft: '0.25rem',\n },\n '& .MuiTypography-root': {\n fontWeight: 500,\n fontSize: '0.8125rem',\n lineHeight: '1.25rem',\n letterSpacing: '-0.005rem',\n color: chipBgColor,\n margin: 0,\n },\n },\n },\n },\n },\n MuiListItemIcon: {\n styleOverrides: {\n root: {\n minWidth: 'inherit',\n },\n },\n },\n MuiListItemButton: {\n styleOverrides: {\n root: {\n padding: 0,\n width: '2.5rem',\n height: '2.5rem',\n borderRadius: '50%',\n justifyContent: 'center',\n backgroundColor: chipTextColor,\n '&:hover': {\n backgroundColor: chipTextColor,\n },\n '&:not(:last-child)': {\n marginBottom: '0.75rem',\n },\n '&.Mui-selected': {\n backgroundColor: listItemActiveBg,\n '&:hover': {\n backgroundColor: listItemActiveBg,\n },\n },\n '&.Mui-disabled': {\n opacity: 0.8,\n },\n },\n },\n },\n },\n };\n};\n\nexport default (customVariables: ThemeVars) =>\n applicationTheme({\n ...vars,\n ...customVariables,\n });\n"],"names":["ReactDiagramMetaTypes","MetaNodeModel","NodeModel","constructor","options","super","type","META_NODE","this","addPort","DefaultPortModel","in","name","MetaLinkModel","DefaultLinkModel","META_LINK","UnknownTypeWidget","React","MetaNodeFactory","AbstractReactFactory","componentsMap","generateModel","generateReactWidget","event","has","model","shape","ReactComponentType","get","key","getOptions","id","engine","MetaLinkFactory","DefaultLinkFactory","generateLinkSegment","selected","path","_model$getOptions","getNode","nodes","find","n","vars","fontFamily","primaryBg","textWhite","chipTextColor","chipBgColor","chipPrimaryTextColor","chipPrimaryBgColor","breadcrumbLinkColor","breadcrumbTextColor","buttonPrimaryBgColor","buttonPrimaryBgHoverColor","buttonPrimaryDisabledBgColor","listItemActiveBg","listSelectedTextColor","listBoxShadow","listBorderColor","dividerColor","dropdownBg","dropdownTextColor","overlayColor","progressBg","progressBar","progressShadow","switchShadow","useStyles","makeStyles","root","zIndex","width","background","boxShadow","borderRadius","position","left","top","transform","&.right","right","& .MuiList-root","padding","node","margin","& .MuiDivider-root","borderColor","border","borderTop","& img","display","Sidebar","classes","Box","className","List","disablePadding","component","ListItemButton","ListItemIcon","src","Buffer","toString","alt","Divider","disabled","Position","x","y","add","otherPosition","sub","_","container","height","canvasContainer","nodesMap","linksMap","links","sourceId","sourcePortId","targetId","targetPortId","set","getSourceId","getSourcePortId","getTargetId","getTargetPortId","toModel","Object","fromEntries","parent","getId","getParentId","_this$parent","getWorldPosition","_this$parent2","optionsMap","metaNodes","metaLinks","wrapperClassName","metaTheme","createEngine","getNodeFactories","registerFactory","getLinkFactories","DiagramModel","callback","metaNodeModels","mn","metaNodeModel","setPosition","push","processNodes","map","ml","metaLink","link","source","target","setSourcePort","getPort","setTargetPort","getLinkModel","filter","mlm","undefined","addAll","setModel","containerClassName","ThemeProvider","theme","createTheme","customVariables","customThemeVariables","params","components","MuiCssBaseline","styleOverrides","MuiList","&.customSwitch","& .MuiListItemButton-root","alignItems","justifyContent","&:not(:last-child)","marginBottom","&.Mui-disabled","opacity","&.Mui-selected","& .MuiTypography-root","color","& .MuiChip-root","marginLeft","fontWeight","fontSize","lineHeight","letterSpacing","MuiListItemIcon","minWidth","MuiListItemButton","backgroundColor","&:hover","applicationTheme","CssBaseline","CanvasWidget","canvasClassName"],"mappings":"8IAAYA,oRAAZ,SAAYA,GACVA,6BACAA,6BAFF,CAAYA,IAAAA,aCGCC,UAAsBC,YACjCC,YAAYC,EAAU,IACpBC,MAAM,IACDD,EACHE,KAAMN,EAAsBO,YAK9BC,KAAKC,QACH,IAAIC,mBAAiB,CACnBC,IAAI,EACJC,KAAM,QAGVJ,KAAKC,QACH,IAAIC,mBAAiB,CACnBC,IAAI,EACJC,KAAM,gBClBDC,UAAsBC,mBACjCX,YAAYC,EAAU,IACpBC,MAAM,IACDD,EACHE,KAAMN,EAAsBe,mBCLrBC,EAAoB,IACxBC,iDCGIC,UAAwBC,uBAGnChB,YAAYiB,GACVf,MAAML,EAAsBO,WAC5BC,KAAKY,cAAgBA,EAGvBC,gBACE,OAAO,IAAIpB,EAGbqB,oBAAoBC,GAClB,GAAIf,KAAKY,cAAcI,IAAID,EAAME,MAAMrB,QAAQsB,OAAQ,CACrD,MAAMC,EAAqBnB,KAAKY,cAAcQ,IAC5CL,EAAME,MAAMrB,QAAQsB,OAEtB,OAEET,gBAACU,GACCE,oBAAqBN,EAAME,MAAMK,aAAaC,GAC9CC,OAAQxB,KAAKwB,OACbP,MAAOF,EAAME,QAKnB,OAAOR,gBAACD,eC3BCiB,UAAwBC,qBAGnC/B,YAAYiB,GACVf,MAAML,EAAsBe,WAC5BP,KAAKY,cAAgBA,EAGvBC,gBACE,OAAO,IAAIR,EAGbsB,oBACEV,EACAW,EACAC,SAGA,GAAI7B,KAAKY,cAAcI,aAAIC,EAAMK,qBAANQ,EAAoBZ,OAAQ,CACrD,MAAMC,EAAqBnB,KAAKY,cAAcQ,IAE5CH,EAAMK,aAAaJ,OAGrB,OAEET,gBAACU,GACCE,oBAAqBJ,EAAMK,aAAaC,GACxCC,OAAQxB,KAAKwB,OACbP,MAAOA,EACPY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CACJiI,SAAU,aAIhBC,kBAAmB,CACjBrB,eAAgB,CACd7G,KAAM,CACJa,QAAS,EACTX,MAAO,SACP2C,OAAQ,SACRxC,aAAc,MACd6G,eAAgB,SAChBiB,gBAAiB1J,EACjB2J,UAAW,CACTD,gBAAiB1J,GAEnB0I,qBAAsB,CACpBC,aAAc,WAEhBG,iBAAkB,CAChBY,gBAAiBjJ,EACjBkJ,UAAW,CACTD,gBAAiBjJ,IAGrBmI,iBAAkB,CAChBC,QAAS,UAUrBe,CAAiB,IACZhK,KACAmI,OLnCD7J,gBAAC2L,QACD3L,gBAAC6E,OAAIC,UAAW2E,GACdzJ,gBAAC2E,QACD3E,gBAAC4L,gBACC9G,aAAcF,EAAQuB,yBAAmB0B,SAAAA,EAAWgE,kBACpD9K,OAAQA,UK2BF8I"} \ No newline at end of file +{"version":3,"file":"meta-diagram.cjs.production.min.js","sources":["../src/constants.ts","../src/models/Position.ts","../src/helpers/nodesHelper.ts","../src/react-diagrams/MetaNodeModel.ts","../src/react-diagrams/MetaLinkModel.ts","../src/components/UnknownTypeWidget.tsx","../src/react-diagrams/MetaNodeFactory.tsx","../src/react-diagrams/MetaLinkFactory.tsx","../src/components/assets/styles/variables.ts","../src/components/Sidebar.tsx","../src/index.tsx","../src/models/ComponentsMap.ts","../src/models/MetaLink.ts","../src/models/MetaNode.ts","../src/helpers/engineHelper.ts","../src/helpers/linksHelper.ts","../src/theme.ts"],"sourcesContent":["export enum ReactDiagramMetaTypes {\n META_NODE = 'meta-node-type',\n META_LINK = 'meta-link-type',\n}\n","export class Position {\n x: number;\n y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n add(otherPosition: Position) : Position {\n return new Position(this.x+ otherPosition.x, this.y + otherPosition.y)\n }\n\n sub(otherPosition: Position) : Position {\n return new Position(this.x - otherPosition.x, this.y - otherPosition.y)\n }\n}\n","import { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport {MetaNode} from \"../models/MetaNode\";\nimport {BaseEntityEvent} from \"@projectstorm/react-canvas-core\";\nimport {NodeModel, NodeModelGenerics} from \"@projectstorm/react-diagrams\";\n\nexport function getNode(\n id: string,\n nodes: MetaNodeModel[]\n): MetaNodeModel | undefined {\n return nodes.find(n => n.getOptions().id === id);\n}\n\nexport function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] {\n const metaNodeModels = []\n for(const mn of metaNodes){\n const metaNodeModel = mn.toModel()\n const position = mn.getWorldPosition()\n metaNodeModel.setPosition(position.x, position.y)\n // @ts-ignore\n metaNodeModel.registerListener({positionChanged: (event => callback(event))})\n metaNodeModels.push(metaNodeModel)\n }\n return metaNodeModels\n}\n","import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport {Position} from \"../models/Position\";\nimport {getNode} from \"../helpers/nodesHelper\";\n\nexport class MetaNodeModel extends NodeModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_NODE,\n });\n\n // set up an in and out port\n\n this.addPort(\n new DefaultPortModel({\n in: true,\n name: 'in',\n })\n );\n this.addPort(\n new DefaultPortModel({\n in: false,\n name: 'out',\n })\n );\n }\n\n getLocalPosition(nodes: MetaNodeModel[]): Position {\n const worldPosition = new Position(this.getX(), this.getY())\n // @ts-ignore\n const parentId = this.options['parentId']\n const parent = getNode(parentId, nodes)\n return parent ? worldPosition.sub(parent.getLocalPosition(nodes)) : worldPosition\n }\n\n updateLocalPosition(nodes: MetaNodeModel[]) : void {\n // @ts-ignore\n this.options['position'] = this.getLocalPosition(nodes)\n }\n}\n","import { DefaultLinkModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaLinkModel extends DefaultLinkModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_LINK,\n });\n }\n}\n","import React from 'react';\n\nexport const UnknownTypeWidget = () => {\n return
Unknown Type
;\n};\n","import { AbstractReactFactory } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './MetaNodeModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport React from 'react';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeFactory extends AbstractReactFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_NODE);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaNodeModel();\n }\n\n generateReactWidget(event: any): JSX.Element {\n if (this.componentsMap.has(event.model.options.shape)) {\n const ReactComponentType = this.componentsMap.get(\n event.model.options.shape\n );\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default node instead\n return ;\n }\n}\n","import { MetaLinkModel } from './MetaLinkModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport React from 'react';\nimport { DefaultLinkFactory } from '@projectstorm/react-diagrams';\n\nexport class MetaLinkFactory extends DefaultLinkFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_LINK);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaLinkModel();\n }\n\n generateLinkSegment(\n model: MetaLinkModel,\n selected: boolean,\n path: string\n ): JSX.Element {\n // @ts-ignore\n if (this.componentsMap.has(model.getOptions()?.shape)) {\n const ReactComponentType = this.componentsMap.get(\n // @ts-ignore\n model.getOptions().shape\n );\n\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default link instead\n return ;\n }\n}\n","const vars = {\n fontFamily: 'Inter, sans-serif',\n primaryBg: '#f1f1f1',\n textWhite: '#FFFFFF',\n chipTextColor: '#F2F2F7',\n chipBgColor: 'rgba(60, 60, 67, 0.4)',\n\n chipPrimaryTextColor: 'rgba(255, 255, 255, 0.8)',\n chipPrimaryBgColor: 'rgba(0, 122, 255, 0.6)',\n\n breadcrumbLinkColor: '#A2A2A2',\n breadcrumbTextColor: '#292929',\n\n buttonPrimaryBgColor: '4353FF',\n buttonPrimaryBgHoverColor: '#3443E1',\n buttonPrimaryDisabledBgColor: 'rgba(0, 122, 255, 0.4)',\n\n listItemActiveBg: '#007AFF',\n listSelectedTextColor: '#3C3C43',\n listBoxShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)',\n listBorderColor: 'rgba(0, 0, 0, 0.04)',\n\n dividerColor: 'rgba(118, 120, 125, 0.12)',\n\n dropdownBg: 'rgba(246, 246, 248, 0.8)',\n dropdownTextColor: 'rgba(60, 60, 67, 0.6)',\n\n overlayColor: 'rgba(0, 0, 0, 0.4)',\n\n progressBg: '#E5E5E5',\n progressBar: '#017AFF',\n progressShadow: 'inset 0 0 0.0625rem #E3E3E3',\n\n switchShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',\n};\n\nexport default vars;\n","import React from 'react';\nimport { Box } from '@mui/system';\nimport { makeStyles } from '@mui/styles';\nimport vars from './assets/styles/variables';\nimport { Divider, List, ListItemButton, ListItemIcon } from '@mui/material';\nimport Move from './assets/svg/move.svg';\nimport Icon from './assets/svg/icon.svg';\nimport Node from './assets/svg/node.svg';\nimport Cursor from './assets/svg/cursor.svg';\nimport Fullscreen from './assets/svg/fullscreen.svg';\n\nconst { textWhite, dividerColor } = vars;\n\nconst useStyles = makeStyles(() => ({\n root: {\n zIndex: '5',\n width: '4rem',\n background: textWhite,\n boxShadow:\n '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)',\n borderRadius: '2rem',\n position: 'fixed',\n left: '1rem',\n top: '50%',\n transform: 'translateY(-50%)',\n\n '&.right': {\n left: 'auto',\n right: '1rem',\n },\n\n '& .MuiList-root': {\n padding: '0.75rem',\n },\n },\n\n node: {\n margin: '0.25rem 0',\n '& .MuiDivider-root': {\n borderColor: dividerColor,\n width: 'calc(100% - 1.5rem)',\n margin: '0 auto',\n border: 'none',\n borderTop: '0.0625rem solid',\n },\n\n '& img': {\n display: 'block',\n margin: '1rem 0',\n },\n },\n}));\n\nconst Sidebar = () => {\n const classes = useStyles();\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n );\n};\n\nexport default Sidebar;\n","import * as React from 'react';\nimport { MetaNode } from './models/MetaNode';\nimport { MetaLink } from './models/MetaLink';\nimport { ComponentsMap } from './models/ComponentsMap';\nimport createEngine, { DiagramModel } from '@projectstorm/react-diagrams';\nimport { MetaNodeFactory } from './react-diagrams/MetaNodeFactory';\nimport { MetaLinkFactory } from './react-diagrams/MetaLinkFactory';\nimport { CanvasWidget } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './react-diagrams/MetaNodeModel';\nimport { getLinkModel } from './helpers/linksHelper';\nimport { makeStyles } from '@mui/styles';\nimport Sidebar from './components/Sidebar';\nimport { ThemeProvider, createTheme } from '@mui/material/styles';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport theme from './theme';\nimport { Box } from '@mui/material';\nimport {processNodes} from \"./helpers/nodesHelper\";\nimport {updateChildrenPosition} from \"./helpers/engineHelper\";\n\nconst useStyles = makeStyles(_ => ({\n container: {\n height: '100%',\n width: '100%',\n },\n canvasContainer: {\n height: '100%',\n width: '100%',\n background: '#fffff',\n },\n}));\n\ninterface MetaDiagramProps {\n metaNodes: MetaNode[];\n metaLinks: MetaLink[];\n componentsMap: ComponentsMap;\n wrapperClassName?: string;\n canvasClassName?: string;\n metaTheme: {\n customThemeVariables: {};\n canvasClassName: string;\n };\n}\n\nconst MetaDiagram = ({\n metaNodes,\n metaLinks,\n componentsMap,\n wrapperClassName,\n metaTheme,\n}: MetaDiagramProps) => {\n const classes = useStyles();\n\n // set up the diagram engine\n const engine = createEngine();\n\n engine\n .getNodeFactories()\n // @ts-ignore\n .registerFactory(new MetaNodeFactory(componentsMap.nodes));\n\n engine\n .getLinkFactories()\n // @ts-ignore\n .registerFactory(new MetaLinkFactory(componentsMap.links));\n\n // @ts-ignore\n const repaintCanvas = (event: any) => {\n let model = engine.getModel();\n const node = event.entity\n const nodes = model.getNodes()\n // @ts-ignore\n updateChildrenPosition(nodes, node)\n // @ts-ignore\n // updateNodeLocalPosition(nodes, node)\n engine.repaintCanvas();\n }\n\n // set up the diagram model\n\n const model = new DiagramModel();\n const nodes = processNodes(metaNodes, repaintCanvas)\n\n const links = metaLinks\n .map(ml => getLinkModel(ml, nodes))\n .filter(mlm => mlm !== undefined);\n // @ts-ignore\n model.addAll(...nodes, ...links);\n\n // load model into engine\n engine.setModel(model);\n\n const containerClassName = wrapperClassName\n ? wrapperClassName\n : classes.container;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default MetaDiagram;\nexport { MetaNode, MetaLink, MetaNodeModel, ComponentsMap };\nexport { MetaLinkModel } from './react-diagrams/MetaLinkModel';\nexport { Position } from './models/Position';\n","import React from 'react';\n\nexport class ComponentsMap {\n nodes: Map;\n links: Map;\n\n constructor(\n nodesMap: Map,\n linksMap: Map\n ) {\n this.nodes = nodesMap;\n this.links = linksMap;\n }\n}\n","import { ILink } from './ILink';\nimport {MetaLinkModel} from \"../react-diagrams/MetaLinkModel\";\n\nexport class MetaLink implements ILink {\n sourceId: string;\n sourcePortId: string;\n targetId: string;\n targetPortId: string;\n options: Map;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n sourceId: string,\n sourcePortId: string,\n targetId: string,\n targetPortId: string,\n options: Map\n ) {\n this.sourceId = sourceId;\n this.sourcePortId = sourcePortId;\n this.targetId = targetId;\n this.targetPortId = targetPortId;\n this.options = options;\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getSourceId(): string {\n return this.sourceId;\n }\n\n getSourcePortId(): string {\n return this.sourcePortId;\n }\n\n getTargetId(): string {\n return this.targetId;\n }\n\n getTargetPortId(): string {\n return this.targetPortId;\n }\n\n toModel(): MetaLinkModel {\n return new MetaLinkModel(Object.fromEntries(this.options))\n }\n}\n","import { Position } from './Position';\nimport {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport class MetaNode {\n private readonly parent: MetaNode | undefined;\n private readonly position: Position;\n private readonly options: Map;;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n position: Position,\n parent: MetaNode | undefined,\n options: Map\n ) {\n this.parent = parent\n this.position = position\n this.options = options\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getId() : string{\n return this.options.get('id')\n }\n\n getParentId() : string | undefined {\n return this.parent?.getId()\n }\n\n getWorldPosition() : Position {\n return this.parent ? this.position.add(this.parent?.getWorldPosition()) : this.position\n }\n\n toModel() : MetaNodeModel {\n const optionsMap = this.options\n optionsMap.set('parentId', this.getParentId())\n optionsMap.set('position', this.position)\n return new MetaNodeModel(Object.fromEntries(optionsMap))\n }\n\n}\n","import {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport function updateChildrenPosition(nodes: MetaNodeModel[], parent: MetaNodeModel): void {\n // @ts-ignore\n const children = nodes.filter(n => n.options['parentId'] == parent.options['id']);\n children.forEach(n => {\n // @ts-ignore\n n.setPosition(parent.getX() + n.options['position'].x, parent.getY() + n.options['position'].y)\n // TODO: Fix nested position update\n // updateChildrenPosition(nodes, n)\n })\n}\n\nexport function updateNodeLocalPosition(nodes: MetaNodeModel[], node: MetaNodeModel): void {\n node.updateLocalPosition(nodes)\n}","import { MetaLink } from '../models/MetaLink';\nimport { MetaLinkModel } from '../react-diagrams/MetaLinkModel';\nimport { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport { getNode } from './nodesHelper';\n\nexport function getLinkModel(\n metaLink: MetaLink,\n nodes: MetaNodeModel[]\n): MetaLinkModel | undefined {\n const link = metaLink.toModel();\n const source = getNode(metaLink.getSourceId(), nodes);\n const target = getNode(metaLink.getTargetId(), nodes);\n if (source && target) {\n link.setSourcePort(source.getPort(metaLink.getSourcePortId()));\n link.setTargetPort(target.getPort(metaLink.getTargetPortId()));\n return link;\n }\n return undefined;\n}\n","import vars from './components/assets/styles/variables';\n\ntype ThemeVars = {\n [key: string]: any;\n};\n\nconst applicationTheme = (params: ThemeVars) => {\n const {\n primaryBg,\n fontFamily,\n chipTextColor,\n chipBgColor,\n textWhite,\n listItemActiveBg,\n listSelectedTextColor,\n listBoxShadow,\n listBorderColor,\n } = params;\n return {\n components: {\n MuiCssBaseline: {\n styleOverrides: `\n html {\n background: ${primaryBg};\n font-family: ${fontFamily};\n }\n body {\n background-color:${primaryBg};\n font-family: ${fontFamily};\n font-size: 1rem;\n }\n `,\n },\n MuiList: {\n styleOverrides: {\n root: {\n '&.customSwitch': {\n padding: '0.125rem',\n background: chipTextColor,\n borderRadius: '0.5rem',\n display: 'flex',\n '& .MuiListItemButton-root': {\n padding: '0.25rem 0.75rem',\n borderRadius: '0.4375rem',\n width: '10.59375rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n '&:not(:last-child)': {\n marginBottom: '0',\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n '&.Mui-selected': {\n background: textWhite,\n boxShadow: listBoxShadow,\n border: `0.03125rem solid ${listBorderColor}`,\n '& .MuiTypography-root': {\n color: listSelectedTextColor,\n },\n },\n },\n '& .MuiChip-root': {\n marginLeft: '0.25rem',\n },\n '& .MuiTypography-root': {\n fontWeight: 500,\n fontSize: '0.8125rem',\n lineHeight: '1.25rem',\n letterSpacing: '-0.005rem',\n color: chipBgColor,\n margin: 0,\n },\n },\n },\n },\n },\n MuiListItemIcon: {\n styleOverrides: {\n root: {\n minWidth: 'inherit',\n },\n },\n },\n MuiListItemButton: {\n styleOverrides: {\n root: {\n padding: 0,\n width: '2.5rem',\n height: '2.5rem',\n borderRadius: '50%',\n justifyContent: 'center',\n backgroundColor: chipTextColor,\n '&:hover': {\n backgroundColor: chipTextColor,\n },\n '&:not(:last-child)': {\n marginBottom: '0.75rem',\n },\n '&.Mui-selected': {\n backgroundColor: listItemActiveBg,\n '&:hover': {\n backgroundColor: listItemActiveBg,\n },\n },\n '&.Mui-disabled': {\n opacity: 0.8,\n },\n },\n },\n },\n },\n };\n};\n\nexport default (customVariables: ThemeVars) =>\n applicationTheme({\n ...vars,\n ...customVariables,\n });\n"],"names":["ReactDiagramMetaTypes","Position","constructor","x","y","this","add","otherPosition","sub","getNode","id","nodes","find","n","getOptions","MetaNodeModel","NodeModel","options","super","type","META_NODE","addPort","DefaultPortModel","in","name","getLocalPosition","worldPosition","getX","getY","parent","updateLocalPosition","MetaLinkModel","DefaultLinkModel","META_LINK","UnknownTypeWidget","React","MetaNodeFactory","AbstractReactFactory","componentsMap","generateModel","generateReactWidget","event","has","model","shape","ReactComponentType","get","key","engine","MetaLinkFactory","DefaultLinkFactory","generateLinkSegment","selected","path","_model$getOptions","vars","fontFamily","primaryBg","textWhite","chipTextColor","chipBgColor","chipPrimaryTextColor","chipPrimaryBgColor","breadcrumbLinkColor","breadcrumbTextColor","buttonPrimaryBgColor","buttonPrimaryBgHoverColor","buttonPrimaryDisabledBgColor","listItemActiveBg","listSelectedTextColor","listBoxShadow","listBorderColor","dividerColor","dropdownBg","dropdownTextColor","overlayColor","progressBg","progressBar","progressShadow","switchShadow","useStyles","makeStyles","root","zIndex","width","background","boxShadow","borderRadius","position","left","top","transform","&.right","right","& .MuiList-root","padding","node","margin","& .MuiDivider-root","borderColor","border","borderTop","& img","display","Sidebar","classes","Box","className","List","disablePadding","component","ListItemButton","ListItemIcon","src","Buffer","toString","alt","Divider","disabled","_","container","height","canvasContainer","nodesMap","linksMap","links","sourceId","sourcePortId","targetId","targetPortId","set","getSourceId","getSourcePortId","getTargetId","getTargetPortId","toModel","Object","fromEntries","getId","getParentId","_this$parent","getWorldPosition","_this$parent2","optionsMap","metaNodes","metaLinks","wrapperClassName","metaTheme","createEngine","getNodeFactories","registerFactory","getLinkFactories","DiagramModel","callback","metaNodeModels","mn","metaNodeModel","setPosition","registerListener","positionChanged","push","processNodes","getModel","entity","filter","forEach","updateChildrenPosition","getNodes","repaintCanvas","map","ml","metaLink","link","source","target","setSourcePort","getPort","setTargetPort","getLinkModel","mlm","undefined","addAll","setModel","containerClassName","ThemeProvider","theme","createTheme","customVariables","customThemeVariables","params","components","MuiCssBaseline","styleOverrides","MuiList","&.customSwitch","& .MuiListItemButton-root","alignItems","justifyContent","&:not(:last-child)","marginBottom","&.Mui-disabled","opacity","&.Mui-selected","& .MuiTypography-root","color","& .MuiChip-root","marginLeft","fontWeight","fontSize","lineHeight","letterSpacing","MuiListItemIcon","minWidth","MuiListItemButton","backgroundColor","&:hover","applicationTheme","CssBaseline","CanvasWidget","canvasClassName"],"mappings":"8IAAYA,oRAAZ,SAAYA,GACVA,6BACAA,6BAFF,CAAYA,IAAAA,aCACC,EAIXC,YAAYC,EAAWC,GACrBC,KAAKF,EAAIA,EACTE,KAAKD,EAAIA,EAGXE,IAAIC,GACF,OAAO,IAAIN,EAASI,KAAKF,EAAGI,EAAcJ,EAAGE,KAAKD,EAAIG,EAAcH,GAGtEI,IAAID,GACF,OAAO,IAAIN,EAASI,KAAKF,EAAII,EAAcJ,EAAGE,KAAKD,EAAIG,EAAcH,aCTzDK,EACdC,EACAC,GAEA,OAAOA,EAAMC,KAAKC,GAAKA,EAAEC,aAAaJ,KAAOA,SCJlCK,UAAsBC,YACjCd,YAAYe,EAAU,IACpBC,MAAM,IACDD,EACHE,KAAMnB,EAAsBoB,YAK9Bf,KAAKgB,QACH,IAAIC,mBAAiB,CACnBC,IAAI,EACJC,KAAM,QAGVnB,KAAKgB,QACH,IAAIC,mBAAiB,CACnBC,IAAI,EACJC,KAAM,SAKVC,iBAAiBd,GACb,MAAMe,EAAgB,IAAIzB,EAASI,KAAKsB,OAAQtB,KAAKuB,QAG/CC,EAASpB,EADEJ,KAAKY,QAAL,SACgBN,GACjC,OAAOkB,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BAAsB,CACpBC,aAAc,WAEhBG,iBAAkB,CAChBY,gBAAiBlJ,EACjBmJ,UAAW,CACTD,gBAAiBlJ,IAGrBoI,iBAAkB,CAChBC,QAAS,UAUrBe,CAAiB,IACZjK,KACAoI,ONtBDxJ,gBAACsL,QACDtL,gBAACuE,OAAIC,UAAW4E,GACdpJ,gBAACqE,QACDrE,gBAACuL,gBACC/G,aAAcF,EAAQiB,yBAAmByB,SAAAA,EAAWwE,kBACpD3K,OAAQA,UMcF2I"} \ No newline at end of file diff --git a/dist/meta-diagram.esm.js b/dist/meta-diagram.esm.js index d68eb1d..ff179e0 100644 --- a/dist/meta-diagram.esm.js +++ b/dist/meta-diagram.esm.js @@ -14,6 +14,42 @@ var ReactDiagramMetaTypes; ReactDiagramMetaTypes["META_LINK"] = "meta-link-type"; })(ReactDiagramMetaTypes || (ReactDiagramMetaTypes = {})); +class Position { + constructor(x, y) { + this.x = x; + this.y = y; + } + + add(otherPosition) { + return new Position(this.x + otherPosition.x, this.y + otherPosition.y); + } + + sub(otherPosition) { + return new Position(this.x - otherPosition.x, this.y - otherPosition.y); + } + +} + +function getNode(id, nodes) { + return nodes.find(n => n.getOptions().id === id); +} +function processNodes(metaNodes, callback) { + const metaNodeModels = []; + + for (const mn of metaNodes) { + const metaNodeModel = mn.toModel(); + const position = mn.getWorldPosition(); + metaNodeModel.setPosition(position.x, position.y); // @ts-ignore + + metaNodeModel.registerListener({ + positionChanged: event => callback(event) + }); + metaNodeModels.push(metaNodeModel); + } + + return metaNodeModels; +} + class MetaNodeModel extends NodeModel { constructor(options = {}) { super({ ...options, @@ -30,6 +66,19 @@ class MetaNodeModel extends NodeModel { })); } + getLocalPosition(nodes) { + const worldPosition = new Position(this.getX(), this.getY()); // @ts-ignore + + const parentId = this.options['parentId']; + const parent = getNode(parentId, nodes); + return parent ? worldPosition.sub(parent.getLocalPosition(nodes)) : worldPosition; + } + + updateLocalPosition(nodes) { + // @ts-ignore + this.options['position'] = this.getLocalPosition(nodes); + } + } class MetaNode { @@ -184,25 +233,6 @@ class MetaLinkFactory extends DefaultLinkFactory { } -function getNode(id, nodes) { - return nodes.find(n => n.getOptions().id === id); -} // @ts-ignore - -function processNodes(metaNodes, callback) { - const metaNodeModels = []; - - for (const mn of metaNodes) { - const metaNodeModel = mn.toModel(); - const position = mn.getWorldPosition(); - metaNodeModel.setPosition(position.x, position.y); // @ts-ignore - //metaNodeModel.registerListener({positionChanged: (event => callback(event))}) - - metaNodeModels.push(metaNodeModel); - } - - return metaNodeModels; -} - function getLinkModel(metaLink, nodes) { const link = metaLink.toModel(); const source = getNode(metaLink.getSourceId(), nodes); @@ -441,20 +471,14 @@ var theme = (customVariables => applicationTheme({ ...vars, ...customVariables })); -class Position { - constructor(x, y) { - this.x = x; - this.y = y; - } - - add(otherPosition) { - return new Position(this.x + otherPosition.x, this.y + otherPosition.y); - } - - sub(otherPosition) { - return new Position(this.x - otherPosition.x, this.y - otherPosition.y); - } - +function updateChildrenPosition(nodes, parent) { + // @ts-ignore + const children = nodes.filter(n => n.options['parentId'] == parent.options['id']); + children.forEach(n => { + // @ts-ignore + n.setPosition(parent.getX() + n.options['position'].x, parent.getY() + n.options['position'].y); // TODO: Fix nested position update + // updateChildrenPosition(nodes, n) + }); } const useStyles$1 = /*#__PURE__*/makeStyles(_ => ({ @@ -482,10 +506,22 @@ const MetaDiagram = ({ engine.getNodeFactories() // @ts-ignore .registerFactory(new MetaNodeFactory(componentsMap.nodes)); engine.getLinkFactories() // @ts-ignore - .registerFactory(new MetaLinkFactory(componentsMap.links)); // set up the diagram model + .registerFactory(new MetaLinkFactory(componentsMap.links)); // @ts-ignore + + const repaintCanvas = event => { + let model = engine.getModel(); + const node = event.entity; + const nodes = model.getNodes(); // @ts-ignore + + updateChildrenPosition(nodes, node); // @ts-ignore + // updateNodeLocalPosition(nodes, node) + + engine.repaintCanvas(); + }; // set up the diagram model + const model = new DiagramModel(); - const nodes = processNodes(metaNodes); + const nodes = processNodes(metaNodes, repaintCanvas); const links = metaLinks.map(ml => getLinkModel(ml, nodes)).filter(mlm => mlm !== undefined); // @ts-ignore model.addAll(...nodes, ...links); // load model into engine diff --git a/dist/meta-diagram.esm.js.map b/dist/meta-diagram.esm.js.map index 0a237d9..4c1cfe7 100644 --- a/dist/meta-diagram.esm.js.map +++ b/dist/meta-diagram.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"meta-diagram.esm.js","sources":["../src/constants.ts","../src/react-diagrams/MetaNodeModel.ts","../src/models/MetaNode.ts","../src/react-diagrams/MetaLinkModel.ts","../src/models/MetaLink.ts","../src/models/ComponentsMap.ts","../src/components/UnknownTypeWidget.tsx","../src/react-diagrams/MetaNodeFactory.tsx","../src/react-diagrams/MetaLinkFactory.tsx","../src/helpers/nodesHelper.ts","../src/helpers/linksHelper.ts","../src/components/assets/styles/variables.ts","../src/components/Sidebar.tsx","../src/theme.ts","../src/models/Position.ts","../src/index.tsx"],"sourcesContent":["export enum ReactDiagramMetaTypes {\n META_NODE = 'meta-node-type',\n META_LINK = 'meta-link-type',\n}\n","import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeModel extends NodeModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_NODE,\n });\n\n // set up an in and out port\n\n this.addPort(\n new DefaultPortModel({\n in: true,\n name: 'in',\n })\n );\n this.addPort(\n new DefaultPortModel({\n in: false,\n name: 'out',\n })\n );\n }\n}\n","import { Position } from './Position';\nimport {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport class MetaNode {\n private readonly parent: MetaNode | undefined;\n private readonly position: Position;\n private readonly options: Map;;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n position: Position,\n parent: MetaNode | undefined,\n options: Map\n ) {\n this.parent = parent\n this.position = position\n this.options = options\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getId() : string{\n return this.options.get('id')\n }\n\n getParentId() : string | undefined {\n return this.parent?.getId()\n }\n\n getWorldPosition() : Position {\n return this.parent ? this.position.add(this.parent?.getWorldPosition()) : this.position\n }\n\n toModel() : MetaNodeModel {\n const optionsMap = this.options\n optionsMap.set('parentId', this.getParentId())\n optionsMap.set('position', this.position)\n return new MetaNodeModel(Object.fromEntries(optionsMap))\n }\n\n}\n","import { DefaultLinkModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaLinkModel extends DefaultLinkModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_LINK,\n });\n }\n}\n","import { ILink } from './ILink';\nimport {MetaLinkModel} from \"../react-diagrams/MetaLinkModel\";\n\nexport class MetaLink implements ILink {\n sourceId: string;\n sourcePortId: string;\n targetId: string;\n targetPortId: string;\n options: Map;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n sourceId: string,\n sourcePortId: string,\n targetId: string,\n targetPortId: string,\n options: Map\n ) {\n this.sourceId = sourceId;\n this.sourcePortId = sourcePortId;\n this.targetId = targetId;\n this.targetPortId = targetPortId;\n this.options = options;\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getSourceId(): string {\n return this.sourceId;\n }\n\n getSourcePortId(): string {\n return this.sourcePortId;\n }\n\n getTargetId(): string {\n return this.targetId;\n }\n\n getTargetPortId(): string {\n return this.targetPortId;\n }\n\n toModel(): MetaLinkModel {\n return new MetaLinkModel(Object.fromEntries(this.options))\n }\n}\n","import React from 'react';\n\nexport class ComponentsMap {\n nodes: Map;\n links: Map;\n\n constructor(\n nodesMap: Map,\n linksMap: Map\n ) {\n this.nodes = nodesMap;\n this.links = linksMap;\n }\n}\n","import React from 'react';\n\nexport const UnknownTypeWidget = () => {\n return
Unknown Type
;\n};\n","import { AbstractReactFactory } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './MetaNodeModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport React from 'react';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeFactory extends AbstractReactFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_NODE);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaNodeModel();\n }\n\n generateReactWidget(event: any): JSX.Element {\n if (this.componentsMap.has(event.model.options.shape)) {\n const ReactComponentType = this.componentsMap.get(\n event.model.options.shape\n );\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default node instead\n return ;\n }\n}\n","import { MetaLinkModel } from './MetaLinkModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport React from 'react';\nimport { DefaultLinkFactory } from '@projectstorm/react-diagrams';\n\nexport class MetaLinkFactory extends DefaultLinkFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_LINK);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaLinkModel();\n }\n\n generateLinkSegment(\n model: MetaLinkModel,\n selected: boolean,\n path: string\n ): JSX.Element {\n // @ts-ignore\n if (this.componentsMap.has(model.getOptions()?.shape)) {\n const ReactComponentType = this.componentsMap.get(\n // @ts-ignore\n model.getOptions().shape\n );\n\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default link instead\n return ;\n }\n}\n","import { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport {MetaNode} from \"../models/MetaNode\";\nimport {BaseEntityEvent} from \"@projectstorm/react-canvas-core\";\nimport {NodeModel, NodeModelGenerics} from \"@projectstorm/react-diagrams\";\n\nexport function getNode(\n id: string,\n nodes: MetaNodeModel[]\n): MetaNodeModel | undefined {\n return nodes.find(n => n.getOptions().id === id);\n}\n\n// @ts-ignore\nexport function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] {\n const metaNodeModels = []\n for(const mn of metaNodes){\n const metaNodeModel = mn.toModel()\n const position = mn.getWorldPosition()\n metaNodeModel.setPosition(position.x, position.y)\n // @ts-ignore\n //metaNodeModel.registerListener({positionChanged: (event => callback(event))})\n metaNodeModels.push(metaNodeModel)\n }\n return metaNodeModels\n}\n","import { MetaLink } from '../models/MetaLink';\nimport { MetaLinkModel } from '../react-diagrams/MetaLinkModel';\nimport { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport { getNode } from './nodesHelper';\n\nexport function getLinkModel(\n metaLink: MetaLink,\n nodes: MetaNodeModel[]\n): MetaLinkModel | undefined {\n const link = metaLink.toModel();\n const source = getNode(metaLink.getSourceId(), nodes);\n const target = getNode(metaLink.getTargetId(), nodes);\n if (source && target) {\n link.setSourcePort(source.getPort(metaLink.getSourcePortId()));\n link.setTargetPort(target.getPort(metaLink.getTargetPortId()));\n return link;\n }\n return undefined;\n}\n","const vars = {\n fontFamily: 'Inter, sans-serif',\n primaryBg: '#f1f1f1',\n textWhite: '#FFFFFF',\n chipTextColor: '#F2F2F7',\n chipBgColor: 'rgba(60, 60, 67, 0.4)',\n\n chipPrimaryTextColor: 'rgba(255, 255, 255, 0.8)',\n chipPrimaryBgColor: 'rgba(0, 122, 255, 0.6)',\n\n breadcrumbLinkColor: '#A2A2A2',\n breadcrumbTextColor: '#292929',\n\n buttonPrimaryBgColor: '4353FF',\n buttonPrimaryBgHoverColor: '#3443E1',\n buttonPrimaryDisabledBgColor: 'rgba(0, 122, 255, 0.4)',\n\n listItemActiveBg: '#007AFF',\n listSelectedTextColor: '#3C3C43',\n listBoxShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)',\n listBorderColor: 'rgba(0, 0, 0, 0.04)',\n\n dividerColor: 'rgba(118, 120, 125, 0.12)',\n\n dropdownBg: 'rgba(246, 246, 248, 0.8)',\n dropdownTextColor: 'rgba(60, 60, 67, 0.6)',\n\n overlayColor: 'rgba(0, 0, 0, 0.4)',\n\n progressBg: '#E5E5E5',\n progressBar: '#017AFF',\n progressShadow: 'inset 0 0 0.0625rem #E3E3E3',\n\n switchShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',\n};\n\nexport default vars;\n","import React from 'react';\nimport { Box } from '@mui/system';\nimport { makeStyles } from '@mui/styles';\nimport vars from './assets/styles/variables';\nimport { Divider, List, ListItemButton, ListItemIcon } from '@mui/material';\nimport Move from './assets/svg/move.svg';\nimport Icon from './assets/svg/icon.svg';\nimport Node from './assets/svg/node.svg';\nimport Cursor from './assets/svg/cursor.svg';\nimport Fullscreen from './assets/svg/fullscreen.svg';\n\nconst { textWhite, dividerColor } = vars;\n\nconst useStyles = makeStyles(() => ({\n root: {\n zIndex: '5',\n width: '4rem',\n background: textWhite,\n boxShadow:\n '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)',\n borderRadius: '2rem',\n position: 'fixed',\n left: '1rem',\n top: '50%',\n transform: 'translateY(-50%)',\n\n '&.right': {\n left: 'auto',\n right: '1rem',\n },\n\n '& .MuiList-root': {\n padding: '0.75rem',\n },\n },\n\n node: {\n margin: '0.25rem 0',\n '& .MuiDivider-root': {\n borderColor: dividerColor,\n width: 'calc(100% - 1.5rem)',\n margin: '0 auto',\n border: 'none',\n borderTop: '0.0625rem solid',\n },\n\n '& img': {\n display: 'block',\n margin: '1rem 0',\n },\n },\n}));\n\nconst Sidebar = () => {\n const classes = useStyles();\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n );\n};\n\nexport default Sidebar;\n","import vars from './components/assets/styles/variables';\n\ntype ThemeVars = {\n [key: string]: any;\n};\n\nconst applicationTheme = (params: ThemeVars) => {\n const {\n primaryBg,\n fontFamily,\n chipTextColor,\n chipBgColor,\n textWhite,\n listItemActiveBg,\n listSelectedTextColor,\n listBoxShadow,\n listBorderColor,\n } = params;\n return {\n components: {\n MuiCssBaseline: {\n styleOverrides: `\n html {\n background: ${primaryBg};\n font-family: ${fontFamily};\n }\n body {\n background-color:${primaryBg};\n font-family: ${fontFamily};\n font-size: 1rem;\n }\n `,\n },\n MuiList: {\n styleOverrides: {\n root: {\n '&.customSwitch': {\n padding: '0.125rem',\n background: chipTextColor,\n borderRadius: '0.5rem',\n display: 'flex',\n '& .MuiListItemButton-root': {\n padding: '0.25rem 0.75rem',\n borderRadius: '0.4375rem',\n width: '10.59375rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n '&:not(:last-child)': {\n marginBottom: '0',\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n '&.Mui-selected': {\n background: textWhite,\n boxShadow: listBoxShadow,\n border: `0.03125rem solid ${listBorderColor}`,\n '& .MuiTypography-root': {\n color: listSelectedTextColor,\n },\n },\n },\n '& .MuiChip-root': {\n marginLeft: '0.25rem',\n },\n '& .MuiTypography-root': {\n fontWeight: 500,\n fontSize: '0.8125rem',\n lineHeight: '1.25rem',\n letterSpacing: '-0.005rem',\n color: chipBgColor,\n margin: 0,\n },\n },\n },\n },\n },\n MuiListItemIcon: {\n styleOverrides: {\n root: {\n minWidth: 'inherit',\n },\n },\n },\n MuiListItemButton: {\n styleOverrides: {\n root: {\n padding: 0,\n width: '2.5rem',\n height: '2.5rem',\n borderRadius: '50%',\n justifyContent: 'center',\n backgroundColor: chipTextColor,\n '&:hover': {\n backgroundColor: chipTextColor,\n },\n '&:not(:last-child)': {\n marginBottom: '0.75rem',\n },\n '&.Mui-selected': {\n backgroundColor: listItemActiveBg,\n '&:hover': {\n backgroundColor: listItemActiveBg,\n },\n },\n '&.Mui-disabled': {\n opacity: 0.8,\n },\n },\n },\n },\n },\n };\n};\n\nexport default (customVariables: ThemeVars) =>\n applicationTheme({\n ...vars,\n ...customVariables,\n });\n","export class Position {\n x: number;\n y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n add(otherPosition: Position) : Position {\n return new Position(this.x+ otherPosition.x, this.y + otherPosition.y)\n }\n\n sub(otherPosition: Position) : Position {\n return new Position(this.x - otherPosition.x, this.y - otherPosition.y)\n }\n}\n","import * as React from 'react';\nimport { MetaNode } from './models/MetaNode';\nimport { MetaLink } from './models/MetaLink';\nimport { ComponentsMap } from './models/ComponentsMap';\nimport createEngine, { DiagramModel } from '@projectstorm/react-diagrams';\nimport { MetaNodeFactory } from './react-diagrams/MetaNodeFactory';\nimport { MetaLinkFactory } from './react-diagrams/MetaLinkFactory';\nimport { CanvasWidget } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './react-diagrams/MetaNodeModel';\nimport { getLinkModel } from './helpers/linksHelper';\nimport { makeStyles } from '@mui/styles';\nimport Sidebar from './components/Sidebar';\nimport { ThemeProvider, createTheme } from '@mui/material/styles';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport theme from './theme';\nimport { Box } from '@mui/material';\nimport {processNodes} from \"./helpers/nodesHelper\";\n\nconst useStyles = makeStyles(_ => ({\n container: {\n height: '100%',\n width: '100%',\n },\n canvasContainer: {\n height: '100%',\n width: '100%',\n background: '#fffff',\n },\n}));\n\ninterface MetaDiagramProps {\n metaNodes: MetaNode[];\n metaLinks: MetaLink[];\n componentsMap: ComponentsMap;\n wrapperClassName?: string;\n canvasClassName?: string;\n metaTheme: {\n customThemeVariables: {};\n canvasClassName: string;\n };\n}\n\nconst MetaDiagram = ({\n metaNodes,\n metaLinks,\n componentsMap,\n wrapperClassName,\n metaTheme,\n}: MetaDiagramProps) => {\n const classes = useStyles();\n\n // set up the diagram engine\n const engine = createEngine();\n\n engine\n .getNodeFactories()\n // @ts-ignore\n .registerFactory(new MetaNodeFactory(componentsMap.nodes));\n\n engine\n .getLinkFactories()\n // @ts-ignore\n .registerFactory(new MetaLinkFactory(componentsMap.links));\n\n // set up the diagram model\n\n const model = new DiagramModel();\n const nodes = processNodes(metaNodes, () => console.log(\"repaint canvas\"))\n\n const links = metaLinks\n .map(ml => getLinkModel(ml, nodes))\n .filter(mlm => mlm !== undefined);\n // @ts-ignore\n model.addAll(...nodes, ...links);\n\n // load model into engine\n engine.setModel(model);\n\n const containerClassName = wrapperClassName\n ? wrapperClassName\n : classes.container;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default MetaDiagram;\nexport { MetaNode, MetaLink, MetaNodeModel, ComponentsMap };\nexport { MetaLinkModel } from './react-diagrams/MetaLinkModel';\nexport { Position } from './models/Position';\n"],"names":["ReactDiagramMetaTypes","MetaNodeModel","NodeModel","constructor","options","type","META_NODE","addPort","DefaultPortModel","in","name","MetaNode","id","shape","position","parent","set","getId","get","getParentId","getWorldPosition","add","toModel","optionsMap","Object","fromEntries","MetaLinkModel","DefaultLinkModel","META_LINK","MetaLink","sourceId","sourcePortId","targetId","targetPortId","getSourceId","getSourcePortId","getTargetId","getTargetPortId","ComponentsMap","nodesMap","linksMap","nodes","links","UnknownTypeWidget","React","MetaNodeFactory","AbstractReactFactory","componentsMap","generateModel","generateReactWidget","event","has","model","ReactComponentType","key","getOptions","engine","MetaLinkFactory","DefaultLinkFactory","generateLinkSegment","selected","path","getNode","find","n","processNodes","metaNodes","callback","metaNodeModels","mn","metaNodeModel","setPosition","x","y","push","getLinkModel","metaLink","link","source","target","setSourcePort","getPort","setTargetPort","undefined","vars","fontFamily","primaryBg","textWhite","chipTextColor","chipBgColor","chipPrimaryTextColor","chipPrimaryBgColor","breadcrumbLinkColor","breadcrumbTextColor","buttonPrimaryBgColor","buttonPrimaryBgHoverColor","buttonPrimaryDisabledBgColor","listItemActiveBg","listSelectedTextColor","listBoxShadow","listBorderColor","dividerColor","dropdownBg","dropdownTextColor","overlayColor","progressBg","progressBar","progressShadow","switchShadow","useStyles","makeStyles","root","zIndex","width","background","boxShadow","borderRadius","left","top","transform","right","padding","node","margin","borderColor","border","borderTop","display","Sidebar","classes","Box","className","List","disablePadding","component","ListItemButton","ListItemIcon","src","Buffer","Cursor","toString","alt","Move","Divider","Node","disabled","Icon","Fullscreen","applicationTheme","params","components","MuiCssBaseline","styleOverrides","MuiList","alignItems","justifyContent","marginBottom","opacity","color","marginLeft","fontWeight","fontSize","lineHeight","letterSpacing","MuiListItemIcon","minWidth","MuiListItemButton","height","backgroundColor","customVariables","Position","otherPosition","sub","_","container","canvasContainer","MetaDiagram","metaLinks","wrapperClassName","metaTheme","createEngine","getNodeFactories","registerFactory","getLinkFactories","DiagramModel","map","ml","filter","mlm","addAll","setModel","containerClassName","ThemeProvider","theme","createTheme","customThemeVariables","CssBaseline","CanvasWidget","canvasClassName"],"mappings":";;;;;;;;;AAAA,IAAYA,qBAAZ;;AAAA,WAAYA;EACVA,kCAAA,mBAAA;EACAA,kCAAA,mBAAA;AACD,CAHD,EAAYA,qBAAqB,KAArBA,qBAAqB,KAAA,CAAjC;;MCGaC,sBAAsBC;EACjCC,YAAYC,OAAO,GAAG;IACpB,MAAM,EACJ,GAAGA,OADC;MAEJC,IAAI,EAAEL,qBAAqB,CAACM;KAF9B;;IAOA,KAAKC,OAAL,CACE,IAAIC,gBAAJ,CAAqB;MACnBC,EAAE,EAAE,IADe;MAEnBC,IAAI,EAAE;KAFR,CADF;IAMA,KAAKH,OAAL,CACE,IAAIC,gBAAJ,CAAqB;MACnBC,EAAE,EAAE,KADe;MAEnBC,IAAI,EAAE;KAFR,CADF;;;;;MCfSC;EAKXR,YACES,IACAF,MACAG,OACAC,UACAC,QACAX;IAEA,KAAKW,MAAL,GAAcA,MAAd;IACA,KAAKD,QAAL,GAAgBA,QAAhB;IACA,KAAKV,OAAL,GAAeA,OAAf;IACA,KAAKA,OAAL,CAAaY,GAAb,CAAiB,IAAjB,EAAuBJ,EAAvB;IACA,KAAKR,OAAL,CAAaY,GAAb,CAAiB,MAAjB,EAAyBN,IAAzB;IACA,KAAKN,OAAL,CAAaY,GAAb,CAAiB,OAAjB,EAA0BH,KAA1B;;;EAGFI,KAAK;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G,YAAY,CAAC+G,EAAD,EAAKjJ,KAAL,CADX,EAEXkJ,MAFW,CAEJC,GAAG,IAAIA,GAAG,KAAKzG,SAFX,CAAd;;EAIA/B,KAAK,CAACyI,MAAN,CAAa,GAAGpJ,KAAhB,EAAuB,GAAGC,KAA1B;;EAGAc,MAAM,CAACsI,QAAP,CAAgB1I,KAAhB;EAEA,MAAM2I,kBAAkB,GAAGb,gBAAgB,GACvCA,gBADuC,GAEvCjD,OAAO,CAAC6C,SAFZ;EAIA,OACElI,aAAA,CAACoJ,aAAD;IAAeC,KAAK,EAAEC,WAAW,CAACD,KAAK,CAACd,SAAD,oBAACA,SAAS,CAAEgB,oBAAZ,CAAN;GAAjC,EACEvJ,aAAA,CAACwJ,WAAD,MAAA,CADF,EAEExJ,aAAA,CAACsF,KAAD;IAAKC,SAAS,EAAE4D;GAAhB,EACEnJ,aAAA,CAACoF,OAAD,MAAA,CADF,EAEEpF,aAAA,CAACyJ,YAAD;IACElE,SAAS,KAAKF,OAAO,CAAC8C,mBAAmBI,SAA9B,oBAA8BA,SAAS,CAAEmB;IACpD9I,MAAM,EAAEA;GAFV,CAFF,CAFF,CADF;AAYD,CApDD;;;;;"} \ No newline at end of file +{"version":3,"file":"meta-diagram.esm.js","sources":["../src/constants.ts","../src/models/Position.ts","../src/helpers/nodesHelper.ts","../src/react-diagrams/MetaNodeModel.ts","../src/models/MetaNode.ts","../src/react-diagrams/MetaLinkModel.ts","../src/models/MetaLink.ts","../src/models/ComponentsMap.ts","../src/components/UnknownTypeWidget.tsx","../src/react-diagrams/MetaNodeFactory.tsx","../src/react-diagrams/MetaLinkFactory.tsx","../src/helpers/linksHelper.ts","../src/components/assets/styles/variables.ts","../src/components/Sidebar.tsx","../src/theme.ts","../src/helpers/engineHelper.ts","../src/index.tsx"],"sourcesContent":["export enum ReactDiagramMetaTypes {\n META_NODE = 'meta-node-type',\n META_LINK = 'meta-link-type',\n}\n","export class Position {\n x: number;\n y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n add(otherPosition: Position) : Position {\n return new Position(this.x+ otherPosition.x, this.y + otherPosition.y)\n }\n\n sub(otherPosition: Position) : Position {\n return new Position(this.x - otherPosition.x, this.y - otherPosition.y)\n }\n}\n","import { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport {MetaNode} from \"../models/MetaNode\";\nimport {BaseEntityEvent} from \"@projectstorm/react-canvas-core\";\nimport {NodeModel, NodeModelGenerics} from \"@projectstorm/react-diagrams\";\n\nexport function getNode(\n id: string,\n nodes: MetaNodeModel[]\n): MetaNodeModel | undefined {\n return nodes.find(n => n.getOptions().id === id);\n}\n\nexport function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] {\n const metaNodeModels = []\n for(const mn of metaNodes){\n const metaNodeModel = mn.toModel()\n const position = mn.getWorldPosition()\n metaNodeModel.setPosition(position.x, position.y)\n // @ts-ignore\n metaNodeModel.registerListener({positionChanged: (event => callback(event))})\n metaNodeModels.push(metaNodeModel)\n }\n return metaNodeModels\n}\n","import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport {Position} from \"../models/Position\";\nimport {getNode} from \"../helpers/nodesHelper\";\n\nexport class MetaNodeModel extends NodeModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_NODE,\n });\n\n // set up an in and out port\n\n this.addPort(\n new DefaultPortModel({\n in: true,\n name: 'in',\n })\n );\n this.addPort(\n new DefaultPortModel({\n in: false,\n name: 'out',\n })\n );\n }\n\n getLocalPosition(nodes: MetaNodeModel[]): Position {\n const worldPosition = new Position(this.getX(), this.getY())\n // @ts-ignore\n const parentId = this.options['parentId']\n const parent = getNode(parentId, nodes)\n return parent ? worldPosition.sub(parent.getLocalPosition(nodes)) : worldPosition\n }\n\n updateLocalPosition(nodes: MetaNodeModel[]) : void {\n // @ts-ignore\n this.options['position'] = this.getLocalPosition(nodes)\n }\n}\n","import { Position } from './Position';\nimport {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport class MetaNode {\n private readonly parent: MetaNode | undefined;\n private readonly position: Position;\n private readonly options: Map;;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n position: Position,\n parent: MetaNode | undefined,\n options: Map\n ) {\n this.parent = parent\n this.position = position\n this.options = options\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getId() : string{\n return this.options.get('id')\n }\n\n getParentId() : string | undefined {\n return this.parent?.getId()\n }\n\n getWorldPosition() : Position {\n return this.parent ? this.position.add(this.parent?.getWorldPosition()) : this.position\n }\n\n toModel() : MetaNodeModel {\n const optionsMap = this.options\n optionsMap.set('parentId', this.getParentId())\n optionsMap.set('position', this.position)\n return new MetaNodeModel(Object.fromEntries(optionsMap))\n }\n\n}\n","import { DefaultLinkModel } from '@projectstorm/react-diagrams';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaLinkModel extends DefaultLinkModel {\n constructor(options = {}) {\n super({\n ...options,\n type: ReactDiagramMetaTypes.META_LINK,\n });\n }\n}\n","import { ILink } from './ILink';\nimport {MetaLinkModel} from \"../react-diagrams/MetaLinkModel\";\n\nexport class MetaLink implements ILink {\n sourceId: string;\n sourcePortId: string;\n targetId: string;\n targetPortId: string;\n options: Map;\n\n constructor(\n id: string,\n name: string,\n shape: string,\n sourceId: string,\n sourcePortId: string,\n targetId: string,\n targetPortId: string,\n options: Map\n ) {\n this.sourceId = sourceId;\n this.sourcePortId = sourcePortId;\n this.targetId = targetId;\n this.targetPortId = targetPortId;\n this.options = options;\n this.options.set('id', id);\n this.options.set('name', name);\n this.options.set('shape', shape);\n }\n\n getSourceId(): string {\n return this.sourceId;\n }\n\n getSourcePortId(): string {\n return this.sourcePortId;\n }\n\n getTargetId(): string {\n return this.targetId;\n }\n\n getTargetPortId(): string {\n return this.targetPortId;\n }\n\n toModel(): MetaLinkModel {\n return new MetaLinkModel(Object.fromEntries(this.options))\n }\n}\n","import React from 'react';\n\nexport class ComponentsMap {\n nodes: Map;\n links: Map;\n\n constructor(\n nodesMap: Map,\n linksMap: Map\n ) {\n this.nodes = nodesMap;\n this.links = linksMap;\n }\n}\n","import React from 'react';\n\nexport const UnknownTypeWidget = () => {\n return
Unknown Type
;\n};\n","import { AbstractReactFactory } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './MetaNodeModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport React from 'react';\nimport { ReactDiagramMetaTypes } from '../constants';\n\nexport class MetaNodeFactory extends AbstractReactFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_NODE);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaNodeModel();\n }\n\n generateReactWidget(event: any): JSX.Element {\n if (this.componentsMap.has(event.model.options.shape)) {\n const ReactComponentType = this.componentsMap.get(\n event.model.options.shape\n );\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default node instead\n return ;\n }\n}\n","import { MetaLinkModel } from './MetaLinkModel';\nimport { UnknownTypeWidget } from '../components/UnknownTypeWidget';\nimport { ReactDiagramMetaTypes } from '../constants';\nimport React from 'react';\nimport { DefaultLinkFactory } from '@projectstorm/react-diagrams';\n\nexport class MetaLinkFactory extends DefaultLinkFactory {\n componentsMap: Map;\n\n constructor(componentsMap: Map) {\n super(ReactDiagramMetaTypes.META_LINK);\n this.componentsMap = componentsMap;\n }\n\n generateModel() {\n return new MetaLinkModel();\n }\n\n generateLinkSegment(\n model: MetaLinkModel,\n selected: boolean,\n path: string\n ): JSX.Element {\n // @ts-ignore\n if (this.componentsMap.has(model.getOptions()?.shape)) {\n const ReactComponentType = this.componentsMap.get(\n // @ts-ignore\n model.getOptions().shape\n );\n\n return (\n // @ts-ignore\n \n );\n }\n // TODO: Generate default link instead\n return ;\n }\n}\n","import { MetaLink } from '../models/MetaLink';\nimport { MetaLinkModel } from '../react-diagrams/MetaLinkModel';\nimport { MetaNodeModel } from '../react-diagrams/MetaNodeModel';\nimport { getNode } from './nodesHelper';\n\nexport function getLinkModel(\n metaLink: MetaLink,\n nodes: MetaNodeModel[]\n): MetaLinkModel | undefined {\n const link = metaLink.toModel();\n const source = getNode(metaLink.getSourceId(), nodes);\n const target = getNode(metaLink.getTargetId(), nodes);\n if (source && target) {\n link.setSourcePort(source.getPort(metaLink.getSourcePortId()));\n link.setTargetPort(target.getPort(metaLink.getTargetPortId()));\n return link;\n }\n return undefined;\n}\n","const vars = {\n fontFamily: 'Inter, sans-serif',\n primaryBg: '#f1f1f1',\n textWhite: '#FFFFFF',\n chipTextColor: '#F2F2F7',\n chipBgColor: 'rgba(60, 60, 67, 0.4)',\n\n chipPrimaryTextColor: 'rgba(255, 255, 255, 0.8)',\n chipPrimaryBgColor: 'rgba(0, 122, 255, 0.6)',\n\n breadcrumbLinkColor: '#A2A2A2',\n breadcrumbTextColor: '#292929',\n\n buttonPrimaryBgColor: '4353FF',\n buttonPrimaryBgHoverColor: '#3443E1',\n buttonPrimaryDisabledBgColor: 'rgba(0, 122, 255, 0.4)',\n\n listItemActiveBg: '#007AFF',\n listSelectedTextColor: '#3C3C43',\n listBoxShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.12), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.04)',\n listBorderColor: 'rgba(0, 0, 0, 0.04)',\n\n dividerColor: 'rgba(118, 120, 125, 0.12)',\n\n dropdownBg: 'rgba(246, 246, 248, 0.8)',\n dropdownTextColor: 'rgba(60, 60, 67, 0.6)',\n\n overlayColor: 'rgba(0, 0, 0, 0.4)',\n\n progressBg: '#E5E5E5',\n progressBar: '#017AFF',\n progressShadow: 'inset 0 0 0.0625rem #E3E3E3',\n\n switchShadow:\n '0 0.1875rem 0.5rem rgba(0, 0, 0, 0.15), 0 0.1875rem 0.0625rem rgba(0, 0, 0, 0.06)',\n};\n\nexport default vars;\n","import React from 'react';\nimport { Box } from '@mui/system';\nimport { makeStyles } from '@mui/styles';\nimport vars from './assets/styles/variables';\nimport { Divider, List, ListItemButton, ListItemIcon } from '@mui/material';\nimport Move from './assets/svg/move.svg';\nimport Icon from './assets/svg/icon.svg';\nimport Node from './assets/svg/node.svg';\nimport Cursor from './assets/svg/cursor.svg';\nimport Fullscreen from './assets/svg/fullscreen.svg';\n\nconst { textWhite, dividerColor } = vars;\n\nconst useStyles = makeStyles(() => ({\n root: {\n zIndex: '5',\n width: '4rem',\n background: textWhite,\n boxShadow:\n '0 0 3.75rem rgba(0, 0, 0, 0.1), 0 0.5rem 2.5rem -0.625rem rgba(0, 0, 0, 0.1)',\n borderRadius: '2rem',\n position: 'fixed',\n left: '1rem',\n top: '50%',\n transform: 'translateY(-50%)',\n\n '&.right': {\n left: 'auto',\n right: '1rem',\n },\n\n '& .MuiList-root': {\n padding: '0.75rem',\n },\n },\n\n node: {\n margin: '0.25rem 0',\n '& .MuiDivider-root': {\n borderColor: dividerColor,\n width: 'calc(100% - 1.5rem)',\n margin: '0 auto',\n border: 'none',\n borderTop: '0.0625rem solid',\n },\n\n '& img': {\n display: 'block',\n margin: '1rem 0',\n },\n },\n}));\n\nconst Sidebar = () => {\n const classes = useStyles();\n return (\n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n \n \n );\n};\n\nexport default Sidebar;\n","import vars from './components/assets/styles/variables';\n\ntype ThemeVars = {\n [key: string]: any;\n};\n\nconst applicationTheme = (params: ThemeVars) => {\n const {\n primaryBg,\n fontFamily,\n chipTextColor,\n chipBgColor,\n textWhite,\n listItemActiveBg,\n listSelectedTextColor,\n listBoxShadow,\n listBorderColor,\n } = params;\n return {\n components: {\n MuiCssBaseline: {\n styleOverrides: `\n html {\n background: ${primaryBg};\n font-family: ${fontFamily};\n }\n body {\n background-color:${primaryBg};\n font-family: ${fontFamily};\n font-size: 1rem;\n }\n `,\n },\n MuiList: {\n styleOverrides: {\n root: {\n '&.customSwitch': {\n padding: '0.125rem',\n background: chipTextColor,\n borderRadius: '0.5rem',\n display: 'flex',\n '& .MuiListItemButton-root': {\n padding: '0.25rem 0.75rem',\n borderRadius: '0.4375rem',\n width: '10.59375rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n '&:not(:last-child)': {\n marginBottom: '0',\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n '&.Mui-selected': {\n background: textWhite,\n boxShadow: listBoxShadow,\n border: `0.03125rem solid ${listBorderColor}`,\n '& .MuiTypography-root': {\n color: listSelectedTextColor,\n },\n },\n },\n '& .MuiChip-root': {\n marginLeft: '0.25rem',\n },\n '& .MuiTypography-root': {\n fontWeight: 500,\n fontSize: '0.8125rem',\n lineHeight: '1.25rem',\n letterSpacing: '-0.005rem',\n color: chipBgColor,\n margin: 0,\n },\n },\n },\n },\n },\n MuiListItemIcon: {\n styleOverrides: {\n root: {\n minWidth: 'inherit',\n },\n },\n },\n MuiListItemButton: {\n styleOverrides: {\n root: {\n padding: 0,\n width: '2.5rem',\n height: '2.5rem',\n borderRadius: '50%',\n justifyContent: 'center',\n backgroundColor: chipTextColor,\n '&:hover': {\n backgroundColor: chipTextColor,\n },\n '&:not(:last-child)': {\n marginBottom: '0.75rem',\n },\n '&.Mui-selected': {\n backgroundColor: listItemActiveBg,\n '&:hover': {\n backgroundColor: listItemActiveBg,\n },\n },\n '&.Mui-disabled': {\n opacity: 0.8,\n },\n },\n },\n },\n },\n };\n};\n\nexport default (customVariables: ThemeVars) =>\n applicationTheme({\n ...vars,\n ...customVariables,\n });\n","import {MetaNodeModel} from \"../react-diagrams/MetaNodeModel\";\n\nexport function updateChildrenPosition(nodes: MetaNodeModel[], parent: MetaNodeModel): void {\n // @ts-ignore\n const children = nodes.filter(n => n.options['parentId'] == parent.options['id']);\n children.forEach(n => {\n // @ts-ignore\n n.setPosition(parent.getX() + n.options['position'].x, parent.getY() + n.options['position'].y)\n // TODO: Fix nested position update\n // updateChildrenPosition(nodes, n)\n })\n}\n\nexport function updateNodeLocalPosition(nodes: MetaNodeModel[], node: MetaNodeModel): void {\n node.updateLocalPosition(nodes)\n}","import * as React from 'react';\nimport { MetaNode } from './models/MetaNode';\nimport { MetaLink } from './models/MetaLink';\nimport { ComponentsMap } from './models/ComponentsMap';\nimport createEngine, { DiagramModel } from '@projectstorm/react-diagrams';\nimport { MetaNodeFactory } from './react-diagrams/MetaNodeFactory';\nimport { MetaLinkFactory } from './react-diagrams/MetaLinkFactory';\nimport { CanvasWidget } from '@projectstorm/react-canvas-core';\nimport { MetaNodeModel } from './react-diagrams/MetaNodeModel';\nimport { getLinkModel } from './helpers/linksHelper';\nimport { makeStyles } from '@mui/styles';\nimport Sidebar from './components/Sidebar';\nimport { ThemeProvider, createTheme } from '@mui/material/styles';\nimport CssBaseline from '@mui/material/CssBaseline';\nimport theme from './theme';\nimport { Box } from '@mui/material';\nimport {processNodes} from \"./helpers/nodesHelper\";\nimport {updateChildrenPosition} from \"./helpers/engineHelper\";\n\nconst useStyles = makeStyles(_ => ({\n container: {\n height: '100%',\n width: '100%',\n },\n canvasContainer: {\n height: '100%',\n width: '100%',\n background: '#fffff',\n },\n}));\n\ninterface MetaDiagramProps {\n metaNodes: MetaNode[];\n metaLinks: MetaLink[];\n componentsMap: ComponentsMap;\n wrapperClassName?: string;\n canvasClassName?: string;\n metaTheme: {\n customThemeVariables: {};\n canvasClassName: string;\n };\n}\n\nconst MetaDiagram = ({\n metaNodes,\n metaLinks,\n componentsMap,\n wrapperClassName,\n metaTheme,\n}: MetaDiagramProps) => {\n const classes = useStyles();\n\n // set up the diagram engine\n const engine = createEngine();\n\n engine\n .getNodeFactories()\n // @ts-ignore\n .registerFactory(new MetaNodeFactory(componentsMap.nodes));\n\n engine\n .getLinkFactories()\n // @ts-ignore\n .registerFactory(new MetaLinkFactory(componentsMap.links));\n\n // @ts-ignore\n const repaintCanvas = (event: any) => {\n let model = engine.getModel();\n const node = event.entity\n const nodes = model.getNodes()\n // @ts-ignore\n updateChildrenPosition(nodes, node)\n // @ts-ignore\n // updateNodeLocalPosition(nodes, node)\n engine.repaintCanvas();\n }\n\n // set up the diagram model\n\n const model = new DiagramModel();\n const nodes = processNodes(metaNodes, repaintCanvas)\n\n const links = metaLinks\n .map(ml => getLinkModel(ml, nodes))\n .filter(mlm => mlm !== undefined);\n // @ts-ignore\n model.addAll(...nodes, ...links);\n\n // load model into engine\n engine.setModel(model);\n\n const containerClassName = wrapperClassName\n ? wrapperClassName\n : classes.container;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default MetaDiagram;\nexport { MetaNode, MetaLink, MetaNodeModel, ComponentsMap };\nexport { MetaLinkModel } from './react-diagrams/MetaLinkModel';\nexport { Position } from './models/Position';\n"],"names":["ReactDiagramMetaTypes","Position","constructor","x","y","add","otherPosition","sub","getNode","id","nodes","find","n","getOptions","processNodes","metaNodes","callback","metaNodeModels","mn","metaNodeModel","toModel","position","getWorldPosition","setPosition","registerListener","positionChanged","event","push","MetaNodeModel","NodeModel","options","type","META_NODE","addPort","DefaultPortModel","in","name","getLocalPosition","worldPosition","getX","getY","parentId","parent","updateLocalPosition","MetaNode","shape","set","getId","get","getParentId","optionsMap","Object","fromEntries","MetaLinkModel","DefaultLinkModel","META_LINK","MetaLink","sourceId","sourcePortId","targetId","targetPortId","getSourceId","getSourcePortId","getTargetId","getTargetPortId","ComponentsMap","nodesMap","linksMap","links","UnknownTypeWidget","React","MetaNodeFactory","AbstractReactFactory","componentsMap","generateModel","generateReactWidget","has","model","ReactComponentType","key","engine","MetaLinkFactory","DefaultLinkFactory","generateLinkSegment","selected","path","getLinkModel","metaLink","link","source","target","setSourcePort","getPort","setTargetPort","undefined","vars","fontFamily","primaryBg","textWhite","chipTextColor","chipBgColor","chipPrimaryTextColor","chipPrimaryBgColor","breadcrumbLinkColor","breadcrumbTextColor","buttonPrimaryBgColor","buttonPrimaryBgHoverColor","buttonPrimaryDisabledBgColor","listItemActiveBg","listSelectedTextColor","listBoxShadow","listBorderColor","dividerColor","dropdownBg","dropdownTextColor","overlayColor","progressBg","progressBar","progressShadow","switchShadow","useStyles","makeStyles","root","zIndex","width","background","boxShadow","borderRadius","left","top","transform","right","padding","node","margin","borderColor","border","borderTop","display","Sidebar","classes","Box","className","List","disablePadding","component","ListItemButton","ListItemIcon","src","Buffer","Cursor","toString","alt","Move","Divider","Node","disabled","Icon","Fullscreen","applicationTheme","params","components","MuiCssBaseline","styleOverrides","MuiList","alignItems","justifyContent","marginBottom","opacity","color","marginLeft","fontWeight","fontSize","lineHeight","letterSpacing","MuiListItemIcon","minWidth","MuiListItemButton","height","backgroundColor","customVariables","updateChildrenPosition","children","filter","forEach","_","container","canvasContainer","MetaDiagram","metaLinks","wrapperClassName","metaTheme","createEngine","getNodeFactories","registerFactory","getLinkFactories","repaintCanvas","getModel","entity","getNodes","DiagramModel","map","ml","mlm","addAll","setModel","containerClassName","ThemeProvider","theme","createTheme","customThemeVariables","CssBaseline","CanvasWidget","canvasClassName"],"mappings":";;;;;;;;;AAAA,IAAYA,qBAAZ;;AAAA,WAAYA;EACVA,kCAAA,mBAAA;EACAA,kCAAA,mBAAA;AACD,CAHD,EAAYA,qBAAqB,KAArBA,qBAAqB,KAAA,CAAjC;;MCAaC;EAIXC,YAAYC,GAAWC;IACrB,KAAKD,CAAL,GAASA,CAAT;IACA,KAAKC,CAAL,GAASA,CAAT;;;EAGFC,GAAG,CAACC,aAAD;IACD,OAAO,IAAIL,QAAJ,CAAa,KAAKE,CAAL,GAAQG,aAAa,CAACH,CAAnC,EAAsC,KAAKC,CAAL,GAASE,aAAa,CAACF,CAA7D,CAAP;;;EAGFG,GAAG,CAACD,aAAD;IACD,OAAO,IAAIL,QAAJ,CAAa,KAAKE,CAAL,GAASG,aAAa,CAACH,CAApC,EAAuC,KAAKC,CAAL,GAASE,aAAa,CAACF,CAA9D,CAAP;;;;;SCTYI,QACdC,IACAC;EAEA,OAAOA,KAAK,CAACC,IAAN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K,MAAnB;IACA,MAAM5L,KAAK,GAAGmE,KAAK,CAAC0H,QAAN,EAAd;;IAEAlB,sBAAsB,CAAC3K,KAAD,EAAQ2H,IAAR,CAAtB;;;IAGArD,MAAM,CAACoH,aAAP;GARF;;;EAaA,MAAMvH,KAAK,GAAG,IAAI2H,YAAJ,EAAd;EACA,MAAM9L,KAAK,GAAGI,YAAY,CAACC,SAAD,EAAYqL,aAAZ,CAA1B;EAEA,MAAMhI,KAAK,GAAGyH,SAAS,CACpBY,GADW,CACPC,EAAE,IAAIpH,YAAY,CAACoH,EAAD,EAAKhM,KAAL,CADX,EAEX6K,MAFW,CAEJoB,GAAG,IAAIA,GAAG,KAAK7G,SAFX,CAAd;;EAIAjB,KAAK,CAAC+H,MAAN,CAAa,GAAGlM,KAAhB,EAAuB,GAAG0D,KAA1B;;EAGAY,MAAM,CAAC6H,QAAP,CAAgBhI,KAAhB;EAEA,MAAMiI,kBAAkB,GAAGhB,gBAAgB,GACvCA,gBADuC,GAEvClD,OAAO,CAAC8C,SAFZ;EAIA,OACEpH,aAAA,CAACyI,aAAD;IAAeC,KAAK,EAAEC,WAAW,CAACD,KAAK,CAACjB,SAAD,oBAACA,SAAS,CAAEmB,oBAAZ,CAAN;GAAjC,EACE5I,aAAA,CAAC6I,WAAD,MAAA,CADF,EAEE7I,aAAA,CAACuE,KAAD;IAAKC,SAAS,EAAEgE;GAAhB,EACExI,aAAA,CAACqE,OAAD,MAAA,CADF,EAEErE,aAAA,CAAC8I,YAAD;IACEtE,SAAS,KAAKF,OAAO,CAAC+C,mBAAmBI,SAA9B,oBAA8BA,SAAS,CAAEsB;IACpDrI,MAAM,EAAEA;GAFV,CAFF,CAFF,CADF;AAYD,CAhED;;;;;"} \ No newline at end of file diff --git a/dist/react-diagrams/MetaNodeModel.d.ts b/dist/react-diagrams/MetaNodeModel.d.ts index c70b8b5..3055bb6 100644 --- a/dist/react-diagrams/MetaNodeModel.d.ts +++ b/dist/react-diagrams/MetaNodeModel.d.ts @@ -1,4 +1,7 @@ import { NodeModel } from '@projectstorm/react-diagrams'; +import { Position } from "../models/Position"; export declare class MetaNodeModel extends NodeModel { constructor(options?: {}); + getLocalPosition(nodes: MetaNodeModel[]): Position; + updateLocalPosition(nodes: MetaNodeModel[]): void; } diff --git a/example/index.tsx b/example/index.tsx index 1edbc70..5c00d86 100644 --- a/example/index.tsx +++ b/example/index.tsx @@ -21,7 +21,7 @@ const useStyles = makeStyles(_ => ({ const App = () => { const classes = useStyles(); - const grandparent = new MetaNode('group2', 'grandparent', 'default', new Position(0, 0), + const grandparent = new MetaNode('group2', 'grandparent', 'default', new Position(130, 105), null, new Map(Object.entries({color: 'rgb(0,255,0)'}))) const parent = new MetaNode('group', 'parent', 'default', new Position(130, 105), @@ -43,7 +43,7 @@ const App = () => { return (
- n.options['parentId'] == parent.options['id']); + children.forEach(n => { + // @ts-ignore + n.setPosition(parent.getX() + n.options['position'].x, parent.getY() + n.options['position'].y) + // TODO: Fix nested position update + // updateChildrenPosition(nodes, n) + }) +} + +export function updateNodeLocalPosition(nodes: MetaNodeModel[], node: MetaNodeModel): void { + node.updateLocalPosition(nodes) +} \ No newline at end of file diff --git a/src/helpers/nodesHelper.ts b/src/helpers/nodesHelper.ts index 8144205..d3f136c 100644 --- a/src/helpers/nodesHelper.ts +++ b/src/helpers/nodesHelper.ts @@ -10,7 +10,6 @@ export function getNode( return nodes.find(n => n.getOptions().id === id); } -// @ts-ignore export function processNodes(metaNodes: MetaNode[], callback: { (event: any): void; (arg0: BaseEntityEvent>): void; }) : MetaNodeModel[] { const metaNodeModels = [] for(const mn of metaNodes){ @@ -18,7 +17,7 @@ export function processNodes(metaNodes: MetaNode[], callback: { (event: any): vo const position = mn.getWorldPosition() metaNodeModel.setPosition(position.x, position.y) // @ts-ignore - //metaNodeModel.registerListener({positionChanged: (event => callback(event))}) + metaNodeModel.registerListener({positionChanged: (event => callback(event))}) metaNodeModels.push(metaNodeModel) } return metaNodeModels diff --git a/src/index.tsx b/src/index.tsx index 78c44e0..c5d20a5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -15,6 +15,7 @@ import CssBaseline from '@mui/material/CssBaseline'; import theme from './theme'; import { Box } from '@mui/material'; import {processNodes} from "./helpers/nodesHelper"; +import {updateChildrenPosition} from "./helpers/engineHelper"; const useStyles = makeStyles(_ => ({ container: { @@ -62,10 +63,22 @@ const MetaDiagram = ({ // @ts-ignore .registerFactory(new MetaLinkFactory(componentsMap.links)); + // @ts-ignore + const repaintCanvas = (event: any) => { + let model = engine.getModel(); + const node = event.entity + const nodes = model.getNodes() + // @ts-ignore + updateChildrenPosition(nodes, node) + // @ts-ignore + // updateNodeLocalPosition(nodes, node) + engine.repaintCanvas(); + } + // set up the diagram model const model = new DiagramModel(); - const nodes = processNodes(metaNodes, () => console.log("repaint canvas")) + const nodes = processNodes(metaNodes, repaintCanvas) const links = metaLinks .map(ml => getLinkModel(ml, nodes)) diff --git a/src/react-diagrams/MetaNodeModel.ts b/src/react-diagrams/MetaNodeModel.ts index 33d6ba7..2f43df1 100644 --- a/src/react-diagrams/MetaNodeModel.ts +++ b/src/react-diagrams/MetaNodeModel.ts @@ -1,5 +1,7 @@ import { DefaultPortModel, NodeModel } from '@projectstorm/react-diagrams'; import { ReactDiagramMetaTypes } from '../constants'; +import {Position} from "../models/Position"; +import {getNode} from "../helpers/nodesHelper"; export class MetaNodeModel extends NodeModel { constructor(options = {}) { @@ -23,4 +25,17 @@ export class MetaNodeModel extends NodeModel { }) ); } + + getLocalPosition(nodes: MetaNodeModel[]): Position { + const worldPosition = new Position(this.getX(), this.getY()) + // @ts-ignore + const parentId = this.options['parentId'] + const parent = getNode(parentId, nodes) + return parent ? worldPosition.sub(parent.getLocalPosition(nodes)) : worldPosition + } + + updateLocalPosition(nodes: MetaNodeModel[]) : void { + // @ts-ignore + this.options['position'] = this.getLocalPosition(nodes) + } }