@awesome-flow/ecs 0.9.0 → 0.9.1

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 (3) hide show
  1. package/dist/index.cjs +1007 -211
  2. package/dist/index.js +1011 -215
  3. package/package.json +6 -5
package/dist/index.cjs CHANGED
@@ -43,17 +43,27 @@ var EcsHandleDataType = /* @__PURE__ */ ((EcsHandleDataType2) => {
43
43
  })(EcsHandleDataType || {});
44
44
 
45
45
  // src/nodes/node-entity.tsx
46
+ var _compilerruntime = require('react/compiler-runtime');
46
47
  var _layout = require('@awesome-flow/core/layout');
47
48
  var _core = require('@mantine/core');
48
49
 
49
50
 
50
51
  // src/components/formatter-camel-case.tsx
51
52
 
53
+
52
54
  function CamelCaseFormatter(props) {
53
- const value = _react.useMemo.call(void 0,
54
- () => _optionalChain([props, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3(), 'access', _4 => _4.replace, 'call', _5 => _5(/([a-z])([A-Z])/g, "$1 $2")]),
55
- [props.value]
56
- );
55
+ const $ = _compilerruntime.c.call(void 0, 2);
56
+ let t0;
57
+ let t1;
58
+ if ($[0] !== props.value) {
59
+ t1 = _optionalChain([props, 'access', _ => _.value, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3(), 'access', _4 => _4.replace, 'call', _5 => _5(/([a-z])([A-Z])/g, "$1 $2")]);
60
+ $[0] = props.value;
61
+ $[1] = t1;
62
+ } else {
63
+ t1 = $[1];
64
+ }
65
+ t0 = t1;
66
+ const value = t0;
57
67
  return value;
58
68
  }
59
69
  var formatter_camel_case_default = _react.memo.call(void 0, CamelCaseFormatter);
@@ -61,50 +71,172 @@ var formatter_camel_case_default = _react.memo.call(void 0, CamelCaseFormatter);
61
71
  // src/layout/entity-layout.tsx
62
72
 
63
73
 
74
+
64
75
  // src/components/entity-component-list.tsx
65
76
 
66
77
 
67
78
 
79
+
68
80
  // src/components/entity-component-inspector.tsx
69
81
 
82
+
70
83
  var _hooks = require('@mantine/hooks');
71
84
 
72
85
 
73
86
  // src/components/object-inspector.tsx
74
87
 
75
88
 
89
+
76
90
  var _reactinspector = require('react-inspector');
77
91
  var _jsxruntime = require('react/jsx-runtime');
78
92
  function ObjectInspector(props) {
93
+ const $ = _compilerruntime.c.call(void 0, 3);
79
94
  const colorScheme = _core.useComputedColorScheme.call(void 0, );
80
- const theme = _react.useMemo.call(void 0,
81
- () => colorScheme === "dark" ? "chromeDark" : "chromeLight",
82
- [colorScheme]
83
- );
84
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactinspector.Inspector, { table: false, theme, data: props.data });
95
+ let t0;
96
+ t0 = colorScheme === "dark" ? "chromeDark" : "chromeLight";
97
+ const theme = t0;
98
+ let t1;
99
+ if ($[0] !== props.data || $[1] !== theme) {
100
+ t1 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactinspector.Inspector, { table: false, theme, data: props.data });
101
+ $[0] = props.data;
102
+ $[1] = theme;
103
+ $[2] = t1;
104
+ } else {
105
+ t1 = $[2];
106
+ }
107
+ return t1;
85
108
  }
86
109
  var object_inspector_default = _react.memo.call(void 0, ObjectInspector);
87
110
 
88
111
  // src/components/entity-component-inspector.tsx
89
112
 
90
113
  function EntityComponentInspector(props) {
91
- const [opened, { toggle }] = _hooks.useDisclosure.call(void 0, false);
92
- const buttonColor = _react.useMemo.call(void 0, () => opened ? "light" : "indigo", [opened]);
93
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { children: [
94
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Button, { variant: "outline", size: "xs", onClick: toggle, color: buttonColor, fullWidth: true, children: props.component.componentType }),
95
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Collapse, { in: opened, children: opened && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, object_inspector_default, { data: props.component }) })
96
- ] });
114
+ const $ = _compilerruntime.c.call(void 0, 13);
115
+ const [opened, t0] = _hooks.useDisclosure.call(void 0, false);
116
+ const {
117
+ toggle
118
+ } = t0;
119
+ let t1;
120
+ t1 = opened ? "light" : "indigo";
121
+ const buttonColor = t1;
122
+ let t2;
123
+ if ($[0] !== buttonColor || $[1] !== props.component.componentType || $[2] !== toggle) {
124
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Button, { variant: "outline", size: "xs", onClick: toggle, color: buttonColor, fullWidth: true, children: props.component.componentType });
125
+ $[0] = buttonColor;
126
+ $[1] = props.component.componentType;
127
+ $[2] = toggle;
128
+ $[3] = t2;
129
+ } else {
130
+ t2 = $[3];
131
+ }
132
+ let t3;
133
+ if ($[4] !== opened || $[5] !== props.component) {
134
+ t3 = opened && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, object_inspector_default, { data: props.component });
135
+ $[4] = opened;
136
+ $[5] = props.component;
137
+ $[6] = t3;
138
+ } else {
139
+ t3 = $[6];
140
+ }
141
+ let t4;
142
+ if ($[7] !== opened || $[8] !== t3) {
143
+ t4 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Collapse, { in: opened, children: t3 });
144
+ $[7] = opened;
145
+ $[8] = t3;
146
+ $[9] = t4;
147
+ } else {
148
+ t4 = $[9];
149
+ }
150
+ let t5;
151
+ if ($[10] !== t2 || $[11] !== t4) {
152
+ t5 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Box, { children: [
153
+ t2,
154
+ t4
155
+ ] });
156
+ $[10] = t2;
157
+ $[11] = t4;
158
+ $[12] = t5;
159
+ } else {
160
+ t5 = $[12];
161
+ }
162
+ return t5;
97
163
  }
98
164
  var entity_component_inspector_default = _react.memo.call(void 0, EntityComponentInspector);
99
165
 
100
166
  // src/components/entity-component-list.tsx
101
167
 
