@awesome-flow/ecs 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,1320 +1,568 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;// src/abstract/ecs-flow-context.ts
2
- var _react = require('react');
3
- var EcsFlowContext = _react.createContext.call(void 0, null);
4
-
5
- // src/utils/id-generator.ts
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const react = __toESM(require("react"));
25
+ const __awesome_flow_core_layout = __toESM(require("@awesome-flow/core/layout"));
26
+ const __mantine_core = __toESM(require("@mantine/core"));
27
+ const __mantine_hooks = __toESM(require("@mantine/hooks"));
28
+ const react_inspector = __toESM(require("react-inspector"));
29
+ const react_jsx_runtime = __toESM(require("react/jsx-runtime"));
30
+ const __awesome_ecs_abstract_systems = __toESM(require("@awesome-ecs/abstract/systems"));
31
+ const __xyflow_react = __toESM(require("@xyflow/react"));
32
+ const __awesome_flow_core_canvas = __toESM(require("@awesome-flow/core/canvas"));
33
+ const __awesome_flow_core_abstract = __toESM(require("@awesome-flow/core/abstract"));
34
+ const __awesome_flow_core_hooks = __toESM(require("@awesome-flow/core/hooks"));
35
+
36
+ //#region src/abstract/ecs-flow-context.ts
37
+ const EcsFlowContext = (0, react.createContext)(null);
38
+
39
+ //#endregion
40
+ //#region src/utils/id-generator.ts
6
41
  var EcsIdGenerator = class {
7
- static entityProxy(proxy) {
8
- return `${proxy.entityType}:${proxy.entityUid}`;
9
- }
42
+ static entityProxy(proxy) {
43
+ return `${proxy.entityType}:${proxy.entityUid}`;
44
+ }
10
45
  };
11
46
 
12
- // src/abstract/ecs-flow-repository.ts
47
+ //#endregion
48
+ //#region src/abstract/ecs-flow-repository.ts
13
49
  var EcsFlowRepository = class {
14
-
15
- constructor() {
16
- this.nodes = /* @__PURE__ */ new Map();
17
- }
18
- get sizeNodes() {
19
- return this.nodes.size;
20
- }
21
- addSystemModuleNode(node) {
22
- this.nodes.set(node.data.entityType.toString(), node);
23
- }
24
- getSystemModuleNode(entityType) {
25
- return this.nodes.get(entityType.toString());
26
- }
27
- addEntityNode(node) {
28
- this.nodes.set(EcsIdGenerator.entityProxy(node.data.entity), node);
29
- }
30
- getEntityNode(entity) {
31
- return this.nodes.get(EcsIdGenerator.entityProxy(entity));
32
- }
33
- listAllNodes() {
34
- return Array.from(this.nodes.values());
35
- }
50
+ nodes;
51
+ constructor() {
52
+ this.nodes = new Map();
53
+ }
54
+ get sizeNodes() {
55
+ return this.nodes.size;
56
+ }
57
+ addSystemModuleNode(node) {
58
+ this.nodes.set(node.data.entityType.toString(), node);
59
+ }
60
+ getSystemModuleNode(entityType) {
61
+ return this.nodes.get(entityType.toString());
62
+ }
63
+ addEntityNode(node) {
64
+ this.nodes.set(EcsIdGenerator.entityProxy(node.data.entity), node);
65
+ }
66
+ getEntityNode(entity) {
67
+ return this.nodes.get(EcsIdGenerator.entityProxy(entity));
68
+ }
69
+ listAllNodes() {
70
+ return Array.from(this.nodes.values());
71
+ }
36
72
  };
37
73
 
38
- // src/abstract/handle-types.ts
39
- var EcsHandleDataType = /* @__PURE__ */ ((EcsHandleDataType2) => {
40
- EcsHandleDataType2["proxy"] = "proxy";
41
- EcsHandleDataType2["module"] = "module";
42
- return EcsHandleDataType2;
43
- })(EcsHandleDataType || {});
44
-
45
- // src/nodes/node-entity.tsx
46
- var _compilerruntime = require('react/compiler-runtime');
47
- var _layout = require('@awesome-flow/core/layout');
48
- var _core = require('@mantine/core');
49
-
50
-
51
- // src/components/formatter-camel-case.tsx
52
-
74
+ //#endregion
75
+ //#region src/abstract/handle-types.ts
76
+ let EcsHandleDataType = /* @__PURE__ */ function(EcsHandleDataType$1) {
77
+ EcsHandleDataType$1["proxy"] = "proxy";
78
+ EcsHandleDataType$1["module"] = "module";
79
+ return EcsHandleDataType$1;
80
+ }({});
53
81
 
