@awesome-flow/ecs 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/index.cjs +5 -0
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.mts +2 -0
- package/dist/canvas/index.mjs +3 -0
- package/dist/canvas-C4nDXlkK.mjs +677 -0
- package/dist/canvas-C4nDXlkK.mjs.map +1 -0
- package/dist/canvas-DlWcWu05.cjs +688 -0
- package/dist/canvas-DlWcWu05.cjs.map +1 -0
- package/dist/context/index.cjs +497 -0
- package/dist/context/index.cjs.map +1 -0
- package/dist/context/index.d.cts +2 -0
- package/dist/context/index.d.mts +2 -0
- package/dist/context/index.mjs +492 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/entity-component-inspector-CNaN8Scf.mjs +79 -0
- package/dist/entity-component-inspector-CNaN8Scf.mjs.map +1 -0
- package/dist/entity-component-inspector-VlwcaUqy.cjs +90 -0
- package/dist/entity-component-inspector-VlwcaUqy.cjs.map +1 -0
- package/dist/hooks/index.cjs +19 -0
- package/dist/hooks/index.d.cts +2 -0
- package/dist/hooks/index.d.mts +2 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/id-generator-C2_8g29M.cjs +45 -0
- package/dist/id-generator-C2_8g29M.cjs.map +1 -0
- package/dist/id-generator-DDsv3NdX.mjs +34 -0
- package/dist/id-generator-DDsv3NdX.mjs.map +1 -0
- package/dist/index-B9WbxxFC.d.mts +67 -0
- package/dist/index-B9WbxxFC.d.mts.map +1 -0
- package/dist/index-BTs_8SY-.d.cts +20 -0
- package/dist/index-BTs_8SY-.d.cts.map +1 -0
- package/dist/index-C-TDFHpq.d.mts +54 -0
- package/dist/index-C-TDFHpq.d.mts.map +1 -0
- package/dist/index-CNCqWBLh.d.cts +54 -0
- package/dist/index-CNCqWBLh.d.cts.map +1 -0
- package/dist/index-CyeezgDI.d.mts +20 -0
- package/dist/index-CyeezgDI.d.mts.map +1 -0
- package/dist/index-D9zIjQH9.d.mts +1 -0
- package/dist/index-DCOd7jg-.d.mts +99 -0
- package/dist/index-DCOd7jg-.d.mts.map +1 -0
- package/dist/index-DGjpWDlm.d.cts +99 -0
- package/dist/index-DGjpWDlm.d.cts.map +1 -0
- package/dist/index-DLoAMD9J.d.cts +1 -0
- package/dist/index-YNgbjS9S.d.cts +159 -0
- package/dist/index-YNgbjS9S.d.cts.map +1 -0
- package/dist/index-_BgjSgkQ.d.mts +159 -0
- package/dist/index-_BgjSgkQ.d.mts.map +1 -0
- package/dist/index-t3_yRTa6.d.cts +67 -0
- package/dist/index-t3_yRTa6.d.cts.map +1 -0
- package/dist/index.cjs +55 -531
- package/dist/index.d.cts +9 -106
- package/dist/index.d.mts +9 -106
- package/dist/index.mjs +10 -520
- package/dist/inspectors/index.cjs +6 -0
- package/dist/inspectors/index.d.cts +2 -0
- package/dist/inspectors/index.d.mts +2 -0
- package/dist/inspectors/index.mjs +3 -0
- package/dist/node-props-BtAkmdqr.d.mts +45 -0
- package/dist/node-props-BtAkmdqr.d.mts.map +1 -0
- package/dist/node-props-DkuSwMA0.d.cts +45 -0
- package/dist/node-props-DkuSwMA0.d.cts.map +1 -0
- package/dist/node-systems-module-CPDV8u8O.d.mts +22 -0
- package/dist/node-systems-module-CPDV8u8O.d.mts.map +1 -0
- package/dist/node-systems-module-CzkoMbdF.d.cts +22 -0
- package/dist/node-systems-module-CzkoMbdF.d.cts.map +1 -0
- package/dist/node-types-BRcpbaeR.mjs +1604 -0
- package/dist/node-types-BRcpbaeR.mjs.map +1 -0
- package/dist/node-types-D_NfbsUT.cjs +1819 -0
- package/dist/node-types-D_NfbsUT.cjs.map +1 -0
- package/dist/nodes/index.cjs +10 -0
- package/dist/nodes/index.d.cts +3 -0
- package/dist/nodes/index.d.mts +3 -0
- package/dist/nodes/index.mjs +3 -0
- package/dist/template-tool-nodes-B7sT2iRc.d.cts +35 -0
- package/dist/template-tool-nodes-B7sT2iRc.d.cts.map +1 -0
- package/dist/template-tool-nodes-BwavFwMh.d.mts +35 -0
- package/dist/template-tool-nodes-BwavFwMh.d.mts.map +1 -0
- package/dist/templates/index.cjs +11 -0
- package/dist/templates/index.d.cts +2 -0
- package/dist/templates/index.d.mts +2 -0
- package/dist/templates/index.mjs +3 -0
- package/package.json +85 -25
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas-DlWcWu05.cjs","names":["useFlowStore","Node","useEffect","EntityNodeData","useBridgeStoreVersion","useEcsBridge","FlowEcsEdgeProxiesProps","nodesToConnect","FlowEcsEdgeModules","props","$","_c","onConnect","_temp","bridge","moduleVersion","t0","node","data","entity","sourceHandle","handles","find","_temp2","entityRepository","get","systemModule","ecsFlowRepository","getSystemModuleNode","myProxy","entityType","targetHandle","_temp3","source","id","target","handleId","t1","t2","Symbol","for","h_0","h","connection","state","useFlowStore","Node","useEffect","EntityNodeData","useBridgeStoreVersion","useEcsBridge","FlowEcsEdgeProxiesProps","nodesToConnect","FlowEcsEdgeProxies","props","$","_c","onConnect","_temp","bridge","proxyVersion","t0","node","data","entity","sourceHandle","handles","find","_temp2","entityRepository","get","proxies","Array","from","entityProxyRepository","getAll","myProxy","values","flat","proxy","proxyNode","ecsFlowRepository","getEntityNode","targetHandle","_temp3","source","id","target","handleId","t1","t2","Symbol","for","h_0","h","connection","state","FlowContext","useFlowStore","Node","useContext","useEffect","useState","EntityNodeData","EcsNodeType","useEcsBridge","useEntityList","FlowEcsEdgeModules","FlowEcsEdgeProxies","FlowEcsEntities","$","_c","nodeFactory","addNodes","_temp","bridge","entities","t0","Symbol","for","entityNodes","setEntityNodes","t1","t2","nodesToAdd","nodesToConnect","entity","node","ecsFlowRepository","getEntityNode","myProxy","createNodeFromType","data","entityType","position","x","y","addEntityNode","push","length","t3","state","FlowContext","useFlowStore","Node","useContext","useEffect","SystemsModuleNodeData","EcsNodeType","useEcsBridge","useSystemsModuleList","FlowEcsModules","$","_c","nodeFactory","addNodes","_temp","bridge","modules","t0","t1","keys","Array","from","nodesToAdd","element","ecsFlowRepository","getSystemModuleNode","node","createNodeFromType","systemsModule","data","entityType","position","x","y","addSystemModuleNode","push","length","t2","Symbol","for","state","FlowContext","StoreContext","useFlowStore","Node","useContext","useEffect","shallow","EntityNodeData","ScopeGroupNodeData","EcsNodeType","useEcsBridge","useScopeList","FlowEcsScopes","$","_c","nodeFactory","flowStore","bridge","scopes","nodes","setGroups","setNodes","_temp","t0","length","changed","currentNodes","instance","getState","nextNodes","groups","scope","groupNode","ecsFlowRepository","getScopeGroupNode","scopeId","createNodeFromType","scopeGroup","data","title","position","x","y","className","addScopeGroupNode","unshift","childIds","entity","entities","entityNode","getEntityNode","myProxy","push","id","scopedNodeIds","Set","Object","values","flat","groupIds","keys","orderedNodes","map","node","has","type","parentId","entries","find","t1","children","includes","undefined","extent","const","sort","_temp2","t2","Symbol","for","a","b","Number","isGroup","state","useFlowStore","FlowState","Node","useEffect","shallow","EntityNodeData","EcsNodeType","useEcsBridge","selector","state","nodes","updateNodeData","FlowEcsSpawnEntities","$","_c","bridge","t0","t1","node","type","entity","data","spawn","update","enqueueEntitySpawn","id","spawnStatus","entityType","ecsFlowRepository","addEntityNode","t2","Symbol","for","FlowContext","useFlowStore","Node","useContext","useEffect","EcsToolNodeData","EcsNodeType","useEcsBridge","defaultEcsToolNodes","scheduler","eventTimeline","telemetry","updateQueue","const","EcsToolNodeType","FlowEcsToolNodesProps","nodes","FlowEcsToolNodes","t0","$","_c","t1","undefined","nodeFactory","addNodes","_temp","bridge","t2","t3","nodesToAdd","forEach","type","index","ecsFlowRepository","getToolNode","node","createNodeFromType","position","x","y","addToolNode","push","length","t4","Symbol","for","state","FlowAutoLayout","memo","useEffect","useState","useBridgeStoreVersion","useEcsBridge","FlowEcsEntities","FlowEcsModules","FlowEcsScopes","FlowEcsSpawnEntities","FlowEcsToolNodes","EcsToolNodeType","FlowEcsStateProps","showSystemModules","showEntities","autoLayout","enableEntitySpawning","showScopes","toolNodes","FlowEcsState","props","$","_c","refreshLayout","setRefreshLayout","bridge","entityVersion","moduleVersion","t0","Symbol","for","frame","requestAnimationFrame","cancelAnimationFrame","t1","ecsFlowRepository","sizeNodes","t2","t3","t4","t5","t6","Array","isArray","undefined","t7","t8","FlowCanvasContext","FlowCanvasDropWrapper","FlowCanvasRenderIntersections","FlowCanvasWrapper","FlowConnectionStatus","FlowEdgesSelection","FlowTemplatesList","Portal","useState","ecsNodeTemplates","ecsNodeTypes","FlowEcsState","FlowEcsStateProps","useEntityTypeTemplates","FlowEcsCanvasProps","Partial","enableDragDrop","showEntityTypeTemplates","showTemplates","FlowEcsCanvas","t0","$","_c","autoLayout","t1","enableEntitySpawning","t2","t3","showEntities","t4","t5","showScopes","t6","showSystemModules","t7","t8","toolNodes","t9","undefined","over","setOver","entityTypeTemplates","t10","canvas","t11","t12","t13","Symbol","for","t14","t15","t16"],"sources":["../src/flow/flow-ecs-edge-modules.tsx","../src/flow/flow-ecs-edge-proxies.tsx","../src/flow/flow-ecs-entities.tsx","../src/flow/flow-ecs-modules.tsx","../src/flow/flow-ecs-scopes.tsx","../src/flow/flow-ecs-spawn-entities.tsx","../src/flow/flow-ecs-tool-nodes.tsx","../src/flow/flow-ecs-state.tsx","../src/canvas/flow-ecs-canvas.tsx"],"sourcesContent":["import { useFlowStore } from '@awesome-flow/core/hooks';\nimport { Node } from '@xyflow/react';\nimport { useEffect } from 'react';\nimport { EntityNodeData } from '../abstract/node-props';\nimport { useBridgeStoreVersion, useEcsBridge } from '../hooks';\n\nexport type FlowEcsEdgeProxiesProps = {\n nodesToConnect: Node<EntityNodeData>[];\n};\n\nfunction FlowEcsEdgeModules(props: Readonly<FlowEcsEdgeProxiesProps>) {\n const { nodesToConnect } = props;\n\n const onConnect = useFlowStore((state: { onConnect: any }) => state.onConnect);\n\n const bridge = useEcsBridge();\n const moduleVersion = useBridgeStoreVersion('modules');\n\n useEffect(() => {\n for (const node of nodesToConnect) {\n if (!node.data.entity) {\n continue;\n }\n\n const sourceHandle = node.data.handles.find((h) => h.connection === 'source');\n const entity = bridge.entityRepository.get(node.data.entity);\n\n const systemModule = bridge.ecsFlowRepository.getSystemModuleNode(entity.myProxy.entityType);\n const targetHandle = systemModule?.data.handles.find((h) => h.connection === 'target');\n\n if (sourceHandle && targetHandle) {\n onConnect({\n source: node.id,\n target: systemModule.id,\n sourceHandle: sourceHandle.handleId,\n targetHandle: targetHandle.handleId\n });\n }\n }\n }, [bridge, moduleVersion, nodesToConnect, onConnect]);\n\n return <></>;\n}\n\nexport default FlowEcsEdgeModules;\n","import { useFlowStore } from '@awesome-flow/core/hooks';\nimport { Node } from '@xyflow/react';\nimport { useEffect } from 'react';\nimport { EntityNodeData } from '../abstract/node-props';\nimport { useBridgeStoreVersion, useEcsBridge } from '../hooks';\n\nexport type FlowEcsEdgeProxiesProps = {\n nodesToConnect: Node<EntityNodeData>[];\n};\n\nfunction FlowEcsEdgeProxies(props: Readonly<FlowEcsEdgeProxiesProps>) {\n const { nodesToConnect } = props;\n\n const onConnect = useFlowStore((state: { onConnect: any }) => state.onConnect);\n\n const bridge = useEcsBridge();\n const proxyVersion = useBridgeStoreVersion('proxies');\n\n useEffect(() => {\n for (const node of nodesToConnect) {\n if (!node.data.entity) {\n continue;\n }\n\n const sourceHandle = node.data.handles.find((h) => h.connection === 'source');\n const entity = bridge.entityRepository.get(node.data.entity);\n const proxies = Array.from(bridge.entityProxyRepository.getAll(entity.myProxy).values()).flat();\n\n for (const proxy of proxies) {\n const proxyNode = bridge.ecsFlowRepository.getEntityNode(proxy);\n\n if (proxyNode) {\n const targetHandle = proxyNode.data.handles.find((h) => h.connection === 'target');\n\n if (sourceHandle && targetHandle) {\n onConnect({\n source: node.id,\n target: proxyNode.id,\n sourceHandle: sourceHandle.handleId,\n targetHandle: targetHandle.handleId\n });\n }\n }\n }\n }\n }, [bridge, nodesToConnect, onConnect, proxyVersion]);\n\n return <></>;\n}\n\nexport default FlowEcsEdgeProxies;\n","import { FlowContext } from '@awesome-flow/core/abstract';\nimport { useFlowStore } from '@awesome-flow/core/hooks';\nimport { Node } from '@xyflow/react';\nimport { useContext, useEffect, useState } from 'react';\nimport { EntityNodeData } from '../abstract/node-props';\nimport { EcsNodeType } from '../abstract/node-types';\nimport { useEcsBridge, useEntityList } from '../hooks';\nimport FlowEcsEdgeModules from './flow-ecs-edge-modules';\nimport FlowEcsEdgeProxies from './flow-ecs-edge-proxies';\n\nfunction FlowEcsEntities() {\n const { nodeFactory } = useContext(FlowContext);\n const addNodes = useFlowStore((state) => state.addNodes);\n\n const bridge = useEcsBridge();\n const entities = useEntityList();\n const [entityNodes, setEntityNodes] = useState<Node<EntityNodeData>[]>([]);\n\n useEffect(() => {\n const nodesToAdd: Node<EntityNodeData>[] = [];\n const nodesToConnect: Node<EntityNodeData>[] = [];\n\n for (const entity of entities) {\n let node = bridge.ecsFlowRepository.getEntityNode(entity.myProxy);\n\n if (!node) {\n node = nodeFactory.createNodeFromType<EntityNodeData>(EcsNodeType.entity);\n node.data.entity = entity.myProxy;\n node.data.entityType = entity.myProxy.entityType;\n node.position = { x: 0, y: 0 };\n\n bridge.ecsFlowRepository.addEntityNode(node);\n nodesToAdd.push(node);\n }\n\n nodesToConnect.push(node);\n }\n\n setEntityNodes(nodesToConnect);\n if (nodesToAdd.length) {\n addNodes(nodesToAdd);\n }\n }, [addNodes, bridge, entities, nodeFactory]);\n\n return (\n <>\n <FlowEcsEdgeProxies nodesToConnect={entityNodes} />\n <FlowEcsEdgeModules nodesToConnect={entityNodes} />\n </>\n );\n}\n\nexport default FlowEcsEntities;\n","import { FlowContext } from '@awesome-flow/core/abstract';\nimport { useFlowStore } from '@awesome-flow/core/hooks';\nimport { Node } from '@xyflow/react';\nimport { useContext, useEffect } from 'react';\nimport { SystemsModuleNodeData } from '../abstract/node-props';\nimport { EcsNodeType } from '../abstract/node-types';\nimport { useEcsBridge, useSystemsModuleList } from '../hooks';\n\nfunction FlowEcsModules() {\n const { nodeFactory } = useContext(FlowContext);\n const addNodes = useFlowStore((state) => state.addNodes);\n\n const bridge = useEcsBridge();\n const modules = useSystemsModuleList();\n\n useEffect(() => {\n const keys = Array.from(modules.keys());\n\n const nodesToAdd: Node<SystemsModuleNodeData>[] = [];\n\n for (const element of keys) {\n if (bridge.ecsFlowRepository.getSystemModuleNode(element)) {\n continue;\n }\n\n const node = nodeFactory.createNodeFromType<SystemsModuleNodeData>(EcsNodeType.systemsModule);\n\n node.data.entityType = element;\n node.position = { x: 0, y: 0 };\n\n bridge.ecsFlowRepository.addSystemModuleNode(node);\n nodesToAdd.push(node);\n }\n\n if (nodesToAdd.length) {\n addNodes(nodesToAdd);\n }\n }, [addNodes, bridge, modules, nodeFactory]);\n\n return <></>;\n}\n\nexport default FlowEcsModules;\n","import { FlowContext, StoreContext } from '@awesome-flow/core/abstract';\nimport { useFlowStore } from '@awesome-flow/core/hooks';\nimport { Node } from '@xyflow/react';\nimport { useContext, useEffect } from 'react';\nimport { shallow } from 'zustand/shallow';\nimport { EntityNodeData, ScopeGroupNodeData } from '../abstract/node-props';\nimport { EcsNodeType } from '../abstract/node-types';\nimport { useEcsBridge, useScopeList } from '../hooks';\n\nfunction FlowEcsScopes() {\n const { nodeFactory } = useContext(FlowContext);\n const { flowStore } = useContext(StoreContext);\n const bridge = useEcsBridge();\n const scopes = useScopeList();\n\n const { nodes, setGroups, setNodes } = useFlowStore(\n (state) => ({\n nodes: state.nodes,\n setGroups: state.setGroups,\n setNodes: state.setNodes\n }),\n shallow\n );\n\n useEffect(() => {\n if (!scopes.length) {\n return;\n }\n\n let changed = false;\n const currentNodes = flowStore.instance.getState().nodes;\n const nextNodes = [...currentNodes];\n const groups: Record<string, string[]> = {};\n\n for (const scope of scopes) {\n let groupNode = bridge.ecsFlowRepository.getScopeGroupNode(scope.scopeId);\n\n if (!groupNode) {\n groupNode = nodeFactory.createNodeFromType<ScopeGroupNodeData>(EcsNodeType.scopeGroup);\n groupNode.data.scopeId = scope.scopeId;\n groupNode.data.title = 'Scope';\n groupNode.position = { x: 0, y: 0 };\n groupNode.className = 'react-flow__node-group';\n\n bridge.ecsFlowRepository.addScopeGroupNode(groupNode);\n nextNodes.unshift(groupNode);\n changed = true;\n }\n\n const childIds: string[] = [];\n for (const entity of scope.entities) {\n const entityNode = bridge.ecsFlowRepository.getEntityNode(entity.myProxy) as Node<EntityNodeData> | undefined;\n if (!entityNode) {\n continue;\n }\n\n childIds.push(entityNode.id);\n }\n\n groups[groupNode.id] = childIds;\n }\n\n const scopedNodeIds = new Set(Object.values(groups).flat());\n const groupIds = new Set(Object.keys(groups));\n const orderedNodes = nextNodes\n .map((node) => {\n if (groupIds.has(node.id)) {\n return node;\n }\n\n if (node.type !== EcsNodeType.entity) {\n return node;\n }\n\n const parentId = scopedNodeIds.has(node.id)\n ? Object.entries(groups).find(([, children]) => children.includes(node.id))?.[0]\n : undefined;\n\n if (node.parentId !== parentId) {\n changed = true;\n return {\n ...node,\n extent: parentId ? ('parent' as const) : undefined,\n parentId\n };\n }\n\n return node;\n })\n .sort((a, b) => Number(!a.data?.isGroup) - Number(!b.data?.isGroup));\n\n if (changed) {\n setNodes(orderedNodes);\n }\n\n setGroups(groups);\n }, [bridge, flowStore, nodeFactory, nodes, scopes, setGroups, setNodes]);\n\n return <></>;\n}\n\nexport default FlowEcsScopes;\n","import { useFlowStore } from '@awesome-flow/core/hooks';\nimport { FlowState } from '@awesome-flow/core/stores';\nimport { Node } from '@xyflow/react';\nimport { useEffect } from 'react';\nimport { shallow } from 'zustand/shallow';\nimport { EntityNodeData } from '../abstract/node-props';\nimport { EcsNodeType } from '../abstract/node-types';\nimport { useEcsBridge } from '../hooks';\n\nconst selector = (state: FlowState) => ({\n nodes: state.nodes,\n updateNodeData: state.updateNodeData\n});\n\nfunction FlowEcsSpawnEntities() {\n const bridge = useEcsBridge();\n const { nodes, updateNodeData } = useFlowStore(selector, shallow);\n\n useEffect(() => {\n for (const node of nodes as Node<EntityNodeData>[]) {\n if (node.type !== EcsNodeType.entity || !node.data.spawn || node.data.entity) {\n continue;\n }\n\n const update = bridge.enqueueEntitySpawn(node.data.spawn);\n if (!update) {\n updateNodeData<EntityNodeData>(node.id, {\n spawnStatus: 'missing-queue'\n });\n continue;\n }\n\n const data: Partial<EntityNodeData> = {\n entity: update.entity,\n entityType: update.entity.entityType,\n spawnStatus: 'queued'\n };\n\n bridge.ecsFlowRepository.addEntityNode({\n ...node,\n data: {\n ...node.data,\n ...data\n }\n });\n updateNodeData<EntityNodeData>(node.id, data);\n }\n }, [bridge, nodes, updateNodeData]);\n\n return <></>;\n}\n\nexport default FlowEcsSpawnEntities;\n","import { FlowContext } from '@awesome-flow/core/abstract';\nimport { useFlowStore } from '@awesome-flow/core/hooks';\nimport { Node } from '@xyflow/react';\nimport { useContext, useEffect } from 'react';\nimport { EcsToolNodeData } from '../abstract/node-props';\nimport { EcsNodeType } from '../abstract/node-types';\nimport { useEcsBridge } from '../hooks';\n\nexport const defaultEcsToolNodes = [\n EcsNodeType.scheduler,\n EcsNodeType.eventTimeline,\n EcsNodeType.telemetry,\n EcsNodeType.updateQueue\n] as const;\n\nexport type EcsToolNodeType = (typeof defaultEcsToolNodes)[number];\n\nexport type FlowEcsToolNodesProps = {\n nodes?: readonly EcsToolNodeType[];\n};\n\nfunction FlowEcsToolNodes({ nodes = defaultEcsToolNodes }: Readonly<FlowEcsToolNodesProps>) {\n const { nodeFactory } = useContext(FlowContext);\n const addNodes = useFlowStore((state) => state.addNodes);\n const bridge = useEcsBridge();\n\n useEffect(() => {\n const nodesToAdd: Node<EcsToolNodeData>[] = [];\n\n nodes.forEach((type, index) => {\n if (bridge.ecsFlowRepository.getToolNode(type)) {\n return;\n }\n\n const node = nodeFactory.createNodeFromType<EcsToolNodeData>(type);\n node.position = { x: 980, y: index * 220 };\n bridge.ecsFlowRepository.addToolNode(node);\n nodesToAdd.push(node);\n });\n\n if (nodesToAdd.length) {\n addNodes(nodesToAdd);\n }\n }, [addNodes, bridge, nodeFactory, nodes]);\n\n return <></>;\n}\n\nexport default FlowEcsToolNodes;\n","import { FlowAutoLayout } from '@awesome-flow/core/canvas';\nimport { memo, useEffect, useState } from 'react';\nimport { useBridgeStoreVersion, useEcsBridge } from '../hooks';\nimport FlowEcsEntities from './flow-ecs-entities';\nimport FlowEcsModules from './flow-ecs-modules';\nimport FlowEcsScopes from './flow-ecs-scopes';\nimport FlowEcsSpawnEntities from './flow-ecs-spawn-entities';\nimport FlowEcsToolNodes, { EcsToolNodeType } from './flow-ecs-tool-nodes';\n\nexport type FlowEcsStateProps = {\n showSystemModules: boolean;\n showEntities: boolean;\n autoLayout: boolean;\n enableEntitySpawning?: boolean;\n showScopes?: boolean;\n toolNodes?: boolean | readonly EcsToolNodeType[];\n};\n\nfunction FlowEcsState(props: Readonly<FlowEcsStateProps>) {\n const [refreshLayout, setRefreshLayout] = useState(false);\n const bridge = useEcsBridge();\n const entityVersion = useBridgeStoreVersion('entities');\n const moduleVersion = useBridgeStoreVersion('modules');\n\n useEffect(() => {\n setRefreshLayout(false);\n const frame = requestAnimationFrame(() => setRefreshLayout(true));\n\n return () => cancelAnimationFrame(frame);\n }, [bridge.ecsFlowRepository.sizeNodes, entityVersion, moduleVersion]);\n\n return (\n <>\n {props.showSystemModules && <FlowEcsModules />}\n {props.showEntities && <FlowEcsEntities />}\n {props.enableEntitySpawning && <FlowEcsSpawnEntities />}\n {props.showScopes && <FlowEcsScopes />}\n {props.toolNodes && <FlowEcsToolNodes nodes={Array.isArray(props.toolNodes) ? props.toolNodes : undefined} />}\n {props.autoLayout && <FlowAutoLayout refreshLayout={refreshLayout} />}\n </>\n );\n}\n\nexport default memo(FlowEcsState);\n","import {\n FlowCanvasContext,\n FlowCanvasDropWrapper,\n FlowCanvasRenderIntersections,\n FlowCanvasWrapper,\n FlowConnectionStatus,\n FlowEdgesSelection,\n FlowTemplatesList\n} from '@awesome-flow/core/canvas';\nimport { Portal } from '@mantine/core';\nimport { useState } from 'react';\nimport { ecsNodeTemplates, ecsNodeTypes } from '../abstract/node-types';\nimport FlowEcsState, { FlowEcsStateProps } from '../flow/flow-ecs-state';\nimport { useEntityTypeTemplates } from '../hooks';\n\nexport type FlowEcsCanvasProps = Partial<FlowEcsStateProps> & {\n enableDragDrop?: boolean;\n showEntityTypeTemplates?: boolean;\n showTemplates?: boolean;\n};\n\nexport function FlowEcsCanvas({\n autoLayout = true,\n enableEntitySpawning = true,\n enableDragDrop = true,\n showEntities = true,\n showEntityTypeTemplates = true,\n showScopes = true,\n showSystemModules = true,\n showTemplates = false,\n toolNodes = false\n}: Readonly<FlowEcsCanvasProps>) {\n const [over, setOver] = useState(false);\n const entityTypeTemplates = useEntityTypeTemplates(showEntityTypeTemplates);\n const canvas = <FlowCanvasRenderIntersections canvasHighlighted={over} nodeTypes={ecsNodeTypes} />;\n\n return (\n <FlowCanvasContext nodeTemplates={ecsNodeTemplates}>\n {enableDragDrop ? (\n <FlowCanvasDropWrapper setOver={setOver}>{canvas}</FlowCanvasDropWrapper>\n ) : (\n <FlowCanvasWrapper>{canvas}</FlowCanvasWrapper>\n )}\n <FlowEdgesSelection />\n <FlowConnectionStatus />\n <FlowEcsState\n autoLayout={autoLayout}\n enableEntitySpawning={enableEntitySpawning}\n showEntities={showEntities}\n showScopes={showScopes}\n showSystemModules={showSystemModules}\n toolNodes={toolNodes}\n />\n {showTemplates && (\n <Portal target=\"#portal-navbar\">\n <FlowTemplatesList extraTemplates={entityTypeTemplates} nodeTypes={ecsNodeTypes} />\n </Portal>\n )}\n </FlowCanvasContext>\n );\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAAQ,mBAAAC,OAAA;CAAA,MAAAC,kCAAA,EAAA;CACE,MAAA,EAAAH,mBAA2BE;CAE3B,MAAAG,uDAA+BC,OAA8C;CAE7E,MAAAC,SAAeT,gCAAa;CAC5B,MAAAU,gBAAsBX,yCAAsB,SAAS;C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AA5B,EAAA,MAAA6B;EAAA7B,EAAA,MAAA8B;CAAA,OAAAA,MAAA9B,EAAA;CAAA,OArBpB8B;AAqBoB"}
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_id_generator = require('../id-generator-C2_8g29M.cjs');
|
|
3
|
+
let react_compiler_runtime = require("react/compiler-runtime");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let _awesome_ecs_abstract_systems = require("@awesome-ecs/abstract/systems");
|
|
6
|
+
let _awesome_ecs_abstract_entities = require("@awesome-ecs/abstract/entities");
|
|
7
|
+
let _awesome_ecs_abstract_factories = require("@awesome-ecs/abstract/factories");
|
|
8
|
+
|
|
9
|
+
//#region src/context/ecs-flow-repository.ts
|
|
10
|
+
var EcsFlowRepository = class {
|
|
11
|
+
nodes;
|
|
12
|
+
constructor() {
|
|
13
|
+
this.nodes = /* @__PURE__ */ new Map();
|
|
14
|
+
}
|
|
15
|
+
get sizeNodes() {
|
|
16
|
+
return this.nodes.size;
|
|
17
|
+
}
|
|
18
|
+
addSystemModuleNode(node) {
|
|
19
|
+
this.nodes.set(node.data.entityType.toString(), node);
|
|
20
|
+
}
|
|
21
|
+
getSystemModuleNode(entityType) {
|
|
22
|
+
return this.nodes.get(entityType.toString());
|
|
23
|
+
}
|
|
24
|
+
addScopeGroupNode(node) {
|
|
25
|
+
this.nodes.set(require_id_generator.EcsIdGenerator.scope(node.data.scopeId), node);
|
|
26
|
+
}
|
|
27
|
+
getScopeGroupNode(scopeId) {
|
|
28
|
+
return this.nodes.get(require_id_generator.EcsIdGenerator.scope(scopeId));
|
|
29
|
+
}
|
|
30
|
+
addEntityNode(node) {
|
|
31
|
+
if (!node.data.entity) return;
|
|
32
|
+
this.nodes.set(require_id_generator.EcsIdGenerator.entityProxy(node.data.entity), node);
|
|
33
|
+
}
|
|
34
|
+
getEntityNode(entity) {
|
|
35
|
+
return this.nodes.get(require_id_generator.EcsIdGenerator.entityProxy(entity));
|
|
36
|
+
}
|
|
37
|
+
addToolNode(node) {
|
|
38
|
+
this.nodes.set(require_id_generator.EcsIdGenerator.tool(node.type), node);
|
|
39
|
+
}
|
|
40
|
+
getToolNode(type) {
|
|
41
|
+
return this.nodes.get(require_id_generator.EcsIdGenerator.tool(type));
|
|
42
|
+
}
|
|
43
|
+
listAllNodes() {
|
|
44
|
+
return Array.from(this.nodes.values());
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/context/ecs-bridge.ts
|
|
50
|
+
const INSTRUMENTATION = Symbol.for("@awesome-flow/ecs.bridge.instrumentation");
|
|
51
|
+
function createVersionStore() {
|
|
52
|
+
let version = 0;
|
|
53
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
54
|
+
return {
|
|
55
|
+
getSnapshot: () => version,
|
|
56
|
+
notify: () => {
|
|
57
|
+
version += 1;
|
|
58
|
+
for (const listener of listeners) listener();
|
|
59
|
+
},
|
|
60
|
+
subscribe: (listener) => {
|
|
61
|
+
listeners.add(listener);
|
|
62
|
+
return () => listeners.delete(listener);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function notifyInstrumentedListeners(listeners, args, result) {
|
|
67
|
+
for (const listener of Array.from(listeners)) listener(args, result);
|
|
68
|
+
}
|
|
69
|
+
function instrumentMethod(target, methodName, listener) {
|
|
70
|
+
if (!target) return () => void 0;
|
|
71
|
+
const mutableTarget = target;
|
|
72
|
+
const method = mutableTarget[methodName];
|
|
73
|
+
if (typeof method !== "function") return () => void 0;
|
|
74
|
+
let instrumented = method;
|
|
75
|
+
if (!instrumented[INSTRUMENTATION]) {
|
|
76
|
+
const original = method;
|
|
77
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
78
|
+
instrumented = function bridgeInstrumentedMethod(...args) {
|
|
79
|
+
const result = original.apply(this, args);
|
|
80
|
+
const maybePromise = result;
|
|
81
|
+
if (maybePromise && typeof maybePromise.finally === "function") return maybePromise.finally(() => notifyInstrumentedListeners(listeners, args, result));
|
|
82
|
+
notifyInstrumentedListeners(listeners, args, result);
|
|
83
|
+
return result;
|
|
84
|
+
};
|
|
85
|
+
instrumented[INSTRUMENTATION] = {
|
|
86
|
+
listeners,
|
|
87
|
+
original
|
|
88
|
+
};
|
|
89
|
+
mutableTarget[methodName] = instrumented;
|
|
90
|
+
}
|
|
91
|
+
instrumented[INSTRUMENTATION].listeners.add(listener);
|
|
92
|
+
return () => {
|
|
93
|
+
instrumented[INSTRUMENTATION]?.listeners.delete(listener);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function isProxy(value) {
|
|
97
|
+
return !!value && typeof value === "object" && "entityType" in value && "entityUid" in value;
|
|
98
|
+
}
|
|
99
|
+
function sameProxy(a, b) {
|
|
100
|
+
return !!a && !!b && a.entityType === b.entityType && a.entityUid === b.entityUid;
|
|
101
|
+
}
|
|
102
|
+
function entityTypeKey(entityType) {
|
|
103
|
+
return entityType.toString();
|
|
104
|
+
}
|
|
105
|
+
function normalizeEntityTypeDescriptor(descriptor) {
|
|
106
|
+
return {
|
|
107
|
+
...descriptor,
|
|
108
|
+
id: descriptor.id ?? require_id_generator.EcsIdGenerator.entityType(descriptor.entityType)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function normalizePhase(phase) {
|
|
112
|
+
if (phase === void 0 || phase === null) return;
|
|
113
|
+
if (typeof phase === "number") return _awesome_ecs_abstract_systems.SystemType[phase];
|
|
114
|
+
return phase;
|
|
115
|
+
}
|
|
116
|
+
function entryMs(entry) {
|
|
117
|
+
if (entry.msPassed !== void 0) return entry.msPassed;
|
|
118
|
+
if (entry.endedAt !== void 0) return entry.endedAt - entry.startedAt;
|
|
119
|
+
}
|
|
120
|
+
function matchesMetric(entry, filter) {
|
|
121
|
+
if (!filter) return true;
|
|
122
|
+
if (filter.category && entry.category !== filter.category) return false;
|
|
123
|
+
const phase = normalizePhase(filter.phase)?.toString().toLowerCase();
|
|
124
|
+
if (phase && !entry.name.toLowerCase().includes(phase)) return false;
|
|
125
|
+
if (filter.entityType && entry.category !== _awesome_ecs_abstract_factories.PipelineCategory.system) {
|
|
126
|
+
const entityType = filter.entityType.toString().toLowerCase();
|
|
127
|
+
if (!entry.name.toLowerCase().includes(entityType)) return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
var EcsBridge = class {
|
|
132
|
+
ecsFlowRepository;
|
|
133
|
+
entityEventsManager;
|
|
134
|
+
entityProxyRepository;
|
|
135
|
+
entityRepository;
|
|
136
|
+
entityScheduler;
|
|
137
|
+
entityUpdateQueue;
|
|
138
|
+
performanceTimer;
|
|
139
|
+
stores;
|
|
140
|
+
systemsModuleRepository;
|
|
141
|
+
defaultScopeId;
|
|
142
|
+
entityTypeDescriptors = /* @__PURE__ */ new Map();
|
|
143
|
+
eventLogSize;
|
|
144
|
+
eventLog = [];
|
|
145
|
+
metricEntries = [];
|
|
146
|
+
scopedProxies = /* @__PURE__ */ new Map();
|
|
147
|
+
updateCounts = /* @__PURE__ */ new Map();
|
|
148
|
+
unsubscribeInstrumentation = [];
|
|
149
|
+
constructor(input) {
|
|
150
|
+
this.ecsFlowRepository = input.ecsFlowRepository ?? new EcsFlowRepository();
|
|
151
|
+
this.entityEventsManager = input.entityEventsManager;
|
|
152
|
+
this.entityProxyRepository = input.entityProxyRepository;
|
|
153
|
+
this.entityRepository = input.entityRepository;
|
|
154
|
+
this.entityScheduler = input.entityScheduler;
|
|
155
|
+
this.entityUpdateQueue = input.entityUpdateQueue;
|
|
156
|
+
this.defaultScopeId = input.defaultScopeId;
|
|
157
|
+
this.performanceTimer = input.performanceTimer;
|
|
158
|
+
this.systemsModuleRepository = input.systemsModuleRepository;
|
|
159
|
+
this.eventLogSize = input.eventLogSize ?? 250;
|
|
160
|
+
this.stores = {
|
|
161
|
+
entities: createVersionStore(),
|
|
162
|
+
entityTypes: createVersionStore(),
|
|
163
|
+
events: createVersionStore(),
|
|
164
|
+
metrics: createVersionStore(),
|
|
165
|
+
modules: createVersionStore(),
|
|
166
|
+
proxies: createVersionStore(),
|
|
167
|
+
queue: createVersionStore(),
|
|
168
|
+
scheduler: createVersionStore(),
|
|
169
|
+
scopes: createVersionStore(),
|
|
170
|
+
subscriptions: createVersionStore(),
|
|
171
|
+
updates: createVersionStore()
|
|
172
|
+
};
|
|
173
|
+
for (const descriptor of input.entityTypeDescriptors ?? []) {
|
|
174
|
+
const normalized = normalizeEntityTypeDescriptor(descriptor);
|
|
175
|
+
this.entityTypeDescriptors.set(normalized.id, normalized);
|
|
176
|
+
}
|
|
177
|
+
this.instrumentRepositories();
|
|
178
|
+
}
|
|
179
|
+
dispose() {
|
|
180
|
+
for (const unsubscribe of this.unsubscribeInstrumentation.splice(0)) unsubscribe();
|
|
181
|
+
}
|
|
182
|
+
getEntityUpdateCounts(target) {
|
|
183
|
+
const entityUid = isProxy(target) ? target.entityUid : target;
|
|
184
|
+
return this.updateCounts.get(entityUid) ?? {
|
|
185
|
+
removes: 0,
|
|
186
|
+
updates: 0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
getEntitiesInScope(scopeId) {
|
|
190
|
+
return Array.from(this.entityRepository.listAll()).filter((entity) => entity.identity?.model?.scopeId === scopeId);
|
|
191
|
+
}
|
|
192
|
+
getEntityTypeDescriptor(idOrEntityType) {
|
|
193
|
+
const key = idOrEntityType.toString();
|
|
194
|
+
return this.entityTypeDescriptors.get(key) ?? Array.from(this.entityTypeDescriptors.values()).find((descriptor) => entityTypeKey(descriptor.entityType) === key);
|
|
195
|
+
}
|
|
196
|
+
getEntityTypeDescriptors() {
|
|
197
|
+
const descriptors = /* @__PURE__ */ new Map();
|
|
198
|
+
const explicitEntityTypes = /* @__PURE__ */ new Set();
|
|
199
|
+
for (const descriptor of this.entityTypeDescriptors.values()) {
|
|
200
|
+
descriptors.set(descriptor.id, descriptor);
|
|
201
|
+
explicitEntityTypes.add(entityTypeKey(descriptor.entityType));
|
|
202
|
+
}
|
|
203
|
+
for (const entityType of this.systemsModuleRepository.list().keys()) if (!explicitEntityTypes.has(entityTypeKey(entityType))) {
|
|
204
|
+
const descriptor = normalizeEntityTypeDescriptor({ entityType });
|
|
205
|
+
descriptors.set(descriptor.id, descriptor);
|
|
206
|
+
}
|
|
207
|
+
for (const entity of this.entityRepository.listAll()) {
|
|
208
|
+
const { entityType } = entity.myProxy;
|
|
209
|
+
if (!explicitEntityTypes.has(entityTypeKey(entityType))) {
|
|
210
|
+
const descriptor = normalizeEntityTypeDescriptor({ entityType });
|
|
211
|
+
descriptors.set(descriptor.id, descriptor);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return Array.from(descriptors.values()).sort((a, b) => a.entityType.toString().localeCompare(b.entityType.toString()));
|
|
215
|
+
}
|
|
216
|
+
registerEntityTypeDescriptor(descriptor) {
|
|
217
|
+
const normalized = normalizeEntityTypeDescriptor(descriptor);
|
|
218
|
+
this.entityTypeDescriptors.set(normalized.id, normalized);
|
|
219
|
+
this.stores.entityTypes.notify();
|
|
220
|
+
return normalized;
|
|
221
|
+
}
|
|
222
|
+
getScopes() {
|
|
223
|
+
const entitiesByScope = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const entity of this.entityRepository.listAll()) {
|
|
225
|
+
const scopeId = entity.identity?.model?.scopeId;
|
|
226
|
+
if (!scopeId) continue;
|
|
227
|
+
const entities = entitiesByScope.get(scopeId) ?? [];
|
|
228
|
+
entities.push(entity);
|
|
229
|
+
entitiesByScope.set(scopeId, entities);
|
|
230
|
+
}
|
|
231
|
+
for (const scopeId of this.scopedProxies.keys()) if (!entitiesByScope.has(scopeId)) entitiesByScope.set(scopeId, []);
|
|
232
|
+
return Array.from(entitiesByScope.entries()).map(([scopeId, entities]) => ({
|
|
233
|
+
scopeId,
|
|
234
|
+
entities,
|
|
235
|
+
scopedProxies: this.scopedProxies.get(scopeId) ?? /* @__PURE__ */ new Map()
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
getEventStream(filter) {
|
|
239
|
+
const entries = this.eventLog.filter((entry) => {
|
|
240
|
+
if (filter?.type !== void 0 && entry.event.data.uid !== filter.type) return false;
|
|
241
|
+
if (filter?.scopeId && entry.event.scopeId !== filter.scopeId) return false;
|
|
242
|
+
if (filter?.source && !sameProxy(entry.event.origin, filter.source)) return false;
|
|
243
|
+
if (filter?.target) {
|
|
244
|
+
if (!(entry.event.target ? [entry.event.target] : entry.targets).some((target) => sameProxy(target, filter.target))) return false;
|
|
245
|
+
}
|
|
246
|
+
return true;
|
|
247
|
+
});
|
|
248
|
+
return filter?.limit ? entries.slice(-filter.limit) : entries;
|
|
249
|
+
}
|
|
250
|
+
getMetricEntries(filter) {
|
|
251
|
+
return (this.performanceTimer?.metrics ? Array.from(this.performanceTimer.metrics.values()).flat() : this.metricEntries).filter((entry) => matchesMetric(entry, filter));
|
|
252
|
+
}
|
|
253
|
+
getMiddlewareMetrics(filter) {
|
|
254
|
+
const summaries = /* @__PURE__ */ new Map();
|
|
255
|
+
for (const entry of this.getMetricEntries(filter)) {
|
|
256
|
+
const ms = entryMs(entry);
|
|
257
|
+
if (ms === void 0) continue;
|
|
258
|
+
const category = entry.category ?? _awesome_ecs_abstract_factories.PipelineCategory.system;
|
|
259
|
+
const key = `${category}:${entry.name}`;
|
|
260
|
+
const existing = summaries.get(key);
|
|
261
|
+
if (existing) {
|
|
262
|
+
existing.count += 1;
|
|
263
|
+
existing.totalMs += ms;
|
|
264
|
+
existing.avgMs = existing.totalMs / existing.count;
|
|
265
|
+
existing.minMs = Math.min(existing.minMs, ms);
|
|
266
|
+
existing.maxMs = Math.max(existing.maxMs, ms);
|
|
267
|
+
existing.lastMs = ms;
|
|
268
|
+
} else summaries.set(key, {
|
|
269
|
+
name: entry.name,
|
|
270
|
+
category,
|
|
271
|
+
count: 1,
|
|
272
|
+
totalMs: ms,
|
|
273
|
+
avgMs: ms,
|
|
274
|
+
minMs: ms,
|
|
275
|
+
maxMs: ms,
|
|
276
|
+
lastMs: ms
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return Array.from(summaries.values()).sort((a, b) => b.totalMs - a.totalMs);
|
|
280
|
+
}
|
|
281
|
+
getPipelineMetrics(entityType, phase) {
|
|
282
|
+
const samples = this.getMetricEntries({
|
|
283
|
+
category: _awesome_ecs_abstract_factories.PipelineCategory.module,
|
|
284
|
+
entityType,
|
|
285
|
+
phase
|
|
286
|
+
}).map(entryMs).filter((ms) => ms !== void 0);
|
|
287
|
+
if (!samples.length) return;
|
|
288
|
+
const totalMs = samples.reduce((sum, ms) => sum + ms, 0);
|
|
289
|
+
return {
|
|
290
|
+
name: [entityType, normalizePhase(phase)].filter(Boolean).join(":") || "pipeline",
|
|
291
|
+
count: samples.length,
|
|
292
|
+
totalMs,
|
|
293
|
+
avgMs: totalMs / samples.length,
|
|
294
|
+
minMs: Math.min(...samples),
|
|
295
|
+
maxMs: Math.max(...samples),
|
|
296
|
+
lastMs: samples[samples.length - 1],
|
|
297
|
+
samples
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
getSchedulerSnapshot() {
|
|
301
|
+
if (!this.entityScheduler) return;
|
|
302
|
+
return {
|
|
303
|
+
frameSubscriptions: Array.from(this.entityScheduler.frameSubscriptions),
|
|
304
|
+
isPaused: this.entityScheduler.isPaused,
|
|
305
|
+
pendingCount: this.entityScheduler.pendingCount,
|
|
306
|
+
schedules: Array.from(this.entityScheduler.schedules),
|
|
307
|
+
skippedEntityTypes: Array.from(this.entityScheduler.skippedEntityTypes)
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
getUpdateQueueSnapshot(limit) {
|
|
311
|
+
if (!this.entityUpdateQueue) return;
|
|
312
|
+
const items = this.entityUpdateQueue.items();
|
|
313
|
+
return {
|
|
314
|
+
items: limit ? items.slice(-limit) : items,
|
|
315
|
+
size: this.entityUpdateQueue.size
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
createEntitySpawnUpdate(spawn) {
|
|
319
|
+
const descriptor = spawn.descriptorId ? this.getEntityTypeDescriptor(spawn.descriptorId) : this.getEntityTypeDescriptor(spawn.entityType);
|
|
320
|
+
const entityType = descriptor?.entityType ?? spawn.entityType;
|
|
321
|
+
const uid = spawn.uid ?? require_id_generator.EcsIdGenerator.entityUid(entityType);
|
|
322
|
+
const scopeId = spawn.scopeId ?? descriptor?.scopeId ?? this.defaultScopeId;
|
|
323
|
+
const modelInput = {
|
|
324
|
+
descriptor: descriptor ?? normalizeEntityTypeDescriptor({ entityType }),
|
|
325
|
+
entityType,
|
|
326
|
+
scopeId,
|
|
327
|
+
uid
|
|
328
|
+
};
|
|
329
|
+
const model = descriptor?.createModel?.(modelInput) ?? {
|
|
330
|
+
uid,
|
|
331
|
+
scopeId
|
|
332
|
+
};
|
|
333
|
+
const snapshot = descriptor?.createSnapshot?.(modelInput);
|
|
334
|
+
return {
|
|
335
|
+
type: _awesome_ecs_abstract_entities.EntityUpdateType.update,
|
|
336
|
+
entity: {
|
|
337
|
+
entityType,
|
|
338
|
+
entityUid: model.uid
|
|
339
|
+
},
|
|
340
|
+
model,
|
|
341
|
+
snapshot
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
enqueueEntitySpawn(spawn) {
|
|
345
|
+
if (!this.entityUpdateQueue) return;
|
|
346
|
+
const update = this.createEntitySpawnUpdate(spawn);
|
|
347
|
+
this.entityUpdateQueue.enqueue(update);
|
|
348
|
+
return update;
|
|
349
|
+
}
|
|
350
|
+
listSystemsModules() {
|
|
351
|
+
return this.systemsModuleRepository.list();
|
|
352
|
+
}
|
|
353
|
+
recordEvent(event, targets = []) {
|
|
354
|
+
this.eventLog.push({
|
|
355
|
+
event,
|
|
356
|
+
targets,
|
|
357
|
+
recordedAt: Date.now()
|
|
358
|
+
});
|
|
359
|
+
if (this.eventLog.length > this.eventLogSize) this.eventLog.splice(0, this.eventLog.length - this.eventLogSize);
|
|
360
|
+
this.stores.events.notify();
|
|
361
|
+
}
|
|
362
|
+
bumpUpdate(entityUid, key) {
|
|
363
|
+
const counts = this.updateCounts.get(entityUid) ?? {
|
|
364
|
+
removes: 0,
|
|
365
|
+
updates: 0
|
|
366
|
+
};
|
|
367
|
+
counts[key] += 1;
|
|
368
|
+
this.updateCounts.set(entityUid, counts);
|
|
369
|
+
this.stores.updates.notify();
|
|
370
|
+
}
|
|
371
|
+
instrumentRepositories() {
|
|
372
|
+
this.unsubscribeInstrumentation.push(instrumentMethod(this.entityRepository, "set", (args) => {
|
|
373
|
+
const entity = args[0];
|
|
374
|
+
if (entity?.myProxy) this.bumpUpdate(entity.myProxy.entityUid, "updates");
|
|
375
|
+
this.stores.entities.notify();
|
|
376
|
+
this.stores.entityTypes.notify();
|
|
377
|
+
this.stores.scopes.notify();
|
|
378
|
+
}), instrumentMethod(this.entityRepository, "delete", (args) => {
|
|
379
|
+
const proxy = args[0];
|
|
380
|
+
if (isProxy(proxy)) this.bumpUpdate(proxy.entityUid, "removes");
|
|
381
|
+
this.stores.entities.notify();
|
|
382
|
+
this.stores.entityTypes.notify();
|
|
383
|
+
this.stores.scopes.notify();
|
|
384
|
+
}), instrumentMethod(this.entityRepository, "clear", () => {
|
|
385
|
+
this.stores.entities.notify();
|
|
386
|
+
this.stores.entityTypes.notify();
|
|
387
|
+
this.stores.scopes.notify();
|
|
388
|
+
}), instrumentMethod(this.systemsModuleRepository, "set", () => {
|
|
389
|
+
this.stores.modules.notify();
|
|
390
|
+
this.stores.entityTypes.notify();
|
|
391
|
+
}), instrumentMethod(this.entityProxyRepository, "register", () => {
|
|
392
|
+
this.stores.proxies.notify();
|
|
393
|
+
}), instrumentMethod(this.entityProxyRepository, "registerMany", () => {
|
|
394
|
+
this.stores.proxies.notify();
|
|
395
|
+
}), instrumentMethod(this.entityProxyRepository, "remove", () => {
|
|
396
|
+
this.stores.proxies.notify();
|
|
397
|
+
}), instrumentMethod(this.entityProxyRepository, "removeAllFor", () => {
|
|
398
|
+
this.stores.proxies.notify();
|
|
399
|
+
}), instrumentMethod(this.entityProxyRepository, "setScopedProxy", (args) => {
|
|
400
|
+
const entity = args[0];
|
|
401
|
+
const scopeId = args[1];
|
|
402
|
+
if (isProxy(entity) && typeof scopeId === "string") {
|
|
403
|
+
const proxies = this.scopedProxies.get(scopeId) ?? /* @__PURE__ */ new Map();
|
|
404
|
+
proxies.set(entity.entityType, entity);
|
|
405
|
+
this.scopedProxies.set(scopeId, proxies);
|
|
406
|
+
}
|
|
407
|
+
this.stores.proxies.notify();
|
|
408
|
+
this.stores.scopes.notify();
|
|
409
|
+
}), instrumentMethod(this.entityProxyRepository, "removeScopedProxy", (args) => {
|
|
410
|
+
const entity = args[0];
|
|
411
|
+
const scopeId = args[1];
|
|
412
|
+
if (isProxy(entity) && typeof scopeId === "string") {
|
|
413
|
+
const proxies = this.scopedProxies.get(scopeId);
|
|
414
|
+
if ((proxies?.get(entity.entityType))?.entityUid === entity.entityUid) proxies.delete(entity.entityType);
|
|
415
|
+
if (proxies?.size === 0) this.scopedProxies.delete(scopeId);
|
|
416
|
+
}
|
|
417
|
+
this.stores.proxies.notify();
|
|
418
|
+
this.stores.scopes.notify();
|
|
419
|
+
}), instrumentMethod(this.entityEventsManager, "subscribe", () => {
|
|
420
|
+
this.stores.subscriptions.notify();
|
|
421
|
+
}), instrumentMethod(this.entityEventsManager, "unsubscribe", () => {
|
|
422
|
+
this.stores.subscriptions.notify();
|
|
423
|
+
}), instrumentMethod(this.entityEventsManager, "clearSubscriptions", () => {
|
|
424
|
+
this.stores.subscriptions.notify();
|
|
425
|
+
}), instrumentMethod(this.entityEventsManager, "clearSubscriptionsForEntity", () => {
|
|
426
|
+
this.stores.subscriptions.notify();
|
|
427
|
+
}), instrumentMethod(this.entityEventsManager, "clearSubscriptionsForEvent", () => {
|
|
428
|
+
this.stores.subscriptions.notify();
|
|
429
|
+
}), instrumentMethod(this.performanceTimer, "endTimer", (_args, result) => {
|
|
430
|
+
const entry = result;
|
|
431
|
+
if (!this.performanceTimer?.metrics && entry?.name) this.metricEntries.push(entry);
|
|
432
|
+
this.stores.metrics.notify();
|
|
433
|
+
}), instrumentMethod(this.entityScheduler, "schedule", () => {
|
|
434
|
+
this.stores.scheduler.notify();
|
|
435
|
+
}), instrumentMethod(this.entityScheduler, "remove", () => {
|
|
436
|
+
this.stores.scheduler.notify();
|
|
437
|
+
}), instrumentMethod(this.entityScheduler, "clear", () => {
|
|
438
|
+
this.stores.scheduler.notify();
|
|
439
|
+
}), instrumentMethod(this.entityScheduler, "skipEntityType", () => {
|
|
440
|
+
this.stores.scheduler.notify();
|
|
441
|
+
}), instrumentMethod(this.entityScheduler, "unskipEntityType", () => {
|
|
442
|
+
this.stores.scheduler.notify();
|
|
443
|
+
}), instrumentMethod(this.entityScheduler, "pause", () => {
|
|
444
|
+
this.stores.scheduler.notify();
|
|
445
|
+
}), instrumentMethod(this.entityScheduler, "resume", () => {
|
|
446
|
+
this.stores.scheduler.notify();
|
|
447
|
+
}), instrumentMethod(this.entityUpdateQueue, "enqueue", () => {
|
|
448
|
+
this.stores.queue.notify();
|
|
449
|
+
}), instrumentMethod(this.entityUpdateQueue, "dequeue", () => {
|
|
450
|
+
this.stores.queue.notify();
|
|
451
|
+
}), instrumentMethod(this.entityUpdateQueue, "clear", () => {
|
|
452
|
+
this.stores.queue.notify();
|
|
453
|
+
}));
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
function createEcsBridge(input) {
|
|
457
|
+
return new EcsBridge(input);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/context/ecs-canvas-provider.tsx
|
|
462
|
+
function EcsCanvasProvider(t0) {
|
|
463
|
+
const $ = (0, react_compiler_runtime.c)(7);
|
|
464
|
+
const { bridge, children, readOnly: t1, telemetryThresholdMs } = t0;
|
|
465
|
+
const readOnly = t1 === void 0 ? false : t1;
|
|
466
|
+
let t2;
|
|
467
|
+
if ($[0] !== bridge || $[1] !== readOnly || $[2] !== telemetryThresholdMs) {
|
|
468
|
+
t2 = Object.assign(bridge, {
|
|
469
|
+
readOnly,
|
|
470
|
+
telemetryThresholdMs
|
|
471
|
+
});
|
|
472
|
+
$[0] = bridge;
|
|
473
|
+
$[1] = readOnly;
|
|
474
|
+
$[2] = telemetryThresholdMs;
|
|
475
|
+
$[3] = t2;
|
|
476
|
+
} else t2 = $[3];
|
|
477
|
+
const value = t2;
|
|
478
|
+
let t3;
|
|
479
|
+
if ($[4] !== children || $[5] !== value) {
|
|
480
|
+
t3 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_id_generator.EcsFlowContext.Provider, {
|
|
481
|
+
value,
|
|
482
|
+
children
|
|
483
|
+
});
|
|
484
|
+
$[4] = children;
|
|
485
|
+
$[5] = value;
|
|
486
|
+
$[6] = t3;
|
|
487
|
+
} else t3 = $[6];
|
|
488
|
+
return t3;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
//#endregion
|
|
492
|
+
exports.EcsBridge = EcsBridge;
|
|
493
|
+
exports.EcsCanvasProvider = EcsCanvasProvider;
|
|
494
|
+
exports.EcsFlowContext = require_id_generator.EcsFlowContext;
|
|
495
|
+
exports.EcsFlowRepository = EcsFlowRepository;
|
|
496
|
+
exports.createEcsBridge = createEcsBridge;
|
|
497
|
+
//# sourceMappingURL=index.cjs.map
|