@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.
Files changed (85) hide show
  1. package/dist/canvas/index.cjs +5 -0
  2. package/dist/canvas/index.d.cts +2 -0
  3. package/dist/canvas/index.d.mts +2 -0
  4. package/dist/canvas/index.mjs +3 -0
  5. package/dist/canvas-C4nDXlkK.mjs +677 -0
  6. package/dist/canvas-C4nDXlkK.mjs.map +1 -0
  7. package/dist/canvas-DlWcWu05.cjs +688 -0
  8. package/dist/canvas-DlWcWu05.cjs.map +1 -0
  9. package/dist/context/index.cjs +497 -0
  10. package/dist/context/index.cjs.map +1 -0
  11. package/dist/context/index.d.cts +2 -0
  12. package/dist/context/index.d.mts +2 -0
  13. package/dist/context/index.mjs +492 -0
  14. package/dist/context/index.mjs.map +1 -0
  15. package/dist/entity-component-inspector-CNaN8Scf.mjs +79 -0
  16. package/dist/entity-component-inspector-CNaN8Scf.mjs.map +1 -0
  17. package/dist/entity-component-inspector-VlwcaUqy.cjs +90 -0
  18. package/dist/entity-component-inspector-VlwcaUqy.cjs.map +1 -0
  19. package/dist/hooks/index.cjs +19 -0
  20. package/dist/hooks/index.d.cts +2 -0
  21. package/dist/hooks/index.d.mts +2 -0
  22. package/dist/hooks/index.mjs +3 -0
  23. package/dist/id-generator-C2_8g29M.cjs +45 -0
  24. package/dist/id-generator-C2_8g29M.cjs.map +1 -0
  25. package/dist/id-generator-DDsv3NdX.mjs +34 -0
  26. package/dist/id-generator-DDsv3NdX.mjs.map +1 -0
  27. package/dist/index-B9WbxxFC.d.mts +67 -0
  28. package/dist/index-B9WbxxFC.d.mts.map +1 -0
  29. package/dist/index-BTs_8SY-.d.cts +20 -0
  30. package/dist/index-BTs_8SY-.d.cts.map +1 -0
  31. package/dist/index-C-TDFHpq.d.mts +54 -0
  32. package/dist/index-C-TDFHpq.d.mts.map +1 -0
  33. package/dist/index-CNCqWBLh.d.cts +54 -0
  34. package/dist/index-CNCqWBLh.d.cts.map +1 -0
  35. package/dist/index-CyeezgDI.d.mts +20 -0
  36. package/dist/index-CyeezgDI.d.mts.map +1 -0
  37. package/dist/index-D9zIjQH9.d.mts +1 -0
  38. package/dist/index-DCOd7jg-.d.mts +99 -0
  39. package/dist/index-DCOd7jg-.d.mts.map +1 -0
  40. package/dist/index-DGjpWDlm.d.cts +99 -0
  41. package/dist/index-DGjpWDlm.d.cts.map +1 -0
  42. package/dist/index-DLoAMD9J.d.cts +1 -0
  43. package/dist/index-YNgbjS9S.d.cts +159 -0
  44. package/dist/index-YNgbjS9S.d.cts.map +1 -0
  45. package/dist/index-_BgjSgkQ.d.mts +159 -0
  46. package/dist/index-_BgjSgkQ.d.mts.map +1 -0
  47. package/dist/index-t3_yRTa6.d.cts +67 -0
  48. package/dist/index-t3_yRTa6.d.cts.map +1 -0
  49. package/dist/index.cjs +55 -531
  50. package/dist/index.d.cts +9 -106
  51. package/dist/index.d.mts +9 -106
  52. package/dist/index.mjs +10 -520
  53. package/dist/inspectors/index.cjs +6 -0
  54. package/dist/inspectors/index.d.cts +2 -0
  55. package/dist/inspectors/index.d.mts +2 -0
  56. package/dist/inspectors/index.mjs +3 -0
  57. package/dist/node-props-BtAkmdqr.d.mts +45 -0
  58. package/dist/node-props-BtAkmdqr.d.mts.map +1 -0
  59. package/dist/node-props-DkuSwMA0.d.cts +45 -0
  60. package/dist/node-props-DkuSwMA0.d.cts.map +1 -0
  61. package/dist/node-systems-module-CPDV8u8O.d.mts +22 -0
  62. package/dist/node-systems-module-CPDV8u8O.d.mts.map +1 -0
  63. package/dist/node-systems-module-CzkoMbdF.d.cts +22 -0
  64. package/dist/node-systems-module-CzkoMbdF.d.cts.map +1 -0
  65. package/dist/node-types-BRcpbaeR.mjs +1604 -0
  66. package/dist/node-types-BRcpbaeR.mjs.map +1 -0
  67. package/dist/node-types-D_NfbsUT.cjs +1819 -0
  68. package/dist/node-types-D_NfbsUT.cjs.map +1 -0
  69. package/dist/nodes/index.cjs +10 -0
  70. package/dist/nodes/index.d.cts +3 -0
  71. package/dist/nodes/index.d.mts +3 -0
  72. package/dist/nodes/index.mjs +3 -0
  73. package/dist/template-tool-nodes-B7sT2iRc.d.cts +35 -0
  74. package/dist/template-tool-nodes-B7sT2iRc.d.cts.map +1 -0
  75. package/dist/template-tool-nodes-BwavFwMh.d.mts +35 -0
  76. package/dist/template-tool-nodes-BwavFwMh.d.mts.map +1 -0
  77. package/dist/templates/index.cjs +11 -0
  78. package/dist/templates/index.d.cts +2 -0
  79. package/dist/templates/index.d.mts +2 -0
  80. package/dist/templates/index.mjs +3 -0
  81. package/package.json +85 -25
  82. package/dist/index.cjs.map +0 -1
  83. package/dist/index.d.cts.map +0 -1
  84. package/dist/index.d.mts.map +0 -1
  85. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,5 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_canvas = require('../canvas-DlWcWu05.cjs');