82
+ //#endregion
83
+ //#region src/components/formatter-camel-case.tsx
54
84
  function CamelCaseFormatter(props) {
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;
67
- return value;
85
+ const value = (0, react.useMemo)(() => props.value?.toString().replace(/([a-z])([A-Z])/g, "$1 $2"), [props.value]);
86
+ return value;
68
87
  }
69
- var formatter_camel_case_default = _react.memo.call(void 0, CamelCaseFormatter);
70
-
71
- // src/layout/entity-layout.tsx
72
-
73
-
74
-
75
- // src/components/entity-component-list.tsx
76
-
77
-
78
-
79
-
80
- // src/components/entity-component-inspector.tsx
81
-
82
-
83
- var _hooks = require('@mantine/hooks');
88
+ var formatter_camel_case_default = (0, react.memo)(CamelCaseFormatter);
84
89
 
85
-
86
- // src/components/object-inspector.tsx
87
-
88
-
89
-
90
- var _reactinspector = require('react-inspector');
91
- var _jsxruntime = require('react/jsx-runtime');
90
+ //#endregion
91
+ //#region src/components/object-inspector.tsx
92
92
  function ObjectInspector(props) {
93
- const $ = _compilerruntime.c.call(void 0, 3);
94
- const colorScheme = _core.useComputedColorScheme.call(void 0, );
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;
108
- }
109
- var object_inspector_default = _react.memo.call(void 0, ObjectInspector);
110
-
111
- // src/components/entity-component-inspector.tsx
112
-
93
+ const colorScheme = (0, __mantine_core.useComputedColorScheme)();
94
+ const theme = (0, react.useMemo)(() => colorScheme === "dark" ? "chromeDark" : "chromeLight", [colorScheme]);
95
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_inspector.Inspector, {
96
+ table: false,
97
+ theme,
98
+ data: props.data
99
+ });
100
+ }
101
+ var object_inspector_default = (0, react.memo)(ObjectInspector);
102
+
103
+ //#endregion
104
+ //#region src/components/entity-component-inspector.tsx
113
105
  function EntityComponentInspector(props) {
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;
163
- }
164
- var entity_component_inspector_default = _react.memo.call(void 0, EntityComponentInspector);
165
-
166
- // src/components/entity-component-list.tsx
167
-
106
+ const [opened, { toggle }] = (0, __mantine_hooks.useDisclosure)(false);
107
+ const buttonColor = (0, react.useMemo)(() => opened ? "light" : "indigo", [opened]);
108
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Box, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Button, {
109
+ variant: "outline",
110
+ size: "xs",
111
+ onClick: toggle,
112
+ color: buttonColor,
113
+ fullWidth: true,
114
+ children: props.component.componentType
115
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Collapse, {
116
+ in: opened,
117
+ children: opened && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(object_inspector_default, { data: props.component })
118
+ })] });
119
+ }
120
+ var entity_component_inspector_default = (0, react.memo)(EntityComponentInspector);
121
+
122
+ //#endregion
123
+ //#region src/components/entity-component-list.tsx
168
124
  function EntityComponentList(props) {
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);
240
- }
241
- var entity_component_list_default = _react.memo.call(void 0, EntityComponentList);
242
-
243
- // src/components/entity-proxy-list.tsx
244
-
245
-
246
-
247
-
248
- // src/components/badge-list.tsx
249
-
250
-
251
-
125
+ const components = Array.from(props.entity.components.values());
126
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion.Item, {
127
+ value: "components",
128
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
129
+ fullWidth: true,
130
+ variant: "light",
131
+ rightSection: components.length,
132
+ children: "Components"
133
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Panel, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Stack, { children: components.map((c, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_component_inspector_default, { component: c }, i)) }) })]
134
+ }, "components");
135
+ }
136
+ var entity_component_list_default = (0, react.memo)(EntityComponentList);
137
+
138
+ //#endregion
139
+ //#region src/components/badge-list.tsx
252
140
  function BadgeList(props) {
253
- return props.items.map((value, i) => {
254
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { ...props.badge || [], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, formatter_camel_case_default, { value }) }, i);
255
- });
141
+ return props.items.map((value, i) => {
142
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
143
+ ...props.badge || [],
144
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value })
145
+ }, i);
146
+ });
256
147
  }
