@awesome-flow/ecs 0.9.0 → 0.9.2

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 +12 -11
package/dist/index.js CHANGED
@@ -43,72 +43,205 @@ var EcsHandleDataType = /* @__PURE__ */ ((EcsHandleDataType2) => {
43
43
  })(EcsHandleDataType || {});
44
44
 
45
45
  // src/nodes/node-entity.tsx
46
+ import { c as _c9 } from "react/compiler-runtime";
46
47
  import { NodeContainer } from "@awesome-flow/core/layout";
47
48
  import { Badge as Badge7 } from "@mantine/core";
48
- import { useContext as useContext3, useMemo as useMemo4 } from "react";
49
+ import { useContext as useContext3 } from "react";
49
50
 
50
51
  // src/components/formatter-camel-case.tsx
51
- import { memo, useMemo } from "react";
52
+ import { c as _c } from "react/compiler-runtime";
53
+ import { memo } from "react";
52
54
  function CamelCaseFormatter(props) {
53
- const value = useMemo(
54
- () => props.value?.toString().replace(/([a-z])([A-Z])/g, "$1 $2"),
55
- [props.value]
56
- );
55
+ const $ = _c(2);
56
+ let t0;
57
+ let t1;
58
+ if ($[0] !== props.value) {
59
+ t1 = props.value?.toString().replace(/([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 = memo(CamelCaseFormatter);
60
70
 
61
71
  // src/layout/entity-layout.tsx
72
+ import { c as _c8 } from "react/compiler-runtime";
62
73
  import { Accordion as Accordion4, Badge as Badge6, Divider, Group } from "@mantine/core";
63
74
 
64
75
  // src/components/entity-component-list.tsx
76
+ import { c as _c4 } from "react/compiler-runtime";
65
77
  import { Accordion, Badge, Stack } from "@mantine/core";
66
78
  import { memo as memo4 } from "react";
67
79
 
68
80
  // src/components/entity-component-inspector.tsx
81
+ import { c as _c3 } from "react/compiler-runtime";
69
82
  import { Box, Button, Collapse } from "@mantine/core";
70
83
  import { useDisclosure } from "@mantine/hooks";
71
- import { memo as memo3, useMemo as useMemo3 } from "react";
84
+ import { memo as memo3 } from "react";
72
85
 
73
86
  // src/components/object-inspector.tsx
87
+ import { c as _c2 } from "react/compiler-runtime";
74
88
  import { useComputedColorScheme } from "@mantine/core";
75
- import { memo as memo2, useMemo as useMemo2 } from "react";
89
+ import { memo as memo2 } from "react";
76
90
  import { Inspector } from "react-inspector";
77
91
  import { jsx } from "react/jsx-runtime";
78
92
  function ObjectInspector(props) {
93
+ const $ = _c2(3);
79
94
  const colorScheme = useComputedColorScheme();
80
- const theme = useMemo2(
81
- () => colorScheme === "dark" ? "chromeDark" : "chromeLight",
82
- [colorScheme]
83
- );
84
- return /* @__PURE__ */ jsx(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__ */ jsx(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 = memo2(ObjectInspector);
87
110
 
88
111
  // src/components/entity-component-inspector.tsx
89
112
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
90
113
  function EntityComponentInspector(props) {
91
- const [opened, { toggle }] = useDisclosure(false);
92
- const buttonColor = useMemo3(() => opened ? "light" : "indigo", [opened]);
93
- return /* @__PURE__ */ jsxs(Box, { children: [
94
- /* @__PURE__ */ jsx2(Button, { variant: "outline", size: "xs", onClick: toggle, color: buttonColor, fullWidth: true, children: props.component.componentType }),
95
- /* @__PURE__ */ jsx2(Collapse, { in: opened, children: opened && /* @__PURE__ */ jsx2(object_inspector_default, { data: props.component }) })
96
- ] });
114
+ const $ = _c3(13);
115
+ const [opened, t0] = useDisclosure(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__ */ jsx2(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__ */ jsx2(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__ */ jsx2(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__ */ jsxs(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 = memo3(EntityComponentInspector);
99
165
 
100
166
  // src/components/entity-component-list.tsx
101
167
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
102
168
  function EntityComponentList(props) {
103
- const components = Array.from(props.entity.components.values());
104
- return /* @__PURE__ */ jsxs2(Accordion.Item, { value: "components", children: [
105
- /* @__PURE__ */ jsx3(Accordion.Control, { children: /* @__PURE__ */ jsx3(Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: "Components" }) }),
106
- /* @__PURE__ */ jsx3(Accordion.Panel, { children: /* @__PURE__ */ jsx3(Stack, { children: components.map((c, i) => /* @__PURE__ */ jsx3(entity_component_inspector_default, { component: c }, i)) }) })
107
- ] }, "components");
169
+ const $ = _c4(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 = Accordion.Item;
180
+ t1 = "components";
181
+ t2 = "components";
182
+ t3 = /* @__PURE__ */ jsx3(Accordion.Control, { children: /* @__PURE__ */ jsx3(Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: "Components" }) });
183
+ T1 = Accordion.Panel;
184
+ T0 = 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__ */ jsx3(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__ */ jsx3(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__ */ jsxs2(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__ */ jsx3(entity_component_inspector_default, { component: c }, i);
108
240
  }
109
241
  var entity_component_list_default = memo4(EntityComponentList);
110
242
 
111
243
  // src/components/entity-proxy-list.tsx
244
+ import { c as _c5 } from "react/compiler-runtime";
112
245
  import { Accordion as Accordion2, Badge as Badge3, Stack as Stack2 } from "@mantine/core";
113
246
  import { memo as memo6 } from "react";
114
247
 
@@ -126,163 +259,594 @@ var badge_list_default = memo5(BadgeList);
126
259
  // src/components/entity-proxy-list.tsx
127
260
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
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__ */ jsxs3(Accordion2.Item, { value: "proxies", children: [
132
- /* @__PURE__ */ jsx5(Accordion2.Control, { children: /* @__PURE__ */ jsx5(Badge3, { fullWidth: true, variant: "light", rightSection: items.length, children: "Proxies" }) }),
133
- /* @__PURE__ */ jsx5(Accordion2.Panel, { children: /* @__PURE__ */ jsx5(Stack2, { children: /* @__PURE__ */ jsx5(badge_list_default, { items, badge: { variant: "outline" } }) }) })
134
- ] }, "proxies");
262
+ const $ = _c5(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__ */ jsx5(Accordion2.Control, { children: /* @__PURE__ */ jsx5(Badge3, { 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__ */ jsx5(Accordion2.Panel, { children: /* @__PURE__ */ jsx5(Stack2, { children: /* @__PURE__ */ jsx5(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__ */ jsxs3(Accordion2.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 = memo6(EntityProxyList);
137
322
 
138
323
  // src/components/entity-subscription-list.tsx
324
+ import { c as _c6 } from "react/compiler-runtime";
139
325
  import { Accordion as Accordion3, Badge as Badge4, Stack as Stack3 } from "@mantine/core";
140
326
  import { memo as memo7, useContext } from "react";
141
327
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
142
328
  function EntitySubscriptionList(props) {
143
- const { entityEventsManager } = useContext(EcsFlowContext);
144
- const subscriptions = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
145
- return /* @__PURE__ */ jsxs4(Accordion3.Item, { value: "subscriptions", children: [
146
- /* @__PURE__ */ jsx6(Accordion3.Control, { children: /* @__PURE__ */ jsx6(Badge4, { fullWidth: true, variant: "light", rightSection: subscriptions.length, children: "Events" }) }),
147
- /* @__PURE__ */ jsx6(Accordion3.Panel, { children: /* @__PURE__ */ jsx6(Stack3, { children: /* @__PURE__ */ jsx6(badge_list_default, { items: subscriptions, badge: { variant: "outline" } }) }) })
148
- ] }, "subscriptions");
329
+ const $ = _c6(11);
330
+ const {
331
+ entityEventsManager
332
+ } = useContext(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__ */ jsx6(Accordion3.Control, { children: /* @__PURE__ */ jsx6(Badge4, { 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__ */ jsx6(Accordion3.Panel, { children: /* @__PURE__ */ jsx6(Stack3, { children: /* @__PURE__ */ jsx6(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__ */ jsxs4(Accordion3.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 = memo7(EntitySubscriptionList);
151
383
 
152
384
  // src/components/entity-update-counter.tsx
385
+ import { c as _c7 } from "react/compiler-runtime";
153
386
  import { Badge as Badge5 } from "@mantine/core";
154
387
  import { memo as memo8, useContext as useContext2, useEffect, useState } from "react";
155
388
  import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
156
389
  function EntityUpdateCounter(props) {
390
+ const $ = _c7(16);
157
391
  const [, setRefresh] = useState(0);
158
- const { entityUpdateCounter } = useContext2(EcsFlowContext);
159
- const updates = entityUpdateCounter.getUpdateCount(props.entityUid) || 0;
160
- const removes = entityUpdateCounter.getRemoveCount(props.entityUid) || 0;
161
- useEffect(() => {
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
+ } = useContext2(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__ */ jsxs5(Fragment, { children: [
171
- /* @__PURE__ */ jsx7(Badge5, { variant: "light", children: updates }),
172
- /* @__PURE__ */ jsx7(Badge5, { 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
+ useEffect(t2, t3);
439
+ let t4;
440
+ if ($[9] !== updates) {
441
+ t4 = /* @__PURE__ */ jsx7(Badge5, { 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__ */ jsx7(Badge5, { 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__ */ jsxs5(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 = memo8(EntityUpdateCounter);
176
473
 
177
474
  // src/layout/entity-layout.tsx
178
475
  import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
179
- function EntityLayout({ entity }) {
180
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
181
- /* @__PURE__ */ jsxs6(Group, { children: [
476
+ function EntityLayout(t0) {
477
+ const $ = _c8(8);
478
+ const {
479
+ entity
480
+ } = t0;
481
+ let t1;
482
+ if ($[0] !== entity.myProxy.entityUid) {
483
+ t1 = /* @__PURE__ */ jsxs6(Group, { children: [
182
484
  /* @__PURE__ */ jsx8(Badge6, { variant: "outline", color: "orange", children: entity.myProxy.entityUid }),
183
485
  /* @__PURE__ */ jsx8(entity_update_counter_default, { entityUid: entity.myProxy.entityUid })
184
- ] }),
185
- /* @__PURE__ */ jsx8(Divider, { my: 5 }),
186
- /* @__PURE__ */ jsxs6(Accordion4, { 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__ */ jsx8(Divider, { my: 5 });
495
+ $[2] = t2;
496
+ } else {
497
+ t2 = $[2];
498
+ }
499
+ let t3;
500
+ if ($[3] !== entity) {
501
+ t3 = /* @__PURE__ */ jsxs6(Accordion4, { children: [
187
502
  /* @__PURE__ */ jsx8(entity_component_list_default, { entity }),
188
503
  /* @__PURE__ */ jsx8(entity_proxy_list_default, { entity }),
189
504
  /* @__PURE__ */ jsx8(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__ */ jsxs6(Fragment2, { 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
  import { jsx as jsx9 } from "react/jsx-runtime";
197
- function EntityNode({ id, data, selected, type }) {
198
- const { entityRepository } = useContext3(EcsFlowContext);
199
- const entity = useMemo4(() => entityRepository.get(data.entity), [data.entity]);
200
- return /* @__PURE__ */ jsx9(
201
- NodeContainer,
202
- {
203
- id,
204
- selected,
205
- data,
206
- title: /* @__PURE__ */ jsx9(Badge7, { fullWidth: true, variant: "transparent", children: /* @__PURE__ */ jsx9(formatter_camel_case_default, { value: entity.myProxy.entityType }) }),
207
- type,
208
- children: /* @__PURE__ */ jsx9(entity_layout_default, { entity })
209
- }
210
- );
530
+ function EntityNode(t0) {
531
+ const $ = _c9(14);
532
+ const {
533
+ id,
534
+ data,
535
+ selected,
536
+ type
537
+ } = t0;
538
+ const {
539
+ entityRepository
540
+ } = useContext3(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__ */ jsx9(Badge7, { fullWidth: true, variant: "transparent", children: /* @__PURE__ */ jsx9(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__ */ jsx9(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__ */ jsx9(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
 
214
586
  // src/nodes/node-systems-module.tsx
587
+ import { c as _c12 } from "react/compiler-runtime";
215
588
  import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
216
589
  import { Badge as Badge9 } from "@mantine/core";
217
590
  import { useContext as useContext4 } from "react";
218
591
 
219
592
  // src/layout/systems-module-layout.tsx
593
+ import { c as _c11 } from "react/compiler-runtime";
220
594
  import { SystemType } from "@awesome-ecs/abstract/systems";
221
595
  import { Accordion as Accordion6, Text } from "@mantine/core";
222
- import { useMemo as useMemo5 } from "react";
223
596
 
224
597
  // src/components/pipeline-middleware-list.tsx
598
+ import { c as _c10 } from "react/compiler-runtime";
225
599
  import { Accordion as Accordion5, Badge as Badge8, Stack as Stack4 } from "@mantine/core";
226
600
  import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
227
601
  function PipelineMiddlewareList(props) {
228
- let middleware = [];
602
+ const $ = _c10(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__ */ jsxs7(Accordion5.Item, { value: props.label, children: [
236
- /* @__PURE__ */ jsx10(Accordion5.Control, { children: /* @__PURE__ */ jsx10(Badge8, { fullWidth: true, variant: "light", rightSection: components.length, children: props.label }) }),
237
- /* @__PURE__ */ jsx10(Accordion5.Panel, { children: /* @__PURE__ */ jsx10(Stack4, { children: /* @__PURE__ */ jsx10(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__ */ jsx10(Accordion5.Control, { children: /* @__PURE__ */ jsx10(Badge8, { 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__ */ jsx10(Accordion5.Panel, { children: /* @__PURE__ */ jsx10(Stack4, { children: /* @__PURE__ */ jsx10(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__ */ jsxs7(Accordion5.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
  import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
244
671
  function SystemsModuleLayout(props) {
245
- const { module } = props;
246
- const runtimeContext = module["runtimeContext"];
247
- const { systemContext } = runtimeContext;
248
- const { status } = useMemo5(() => {
249
- return systemContext.runtime;
250
- }, [systemContext.runtime.status]);
251
- const init = runtimeContext.systemPipelines.get(SystemType.initialize);
252
- const update = runtimeContext.systemPipelines.get(SystemType.update);
253
- const render = runtimeContext.systemPipelines.get(SystemType.render);
254
- const sync = runtimeContext.systemPipelines.get(SystemType.sync);
255
- return /* @__PURE__ */ jsxs8(Fragment3, { children: [
256
- /* @__PURE__ */ jsxs8(Text, { children: [
672
+ const $ = _c11(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(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(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(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(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__ */ jsxs8(Text, { children: [
257
724
  "Status: ",
258
725
  status
259
- ] }),
260
- /* @__PURE__ */ jsxs8(Accordion6, { children: [
261
- init && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: init, label: "Initialize" }),
262
- update && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: update, label: "Update" }),
263
- render && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: render, label: "Render" }),
264
- sync && /* @__PURE__ */ jsx11(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__ */ jsx11(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__ */ jsx11(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__ */ jsx11(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__ */ jsx11(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__ */ jsxs8(Accordion6, { 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__ */ jsxs8(Fragment3, { 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
  import { jsx as jsx12 } from "react/jsx-runtime";
272
- function SystemsModuleNode({ id, data, selected, type }) {
273
- const { systemsModuleRepository } = useContext4(EcsFlowContext);
274
- const module = systemsModuleRepository.get(data.entityType);
275
- return /* @__PURE__ */ jsx12(
276
- NodeContainer2,
277
- {
278
- id,
279
- selected,
280
- data,
281
- title: /* @__PURE__ */ jsx12(Badge9, { fullWidth: true, color: "indigo", variant: "transparent", children: /* @__PURE__ */ jsx12(formatter_camel_case_default, { value: data.entityType }) }),
282
- type,
283
- children: /* @__PURE__ */ jsx12(systems_module_layout_default, { type: data.entityType, module })
284
- }
285
- );
798
+ function SystemsModuleNode(t0) {
799
+ const $ = _c12(15);
800
+ const {
801
+ id,
802
+ data,
803
+ selected,
804
+ type
805
+ } = t0;
806
+ const {
807
+ systemsModuleRepository
808
+ } = useContext4(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__ */ jsx12(Badge9, { fullWidth: true, color: "indigo", variant: "transparent", children: /* @__PURE__ */ jsx12(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__ */ jsx12(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__ */ jsx12(NodeContainer2, { 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,154 +922,386 @@ var ecsNodeTemplates = {
358
922
  };
359
923
 
360
924
  // src/flow/flow-ecs-state.tsx
925
+ import { c as _c17 } from "react/compiler-runtime";
361
926
  import { FlowAutoLayout } from "@awesome-flow/core/canvas";
362
927
  import { memo as memo9, useContext as useContext9, useEffect as useEffect6, useState as useState3 } from "react";
363
928
 
364
929
  // src/flow/flow-ecs-entities.tsx
930
+ import { c as _c15 } from "react/compiler-runtime";
365
931
  import { FlowContext } from "@awesome-flow/core/abstract";
366
932
  import { useFlowStore as useFlowStore3 } from "@awesome-flow/core/hooks";
367
933
  import { useContext as useContext7, useEffect as useEffect4, useState as useState2 } from "react";
368
934
 
369
935
  // src/flow/flow-ecs-edge-modules.tsx
936
+ import { c as _c13 } from "react/compiler-runtime";
370
937
  import { useFlowStore } from "@awesome-flow/core/hooks";
371
938
  import { useContext as useContext5, useEffect as useEffect2 } from "react";
372
939
  import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
373
940
  function FlowEcsEdgeModules(props) {
374
- const { nodesToConnect } = props;
375
- const onConnect = useFlowStore((state) => state.onConnect);
376
- const { ecsFlowRepository, entityRepository } = useContext5(EcsFlowContext);
377
- useEffect2(() => {
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 = systemModule?.data.handles.find((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 $ = _c13(7);
942
+ const {
943
+ nodesToConnect
944
+ } = props;
945
+ const onConnect = useFlowStore(_temp7);
946
+ const {
947
+ ecsFlowRepository,
948
+ entityRepository
949
+ } = useContext5(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 = systemModule?.data.handles.find(_temp32);
959
+ if (targetHandle) {
960
+ onConnect({
961
+ source: node.id,
962
+ target: systemModule.id,
963
+ sourceHandle: sourceHandle.handleId,
964
+ targetHandle: targetHandle.handleId
965
+ });
966
+ }
390
967
  }
391
- }
392
- }, [nodesToConnect]);
393
- return /* @__PURE__ */ jsx13(Fragment4, {});
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
+ useEffect2(t0, t1);
981
+ let t2;
982
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
983
+ t2 = /* @__PURE__ */ jsx13(Fragment4, {});
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
 
397
1001
  // src/flow/flow-ecs-edge-proxies.tsx
1002
+ import { c as _c14 } from "react/compiler-runtime";
398
1003
  import { useFlowStore as useFlowStore2 } from "@awesome-flow/core/hooks";
399
1004
  import { useContext as useContext6, useEffect as useEffect3 } from "react";
400
1005
  import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
401
1006
  function FlowEcsEdgeProxies(props) {
402
- const { nodesToConnect } = props;
403
- const onConnect = useFlowStore2((state) => state.onConnect);
404
- const { ecsFlowRepository, entityRepository } = useContext6(EcsFlowContext);
405
- useEffect3(() => {
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 $ = _c14(7);
1008
+ const {
1009
+ nodesToConnect
1010
+ } = props;
1011
+ const onConnect = useFlowStore2(_temp8);
1012
+ const {
1013
+ ecsFlowRepository,
1014
+ entityRepository
1015
+ } = useContext6(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.handleId,
1032
+ targetHandle: targetHandle.handleId
1033
+ });
1034
+ }
420
1035
  }
421
1036
  }
422
1037
  }
423
- }
424
- }, [nodesToConnect]);
425
- return /* @__PURE__ */ jsx14(Fragment5, {});
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
+ useEffect3(t0, t1);
1051
+ let t2;
1052
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1053
+ t2 = /* @__PURE__ */ jsx14(Fragment5, {});
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
  import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
431
1073
  function FlowEcsEntities() {
432
- const { nodeFactory } = useContext7(FlowContext);
433
- const addNodes = useFlowStore3((state) => state.addNodes);
434
- const { ecsFlowRepository, entityRepository } = useContext7(EcsFlowContext);
435
- const [entityNodes, setEntityNodes] = useState2([]);
436
- useEffect4(() => {
437
- const entities = entityRepository.listAll();
438
- const nodes = [];
439
- for (const entity of entities) {
440
- if (ecsFlowRepository.getEntityNode(entity.myProxy)) {
441
- continue;
1074
+ const $ = _c15(9);
1075
+ const {
1076
+ nodeFactory
1077
+ } = useContext7(FlowContext);
1078
+ const addNodes = useFlowStore3(_temp9);
1079
+ const {
1080
+ ecsFlowRepository,
1081
+ entityRepository
1082
+ } = useContext7(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] = useState2(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__ */ jsxs9(Fragment6, { children: [
453
- /* @__PURE__ */ jsx15(flow_ecs_edge_proxies_default, { nodesToConnect: entityNodes }),
454
- /* @__PURE__ */ jsx15(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
+ useEffect4(t1, t2);
1125
+ let t3;
1126
+ if ($[7] !== entityNodes) {
1127
+ t3 = /* @__PURE__ */ jsxs9(Fragment6, { children: [
1128
+ /* @__PURE__ */ jsx15(flow_ecs_edge_proxies_default, { nodesToConnect: entityNodes }),
1129
+ /* @__PURE__ */ jsx15(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
 
459
1143
  // src/flow/flow-ecs-modules.tsx
1144
+ import { c as _c16 } from "react/compiler-runtime";
460
1145
  import { FlowContext as FlowContext2 } from "@awesome-flow/core/abstract";
461
1146
  import { useFlowStore as useFlowStore4 } from "@awesome-flow/core/hooks";
462
1147
  import { useContext as useContext8, useEffect as useEffect5 } from "react";
463
1148
  import { Fragment as Fragment7, jsx as jsx16 } from "react/jsx-runtime";
464
1149
  function FlowEcsModules() {
465
- const { nodeFactory } = useContext8(FlowContext2);
466
- const addNodes = useFlowStore4((state) => state.addNodes);
467
- const { ecsFlowRepository, systemsModuleRepository } = useContext8(EcsFlowContext);
468
- useEffect5(() => {
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 $ = _c16(7);
1151
+ const {
1152
+ nodeFactory
1153
+ } = useContext8(FlowContext2);
1154
+ const addNodes = useFlowStore4(_temp10);
1155
+ const {
1156
+ ecsFlowRepository,
1157
+ systemsModuleRepository
1158
+ } = useContext8(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);
1178
+ }
1179
+ if (nodesToAdd.length) {
1180
+ addNodes(nodesToAdd);
475
1181
  }
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__ */ jsx16(Fragment7, {});
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
+ useEffect5(t0, t1);
1195
+ let t2;
1196
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1197
+ t2 = /* @__PURE__ */ jsx16(Fragment7, {});
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
  import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
492
1217
  function FlowEcsState(props) {
1218
+ const $ = _c17(17);
493
1219
  const [, setUpdates] = useState3(0);
494
1220
  const [refreshLayout, setRefreshLayout] = useState3(false);
495
- const { ecsFlowRepository } = useContext9(EcsFlowContext);
496
- useEffect6(() => {
497
- setRefreshLayout(true);
498
- }, [ecsFlowRepository.sizeNodes]);
499
- useEffect6(() => {
500
- setInterval(() => {
501
- setUpdates((updates) => updates + 1);
502
- }, 1e3);
503
- }, []);
504
- return /* @__PURE__ */ jsxs10(Fragment8, { children: [
505
- props.showSystemModules && /* @__PURE__ */ jsx17(flow_ecs_modules_default, {}),
506
- props.showEntities && /* @__PURE__ */ jsx17(flow_ecs_entities_default, {}),
507
- props.autoLayout && /* @__PURE__ */ jsx17(FlowAutoLayout, { refreshLayout })
508
- ] });
1221
+ const {
1222
+ ecsFlowRepository
1223
+ } = useContext9(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
+ useEffect6(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
+ useEffect6(t2, t3);
1262
+ let t4;
1263
+ if ($[6] !== props.showSystemModules) {
1264
+ t4 = props.showSystemModules && /* @__PURE__ */ jsx17(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__ */ jsx17(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__ */ jsx17(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__ */ jsxs10(Fragment8, { 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 = memo9(FlowEcsState);
511
1307
  export {