@awesome-flow/ecs 0.7.0 → 0.8.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 +261 -301
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +180 -183
- package/package.json +27 -20
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { EntityTypeUid, IEntityProxy,
|
|
2
|
+
import { EntityUid, EntityTypeUid, IEntityProxy, IEntityRepository } from '@awesome-ecs/abstract/entities';
|
|
3
3
|
import { ISystemsModuleRepository } from '@awesome-ecs/abstract/systems';
|
|
4
4
|
import { EntityEventsManager } from '@awesome-ecs/core/entities';
|
|
5
5
|
import { Node, NodeProps } from '@xyflow/react';
|
|
6
6
|
import { BasicNodeData, ITemplateFactory, NodeTemplate } from '@awesome-flow/core/abstract';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
|
+
interface IEntityUpdateCounter {
|
|
10
|
+
getUpdateCount(entityUid: EntityUid): number;
|
|
11
|
+
getRemoveCount(entityUid: EntityUid): number;
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
type SystemsModuleNodeData = BasicNodeData & {
|
|
10
15
|
entityType: EntityTypeUid;
|
|
11
16
|
};
|
|
@@ -24,11 +29,6 @@ declare class EcsFlowRepository {
|
|
|
24
29
|
listAllNodes(): Node[];
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
interface IEntityUpdateCounter {
|
|
28
|
-
getUpdateCount(entityUid: EntityUid): number;
|
|
29
|
-
getRemoveCount(entityUid: EntityUid): number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
32
|
type EcsFlowContextProps = {
|
|
33
33
|
ecsFlowRepository: EcsFlowRepository;
|
|
34
34
|
entityRepository: IEntityRepository;
|
|
@@ -43,10 +43,10 @@ declare enum EcsHandleDataType {
|
|
|
43
43
|
module = "module"
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
declare function SystemsModuleNode({ id, data, selected, type }: NodeProps<Node<SystemsModuleNodeData>>): react_jsx_runtime.JSX.Element;
|
|
47
|
-
|
|
48
46
|
declare function EntityNode({ id, data, selected, type }: NodeProps<Node<EntityNodeData>>): react_jsx_runtime.JSX.Element;
|
|
49
47
|
|
|
48
|
+
declare function SystemsModuleNode({ id, data, selected, type }: NodeProps<Node<SystemsModuleNodeData>>): react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
50
|
declare class EntityNodeTemplate implements ITemplateFactory {
|
|
51
51
|
readonly template: NodeTemplate<EntityNodeData>;
|
|
52
52
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { EntityTypeUid, IEntityProxy,
|
|
2
|
+
import { EntityUid, EntityTypeUid, IEntityProxy, IEntityRepository } from '@awesome-ecs/abstract/entities';
|
|
3
3
|
import { ISystemsModuleRepository } from '@awesome-ecs/abstract/systems';
|
|
4
4
|
import { EntityEventsManager } from '@awesome-ecs/core/entities';
|
|
5
5
|
import { Node, NodeProps } from '@xyflow/react';
|
|
6
6
|
import { BasicNodeData, ITemplateFactory, NodeTemplate } from '@awesome-flow/core/abstract';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
|
+
interface IEntityUpdateCounter {
|
|
10
|
+
getUpdateCount(entityUid: EntityUid): number;
|
|
11
|
+
getRemoveCount(entityUid: EntityUid): number;
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
type SystemsModuleNodeData = BasicNodeData & {
|
|
10
15
|
entityType: EntityTypeUid;
|
|
11
16
|
};
|
|
@@ -24,11 +29,6 @@ declare class EcsFlowRepository {
|
|
|
24
29
|
listAllNodes(): Node[];
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
interface IEntityUpdateCounter {
|
|
28
|
-
getUpdateCount(entityUid: EntityUid): number;
|
|
29
|
-
getRemoveCount(entityUid: EntityUid): number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
32
|
type EcsFlowContextProps = {
|
|
33
33
|
ecsFlowRepository: EcsFlowRepository;
|
|
34
34
|
entityRepository: IEntityRepository;
|
|
@@ -43,10 +43,10 @@ declare enum EcsHandleDataType {
|
|
|
43
43
|
module = "module"
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
declare function SystemsModuleNode({ id, data, selected, type }: NodeProps<Node<SystemsModuleNodeData>>): react_jsx_runtime.JSX.Element;
|
|
47
|
-
|
|
48
46
|
declare function EntityNode({ id, data, selected, type }: NodeProps<Node<EntityNodeData>>): react_jsx_runtime.JSX.Element;
|
|
49
47
|
|
|
48
|
+
declare function SystemsModuleNode({ id, data, selected, type }: NodeProps<Node<SystemsModuleNodeData>>): react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
50
|
declare class EntityNodeTemplate implements ITemplateFactory {
|
|
51
51
|
readonly template: NodeTemplate<EntityNodeData>;
|
|
52
52
|
}
|
package/dist/index.js
CHANGED
|
@@ -42,22 +42,10 @@ var EcsHandleDataType = /* @__PURE__ */ ((EcsHandleDataType2) => {
|
|
|
42
42
|
return EcsHandleDataType2;
|
|
43
43
|
})(EcsHandleDataType || {});
|
|
44
44
|
|
|
45
|
-
// src/nodes/node-
|
|
45
|
+
// src/nodes/node-entity.tsx
|
|
46
46
|
import { NodeContainer } from "@awesome-flow/core/layout";
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
// src/layout/systems-module-layout.tsx
|
|
51
|
-
import { SystemType } from "@awesome-ecs/abstract/systems";
|
|
52
|
-
import { Accordion as Accordion2, Text } from "@mantine/core";
|
|
53
|
-
import { useMemo as useMemo2 } from "react";
|
|
54
|
-
|
|
55
|
-
// src/components/pipeline-middleware-list.tsx
|
|
56
|
-
import { Accordion, Badge as Badge2, Stack } from "@mantine/core";
|
|
57
|
-
|
|
58
|
-
// src/components/badge-list.tsx
|
|
59
|
-
import { Badge } from "@mantine/core";
|
|
60
|
-
import { memo as memo2 } from "react";
|
|
47
|
+
import { Badge as Badge7 } from "@mantine/core";
|
|
48
|
+
import { useContext as useContext3, useMemo as useMemo4 } from "react";
|
|
61
49
|
|
|
62
50
|
// src/components/formatter-camel-case.tsx
|
|
63
51
|
import { memo, useMemo } from "react";
|
|
@@ -70,169 +58,104 @@ function CamelCaseFormatter(props) {
|
|
|
70
58
|
}
|
|
71
59
|
var formatter_camel_case_default = memo(CamelCaseFormatter);
|
|
72
60
|
|
|
73
|
-
// src/components/badge-list.tsx
|
|
74
|
-
import { jsx } from "react/jsx-runtime";
|
|
75
|
-
function BadgeList(props) {
|
|
76
|
-
return props.items.map((value, i) => {
|
|
77
|
-
return /* @__PURE__ */ jsx(Badge, { ...props.badge || [], children: /* @__PURE__ */ jsx(formatter_camel_case_default, { value }) }, i);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
var badge_list_default = memo2(BadgeList);
|
|
81
|
-
|
|
82
|
-
// src/components/pipeline-middleware-list.tsx
|
|
83
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
84
|
-
function PipelineMiddlewareList(props) {
|
|
85
|
-
let middleware = [];
|
|
86
|
-
if (props.pipeline) {
|
|
87
|
-
middleware = props.pipeline["middleware"];
|
|
88
|
-
}
|
|
89
|
-
const components = middleware.map((m) => {
|
|
90
|
-
return m.name || m.constructor.name;
|
|
91
|
-
});
|
|
92
|
-
return /* @__PURE__ */ jsxs(Accordion.Item, { value: props.label, children: [
|
|
93
|
-
/* @__PURE__ */ jsx2(Accordion.Control, { children: /* @__PURE__ */ jsx2(Badge2, { fullWidth: true, variant: "light", rightSection: components.length, children: props.label }) }),
|
|
94
|
-
/* @__PURE__ */ jsx2(Accordion.Panel, { children: /* @__PURE__ */ jsx2(Stack, { children: /* @__PURE__ */ jsx2(badge_list_default, { items: components, badge: { variant: "outline" } }) }) })
|
|
95
|
-
] }, props.label);
|
|
96
|
-
}
|
|
97
|
-
var pipeline_middleware_list_default = PipelineMiddlewareList;
|
|
98
|
-
|
|
99
|
-
// src/layout/systems-module-layout.tsx
|
|
100
|
-
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
101
|
-
function SystemsModuleLayout(props) {
|
|
102
|
-
const { module } = props;
|
|
103
|
-
const runtimeContext = module["runtimeContext"];
|
|
104
|
-
const { systemContext } = runtimeContext;
|
|
105
|
-
const { status } = useMemo2(() => {
|
|
106
|
-
return systemContext.runtime;
|
|
107
|
-
}, [systemContext.runtime.status]);
|
|
108
|
-
const init = runtimeContext.systemPipelines.get(SystemType.initialize);
|
|
109
|
-
const update = runtimeContext.systemPipelines.get(SystemType.update);
|
|
110
|
-
const render = runtimeContext.systemPipelines.get(SystemType.render);
|
|
111
|
-
const sync = runtimeContext.systemPipelines.get(SystemType.sync);
|
|
112
|
-
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
113
|
-
/* @__PURE__ */ jsxs2(Text, { children: [
|
|
114
|
-
"Status: ",
|
|
115
|
-
status
|
|
116
|
-
] }),
|
|
117
|
-
/* @__PURE__ */ jsxs2(Accordion2, { children: [
|
|
118
|
-
init && /* @__PURE__ */ jsx3(pipeline_middleware_list_default, { pipeline: init, label: "Initialize" }),
|
|
119
|
-
update && /* @__PURE__ */ jsx3(pipeline_middleware_list_default, { pipeline: update, label: "Update" }),
|
|
120
|
-
render && /* @__PURE__ */ jsx3(pipeline_middleware_list_default, { pipeline: render, label: "Render" }),
|
|
121
|
-
sync && /* @__PURE__ */ jsx3(pipeline_middleware_list_default, { pipeline: sync, label: "Sync" })
|
|
122
|
-
] })
|
|
123
|
-
] });
|
|
124
|
-
}
|
|
125
|
-
var systems_module_layout_default = SystemsModuleLayout;
|
|
126
|
-
|
|
127
|
-
// src/nodes/node-systems-module.tsx
|
|
128
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
129
|
-
function SystemsModuleNode({ id, data, selected, type }) {
|
|
130
|
-
const { systemsModuleRepository } = useContext(EcsFlowContext);
|
|
131
|
-
const module = systemsModuleRepository.get(data.entityType);
|
|
132
|
-
return /* @__PURE__ */ jsx4(
|
|
133
|
-
NodeContainer,
|
|
134
|
-
{
|
|
135
|
-
id,
|
|
136
|
-
selected,
|
|
137
|
-
data,
|
|
138
|
-
title: /* @__PURE__ */ jsx4(Badge3, { fullWidth: true, color: "indigo", variant: "transparent", children: /* @__PURE__ */ jsx4(formatter_camel_case_default, { value: data.entityType }) }),
|
|
139
|
-
type,
|
|
140
|
-
children: /* @__PURE__ */ jsx4(systems_module_layout_default, { type: data.entityType, module })
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
var node_systems_module_default = SystemsModuleNode;
|
|
145
|
-
|
|
146
|
-
// src/nodes/node-entity.tsx
|
|
147
|
-
import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
|
|
148
|
-
import { Badge as Badge9 } from "@mantine/core";
|
|
149
|
-
import { useContext as useContext4, useMemo as useMemo5 } from "react";
|
|
150
|
-
|
|
151
61
|
// src/layout/entity-layout.tsx
|
|
152
|
-
import { Accordion as
|
|
62
|
+
import { Accordion as Accordion4, Badge as Badge6, Divider, Group } from "@mantine/core";
|
|
153
63
|
|
|
154
64
|
// src/components/entity-component-list.tsx
|
|
155
|
-
import { Accordion
|
|
156
|
-
import { memo as
|
|
65
|
+
import { Accordion, Badge, Stack } from "@mantine/core";
|
|
66
|
+
import { memo as memo4 } from "react";
|
|
157
67
|
|
|
158
68
|
// src/components/entity-component-inspector.tsx
|
|
159
69
|
import { Box, Button, Collapse } from "@mantine/core";
|
|
160
|
-
import { memo as memo4, useMemo as useMemo4 } from "react";
|
|
161
70
|
import { useDisclosure } from "@mantine/hooks";
|
|
71
|
+
import { memo as memo3, useMemo as useMemo3 } from "react";
|
|
162
72
|
|
|
163
73
|
// src/components/object-inspector.tsx
|
|
164
74
|
import { useComputedColorScheme } from "@mantine/core";
|
|
165
|
-
import { memo as
|
|
75
|
+
import { memo as memo2, useMemo as useMemo2 } from "react";
|
|
166
76
|
import { Inspector } from "react-inspector";
|
|
167
|
-
import { jsx
|
|
77
|
+
import { jsx } from "react/jsx-runtime";
|
|
168
78
|
function ObjectInspector(props) {
|
|
169
79
|
const colorScheme = useComputedColorScheme();
|
|
170
|
-
const theme =
|
|
80
|
+
const theme = useMemo2(
|
|
171
81
|
() => colorScheme === "dark" ? "chromeDark" : "chromeLight",
|
|
172
82
|
[colorScheme]
|
|
173
83
|
);
|
|
174
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ jsx(Inspector, { table: false, theme, data: props.data });
|
|
175
85
|
}
|
|
176
|
-
var object_inspector_default =
|
|
86
|
+
var object_inspector_default = memo2(ObjectInspector);
|
|
177
87
|
|
|
178
88
|
// src/components/entity-component-inspector.tsx
|
|
179
|
-
import { jsx as
|
|
89
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
180
90
|
function EntityComponentInspector(props) {
|
|
181
91
|
const [opened, { toggle }] = useDisclosure(false);
|
|
182
|
-
const buttonColor =
|
|
183
|
-
return /* @__PURE__ */
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
92
|
+
const buttonColor = useMemo3(() => opened ? "light" : "indigo", [opened]);
|
|
93
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx2(Button, { variant: "outline", size: "xs", onClick: toggle, color: buttonColor, fullWidth: true, children: props.component.componentType }),
|
|
95
|
+
/* @__PURE__ */ jsx2(Collapse, { in: opened, children: opened && /* @__PURE__ */ jsx2(object_inspector_default, { data: props.component }) })
|
|
186
96
|
] });
|
|
187
97
|
}
|
|
188
|
-
var entity_component_inspector_default =
|
|
98
|
+
var entity_component_inspector_default = memo3(EntityComponentInspector);
|
|
189
99
|
|
|
190
100
|
// src/components/entity-component-list.tsx
|
|
191
|
-
import { jsx as
|
|
101
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
192
102
|
function EntityComponentList(props) {
|
|
193
103
|
const components = Array.from(props.entity.components.values());
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ jsxs2(Accordion.Item, { value: "components", children: [
|
|
105
|
+
/* @__PURE__ */ jsx3(Accordion.Control, { children: /* @__PURE__ */ jsx3(Badge, { fullWidth: true, variant: "light", rightSection: components.length, children: "Components" }) }),
|
|
106
|
+
/* @__PURE__ */ jsx3(Accordion.Panel, { children: /* @__PURE__ */ jsx3(Stack, { children: components.map((c, i) => /* @__PURE__ */ jsx3(entity_component_inspector_default, { component: c }, i)) }) })
|
|
197
107
|
] }, "components");
|
|
198
108
|
}
|
|
199
|
-
var entity_component_list_default =
|
|
109
|
+
var entity_component_list_default = memo4(EntityComponentList);
|
|
200
110
|
|
|
201
111
|
// src/components/entity-proxy-list.tsx
|
|
202
|
-
import { Accordion as
|
|
112
|
+
import { Accordion as Accordion2, Badge as Badge3, Stack as Stack2 } from "@mantine/core";
|
|
203
113
|
import { memo as memo6 } from "react";
|
|
204
|
-
|
|
114
|
+
|
|
115
|
+
// src/components/badge-list.tsx
|
|
116
|
+
import { Badge as Badge2 } from "@mantine/core";
|
|
117
|
+
import { memo as memo5 } from "react";
|
|
118
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
119
|
+
function BadgeList(props) {
|
|
120
|
+
return props.items.map((value, i) => {
|
|
121
|
+
return /* @__PURE__ */ jsx4(Badge2, { ...props.badge || [], children: /* @__PURE__ */ jsx4(formatter_camel_case_default, { value }) }, i);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
var badge_list_default = memo5(BadgeList);
|
|
125
|
+
|
|
126
|
+
// src/components/entity-proxy-list.tsx
|
|
127
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
205
128
|
function EntityProxyList(props) {
|
|
206
129
|
const proxies = Array.from(props.entity.proxies.values()).map((c) => c.values());
|
|
207
130
|
const items = proxies.map((p) => Array.from(p).map((k) => EcsIdGenerator.entityProxy(k))).flat();
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
131
|
+
return /* @__PURE__ */ jsxs3(Accordion2.Item, { value: "proxies", children: [
|
|
132
|
+
/* @__PURE__ */ jsx5(Accordion2.Control, { children: /* @__PURE__ */ jsx5(Badge3, { fullWidth: true, variant: "light", rightSection: items.length, children: "Proxies" }) }),
|
|
133
|
+
/* @__PURE__ */ jsx5(Accordion2.Panel, { children: /* @__PURE__ */ jsx5(Stack2, { children: /* @__PURE__ */ jsx5(badge_list_default, { items, badge: { variant: "outline" } }) }) })
|
|
211
134
|
] }, "proxies");
|
|
212
135
|
}
|
|
213
136
|
var entity_proxy_list_default = memo6(EntityProxyList);
|
|
214
137
|
|
|
215
138
|
// src/components/entity-subscription-list.tsx
|
|
216
|
-
import { Accordion as
|
|
217
|
-
import { memo as memo7, useContext
|
|
218
|
-
import { jsx as
|
|
139
|
+
import { Accordion as Accordion3, Badge as Badge4, Stack as Stack3 } from "@mantine/core";
|
|
140
|
+
import { memo as memo7, useContext } from "react";
|
|
141
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
219
142
|
function EntitySubscriptionList(props) {
|
|
220
|
-
const { entityEventsManager } =
|
|
143
|
+
const { entityEventsManager } = useContext(EcsFlowContext);
|
|
221
144
|
const subscriptions = entityEventsManager.getSubscriptionsForEntity(props.entity.myProxy);
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs4(Accordion3.Item, { value: "subscriptions", children: [
|
|
146
|
+
/* @__PURE__ */ jsx6(Accordion3.Control, { children: /* @__PURE__ */ jsx6(Badge4, { fullWidth: true, variant: "light", rightSection: subscriptions.length, children: "Events" }) }),
|
|
147
|
+
/* @__PURE__ */ jsx6(Accordion3.Panel, { children: /* @__PURE__ */ jsx6(Stack3, { children: /* @__PURE__ */ jsx6(badge_list_default, { items: subscriptions, badge: { variant: "outline" } }) }) })
|
|
225
148
|
] }, "subscriptions");
|
|
226
149
|
}
|
|
227
150
|
var entity_subscription_list_default = memo7(EntitySubscriptionList);
|
|
228
151
|
|
|
229
152
|
// src/components/entity-update-counter.tsx
|
|
230
|
-
import { Badge as
|
|
231
|
-
import { memo as memo8, useContext as
|
|
232
|
-
import { Fragment
|
|
153
|
+
import { Badge as Badge5 } from "@mantine/core";
|
|
154
|
+
import { memo as memo8, useContext as useContext2, useEffect, useState } from "react";
|
|
155
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
233
156
|
function EntityUpdateCounter(props) {
|
|
234
157
|
const [, setRefresh] = useState(0);
|
|
235
|
-
const { entityUpdateCounter } =
|
|
158
|
+
const { entityUpdateCounter } = useContext2(EcsFlowContext);
|
|
236
159
|
const updates = entityUpdateCounter.getUpdateCount(props.entityUid) || 0;
|
|
237
160
|
const removes = entityUpdateCounter.getRemoveCount(props.entityUid) || 0;
|
|
238
161
|
useEffect(() => {
|
|
@@ -244,49 +167,124 @@ function EntityUpdateCounter(props) {
|
|
|
244
167
|
clearInterval(interval);
|
|
245
168
|
};
|
|
246
169
|
}, []);
|
|
247
|
-
return /* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */
|
|
170
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
171
|
+
/* @__PURE__ */ jsx7(Badge5, { variant: "light", children: updates }),
|
|
172
|
+
/* @__PURE__ */ jsx7(Badge5, { variant: "light", color: "orange", children: removes })
|
|
250
173
|
] });
|
|
251
174
|
}
|
|
252
175
|
var entity_update_counter_default = memo8(EntityUpdateCounter);
|
|
253
176
|
|
|
254
177
|
// src/layout/entity-layout.tsx
|
|
255
|
-
import { Fragment as
|
|
178
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
256
179
|
function EntityLayout({ entity }) {
|
|
257
|
-
return /* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */
|
|
180
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
181
|
+
/* @__PURE__ */ jsxs6(Group, { children: [
|
|
182
|
+
/* @__PURE__ */ jsx8(Badge6, { variant: "outline", color: "orange", children: entity.myProxy.entityUid }),
|
|
183
|
+
/* @__PURE__ */ jsx8(entity_update_counter_default, { entityUid: entity.myProxy.entityUid })
|
|
261
184
|
] }),
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ jsx8(Divider, { my: 5 }),
|
|
186
|
+
/* @__PURE__ */ jsxs6(Accordion4, { children: [
|
|
187
|
+
/* @__PURE__ */ jsx8(entity_component_list_default, { entity }),
|
|
188
|
+
/* @__PURE__ */ jsx8(entity_proxy_list_default, { entity }),
|
|
189
|
+
/* @__PURE__ */ jsx8(entity_subscription_list_default, { entity })
|
|
267
190
|
] })
|
|
268
191
|
] });
|
|
269
192
|
}
|
|
270
193
|
var entity_layout_default = EntityLayout;
|
|
271
194
|
|
|
272
195
|
// src/nodes/node-entity.tsx
|
|
273
|
-
import { jsx as
|
|
196
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
274
197
|
function EntityNode({ id, data, selected, type }) {
|
|
275
|
-
const { entityRepository } =
|
|
276
|
-
const entity =
|
|
198
|
+
const { entityRepository } = useContext3(EcsFlowContext);
|
|
199
|
+
const entity = useMemo4(() => entityRepository.get(data.entity), [data.entity]);
|
|
200
|
+
return /* @__PURE__ */ jsx9(
|
|
201
|
+
NodeContainer,
|
|
202
|
+
{
|
|
203
|
+
id,
|
|
204
|
+
selected,
|
|
205
|
+
data,
|
|
206
|
+
title: /* @__PURE__ */ jsx9(Badge7, { fullWidth: true, variant: "transparent", children: /* @__PURE__ */ jsx9(formatter_camel_case_default, { value: entity.myProxy.entityType }) }),
|
|
207
|
+
type,
|
|
208
|
+
children: /* @__PURE__ */ jsx9(entity_layout_default, { entity })
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
var node_entity_default = EntityNode;
|
|
213
|
+
|
|
214
|
+
// src/nodes/node-systems-module.tsx
|
|
215
|
+
import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
|
|
216
|
+
import { Badge as Badge9 } from "@mantine/core";
|
|
217
|
+
import { useContext as useContext4 } from "react";
|
|
218
|
+
|
|
219
|
+
// src/layout/systems-module-layout.tsx
|
|
220
|
+
import { SystemType } from "@awesome-ecs/abstract/systems";
|
|
221
|
+
import { Accordion as Accordion6, Text } from "@mantine/core";
|
|
222
|
+
import { useMemo as useMemo5 } from "react";
|
|
223
|
+
|
|
224
|
+
// src/components/pipeline-middleware-list.tsx
|
|
225
|
+
import { Accordion as Accordion5, Badge as Badge8, Stack as Stack4 } from "@mantine/core";
|
|
226
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
227
|
+
function PipelineMiddlewareList(props) {
|
|
228
|
+
let middleware = [];
|
|
229
|
+
if (props.pipeline) {
|
|
230
|
+
middleware = props.pipeline["middleware"];
|
|
231
|
+
}
|
|
232
|
+
const components = middleware.map((m) => {
|
|
233
|
+
return m.name || m.constructor.name;
|
|
234
|
+
});
|
|
235
|
+
return /* @__PURE__ */ jsxs7(Accordion5.Item, { value: props.label, children: [
|
|
236
|
+
/* @__PURE__ */ jsx10(Accordion5.Control, { children: /* @__PURE__ */ jsx10(Badge8, { fullWidth: true, variant: "light", rightSection: components.length, children: props.label }) }),
|
|
237
|
+
/* @__PURE__ */ jsx10(Accordion5.Panel, { children: /* @__PURE__ */ jsx10(Stack4, { children: /* @__PURE__ */ jsx10(badge_list_default, { items: components, badge: { variant: "outline" } }) }) })
|
|
238
|
+
] }, props.label);
|
|
239
|
+
}
|
|
240
|
+
var pipeline_middleware_list_default = PipelineMiddlewareList;
|
|
241
|
+
|
|
242
|
+
// src/layout/systems-module-layout.tsx
|
|
243
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
244
|
+
function SystemsModuleLayout(props) {
|
|
245
|
+
const { module } = props;
|
|
246
|
+
const runtimeContext = module["runtimeContext"];
|
|
247
|
+
const { systemContext } = runtimeContext;
|
|
248
|
+
const { status } = useMemo5(() => {
|
|
249
|
+
return systemContext.runtime;
|
|
250
|
+
}, [systemContext.runtime.status]);
|
|
251
|
+
const init = runtimeContext.systemPipelines.get(SystemType.initialize);
|
|
252
|
+
const update = runtimeContext.systemPipelines.get(SystemType.update);
|
|
253
|
+
const render = runtimeContext.systemPipelines.get(SystemType.render);
|
|
254
|
+
const sync = runtimeContext.systemPipelines.get(SystemType.sync);
|
|
255
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
256
|
+
/* @__PURE__ */ jsxs8(Text, { children: [
|
|
257
|
+
"Status: ",
|
|
258
|
+
status
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ jsxs8(Accordion6, { children: [
|
|
261
|
+
init && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: init, label: "Initialize" }),
|
|
262
|
+
update && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: update, label: "Update" }),
|
|
263
|
+
render && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: render, label: "Render" }),
|
|
264
|
+
sync && /* @__PURE__ */ jsx11(pipeline_middleware_list_default, { pipeline: sync, label: "Sync" })
|
|
265
|
+
] })
|
|
266
|
+
] });
|
|
267
|
+
}
|
|
268
|
+
var systems_module_layout_default = SystemsModuleLayout;
|
|
269
|
+
|
|
270
|
+
// src/nodes/node-systems-module.tsx
|
|
271
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
272
|
+
function SystemsModuleNode({ id, data, selected, type }) {
|
|
273
|
+
const { systemsModuleRepository } = useContext4(EcsFlowContext);
|
|
274
|
+
const module = systemsModuleRepository.get(data.entityType);
|
|
277
275
|
return /* @__PURE__ */ jsx12(
|
|
278
276
|
NodeContainer2,
|
|
279
277
|
{
|
|
280
278
|
id,
|
|
281
279
|
selected,
|
|
282
280
|
data,
|
|
283
|
-
title: /* @__PURE__ */ jsx12(Badge9, { fullWidth: true, variant: "transparent", children: /* @__PURE__ */ jsx12(formatter_camel_case_default, { value:
|
|
281
|
+
title: /* @__PURE__ */ jsx12(Badge9, { fullWidth: true, color: "indigo", variant: "transparent", children: /* @__PURE__ */ jsx12(formatter_camel_case_default, { value: data.entityType }) }),
|
|
284
282
|
type,
|
|
285
|
-
children: /* @__PURE__ */ jsx12(
|
|
283
|
+
children: /* @__PURE__ */ jsx12(systems_module_layout_default, { type: data.entityType, module })
|
|
286
284
|
}
|
|
287
285
|
);
|
|
288
286
|
}
|
|
289
|
-
var
|
|
287
|
+
var node_systems_module_default = SystemsModuleNode;
|
|
290
288
|
|
|
291
289
|
// src/templates/template-entity-node.ts
|
|
292
290
|
import { Position } from "@xyflow/react";
|
|
@@ -360,18 +358,19 @@ var ecsNodeTemplates = {
|
|
|
360
358
|
};
|
|
361
359
|
|
|
362
360
|
// src/flow/flow-ecs-state.tsx
|
|
363
|
-
import {
|
|
361
|
+
import { FlowAutoLayout } from "@awesome-flow/core/canvas";
|
|
362
|
+
import { memo as memo9, useContext as useContext9, useEffect as useEffect6, useState as useState3 } from "react";
|
|
364
363
|
|
|
365
364
|
// src/flow/flow-ecs-entities.tsx
|
|
366
365
|
import { FlowContext } from "@awesome-flow/core/abstract";
|
|
367
|
-
import { useContext as useContext7, useEffect as useEffect4, useState as useState2 } from "react";
|
|
368
366
|
import { useFlowStore as useFlowStore3 } from "@awesome-flow/core/hooks";
|
|
367
|
+
import { useContext as useContext7, useEffect as useEffect4, useState as useState2 } from "react";
|
|
369
368
|
|
|
370
|
-
// src/flow/flow-ecs-edge-
|
|
371
|
-
import { useContext as useContext5, useEffect as useEffect2 } from "react";
|
|
369
|
+
// src/flow/flow-ecs-edge-modules.tsx
|
|
372
370
|
import { useFlowStore } from "@awesome-flow/core/hooks";
|
|
371
|
+
import { useContext as useContext5, useEffect as useEffect2 } from "react";
|
|
373
372
|
import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
|
|
374
|
-
function
|
|
373
|
+
function FlowEcsEdgeModules(props) {
|
|
375
374
|
const { nodesToConnect } = props;
|
|
376
375
|
const onConnect = useFlowStore((state) => state.onConnect);
|
|
377
376
|
const { ecsFlowRepository, entityRepository } = useContext5(EcsFlowContext);
|
|
@@ -379,31 +378,27 @@ function FlowEcsEdgeProxies(props) {
|
|
|
379
378
|
for (const node of nodesToConnect) {
|
|
380
379
|
const sourceHandle = node.data.handles.find((h) => h.connection === "source");
|
|
381
380
|
const entity = entityRepository.get(node.data.entity);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
targetHandle: targetHandle.id
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
}
|
|
381
|
+
const systemModule = ecsFlowRepository.getSystemModuleNode(entity.myProxy.entityType);
|
|
382
|
+
const targetHandle = systemModule?.data.handles.find((h) => h.connection === "target");
|
|
383
|
+
if (targetHandle) {
|
|
384
|
+
onConnect({
|
|
385
|
+
source: node.id,
|
|
386
|
+
target: systemModule.id,
|
|
387
|
+
sourceHandle: sourceHandle.id,
|
|
388
|
+
targetHandle: targetHandle.id
|
|
389
|
+
});
|
|
395
390
|
}
|
|
396
391
|
}
|
|
397
392
|
}, [nodesToConnect]);
|
|
398
393
|
return /* @__PURE__ */ jsx13(Fragment4, {});
|
|
399
394
|
}
|
|
400
|
-
var
|
|
395
|
+
var flow_ecs_edge_modules_default = FlowEcsEdgeModules;
|
|
401
396
|
|
|
402
|
-
// src/flow/flow-ecs-edge-
|
|
403
|
-
import { useContext as useContext6, useEffect as useEffect3 } from "react";
|
|
397
|
+
// src/flow/flow-ecs-edge-proxies.tsx
|
|
404
398
|
import { useFlowStore as useFlowStore2 } from "@awesome-flow/core/hooks";
|
|
399
|
+
import { useContext as useContext6, useEffect as useEffect3 } from "react";
|
|
405
400
|
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
406
|
-
function
|
|
401
|
+
function FlowEcsEdgeProxies(props) {
|
|
407
402
|
const { nodesToConnect } = props;
|
|
408
403
|
const onConnect = useFlowStore2((state) => state.onConnect);
|
|
409
404
|
const { ecsFlowRepository, entityRepository } = useContext6(EcsFlowContext);
|
|
@@ -411,21 +406,25 @@ function FlowEcsEdgeModules(props) {
|
|
|
411
406
|
for (const node of nodesToConnect) {
|
|
412
407
|
const sourceHandle = node.data.handles.find((h) => h.connection === "source");
|
|
413
408
|
const entity = entityRepository.get(node.data.entity);
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
409
|
+
for (const [, proxyMap] of entity.proxies) {
|
|
410
|
+
for (const proxy of proxyMap.values()) {
|
|
411
|
+
const proxyNode = ecsFlowRepository.getEntityNode(proxy);
|
|
412
|
+
if (proxyNode) {
|
|
413
|
+
const targetHandle = proxyNode.data.handles.find((h) => h.connection === "target");
|
|
414
|
+
onConnect({
|
|
415
|
+
source: node.id,
|
|
416
|
+
target: proxyNode.id,
|
|
417
|
+
sourceHandle: sourceHandle.id,
|
|
418
|
+
targetHandle: targetHandle.id
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
424
|
}, [nodesToConnect]);
|
|
426
425
|
return /* @__PURE__ */ jsx14(Fragment5, {});
|
|
427
426
|
}
|
|
428
|
-
var
|
|
427
|
+
var flow_ecs_edge_proxies_default = FlowEcsEdgeProxies;
|
|
429
428
|
|
|
430
429
|
// src/flow/flow-ecs-entities.tsx
|
|
431
430
|
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
@@ -458,9 +457,9 @@ function FlowEcsEntities() {
|
|
|
458
457
|
var flow_ecs_entities_default = FlowEcsEntities;
|
|
459
458
|
|
|
460
459
|
// src/flow/flow-ecs-modules.tsx
|
|
461
|
-
import { useEffect as useEffect5, useContext as useContext8 } from "react";
|
|
462
460
|
import { FlowContext as FlowContext2 } from "@awesome-flow/core/abstract";
|
|
463
461
|
import { useFlowStore as useFlowStore4 } from "@awesome-flow/core/hooks";
|
|
462
|
+
import { useContext as useContext8, useEffect as useEffect5 } from "react";
|
|
464
463
|
import { Fragment as Fragment7, jsx as jsx16 } from "react/jsx-runtime";
|
|
465
464
|
function FlowEcsModules() {
|
|
466
465
|
const { nodeFactory } = useContext8(FlowContext2);
|
|
@@ -489,7 +488,6 @@ function FlowEcsModules() {
|
|
|
489
488
|
var flow_ecs_modules_default = FlowEcsModules;
|
|
490
489
|
|
|
491
490
|
// src/flow/flow-ecs-state.tsx
|
|
492
|
-
import { FlowAutoLayout } from "@awesome-flow/core/canvas";
|
|
493
491
|
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
494
492
|
function FlowEcsState(props) {
|
|
495
493
|
const [, setUpdates] = useState3(0);
|
|
@@ -524,4 +522,3 @@ export {
|
|
|
524
522
|
ecsNodeTemplates,
|
|
525
523
|
ecsNodeTypes
|
|
526
524
|
};
|
|
527
|
-
//# sourceMappingURL=index.js.map
|