@awesome-ecs/abstract 0.21.0 → 0.21.1

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.
Files changed (59) hide show
  1. package/dist/components/index.cjs +10 -32
  2. package/dist/components/index.cjs.map +1 -1
  3. package/dist/components/index.d.cts +3 -2
  4. package/dist/components/index.d.ts +3 -2
  5. package/dist/components/index.js +11 -8
  6. package/dist/components/index.js.map +1 -1
  7. package/dist/entities/index.cjs +11 -33
  8. package/dist/entities/index.cjs.map +1 -1
  9. package/dist/entities/index.d.cts +4 -34
  10. package/dist/entities/index.d.ts +4 -34
  11. package/dist/entities/index.js +12 -9
  12. package/dist/entities/index.js.map +1 -1
  13. package/dist/factories/index.cjs +0 -18
  14. package/dist/factories/index.d.cts +44 -42
  15. package/dist/factories/index.d.ts +44 -42
  16. package/dist/factories/index.js +0 -1
  17. package/dist/identity-component-BDWEtAXA.d.cts +238 -0
  18. package/dist/identity-component-CR1ULadR.d.ts +238 -0
  19. package/dist/index-C3UGZqUG.d.ts +288 -0
  20. package/dist/index-CKh4A7mH.d.cts +460 -0
  21. package/dist/index-ChV4Q5j6.d.cts +137 -0
  22. package/dist/index-Cm-YSPhK.d.ts +254 -0
  23. package/dist/index-D81Fo9XN.d.cts +254 -0
  24. package/dist/index-DLm-DKAk.d.cts +288 -0
  25. package/dist/index-oenqxDCa.d.ts +137 -0
  26. package/dist/index-zpj0YApu.d.ts +460 -0
  27. package/dist/pipelines/index.cjs +28 -35
  28. package/dist/pipelines/index.cjs.map +1 -1
  29. package/dist/pipelines/index.d.cts +4 -89
  30. package/dist/pipelines/index.d.ts +4 -89
  31. package/dist/pipelines/index.js +29 -11
  32. package/dist/pipelines/index.js.map +1 -1
  33. package/dist/systems/index.cjs +31 -35
  34. package/dist/systems/index.cjs.map +1 -1
  35. package/dist/systems/index.d.cts +7 -114
  36. package/dist/systems/index.d.ts +7 -114
  37. package/dist/systems/index.js +32 -11
  38. package/dist/systems/index.js.map +1 -1
  39. package/dist/{types-cZ-1lGPD.d.ts → types-DvzdpbLu.d.cts} +9 -17
  40. package/dist/{types-cZ-1lGPD.d.cts → types-yh4pOGEm.d.ts} +9 -17
  41. package/dist/utils/index.cjs +25 -35
  42. package/dist/utils/index.cjs.map +1 -1
  43. package/dist/utils/index.d.cts +3 -92
  44. package/dist/utils/index.d.ts +3 -92
  45. package/dist/utils/index.js +26 -11
  46. package/dist/utils/index.js.map +1 -1
  47. package/package.json +3 -3
  48. package/dist/entity-repository-BlSpo-x2.d.ts +0 -253
  49. package/dist/entity-repository-DJ1xbvaN.d.cts +0 -253
  50. package/dist/factories/index.cjs.map +0 -1
  51. package/dist/factories/index.js.map +0 -1
  52. package/dist/index-B1KXekZD.d.ts +0 -199
  53. package/dist/index-CnlpX7ys.d.cts +0 -199
  54. package/dist/performance-timer-BVyl0SRs.d.cts +0 -45
  55. package/dist/performance-timer-BVyl0SRs.d.ts +0 -45
  56. package/dist/pipeline-9bVMwJKD.d.ts +0 -161
  57. package/dist/pipeline-CzwetuCd.d.cts +0 -161
  58. package/dist/systems-runtime-context-Bz9hIdKT.d.cts +0 -330
  59. package/dist/systems-runtime-context-C_Tsvoym.d.ts +0 -330