257
- var badge_list_default = _react.memo.call(void 0, BadgeList);
258
-
259
- // src/components/entity-proxy-list.tsx
148
+ var badge_list_default = (0, react.memo)(BadgeList);
260
149
 
150
+ //#endregion
151
+ //#region src/components/entity-proxy-list.tsx
261
152
  function EntityProxyList(props) {
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();
320
- }
321
- var entity_proxy_list_default = _react.memo.call(void 0, EntityProxyList);
322
-
323
- // src/components/entity-subscription-list.tsx
324
-
325
-
326
-
327
-
153
+ const proxies = Array.from(props.entity.proxies.values()).map((c) => c.values());
154
+ const items = proxies.map((p) => Array.from(p).map((k) => EcsIdGenerator.entityProxy(k))).flat();
155
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion.Item, {
156
+ value: "proxies",
157
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
158
+ fullWidth: true,
159
+ variant: "light",
160
+ rightSection: items.length,
161
+ children: "Proxies"
162
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Panel, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Stack, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(badge_list_default, {
163
+ items,
164
+ badge: { variant: "outline" }
165
+ }) }) })]
166
+ }, "proxies");
167
+ }
168
+ var entity_proxy_list_default = (0, react.memo)(EntityProxyList);
169
+
170
+ //#endregion
171
+ //#region src/components/entity-subscription-list.tsx
328
172
  function EntitySubscriptionList(props) {
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;
381
- }
382
- var entity_subscription_list_default = _react.memo.call(void 0, EntitySubscriptionList);
383
-
384
- // src/components/entity-update-counter.tsx
385
-
386
-
387
-
388
-
173
+ const { entityEventsManager } = (0, react.useContext)(EcsFlowContext);
174
+ const subscriptions = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
175
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion.Item, {
176
+ value: "subscriptions",
177
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
178
+ fullWidth: true,
179
+ variant: "light",
180
+ rightSection: subscriptions.length,
181
+ children: "Events"
182
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Panel, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Stack, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(badge_list_default, {
183
+ items: subscriptions,
184
+ badge: { variant: "outline" }
185
+ }) }) })]
186
+ }, "subscriptions");
187
+ }
188
+ var entity_subscription_list_default = (0, react.memo)(EntitySubscriptionList);
189
+
190
+ //#endregion
191
+ //#region src/components/entity-update-counter.tsx
389
192
  function EntityUpdateCounter(props) {
390
- const $ = _compilerruntime.c.call(void 0, 16);
391
- const [, setRefresh] = _react.useState.call(void 0, 0);
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
- };
425
- };
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;
471
- }
472
- var entity_update_counter_default = _react.memo.call(void 0, EntityUpdateCounter);
473
-
474
- // src/layout/entity-layout.tsx
475
-
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: [
484
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _core.Badge, { variant: "outline", color: "orange", children: entity.myProxy.entityUid }),
485
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_update_counter_default, { entityUid: entity.myProxy.entityUid })
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: [
502
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_component_list_default, { entity }),
503
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_proxy_list_default, { entity }),
504
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, entity_subscription_list_default, { entity })
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;
193
+ const [, setRefresh] = (0, react.useState)(0);
194
+ const { entityUpdateCounter } = (0, react.useContext)(EcsFlowContext);
195
+ const updates = entityUpdateCounter.getUpdateCount(props.entityUid) || 0;
196
+ const removes = entityUpdateCounter.getRemoveCount(props.entityUid) || 0;
197
+ (0, react.useEffect)(() => {
198
+ const interval = setInterval(() => {
199
+ setRefresh((refresh) => refresh + 1);
200
+ }, 1e3);
201
+ return () => {
202
+ console.log("CLEAR INTERVAL");
203
+ clearInterval(interval);
204
+ };
205
+ }, []);
206
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
207
+ variant: "light",
208
+ children: updates
209
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
210
+ variant: "light",
211
+ color: "orange",
212
+ children: removes
213
+ })] });
214
+ }
215
+ var entity_update_counter_default = (0, react.memo)(EntityUpdateCounter);
216
+
217
+ //#endregion
218
+ //#region src/layout/entity-layout.tsx
219
+ function EntityLayout({ entity }) {
220
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
221
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Group, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
222
+ variant: "outline",
223
+ color: "orange",
224
+ children: entity.myProxy.entityUid
225
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_update_counter_default, { entityUid: entity.myProxy.entityUid })] }),
226
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Divider, { my: 5 }),
227
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion, { children: [
228
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_component_list_default, { entity }),
229
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_proxy_list_default, { entity }),
230
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_subscription_list_default, { entity })
231
+ ] })
232
+ ] });
525
233
  }
