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