3
+
4
+ exports.FlowEcsCanvas = require_canvas.FlowEcsCanvas;
5
+ exports.FlowEcsState = require_canvas.flow_ecs_state_default;
@@ -0,0 +1,2 @@
1
+ import { i as _default, n as FlowEcsCanvasProps, r as FlowEcsStateProps, t as FlowEcsCanvas } from "../index-DGjpWDlm.cjs";
2
+ export { FlowEcsCanvas, FlowEcsCanvasProps, _default as FlowEcsState, FlowEcsStateProps };
@@ -0,0 +1,2 @@
1
+ import { i as _default, n as FlowEcsCanvasProps, r as FlowEcsStateProps, t as FlowEcsCanvas } from "../index-DCOd7jg-.mjs";
2
+ export { FlowEcsCanvas, FlowEcsCanvasProps, _default as FlowEcsState, FlowEcsStateProps };
@@ -0,0 +1,3 @@
1
+ import { n as flow_ecs_state_default, t as FlowEcsCanvas } from "../canvas-C4nDXlkK.mjs";
2
+
3
+ export { FlowEcsCanvas, flow_ecs_state_default as FlowEcsState };
@@ -0,0 +1,677 @@
1
+ import { E as useEntityTypeTemplates, F as useBridgeStoreVersion, I as useEcsBridge, M as useEntityList, b as useScopeList, n as ecsNodeTemplates, r as ecsNodeTypes, t as EcsNodeType, y as useSystemsModuleList } from "./node-types-BRcpbaeR.mjs";
2
+ import { c } from "react/compiler-runtime";
3
+ import { FlowAutoLayout, FlowCanvasContext, FlowCanvasDropWrapper, FlowCanvasRenderIntersections, FlowCanvasWrapper, FlowConnectionStatus, FlowEdgesSelection, FlowTemplatesList } from "@awesome-flow/core/canvas";
4
+ import { Portal } from "@mantine/core";
5
+ import { memo, useContext, useEffect, useState } from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { useFlowStore } from "@awesome-flow/core/hooks";
8
+ import { FlowContext, StoreContext } from "@awesome-flow/core/abstract";
9
+ import { shallow } from "zustand/shallow";
10
+
11
+ //#region src/flow/flow-ecs-edge-modules.tsx
12
+ function FlowEcsEdgeModules(props) {
13
+ const $ = c(10);
14
+ const { nodesToConnect } = props;
15
+ const onConnect = useFlowStore(_temp$5);
16
+ const bridge = useEcsBridge();
17
+ const moduleVersion = useBridgeStoreVersion("modules");
18
+ let t0;
19
+ if ($[0] !== bridge || $[1] !== nodesToConnect || $[2] !== onConnect) {
20
+ t0 = () => {
21
+ for (const node of nodesToConnect) {
22
+ if (!node.data.entity) continue;
23
+ const sourceHandle = node.data.handles.find(_temp2$2);
24
+ const entity = bridge.entityRepository.get(node.data.entity);
25
+ const systemModule = bridge.ecsFlowRepository.getSystemModuleNode(entity.myProxy.entityType);
26
+ const targetHandle = systemModule?.data.handles.find(_temp3$1);
27
+ if (sourceHandle && targetHandle) onConnect({
28
+ source: node.id,
29
+ target: systemModule.id,
30
+ sourceHandle: sourceHandle.handleId,
31
+ targetHandle: targetHandle.handleId
32
+ });
33
+ }
34
+ };
35
+ $[0] = bridge;
36
+ $[1] = nodesToConnect;
37
+ $[2] = onConnect;
38
+ $[3] = t0;
39
+ } else t0 = $[3];
40
+ let t1;
41
+ if ($[4] !== bridge || $[5] !== moduleVersion || $[6] !== nodesToConnect || $[7] !== onConnect) {
42
+ t1 = [
43
+ bridge,
44
+ moduleVersion,
45
+ nodesToConnect,
46
+ onConnect
47
+ ];
48
+ $[4] = bridge;
49
+ $[5] = moduleVersion;
50
+ $[6] = nodesToConnect;
51
+ $[7] = onConnect;
52
+ $[8] = t1;
53
+ } else t1 = $[8];
54
+ useEffect(t0, t1);
55
+ let t2;
56
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
57
+ t2 = /* @__PURE__ */ jsx(Fragment, {});
58
+ $[9] = t2;
59
+ } else t2 = $[9];
60
+ return t2;
61
+ }
62
+ function _temp3$1(h_0) {
63
+ return h_0.connection === "target";
64
+ }
65
+ function _temp2$2(h) {
66
+ return h.connection === "source";
67
+ }
68
+ function _temp$5(state) {
69
+ return state.onConnect;
70
+ }
71
+
72
+ //#endregion
73
+ //#region src/flow/flow-ecs-edge-proxies.tsx
74
+ function FlowEcsEdgeProxies(props) {
75
+ const $ = c(10);
76
+ const { nodesToConnect } = props;
77
+ const onConnect = useFlowStore(_temp$4);
78
+ const bridge = useEcsBridge();
79
+ const proxyVersion = useBridgeStoreVersion("proxies");
80
+ let t0;
81
+ if ($[0] !== bridge || $[1] !== nodesToConnect || $[2] !== onConnect) {
82
+ t0 = () => {
83
+ for (const node of nodesToConnect) {
84
+ if (!node.data.entity) continue;
85
+ const sourceHandle = node.data.handles.find(_temp2$1);
86
+ const entity = bridge.entityRepository.get(node.data.entity);
87
+ const proxies = Array.from(bridge.entityProxyRepository.getAll(entity.myProxy).values()).flat();
88
+ for (const proxy of proxies) {
89
+ const proxyNode = bridge.ecsFlowRepository.getEntityNode(proxy);
90
+ if (proxyNode) {
91
+ const targetHandle = proxyNode.data.handles.find(_temp3);
92
+ if (sourceHandle && targetHandle) onConnect({
93
+ source: node.id,
94
+ target: proxyNode.id,
95
+ sourceHandle: sourceHandle.handleId,
96
+ targetHandle: targetHandle.handleId
97
+ });
98
+ }
99
+ }
100
+ }
101
+ };
102
+ $[0] = bridge;
103
+ $[1] = nodesToConnect;
104
+ $[2] = onConnect;
105
+ $[3] = t0;
106
+ } else t0 = $[3];
107
+ let t1;
108
+ if ($[4] !== bridge || $[5] !== nodesToConnect || $[6] !== onConnect || $[7] !== proxyVersion) {
109
+ t1 = [
110
+ bridge,
111
+ nodesToConnect,
112
+ onConnect,
113
+ proxyVersion
114
+ ];
115
+ $[4] = bridge;
116
+ $[5] = nodesToConnect;
117
+ $[6] = onConnect;
118
+ $[7] = proxyVersion;
119
+ $[8] = t1;
120
+ } else t1 = $[8];
121
+ useEffect(t0, t1);
122
+ let t2;
123
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
124
+ t2 = /* @__PURE__ */ jsx(Fragment, {});
125
+ $[9] = t2;
126
+ } else t2 = $[9];
127
+ return t2;
128
+ }
129
+ function _temp3(h_0) {
130
+ return h_0.connection === "target";
131
+ }
132
+ function _temp2$1(h) {
133
+ return h.connection === "source";
134
+ }
135
+ function _temp$4(state) {
136
+ return state.onConnect;
137
+ }
138
+
139
+ //#endregion
140
+ //#region src/flow/flow-ecs-entities.tsx
141
+ function FlowEcsEntities() {
142
+ const $ = c(9);
143
+ const { nodeFactory } = useContext(FlowContext);
144
+ const addNodes = useFlowStore(_temp$3);
145
+ const bridge = useEcsBridge();
146
+ const entities = useEntityList();
147
+ let t0;
148
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
149
+ t0 = [];
150
+ $[0] = t0;
151
+ } else t0 = $[0];
152
+ const [entityNodes, setEntityNodes] = useState(t0);
153
+ let t1;
154
+ let t2;
155
+ if ($[1] !== addNodes || $[2] !== bridge || $[3] !== entities || $[4] !== nodeFactory) {
156
+ t1 = () => {
157
+ const nodesToAdd = [];
158
+ const nodesToConnect = [];
159
+ for (const entity of entities) {
160
+ let node = bridge.ecsFlowRepository.getEntityNode(entity.myProxy);
161
+ if (!node) {
162
+ node = nodeFactory.createNodeFromType("entity-node");
163
+ node.data.entity = entity.myProxy;
164
+ node.data.entityType = entity.myProxy.entityType;
165
+ node.position = {
166
+ x: 0,
167
+ y: 0
168
+ };
169
+ bridge.ecsFlowRepository.addEntityNode(node);
170
+ nodesToAdd.push(node);
171
+ }
172
+ nodesToConnect.push(node);
173
+ }
174
+ setEntityNodes(nodesToConnect);
175
+ if (nodesToAdd.length) addNodes(nodesToAdd);
176
+ };
177
+ t2 = [
178
+ addNodes,
179
+ bridge,
180
+ entities,
181
+ nodeFactory
182
+ ];
183
+ $[1] = addNodes;
184
+ $[2] = bridge;
185
+ $[3] = entities;
186
+ $[4] = nodeFactory;
187
+ $[5] = t1;
188
+ $[6] = t2;
189
+ } else {
190
+ t1 = $[5];
191
+ t2 = $[6];
192
+ }
193
+ useEffect(t1, t2);
194
+ let t3;
195
+ if ($[7] !== entityNodes) {
196
+ t3 = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FlowEcsEdgeProxies, { nodesToConnect: entityNodes }), /* @__PURE__ */ jsx(FlowEcsEdgeModules, { nodesToConnect: entityNodes })] });
197
+ $[7] = entityNodes;
198
+ $[8] = t3;
199
+ } else t3 = $[8];
200
+ return t3;
201
+ }
202
+ function _temp$3(state) {
203
+ return state.addNodes;
204
+ }
205
+
206
+ //#endregion
207
+ //#region src/flow/flow-ecs-modules.tsx
208
+ function FlowEcsModules() {
209
+ const $ = c(7);
210
+ const { nodeFactory } = useContext(FlowContext);
211
+ const addNodes = useFlowStore(_temp$2);
212
+ const bridge = useEcsBridge();
213
+ const modules = useSystemsModuleList();
214
+ let t0;
215
+ let t1;
216
+ if ($[0] !== addNodes || $[1] !== bridge || $[2] !== modules || $[3] !== nodeFactory) {
217
+ t0 = () => {
218
+ const keys = Array.from(modules.keys());
219
+ const nodesToAdd = [];
220
+ for (const element of keys) {
221
+ if (bridge.ecsFlowRepository.getSystemModuleNode(element)) continue;
222
+ const node = nodeFactory.createNodeFromType("systems-module-node");
223
+ node.data.entityType = element;
224
+ node.position = {
225
+ x: 0,
226
+ y: 0
227
+ };
228
+ bridge.ecsFlowRepository.addSystemModuleNode(node);
229
+ nodesToAdd.push(node);
230
+ }
231
+ if (nodesToAdd.length) addNodes(nodesToAdd);
232
+ };
233
+ t1 = [
234
+ addNodes,
235
+ bridge,
236
+ modules,
237
+ nodeFactory
238
+ ];
239
+ $[0] = addNodes;
240
+ $[1] = bridge;
241
+ $[2] = modules;
242
+ $[3] = nodeFactory;
243
+ $[4] = t0;
244
+ $[5] = t1;
245
+ } else {
246
+ t0 = $[4];
247
+ t1 = $[5];
248
+ }
249
+ useEffect(t0, t1);
250
+ let t2;
251
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
252
+ t2 = /* @__PURE__ */ jsx(Fragment, {});
253
+ $[6] = t2;
254
+ } else t2 = $[6];
255
+ return t2;
256
+ }
257
+ function _temp$2(state) {
258
+ return state.addNodes;
259
+ }
260
+
261
+ //#endregion
262
+ //#region src/flow/flow-ecs-scopes.tsx
263
+ function FlowEcsScopes() {
264
+ const $ = c(16);
265
+ const { nodeFactory } = useContext(FlowContext);
266
+ const { flowStore } = useContext(StoreContext);
267
+ const bridge = useEcsBridge();
268
+ const scopes = useScopeList();
269
+ const { nodes, setGroups, setNodes } = useFlowStore(_temp$1, shallow);
270
+ let t0;
271
+ if ($[0] !== bridge || $[1] !== flowStore || $[2] !== nodeFactory || $[3] !== scopes || $[4] !== setGroups || $[5] !== setNodes) {
272
+ t0 = () => {
273
+ if (!scopes.length) return;
274
+ let changed = false;
275
+ const nextNodes = [...flowStore.instance.getState().nodes];
276
+ const groups = {};
277
+ for (const scope of scopes) {
278
+ let groupNode = bridge.ecsFlowRepository.getScopeGroupNode(scope.scopeId);
279
+ if (!groupNode) {
280
+ groupNode = nodeFactory.createNodeFromType("scope-group-node");
281
+ groupNode.data.scopeId = scope.scopeId;
282
+ groupNode.data.title = "Scope";
283
+ groupNode.position = {
284
+ x: 0,
285
+ y: 0
286
+ };
287
+ groupNode.className = "react-flow__node-group";
288
+ bridge.ecsFlowRepository.addScopeGroupNode(groupNode);
289
+ nextNodes.unshift(groupNode);
290
+ changed = true;
291
+ }
292
+ const childIds = [];
293
+ for (const entity of scope.entities) {
294
+ const entityNode = bridge.ecsFlowRepository.getEntityNode(entity.myProxy);
295
+ if (!entityNode) continue;
296
+ childIds.push(entityNode.id);
297
+ }
298
+ groups[groupNode.id] = childIds;
299
+ }
300
+ const scopedNodeIds = new Set(Object.values(groups).flat());
301
+ const groupIds = new Set(Object.keys(groups));
302
+ const orderedNodes = nextNodes.map((node) => {
303
+ if (groupIds.has(node.id)) return node;
304
+ if (node.type !== "entity-node") return node;
305
+ const parentId = scopedNodeIds.has(node.id) ? Object.entries(groups).find((t1) => {
306
+ const [, children] = t1;
307
+ return children.includes(node.id);
308
+ })?.[0] : void 0;
309
+ if (node.parentId !== parentId) {
310
+ changed = true;
311
+ return {
312
+ ...node,
313
+ extent: parentId ? "parent" : void 0,
314
+ parentId
315
+ };
316
+ }
317
+ return node;
318
+ }).sort(_temp2);
319
+ if (changed) setNodes(orderedNodes);
320
+ setGroups(groups);
321
+ };
322
+ $[0] = bridge;
323
+ $[1] = flowStore;
324
+ $[2] = nodeFactory;
325
+ $[3] = scopes;
326
+ $[4] = setGroups;
327
+ $[5] = setNodes;
328
+ $[6] = t0;
329
+ } else t0 = $[6];
330
+ let t1;
331
+ if ($[7] !== bridge || $[8] !== flowStore || $[9] !== nodeFactory || $[10] !== nodes || $[11] !== scopes || $[12] !== setGroups || $[13] !== setNodes) {
332
+ t1 = [
333
+ bridge,
334
+ flowStore,
335
+ nodeFactory,
336
+ nodes,
337
+ scopes,
338
+ setGroups,
339
+ setNodes
340
+ ];
341
+ $[7] = bridge;
342
+ $[8] = flowStore;
343
+ $[9] = nodeFactory;
344
+ $[10] = nodes;
345
+ $[11] = scopes;
346
+ $[12] = setGroups;
347
+ $[13] = setNodes;
348
+ $[14] = t1;
349
+ } else t1 = $[14];
350
+ useEffect(t0, t1);
351
+ let t2;
352
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
353
+ t2 = /* @__PURE__ */ jsx(Fragment, {});
354
+ $[15] = t2;
355
+ } else t2 = $[15];
356
+ return t2;
357
+ }
358
+ function _temp2(a, b) {
359
+ return Number(!a.data?.isGroup) - Number(!b.data?.isGroup);
360
+ }
361
+ function _temp$1(state) {
362
+ return {
363
+ nodes: state.nodes,
364
+ setGroups: state.setGroups,
365
+ setNodes: state.setNodes
366
+ };
367
+ }
368
+
369
+ //#endregion
370
+ //#region src/flow/flow-ecs-spawn-entities.tsx
371
+ const selector = (state) => ({
372
+ nodes: state.nodes,
373
+ updateNodeData: state.updateNodeData
374
+ });
375
+ function FlowEcsSpawnEntities() {
376
+ const $ = c(6);
377
+ const bridge = useEcsBridge();
378
+ const { nodes, updateNodeData } = useFlowStore(selector, shallow);
379
+ let t0;
380
+ let t1;
381
+ if ($[0] !== bridge || $[1] !== nodes || $[2] !== updateNodeData) {
382
+ t0 = () => {
383
+ for (const node of nodes) {
384
+ if (node.type !== "entity-node" || !node.data.spawn || node.data.entity) continue;
385
+ const update = bridge.enqueueEntitySpawn(node.data.spawn);
386
+ if (!update) {
387
+ updateNodeData(node.id, { spawnStatus: "missing-queue" });
388
+ continue;
389
+ }
390
+ const data = {
391
+ entity: update.entity,
392
+ entityType: update.entity.entityType,
393
+ spawnStatus: "queued"
394
+ };
395
+ bridge.ecsFlowRepository.addEntityNode({
396
+ ...node,
397
+ data: {
398
+ ...node.data,
399
+ ...data
400
+ }
401
+ });
402
+ updateNodeData(node.id, data);
403
+ }
404
+ };
405
+ t1 = [
406
+ bridge,
407
+ nodes,
408
+ updateNodeData
409
+ ];
410
+ $[0] = bridge;
411
+ $[1] = nodes;
412
+ $[2] = updateNodeData;
413
+ $[3] = t0;
414
+ $[4] = t1;
415
+ } else {
416
+ t0 = $[3];
417
+ t1 = $[4];
418
+ }
419
+ useEffect(t0, t1);
420
+ let t2;
421
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
422
+ t2 = /* @__PURE__ */ jsx(Fragment, {});
423
+ $[5] = t2;
424
+ } else t2 = $[5];
425
+ return t2;
426
+ }
427
+
428
+ //#endregion
429
+ //#region src/flow/flow-ecs-tool-nodes.tsx
430
+ const defaultEcsToolNodes = [
431
+ "scheduler-node",
432
+ "event-timeline-node",
433
+ "telemetry-node",
434
+ "update-queue-node"
435
+ ];
436
+ function FlowEcsToolNodes(t0) {
437
+ const $ = c(7);
438
+ const { nodes: t1 } = t0;
439
+ const nodes = t1 === void 0 ? defaultEcsToolNodes : t1;
440
+ const { nodeFactory } = useContext(FlowContext);
441
+ const addNodes = useFlowStore(_temp);
442
+ const bridge = useEcsBridge();
443
+ let t2;
444
+ let t3;
445
+ if ($[0] !== addNodes || $[1] !== bridge || $[2] !== nodeFactory || $[3] !== nodes) {
446
+ t2 = () => {
447
+ const nodesToAdd = [];
448
+ nodes.forEach((type, index) => {
449
+ if (bridge.ecsFlowRepository.getToolNode(type)) return;
450
+ const node = nodeFactory.createNodeFromType(type);
451
+ node.position = {
452
+ x: 980,
453
+ y: index * 220
454
+ };
455
+ bridge.ecsFlowRepository.addToolNode(node);
456
+ nodesToAdd.push(node);
457
+ });
458
+ if (nodesToAdd.length) addNodes(nodesToAdd);
459
+ };
460
+ t3 = [
461
+ addNodes,
462
+ bridge,
463
+ nodeFactory,
464
+ nodes
465
+ ];
466
+ $[0] = addNodes;
467
+ $[1] = bridge;
468
+ $[2] = nodeFactory;
469
+ $[3] = nodes;
470
+ $[4] = t2;
471
+ $[5] = t3;
472
+ } else {
473
+ t2 = $[4];
474
+ t3 = $[5];
475
+ }
476
+ useEffect(t2, t3);
477
+ let t4;
478
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
479
+ t4 = /* @__PURE__ */ jsx(Fragment, {});
480
+ $[6] = t4;
481
+ } else t4 = $[6];
482
+ return t4;
483
+ }
484
+ function _temp(state) {
485
+ return state.addNodes;
486
+ }
487
+
488
+ //#endregion
489
+ //#region src/flow/flow-ecs-state.tsx
490
+ function FlowEcsState(props) {
491
+ const $ = c(25);
492
+ const [refreshLayout, setRefreshLayout] = useState(false);
493
+ const bridge = useEcsBridge();
494
+ const entityVersion = useBridgeStoreVersion("entities");
495
+ const moduleVersion = useBridgeStoreVersion("modules");
496
+ let t0;
497
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
498
+ t0 = () => {
499
+ setRefreshLayout(false);
500
+ const frame = requestAnimationFrame(() => setRefreshLayout(true));
501
+ return () => cancelAnimationFrame(frame);
502
+ };
503
+ $[0] = t0;
504
+ } else t0 = $[0];
505
+ let t1;
506
+ if ($[1] !== bridge.ecsFlowRepository.sizeNodes || $[2] !== entityVersion || $[3] !== moduleVersion) {
507
+ t1 = [
508
+ bridge.ecsFlowRepository.sizeNodes,
509
+ entityVersion,
510
+ moduleVersion
511
+ ];
512
+ $[1] = bridge.ecsFlowRepository.sizeNodes;
513
+ $[2] = entityVersion;
514
+ $[3] = moduleVersion;
515
+ $[4] = t1;
516
+ } else t1 = $[4];
517
+ useEffect(t0, t1);
518
+ let t2;
519
+ if ($[5] !== props.showSystemModules) {
520
+ t2 = props.showSystemModules && /* @__PURE__ */ jsx(FlowEcsModules, {});
521
+ $[5] = props.showSystemModules;
522
+ $[6] = t2;
523
+ } else t2 = $[6];
524
+ let t3;
525
+ if ($[7] !== props.showEntities) {
526
+ t3 = props.showEntities && /* @__PURE__ */ jsx(FlowEcsEntities, {});
527
+ $[7] = props.showEntities;
528
+ $[8] = t3;
529
+ } else t3 = $[8];
530
+ let t4;
531
+ if ($[9] !== props.enableEntitySpawning) {
532
+ t4 = props.enableEntitySpawning && /* @__PURE__ */ jsx(FlowEcsSpawnEntities, {});
533
+ $[9] = props.enableEntitySpawning;
534
+ $[10] = t4;
535
+ } else t4 = $[10];
536
+ let t5;
537
+ if ($[11] !== props.showScopes) {
538
+ t5 = props.showScopes && /* @__PURE__ */ jsx(FlowEcsScopes, {});
539
+ $[11] = props.showScopes;
540
+ $[12] = t5;
541
+ } else t5 = $[12];
542
+ let t6;
543
+ if ($[13] !== props.toolNodes) {
544
+ t6 = props.toolNodes && /* @__PURE__ */ jsx(FlowEcsToolNodes, { nodes: Array.isArray(props.toolNodes) ? props.toolNodes : void 0 });
545
+ $[13] = props.toolNodes;
546
+ $[14] = t6;
547
+ } else t6 = $[14];
548
+ let t7;
549
+ if ($[15] !== props.autoLayout || $[16] !== refreshLayout) {
550
+ t7 = props.autoLayout && /* @__PURE__ */ jsx(FlowAutoLayout, { refreshLayout });
551
+ $[15] = props.autoLayout;
552
+ $[16] = refreshLayout;
553
+ $[17] = t7;
554
+ } else t7 = $[17];
555
+ let t8;
556
+ if ($[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6 || $[23] !== t7) {
557
+ t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
558
+ t2,
559
+ t3,
560
+ t4,
561
+ t5,
562
+ t6,
563
+ t7
564
+ ] });
565
+ $[18] = t2;
566
+ $[19] = t3;
567
+ $[20] = t4;
568
+ $[21] = t5;
569
+ $[22] = t6;
570
+ $[23] = t7;
571
+ $[24] = t8;
572
+ } else t8 = $[24];
573
+ return t8;
574
+ }
575
+ var flow_ecs_state_default = memo(FlowEcsState);
576
+
577
+ //#endregion
578
+ //#region src/canvas/flow-ecs-canvas.tsx
579
+ function FlowEcsCanvas(t0) {
580
+ const $ = c(21);
581
+ const { autoLayout: t1, enableEntitySpawning: t2, enableDragDrop: t3, showEntities: t4, showEntityTypeTemplates: t5, showScopes: t6, showSystemModules: t7, showTemplates: t8, toolNodes: t9 } = t0;
582
+ const autoLayout = t1 === void 0 ? true : t1;
583
+ const enableEntitySpawning = t2 === void 0 ? true : t2;
584
+ const enableDragDrop = t3 === void 0 ? true : t3;
585
+ const showEntities = t4 === void 0 ? true : t4;
586
+ const showEntityTypeTemplates = t5 === void 0 ? true : t5;
587
+ const showScopes = t6 === void 0 ? true : t6;
588
+ const showSystemModules = t7 === void 0 ? true : t7;
589
+ const showTemplates = t8 === void 0 ? false : t8;
590
+ const toolNodes = t9 === void 0 ? false : t9;
591
+ const [over, setOver] = useState(false);
592
+ const entityTypeTemplates = useEntityTypeTemplates(showEntityTypeTemplates);
593
+ let t10;
594
+ if ($[0] !== over) {
595
+ t10 = /* @__PURE__ */ jsx(FlowCanvasRenderIntersections, {
596
+ canvasHighlighted: over,
597
+ nodeTypes: ecsNodeTypes
598
+ });
599
+ $[0] = over;
600
+ $[1] = t10;
601
+ } else t10 = $[1];
602
+ const canvas = t10;
603
+ let t11;
604
+ if ($[2] !== canvas || $[3] !== enableDragDrop) {
605
+ t11 = enableDragDrop ? /* @__PURE__ */ jsx(FlowCanvasDropWrapper, {
606
+ setOver,
607
+ children: canvas
608
+ }) : /* @__PURE__ */ jsx(FlowCanvasWrapper, { children: canvas });
609
+ $[2] = canvas;
610
+ $[3] = enableDragDrop;
611
+ $[4] = t11;
612
+ } else t11 = $[4];
613
+ let t12;
614
+ let t13;
615
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
616
+ t12 = /* @__PURE__ */ jsx(FlowEdgesSelection, {});
617
+ t13 = /* @__PURE__ */ jsx(FlowConnectionStatus, {});
618
+ $[5] = t12;
619
+ $[6] = t13;
620
+ } else {
621
+ t12 = $[5];
622
+ t13 = $[6];
623
+ }
624
+ let t14;
625
+ if ($[7] !== autoLayout || $[8] !== enableEntitySpawning || $[9] !== showEntities || $[10] !== showScopes || $[11] !== showSystemModules || $[12] !== toolNodes) {
626
+ t14 = /* @__PURE__ */ jsx(flow_ecs_state_default, {
627
+ autoLayout,
628
+ enableEntitySpawning,
629
+ showEntities,
630
+ showScopes,
631
+ showSystemModules,
632
+ toolNodes
633
+ });
634
+ $[7] = autoLayout;
635
+ $[8] = enableEntitySpawning;
636
+ $[9] = showEntities;
637
+ $[10] = showScopes;
638
+ $[11] = showSystemModules;
639
+ $[12] = toolNodes;
640
+ $[13] = t14;
641
+ } else t14 = $[13];
642
+ let t15;
643
+ if ($[14] !== entityTypeTemplates || $[15] !== showTemplates) {
644
+ t15 = showTemplates && /* @__PURE__ */ jsx(Portal, {
645
+ target: "#portal-navbar",
646
+ children: /* @__PURE__ */ jsx(FlowTemplatesList, {
647
+ extraTemplates: entityTypeTemplates,
648
+ nodeTypes: ecsNodeTypes
649
+ })
650
+ });
651
+ $[14] = entityTypeTemplates;
652
+ $[15] = showTemplates;
653
+ $[16] = t15;
654
+ } else t15 = $[16];
655
+ let t16;
656
+ if ($[17] !== t11 || $[18] !== t14 || $[19] !== t15) {
657
+ t16 = /* @__PURE__ */ jsxs(FlowCanvasContext, {
658
+ nodeTemplates: ecsNodeTemplates,
659
+ children: [
660
+ t11,
661
+ t12,
662
+ t13,
663
+ t14,
664
+ t15
665
+ ]
666
+ });
667
+ $[17] = t11;
668
+ $[18] = t14;
669
+ $[19] = t15;
670
+ $[20] = t16;
671
+ } else t16 = $[20];
672
+ return t16;
673
+ }
674
+
675
+ //#endregion
676
+ export { flow_ecs_state_default as n, FlowEcsCanvas as t };
677
+ //# sourceMappingURL=canvas-C4nDXlkK.mjs.map