526
234
  var entity_layout_default = EntityLayout;
527
235
 
528
- // src/nodes/node-entity.tsx
529
-
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;
236
+ //#endregion
237
+ //#region src/nodes/node-entity.tsx
238
+ function EntityNode({ id, data, selected, type }) {
239
+ const { entityRepository } = (0, react.useContext)(EcsFlowContext);
240
+ const entity = (0, react.useMemo)(() => entityRepository.get(data.entity), [data.entity, entityRepository]);
241
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__awesome_flow_core_layout.NodeContainer, {
242
+ id,
243
+ selected,
244
+ data,
245
+ title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
246
+ fullWidth: true,
247
+ variant: "transparent",
248
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value: entity.myProxy.entityType })
249
+ }),
250
+ type,
251
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_layout_default, { entity })
252
+ });
583
253
  }
584
254
  var node_entity_default = EntityNode;
585
255
 
586
- // src/nodes/node-systems-module.tsx
587
-
588
-
589
-
590
-
591
-
592
- // src/layout/systems-module-layout.tsx
593
-
594
- var _systems = require('@awesome-ecs/abstract/systems');
595
-
596
-
597
- // src/components/pipeline-middleware-list.tsx
598
-
599
-
600
-
256
+ //#endregion
257
+ //#region src/components/pipeline-middleware-list.tsx
601
258
  function PipelineMiddlewareList(props) {
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;
611
- if (props.pipeline) {
612
- middleware = props.pipeline.middleware;
613
- }
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;
259
+ let middleware = [];
260
+ if (props.pipeline) middleware = props.pipeline["middleware"];
261
+ const components = middleware.map((m) => {
262
+ return m.name || m.constructor.name;
263
+ });
264
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion.Item, {
265
+ value: props.label,
266
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
267
+ fullWidth: true,
268
+ variant: "light",
269
+ rightSection: components.length,
270
+ children: props.label
271
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Accordion.Panel, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Stack, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(badge_list_default, {
272
+ items: components,
273
+ badge: { variant: "outline" }
274
+ }) }) })]
275
+ }, props.label);
666
276
  }
667
277
  var pipeline_middleware_list_default = PipelineMiddlewareList;
668
278
 
669
- // src/layout/systems-module-layout.tsx
670
-
279
+ //#endregion
280
+ //#region src/layout/systems-module-layout.tsx
671
281
  function SystemsModuleLayout(props) {
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: [
724
- "Status: ",
725
- status
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;
282
+ const { module: module$1 } = props;
283
+ const runtimeContext = module$1["runtimeContext"];
284
+ const { systemContext } = runtimeContext;
285
+ const { status } = (0, react.useMemo)(() => {
286
+ return systemContext.runtime;
287
+ }, [systemContext.runtime]);
288
+ const init = runtimeContext.systemPipelines.get(__awesome_ecs_abstract_systems.SystemType.initialize);
289
+ const update = runtimeContext.systemPipelines.get(__awesome_ecs_abstract_systems.SystemType.update);
290
+ const render = runtimeContext.systemPipelines.get(__awesome_ecs_abstract_systems.SystemType.render);
291
+ const sync = runtimeContext.systemPipelines.get(__awesome_ecs_abstract_systems.SystemType.sync);
292
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Text, { children: ["Status: ", status] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion, { children: [
293
+ init && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(pipeline_middleware_list_default, {
294
+ pipeline: init,
295
+ label: "Initialize"
296
+ }),
297
+ update && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(pipeline_middleware_list_default, {
298
+ pipeline: update,
299
+ label: "Update"
300
+ }),
301
+ render && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(pipeline_middleware_list_default, {
302
+ pipeline: render,
303
+ label: "Render"
304
+ }),
305
+ sync && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(pipeline_middleware_list_default, {
306
+ pipeline: sync,
307
+ label: "Sync"
308
+ })
309
+ ] })] });
793
310
  }