@@ -1,89 +1,4 @@
1
- import { I as IPipelineContext, b as IMiddleware, P as PipelineResult, a as IPipeline } from '../pipeline-9bVMwJKD.js';
2
- export { c as PipelineRuntime, d as PipelineStatus } from '../pipeline-9bVMwJKD.js';
3
- import '../types-cZ-1lGPD.js';
4
- import '../performance-timer-BVyl0SRs.js';
5
-
6
- /**
7
- * The `IMiddlewareRunner` interface allows for custom logic when running an {@link IMiddleware} method.
8
- * It's useful for implementing different `Decorators` to compose extensible runtime logic.
9
- *
10
- * @template TContext The type of the context that will be passed to the middleware methods.
11
- */
12
- interface IMiddlewareRunner<TContext extends IPipelineContext> {
13
- /**
14
- * The `dispatch` method decides how to run the {@link IMiddleware.action} method on the provided {@link IMiddleware} instance.
15
- *
16
- * @param context The {@link IPipelineContext} passed to the Middleware's {@link IMiddleware.action} method.
17
- * @param middleware The {@link IMiddleware} to call the {@link IMiddleware.action} method on.
18
- * @returns A {@link MiddlewareResult} indicating the outcome of the middleware's action.
19
- */
20
- dispatch(context: TContext, middleware: IMiddleware<TContext>): void | PipelineResult;
21
- /**
22
- * The `cleanup` method decides how to run the {@link IMiddleware.cleanup} method on the provided {@link IMiddleware} instance.
23
- *
24
- * @param context The {@link IPipelineContext} passed to the Middleware's {@link IMiddleware.cleanup} method.
25
- * @param middleware The {@link IMiddleware} to call the {@link IMiddleware.cleanup} method on.
26
- * @returns A {@link MiddlewareResult} indicating the outcome of the middleware's cleanup.
27
- */
28
- cleanup(context: TContext, middleware: IMiddleware<TContext>): void | PipelineResult;
29
- }
30
-
31
- /**
32
- * A context that is passed to a parent pipeline in a nested setup.
33
- *
34
- * @template N - The context type of the nested pipeline.
35
- */
36
- interface IParentContext<N extends IPipelineContext> extends IPipelineContext {
37
- readonly nestedPipeline: IPipeline<INestedContext<this>>;
38
- readonly nestedContexts: Partial<N>[];
39
- }
40
- /**
41
- * A context that is passed to a nested pipeline.
42
- *
43
- * @template P - The context type of the parent pipeline.
44
- */
45
- interface INestedContext<P extends IParentContext<any>> extends IPipelineContext {
46
- readonly current: P extends IParentContext<infer N> ? N : never;
47
- readonly previous?: P extends IParentContext<infer N> ? N : never;
48
- readonly parent: P;
49
- }
50
- /**
51
- * A middleware that is ran as part of a nested pipeline.
52
- *
53
- * @template P - The context type of the parent pipeline.
54
- */
55
- type INestedMiddleware<P extends IParentContext<any>> = IMiddleware<INestedContext<P>>;
56
- /**
57
- * A middleware that is ran as part of a parent pipeline.
58
- *
59
- * @template P - The context type of the parent pipeline.
60
- */
61
- type IParentMiddleware<P extends IParentContext<any>> = IMiddleware<P>;
62
-
63
- /**
64
- * The `Pipeline Runner` allows for custom logic when running an {@link IMiddleware} Array.
65
- * It's useful for implementing different `Decorators` to compose extensible runtime logic.
66
- */
67
- interface IPipelineRunner<TContext extends IPipelineContext> {
68
- /**
69
- * The {@link dispatch} method will decide how to run the {@link IMiddleware.action} method on the provided {@link IMiddleware} instances, starting with the provided {@link startIndex} (optional).
70
- *
71
- * @param context - The {@link IPipelineContext} passed to the Middleware's {@link IMiddleware.action} method.
72
- * @param middleware - The {@link IMiddleware} Array to call the {@link IMiddleware.action} methods on.
73
- * @param startIndex - (optional) the Start Index to run in the Middleware Array.
74
- *
75
- * @returns A {@link PipelineResult} indicating the success or failure of the operation.
76
- */
77
- dispatch(context: Partial<TContext>, middleware: IMiddleware<TContext>[], startIndex?: number): PipelineResult;
78
- /**
79
- * The {@link cleanup} method will decide how to run the {@link IMiddleware.cleanup} method on the provided {@link IMiddleware} instances.
80
- *
81
- * @param context - The {@link IPipelineContext} passed to the Middleware's {@link IMiddleware.cleanup} method.
82
- * @param middleware - The {@link IMiddleware} Array to call the {@link IMiddleware.cleanup} methods on.
83
- *
84
- * @returns A {@link PipelineResult} indicating the success or failure of the operation.
85
- */
86
- cleanup(context: Partial<TContext>, middleware: IMiddleware<TContext>[]): PipelineResult;
87
- }
88
-
89
- export { IMiddleware, type IMiddlewareRunner, type INestedContext, type INestedMiddleware, type IParentContext, type IParentMiddleware, IPipeline, IPipelineContext, type IPipelineRunner, PipelineResult };
1
+ import "../types-yh4pOGEm.js";
2
+ import { IMiddleware, IMiddlewareRunner, INestedContext, INestedMiddleware, IParentContext, IParentMiddleware, IPipeline, IPipelineContext, IPipelineRunner, PipelineResult, PipelineRuntime, PipelineStatus } from "../index-Cm-YSPhK.js";
3
+ import "../index-oenqxDCa.js";
4
+ export { IMiddleware, IMiddlewareRunner, INestedContext, INestedMiddleware, IParentContext, IParentMiddleware, IPipeline, IPipelineContext, IPipelineRunner, PipelineResult, PipelineRuntime, PipelineStatus };
@@ -1,12 +1,30 @@
1
- // src/pipelines/pipeline-status.ts
2
- var PipelineStatus = /* @__PURE__ */ ((PipelineStatus2) => {
3
- PipelineStatus2["idle"] = "idle";
4
- PipelineStatus2["ongoing"] = "ongoing";
5
- PipelineStatus2["completed"] = "completed";
6
- PipelineStatus2["halted"] = "halted";
7
- return PipelineStatus2;
8
- })(PipelineStatus || {});
9
- export {
10
- PipelineStatus
11
- };
1
+ //#region src/pipelines/pipeline-status.ts
2
+ /**
3
+ * The PipelineStatus enum represents the different states a pipeline can be in.
4
+ *
5
+ * @remarks
6
+ * This enum is used to track the current status of the pipeline.
7
+ */
8
+ let PipelineStatus = /* @__PURE__ */ function(PipelineStatus$1) {
9
+ /**
10
+ * The pipeline is currently idle and not processing any tasks.
11
+ */
12
+ PipelineStatus$1["idle"] = "idle";
13
+ /**
14
+ * The pipeline is currently processing tasks.
15
+ */
16
+ PipelineStatus$1["ongoing"] = "ongoing";
17
+ /**
18
+ * The pipeline has completed all tasks successfully.
19
+ */
20
+ PipelineStatus$1["completed"] = "completed";
21
+ /**
22
+ * The pipeline has been halted due to an error or middleware intervention.
23
+ */
24
+ PipelineStatus$1["halted"] = "halted";
25
+ return PipelineStatus$1;
26
+ }({});
27
+
28
+ //#endregion
29
+ export { PipelineStatus };
12
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pipelines/pipeline-status.ts"],"sourcesContent":["/**\n * The PipelineStatus enum represents the different states a pipeline can be in.\n *\n * @remarks\n * This enum is used to track the current status of the pipeline.\n */\nexport enum PipelineStatus {\n /**\n * The pipeline is currently idle and not processing any tasks.\n */\n idle = 'idle',\n\n /**\n * The pipeline is currently processing tasks.\n */\n ongoing = 'ongoing',\n\n /**\n * The pipeline has completed all tasks successfully.\n */\n completed = 'completed',\n\n /**\n * The pipeline has been halted due to an error or middleware intervention.\n */\n halted = 'halted'\n}\n"],"mappings":";AAMO,IAAK,iBAAL,kBAAKA,oBAAL;AAIL,EAAAA,gBAAA,UAAO;AAKP,EAAAA,gBAAA,aAAU;AAKV,EAAAA,gBAAA,eAAY;AAKZ,EAAAA,gBAAA,YAAS;AAnBC,SAAAA;AAAA,GAAA;","names":["PipelineStatus"]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/pipelines/pipeline-status.ts"],"sourcesContent":["/**\n * The PipelineStatus enum represents the different states a pipeline can be in.\n *\n * @remarks\n * This enum is used to track the current status of the pipeline.\n */\nexport enum PipelineStatus {\n /**\n * The pipeline is currently idle and not processing any tasks.\n */\n idle = 'idle',\n\n /**\n * The pipeline is currently processing tasks.\n */\n ongoing = 'ongoing',\n\n /**\n * The pipeline has completed all tasks successfully.\n */\n completed = 'completed',\n\n /**\n * The pipeline has been halted due to an error or middleware intervention.\n */\n halted = 'halted'\n}\n"],"mappings":";;;;;;;AAMA,IAAY,4DAAL;;;;AAIL;;;;AAKA;;;;AAKA;;;;AAKA;;AACD"}
@@ -1,38 +1,34 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
1
 