102
168
  function EntityComponentList(props) {
103
- const components = Array.from(props.entity.components.values());
104
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: "components", children: [
105
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: "Components" }) }),
106
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: components.map((c, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_component_inspector_default, { component: c }, i)) }) })
107
- ] }, "components");
169
+ const $ = _compilerruntime.c.call(void 0, 20);
170
+ let T0;
171
+ let T1;
172
+ let T2;
173
+ let t0;
174
+ let t1;
175
+ let t2;
176
+ let t3;
177
+ if ($[0] !== props.entity.components) {
178
+ const components = Array.from(props.entity.components.values());
179
+ T2 = _core.Accordion.Item;
180
+ t1 = "components";
181
+ t2 = "components";
182
+ t3 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: "Components" }) });
183
+ T1 = _core.Accordion.Panel;
184
+ T0 = _core.Stack;
185
+ t0 = components.map(_temp);
186
+ $[0] = props.entity.components;
187
+ $[1] = T0;
188
+ $[2] = T1;
189
+ $[3] = T2;
190
+ $[4] = t0;
191
+ $[5] = t1;
192
+ $[6] = t2;
193
+ $[7] = t3;
194
+ } else {
195
+ T0 = $[1];
196
+ T1 = $[2];
197
+ T2 = $[3];
198
+ t0 = $[4];
199
+ t1 = $[5];
200
+ t2 = $[6];
201
+ t3 = $[7];
202
+ }
203
+ let t4;
204
+ if ($[8] !== T0 || $[9] !== t0) {
205
+ t4 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, T0, { children: t0 });
206
+ $[8] = T0;
207
+ $[9] = t0;
208
+ $[10] = t4;
209
+ } else {
210
+ t4 = $[10];
211
+ }
212
+ let t5;
213
+ if ($[11] !== T1 || $[12] !== t4) {
214
+ t5 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, T1, { children: t4 });
215
+ $[11] = T1;
216
+ $[12] = t4;
217
+ $[13] = t5;
218
+ } else {
219
+ t5 = $[13];
220
+ }
221
+ let t6;
222
+ if ($[14] !== T2 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t5) {
223
+ t6 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, T2, { value: t2, children: [
224
+ t3,
225
+ t5
226
+ ] }, t1);
227
+ $[14] = T2;
228
+ $[15] = t1;
229
+ $[16] = t2;
230
+ $[17] = t3;
231
+ $[18] = t5;
232
+ $[19] = t6;
233
+ } else {
234
+ t6 = $[19];
235
+ }
236
+ return t6;
237
+ }
238
+ function _temp(c, i) {
239
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_component_inspector_default, { component: c }, i);
108
240
  }
109
241
  var entity_component_list_default = _react.memo.call(void 0, EntityComponentList);
110
242
 
@@ -112,6 +244,7 @@ var entity_component_list_default = _react.memo.call(void 0, EntityComponentList
112
244
 
113
245
 
114
246
 
247
+
115
248
  // src/components/badge-list.tsx
116
249
 
117
250
 
@@ -126,12 +259,64 @@ var badge_list_default = _react.memo.call(void 0, BadgeList);
126
259
  // src/components/entity-proxy-list.tsx
127
260
 
128
261
  function EntityProxyList(props) {
129
- const proxies = Array.from(props.entity.proxies.values()).map((c) => c.values());
130
- const items = proxies.map((p) => Array.from(p).map((k) => EcsIdGenerator.entityProxy(k))).flat();
131
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: "proxies", children: [
132
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: items.length, children: "Proxies" }) }),
133
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, badge_list_default, { items, badge: { variant: "outline" } }) }) })
134
- ] }, "proxies");
262
+ const $ = _compilerruntime.c.call(void 0, 10);
263
+ let t0;
264
+ if ($[0] !== props.entity.proxies) {
265
+ const proxies = Array.from(props.entity.proxies.values()).map(_temp4);
266
+ t0 = proxies.map(_temp3).flat();
267
+ $[0] = props.entity.proxies;
268
+ $[1] = t0;
269
+ } else {
270
+ t0 = $[1];
271
+ }
272
+ const items = t0;
273
+ let t1;
274
+ if ($[2] !== items.length) {
275
+ t1 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: items.length, children: "Proxies" }) });
276
+ $[2] = items.length;
277
+ $[3] = t1;
278
+ } else {
279
+ t1 = $[3];
280
+ }
281
+ let t2;
282
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
283
+ t2 = {
284
+ variant: "outline"
285
+ };
286
+ $[4] = t2;
287
+ } else {
288
+ t2 = $[4];
289
+ }
290
+ let t3;
291
+ if ($[5] !== items) {
292
+ t3 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, badge_list_default, { items, badge: t2 }) }) });
293
+ $[5] = items;
294
+ $[6] = t3;
295
+ } else {
296
+ t3 = $[6];
297
+ }
298
+ let t4;
299
+ if ($[7] !== t1 || $[8] !== t3) {
300
+ t4 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: "proxies", children: [
301
+ t1,
302
+ t3
303
+ ] }, "proxies");
304
+ $[7] = t1;
305
+ $[8] = t3;
306
+ $[9] = t4;
307
+ } else {
308
+ t4 = $[9];
309
+ }
310
+ return t4;
311
+ }
312
+ function _temp3(p) {
313
+ return Array.from(p).map(_temp2);
314
+ }
315
+ function _temp2(k) {
316
+ return EcsIdGenerator.entityProxy(k);
317
+ }
318
+ function _temp4(c) {
319
+ return c.values();
135
320
  }
136
321
  var entity_proxy_list_default = _react.memo.call(void 0, EntityProxyList);
137
322
 
@@ -139,13 +324,60 @@ var entity_proxy_list_default = _react.memo.call(void 0, EntityProxyList);
139
324
 
140
325
 
141
326
 
327
+
142
328
  function EntitySubscriptionList(props) {
143
- const { entityEventsManager } = _react.useContext.call(void 0, EcsFlowContext);
144
- const subscriptions = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
145
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: "subscriptions", children: [
146
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: subscriptions.length, children: "Events" }) }),
147
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, badge_list_default, { items: subscriptions, badge: { variant: "outline" } }) }) })
148
- ] }, "subscriptions");
329
+ const $ = _compilerruntime.c.call(void 0, 11);
330
+ const {
331
+ entityEventsManager
332
+ } = _react.useContext.call(void 0, EcsFlowContext);
333
+ let t0;
334
+ if ($[0] !== entityEventsManager || $[1] !== props.entity.myProxy) {
335
+ t0 = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
336
+ $[0] = entityEventsManager;
337
+ $[1] = props.entity.myProxy;
338
+ $[2] = t0;
339
+ } else {
340
+ t0 = $[2];
341
+ }
342
+ const subscriptions = t0;
343
+ let t1;
344
+ if ($[3] !== subscriptions.length) {
345
+ t1 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: subscriptions.length, children: "Events" }) });
346
+ $[3] = subscriptions.length;
347
+ $[4] = t1;
348
+ } else {
349
+ t1 = $[4];
350
+ }
351
+ let t2;
352
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
353
+ t2 = {
354
+ variant: "outline"
355
+ };
356
+ $[5] = t2;
357
+ } else {
358
+ t2 = $[5];
359
+ }
360
+ let t3;
361
+ if ($[6] !== subscriptions) {
362
+ t3 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, badge_list_default, { items: subscriptions, badge: t2 }) }) });
363
+ $[6] = subscriptions;
364
+ $[7] = t3;
365
+ } else {
366
+ t3 = $[7];
367
+ }
368
+ let t4;
369
+ if ($[8] !== t1 || $[9] !== t3) {
370
+ t4 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: "subscriptions", children: [
371
+ t1,
372
+ t3
373
+ ] }, "subscriptions");
374
+ $[8] = t1;
375
+ $[9] = t3;
376
+ $[10] = t4;
377
+ } else {
378
+ t4 = $[10];
379
+ }
380
+ return t4;
149
381
  }