794
311
  var systems_module_layout_default = SystemsModuleLayout;
795
312
 
796
- // src/nodes/node-systems-module.tsx
797
-
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;
313
+ //#endregion
314
+ //#region src/nodes/node-systems-module.tsx
315
+ function SystemsModuleNode({ id, data, selected, type }) {
316
+ const { systemsModuleRepository } = (0, react.useContext)(EcsFlowContext);
317
+ const module$1 = systemsModuleRepository.get(data.entityType);
318
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__awesome_flow_core_layout.NodeContainer, {
319
+ id,
320
+ selected,
321
+ data,
322
+ title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Badge, {
323
+ fullWidth: true,
324
+ color: "indigo",
325
+ variant: "transparent",
326
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value: data.entityType })
327
+ }),
328
+ type,
329
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(systems_module_layout_default, {
330
+ type: data.entityType,
331
+ module: module$1
332
+ })
333
+ });
850
334
  }
851
335
  var node_systems_module_default = SystemsModuleNode;
852
336
 
853
- // src/templates/template-entity-node.ts
854
- var _react3 = require('@xyflow/react');
855
-
856
- // src/abstract/templates.ts
857
- var EcsTemplateGroup = /* @__PURE__ */ ((EcsTemplateGroup2) => {
858
- EcsTemplateGroup2["ecs"] = "ECS";
859
- return EcsTemplateGroup2;
860
- })(EcsTemplateGroup || {});
861
-
862
- // src/templates/template-entity-node.ts
863
- var EntityNodeTemplate = (_class = class {constructor() { _class.prototype.__init.call(this); }
864
- __init() {this.template = {
865
- type: "entity-node" /* entity */,
866
- group: "ECS" /* ecs */,
867
- data: {
868
- title: "Entity",
869
- entity: null
870
- },
871
- handles: [
872
- {
873
- dataType: "proxy" /* proxy */,
874
- position: _react3.Position.Left,
875
- connection: "target",
876
- disabled: true
877
- },
878
- {
879
- dataType: "proxy" /* proxy */,
880
- position: _react3.Position.Right,
881
- connection: "source",
882
- disabled: true
883
- }
884
- ]
885
- }}
886
- }, _class);
887
-
888
- // src/templates/template-systems-module.ts
337
+ //#endregion
338
+ //#region src/abstract/templates.ts
339
+ let EcsTemplateGroup = /* @__PURE__ */ function(EcsTemplateGroup$1) {
340
+ EcsTemplateGroup$1["ecs"] = "ECS";
341
+ return EcsTemplateGroup$1;
342
+ }({});
343
+
344
+ //#endregion
345
+ //#region src/templates/template-entity-node.ts
346
+ var EntityNodeTemplate = class {
347
+ template = {
348
+ type: EcsNodeType.entity,
349
+ group: EcsTemplateGroup.ecs,
350
+ data: {
351
+ title: "Entity",
352
+ entity: null
353
+ },
354
+ handles: [{
355
+ dataType: EcsHandleDataType.proxy,
356
+ position: __xyflow_react.Position.Left,
357
+ connection: "target",
358
+ disabled: true
359
+ }, {
360
+ dataType: EcsHandleDataType.proxy,
361
+ position: __xyflow_react.Position.Right,
362
+ connection: "source",
363
+ disabled: true
364
+ }]
365
+ };
366
+ };
889
367
 