19
- // src/systems/index.ts
20
- var systems_exports = {};
21
- __export(systems_exports, {
22
- SystemType: () => SystemType
23
- });
24
- module.exports = __toCommonJS(systems_exports);
2
+ //#region src/systems/module/system-type.ts
3
+ /**
4
+ * Enum representing the built-in System pipeline types.
5
+ * These types can be extended to introduce more types, and the System Runtime Pipeline should
6
+ * add Middleware to handle the newly added types.
7
+ */
8
+ let SystemType = /* @__PURE__ */ function(SystemType$1) {
9
+ /**
10
+ * The initialization phase of the Module pipeline.
11
+ * This phase is typically used for setting up initial state and resources.
12
+ */
13
+ SystemType$1["initialize"] = "initialize";
14
+ /**
15
+ * The update phase of the Module pipeline.
16
+ * This phase is responsible for updating the game logic and state of entities.
17
+ */
18
+ SystemType$1["update"] = "update";
19
+ /**
20
+ * The render phase of the Module pipeline.
21
+ * This phase is used for rendering the game to the screen.
22
+ */
23
+ SystemType$1["render"] = "render";
24
+ /**
25
+ * The synchronization phase of the Module pipeline.
26
+ * This phase is used for synchronizing game state with external systems or other components.
27
+ */
28
+ SystemType$1["sync"] = "sync";
29
+ return SystemType$1;
30
+ }({});
25
31
 