150
382
  var entity_subscription_list_default = _react.memo.call(void 0, EntitySubscriptionList);
151
383
 
@@ -153,61 +385,201 @@ var entity_subscription_list_default = _react.memo.call(void 0, EntitySubscripti
153
385
 
154
386
 
155
387
 
388
+
156
389
  function EntityUpdateCounter(props) {
390
+ const $ = _compilerruntime.c.call(void 0, 16);
157
391
  const [, setRefresh] = _react.useState.call(void 0, 0);
158
- const { entityUpdateCounter } = _react.useContext.call(void 0, EcsFlowContext);
159
- const updates = entityUpdateCounter.getUpdateCount(props.entityUid) || 0;
160
- const removes = entityUpdateCounter.getRemoveCount(props.entityUid) || 0;
161
- _react.useEffect.call(void 0, () => {
162
- const interval = setInterval(() => {
163
- setRefresh((refresh) => refresh + 1);
164
- }, 1e3);
165
- return () => {
166
- console.log("CLEAR INTERVAL");
167
- clearInterval(interval);
392
+ const {
393
+ entityUpdateCounter
394
+ } = _react.useContext.call(void 0, EcsFlowContext);
395
+ let t0;
396
+ if ($[0] !== entityUpdateCounter || $[1] !== props.entityUid) {
397
+ t0 = entityUpdateCounter.getUpdateCount(props.entityUid) || 0;
398
+ $[0] = entityUpdateCounter;
399
+ $[1] = props.entityUid;
400
+ $[2] = t0;
401
+ } else {
402
+ t0 = $[2];
403
+ }
404
+ const updates = t0;
405
+ let t1;
406
+ if ($[3] !== entityUpdateCounter || $[4] !== props.entityUid) {
407
+ t1 = entityUpdateCounter.getRemoveCount(props.entityUid) || 0;
408
+ $[3] = entityUpdateCounter;
409
+ $[4] = props.entityUid;
410
+ $[5] = t1;
411
+ } else {
412
+ t1 = $[5];
413
+ }
414
+ const removes = t1;
415
+ let t2;
416
+ if ($[6] !== setRefresh) {
417
+ t2 = () => {
418
+ const interval = setInterval(() => {
419
+ setRefresh(_temp5);
420
+ }, 1e3);
421
+ return () => {
422
+ console.log("CLEAR INTERVAL");
423
+ clearInterval(interval);
424
+ };
168
425
  };
169
- }, []);
170
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
171
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { variant: "light", children: updates }),
172
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { variant: "light", color: "orange", children: removes })
173
- ] });
426
+ $[6] = setRefresh;
427
+ $[7] = t2;
428
+ } else {
429
+ t2 = $[7];
430
+ }
431
+ let t3;
432
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
433
+ t3 = [];
434
+ $[8] = t3;
435
+ } else {
436
+ t3 = $[8];
437
+ }
438
+ _react.useEffect.call(void 0, t2, t3);
439
+ let t4;
440
+ if ($[9] !== updates) {
441
+ t4 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { variant: "light", children: updates });
442
+ $[9] = updates;
443
+ $[10] = t4;
444
+ } else {
445
+ t4 = $[10];
446
+ }
447
+ let t5;
448
+ if ($[11] !== removes) {
449
+ t5 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { variant: "light", color: "orange", children: removes });
450
+ $[11] = removes;
451
+ $[12] = t5;
452
+ } else {
453
+ t5 = $[12];
454
+ }
455
+ let t6;
456
+ if ($[13] !== t4 || $[14] !== t5) {
457
+ t6 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
458
+ t4,
459
+ t5
460
+ ] });
461
+ $[13] = t4;
462
+ $[14] = t5;
463
+ $[15] = t6;
464
+ } else {
465
+ t6 = $[15];
466
+ }
467
+ return t6;
468
+ }
469
+ function _temp5(refresh) {
470
+ return refresh + 1;
174
471
  }
175
472
  var entity_update_counter_default = _react.memo.call(void 0, EntityUpdateCounter);
176
473
 
177
474
  // src/layout/entity-layout.tsx
178
475
 
179
- function EntityLayout({ entity }) {
180
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
181
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
476
+ function EntityLayout(t0) {
477
+ const $ = _compilerruntime.c.call(void 0, 8);
478
+ const {
479
+ entity
480
+ } = t0;
481
+ let t1;
482
+ if ($[0] !== entity.myProxy.entityUid) {
483
+ t1 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Group, { children: [
182
484
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { variant: "outline", color: "orange", children: entity.myProxy.entityUid }),
183
485
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_update_counter_default, { entityUid: entity.myProxy.entityUid })
184
- ] }),
185
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Divider, { my: 5 }),
186
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion, { children: [
486
+ ] });
487
+ $[0] = entity.myProxy.entityUid;
488
+ $[1] = t1;
489
+ } else {
490
+ t1 = $[1];
491
+ }
492
+ let t2;
493
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
494
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Divider, { my: 5 });
495
+ $[2] = t2;
496
+ } else {
497
+ t2 = $[2];
498
+ }
499
+ let t3;
500
+ if ($[3] !== entity) {
501
+ t3 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion, { children: [
187
502
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_component_list_default, { entity }),
188
503
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_proxy_list_default, { entity }),
189
504
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_subscription_list_default, { entity })
190
- ] })
191
- ] });
505
+ ] });
506
+ $[3] = entity;
507
+ $[4] = t3;
508
+ } else {
509
+ t3 = $[4];
510
+ }
511
+ let t4;
512
+ if ($[5] !== t1 || $[6] !== t3) {
513
+ t4 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
514
+ t1,
515
+ t2,
516
+ t3
517
+ ] });
518
+ $[5] = t1;
519
+ $[6] = t3;
520
+ $[7] = t4;
521
+ } else {
522
+ t4 = $[7];
523
+ }
524
+ return t4;
192
525
  }
193
526
  var entity_layout_default = EntityLayout;
194
527
 
195
528
  // src/nodes/node-entity.tsx
196
529
 
