@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,73 +0,0 @@
|
|
|
1
|
-
import { describe, test } from "vitest";
|
|
2
|
-
/**
|
|
3
|
-
* Proof of Concept: Separate systems parameter for better type inference
|
|
4
|
-
*/
|
|
5
|
-
// Simulated improved API signature
|
|
6
|
-
function createPluginWithSeparateSystems(plugin, systems) {
|
|
7
|
-
return {
|
|
8
|
-
components: plugin.components,
|
|
9
|
-
resources: plugin.resources,
|
|
10
|
-
archetypes: plugin.archetypes ?? {},
|
|
11
|
-
transactions: plugin.transactions ?? {},
|
|
12
|
-
systems
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
describe("Type Inference POC - Separate Systems Parameter", () => {
|
|
16
|
-
test("should infer db type automatically in system create functions", () => {
|
|
17
|
-
// First parameter: define data shape
|
|
18
|
-
const basePlugin = {
|
|
19
|
-
components: {
|
|
20
|
-
position: { type: "object", default: { x: 0, y: 0 } }
|
|
21
|
-
},
|
|
22
|
-
resources: {
|
|
23
|
-
time: { default: 0 }
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
// Second parameter: define systems
|
|
27
|
-
// TypeScript should now be able to infer the db type!
|
|
28
|
-
const plugin = createPluginWithSeparateSystems(basePlugin, {
|
|
29
|
-
testSystem: {
|
|
30
|
-
create: (db) => () => {
|
|
31
|
-
// Test if db is properly typed (no errors = success!)
|
|
32
|
-
const entities = db.select(["position"]);
|
|
33
|
-
const time = db.resources.time;
|
|
34
|
-
const pos = db.get(1, "position");
|
|
35
|
-
// These should all work without explicit typing!
|
|
36
|
-
console.log(entities, time, pos);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
// Verify the plugin was created
|
|
41
|
-
console.log("Plugin created with inferred types:", plugin);
|
|
42
|
-
});
|
|
43
|
-
test("should work with multiple systems", () => {
|
|
44
|
-
const plugin = createPluginWithSeparateSystems({
|
|
45
|
-
components: {
|
|
46
|
-
position: { type: "object", default: { x: 0, y: 0 } },
|
|
47
|
-
velocity: { type: "object", default: { x: 0, y: 0 } }
|
|
48
|
-
},
|
|
49
|
-
resources: {
|
|
50
|
-
deltaTime: { default: 0 }
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
physicsSystem: {
|
|
54
|
-
create: (db) => () => {
|
|
55
|
-
const entities = db.select(["position", "velocity"]);
|
|
56
|
-
const dt = db.resources.deltaTime;
|
|
57
|
-
console.log(entities, dt);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
renderSystem: {
|
|
61
|
-
create: (db) => () => {
|
|
62
|
-
const entities = db.select(["position"]);
|
|
63
|
-
console.log(entities);
|
|
64
|
-
},
|
|
65
|
-
schedule: {
|
|
66
|
-
after: ["physicsSystem"]
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
console.log("Multi-system plugin:", plugin);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=type-inference-poc.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-inference-poc.test.js","sourceRoot":"","sources":["../../../src/ecs/database/type-inference-poc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAIxC;;GAEG;AAEH,mCAAmC;AACnC,SAAS,+BAA+B,CAatC,MAKC,EACD,OAAY;IAEZ,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,S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|
|
1
|
-
import { Database } from "../../database/database.js";
|
|
2
|
-
type SchedulerState = "running" | "paused" | "disposed";
|
|
3
|
-
export declare const createSchedulerPlugin: () => Required<Database.Plugin<import("../../component-schemas.js").ComponentSchemas, {
|
|
4
|
-
readonly schedulerState: {
|
|
5
|
-
readonly default: SchedulerState;
|
|
6
|
-
};
|
|
7
|
-
}, any, import("../../store/action-functions.js").ActionDeclarations<any, any, any>, "schedulerSystem">>;
|
|
8
|
-
export {};
|
|
@@ -1,54 +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 { Database } from "../../database/database.js";
|
|
23
|
-
export const createSchedulerPlugin = () => {
|
|
24
|
-
return Database.Plugin.create({
|
|
25
|
-
resources: {
|
|
26
|
-
schedulerState: { default: "running" }
|
|
27
|
-
},
|
|
28
|
-
systems: {
|
|
29
|
-
schedulerSystem: {
|
|
30
|
-
create: (db) => {
|
|
31
|
-
// Execute one frame
|
|
32
|
-
const executeFrame = async () => {
|
|
33
|
-
if (db.resources.schedulerState === "running") {
|
|
34
|
-
// Execute all systems in order (excluding schedulerSystem itself)
|
|
35
|
-
for (const tier of db.system.order) {
|
|
36
|
-
// Execute tier in parallel
|
|
37
|
-
await Promise.all(tier.map((name) => db.system.functions[name]()));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (db.resources.schedulerState !== "disposed") {
|
|
41
|
-
requestAnimationFrame(executeFrame);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
executeFrame();
|
|
45
|
-
// Return a no-op system function (the real work happens in the RAF loop)
|
|
46
|
-
return () => {
|
|
47
|
-
// No-op: The scheduler manages its own execution through RAF
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=create-scheduler-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-scheduler-plugin.js","sourceRoot":"","sources":["../../../../src/ecs/plugins/scheduler/create-scheduler-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACtC,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QAC1B,SAAS,EAAE;YACP,cAAc,EAAE,EAAE,OAAO,EAAE,SAA2B,EAAE;SAC3D;QACD,OAAO,EAAE;YACL,eAAe,EAAE;gBACb,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE;oBACX,oBAAoB;oBACpB,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;wBAC5B,IAAI,EAAE,CAAC,SAAS,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;4BAC5C,kEAAkE;4BAClE,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gCACjC,2BAA2B;gCAC3B,MAAM,OAAO,CAAC,GAAG,CACb,IAAI,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAC1D,CAAC;4BACN,CAAC;wBACL,CAAC;wBAED,IAAI,EAAE,CAAC,SAAS,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;4BAC7C,qBAAqB,CAAC,YAAY,CAAC,CAAC;wBACxC,CAAC;oBACL,CAAC,CAAC;oBAEF,YAAY,EAAE,CAAC;oBAEf,yEAAyE;oBACzE,OAAO,GAAG,EAAE;wBACR,6DAA6D;oBACjE,CAAC,CAAC;gBACN,CAAC;aACJ;SACJ;KACJ,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { Database } from "../../database/database.js";
|
|
3
|
-
import { createSchedulerPlugin } from "./create-scheduler-plugin.js";
|
|
4
|
-
describe("createSchedulerPlugin", () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
vi.useFakeTimers();
|
|
7
|
-
});
|
|
8
|
-
afterEach(() => {
|
|
9
|
-
vi.restoreAllMocks();
|
|
10
|
-
vi.useRealTimers();
|
|
11
|
-
});
|
|
12
|
-
it("should create scheduler plugin with timing resources", () => {
|
|
13
|
-
const plugin = createSchedulerPlugin();
|
|
14
|
-
expect(plugin.resources).toHaveProperty("scheduler");
|
|
15
|
-
expect(plugin.resources).toHaveProperty("deltaTime");
|
|
16
|
-
expect(plugin.resources).toHaveProperty("elapsedTime");
|
|
17
|
-
expect(plugin.resources).toHaveProperty("frame");
|
|
18
|
-
expect(plugin.systems).toHaveProperty("schedulerSystem");
|
|
19
|
-
});
|
|
20
|
-
it("should initialize with scheduler control interface", () => {
|
|
21
|
-
const plugin = createSchedulerPlugin();
|
|
22
|
-
const db = Database.create(plugin);
|
|
23
|
-
expect(db.resources.scheduler).toBeDefined();
|
|
24
|
-
expect(db.resources.scheduler.start).toBeInstanceOf(Function);
|
|
25
|
-
expect(db.resources.scheduler.stop).toBeInstanceOf(Function);
|
|
26
|
-
expect(db.resources.scheduler.pause).toBeInstanceOf(Function);
|
|
27
|
-
expect(db.resources.scheduler.resume).toBeInstanceOf(Function);
|
|
28
|
-
expect(db.resources.scheduler.step).toBeInstanceOf(Function);
|
|
29
|
-
expect(db.resources.scheduler.isRunning).toBe(false);
|
|
30
|
-
expect(db.resources.scheduler.isPaused).toBe(false);
|
|
31
|
-
});
|
|
32
|
-
it("should auto-start when autoStart option is true", () => {
|
|
33
|
-
const plugin = createSchedulerPlugin({ autoStart: true });
|
|
34
|
-
const db = Database.create(plugin);
|
|
35
|
-
expect(db.resources.scheduler.isRunning).toBe(true);
|
|
36
|
-
expect(db.resources.scheduler.isPaused).toBe(false);
|
|
37
|
-
db.resources.scheduler.stop();
|
|
38
|
-
});
|
|
39
|
-
it("should start and stop scheduler", () => {
|
|
40
|
-
const plugin = createSchedulerPlugin();
|
|
41
|
-
const db = Database.create(plugin);
|
|
42
|
-
expect(db.resources.scheduler.isRunning).toBe(false);
|
|
43
|
-
db.resources.scheduler.start();
|
|
44
|
-
expect(db.resources.scheduler.isRunning).toBe(true);
|
|
45
|
-
db.resources.scheduler.stop();
|
|
46
|
-
expect(db.resources.scheduler.isRunning).toBe(false);
|
|
47
|
-
});
|
|
48
|
-
it("should pause and resume scheduler", () => {
|
|
49
|
-
const plugin = createSchedulerPlugin();
|
|
50
|
-
const db = Database.create(plugin);
|
|
51
|
-
db.resources.scheduler.start();
|
|
52
|
-
expect(db.resources.scheduler.isPaused).toBe(false);
|
|
53
|
-
db.resources.scheduler.pause();
|
|
54
|
-
expect(db.resources.scheduler.isPaused).toBe(true);
|
|
55
|
-
expect(db.resources.scheduler.isRunning).toBe(true);
|
|
56
|
-
db.resources.scheduler.resume();
|
|
57
|
-
expect(db.resources.scheduler.isPaused).toBe(false);
|
|
58
|
-
db.resources.scheduler.stop();
|
|
59
|
-
});
|
|
60
|
-
it("should execute systems in order", async () => {
|
|
61
|
-
const executionLog = [];
|
|
62
|
-
const gamePlugin = Database.Plugin.create({
|
|
63
|
-
components: {},
|
|
64
|
-
systems: {
|
|
65
|
-
system1: {
|
|
66
|
-
create: (_db) => () => {
|
|
67
|
-
executionLog.push("system1");
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
system2: {
|
|
71
|
-
create: (_db) => () => {
|
|
72
|
-
executionLog.push("system2");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const db = Database.create(Database.Plugin.create({}, [gamePlugin, createSchedulerPlugin()]));
|
|
78
|
-
await db.resources.scheduler.step();
|
|
79
|
-
expect(executionLog).toContain("system1");
|
|
80
|
-
expect(executionLog).toContain("system2");
|
|
81
|
-
});
|
|
82
|
-
it("should update timing resources each frame", async () => {
|
|
83
|
-
const plugin = createSchedulerPlugin();
|
|
84
|
-
const db = Database.create(plugin);
|
|
85
|
-
expect(db.resources.deltaTime).toBe(0);
|
|
86
|
-
expect(db.resources.elapsedTime).toBe(0);
|
|
87
|
-
expect(db.resources.frame).toBe(0);
|
|
88
|
-
vi.setSystemTime(1000);
|
|
89
|
-
await db.resources.scheduler.step();
|
|
90
|
-
expect(db.resources.frame).toBe(0);
|
|
91
|
-
expect(db.resources.deltaTime).toBeGreaterThan(0);
|
|
92
|
-
expect(db.resources.elapsedTime).toBeGreaterThan(0);
|
|
93
|
-
vi.advanceTimersByTime(16);
|
|
94
|
-
await db.resources.scheduler.step();
|
|
95
|
-
expect(db.resources.frame).toBe(1);
|
|
96
|
-
});
|
|
97
|
-
it("should handle async systems", async () => {
|
|
98
|
-
const executionLog = [];
|
|
99
|
-
const gamePlugin = Database.Plugin.create({
|
|
100
|
-
components: {},
|
|
101
|
-
systems: {
|
|
102
|
-
asyncSystem: {
|
|
103
|
-
create: (_db) => async () => {
|
|
104
|
-
await Promise.resolve();
|
|
105
|
-
executionLog.push("async");
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const db = Database.create(Database.Plugin.create({}, [gamePlugin, createSchedulerPlugin()]));
|
|
111
|
-
await db.resources.scheduler.step();
|
|
112
|
-
expect(executionLog).toContain("async");
|
|
113
|
-
});
|
|
114
|
-
it("should respect system scheduling order", async () => {
|
|
115
|
-
const executionLog = [];
|
|
116
|
-
const gamePlugin = Database.Plugin.create({
|
|
117
|
-
components: {},
|
|
118
|
-
systems: {
|
|
119
|
-
inputSystem: {
|
|
120
|
-
create: (_db) => () => {
|
|
121
|
-
executionLog.push("input");
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
physicsSystem: {
|
|
125
|
-
create: (_db) => () => {
|
|
126
|
-
executionLog.push("physics");
|
|
127
|
-
},
|
|
128
|
-
schedule: {
|
|
129
|
-
after: ["inputSystem"]
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
renderSystem: {
|
|
133
|
-
create: (_db) => () => {
|
|
134
|
-
executionLog.push("render");
|
|
135
|
-
},
|
|
136
|
-
schedule: {
|
|
137
|
-
after: ["physicsSystem"]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
const db = Database.create(Database.Plugin.create({}, [gamePlugin, createSchedulerPlugin()]));
|
|
143
|
-
await db.resources.scheduler.step();
|
|
144
|
-
expect(executionLog).toEqual(["input", "physics", "render"]);
|
|
145
|
-
});
|
|
146
|
-
it("should filter out schedulerSystem from execution", async () => {
|
|
147
|
-
const executionLog = [];
|
|
148
|
-
const gamePlugin = Database.Plugin.create({
|
|
149
|
-
components: {},
|
|
150
|
-
systems: {
|
|
151
|
-
testSystem: {
|
|
152
|
-
create: (db) => () => {
|
|
153
|
-
// Log all systems being executed
|
|
154
|
-
for (const tier of db.system.order) {
|
|
155
|
-
executionLog.push(...tier);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
const plugin = createSchedulerPlugin();
|
|
162
|
-
const db = Database.create(Database.Plugin.create({}, [gamePlugin, plugin]));
|
|
163
|
-
await db.resources.scheduler.step();
|
|
164
|
-
// schedulerSystem should be in the order but not executed recursively
|
|
165
|
-
const allSystems = db.system.order.flat();
|
|
166
|
-
expect(allSystems).toContain("schedulerSystem");
|
|
167
|
-
});
|
|
168
|
-
it("should track frame count", async () => {
|
|
169
|
-
const plugin = createSchedulerPlugin();
|
|
170
|
-
const db = Database.create(plugin);
|
|
171
|
-
expect(db.resources.scheduler.frameCount).toBe(0);
|
|
172
|
-
await db.resources.scheduler.step();
|
|
173
|
-
expect(db.resources.scheduler.frameCount).toBe(1);
|
|
174
|
-
await db.resources.scheduler.step();
|
|
175
|
-
expect(db.resources.scheduler.frameCount).toBe(2);
|
|
176
|
-
});
|
|
177
|
-
it("should allow systems to access database", async () => {
|
|
178
|
-
let accessedDeltaTime = 0;
|
|
179
|
-
const gamePlugin = Database.Plugin.create({
|
|
180
|
-
components: {
|
|
181
|
-
position: { type: "object", default: { x: 0, y: 0 } }
|
|
182
|
-
},
|
|
183
|
-
systems: {
|
|
184
|
-
testSystem: {
|
|
185
|
-
create: (db) => () => {
|
|
186
|
-
accessedDeltaTime = db.resources.deltaTime;
|
|
187
|
-
const entities = db.select(["position"]);
|
|
188
|
-
expect(Array.isArray(entities)).toBe(true);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
const db = Database.create(Database.Plugin.create({}, [gamePlugin, createSchedulerPlugin()]));
|
|
194
|
-
await db.resources.scheduler.step();
|
|
195
|
-
expect(accessedDeltaTime).toBeGreaterThanOrEqual(0);
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
//# sourceMappingURL=create-scheduler-plugin.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-scheduler-plugin.test.js","sourceRoot":"","sources":["../../../../src/ecs/plugins/scheduler/create-scheduler-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,UAAU,CAAC,GAAG,EAAE;QACZ,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,EAAE,CAAC,eAAe,EAAE,CAAC;QACrB,EAAE,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC5D,MAAM,MAAM,GAAG,qBAAqB,EAAE,CAAC;QAEvC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QACvD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,cA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IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;aACxD;YACD,OAAO,EAAE;gBACL,UAAU,EAAE;oBACR,MAAM,EAAE,CAAC,EAAO,EAAE,EAAE,CAAC,GAAG,EAAE;wBACtB,iBAAiB,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC;wBAC3C,MAAM,QAAQ,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;wBACzC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC/C,CAAC;iBACJ;aACJ;SACJ,CAAC,CAAC;QAEH,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,UAAU,EAAE,qBAAqB,EAAE,CAAC,CAAQ,CACpE,CAAC;QAET,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAEpC,MAAM,CAAC,iBAAiB,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-inference-test.js","sourceRoot":"","sources":["../../../../src/ecs/plugins/scheduler/type-inference-test.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Entity } from "../entity.js";
|
|
2
|
-
/**
|
|
3
|
-
* EntityFunctions are ecs functions that usually modify the store or database and may return a single entity id or void.
|
|
4
|
-
*/
|
|
5
|
-
export type EntityFunctions = {
|
|
6
|
-
readonly [K: string]: (...args: any[]) => Entity | void;
|
|
7
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-functions.js","sourceRoot":"","sources":["../../../src/ecs/store/entity-functions.ts"],"names":[],"mappings":""}
|
package/ecs/store/functions.d.ts
DELETED
package/ecs/store/functions.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/ecs/store/functions.ts"],"names":[],"mappings":""}
|
|
@@ -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/system/system-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW"}
|
|
@@ -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-declarations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system-declarations.js","sourceRoot":"","sources":["../../../src/ecs/system/system-declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW"}
|
|
@@ -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 { SystemDeclarations, SystemFunctions } from "../system-factory.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 copy.js","sourceRoot":"","sources":["../../../../../src/ecs/system/system-factory/public/create copy.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,MAAM,CAOlB,MAAmC,EACnC,OAA8B,EAC9B,MAAqG;IAErG,OAAO;QACH,MAAM;QACN,OAAO;QACP,MAAM;KACuC,CAAC;AACtD,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 { SystemDeclarations, SystemFunctions } from "../system-factory.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/system/system-factory/public/create.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,MAAM,CAOlB,MAAmC,EACnC,OAA8B,EAC9B,MAAqG;IAErG,OAAO;QACH,MAAM;QACN,OAAO;QACP,MAAM;KACuC,CAAC;AACtD,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/system/system-factory/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;SACJ,CAAC,CACL,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QACtC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAEtC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./create.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ecs/system/system-factory/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 SystemFactory 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 SystemFactory<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
|
-
}
|