26
- // src/systems/module/system-type.ts
27
- var SystemType = /* @__PURE__ */ ((SystemType2) => {
28
- SystemType2["initialize"] = "initialize";
29
- SystemType2["update"] = "update";
30
- SystemType2["render"] = "render";
31
- SystemType2["sync"] = "sync";
32
- return SystemType2;
33
- })(SystemType || {});
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- SystemType
37
- });
32
+ //#endregion
33
+ exports.SystemType = SystemType;
38
34
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/systems/index.ts","../../src/systems/module/system-type.ts"],"sourcesContent":["export * from './pipeline/system-context-entity';\nexport * from './pipeline/system-context-events';\nexport * from './pipeline/system-context-proxies';\nexport * from './pipeline/system-context-repository';\nexport * from './pipeline/system-context-scheduler';\nexport * from './pipeline/system-context-snapshot';\nexport * from './runtime/systems-runtime-context';\nexport * from './runtime/systems-runtime-middleware';\nexport * from './pipeline/system-middleware';\nexport * from './pipeline/system-context';\nexport * from './module/system-type';\nexport * from './module/systems-module';\nexport * from './module/systems-module-definition';\nexport * from './module/systems-module-repository';\nexport * from './runtime/systems-runtime';\n","/**\n * Enum representing the built-in System pipeline types.\n * These types can be extended to introduce more types, and the System Runtime Pipeline should\n * add Middleware to handle the newly added types.\n */\nexport enum SystemType {\n /**\n * The initialization phase of the Module pipeline.\n * This phase is typically used for setting up initial state and resources.\n */\n initialize = 'initialize',\n\n /**\n * The update phase of the Module pipeline.\n * This phase is responsible for updating the game logic and state of entities.\n */\n update = 'update',\n\n /**\n * The render phase of the Module pipeline.\n * This phase is used for rendering the game to the screen.\n */\n render = 'render',\n\n /**\n * The synchronization phase of the Module pipeline.\n * This phase is used for synchronizing game state with external systems or other components.\n */\n sync = 'sync'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAK,aAAL,kBAAKA,gBAAL;AAKL,EAAAA,YAAA,gBAAa;AAMb,EAAAA,YAAA,YAAS;AAMT,EAAAA,YAAA,YAAS;AAMT,EAAAA,YAAA,UAAO;AAvBG,SAAAA;AAAA,GAAA;","names":["SystemType"]}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/systems/module/system-type.ts"],"sourcesContent":["/**\n * Enum representing the built-in System pipeline types.\n * These types can be extended to introduce more types, and the System Runtime Pipeline should\n * add Middleware to handle the newly added types.\n */\nexport enum SystemType {\n /**\n * The initialization phase of the Module pipeline.\n * This phase is typically used for setting up initial state and resources.\n */\n initialize = 'initialize',\n\n /**\n * The update phase of the Module pipeline.\n * This phase is responsible for updating the game logic and state of entities.\n */\n update = 'update',\n\n /**\n * The render phase of the Module pipeline.\n * This phase is used for rendering the game to the screen.\n */\n render = 'render',\n\n /**\n * The synchronization phase of the Module pipeline.\n * This phase is used for synchronizing game state with external systems or other components.\n */\n sync = 'sync'\n}\n"],"mappings":";;;;;;;AAKA,IAAY,oDAAL;;;;;AAKL;;;;;AAMA;;;;;AAMA;;;;;AAMA;;AACD"}
@@ -1,114 +1,7 @@
1
- import { I as ISystemsRuntimeContext, a as ISystemContext, S as SystemType } from '../systems-runtime-context-Bz9hIdKT.cjs';
2
- export { b as ISystemContextEntity, c as ISystemContextEvents, d as ISystemContextProxies, e as ISystemContextRepository, f as ISystemContextScheduler, g as ISystemContextSnapshot } from '../systems-runtime-context-Bz9hIdKT.cjs';
3
- import { c as IEntity, E as EntityTypeUid } from '../index-CnlpX7ys.cjs';
4
- import { b as IMiddleware, a as IPipeline, P as PipelineResult } from '../pipeline-CzwetuCd.cjs';
5
- import { I as Immutable } from '../types-cZ-1lGPD.cjs';
6
- import { f as IEntityUpdate } from '../entity-repository-DJ1xbvaN.cjs';
7
- import '../utils/index.cjs';
8
- import '../performance-timer-BVyl0SRs.cjs';
9
-
10
- /**
11
- * The `ISystemsRuntimeMiddleware` represents the building blocks of executing SystemsModule's registered Pipelines.
12
- * It receives the current State in the Context, and can decide which SystemPipelines to execute.
13
- *
14
- * @typeParam TEntity - The type of entity that the middleware operates on.
15
- * @extends {IMiddleware<ISystemsRuntimeContext<TEntity>>} - Extends the base `IMiddleware` interface, which is used for defining middleware functions.
16
- */
17
- type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
18
-
19
- /**
20
- * The `ISystemMiddleware` is a basic System implementation that can be registered as a Middleware in a SystemPipeline.
21
- * It provides a `SystemPipelineContext` to its exposed methods.
22
- *
23
- * @template TEntity - The type of entity that this middleware operates on.
24
- * @extends {IMiddleware<ISystemContext<TEntity>>} - Extends the base `IMiddleware` interface, which requires a `SystemPipelineContext` to be provided.
25
- */
26
- type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
27
-
28
- /**
29
- * The SystemModuleDefinition is the main way of composing SystemsModules for an Entity.
30
- * It can be used as building blocks for SystemsModules as a way to register common SystemMiddlewares and share across different Entities.
31
- */
32
- interface ISystemsModuleDefinition<TEntity extends IEntity> {
33
- readonly systems: Map<SystemType, IPipeline<ISystemContext<TEntity>>>;
34
- /**
35
- * Registers SystemMiddlewares to the specified SystemPipelineType.
36
- *
37
- * @param type - The SystemPipelineType to append the provided SystemMiddlewares to.
38
- * @param systems - The SystemMiddlewares to be registered in the provided SystemPipelineType in the same order as the provided array.
39
- * The SystemMiddlewares will be appended to existing Pipelines to allow easy extension of existing behaviors.
40
- */
41
- registerSystems?(type: SystemType, systems: Immutable<ISystemMiddleware<TEntity>[]>): void;
42
- /**
43
- * Registers the middleware of the provided SystemsModule in the current SystemsModule. Keeps the same system types.
44
- * @param module - The SystemsModule to be registered.
45
- */
46
- registerModule?(module: Immutable<ISystemsModuleDefinition<TEntity>>): void;
47
- }
48
-
49
- /**
50
- * The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
51
- * It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
52
- */
53
- interface ISystemsModule<TEntity extends IEntity> extends ISystemsModuleDefinition<TEntity> {
54
- /**
55
- * Triggers all registered SystemPipelines to apply the changes from the provided EntityUpdate to an Entity instance.
56
- *
57
- * @param update - The EntityUpdate containing the desired changes to be applied on an Entity instance.
58
- * @returns An optional PipelineResult indicating the success or failure of the triggered SystemPipelines.
59
- */
60
- triggerSystems(update: Immutable<IEntityUpdate>): void | PipelineResult;
61
- }
62
-
63
- /**
64
- * Interface for managing systems modules.
65
- *
66
- * @template TEntity - The type of entity that the systems module operates on.
67
- */
68
- interface ISystemsModuleRepository {
69
- /**
70
- * The number of systems modules in the repository.
71
- */
72
- readonly size: number;
73
- /**
74
- * Retrieves a systems module for a specific entity type.
75
- *
76
- * @param type - The unique identifier of the entity type.
77
- * @returns The systems module for the specified entity type.
78
- */
79
- get<TEntity extends IEntity>(type: EntityTypeUid): ISystemsModule<TEntity>;
80
- /**
81
- * Adds or updates a systems module for a specific entity type.
82
- *
83
- * @param type - The unique identifier of the entity type.
84
- * @param module - The systems module to add or update.
85
- */
86
- set(type: EntityTypeUid, module: ISystemsModule<IEntity>): void;
87
- /**
88
- * Retrieves a read-only map of all systems modules in the repository.
89
- *
90
- * @returns A read-only map of entity type unique identifiers to systems modules.
91
- */
92
- list(): ReadonlyMap<EntityTypeUid, Immutable<ISystemsModule<IEntity>>>;
93
- }
94
-
95
- /**
96
- * The System Runtime allows running a loop of Ticks.
97
- *
98
- * Each `runTick` method can process one or more Entity Updates.
99
- *
100
- * We can have multiple implementations of a `SystemsRuntime`, based on the use-case.
101
- * A different implementation can be chosen at runtime, based for example on performance.
102
- */
103
- interface ISystemsRuntime {
104
- /**
105
- * The method should trigger the SystemsModule logic for the provided `IEntityUpdate`.
106
- * If no EntityUpdate is given, the `SystemRuntime` implementation can choose to dequeue one from the `IEntityUpdateQueue`.
107
- *
108
- * @param update - An optional `IEntityUpdate` to process. If not provided, the method will dequeue one from the `IEntityUpdateQueue`.
109
- * @returns A `PipelineResult` representing the outcome of the SystemsModule logic execution.
110
- */
111
- runTick(update?: IEntityUpdate): PipelineResult;
112
- }
113
-
114
- export { ISystemContext, type ISystemMiddleware, type ISystemsModule, type ISystemsModuleDefinition, type ISystemsModuleRepository, type ISystemsRuntime, ISystemsRuntimeContext, type ISystemsRuntimeMiddleware, SystemType };
1
+ import "../identity-component-BDWEtAXA.cjs";
2
+ import "../types-DvzdpbLu.cjs";
3
+ import "../index-DLm-DKAk.cjs";
4
+ import "../index-D81Fo9XN.cjs";
5
+ import "../index-ChV4Q5j6.cjs";
6
+ import { ISystemContext, ISystemContextEntity, ISystemContextEvents, ISystemContextProxies, ISystemContextRepository, ISystemContextScheduler, ISystemContextSnapshot, ISystemMiddleware, ISystemsModule, ISystemsModuleDefinition, ISystemsModuleRepository, ISystemsRuntime, ISystemsRuntimeContext, ISystemsRuntimeMiddleware, SystemType } from "../index-CKh4A7mH.cjs";
7
+ export { ISystemContext, ISystemContextEntity, ISystemContextEvents, ISystemContextProxies, ISystemContextRepository, ISystemContextScheduler, ISystemContextSnapshot, ISystemMiddleware, ISystemsModule, ISystemsModuleDefinition, ISystemsModuleRepository, ISystemsRuntime, ISystemsRuntimeContext, ISystemsRuntimeMiddleware, SystemType };
@@ -1,114 +1,7 @@
1
- import { I as ISystemsRuntimeContext, a as ISystemContext, S as SystemType } from '../systems-runtime-context-C_Tsvoym.js';
2
- export { b as ISystemContextEntity, c as ISystemContextEvents, d as ISystemContextProxies, e as ISystemContextRepository, f as ISystemContextScheduler, g as ISystemContextSnapshot } from '../systems-runtime-context-C_Tsvoym.js';
3
- import { c as IEntity, E as EntityTypeUid } from '../index-B1KXekZD.js';
4
- import { b as IMiddleware, a as IPipeline, P as PipelineResult } from '../pipeline-9bVMwJKD.js';
5
- import { I as Immutable } from '../types-cZ-1lGPD.js';
6
- import { f as IEntityUpdate } from '../entity-repository-BlSpo-x2.js';
7
- import '../utils/index.js';
8
- import '../performance-timer-BVyl0SRs.js';
9
-
10
- /**
11
- * The `ISystemsRuntimeMiddleware` represents the building blocks of executing SystemsModule's registered Pipelines.
12
- * It receives the current State in the Context, and can decide which SystemPipelines to execute.
13
- *
14
- * @typeParam TEntity - The type of entity that the middleware operates on.
15
- * @extends {IMiddleware<ISystemsRuntimeContext<TEntity>>} - Extends the base `IMiddleware` interface, which is used for defining middleware functions.
16
- */
17
- type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
18
-
19
- /**
20
- * The `ISystemMiddleware` is a basic System implementation that can be registered as a Middleware in a SystemPipeline.
21
- * It provides a `SystemPipelineContext` to its exposed methods.
22
- *
23
- * @template TEntity - The type of entity that this middleware operates on.
24
- * @extends {IMiddleware<ISystemContext<TEntity>>} - Extends the base `IMiddleware` interface, which requires a `SystemPipelineContext` to be provided.
25
- */
26
- type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
27
-
28
- /**
29
- * The SystemModuleDefinition is the main way of composing SystemsModules for an Entity.
30
- * It can be used as building blocks for SystemsModules as a way to register common SystemMiddlewares and share across different Entities.
31
- */
32
- interface ISystemsModuleDefinition<TEntity extends IEntity> {
33
- readonly systems: Map<SystemType, IPipeline<ISystemContext<TEntity>>>;
34
- /**
35
- * Registers SystemMiddlewares to the specified SystemPipelineType.
36
- *
37
- * @param type - The SystemPipelineType to append the provided SystemMiddlewares to.
38
- * @param systems - The SystemMiddlewares to be registered in the provided SystemPipelineType in the same order as the provided array.
39
- * The SystemMiddlewares will be appended to existing Pipelines to allow easy extension of existing behaviors.
40
- */
41
- registerSystems?(type: SystemType, systems: Immutable<ISystemMiddleware<TEntity>[]>): void;
42
- /**
43
- * Registers the middleware of the provided SystemsModule in the current SystemsModule. Keeps the same system types.
44
- * @param module - The SystemsModule to be registered.
45
- */
46
- registerModule?(module: Immutable<ISystemsModuleDefinition<TEntity>>): void;
47
- }
48
-
49
- /**
50
- * The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
51
- * It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
52
- */
53
- interface ISystemsModule<TEntity extends IEntity> extends ISystemsModuleDefinition<TEntity> {
54
- /**
55
- * Triggers all registered SystemPipelines to apply the changes from the provided EntityUpdate to an Entity instance.
56
- *
57
- * @param update - The EntityUpdate containing the desired changes to be applied on an Entity instance.
58
- * @returns An optional PipelineResult indicating the success or failure of the triggered SystemPipelines.
59
- */
60
- triggerSystems(update: Immutable<IEntityUpdate>): void | PipelineResult;
61
- }
62
-
63
- /**
64
- * Interface for managing systems modules.
65
- *
66
- * @template TEntity - The type of entity that the systems module operates on.
67
- */
68
- interface ISystemsModuleRepository {
69
- /**
70
- * The number of systems modules in the repository.
71
- */
72
- readonly size: number;
73
- /**
74
- * Retrieves a systems module for a specific entity type.
75
- *
76
- * @param type - The unique identifier of the entity type.
77
- * @returns The systems module for the specified entity type.
78
- */
79
- get<TEntity extends IEntity>(type: EntityTypeUid): ISystemsModule<TEntity>;
80
- /**
81
- * Adds or updates a systems module for a specific entity type.
82
- *
83
- * @param type - The unique identifier of the entity type.
84
- * @param module - The systems module to add or update.
85
- */
86
- set(type: EntityTypeUid, module: ISystemsModule<IEntity>): void;
87
- /**
88
- * Retrieves a read-only map of all systems modules in the repository.
89
- *
90
- * @returns A read-only map of entity type unique identifiers to systems modules.
91
- */
92
- list(): ReadonlyMap<EntityTypeUid, Immutable<ISystemsModule<IEntity>>>;
93
- }
94
-
95
- /**
96
- * The System Runtime allows running a loop of Ticks.
97
- *
98
- * Each `runTick` method can process one or more Entity Updates.
99
- *
100
- * We can have multiple implementations of a `SystemsRuntime`, based on the use-case.
101
- * A different implementation can be chosen at runtime, based for example on performance.
102
- */
103
- interface ISystemsRuntime {
104
- /**
105
- * The method should trigger the SystemsModule logic for the provided `IEntityUpdate`.
106
- * If no EntityUpdate is given, the `SystemRuntime` implementation can choose to dequeue one from the `IEntityUpdateQueue`.
107
- *
108
- * @param update - An optional `IEntityUpdate` to process. If not provided, the method will dequeue one from the `IEntityUpdateQueue`.
109
- * @returns A `PipelineResult` representing the outcome of the SystemsModule logic execution.
110
- */
111
- runTick(update?: IEntityUpdate): PipelineResult;
112
- }
113
-
114
- export { ISystemContext, type ISystemMiddleware, type ISystemsModule, type ISystemsModuleDefinition, type ISystemsModuleRepository, type ISystemsRuntime, ISystemsRuntimeContext, type ISystemsRuntimeMiddleware, SystemType };
1
+ import "../identity-component-CR1ULadR.js";
2
+ import "../types-yh4pOGEm.js";
3
+ import "../index-C3UGZqUG.js";
4
+ import "../index-Cm-YSPhK.js";
5
+ import "../index-oenqxDCa.js";
6
+ import { ISystemContext, ISystemContextEntity, ISystemContextEvents, ISystemContextProxies, ISystemContextRepository, ISystemContextScheduler, ISystemContextSnapshot, ISystemMiddleware, ISystemsModule, ISystemsModuleDefinition, ISystemsModuleRepository, ISystemsRuntime, ISystemsRuntimeContext, ISystemsRuntimeMiddleware, SystemType } from "../index-zpj0YApu.js";
7
+ export { ISystemContext, ISystemContextEntity, ISystemContextEvents, ISystemContextProxies, ISystemContextRepository, ISystemContextScheduler, ISystemContextSnapshot, ISystemMiddleware, ISystemsModule, ISystemsModuleDefinition, ISystemsModuleRepository, ISystemsRuntime, ISystemsRuntimeContext, ISystemsRuntimeMiddleware, SystemType };
@@ -1,12 +1,33 @@
1
- // src/systems/module/system-type.ts
2
- var SystemType = /* @__PURE__ */ ((SystemType2) => {
3
- SystemType2["initialize"] = "initialize";
4
- SystemType2["update"] = "update";
5
- SystemType2["render"] = "render";
6
- SystemType2["sync"] = "sync";
7
- return SystemType2;
8
- })(SystemType || {});
9
- export {
10
- SystemType
11
- };
1
+ //#region src/systems/module/system-type.ts
2
+ /**
3
+ * Enum representing the built-in System pipeline types.
4
+ * These types can be extended to introduce more types, and the System Runtime Pipeline should
5
+ * add Middleware to handle the newly added types.
6
+ */
7
+ let SystemType = /* @__PURE__ */ function(SystemType$1) {
8
+ /**
9
+ * The initialization phase of the Module pipeline.
10
+ * This phase is typically used for setting up initial state and resources.
11
+ */
12
+ SystemType$1["initialize"] = "initialize";
13
+ /**
14
+ * The update phase of the Module pipeline.
15
+ * This phase is responsible for updating the game logic and state of entities.
16
+ */
17
+ SystemType$1["update"] = "update";
18
+ /**
19
+ * The render phase of the Module pipeline.
20
+ * This phase is used for rendering the game to the screen.
21
+ */
22
+ SystemType$1["render"] = "render";
23
+ /**
24
+ * The synchronization phase of the Module pipeline.
25
+ * This phase is used for synchronizing game state with external systems or other components.
26
+ */
27
+ SystemType$1["sync"] = "sync";
28
+ return SystemType$1;
29
+ }({});
30
+
31
+ //#endregion
32
+ export { SystemType };
12
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/systems/module/system-type.ts"],"sourcesContent":["/**\n * Enum representing the built-in System pipeline types.\n * These types can be extended to introduce more types, and the System Runtime Pipeline should\n * add Middleware to handle the newly added types.\n */\nexport enum SystemType {\n /**\n * The initialization phase of the Module pipeline.\n * This phase is typically used for setting up initial state and resources.\n */\n initialize = 'initialize',\n\n /**\n * The update phase of the Module pipeline.\n * This phase is responsible for updating the game logic and state of entities.\n */\n update = 'update',\n\n /**\n * The render phase of the Module pipeline.\n * This phase is used for rendering the game to the screen.\n */\n render = 'render',\n\n /**\n * The synchronization phase of the Module pipeline.\n * This phase is used for synchronizing game state with external systems or other components.\n */\n sync = 'sync'\n}\n"],"mappings":";AAKO,IAAK,aAAL,kBAAKA,gBAAL;AAKL,EAAAA,YAAA,gBAAa;AAMb,EAAAA,YAAA,YAAS;AAMT,EAAAA,YAAA,YAAS;AAMT,EAAAA,YAAA,UAAO;AAvBG,SAAAA;AAAA,GAAA;","names":["SystemType"]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/systems/module/system-type.ts"],"sourcesContent":["/**\n * Enum representing the built-in System pipeline types.\n * These types can be extended to introduce more types, and the System Runtime Pipeline should\n * add Middleware to handle the newly added types.\n */\nexport enum SystemType {\n /**\n * The initialization phase of the Module pipeline.\n * This phase is typically used for setting up initial state and resources.\n */\n initialize = 'initialize',\n\n /**\n * The update phase of the Module pipeline.\n * This phase is responsible for updating the game logic and state of entities.\n */\n update = 'update',\n\n /**\n * The render phase of the Module pipeline.\n * This phase is used for rendering the game to the screen.\n */\n render = 'render',\n\n /**\n * The synchronization phase of the Module pipeline.\n * This phase is used for synchronizing game state with external systems or other components.\n */\n sync = 'sync'\n}\n"],"mappings":";;;;;;AAKA,IAAY,oDAAL;;;;;AAKL;;;;;AAMA;;;;;AAMA;;;;;AAMA;;AACD"}
@@ -1,30 +1,25 @@
1
+ //#region src/utils/types.d.ts
1
2
  /**
2
3
  * Creates a type that maps all properties of T to boolean.
3
4
  *
4
5
  * @template T - The type to map properties to boolean.
5
6
  * @returns A type with all properties of T mapped to boolean.
6
7
  */