197
- function EntityNode({ id, data, selected, type }) {
198
- const { entityRepository } = _react.useContext.call(void 0, EcsFlowContext);
199
- const entity = _react.useMemo.call(void 0, () => entityRepository.get(data.entity), [data.entity]);
200
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
201
- _layout.NodeContainer,
202
- {
203
- id,
204
- selected,
205
- data,
206
- title: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "transparent", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, formatter_camel_case_default, { value: entity.myProxy.entityType }) }),
207
- type,
208
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_layout_default, { entity })
209
- }
210
- );
530
+ function EntityNode(t0) {
531
+ const $ = _compilerruntime.c.call(void 0, 14);
532
+ const {
533
+ id,
534
+ data,
535
+ selected,
536
+ type
537
+ } = t0;
538
+ const {
539
+ entityRepository
540
+ } = _react.useContext.call(void 0, EcsFlowContext);
541
+ let t1;
542
+ let t2;
543
+ if ($[0] !== data.entity || $[1] !== entityRepository) {
544
+ t2 = entityRepository.get(data.entity);
545
+ $[0] = data.entity;
546
+ $[1] = entityRepository;
547
+ $[2] = t2;
548
+ } else {
549
+ t2 = $[2];
550
+ }
551
+ t1 = t2;
552
+ const entity = t1;
553
+ let t3;
554
+ if ($[3] !== entity.myProxy.entityType) {
555
+ t3 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "transparent", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, formatter_camel_case_default, { value: entity.myProxy.entityType }) });
556
+ $[3] = entity.myProxy.entityType;
557
+ $[4] = t3;
558
+ } else {
559
+ t3 = $[4];
560
+ }
561
+ let t4;
562
+ if ($[5] !== entity) {
563
+ t4 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_layout_default, { entity });
564
+ $[5] = entity;
565
+ $[6] = t4;
566
+ } else {
567
+ t4 = $[6];
568
+ }
569
+ let t5;
570
+ if ($[7] !== data || $[8] !== id || $[9] !== selected || $[10] !== t3 || $[11] !== t4 || $[12] !== type) {
571
+ t5 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeContainer, { id, selected, data, title: t3, type, children: t4 });
572
+ $[7] = data;
573
+ $[8] = id;
574
+ $[9] = selected;
575
+ $[10] = t3;
576
+ $[11] = t4;
577
+ $[12] = type;
578
+ $[13] = t5;
579
+ } else {
580
+ t5 = $[13];
581
+ }
582
+ return t5;
211
583
  }
212
584
  var node_entity_default = EntityNode;
213
585
 
@@ -216,73 +588,265 @@ var node_entity_default = EntityNode;
216
588
 
217
589
 
218
590
 
591
+
219
592
  // src/layout/systems-module-layout.tsx
220
- var _systems = require('@awesome-ecs/abstract/systems');
221
593
 
594
+ var _systems = require('@awesome-ecs/abstract/systems');
222
595
 
223
596
 
224
597
  // src/components/pipeline-middleware-list.tsx
225
598
 
226
599
 
600
+
227
601
  function PipelineMiddlewareList(props) {
228
- let middleware = [];
602
+ const $ = _compilerruntime.c.call(void 0, 13);
603
+ let t0;
604
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
605
+ t0 = [];
606
+ $[0] = t0;
607
+ } else {
608
+ t0 = $[0];
609
+ }
610
+ let middleware = t0;
229
611
  if (props.pipeline) {
230
- middleware = props.pipeline["middleware"];
612
+ middleware = props.pipeline.middleware;
231
613
  }
232
- const components = middleware.map((m) => {
233
- return m.name || m.constructor.name;
234
- });
235
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: props.label, children: [
236
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: props.label }) }),
237
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, badge_list_default, { items: components, badge: { variant: "outline" } }) }) })
238
- ] }, props.label);
614
+ let t1;
615
+ if ($[1] !== middleware) {
616
+ t1 = middleware.map(_temp6);
617
+ $[1] = middleware;
618
+ $[2] = t1;
619
+ } else {
620
+ t1 = $[2];
621
+ }
622
+ const components = t1;
623
+ let t2;
624
+ if ($[3] !== components.length || $[4] !== props.label) {
625
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Control, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: props.label }) });
626
+ $[3] = components.length;
627
+ $[4] = props.label;
628
+ $[5] = t2;
629
+ } else {
630
+ t2 = $[5];
631
+ }
632
+ let t3;
633
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
634
+ t3 = {
635
+ variant: "outline"
636
+ };
637
+ $[6] = t3;
638
+ } else {
639
+ t3 = $[6];
640
+ }
641
+ let t4;
642
+ if ($[7] !== components) {
643
+ t4 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Accordion.Panel, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Stack, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, badge_list_default, { items: components, badge: t3 }) }) });
644
+ $[7] = components;
645
+ $[8] = t4;
646
+ } else {
647
+ t4 = $[8];
648
+ }
649
+ let t5;
650
+ if ($[9] !== props.label || $[10] !== t2 || $[11] !== t4) {
651
+ t5 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion.Item, { value: props.label, children: [
652
+ t2,
653
+ t4
654
+ ] }, props.label);
655
+ $[9] = props.label;
656
+ $[10] = t2;
657
+ $[11] = t4;
658
+ $[12] = t5;
659
+ } else {
660
+ t5 = $[12];
661
+ }
662
+ return t5;
663
+ }
664
+ function _temp6(m) {
665
+ return m.name || m.constructor.name;
239
666
  }
240
667
  var pipeline_middleware_list_default = PipelineMiddlewareList;
241
668
 
242
669
  // src/layout/systems-module-layout.tsx
243
670
 