890
- var SystemsModuleNodeTemplate = (_class2 = class {constructor() { _class2.prototype.__init2.call(this); }
891
- __init2() {this.template = {
892
- type: "systems-module-node" /* systemsModule */,
893
- group: "ECS" /* ecs */,
894
- data: {
895
- title: "Systems Module",
896
- entityType: null
897
- },
898
- handles: [
899
- {
900
- dataType: "module" /* module */,
901
- position: _react3.Position.Left,
902
- connection: "target",
903
- disabled: true
904
- }
905
- ]
906
- }}
907
- }, _class2);
368
+ //#endregion
369
+ //#region src/templates/template-systems-module.ts
370
+ var SystemsModuleNodeTemplate = class {
371
+ template = {
372
+ type: EcsNodeType.systemsModule,
373
+ group: EcsTemplateGroup.ecs,
374
+ data: {
375
+ title: "Systems Module",
376
+ entityType: null
377
+ },
378
+ handles: [{
379
+ dataType: EcsHandleDataType.module,
380
+ position: __xyflow_react.Position.Left,
381
+ connection: "target",
382
+ disabled: true
383
+ }]
384
+ };
385
+ };
908
386
 
909
- // src/abstract/node-types.ts
910
- var EcsNodeType = /* @__PURE__ */ ((EcsNodeType2) => {
911
- EcsNodeType2["systemsModule"] = "systems-module-node";
912
- EcsNodeType2["entity"] = "entity-node";
913
- return EcsNodeType2;
914
- })(EcsNodeType || {});
915
- var ecsNodeTypes = {
916
- ["systems-module-node" /* systemsModule */]: node_systems_module_default,
917
- ["entity-node" /* entity */]: node_entity_default
387
+ //#endregion
388
+ //#region src/abstract/node-types.ts
389
+ let EcsNodeType = /* @__PURE__ */ function(EcsNodeType$1) {
390
+ EcsNodeType$1["systemsModule"] = "systems-module-node";
391
+ EcsNodeType$1["entity"] = "entity-node";
392
+ return EcsNodeType$1;
393
+ }({});
394
+ const ecsNodeTypes = {
395
+ [EcsNodeType.systemsModule]: node_systems_module_default,
396
+ [EcsNodeType.entity]: node_entity_default
918
397
  };
919
- var ecsNodeTemplates = {
920
- ["entity-node" /* entity */]: new EntityNodeTemplate(),
921
- ["systems-module-node" /* systemsModule */]: new SystemsModuleNodeTemplate()
398
+ const ecsNodeTemplates = {
399
+ [EcsNodeType.entity]: new EntityNodeTemplate(),
400
+ [EcsNodeType.systemsModule]: new SystemsModuleNodeTemplate()
922
401
  };
923
402
 
924
- // src/flow/flow-ecs-state.tsx
925
-
926
- var _canvas = require('@awesome-flow/core/canvas');
927
-
928
-
929
- // src/flow/flow-ecs-entities.tsx
930
-
931
- var _abstract = require('@awesome-flow/core/abstract');
932
- var _hooks3 = require('@awesome-flow/core/hooks');
933
-
934
-
935
- // src/flow/flow-ecs-edge-modules.tsx
936
-
937
-
938
-
939
-
403
+ //#endregion
404
+ //#region src/flow/flow-ecs-edge-modules.tsx
940
405
  function FlowEcsEdgeModules(props) {
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.handleId,
964
- targetHandle: targetHandle.handleId
965
- });
966
- }
967
- }
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;
406
+ const { nodesToConnect } = props;
407
+ const onConnect = (0, __awesome_flow_core_hooks.useFlowStore)((state) => state.onConnect);
408
+ const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
409
+ (0, react.useEffect)(() => {
410
+ for (const node of nodesToConnect) {
411
+ const sourceHandle = node.data.handles.find((h) => h.connection === "source");
412
+ const entity = entityRepository.get(node.data.entity);
413
+ const systemModule = ecsFlowRepository.getSystemModuleNode(entity.myProxy.entityType);
414
+ const targetHandle = systemModule?.data.handles.find((h) => h.connection === "target");
415
+ if (targetHandle) onConnect({
416
+ source: node.id,
417
+ target: systemModule.id,
418
+ sourceHandle: sourceHandle.handleId,
419
+ targetHandle: targetHandle.handleId
420
+ });
421
+ }
422
+ }, [
423
+ nodesToConnect,
424
+ ecsFlowRepository,
425
+ entityRepository,
426
+ onConnect
427
+ ]);
428
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
998
429
  }
999
430
  var flow_ecs_edge_modules_default = FlowEcsEdgeModules;
1000
431
 