7
- type BooleanProps<T> = {
8
- [Property in keyof T]: boolean;
9
- };
8
+ type BooleanProps<T> = { [Property in keyof T]: boolean };
10
9
  /**
11
10
  * Creates a type that makes all properties of T mutable.
12
11
  *
13
12
  * @template T - The type to make properties mutable.
14
13
  * @returns A type with all properties of T made mutable.
15
14
  */
16
- type Mutable<T> = {
17
- -readonly [K in keyof T]: T[K];
18
- };
15
+ type Mutable<T> = { -readonly [K in keyof T]: T[K] };
19
16
  /**
20
17
  * Creates a type that makes all properties of T mutable recursively.
21
18
  *
22
19
  * @template T - The type to make properties mutable recursively.
23
20
  * @returns A type with all properties of T made mutable recursively.
24
21
  */
25
- type MutableDeep<T> = {
26
- -readonly [K in keyof T]: Mutable<T[K]>;
27
- };
22
+ type MutableDeep<T> = { -readonly [K in keyof T]: Mutable<T[K]> };
28
23
  type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
29
24
  /**
30
25
  * Creates a type that makes all properties of T immutable.
@@ -61,17 +56,14 @@ type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
61
56
  * @template T - The type to make properties immutable.
62
57
  * @returns A type with all properties of T made immutable.
63
58
  */