244
671
  function SystemsModuleLayout(props) {
245
- const { module } = props;
246
- const runtimeContext = module["runtimeContext"];
247
- const { systemContext } = runtimeContext;
248
- const { status } = _react.useMemo.call(void 0, () => {
249
- return systemContext.runtime;
250
- }, [systemContext.runtime.status]);
251
- const init = runtimeContext.systemPipelines.get(_systems.SystemType.initialize);
252
- const update = runtimeContext.systemPipelines.get(_systems.SystemType.update);
253
- const render = runtimeContext.systemPipelines.get(_systems.SystemType.render);
254
- const sync = runtimeContext.systemPipelines.get(_systems.SystemType.sync);
255
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
256
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { children: [
672
+ const $ = _compilerruntime.c.call(void 0, 26);
673
+ const {
674
+ module
675
+ } = props;
676
+ const runtimeContext = module.runtimeContext;
677
+ const {
678
+ systemContext
679
+ } = runtimeContext;
680
+ let t0;
681
+ t0 = systemContext.runtime;
682
+ const {
683
+ status
684
+ } = t0;
685
+ let t1;
686
+ if ($[0] !== runtimeContext.systemPipelines) {
687
+ t1 = runtimeContext.systemPipelines.get(_systems.SystemType.initialize);
688
+ $[0] = runtimeContext.systemPipelines;
689
+ $[1] = t1;
690
+ } else {
691
+ t1 = $[1];
692
+ }
693
+ const init = t1;
694
+ let t2;
695
+ if ($[2] !== runtimeContext.systemPipelines) {
696
+ t2 = runtimeContext.systemPipelines.get(_systems.SystemType.update);
697
+ $[2] = runtimeContext.systemPipelines;
698
+ $[3] = t2;
699
+ } else {
700
+ t2 = $[3];
701
+ }
702
+ const update = t2;
703
+ let t3;
704
+ if ($[4] !== runtimeContext.systemPipelines) {
705
+ t3 = runtimeContext.systemPipelines.get(_systems.SystemType.render);
706
+ $[4] = runtimeContext.systemPipelines;
707
+ $[5] = t3;
708
+ } else {
709
+ t3 = $[5];
710
+ }
711
+ const render = t3;
712
+ let t4;
713
+ if ($[6] !== runtimeContext.systemPipelines) {
714
+ t4 = runtimeContext.systemPipelines.get(_systems.SystemType.sync);
715
+ $[6] = runtimeContext.systemPipelines;
716
+ $[7] = t4;
717
+ } else {
718
+ t4 = $[7];
719
+ }
720
+ const sync = t4;
721
+ let t5;
722
+ if ($[8] !== status) {
723
+ t5 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Text, { children: [
257
724
  "Status: ",
258
725
  status
259
- ] }),
260
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion, { children: [
261
- init && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: init, label: "Initialize" }),
262
- update && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: update, label: "Update" }),
263
- render && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: render, label: "Render" }),
264
- sync && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: sync, label: "Sync" })
265
- ] })
266
- ] });
726
+ ] });
727
+ $[8] = status;
728
+ $[9] = t5;
729
+ } else {
730
+ t5 = $[9];
731
+ }
732
+ let t6;
733
+ if ($[10] !== init) {
734
+ t6 = init && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: init, label: "Initialize" });
735
+ $[10] = init;
736
+ $[11] = t6;
737
+ } else {
738
+ t6 = $[11];
739
+ }
740
+ let t7;
741
+ if ($[12] !== update) {
742
+ t7 = update && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: update, label: "Update" });
743
+ $[12] = update;
744
+ $[13] = t7;
745
+ } else {
746
+ t7 = $[13];
747
+ }
748
+ let t8;
749
+ if ($[14] !== render) {
750
+ t8 = render && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: render, label: "Render" });
751
+ $[14] = render;
752
+ $[15] = t8;
753
+ } else {
754
+ t8 = $[15];
755
+ }
756
+ let t9;
757
+ if ($[16] !== sync) {
758
+ t9 = sync && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, pipeline_middleware_list_default, { pipeline: sync, label: "Sync" });
759
+ $[16] = sync;
760
+ $[17] = t9;
761
+ } else {
762
+ t9 = $[17];
763
+ }
764
+ let t10;
765
+ if ($[18] !== t6 || $[19] !== t7 || $[20] !== t8 || $[21] !== t9) {
766
+ t10 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _core.Accordion, { children: [
767
+ t6,
768
+ t7,
769
+ t8,
770
+ t9
771
+ ] });
772
+ $[18] = t6;
773
+ $[19] = t7;
774
+ $[20] = t8;
775
+ $[21] = t9;
776
+ $[22] = t10;
777
+ } else {
778
+ t10 = $[22];
779
+ }
780
+ let t11;
781
+ if ($[23] !== t10 || $[24] !== t5) {
782
+ t11 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
783
+ t5,
784
+ t10
785
+ ] });
786
+ $[23] = t10;
787
+ $[24] = t5;
788
+ $[25] = t11;
789
+ } else {
790
+ t11 = $[25];
791
+ }
792
+ return t11;
267
793
  }
268
794
  var systems_module_layout_default = SystemsModuleLayout;
269
795
 
270
796
  // src/nodes/node-systems-module.tsx
271
797
 
272
- function SystemsModuleNode({ id, data, selected, type }) {
273
- const { systemsModuleRepository } = _react.useContext.call(void 0, EcsFlowContext);
274
- const module = systemsModuleRepository.get(data.entityType);
275
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
276
- _layout.NodeContainer,
277
- {
278
- id,
279
- selected,
280
- data,
281
- title: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, color: "indigo", variant: "transparent", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, formatter_camel_case_default, { value: data.entityType }) }),
282
- type,
283
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, systems_module_layout_default, { type: data.entityType, module })
284
- }
285
- );
798
+ function SystemsModuleNode(t0) {
799
+ const $ = _compilerruntime.c.call(void 0, 15);
800
+ const {
801
+ id,
802
+ data,
803
+ selected,
804
+ type
805
+ } = t0;
806
+ const {
807
+ systemsModuleRepository
808
+ } = _react.useContext.call(void 0, EcsFlowContext);
809
+ let t1;
810
+ if ($[0] !== data.entityType || $[1] !== systemsModuleRepository) {
811
+ t1 = systemsModuleRepository.get(data.entityType);
812
+ $[0] = data.entityType;
813
+ $[1] = systemsModuleRepository;
814
+ $[2] = t1;
815
+ } else {
816
+ t1 = $[2];
817
+ }
818
+ const module = t1;
819
+ let t2;
820
+ if ($[3] !== data.entityType) {
821
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { fullWidth: true, color: "indigo", variant: "transparent", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, formatter_camel_case_default, { value: data.entityType }) });
822
+ $[3] = data.entityType;
823
+ $[4] = t2;
824
+ } else {
825
+ t2 = $[4];
826
+ }
827
+ let t3;
828
+ if ($[5] !== data.entityType || $[6] !== module) {
829
+ t3 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, systems_module_layout_default, { type: data.entityType, module });
830
+ $[5] = data.entityType;
831
+ $[6] = module;
832
+ $[7] = t3;
833
+ } else {
834
+ t3 = $[7];
835
+ }
836
+ let t4;
837
+ if ($[8] !== data || $[9] !== id || $[10] !== selected || $[11] !== t2 || $[12] !== t3 || $[13] !== type) {
838
+ t4 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _layout.NodeContainer, { id, selected, data, title: t2, type, children: t3 });
839
+ $[8] = data;
840
+ $[9] = id;
841
+ $[10] = selected;
842
+ $[11] = t2;
843
+ $[12] = t3;
844
+ $[13] = type;
845
+ $[14] = t4;
846
+ } else {
847
+ t4 = $[14];
848
+ }
849
+ return t4;
286
850
  }
287
851
  var node_systems_module_default = SystemsModuleNode;
288
852
 
@@ -358,10 +922,12 @@ var ecsNodeTemplates = {
358
922
  };
359
923
 
360
924
  // src/flow/flow-ecs-state.tsx
925
+
361
926
  var _canvas = require('@awesome-flow/core/canvas');
