@awesome-flow/ecs 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +92 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -38
- package/dist/index.d.cts.map +1 -1
- package/dist/{index.d.ts → index.d.mts} +15 -39
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +41 -55
- package/dist/index.mjs.map +1 -0
- package/package.json +20 -17
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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"));
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let react = require("react");
|
|
3
|
+
let _awesome_flow_core_layout = require("@awesome-flow/core/layout");
|
|
4
|
+
let _mantine_core = require("@mantine/core");
|
|
5
|
+
let _mantine_hooks = require("@mantine/hooks");
|
|
6
|
+
let react_inspector = require("react-inspector");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _awesome_ecs_abstract_systems = require("@awesome-ecs/abstract/systems");
|
|
9
|
+
let _xyflow_react = require("@xyflow/react");
|
|
10
|
+
let _awesome_flow_core_canvas = require("@awesome-flow/core/canvas");
|
|
11
|
+
let _awesome_flow_core_abstract = require("@awesome-flow/core/abstract");
|
|
12
|
+
let _awesome_flow_core_hooks = require("@awesome-flow/core/hooks");
|
|
35
13
|
|
|
36
14
|
//#region src/abstract/ecs-flow-context.ts
|
|
37
15
|
const EcsFlowContext = (0, react.createContext)(null);
|
|
@@ -49,7 +27,7 @@ var EcsIdGenerator = class {
|
|
|
49
27
|
var EcsFlowRepository = class {
|
|
50
28
|
nodes;
|
|
51
29
|
constructor() {
|
|
52
|
-
this.nodes = new Map();
|
|
30
|
+
this.nodes = /* @__PURE__ */ new Map();
|
|
53
31
|
}
|
|
54
32
|
get sizeNodes() {
|
|
55
33
|
return this.nodes.size;
|
|
@@ -73,28 +51,26 @@ var EcsFlowRepository = class {
|
|
|
73
51
|
|
|
74
52
|
//#endregion
|
|
75
53
|
//#region src/abstract/handle-types.ts
|
|
76
|
-
let EcsHandleDataType = /* @__PURE__ */ function(EcsHandleDataType
|
|
77
|
-
EcsHandleDataType
|
|
78
|
-
EcsHandleDataType
|
|
79
|
-
return EcsHandleDataType
|
|
54
|
+
let EcsHandleDataType = /* @__PURE__ */ function(EcsHandleDataType) {
|
|
55
|
+
EcsHandleDataType["proxy"] = "proxy";
|
|
56
|
+
EcsHandleDataType["module"] = "module";
|
|
57
|
+
return EcsHandleDataType;
|
|
80
58
|
}({});
|
|
81
59
|
|
|
82
60
|
//#endregion
|
|
83
61
|
//#region src/components/formatter-camel-case.tsx
|
|
84
62
|
function CamelCaseFormatter(props) {
|
|
85
|
-
|
|
86
|
-
return value;
|
|
63
|
+
return (0, react.useMemo)(() => props.value?.toString().replace(/([a-z])([A-Z])/g, "$1 $2"), [props.value]);
|
|
87
64
|
}
|
|
88
65
|
var formatter_camel_case_default = (0, react.memo)(CamelCaseFormatter);
|
|
89
66
|
|
|
90
67
|
//#endregion
|
|
91
68
|
//#region src/components/object-inspector.tsx
|
|
92
69
|
function ObjectInspector(props) {
|
|
93
|
-
const colorScheme = (0,
|
|
94
|
-
const theme = (0, react.useMemo)(() => colorScheme === "dark" ? "chromeDark" : "chromeLight", [colorScheme]);
|
|
70
|
+
const colorScheme = (0, _mantine_core.useComputedColorScheme)();
|
|
95
71
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_inspector.Inspector, {
|
|
96
72
|
table: false,
|
|
97
|
-
theme,
|
|
73
|
+
theme: (0, react.useMemo)(() => colorScheme === "dark" ? "chromeDark" : "chromeLight", [colorScheme]),
|
|
98
74
|
data: props.data
|
|
99
75
|
});
|
|
100
76
|
}
|
|
@@ -103,16 +79,15 @@ var object_inspector_default = (0, react.memo)(ObjectInspector);
|
|
|
103
79
|
//#endregion
|
|
104
80
|
//#region src/components/entity-component-inspector.tsx
|
|
105
81
|
function EntityComponentInspector(props) {
|
|
106
|
-
const [opened, { toggle }] = (0,
|
|
107
|
-
|
|
108
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Box, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Button, {
|
|
82
|
+
const [opened, { toggle }] = (0, _mantine_hooks.useDisclosure)(false);
|
|
83
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Box, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Button, {
|
|
109
84
|
variant: "outline",
|
|
110
85
|
size: "xs",
|
|
111
86
|
onClick: toggle,
|
|
112
|
-
color:
|
|
87
|
+
color: (0, react.useMemo)(() => opened ? "light" : "indigo", [opened]),
|
|
113
88
|
fullWidth: true,
|
|
114
89
|
children: props.component.componentType
|
|
115
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
90
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Collapse, {
|
|
116
91
|
in: opened,
|
|
117
92
|
children: opened && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(object_inspector_default, { data: props.component })
|
|
118
93
|
})] });
|
|
@@ -123,14 +98,14 @@ var entity_component_inspector_default = (0, react.memo)(EntityComponentInspecto
|
|
|
123
98
|
//#region src/components/entity-component-list.tsx
|
|
124
99
|
function EntityComponentList(props) {
|
|
125
100
|
const components = Array.from(props.entity.components.values());
|
|
126
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
101
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion.Item, {
|
|
127
102
|
value: "components",
|
|
128
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
103
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
129
104
|
fullWidth: true,
|
|
130
105
|
variant: "light",
|
|
131
106
|
rightSection: components.length,
|
|
132
107
|
children: "Components"
|
|
133
|
-
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
108
|
+
}) }), /* @__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
109
|
}, "components");
|
|
135
110
|
}
|
|
136
111
|
var entity_component_list_default = (0, react.memo)(EntityComponentList);
|
|
@@ -139,7 +114,7 @@ var entity_component_list_default = (0, react.memo)(EntityComponentList);
|
|
|
139
114
|
//#region src/components/badge-list.tsx
|
|
140
115
|
function BadgeList(props) {
|
|
141
116
|
return props.items.map((value, i) => {
|
|
142
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
117
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
143
118
|
...props.badge || [],
|
|
144
119
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value })
|
|
145
120
|
}, i);
|
|
@@ -150,16 +125,16 @@ var badge_list_default = (0, react.memo)(BadgeList);
|
|
|
150
125
|
//#endregion
|
|
151
126
|
//#region src/components/entity-proxy-list.tsx
|
|
152
127
|
function EntityProxyList(props) {
|
|
153
|
-
const
|
|
154
|
-
const items =
|
|
155
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
128
|
+
const { entityProxyRepository } = (0, react.useContext)(EcsFlowContext);
|
|
129
|
+
const items = Array.from(entityProxyRepository.getAll(props.entity.myProxy).values()).flat().map((p) => EcsIdGenerator.entityProxy(p));
|
|
130
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion.Item, {
|
|
156
131
|
value: "proxies",
|
|
157
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
132
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
158
133
|
fullWidth: true,
|
|
159
134
|
variant: "light",
|
|
160
135
|
rightSection: items.length,
|
|
161
136
|
children: "Proxies"
|
|
162
|
-
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
137
|
+
}) }), /* @__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
138
|
items,
|
|
164
139
|
badge: { variant: "outline" }
|
|
165
140
|
}) }) })]
|
|
@@ -172,14 +147,14 @@ var entity_proxy_list_default = (0, react.memo)(EntityProxyList);
|
|
|
172
147
|
function EntitySubscriptionList(props) {
|
|
173
148
|
const { entityEventsManager } = (0, react.useContext)(EcsFlowContext);
|
|
174
149
|
const subscriptions = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
|
|
175
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
150
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion.Item, {
|
|
176
151
|
value: "subscriptions",
|
|
177
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
152
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
178
153
|
fullWidth: true,
|
|
179
154
|
variant: "light",
|
|
180
155
|
rightSection: subscriptions.length,
|
|
181
156
|
children: "Events"
|
|
182
|
-
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
157
|
+
}) }), /* @__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
158
|
items: subscriptions,
|
|
184
159
|
badge: { variant: "outline" }
|
|
185
160
|
}) }) })]
|
|
@@ -199,14 +174,13 @@ function EntityUpdateCounter(props) {
|
|
|
199
174
|
setRefresh((refresh) => refresh + 1);
|
|
200
175
|
}, 1e3);
|
|
201
176
|
return () => {
|
|
202
|
-
console.log("CLEAR INTERVAL");
|
|
203
177
|
clearInterval(interval);
|
|
204
178
|
};
|
|
205
179
|
}, []);
|
|
206
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
180
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
207
181
|
variant: "light",
|
|
208
182
|
children: updates
|
|
209
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
183
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
210
184
|
variant: "light",
|
|
211
185
|
color: "orange",
|
|
212
186
|
children: removes
|
|
@@ -218,40 +192,38 @@ var entity_update_counter_default = (0, react.memo)(EntityUpdateCounter);
|
|
|
218
192
|
//#region src/layout/entity-layout.tsx
|
|
219
193
|
function EntityLayout({ entity }) {
|
|
220
194
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
221
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
195
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Group, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
222
196
|
variant: "outline",
|
|
223
197
|
color: "orange",
|
|
224
198
|
children: entity.myProxy.entityUid
|
|
225
199
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_update_counter_default, { entityUid: entity.myProxy.entityUid })] }),
|
|
226
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
227
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
200
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Divider, { my: 5 }),
|
|
201
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion, { children: [
|
|
228
202
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_component_list_default, { entity }),
|
|
229
203
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_proxy_list_default, { entity }),
|
|
230
204
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_subscription_list_default, { entity })
|
|
231
205
|
] })
|
|
232
206
|
] });
|
|
233
207
|
}
|
|
234
|
-
var entity_layout_default = EntityLayout;
|
|
235
208
|
|
|
236
209
|
//#endregion
|
|
237
210
|
//#region src/nodes/node-entity.tsx
|
|
238
211
|
function EntityNode({ id, data, selected, type }) {
|
|
239
212
|
const { entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
240
213
|
const entity = (0, react.useMemo)(() => entityRepository.get(data.entity), [data.entity, entityRepository]);
|
|
241
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
214
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_awesome_flow_core_layout.NodeContainer, {
|
|
242
215
|
id,
|
|
243
216
|
selected,
|
|
244
217
|
data,
|
|
245
|
-
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
218
|
+
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
246
219
|
fullWidth: true,
|
|
247
220
|
variant: "transparent",
|
|
248
221
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value: entity.myProxy.entityType })
|
|
249
222
|
}),
|
|
250
223
|
type,
|
|
251
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
224
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EntityLayout, { entity })
|
|
252
225
|
});
|
|
253
226
|
}
|
|
254
|
-
var node_entity_default = EntityNode;
|
|
255
227
|
|
|
256
228
|
//#endregion
|
|
257
229
|
//#region src/components/pipeline-middleware-list.tsx
|
|
@@ -261,84 +233,78 @@ function PipelineMiddlewareList(props) {
|
|
|
261
233
|
const components = middleware.map((m) => {
|
|
262
234
|
return m.name || m.constructor.name;
|
|
263
235
|
});
|
|
264
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
236
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion.Item, {
|
|
265
237
|
value: props.label,
|
|
266
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
238
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Accordion.Control, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
267
239
|
fullWidth: true,
|
|
268
240
|
variant: "light",
|
|
269
241
|
rightSection: components.length,
|
|
270
242
|
children: props.label
|
|
271
|
-
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
243
|
+
}) }), /* @__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
244
|
items: components,
|
|
273
245
|
badge: { variant: "outline" }
|
|
274
246
|
}) }) })]
|
|
275
247
|
}, props.label);
|
|
276
248
|
}
|
|
277
|
-
var pipeline_middleware_list_default = PipelineMiddlewareList;
|
|
278
249
|
|
|
279
250
|
//#endregion
|
|
280
251
|
//#region src/layout/systems-module-layout.tsx
|
|
281
252
|
function SystemsModuleLayout(props) {
|
|
282
|
-
const { module
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
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, {
|
|
253
|
+
const { module } = props;
|
|
254
|
+
const { systemContext, systemsModule } = module["runtimeContext"];
|
|
255
|
+
const error = systemContext.runtime.error;
|
|
256
|
+
const init = systemsModule.pipelines.get(_awesome_ecs_abstract_systems.SystemType.initialize);
|
|
257
|
+
const update = systemsModule.pipelines.get(_awesome_ecs_abstract_systems.SystemType.update);
|
|
258
|
+
const render = systemsModule.pipelines.get(_awesome_ecs_abstract_systems.SystemType.render);
|
|
259
|
+
const sync = systemsModule.pipelines.get(_awesome_ecs_abstract_systems.SystemType.sync);
|
|
260
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Text, { children: ["Error?: ", error] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion, { children: [
|
|
261
|
+
init && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
294
262
|
pipeline: init,
|
|
295
263
|
label: "Initialize"
|
|
296
264
|
}),
|
|
297
|
-
update && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
265
|
+
update && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
298
266
|
pipeline: update,
|
|
299
267
|
label: "Update"
|
|
300
268
|
}),
|
|
301
|
-
render && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
269
|
+
render && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
302
270
|
pipeline: render,
|
|
303
271
|
label: "Render"
|
|
304
272
|
}),
|
|
305
|
-
sync && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
273
|
+
sync && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
306
274
|
pipeline: sync,
|
|
307
275
|
label: "Sync"
|
|
308
276
|
})
|
|
309
277
|
] })] });
|
|
310
278
|
}
|
|
311
|
-
var systems_module_layout_default = SystemsModuleLayout;
|
|
312
279
|
|
|
313
280
|
//#endregion
|
|
314
281
|
//#region src/nodes/node-systems-module.tsx
|
|
315
282
|
function SystemsModuleNode({ id, data, selected, type }) {
|
|
316
283
|
const { systemsModuleRepository } = (0, react.useContext)(EcsFlowContext);
|
|
317
|
-
const module
|
|
318
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
284
|
+
const module = systemsModuleRepository.get(data.entityType);
|
|
285
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_awesome_flow_core_layout.NodeContainer, {
|
|
319
286
|
id,
|
|
320
287
|
selected,
|
|
321
288
|
data,
|
|
322
|
-
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
289
|
+
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
323
290
|
fullWidth: true,
|
|
324
291
|
color: "indigo",
|
|
325
292
|
variant: "transparent",
|
|
326
293
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value: data.entityType })
|
|
327
294
|
}),
|
|
328
295
|
type,
|
|
329
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
296
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemsModuleLayout, {
|
|
330
297
|
type: data.entityType,
|
|
331
|
-
module
|
|
298
|
+
module
|
|
332
299
|
})
|
|
333
300
|
});
|
|
334
301
|
}
|
|
335
|
-
var node_systems_module_default = SystemsModuleNode;
|
|
336
302
|
|
|
337
303
|
//#endregion
|
|
338
304
|
//#region src/abstract/templates.ts
|
|
339
|
-
let EcsTemplateGroup = /* @__PURE__ */ function(EcsTemplateGroup
|
|
340
|
-
EcsTemplateGroup
|
|
341
|
-
return EcsTemplateGroup
|
|
305
|
+
let EcsTemplateGroup = /* @__PURE__ */ function(EcsTemplateGroup) {
|
|
306
|
+
EcsTemplateGroup["ecs"] = "ECS";
|
|
307
|
+
return EcsTemplateGroup;
|
|
342
308
|
}({});
|
|
343
309
|
|
|
344
310
|
//#endregion
|
|
@@ -353,12 +319,12 @@ var EntityNodeTemplate = class {
|
|
|
353
319
|
},
|
|
354
320
|
handles: [{
|
|
355
321
|
dataType: EcsHandleDataType.proxy,
|
|
356
|
-
position:
|
|
322
|
+
position: _xyflow_react.Position.Left,
|
|
357
323
|
connection: "target",
|
|
358
324
|
disabled: true
|
|
359
325
|
}, {
|
|
360
326
|
dataType: EcsHandleDataType.proxy,
|
|
361
|
-
position:
|
|
327
|
+
position: _xyflow_react.Position.Right,
|
|
362
328
|
connection: "source",
|
|
363
329
|
disabled: true
|
|
364
330
|
}]
|
|
@@ -377,7 +343,7 @@ var SystemsModuleNodeTemplate = class {
|
|
|
377
343
|
},
|
|
378
344
|
handles: [{
|
|
379
345
|
dataType: EcsHandleDataType.module,
|
|
380
|
-
position:
|
|
346
|
+
position: _xyflow_react.Position.Left,
|
|
381
347
|
connection: "target",
|
|
382
348
|
disabled: true
|
|
383
349
|
}]
|
|
@@ -386,14 +352,14 @@ var SystemsModuleNodeTemplate = class {
|
|
|
386
352
|
|
|
387
353
|
//#endregion
|
|
388
354
|
//#region src/abstract/node-types.ts
|
|
389
|
-
let EcsNodeType = /* @__PURE__ */ function(EcsNodeType
|
|
390
|
-
EcsNodeType
|
|
391
|
-
EcsNodeType
|
|
392
|
-
return EcsNodeType
|
|
355
|
+
let EcsNodeType = /* @__PURE__ */ function(EcsNodeType) {
|
|
356
|
+
EcsNodeType["systemsModule"] = "systems-module-node";
|
|
357
|
+
EcsNodeType["entity"] = "entity-node";
|
|
358
|
+
return EcsNodeType;
|
|
393
359
|
}({});
|
|
394
360
|
const ecsNodeTypes = {
|
|
395
|
-
[EcsNodeType.systemsModule]:
|
|
396
|
-
[EcsNodeType.entity]:
|
|
361
|
+
[EcsNodeType.systemsModule]: SystemsModuleNode,
|
|
362
|
+
[EcsNodeType.entity]: EntityNode
|
|
397
363
|
};
|
|
398
364
|
const ecsNodeTemplates = {
|
|
399
365
|
[EcsNodeType.entity]: new EntityNodeTemplate(),
|
|
@@ -404,7 +370,7 @@ const ecsNodeTemplates = {
|
|
|
404
370
|
//#region src/flow/flow-ecs-edge-modules.tsx
|
|
405
371
|
function FlowEcsEdgeModules(props) {
|
|
406
372
|
const { nodesToConnect } = props;
|
|
407
|
-
const onConnect = (0,
|
|
373
|
+
const onConnect = (0, _awesome_flow_core_hooks.useFlowStore)((state) => state.onConnect);
|
|
408
374
|
const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
409
375
|
(0, react.useEffect)(() => {
|
|
410
376
|
for (const node of nodesToConnect) {
|
|
@@ -427,19 +393,19 @@ function FlowEcsEdgeModules(props) {
|
|
|
427
393
|
]);
|
|
428
394
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
429
395
|
}
|
|
430
|
-
var flow_ecs_edge_modules_default = FlowEcsEdgeModules;
|
|
431
396
|
|
|
432
397
|
//#endregion
|
|
433
398
|
//#region src/flow/flow-ecs-edge-proxies.tsx
|
|
434
399
|
function FlowEcsEdgeProxies(props) {
|
|
435
400
|
const { nodesToConnect } = props;
|
|
436
|
-
const onConnect = (0,
|
|
437
|
-
const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
401
|
+
const onConnect = (0, _awesome_flow_core_hooks.useFlowStore)((state) => state.onConnect);
|
|
402
|
+
const { ecsFlowRepository, entityProxyRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
438
403
|
(0, react.useEffect)(() => {
|
|
439
404
|
for (const node of nodesToConnect) {
|
|
440
405
|
const sourceHandle = node.data.handles.find((h) => h.connection === "source");
|
|
441
406
|
const entity = entityRepository.get(node.data.entity);
|
|
442
|
-
|
|
407
|
+
const proxies = Array.from(entityProxyRepository.getAll(entity.myProxy).values()).flat();
|
|
408
|
+
for (const proxy of proxies) {
|
|
443
409
|
const proxyNode = ecsFlowRepository.getEntityNode(proxy);
|
|
444
410
|
if (proxyNode) {
|
|
445
411
|
const targetHandle = proxyNode.data.handles.find((h) => h.connection === "target");
|
|
@@ -456,17 +422,17 @@ function FlowEcsEdgeProxies(props) {
|
|
|
456
422
|
nodesToConnect,
|
|
457
423
|
ecsFlowRepository,
|
|
458
424
|
entityRepository,
|
|
425
|
+
entityProxyRepository,
|
|
459
426
|
onConnect
|
|
460
427
|
]);
|
|
461
428
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
462
429
|
}
|
|
463
|
-
var flow_ecs_edge_proxies_default = FlowEcsEdgeProxies;
|
|
464
430
|
|
|
465
431
|
//#endregion
|
|
466
432
|
//#region src/flow/flow-ecs-entities.tsx
|
|
467
433
|
function FlowEcsEntities() {
|
|
468
|
-
const { nodeFactory } = (0, react.useContext)(
|
|
469
|
-
const addNodes = (0,
|
|
434
|
+
const { nodeFactory } = (0, react.useContext)(_awesome_flow_core_abstract.FlowContext);
|
|
435
|
+
const addNodes = (0, _awesome_flow_core_hooks.useFlowStore)((state) => state.addNodes);
|
|
470
436
|
const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
471
437
|
const [entityNodes, setEntityNodes] = (0, react.useState)([]);
|
|
472
438
|
(0, react.useEffect)(() => {
|
|
@@ -492,15 +458,14 @@ function FlowEcsEntities() {
|
|
|
492
458
|
nodeFactory,
|
|
493
459
|
addNodes
|
|
494
460
|
]);
|
|
495
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
461
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FlowEcsEdgeProxies, { nodesToConnect: entityNodes }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FlowEcsEdgeModules, { nodesToConnect: entityNodes })] });
|
|
496
462
|
}
|
|
497
|
-
var flow_ecs_entities_default = FlowEcsEntities;
|
|
498
463
|
|
|
499
464
|
//#endregion
|
|
500
465
|
//#region src/flow/flow-ecs-modules.tsx
|
|
501
466
|
function FlowEcsModules() {
|
|
502
|
-
const { nodeFactory } = (0, react.useContext)(
|
|
503
|
-
const addNodes = (0,
|
|
467
|
+
const { nodeFactory } = (0, react.useContext)(_awesome_flow_core_abstract.FlowContext);
|
|
468
|
+
const addNodes = (0, _awesome_flow_core_hooks.useFlowStore)((state) => state.addNodes);
|
|
504
469
|
const { ecsFlowRepository, systemsModuleRepository } = (0, react.useContext)(EcsFlowContext);
|
|
505
470
|
(0, react.useEffect)(() => {
|
|
506
471
|
const modules = Array.from(systemsModuleRepository.list()).filter((m) => !!m);
|
|
@@ -528,7 +493,6 @@ function FlowEcsModules() {
|
|
|
528
493
|
]);
|
|
529
494
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
530
495
|
}
|
|
531
|
-
var flow_ecs_modules_default = FlowEcsModules;
|
|
532
496
|
|
|
533
497
|
//#endregion
|
|
534
498
|
//#region src/flow/flow-ecs-state.tsx
|
|
@@ -545,9 +509,9 @@ function FlowEcsState(props) {
|
|
|
545
509
|
}, 1e3);
|
|
546
510
|
}, []);
|
|
547
511
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
548
|
-
props.showSystemModules && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
549
|
-
props.showEntities && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
550
|
-
props.autoLayout && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
512
|
+
props.showSystemModules && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FlowEcsModules, {}),
|
|
513
|
+
props.showEntities && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FlowEcsEntities, {}),
|
|
514
|
+
props.autoLayout && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_awesome_flow_core_canvas.FlowAutoLayout, { refreshLayout })
|
|
551
515
|
] });
|
|
552
516
|
}
|
|
553
517
|
var flow_ecs_state_default = (0, react.memo)(FlowEcsState);
|
|
@@ -558,10 +522,10 @@ exports.EcsFlowRepository = EcsFlowRepository;
|
|
|
558
522
|
exports.EcsHandleDataType = EcsHandleDataType;
|
|
559
523
|
exports.EcsNodeType = EcsNodeType;
|
|
560
524
|
exports.EcsTemplateGroup = EcsTemplateGroup;
|
|
561
|
-
exports.EntityNode =
|
|
525
|
+
exports.EntityNode = EntityNode;
|
|
562
526
|
exports.EntityNodeTemplate = EntityNodeTemplate;
|
|
563
527
|
exports.FlowEcsState = flow_ecs_state_default;
|
|
564
|
-
exports.SystemsModuleNode =
|
|
528
|
+
exports.SystemsModuleNode = SystemsModuleNode;
|
|
565
529
|
exports.SystemsModuleNodeTemplate = SystemsModuleNodeTemplate;
|
|
566
530
|
exports.ecsNodeTemplates = ecsNodeTemplates;
|
|
567
531
|
exports.ecsNodeTypes = ecsNodeTypes;
|