1001
- // src/flow/flow-ecs-edge-proxies.tsx
1002
-
1003
-
1004
-
1005
-
432
+ //#endregion
433
+ //#region src/flow/flow-ecs-edge-proxies.tsx
1006
434
  function FlowEcsEdgeProxies(props) {
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.handleId,
1032
- targetHandle: targetHandle.handleId
1033
- });
1034
- }
1035
- }
1036
- }
1037
- }
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;
435
+ const { nodesToConnect } = props;
436
+ const onConnect = (0, __awesome_flow_core_hooks.useFlowStore)((state) => state.onConnect);
437
+ const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
438
+ (0, react.useEffect)(() => {
439
+ for (const node of nodesToConnect) {
440
+ const sourceHandle = node.data.handles.find((h) => h.connection === "source");
441
+ const entity = entityRepository.get(node.data.entity);
442
+ for (const [, proxyMap] of entity.proxies) for (const proxy of proxyMap.values()) {
443
+ const proxyNode = ecsFlowRepository.getEntityNode(proxy);
444
+ if (proxyNode) {
445
+ const targetHandle = proxyNode.data.handles.find((h) => h.connection === "target");
446
+ onConnect({
447
+ source: node.id,
448
+ target: proxyNode.id,
449
+ sourceHandle: sourceHandle.handleId,
450
+ targetHandle: targetHandle.handleId
451
+ });
452
+ }
453
+ }
454
+ }
455
+ }, [
456
+ nodesToConnect,
457
+ ecsFlowRepository,
458
+ entityRepository,
459
+ onConnect
460
+ ]);
461
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
1068
462
  }
1069
463
  var flow_ecs_edge_proxies_default = FlowEcsEdgeProxies;
1070
464
 
1071
- // src/flow/flow-ecs-entities.tsx
1072
-
465
+ //#endregion
466
+ //#region src/flow/flow-ecs-entities.tsx
1073
467
  function FlowEcsEntities() {
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);
1109
- }
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;
468
+ const { nodeFactory } = (0, react.useContext)(__awesome_flow_core_abstract.FlowContext);
469
+ const addNodes = (0, __awesome_flow_core_hooks.useFlowStore)((state) => state.addNodes);
470
+ const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
471
+ const [entityNodes, setEntityNodes] = (0, react.useState)([]);
472
+ (0, react.useEffect)(() => {
473
+ const entities = entityRepository.listAll();
474
+ const nodes = [];
475
+ for (const entity of entities) {
476
+ if (ecsFlowRepository.getEntityNode(entity.myProxy)) continue;
477
+ const node = nodeFactory.createNodeFromType(EcsNodeType.entity);
478
+ node.data.entity = entity.myProxy;
479
+ node.position = {
480
+ x: 0,
481
+ y: 0
482
+ };
483
+ ecsFlowRepository.addEntityNode(node);
484
+ nodes.push(node);
485
+ }
486
+ setEntityNodes(nodes);
487
+ addNodes(nodes);
488
+ }, [
489
+ entityRepository,
490
+ entityRepository.size,
491
+ ecsFlowRepository,
492
+ nodeFactory,
493
+ addNodes
494
+ ]);
495
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(flow_ecs_edge_proxies_default, { nodesToConnect: entityNodes }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(flow_ecs_edge_modules_default, { nodesToConnect: entityNodes })] });
1140
496
  }
1141
497
  var flow_ecs_entities_default = FlowEcsEntities;
1142
498
 
1143
- // src/flow/flow-ecs-modules.tsx
1144
-
1145
-
1146
-
1147
-
1148
-
499
+ //#endregion
500
+ //#region src/flow/flow-ecs-modules.tsx
1149
501
  function FlowEcsModules() {
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);
1178
- }
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;
502
+ const { nodeFactory } = (0, react.useContext)(__awesome_flow_core_abstract.FlowContext);
503
+ const addNodes = (0, __awesome_flow_core_hooks.useFlowStore)((state) => state.addNodes);
504
+ const { ecsFlowRepository, systemsModuleRepository } = (0, react.useContext)(EcsFlowContext);
505
+ (0, react.useEffect)(() => {
506
+ const modules = Array.from(systemsModuleRepository.list()).filter((m) => !!m);
507
+ const keys = Array.from(modules.values()).map((v) => v[0]);
508
+ const nodesToAdd = [];
509
+ for (const element of keys) {
510
+ if (ecsFlowRepository.getSystemModuleNode(element)) continue;
511
+ const node = nodeFactory.createNodeFromType(EcsNodeType.systemsModule);
512
+ node.data.entityType = element;
513
+ node.position = {
514
+ x: 0,
515
+ y: 0
516
+ };
517
+ ecsFlowRepository.addSystemModuleNode(node);
518
+ nodesToAdd.push(node);
519
+ }
520
+ if (nodesToAdd.length) addNodes(nodesToAdd);
521
+ }, [
522
+ nodeFactory,
523
+ addNodes,
524
+ ecsFlowRepository,
525
+ ecsFlowRepository.sizeNodes,
526
+ systemsModuleRepository,
527
+ systemsModuleRepository.size
528
+ ]);
529
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
1212
530
  }