362
927
 
363
928
 
364
929
  // src/flow/flow-ecs-entities.tsx
930
+
365
931
  var _abstract = require('@awesome-flow/core/abstract');
366
932
  var _hooks3 = require('@awesome-flow/core/hooks');
367
933
 
@@ -370,27 +936,65 @@ var _hooks3 = require('@awesome-flow/core/hooks');
370
936
 
371
937
 
372
938
 
939
+
373
940
  function FlowEcsEdgeModules(props) {
374
- const { nodesToConnect } = props;
375
- const onConnect = _hooks3.useFlowStore.call(void 0, (state) => state.onConnect);
376
- const { ecsFlowRepository, entityRepository } = _react.useContext.call(void 0, EcsFlowContext);
377
- _react.useEffect.call(void 0, () => {
378
- for (const node of nodesToConnect) {
379
- const sourceHandle = node.data.handles.find((h) => h.connection === "source");
380
- const entity = entityRepository.get(node.data.entity);
381
- const systemModule = ecsFlowRepository.getSystemModuleNode(entity.myProxy.entityType);
382
- const targetHandle = _optionalChain([systemModule, 'optionalAccess', _6 => _6.data, 'access', _7 => _7.handles, 'access', _8 => _8.find, 'call', _9 => _9((h) => h.connection === "target")]);
383
- if (targetHandle) {
384
- onConnect({
385
- source: node.id,
386
- target: systemModule.id,
387
- sourceHandle: sourceHandle.id,
388
- targetHandle: targetHandle.id
389
- });
941
+ const $ = _compilerruntime.c.call(void 0, 7);
942
+ const {
943
+ nodesToConnect
944
+ } = props;
945
+ const onConnect = _hooks3.useFlowStore.call(void 0, _temp7);
946
+ const {
947
+ ecsFlowRepository,
948
+ entityRepository
949
+ } = _react.useContext.call(void 0, EcsFlowContext);
950
+ let t0;
951
+ let t1;
952
+ if ($[0] !== ecsFlowRepository || $[1] !== entityRepository || $[2] !== nodesToConnect || $[3] !== onConnect) {
953
+ t0 = () => {
954
+ for (const node of nodesToConnect) {
955
+ const sourceHandle = node.data.handles.find(_temp22);
956
+ const entity = entityRepository.get(node.data.entity);
957
+ const systemModule = ecsFlowRepository.getSystemModuleNode(entity.myProxy.entityType);
958
+ const targetHandle = _optionalChain([systemModule, 'optionalAccess', _6 => _6.data, 'access', _7 => _7.handles, 'access', _8 => _8.find, 'call', _9 => _9(_temp32)]);
959
+ if (targetHandle) {
960
+ onConnect({
961
+ source: node.id,
962
+ target: systemModule.id,
963
+ sourceHandle: sourceHandle.id,
964
+ targetHandle: targetHandle.id
965
+ });
966
+ }
390
967
  }
391
- }
392
- }, [nodesToConnect]);
393
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
968
+ };
969
+ t1 = [nodesToConnect, ecsFlowRepository, entityRepository, onConnect];
970
+ $[0] = ecsFlowRepository;
971
+ $[1] = entityRepository;
972
+ $[2] = nodesToConnect;
973
+ $[3] = onConnect;
974
+ $[4] = t0;
975
+ $[5] = t1;
976
+ } else {
977
+ t0 = $[4];
978
+ t1 = $[5];
979
+ }
980
+ _react.useEffect.call(void 0, t0, t1);
981
+ let t2;
982
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
983
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
984
+ $[6] = t2;
985
+ } else {
986
+ t2 = $[6];
987
+ }
988
+ return t2;
989
+ }
990
+ function _temp32(h_0) {
991
+ return h_0.connection === "target";
992
+ }
993
+ function _temp22(h) {
994
+ return h.connection === "source";
995
+ }
996
+ function _temp7(state) {
997
+ return state.onConnect;
394
998
  }
395
999
  var flow_ecs_edge_modules_default = FlowEcsEdgeModules;
396
1000
 
@@ -398,61 +1002,141 @@ var flow_ecs_edge_modules_default = FlowEcsEdgeModules;
398
1002
 
399
1003
 
400
1004
 