64
- type ImmutableObject<T> = {
65
- readonly [K in keyof T]: T[K];
66
- };
59
+ type ImmutableObject<T> = { readonly [K in keyof T]: T[K] };
67
60
  /**
68
61
  * Creates a type that makes all properties of T immutable recursively.
69
62
  *
70
63
  * @template T - The type to make properties immutable recursively.
71
64
  * @returns A type with all properties of T made immutable recursively.
72
65
  */
73
- type ImmutableObjectDeep<T> = {
74
- readonly [K in keyof T]: Immutable<T[K]>;
75
- };
76
-
77
- export type { BooleanProps as B, Immutable as I, Mutable as M, MutableDeep as a, ImmutableArray as b, ImmutableMap as c, ImmutableSet as d, ImmutableObject as e, ImmutableObjectDeep as f };
66
+ type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
67
+ //#endregion
68
+ export { BooleanProps, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, Mutable, MutableDeep };
69
+ //# sourceMappingURL=types-DvzdpbLu.d.cts.map
@@ -1,30 +1,25 @@
1
+ //#region src/utils/types.d.ts
1
2
  /**
2
3
  * Creates a type that maps all properties of T to boolean.
3
4
  *
4
5
  * @template T - The type to map properties to boolean.
5
6
  * @returns A type with all properties of T mapped to boolean.
6
7
  */