1213
531
  var flow_ecs_modules_default = FlowEcsModules;
1214
532
 
1215
- // src/flow/flow-ecs-state.tsx
1216
-
533
+ //#endregion
534
+ //#region src/flow/flow-ecs-state.tsx
1217
535
  function FlowEcsState(props) {
1218
- const $ = _compilerruntime.c.call(void 0, 17);
1219
- const [, setUpdates] = _react.useState.call(void 0, 0);
1220
- const [refreshLayout, setRefreshLayout] = _react.useState.call(void 0, false);
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;
1305
- }
1306
- var flow_ecs_state_default = _react.memo.call(void 0, FlowEcsState);
1307
-
1308
-
1309
-
1310
-
1311
-
1312
-
1313
-
1314
-
1315
-
1316
-
1317
-
1318
-
1319
-
1320
- exports.EcsFlowContext = EcsFlowContext; exports.EcsFlowRepository = EcsFlowRepository; exports.EcsHandleDataType = EcsHandleDataType; exports.EcsNodeType = EcsNodeType; exports.EcsTemplateGroup = EcsTemplateGroup; exports.EntityNode = node_entity_default; exports.EntityNodeTemplate = EntityNodeTemplate; exports.FlowEcsState = flow_ecs_state_default; exports.SystemsModuleNode = node_systems_module_default; exports.SystemsModuleNodeTemplate = SystemsModuleNodeTemplate; exports.ecsNodeTemplates = ecsNodeTemplates; exports.ecsNodeTypes = ecsNodeTypes;
536
+ const [, setUpdates] = (0, react.useState)(0);
537
+ const [refreshLayout, setRefreshLayout] = (0, react.useState)(false);
538
+ const { ecsFlowRepository } = (0, react.useContext)(EcsFlowContext);
539
+ (0, react.useEffect)(() => {
540
+ setRefreshLayout(true);
541
+ }, [ecsFlowRepository.sizeNodes]);
542
+ (0, react.useEffect)(() => {
543
+ setInterval(() => {
544
+ setUpdates((updates) => updates + 1);
545
+ }, 1e3);
546
+ }, []);
547
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
548
+ props.showSystemModules && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(flow_ecs_modules_default, {}),
549
+ props.showEntities && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(flow_ecs_entities_default, {}),
550
+ props.autoLayout && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__awesome_flow_core_canvas.FlowAutoLayout, { refreshLayout })
551
+ ] });
552
+ }
553
+ var flow_ecs_state_default = (0, react.memo)(FlowEcsState);
554
+
555
+ //#endregion
556
+ exports.EcsFlowContext = EcsFlowContext;
557
+ exports.EcsFlowRepository = EcsFlowRepository;
558
+ exports.EcsHandleDataType = EcsHandleDataType;
559
+ exports.EcsNodeType = EcsNodeType;
560
+ exports.EcsTemplateGroup = EcsTemplateGroup;
561
+ exports.EntityNode = node_entity_default;
562
+ exports.EntityNodeTemplate = EntityNodeTemplate;
563
+ exports.FlowEcsState = flow_ecs_state_default;
564
+ exports.SystemsModuleNode = node_systems_module_default;
565
+ exports.SystemsModuleNodeTemplate = SystemsModuleNodeTemplate;
566
+ exports.ecsNodeTemplates = ecsNodeTemplates;
567
+ exports.ecsNodeTypes = ecsNodeTypes;
568
+ //# sourceMappingURL=index.cjs.map