1005
+
401
1006
  function FlowEcsEdgeProxies(props) {
402
- const { nodesToConnect } = props;
403
- const onConnect = _hooks3.useFlowStore.call(void 0, (state) => state.onConnect);
404
- const { ecsFlowRepository, entityRepository } = _react.useContext.call(void 0, EcsFlowContext);
405
- _react.useEffect.call(void 0, () => {
406
- for (const node of nodesToConnect) {
407
- const sourceHandle = node.data.handles.find((h) => h.connection === "source");
408
- const entity = entityRepository.get(node.data.entity);
409
- for (const [, proxyMap] of entity.proxies) {
410
- for (const proxy of proxyMap.values()) {
411
- const proxyNode = ecsFlowRepository.getEntityNode(proxy);
412
- if (proxyNode) {
413
- const targetHandle = proxyNode.data.handles.find((h) => h.connection === "target");
414
- onConnect({
415
- source: node.id,
416
- target: proxyNode.id,
417
- sourceHandle: sourceHandle.id,
418
- targetHandle: targetHandle.id
419
- });
1007
+ const $ = _compilerruntime.c.call(void 0, 7);
1008
+ const {
1009
+ nodesToConnect
1010
+ } = props;
1011
+ const onConnect = _hooks3.useFlowStore.call(void 0, _temp8);
1012
+ const {
1013
+ ecsFlowRepository,
1014
+ entityRepository
1015
+ } = _react.useContext.call(void 0, EcsFlowContext);
1016
+ let t0;
1017
+ let t1;
1018
+ if ($[0] !== ecsFlowRepository || $[1] !== entityRepository || $[2] !== nodesToConnect || $[3] !== onConnect) {
1019
+ t0 = () => {
1020
+ for (const node of nodesToConnect) {
1021
+ const sourceHandle = node.data.handles.find(_temp23);
1022
+ const entity = entityRepository.get(node.data.entity);
1023
+ for (const [, proxyMap] of entity.proxies) {
1024
+ for (const proxy of proxyMap.values()) {
1025
+ const proxyNode = ecsFlowRepository.getEntityNode(proxy);
1026
+ if (proxyNode) {
1027
+ const targetHandle = proxyNode.data.handles.find(_temp33);
1028
+ onConnect({
1029
+ source: node.id,
1030
+ target: proxyNode.id,
1031
+ sourceHandle: sourceHandle.id,
1032
+ targetHandle: targetHandle.id
1033
+ });
1034
+ }
420
1035
  }
421
1036
  }
422
1037
  }
423
- }
424
- }, [nodesToConnect]);
425
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
1038
+ };
1039
+ t1 = [nodesToConnect, ecsFlowRepository, entityRepository, onConnect];
1040
+ $[0] = ecsFlowRepository;
1041
+ $[1] = entityRepository;
1042
+ $[2] = nodesToConnect;
1043
+ $[3] = onConnect;
1044
+ $[4] = t0;
1045
+ $[5] = t1;
1046
+ } else {
1047
+ t0 = $[4];
1048
+ t1 = $[5];
1049
+ }
1050
+ _react.useEffect.call(void 0, t0, t1);
1051
+ let t2;
1052
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1053
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
1054
+ $[6] = t2;
1055
+ } else {
1056
+ t2 = $[6];
1057
+ }
1058
+ return t2;
1059
+ }
1060
+ function _temp33(h_0) {
1061
+ return h_0.connection === "target";
1062
+ }
1063
+ function _temp23(h) {
1064
+ return h.connection === "source";
1065
+ }
1066
+ function _temp8(state) {
1067
+ return state.onConnect;
426
1068
  }
427
1069
  var flow_ecs_edge_proxies_default = FlowEcsEdgeProxies;
428
1070
 
429
1071
  // src/flow/flow-ecs-entities.tsx
430
1072
 
431
1073
  function FlowEcsEntities() {
432
- const { nodeFactory } = _react.useContext.call(void 0, _abstract.FlowContext);
433
- const addNodes = _hooks3.useFlowStore.call(void 0, (state) => state.addNodes);
434
- const { ecsFlowRepository, entityRepository } = _react.useContext.call(void 0, EcsFlowContext);
435
- const [entityNodes, setEntityNodes] = _react.useState.call(void 0, []);
436
- _react.useEffect.call(void 0, () => {
437
- const entities = entityRepository.listAll();
438
- const nodes = [];
439
- for (const entity of entities) {
440
- if (ecsFlowRepository.getEntityNode(entity.myProxy)) {
441
- continue;
1074
+ const $ = _compilerruntime.c.call(void 0, 9);
1075
+ const {
1076
+ nodeFactory
1077
+ } = _react.useContext.call(void 0, _abstract.FlowContext);
1078
+ const addNodes = _hooks3.useFlowStore.call(void 0, _temp9);
1079
+ const {
1080
+ ecsFlowRepository,
1081
+ entityRepository
1082
+ } = _react.useContext.call(void 0, EcsFlowContext);
1083
+ let t0;
1084
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1085
+ t0 = [];
1086
+ $[0] = t0;
1087
+ } else {
1088
+ t0 = $[0];
1089
+ }
1090
+ const [entityNodes, setEntityNodes] = _react.useState.call(void 0, t0);
1091
+ let t1;
1092
+ let t2;
1093
+ if ($[1] !== addNodes || $[2] !== ecsFlowRepository || $[3] !== entityRepository || $[4] !== nodeFactory) {
1094
+ t1 = () => {
1095
+ const entities = entityRepository.listAll();
1096
+ const nodes = [];
1097
+ for (const entity of entities) {
1098
+ if (ecsFlowRepository.getEntityNode(entity.myProxy)) {
1099
+ continue;
1100
+ }
1101
+ const node = nodeFactory.createNodeFromType("entity-node" /* entity */);
1102
+ node.data.entity = entity.myProxy;
1103
+ node.position = {
1104
+ x: 0,
1105
+ y: 0
1106
+ };
1107
+ ecsFlowRepository.addEntityNode(node);
1108
+ nodes.push(node);
442
1109
  }
443
- const node = nodeFactory.createNodeFromType("entity-node" /* entity */);
444
- node.data.entity = entity.myProxy;
445
- node.position = { x: 0, y: 0 };
446
- ecsFlowRepository.addEntityNode(node);
447
- nodes.push(node);
448
- }
449
- setEntityNodes(nodes);
450
- addNodes(nodes);
451
- }, [entityRepository.size]);
452
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
453
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_edge_proxies_default, { nodesToConnect: entityNodes }),
454
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_edge_modules_default, { nodesToConnect: entityNodes })
455
- ] });
1110
+ setEntityNodes(nodes);
1111
+ addNodes(nodes);
1112
+ };
1113
+ t2 = [entityRepository, entityRepository.size, ecsFlowRepository, nodeFactory, addNodes];
1114
+ $[1] = addNodes;
1115
+ $[2] = ecsFlowRepository;
1116
+ $[3] = entityRepository;
1117
+ $[4] = nodeFactory;
1118
+ $[5] = t1;
1119
+ $[6] = t2;
1120
+ } else {
1121
+ t1 = $[5];
1122
+ t2 = $[6];
1123
+ }
1124
+ _react.useEffect.call(void 0, t1, t2);
1125
+ let t3;
1126
+ if ($[7] !== entityNodes) {
1127
+ t3 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1128
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_edge_proxies_default, { nodesToConnect: entityNodes }),
1129
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_edge_modules_default, { nodesToConnect: entityNodes })
1130
+ ] });
1131
+ $[7] = entityNodes;
1132
+ $[8] = t3;
1133
+ } else {
1134
+ t3 = $[8];
1135
+ }
1136
+ return t3;
1137
+ }
1138
+ function _temp9(state) {
1139
+ return state.addNodes;
456
1140
  }
457
1141
  var flow_ecs_entities_default = FlowEcsEntities;
458
1142
 
@@ -461,51 +1145,163 @@ var flow_ecs_entities_default = FlowEcsEntities;
461
1145
 
462
1146
 
463
1147
 
