@awesome-flow/ecs 0.9.5 → 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 +87 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -24
- package/dist/index.d.cts.map +1 -1
- package/dist/{index.d.ts → index.d.mts} +12 -25
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +36 -53
- 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);
|
|
@@ -151,16 +126,15 @@ var badge_list_default = (0, react.memo)(BadgeList);
|
|
|
151
126
|
//#region src/components/entity-proxy-list.tsx
|
|
152
127
|
function EntityProxyList(props) {
|
|
153
128
|
const { entityProxyRepository } = (0, react.useContext)(EcsFlowContext);
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Accordion.Item, {
|
|
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, {
|
|
157
131
|
value: "proxies",
|
|
158
|
-
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, {
|
|
159
133
|
fullWidth: true,
|
|
160
134
|
variant: "light",
|
|
161
135
|
rightSection: items.length,
|
|
162
136
|
children: "Proxies"
|
|
163
|
-
}) }), /* @__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, {
|
|
164
138
|
items,
|
|
165
139
|
badge: { variant: "outline" }
|
|
166
140
|
}) }) })]
|
|
@@ -173,14 +147,14 @@ var entity_proxy_list_default = (0, react.memo)(EntityProxyList);
|
|
|
173
147
|
function EntitySubscriptionList(props) {
|
|
174
148
|
const { entityEventsManager } = (0, react.useContext)(EcsFlowContext);
|
|
175
149
|
const subscriptions = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
|
|
176
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
150
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion.Item, {
|
|
177
151
|
value: "subscriptions",
|
|
178
|
-
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, {
|
|
179
153
|
fullWidth: true,
|
|
180
154
|
variant: "light",
|
|
181
155
|
rightSection: subscriptions.length,
|
|
182
156
|
children: "Events"
|
|
183
|
-
}) }), /* @__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, {
|
|
184
158
|
items: subscriptions,
|
|
185
159
|
badge: { variant: "outline" }
|
|
186
160
|
}) }) })]
|
|
@@ -200,14 +174,13 @@ function EntityUpdateCounter(props) {
|
|
|
200
174
|
setRefresh((refresh) => refresh + 1);
|
|
201
175
|
}, 1e3);
|
|
202
176
|
return () => {
|
|
203
|
-
console.log("CLEAR INTERVAL");
|
|
204
177
|
clearInterval(interval);
|
|
205
178
|
};
|
|
206
179
|
}, []);
|
|
207
|
-
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, {
|
|
208
181
|
variant: "light",
|
|
209
182
|
children: updates
|
|
210
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
183
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
211
184
|
variant: "light",
|
|
212
185
|
color: "orange",
|
|
213
186
|
children: removes
|
|
@@ -219,40 +192,38 @@ var entity_update_counter_default = (0, react.memo)(EntityUpdateCounter);
|
|
|
219
192
|
//#region src/layout/entity-layout.tsx
|
|
220
193
|
function EntityLayout({ entity }) {
|
|
221
194
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
222
|
-
/* @__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, {
|
|
223
196
|
variant: "outline",
|
|
224
197
|
color: "orange",
|
|
225
198
|
children: entity.myProxy.entityUid
|
|
226
199
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_update_counter_default, { entityUid: entity.myProxy.entityUid })] }),
|
|
227
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
228
|
-
/* @__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: [
|
|
229
202
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_component_list_default, { entity }),
|
|
230
203
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_proxy_list_default, { entity }),
|
|
231
204
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(entity_subscription_list_default, { entity })
|
|
232
205
|
] })
|
|
233
206
|
] });
|
|
234
207
|
}
|
|
235
|
-
var entity_layout_default = EntityLayout;
|
|
236
208
|
|
|
237
209
|
//#endregion
|
|
238
210
|
//#region src/nodes/node-entity.tsx
|
|
239
211
|
function EntityNode({ id, data, selected, type }) {
|
|
240
212
|
const { entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
241
213
|
const entity = (0, react.useMemo)(() => entityRepository.get(data.entity), [data.entity, entityRepository]);
|
|
242
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
214
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_awesome_flow_core_layout.NodeContainer, {
|
|
243
215
|
id,
|
|
244
216
|
selected,
|
|
245
217
|
data,
|
|
246
|
-
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
218
|
+
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
247
219
|
fullWidth: true,
|
|
248
220
|
variant: "transparent",
|
|
249
221
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value: entity.myProxy.entityType })
|
|
250
222
|
}),
|
|
251
223
|
type,
|
|
252
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
224
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EntityLayout, { entity })
|
|
253
225
|
});
|
|
254
226
|
}
|
|
255
|
-
var node_entity_default = EntityNode;
|
|
256
227
|
|
|
257
228
|
//#endregion
|
|
258
229
|
//#region src/components/pipeline-middleware-list.tsx
|
|
@@ -262,84 +233,78 @@ function PipelineMiddlewareList(props) {
|
|
|
262
233
|
const components = middleware.map((m) => {
|
|
263
234
|
return m.name || m.constructor.name;
|
|
264
235
|
});
|
|
265
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
236
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Accordion.Item, {
|
|
266
237
|
value: props.label,
|
|
267
|
-
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, {
|
|
268
239
|
fullWidth: true,
|
|
269
240
|
variant: "light",
|
|
270
241
|
rightSection: components.length,
|
|
271
242
|
children: props.label
|
|
272
|
-
}) }), /* @__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, {
|
|
273
244
|
items: components,
|
|
274
245
|
badge: { variant: "outline" }
|
|
275
246
|
}) }) })]
|
|
276
247
|
}, props.label);
|
|
277
248
|
}
|
|
278
|
-
var pipeline_middleware_list_default = PipelineMiddlewareList;
|
|
279
249
|
|
|
280
250
|
//#endregion
|
|
281
251
|
//#region src/layout/systems-module-layout.tsx
|
|
282
252
|
function SystemsModuleLayout(props) {
|
|
283
|
-
const { module
|
|
284
|
-
const
|
|
285
|
-
const
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const sync = runtimeContext.systemPipelines.get(__awesome_ecs_abstract_systems.SystemType.sync);
|
|
293
|
-
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: [
|
|
294
|
-
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, {
|
|
295
262
|
pipeline: init,
|
|
296
263
|
label: "Initialize"
|
|
297
264
|
}),
|
|
298
|
-
update && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
265
|
+
update && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
299
266
|
pipeline: update,
|
|
300
267
|
label: "Update"
|
|
301
268
|
}),
|
|
302
|
-
render && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
269
|
+
render && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
303
270
|
pipeline: render,
|
|
304
271
|
label: "Render"
|
|
305
272
|
}),
|
|
306
|
-
sync && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
273
|
+
sync && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PipelineMiddlewareList, {
|
|
307
274
|
pipeline: sync,
|
|
308
275
|
label: "Sync"
|
|
309
276
|
})
|
|
310
277
|
] })] });
|
|
311
278
|
}
|
|
312
|
-
var systems_module_layout_default = SystemsModuleLayout;
|
|
313
279
|
|
|
314
280
|
//#endregion
|
|
315
281
|
//#region src/nodes/node-systems-module.tsx
|
|
316
282
|
function SystemsModuleNode({ id, data, selected, type }) {
|
|
317
283
|
const { systemsModuleRepository } = (0, react.useContext)(EcsFlowContext);
|
|
318
|
-
const module
|
|
319
|
-
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, {
|
|
320
286
|
id,
|
|
321
287
|
selected,
|
|
322
288
|
data,
|
|
323
|
-
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
289
|
+
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Badge, {
|
|
324
290
|
fullWidth: true,
|
|
325
291
|
color: "indigo",
|
|
326
292
|
variant: "transparent",
|
|
327
293
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(formatter_camel_case_default, { value: data.entityType })
|
|
328
294
|
}),
|
|
329
295
|
type,
|
|
330
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
296
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SystemsModuleLayout, {
|
|
331
297
|
type: data.entityType,
|
|
332
|
-
module
|
|
298
|
+
module
|
|
333
299
|
})
|
|
334
300
|
});
|
|
335
301
|
}
|
|
336
|
-
var node_systems_module_default = SystemsModuleNode;
|
|
337
302
|
|
|
338
303
|
//#endregion
|
|
339
304
|
//#region src/abstract/templates.ts
|
|
340
|
-
let EcsTemplateGroup = /* @__PURE__ */ function(EcsTemplateGroup
|
|
341
|
-
EcsTemplateGroup
|
|
342
|
-
return EcsTemplateGroup
|
|
305
|
+
let EcsTemplateGroup = /* @__PURE__ */ function(EcsTemplateGroup) {
|
|
306
|
+
EcsTemplateGroup["ecs"] = "ECS";
|
|
307
|
+
return EcsTemplateGroup;
|
|
343
308
|
}({});
|
|
344
309
|
|
|
345
310
|
//#endregion
|
|
@@ -354,12 +319,12 @@ var EntityNodeTemplate = class {
|
|
|
354
319
|
},
|
|
355
320
|
handles: [{
|
|
356
321
|
dataType: EcsHandleDataType.proxy,
|
|
357
|
-
position:
|
|
322
|
+
position: _xyflow_react.Position.Left,
|
|
358
323
|
connection: "target",
|
|
359
324
|
disabled: true
|
|
360
325
|
}, {
|
|
361
326
|
dataType: EcsHandleDataType.proxy,
|
|
362
|
-
position:
|
|
327
|
+
position: _xyflow_react.Position.Right,
|
|
363
328
|
connection: "source",
|
|
364
329
|
disabled: true
|
|
365
330
|
}]
|
|
@@ -378,7 +343,7 @@ var SystemsModuleNodeTemplate = class {
|
|
|
378
343
|
},
|
|
379
344
|
handles: [{
|
|
380
345
|
dataType: EcsHandleDataType.module,
|
|
381
|
-
position:
|
|
346
|
+
position: _xyflow_react.Position.Left,
|
|
382
347
|
connection: "target",
|
|
383
348
|
disabled: true
|
|
384
349
|
}]
|
|
@@ -387,14 +352,14 @@ var SystemsModuleNodeTemplate = class {
|
|
|
387
352
|
|
|
388
353
|
//#endregion
|
|
389
354
|
//#region src/abstract/node-types.ts
|
|
390
|
-
let EcsNodeType = /* @__PURE__ */ function(EcsNodeType
|
|
391
|
-
EcsNodeType
|
|
392
|
-
EcsNodeType
|
|
393
|
-
return EcsNodeType
|
|
355
|
+
let EcsNodeType = /* @__PURE__ */ function(EcsNodeType) {
|
|
356
|
+
EcsNodeType["systemsModule"] = "systems-module-node";
|
|
357
|
+
EcsNodeType["entity"] = "entity-node";
|
|
358
|
+
return EcsNodeType;
|
|
394
359
|
}({});
|
|
395
360
|
const ecsNodeTypes = {
|
|
396
|
-
[EcsNodeType.systemsModule]:
|
|
397
|
-
[EcsNodeType.entity]:
|
|
361
|
+
[EcsNodeType.systemsModule]: SystemsModuleNode,
|
|
362
|
+
[EcsNodeType.entity]: EntityNode
|
|
398
363
|
};
|
|
399
364
|
const ecsNodeTemplates = {
|
|
400
365
|
[EcsNodeType.entity]: new EntityNodeTemplate(),
|
|
@@ -405,7 +370,7 @@ const ecsNodeTemplates = {
|
|
|
405
370
|
//#region src/flow/flow-ecs-edge-modules.tsx
|
|
406
371
|
function FlowEcsEdgeModules(props) {
|
|
407
372
|
const { nodesToConnect } = props;
|
|
408
|
-
const onConnect = (0,
|
|
373
|
+
const onConnect = (0, _awesome_flow_core_hooks.useFlowStore)((state) => state.onConnect);
|
|
409
374
|
const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
410
375
|
(0, react.useEffect)(() => {
|
|
411
376
|
for (const node of nodesToConnect) {
|
|
@@ -428,13 +393,12 @@ function FlowEcsEdgeModules(props) {
|
|
|
428
393
|
]);
|
|
429
394
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
430
395
|
}
|
|
431
|
-
var flow_ecs_edge_modules_default = FlowEcsEdgeModules;
|
|
432
396
|
|
|
433
397
|
//#endregion
|
|
434
398
|
//#region src/flow/flow-ecs-edge-proxies.tsx
|
|
435
399
|
function FlowEcsEdgeProxies(props) {
|
|
436
400
|
const { nodesToConnect } = props;
|
|
437
|
-
const onConnect = (0,
|
|
401
|
+
const onConnect = (0, _awesome_flow_core_hooks.useFlowStore)((state) => state.onConnect);
|
|
438
402
|
const { ecsFlowRepository, entityProxyRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
439
403
|
(0, react.useEffect)(() => {
|
|
440
404
|
for (const node of nodesToConnect) {
|
|
@@ -463,13 +427,12 @@ function FlowEcsEdgeProxies(props) {
|
|
|
463
427
|
]);
|
|
464
428
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
465
429
|
}
|
|
466
|
-
var flow_ecs_edge_proxies_default = FlowEcsEdgeProxies;
|
|
467
430
|
|
|
468
431
|
//#endregion
|
|
469
432
|
//#region src/flow/flow-ecs-entities.tsx
|
|
470
433
|
function FlowEcsEntities() {
|
|
471
|
-
const { nodeFactory } = (0, react.useContext)(
|
|
472
|
-
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);
|
|
473
436
|
const { ecsFlowRepository, entityRepository } = (0, react.useContext)(EcsFlowContext);
|
|
474
437
|
const [entityNodes, setEntityNodes] = (0, react.useState)([]);
|
|
475
438
|
(0, react.useEffect)(() => {
|
|
@@ -495,15 +458,14 @@ function FlowEcsEntities() {
|
|
|
495
458
|
nodeFactory,
|
|
496
459
|
addNodes
|
|
497
460
|
]);
|
|
498
|
-
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 })] });
|
|
499
462
|
}
|
|
500
|
-
var flow_ecs_entities_default = FlowEcsEntities;
|
|
501
463
|
|
|
502
464
|
//#endregion
|
|
503
465
|
//#region src/flow/flow-ecs-modules.tsx
|
|
504
466
|
function FlowEcsModules() {
|
|
505
|
-
const { nodeFactory } = (0, react.useContext)(
|
|
506
|
-
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);
|
|
507
469
|
const { ecsFlowRepository, systemsModuleRepository } = (0, react.useContext)(EcsFlowContext);
|
|
508
470
|
(0, react.useEffect)(() => {
|
|
509
471
|
const modules = Array.from(systemsModuleRepository.list()).filter((m) => !!m);
|
|
@@ -531,7 +493,6 @@ function FlowEcsModules() {
|
|
|
531
493
|
]);
|
|
532
494
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
533
495
|
}
|
|
534
|
-
var flow_ecs_modules_default = FlowEcsModules;
|
|
535
496
|
|
|
536
497
|
//#endregion
|
|
537
498
|
//#region src/flow/flow-ecs-state.tsx
|
|
@@ -548,9 +509,9 @@ function FlowEcsState(props) {
|
|
|
548
509
|
}, 1e3);
|
|
549
510
|
}, []);
|
|
550
511
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
551
|
-
props.showSystemModules && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
552
|
-
props.showEntities && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
553
|
-
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 })
|
|
554
515
|
] });
|
|
555
516
|
}
|
|
556
517
|
var flow_ecs_state_default = (0, react.memo)(FlowEcsState);
|
|
@@ -561,10 +522,10 @@ exports.EcsFlowRepository = EcsFlowRepository;
|
|
|
561
522
|
exports.EcsHandleDataType = EcsHandleDataType;
|
|
562
523
|
exports.EcsNodeType = EcsNodeType;
|
|
563
524
|
exports.EcsTemplateGroup = EcsTemplateGroup;
|
|
564
|
-
exports.EntityNode =
|
|
525
|
+
exports.EntityNode = EntityNode;
|
|
565
526
|
exports.EntityNodeTemplate = EntityNodeTemplate;
|
|
566
527
|
exports.FlowEcsState = flow_ecs_state_default;
|
|
567
|
-
exports.SystemsModuleNode =
|
|
528
|
+
exports.SystemsModuleNode = SystemsModuleNode;
|
|
568
529
|
exports.SystemsModuleNodeTemplate = SystemsModuleNodeTemplate;
|
|
569
530
|
exports.ecsNodeTemplates = ecsNodeTemplates;
|
|
570
531
|
exports.ecsNodeTypes = ecsNodeTypes;
|