@adobe/data 0.9.5 → 0.9.6
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/ecs/database/create-plugin-cryos-pattern.test.d.ts +3 -0
- package/ecs/database/create-plugin-cryos-pattern.test.js +83 -0
- package/ecs/database/create-plugin-cryos-pattern.test.js.map +1 -0
- package/ecs/database/create-plugin-graphics.test.d.ts +93 -0
- package/ecs/database/create-plugin-graphics.test.js +135 -0
- package/ecs/database/create-plugin-graphics.test.js.map +1 -0
- package/ecs/database/create-plugin-type.type-test.js +563 -0
- package/ecs/database/create-plugin-type.type-test.js.map +1 -0
- package/ecs/database/create-plugin-type.type.test.js +563 -0
- package/ecs/database/create-plugin-type.type.test.js.map +1 -0
- package/ecs/database/database.d.ts +6 -1
- package/ecs/database/database.js.map +1 -1
- package/ecs/database/experimental-action-types.js +275 -0
- package/ecs/database/experimental-action-types.js.map +1 -0
- package/ecs/database/from-plugin.type-test.js +180 -0
- package/ecs/database/from-plugin.type-test.js.map +1 -0
- package/ecs/database/plugin-types.js +5 -0
- package/ecs/database/plugin-types.js.map +1 -0
- package/ecs/database/type-investigation.test.js +54 -0
- package/ecs/database/type-investigation.test.js.map +1 -0
- package/ecs/store/core/create-core.test.js +21 -0
- package/ecs/store/core/create-core.test.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/typed-buffer/create-array-buffer.js +10 -0
- package/typed-buffer/create-array-buffer.js.map +1 -1
- package/typed-buffer/create-array-buffer.test.js +50 -0
- package/typed-buffer/create-array-buffer.test.js.map +1 -1
- package/typed-buffer/create-const-buffer.js +3 -0
- package/typed-buffer/create-const-buffer.js.map +1 -1
- package/typed-buffer/create-const-buffer.test.js +24 -0
- package/typed-buffer/create-const-buffer.test.js.map +1 -1
- package/typed-buffer/create-number-buffer.js +4 -0
- package/typed-buffer/create-number-buffer.js.map +1 -1
- package/typed-buffer/create-number-buffer.test.js +38 -0
- package/typed-buffer/create-number-buffer.test.js.map +1 -1
- package/typed-buffer/create-struct-buffer.js +11 -0
- package/typed-buffer/create-struct-buffer.js.map +1 -1
- package/typed-buffer/create-struct-buffer.test.js +60 -0
- package/typed-buffer/create-struct-buffer.test.js.map +1 -1
- package/typed-buffer/typed-buffer.d.ts +2 -0
- package/typed-buffer/typed-buffer.js.map +1 -1
- package/assembly/package.json +0 -1
- package/blob/package.json +0 -1
- package/cache/package.json +0 -1
- package/debug-type-test.js +0 -12
- package/debug-type-test.js.map +0 -1
- package/ecs/database/archetype-type-safety-test.d.ts +0 -21
- package/ecs/database/archetype-type-safety-test.js +0 -36
- package/ecs/database/archetype-type-safety-test.js.map +0 -1
- package/ecs/database/create-database-schema-test.js +0 -150
- package/ecs/database/create-database-schema-test.js.map +0 -1
- package/ecs/database/create-plugin-v2.d.ts +0 -79
- package/ecs/database/create-plugin-v2.js +0 -68
- package/ecs/database/create-plugin-v2.js.map +0 -1
- package/ecs/database/create-plugin-v2.test.js +0 -362
- package/ecs/database/create-plugin-v2.test.js.map +0 -1
- package/ecs/database/create-plugin.OLD.d.ts +0 -138
- package/ecs/database/create-plugin.OLD.js +0 -59
- package/ecs/database/create-plugin.OLD.js.map +0 -1
- package/ecs/database/database-with-systems.test.js +0 -292
- package/ecs/database/database-with-systems.test.js.map +0 -1
- package/ecs/database/database.plugin.create.test.OLD.js +0 -601
- package/ecs/database/database.plugin.create.test.OLD.js.map +0 -1
- package/ecs/database/database.plugin.create.test.js +0 -321
- package/ecs/database/database.plugin.create.test.js.map +0 -1
- package/ecs/database/database.plugin.test.d.ts +0 -1
- package/ecs/database/database.plugin.test.js +0 -90
- package/ecs/database/database.plugin.test.js.map +0 -1
- package/ecs/database/database.test copy.d.ts +0 -1
- package/ecs/database/database.test copy.js +0 -199
- package/ecs/database/database.test copy.js.map +0 -1
- package/ecs/database/multi-param-inference-poc.test.d.ts +0 -1
- package/ecs/database/multi-param-inference-poc.test.js +0 -96
- package/ecs/database/multi-param-inference-poc.test.js.map +0 -1
- package/ecs/database/old-plugin-create-with-dependencies-array.d.ts +0 -61
- package/ecs/database/old-plugin-create-with-dependencies-array.js +0 -76
- package/ecs/database/old-plugin-create-with-dependencies-array.js.map +0 -1
- package/ecs/database/overload-inference-poc.test.d.ts +0 -1
- package/ecs/database/overload-inference-poc.test.js +0 -109
- package/ecs/database/overload-inference-poc.test.js.map +0 -1
- package/ecs/database/schedule-type-check-demo.d.ts +0 -10
- package/ecs/database/schedule-type-check-demo.js +0 -71
- package/ecs/database/schedule-type-check-demo.js.map +0 -1
- package/ecs/database/test-archetype-validation.d.ts +0 -9
- package/ecs/database/test-archetype-validation.js +0 -14
- package/ecs/database/test-archetype-validation.js.map +0 -1
- package/ecs/database/test-exactkeys.d.ts +0 -1
- package/ecs/database/test-exactkeys.js +0 -17
- package/ecs/database/test-exactkeys.js.map +0 -1
- package/ecs/database/transactional-store/coalesce-transactions.test.js +0 -433
- package/ecs/database/transactional-store/coalesce-transactions.test.js.map +0 -1
- package/ecs/database/type-inference-demo.d.ts +0 -75
- package/ecs/database/type-inference-demo.js +0 -73
- package/ecs/database/type-inference-demo.js.map +0 -1
- package/ecs/database/type-inference-poc.test.d.ts +0 -1
- package/ecs/database/type-inference-poc.test.js +0 -73
- package/ecs/database/type-inference-poc.test.js.map +0 -1
- package/ecs/package.json +0 -1
- package/ecs/plugins/scheduler/create-scheduler-plugin.d.ts +0 -8
- package/ecs/plugins/scheduler/create-scheduler-plugin.js +0 -54
- package/ecs/plugins/scheduler/create-scheduler-plugin.js.map +0 -1
- package/ecs/plugins/scheduler/create-scheduler-plugin.test.d.ts +0 -1
- package/ecs/plugins/scheduler/create-scheduler-plugin.test.js +0 -198
- package/ecs/plugins/scheduler/create-scheduler-plugin.test.js.map +0 -1
- package/ecs/plugins/scheduler/type-inference-test.d.ts +0 -1
- package/ecs/plugins/scheduler/type-inference-test.js +0 -2
- package/ecs/plugins/scheduler/type-inference-test.js.map +0 -1
- package/ecs/store/entity-functions.d.ts +0 -7
- package/ecs/store/entity-functions.js +0 -2
- package/ecs/store/entity-functions.js.map +0 -1
- package/ecs/store/functions.d.ts +0 -2
- package/ecs/store/functions.js +0 -2
- package/ecs/store/functions.js.map +0 -1
- package/ecs/system/system-declaration.d.ts +0 -7
- package/ecs/system/system-declaration.js +0 -23
- package/ecs/system/system-declaration.js.map +0 -1
- package/ecs/system/system-declarations.d.ts +0 -4
- package/ecs/system/system-declarations.js +0 -23
- package/ecs/system/system-declarations.js.map +0 -1
- package/ecs/system/system-factory/public/create copy.d.ts +0 -12
- package/ecs/system/system-factory/public/create copy.js +0 -8
- package/ecs/system/system-factory/public/create copy.js.map +0 -1
- package/ecs/system/system-factory/public/create.d.ts +0 -12
- package/ecs/system/system-factory/public/create.js +0 -8
- package/ecs/system/system-factory/public/create.js.map +0 -1
- package/ecs/system/system-factory/public/create.test.d.ts +0 -1
- package/ecs/system/system-factory/public/create.test.js +0 -42
- package/ecs/system/system-factory/public/create.test.js.map +0 -1
- package/ecs/system/system-factory/public/index.d.ts +0 -1
- package/ecs/system/system-factory/public/index.js +0 -2
- package/ecs/system/system-factory/public/index.js.map +0 -1
- package/ecs/system/system-factory/system-factory.d.ts +0 -17
- package/ecs/system/system-factory/system-factory.js +0 -23
- package/ecs/system/system-factory/system-factory.js.map +0 -1
- package/ecs/system/system-factory.d.ts +0 -9
- package/ecs/system/system-factory.js +0 -23
- package/ecs/system/system-factory.js.map +0 -1
- package/ecs/system/system-interface.d.ts +0 -5
- package/ecs/system/system-interface.js +0 -2
- package/ecs/system/system-interface.js.map +0 -1
- package/ecs/system/system.d.ts +0 -4
- package/ecs/system/system.js +0 -23
- package/ecs/system/system.js.map +0 -1
- package/ecs/system/systems-type.d.ts +0 -2
- package/ecs/system/systems-type.js +0 -2
- package/ecs/system/systems-type.js.map +0 -1
- package/ecs/system/systems.d.ts +0 -2
- package/ecs/system/systems.js +0 -23
- package/ecs/system/systems.js.map +0 -1
- package/ecs/system/world-schema/public/create.d.ts +0 -12
- package/ecs/system/world-schema/public/create.js +0 -8
- package/ecs/system/world-schema/public/create.js.map +0 -1
- package/ecs/system/world-schema/public/create.test.d.ts +0 -1
- package/ecs/system/world-schema/public/create.test.js +0 -42
- package/ecs/system/world-schema/public/create.test.js.map +0 -1
- package/ecs/system/world-schema/public/index.d.ts +0 -1
- package/ecs/system/world-schema/public/index.js +0 -2
- package/ecs/system/world-schema/public/index.js.map +0 -1
- package/ecs/system/world-schema/system-factory.d.ts +0 -17
- package/ecs/system/world-schema/system-factory.js +0 -23
- package/ecs/system/world-schema/system-factory.js.map +0 -1
- package/ecs/world/calculate-system-order.d.ts +0 -18
- package/ecs/world/calculate-system-order.js +0 -113
- package/ecs/world/calculate-system-order.js.map +0 -1
- package/ecs/world/calculate-system-order.test.d.ts +0 -1
- package/ecs/world/calculate-system-order.test.js +0 -168
- package/ecs/world/calculate-system-order.test.js.map +0 -1
- package/ecs/world/create-world-schema-test.d.ts +0 -1
- package/ecs/world/create-world-schema-test.js +0 -294
- package/ecs/world/create-world-schema-test.js.map +0 -1
- package/ecs/world/create-world-type-test.d.ts +0 -1
- package/ecs/world/create-world-type-test.js +0 -129
- package/ecs/world/create-world-type-test.js.map +0 -1
- package/ecs/world/create-world.d.ts +0 -19
- package/ecs/world/create-world.js +0 -80
- package/ecs/world/create-world.js.map +0 -1
- package/ecs/world/create-world.test.d.ts +0 -1
- package/ecs/world/create-world.test.js +0 -292
- package/ecs/world/create-world.test.js.map +0 -1
- package/ecs/world/public/world-schema/public/create.d.ts +0 -12
- package/ecs/world/public/world-schema/public/create.js +0 -8
- package/ecs/world/public/world-schema/public/create.js.map +0 -1
- package/ecs/world/public/world-schema/public/create.test.d.ts +0 -1
- package/ecs/world/public/world-schema/public/create.test.js +0 -42
- package/ecs/world/public/world-schema/public/create.test.js.map +0 -1
- package/ecs/world/public/world-schema/public/index.d.ts +0 -1
- package/ecs/world/public/world-schema/public/index.js +0 -2
- package/ecs/world/public/world-schema/public/index.js.map +0 -1
- package/ecs/world/public/world-schema/world-schema.d.ts +0 -17
- package/ecs/world/public/world-schema/world-schema.js +0 -23
- package/ecs/world/public/world-schema/world-schema.js.map +0 -1
- package/ecs/world/system-declaration.d.ts +0 -1
- package/ecs/world/system-declaration.js +0 -23
- package/ecs/world/system-declaration.js.map +0 -1
- package/ecs/world/system-schedule-typing-test.d.ts +0 -1
- package/ecs/world/system-schedule-typing-test.js +0 -83
- package/ecs/world/system-schedule-typing-test.js.map +0 -1
- package/ecs/world/world-schema/public/create.d.ts +0 -12
- package/ecs/world/world-schema/public/create.js +0 -10
- package/ecs/world/world-schema/public/create.js.map +0 -1
- package/ecs/world/world-schema/public/create.test.d.ts +0 -1
- package/ecs/world/world-schema/public/create.test.js +0 -41
- package/ecs/world/world-schema/public/create.test.js.map +0 -1
- package/ecs/world/world-schema/public/index.d.ts +0 -1
- package/ecs/world/world-schema/public/index.js +0 -2
- package/ecs/world/world-schema/public/index.js.map +0 -1
- package/ecs/world/world-schema/system-factory.d.ts +0 -17
- package/ecs/world/world-schema/system-factory.js +0 -23
- package/ecs/world/world-schema/system-factory.js.map +0 -1
- package/ecs/world/world-schema/world-schema.d.ts +0 -19
- package/ecs/world/world-schema/world-schema.js +0 -23
- package/ecs/world/world-schema/world-schema.js.map +0 -1
- package/ecs/world/world.d.ts +0 -86
- package/ecs/world/world.js +0 -81
- package/ecs/world/world.js.map +0 -1
- package/ecs/world/world.test.d.ts +0 -1
- package/ecs/world/world.test.js +0 -176
- package/ecs/world/world.test.js.map +0 -1
- package/functions/package.json +0 -1
- package/lit/elements/application-element copy.d.ts +0 -9
- package/lit/elements/application-element copy.js +0 -62
- package/lit/elements/application-element copy.js.map +0 -1
- package/lit/package.json +0 -1
- package/math/package.json +0 -1
- package/observe/package.json +0 -1
- package/old-ecs/package.json +0 -1
- package/perftest/package.json +0 -1
- package/samples/package.json +0 -1
- package/schema/package.json +0 -1
- package/service/package.json +0 -1
- package/table/package.json +0 -1
- package/typed-buffer/package.json +0 -1
- package/types/package.json +0 -1
- /package/{debug-type-test.d.ts → ecs/database/create-plugin-type.type-test.d.ts} +0 -0
- /package/ecs/database/{create-database-schema-test.d.ts → create-plugin-type.type.test.d.ts} +0 -0
- /package/ecs/database/{create-plugin-v2.test.d.ts → experimental-action-types.d.ts} +0 -0
- /package/ecs/database/{database-with-systems.test.d.ts → from-plugin.type-test.d.ts} +0 -0
- /package/ecs/database/{database.plugin.create.test.OLD.d.ts → plugin-types.d.ts} +0 -0
- /package/ecs/database/{database.plugin.create.test.d.ts → type-investigation.test.d.ts} +0 -0
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
import { assert } from "riteway/vitest";
|
|
23
|
-
import { describe, test } from "vitest";
|
|
24
|
-
import { createWorld } from "./create-world.js";
|
|
25
|
-
import { World } from "./world.js";
|
|
26
|
-
describe("createWorld", () => {
|
|
27
|
-
test("empty world creation", async () => {
|
|
28
|
-
const world = createWorld();
|
|
29
|
-
await assert({
|
|
30
|
-
given: "no arguments",
|
|
31
|
-
should: "create empty world with database",
|
|
32
|
-
actual: typeof world.database,
|
|
33
|
-
expected: "object",
|
|
34
|
-
});
|
|
35
|
-
await assert({
|
|
36
|
-
given: "no arguments",
|
|
37
|
-
should: "create empty world with system object",
|
|
38
|
-
actual: typeof world.system,
|
|
39
|
-
expected: "object",
|
|
40
|
-
});
|
|
41
|
-
await assert({
|
|
42
|
-
given: "no arguments",
|
|
43
|
-
should: "have empty system functions",
|
|
44
|
-
actual: Object.keys(world.system.functions).length,
|
|
45
|
-
expected: 0,
|
|
46
|
-
});
|
|
47
|
-
await assert({
|
|
48
|
-
given: "no arguments",
|
|
49
|
-
should: "have empty system order",
|
|
50
|
-
actual: world.system.order.length,
|
|
51
|
-
expected: 0,
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
test("world from schema with systems", async () => {
|
|
55
|
-
let systemExecuted = false;
|
|
56
|
-
const schema = World.Schema.create({
|
|
57
|
-
components: {
|
|
58
|
-
position: { type: "object", default: { x: 0, y: 0, z: 0 } }
|
|
59
|
-
},
|
|
60
|
-
resources: {
|
|
61
|
-
time: { default: { delta: 0, elapsed: 0 } }
|
|
62
|
-
},
|
|
63
|
-
systems: {
|
|
64
|
-
updateSystem: {
|
|
65
|
-
create: (world) => () => {
|
|
66
|
-
systemExecuted = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const world = createWorld(schema);
|
|
72
|
-
await assert({
|
|
73
|
-
given: "world schema with one system",
|
|
74
|
-
should: "have system function available",
|
|
75
|
-
actual: typeof world.system.functions.updateSystem,
|
|
76
|
-
expected: "function",
|
|
77
|
-
});
|
|
78
|
-
await assert({
|
|
79
|
-
given: "world schema with one system",
|
|
80
|
-
should: "have system in order array",
|
|
81
|
-
actual: world.system.order,
|
|
82
|
-
expected: [["updateSystem"]],
|
|
83
|
-
});
|
|
84
|
-
// Execute the system
|
|
85
|
-
world.system.functions.updateSystem();
|
|
86
|
-
await assert({
|
|
87
|
-
given: "system execution",
|
|
88
|
-
should: "execute the system function",
|
|
89
|
-
actual: systemExecuted,
|
|
90
|
-
expected: true,
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
test("world with multiple systems and dependencies", async () => {
|
|
94
|
-
const executionOrder = [];
|
|
95
|
-
const schema = World.Schema.create({
|
|
96
|
-
systems: {
|
|
97
|
-
inputSystem: {
|
|
98
|
-
create: (world) => () => {
|
|
99
|
-
executionOrder.push("input");
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
physicsSystem: {
|
|
103
|
-
create: (world) => () => {
|
|
104
|
-
executionOrder.push("physics");
|
|
105
|
-
},
|
|
106
|
-
schedule: { after: ["inputSystem"] }
|
|
107
|
-
},
|
|
108
|
-
renderSystem: {
|
|
109
|
-
create: (world) => () => {
|
|
110
|
-
executionOrder.push("render");
|
|
111
|
-
},
|
|
112
|
-
schedule: { after: ["physicsSystem"] }
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
const world = createWorld(schema);
|
|
117
|
-
await assert({
|
|
118
|
-
given: "systems with dependencies",
|
|
119
|
-
should: "calculate correct execution order",
|
|
120
|
-
actual: world.system.order,
|
|
121
|
-
expected: [["inputSystem"], ["physicsSystem"], ["renderSystem"]],
|
|
122
|
-
});
|
|
123
|
-
// Execute systems in order
|
|
124
|
-
for (const tier of world.system.order) {
|
|
125
|
-
for (const systemName of tier) {
|
|
126
|
-
world.system.functions[systemName]();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
await assert({
|
|
130
|
-
given: "systems executed in order",
|
|
131
|
-
should: "run in correct sequence",
|
|
132
|
-
actual: executionOrder,
|
|
133
|
-
expected: ["input", "physics", "render"],
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
test("systems can access database", async () => {
|
|
137
|
-
let capturedDatabase = null;
|
|
138
|
-
const schema = World.Schema.create({
|
|
139
|
-
components: {
|
|
140
|
-
position: { type: "object", default: { x: 0, y: 0, z: 0 } }
|
|
141
|
-
},
|
|
142
|
-
systems: {
|
|
143
|
-
testSystem: {
|
|
144
|
-
create: (world) => {
|
|
145
|
-
capturedDatabase = world.database;
|
|
146
|
-
return () => { };
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
const world = createWorld(schema);
|
|
152
|
-
await assert({
|
|
153
|
-
given: "system created with database",
|
|
154
|
-
should: "receive database instance",
|
|
155
|
-
actual: capturedDatabase === world.database,
|
|
156
|
-
expected: true,
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
test("world extend with new systems", async () => {
|
|
160
|
-
const baseSchema = World.Schema.create({
|
|
161
|
-
systems: {
|
|
162
|
-
systemA: {
|
|
163
|
-
create: (world) => () => { }
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
const extensionSchema = World.Schema.create({
|
|
168
|
-
systems: {
|
|
169
|
-
systemB: {
|
|
170
|
-
create: (world) => () => { }
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
const world = createWorld(baseSchema);
|
|
175
|
-
const extendedWorld = world.extend(extensionSchema);
|
|
176
|
-
await assert({
|
|
177
|
-
given: "world extended with new system",
|
|
178
|
-
should: "have both systems available",
|
|
179
|
-
actual: Object.keys(extendedWorld.system.functions).sort(),
|
|
180
|
-
expected: ["systemA", "systemB"],
|
|
181
|
-
});
|
|
182
|
-
await assert({
|
|
183
|
-
given: "world extended with new system",
|
|
184
|
-
should: "update system order",
|
|
185
|
-
actual: extendedWorld.system.order,
|
|
186
|
-
expected: [["systemA", "systemB"]],
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
test("world extend with components and resources", async () => {
|
|
190
|
-
const baseSchema = World.Schema.create({
|
|
191
|
-
components: {
|
|
192
|
-
position: { type: "object", default: { x: 0, y: 0, z: 0 } }
|
|
193
|
-
},
|
|
194
|
-
systems: {
|
|
195
|
-
systemA: {
|
|
196
|
-
create: (world) => () => {
|
|
197
|
-
// Can access position component
|
|
198
|
-
const entities = world.database.select(["position"]);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
const extensionSchema = World.Schema.create({
|
|
204
|
-
components: {
|
|
205
|
-
velocity: { type: "object", default: { x: 0, y: 0, z: 0 } }
|
|
206
|
-
},
|
|
207
|
-
systems: {
|
|
208
|
-
systemB: {
|
|
209
|
-
create: (world) => () => {
|
|
210
|
-
// Can access velocity component
|
|
211
|
-
const entities = world.database.select(["velocity"]);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
const world = createWorld(baseSchema);
|
|
217
|
-
const extendedWorld = world.extend(extensionSchema);
|
|
218
|
-
// Create entity with both components
|
|
219
|
-
const archetype = extendedWorld.database.store.ensureArchetype(["id", "position", "velocity"]);
|
|
220
|
-
archetype.insert({
|
|
221
|
-
position: { x: 1, y: 2, z: 3 },
|
|
222
|
-
velocity: { x: 0.1, y: 0.2, z: 0.3 }
|
|
223
|
-
});
|
|
224
|
-
await assert({
|
|
225
|
-
given: "world extended with components",
|
|
226
|
-
should: "have both systems available",
|
|
227
|
-
actual: Object.keys(extendedWorld.system.functions).sort(),
|
|
228
|
-
expected: ["systemA", "systemB"],
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
test("world with async system", async () => {
|
|
232
|
-
let asyncExecuted = false;
|
|
233
|
-
const schema = World.Schema.create({
|
|
234
|
-
systems: {
|
|
235
|
-
asyncSystem: {
|
|
236
|
-
create: (world) => async () => {
|
|
237
|
-
await new Promise(resolve => setTimeout(resolve, 1));
|
|
238
|
-
asyncExecuted = true;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
const world = createWorld(schema);
|
|
244
|
-
await world.system.functions.asyncSystem();
|
|
245
|
-
await assert({
|
|
246
|
-
given: "async system execution",
|
|
247
|
-
should: "complete async operations",
|
|
248
|
-
actual: asyncExecuted,
|
|
249
|
-
expected: true,
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
test("world with parallel systems execution", async () => {
|
|
253
|
-
const executionLog = [];
|
|
254
|
-
const schema = World.Schema.create({
|
|
255
|
-
systems: {
|
|
256
|
-
system1: {
|
|
257
|
-
create: (world) => () => {
|
|
258
|
-
executionLog.push("system1-start");
|
|
259
|
-
executionLog.push("system1-end");
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
system2: {
|
|
263
|
-
create: (world) => () => {
|
|
264
|
-
executionLog.push("system2-start");
|
|
265
|
-
executionLog.push("system2-end");
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
system3: {
|
|
269
|
-
create: (world) => () => {
|
|
270
|
-
executionLog.push("system3-start");
|
|
271
|
-
executionLog.push("system3-end");
|
|
272
|
-
},
|
|
273
|
-
schedule: { after: ["system1", "system2"] }
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
const world = createWorld(schema);
|
|
278
|
-
await assert({
|
|
279
|
-
given: "systems with parallel execution capability",
|
|
280
|
-
should: "group independent systems in same tier",
|
|
281
|
-
actual: world.system.order[0]?.length ?? 0,
|
|
282
|
-
expected: 2,
|
|
283
|
-
});
|
|
284
|
-
await assert({
|
|
285
|
-
given: "systems with parallel execution capability",
|
|
286
|
-
should: "place dependent system in later tier",
|
|
287
|
-
actual: world.system.order[1],
|
|
288
|
-
expected: ["system3"],
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
//# sourceMappingURL=create-world.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-world.test.js","sourceRoot":"","sources":["../../../src/ecs/world/create-world.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAU,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAEzB,IAAI,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;QAE5B,MAAM,MAAM,CAAC;YACT,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,kCAAkC;YAC1C,MAAM,EAAE,OAAO,KAAK,CAAC,QAAQ;YAC7B,QAAQ,EAAE,QAAQ;SACrB,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC;YACT,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,uCAAuC;YAC/C,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM;YAC3B,QAAQ,EAAE,QAAQ;SACrB,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC;YACT,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,6BAA6B;YACrC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM;YAClD,QAAQ,EAAE,CAAC;SACd,CAAC,CAAC;QAEH,MAAM,MAAM,CAAC;YACT,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,yBAAyB;YACjC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM;YACjC,QAAQ,EAAE,CAAC;SACd,CAAC,C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
|
-
import { ComponentSchemas } from "../../../component-schemas.js";
|
|
4
|
-
import { ArchetypeComponents, Database } from "../../../index.js";
|
|
5
|
-
import { ResourceSchemas } from "../../../resource-schemas.js";
|
|
6
|
-
import { ActionDeclarations, ToActionFunctions } from "../../../store/action-functions.js";
|
|
7
|
-
import { SystemDeclarations, SystemFunctions } from "../world-schema.js";
|
|
8
|
-
export declare function create<C extends ComponentSchemas, R extends ResourceSchemas, A extends ArchetypeComponents<StringKeyof<C>>, T extends ActionDeclarations<FromSchemas<C>, FromSchemas<R>, A>, S extends string>(schema: Database.Schema<C, R, A, T>, systems: SystemDeclarations<S>, create: (db: Database<FromSchemas<C>, FromSchemas<R>, A, ToActionFunctions<T>>) => SystemFunctions<S>): {
|
|
9
|
-
readonly schema: Database.Schema<C, R, A, T>;
|
|
10
|
-
readonly systems: SystemDeclarations<S>;
|
|
11
|
-
readonly create: (db: Database<FromSchemas<C>, FromSchemas<R>, A, ToActionFunctions<T>>) => SystemFunctions<S>;
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../../src/ecs/world/public/world-schema/public/create.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,MAAM,CAOlB,MAAmC,EACnC,OAA8B,EAC9B,MAAqG;IAErG,OAAO;QACH,MAAM;QACN,OAAO;QACP,MAAM;KACqC,CAAC;AACpD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Vec3 } from "../../../../math/index.js";
|
|
2
|
-
import { Time } from "../../../../schema/index.js";
|
|
3
|
-
import { Database } from "../../../index.js";
|
|
4
|
-
import { create } from "./create.js";
|
|
5
|
-
import { describe, expect, it } from "vitest";
|
|
6
|
-
describe("create", () => {
|
|
7
|
-
it("should create a system factory", () => {
|
|
8
|
-
const graphics = create(Database.Schema.create({
|
|
9
|
-
components: {
|
|
10
|
-
position: Vec3.schema,
|
|
11
|
-
velocity: Vec3.schema,
|
|
12
|
-
},
|
|
13
|
-
resources: {
|
|
14
|
-
time: Time.schema,
|
|
15
|
-
},
|
|
16
|
-
archetypes: {
|
|
17
|
-
Position: ["position"],
|
|
18
|
-
},
|
|
19
|
-
transactions: {
|
|
20
|
-
createPosition(store) {
|
|
21
|
-
return store.archetypes.Position.insert({
|
|
22
|
-
position: [1, 2, 3],
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}), {
|
|
27
|
-
update: { name: "update" },
|
|
28
|
-
render: { name: "render" },
|
|
29
|
-
}, (db) => ({
|
|
30
|
-
update: () => {
|
|
31
|
-
},
|
|
32
|
-
render: () => {
|
|
33
|
-
},
|
|
34
|
-
}));
|
|
35
|
-
expect(graphics.schema).toBeDefined();
|
|
36
|
-
expect(graphics.systems).toBeDefined();
|
|
37
|
-
expect(graphics.create).toBeDefined();
|
|
38
|
-
expect(graphics.systems.render.name).toBe("render");
|
|
39
|
-
expect(graphics.systems.update.name).toBe("update");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=create.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.test.js","sourceRoot":"","sources":["../../../../../../src/ecs/world/public/world-schema/public/create.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,MAAM,QAAQ,GAAG,MAAM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* from "./create.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ecs/world/public/world-schema/public/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FromSchemas } from "../../../schema/index.js";
|
|
2
|
-
import { StringKeyof } from "../../../types/types.js";
|
|
3
|
-
import { ArchetypeComponents, ComponentSchemas, Database, ResourceSchemas } from "../../index.js";
|
|
4
|
-
import { ActionDeclarations, ToActionFunctions } from "../../store/action-functions.js";
|
|
5
|
-
import { SystemDeclaration } from "../system-declaration.js";
|
|
6
|
-
export * as WorldSchema from "./public/index.js";
|
|
7
|
-
export type SystemDeclarations<S extends string> = {
|
|
8
|
-
readonly [K in S]: SystemDeclaration<K>;
|
|
9
|
-
};
|
|
10
|
-
export type SystemFunctions<S extends string> = {
|
|
11
|
-
readonly [K in S]: () => void;
|
|
12
|
-
};
|
|
13
|
-
export interface WorldSchema<C extends ComponentSchemas = never, R extends ResourceSchemas = never, A extends ArchetypeComponents<StringKeyof<C>> = never, T extends ActionDeclarations<FromSchemas<C>, FromSchemas<R>, A> = never, S extends string = never> {
|
|
14
|
-
schema: Database.Schema<C, R, A, T>;
|
|
15
|
-
systems: SystemDeclarations<S>;
|
|
16
|
-
create(db: Database<FromSchemas<C>, FromSchemas<R>, A, ToActionFunctions<T>>): SystemFunctions<S>;
|
|
17
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
export * as WorldSchema from "./public/index.js";
|
|
23
|
-
//# sourceMappingURL=world-schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"world-schema.js","sourceRoot":"","sources":["../../../../../src/ecs/world/public/world-schema/world-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAQX,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type SystemFunction = () => void | Promise<void>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=system-declaration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system-declaration.js","sourceRoot":"","sources":["../../../src/ecs/world/system-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
import { World } from "./world.js";
|
|
23
|
-
// Test that system schedule typing works correctly
|
|
24
|
-
const baseSchema = World.Schema.create({
|
|
25
|
-
components: {
|
|
26
|
-
position: { type: "number" },
|
|
27
|
-
},
|
|
28
|
-
resources: {},
|
|
29
|
-
archetypes: {},
|
|
30
|
-
transactions: {},
|
|
31
|
-
systems: {
|
|
32
|
-
inputSystem: {
|
|
33
|
-
create: () => () => { }
|
|
34
|
-
},
|
|
35
|
-
physicsSystem: {
|
|
36
|
-
create: () => () => { },
|
|
37
|
-
// Valid: can reference other systems (type is constrained to all system names in schema)
|
|
38
|
-
schedule: {
|
|
39
|
-
after: ["inputSystem"]
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
renderSystem: {
|
|
43
|
-
create: () => () => { },
|
|
44
|
-
// Valid: can reference multiple systems (type is constrained to all system names)
|
|
45
|
-
schedule: {
|
|
46
|
-
after: ["inputSystem", "physicsSystem"]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const extendedSchema = World.Schema.create({
|
|
52
|
-
components: {
|
|
53
|
-
velocity: { type: "number" }
|
|
54
|
-
},
|
|
55
|
-
resources: {},
|
|
56
|
-
archetypes: {},
|
|
57
|
-
transactions: {},
|
|
58
|
-
systems: {
|
|
59
|
-
aiSystem: {
|
|
60
|
-
create: () => () => { },
|
|
61
|
-
// Valid: references systems from both current schema and dependencies
|
|
62
|
-
schedule: {
|
|
63
|
-
after: ["inputSystem"], // from baseSchema
|
|
64
|
-
before: ["physicsSystem"] // from baseSchema
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
debugSystem: {
|
|
68
|
-
create: () => () => { },
|
|
69
|
-
// Valid: can reference systems from current schema and dependencies
|
|
70
|
-
schedule: {
|
|
71
|
-
after: ["aiSystem", "renderSystem"]
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}, [baseSchema]);
|
|
76
|
-
// Verify the schemas compile
|
|
77
|
-
const hasInputSystem = "inputSystem" in baseSchema.systems;
|
|
78
|
-
const hasAiSystem = "aiSystem" in extendedSchema.systems;
|
|
79
|
-
if (!hasInputSystem || !hasAiSystem) {
|
|
80
|
-
throw new Error("System schedule typing test failed");
|
|
81
|
-
}
|
|
82
|
-
console.log("✓ System schedule typing test passed");
|
|
83
|
-
//# sourceMappingURL=system-schedule-typing-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system-schedule-typing-test.js","sourceRoot":"","sources":["../../../src/ecs/world/system-schedule-typing-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,mDAAmD;AAEnD,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACnC,UAAU,EAAE;QACR,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC/B;IACD,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,EAAE;IAChB,OAAO,EAAE;QACL,WAAW,EAAE;YACT,MAAM,E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AAc,IAAI,CAAC,WAAW,EAAE,CAAC;IAClC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC1D,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FromSchemas } from "../../../../schema/from-schemas.js";
|
|
2
|
-
import { StringKeyof } from "../../../../types/types.js";
|
|
3
|
-
import { ComponentSchemas } from "../../../component-schemas.js";
|
|
4
|
-
import { ArchetypeComponents, Database } from "../../../index.js";
|
|
5
|
-
import { ResourceSchemas } from "../../../resource-schemas.js";
|
|
6
|
-
import { ActionDeclarations, ToActionFunctions } from "../../../store/action-functions.js";
|
|
7
|
-
import { SystemFunctions } from "../world-schema.js";
|
|
8
|
-
export declare function create<C extends ComponentSchemas, R extends ResourceSchemas, A extends ArchetypeComponents<StringKeyof<C>>, T extends ActionDeclarations<FromSchemas<C>, FromSchemas<R>, A>, S extends string>(schema: Database.Schema<C, R, A, T>, systems: {
|
|
9
|
-
readonly [K in S]: {
|
|
10
|
-
readonly name: K;
|
|
11
|
-
};
|
|
12
|
-
}, createFn: (db: Database<FromSchemas<C>, FromSchemas<R>, A, ToActionFunctions<T>>) => SystemFunctions<S>): WorldSchema<C, R, A, T, S>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function create(schema, systems, createFn) {
|
|
2
|
-
return {
|
|
3
|
-
components: schema.components,
|
|
4
|
-
resources: schema.resources,
|
|
5
|
-
archetypes: schema.archetypes,
|
|
6
|
-
transactions: schema.transactions,
|
|
7
|
-
systems: systems,
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../src/ecs/world/world-schema/public/create.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,MAAM,CAOlB,MAAmC,EACnC,OAAoD,EACpD,QAAuG;IAEvG,OAAO;QACH,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,OAAO,EAAE,OAAc;KACoB,CAAC;AACpD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Vec3 } from "../../../../math/index.js";
|
|
2
|
-
import { Time } from "../../../../schema/index.js";
|
|
3
|
-
import { Database } from "../../../index.js";
|
|
4
|
-
import { create } from "./create.js";
|
|
5
|
-
import { describe, expect, it } from "vitest";
|
|
6
|
-
describe("create", () => {
|
|
7
|
-
it("should create a system factory", () => {
|
|
8
|
-
const graphics = create(Database.Schema.create({
|
|
9
|
-
components: {
|
|
10
|
-
position: Vec3.schema,
|
|
11
|
-
velocity: Vec3.schema,
|
|
12
|
-
},
|
|
13
|
-
resources: {
|
|
14
|
-
time: Time.schema,
|
|
15
|
-
},
|
|
16
|
-
archetypes: {
|
|
17
|
-
Position: ["position"],
|
|
18
|
-
},
|
|
19
|
-
transactions: {
|
|
20
|
-
createPosition(store) {
|
|
21
|
-
return store.archetypes.Position.insert({
|
|
22
|
-
position: [1, 2, 3],
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}), {
|
|
27
|
-
update: { name: "update" },
|
|
28
|
-
render: { name: "render" },
|
|
29
|
-
}, (db) => ({
|
|
30
|
-
update: () => {
|
|
31
|
-
},
|
|
32
|
-
render: () => {
|
|
33
|
-
},
|
|
34
|
-
}));
|
|
35
|
-
expect(graphics.components).toBeDefined();
|
|
36
|
-
expect(graphics.systems).toBeDefined();
|
|
37
|
-
expect(graphics.systems.render.name).toBe("render");
|
|
38
|
-
expect(graphics.systems.update.name).toBe("update");
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=create.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.test.js","sourceRoot":"","sources":["../../../../../src/ecs/world/world-schema/public/create.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,MAAM,QAAQ,GAAG,MAAM,CACnB,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YACnB,UAAU,EAAE;gBACR,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,QAAQ,EAAE,IAAI,CAAC,MAAM;aACxB;YACD,SAAS,EAAE;gBACP,IAAI,EAAE,IAAI,CAAC,MAAM;aACpB;YACD,UAAU,EAAE;gBACR,QAAQ,EAAE,CAAC,UAAU,CAAC;aACzB;YACD,YAAY,EAAE;gBACV,cAAc,CAAC,KAAK;oBAChB,OAAO,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;wBACpC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;qBACtB,CAAC,CAAC;gBACP,CAAC;aACJ;SACJ,CAAC,EACF;YACI,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC7B,EACD,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACL,MAAM,EAAE,GAAG,EAAE;YACb,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;YACb,CAAC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