1148
+
464
1149
  function FlowEcsModules() {
465
- const { nodeFactory } = _react.useContext.call(void 0, _abstract.FlowContext);
466
- const addNodes = _hooks3.useFlowStore.call(void 0, (state) => state.addNodes);
467
- const { ecsFlowRepository, systemsModuleRepository } = _react.useContext.call(void 0, EcsFlowContext);
468
- _react.useEffect.call(void 0, () => {
469
- const modules = Array.from(systemsModuleRepository.list()).filter((m) => !!m);
470
- const keys = Array.from(modules.values()).map((v) => v[0]);
471
- const nodesToAdd = [];
472
- for (const element of keys) {
473
- if (ecsFlowRepository.getSystemModuleNode(element)) {
474
- continue;
1150
+ const $ = _compilerruntime.c.call(void 0, 7);
1151
+ const {
1152
+ nodeFactory
1153
+ } = _react.useContext.call(void 0, _abstract.FlowContext);
1154
+ const addNodes = _hooks3.useFlowStore.call(void 0, _temp10);
1155
+ const {
1156
+ ecsFlowRepository,
1157
+ systemsModuleRepository
1158
+ } = _react.useContext.call(void 0, EcsFlowContext);
1159
+ let t0;
1160
+ let t1;
1161
+ if ($[0] !== addNodes || $[1] !== ecsFlowRepository || $[2] !== nodeFactory || $[3] !== systemsModuleRepository) {
1162
+ t0 = () => {
1163
+ const modules = Array.from(systemsModuleRepository.list()).filter(_temp24);
1164
+ const keys = Array.from(modules.values()).map(_temp34);
1165
+ const nodesToAdd = [];
1166
+ for (const element of keys) {
1167
+ if (ecsFlowRepository.getSystemModuleNode(element)) {
1168
+ continue;
1169
+ }
1170
+ const node = nodeFactory.createNodeFromType("systems-module-node" /* systemsModule */);
1171
+ node.data.entityType = element;
1172
+ node.position = {
1173
+ x: 0,
1174
+ y: 0
1175
+ };
1176
+ ecsFlowRepository.addSystemModuleNode(node);
1177
+ nodesToAdd.push(node);
475
1178
  }
476
- const node = nodeFactory.createNodeFromType("systems-module-node" /* systemsModule */);
477
- node.data.entityType = element;
478
- node.position = { x: 0, y: 0 };
479
- ecsFlowRepository.addSystemModuleNode(node);
480
- nodesToAdd.push(node);
481
- }
482
- if (nodesToAdd.length) {
483
- addNodes(nodesToAdd);
484
- }
485
- }, [systemsModuleRepository.size]);
486
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
1179
+ if (nodesToAdd.length) {
1180
+ addNodes(nodesToAdd);
1181
+ }
1182
+ };
1183
+ t1 = [nodeFactory, addNodes, ecsFlowRepository, ecsFlowRepository.sizeNodes, systemsModuleRepository, systemsModuleRepository.size];
1184
+ $[0] = addNodes;
1185
+ $[1] = ecsFlowRepository;
1186
+ $[2] = nodeFactory;
1187
+ $[3] = systemsModuleRepository;
1188
+ $[4] = t0;
1189
+ $[5] = t1;
1190
+ } else {
1191
+ t0 = $[4];
1192
+ t1 = $[5];
1193
+ }
1194
+ _react.useEffect.call(void 0, t0, t1);
1195
+ let t2;
1196
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1197
+ t2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {});
1198
+ $[6] = t2;
1199
+ } else {
1200
+ t2 = $[6];
1201
+ }
1202
+ return t2;
1203
+ }
1204
+ function _temp34(v) {
1205
+ return v[0];
1206
+ }
1207
+ function _temp24(m) {
1208
+ return !!m;
1209
+ }
1210
+ function _temp10(state) {
1211
+ return state.addNodes;
487
1212
  }
488
1213
  var flow_ecs_modules_default = FlowEcsModules;
489
1214
 
490
1215
  // src/flow/flow-ecs-state.tsx
491
1216
 
492
1217
  function FlowEcsState(props) {
1218
+ const $ = _compilerruntime.c.call(void 0, 17);
493
1219
  const [, setUpdates] = _react.useState.call(void 0, 0);
494
1220
  const [refreshLayout, setRefreshLayout] = _react.useState.call(void 0, false);
495
- const { ecsFlowRepository } = _react.useContext.call(void 0, EcsFlowContext);
496
- _react.useEffect.call(void 0, () => {
497
- setRefreshLayout(true);
498
- }, [ecsFlowRepository.sizeNodes]);
499
- _react.useEffect.call(void 0, () => {
500
- setInterval(() => {
501
- setUpdates((updates) => updates + 1);
502
- }, 1e3);
503
- }, []);
504
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
505
- props.showSystemModules && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_modules_default, {}),
506
- props.showEntities && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_entities_default, {}),
507
- props.autoLayout && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _canvas.FlowAutoLayout, { refreshLayout })
508
- ] });
1221
+ const {
1222
+ ecsFlowRepository
1223
+ } = _react.useContext.call(void 0, EcsFlowContext);
1224
+ let t0;
1225
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1226
+ t0 = () => {
1227
+ setRefreshLayout(true);
1228
+ };
1229
+ $[0] = t0;
1230
+ } else {
1231
+ t0 = $[0];
1232
+ }
1233
+ let t1;
1234
+ if ($[1] !== ecsFlowRepository.sizeNodes) {
1235
+ t1 = [ecsFlowRepository.sizeNodes];
1236
+ $[1] = ecsFlowRepository.sizeNodes;
1237
+ $[2] = t1;
1238
+ } else {
1239
+ t1 = $[2];
1240
+ }
1241
+ _react.useEffect.call(void 0, t0, t1);
1242
+ let t2;
1243
+ if ($[3] !== setUpdates) {
1244
+ t2 = () => {
1245
+ setInterval(() => {
1246
+ setUpdates(_temp11);
1247
+ }, 1e3);
1248
+ };
1249
+ $[3] = setUpdates;
1250
+ $[4] = t2;
1251
+ } else {
1252
+ t2 = $[4];
1253
+ }
1254
+ let t3;
1255
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1256
+ t3 = [];
1257
+ $[5] = t3;
1258
+ } else {
1259
+ t3 = $[5];
1260
+ }
1261
+ _react.useEffect.call(void 0, t2, t3);
1262
+ let t4;
1263
+ if ($[6] !== props.showSystemModules) {
1264
+ t4 = props.showSystemModules && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_modules_default, {});
1265
+ $[6] = props.showSystemModules;
1266
+ $[7] = t4;
1267
+ } else {
1268
+ t4 = $[7];
1269
+ }
1270
+ let t5;
1271
+ if ($[8] !== props.showEntities) {
1272
+ t5 = props.showEntities && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, flow_ecs_entities_default, {});
1273
+ $[8] = props.showEntities;
1274
+ $[9] = t5;
1275
+ } else {
1276
+ t5 = $[9];
1277
+ }
1278
+ let t6;
1279
+ if ($[10] !== props.autoLayout || $[11] !== refreshLayout) {
1280
+ t6 = props.autoLayout && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _canvas.FlowAutoLayout, { refreshLayout });
1281
+ $[10] = props.autoLayout;
1282
+ $[11] = refreshLayout;
1283
+ $[12] = t6;
1284
+ } else {
1285
+ t6 = $[12];
1286
+ }
1287
+ let t7;
1288
+ if ($[13] !== t4 || $[14] !== t5 || $[15] !== t6) {
1289
+ t7 = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1290
+ t4,
1291
+ t5,
1292
+ t6
1293
+ ] });
1294
+ $[13] = t4;
1295
+ $[14] = t5;
1296
+ $[15] = t6;
1297
+ $[16] = t7;
1298
+ } else {
1299
+ t7 = $[16];
1300
+ }
1301
+ return t7;
1302
+ }
1303
+ function _temp11(updates) {
1304
+ return updates + 1;
509
1305
  }
510
1306
  var flow_ecs_state_default = _react.memo.call(void 0, FlowEcsState);
511
1307