7
- type BooleanProps<T> = {
8
- [Property in keyof T]: boolean;
9
- };
8
+ type BooleanProps<T> = { [Property in keyof T]: boolean };
10
9
  /**
11
10
  * Creates a type that makes all properties of T mutable.
12
11
  *
13
12
  * @template T - The type to make properties mutable.
14
13
  * @returns A type with all properties of T made mutable.
15
14
  */
16
- type Mutable<T> = {
17
- -readonly [K in keyof T]: T[K];
18
- };
15
+ type Mutable<T> = { -readonly [K in keyof T]: T[K] };
19
16
  /**
20
17
  * Creates a type that makes all properties of T mutable recursively.
21
18
  *
22
19
  * @template T - The type to make properties mutable recursively.
23
20
  * @returns A type with all properties of T made mutable recursively.
24
21
  */
25
- type MutableDeep<T> = {
26
- -readonly [K in keyof T]: Mutable<T[K]>;
27
- };
22
+ type MutableDeep<T> = { -readonly [K in keyof T]: Mutable<T[K]> };
28
23
  type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
29
24
  /**
30
25
  * Creates a type that makes all properties of T immutable.
@@ -61,17 +56,14 @@ type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
61
56
  * @template T - The type to make properties immutable.
62
57
  * @returns A type with all properties of T made immutable.
63
58
  */
64
- type ImmutableObject<T> = {
65
- readonly [K in keyof T]: T[K];
66
- };
59
+ type ImmutableObject<T> = { readonly [K in keyof T]: T[K] };
67
60
  /**
68
61
  * Creates a type that makes all properties of T immutable recursively.
69
62
  *
70
63
  * @template T - The type to make properties immutable recursively.
71
64
  * @returns A type with all properties of T made immutable recursively.
72
65
  */
73
- type ImmutableObjectDeep<T> = {
74
- readonly [K in keyof T]: Immutable<T[K]>;
75
- };
76
-
77
- export type { BooleanProps as B, Immutable as I, Mutable as M, MutableDeep as a, ImmutableArray as b, ImmutableMap as c, ImmutableSet as d, ImmutableObject as e, ImmutableObjectDeep as f };
66
+ type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
67
+ //#endregion
68
+ export { BooleanProps, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, Mutable, MutableDeep };
69
+ //# sourceMappingURL=types-yh4pOGEm.d.ts.map