@awesome-ecs/abstract 0.32.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.mts +1 -1
- package/dist/entities/index.cjs +1 -19
- package/dist/entities/index.cjs.map +1 -1
- package/dist/entities/index.d.cts +3 -3
- package/dist/entities/index.d.mts +3 -3
- package/dist/entities/index.mjs +1 -19
- package/dist/entities/index.mjs.map +1 -1
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +2 -2
- package/dist/factories/index.d.mts +2 -2
- package/dist/factories/index.mjs.map +1 -1
- package/dist/{index-vpjRaGIC.d.mts → index--9JJtMKF.d.mts} +83 -254
- package/dist/{index-BOsrKTWm.d.cts → index-0hg5PXZe.d.cts} +83 -254
- package/dist/{index-BD7sDB60.d.mts → index-BOS-47DQ.d.mts} +137 -298
- package/dist/{index-CeqaKmWR.d.mts → index-Bl7Cf9gi.d.cts} +11 -11
- package/dist/{index-BJFNTFDd.d.cts → index-CPGVaS-_.d.cts} +137 -298
- package/dist/{index-DMTkNY1e.d.cts → index-DXbpfhHa.d.mts} +11 -11
- package/dist/{index-C5nragoq.d.cts → index-HeCQLTSE.d.cts} +11 -3
- package/dist/{index-BlP67nCr.d.mts → index-Tznk33g6.d.mts} +11 -3
- package/dist/pipelines/index.d.cts +2 -2
- package/dist/pipelines/index.d.mts +2 -2
- package/dist/systems/index.cjs +8 -5
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +84 -2
- package/dist/systems/index.d.mts +84 -2
- package/dist/systems/index.mjs +8 -5
- package/dist/systems/index.mjs.map +1 -1
- package/dist/{types-Bbmnq4ni.d.cts → types-COxeVghs.d.cts} +19 -4
- package/dist/{types-C1ojaDL4.d.mts → types-UnqKSA14.d.mts} +19 -4
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.mts +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Immutable } from "./types-
|
|
1
|
+
import { r as Immutable } from "./types-COxeVghs.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/components/config.d.ts
|
|
4
4
|
/**
|
|
@@ -155,6 +155,14 @@ type TypedEntityProxy<T extends EntityTypeUid> = {
|
|
|
155
155
|
* A mapped type that transforms an array of EntityType into an array of TypedEntityProxy.
|
|
156
156
|
*/
|
|
157
157
|
type RequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> = [...{ [I in keyof TProxyTypes]: TypedEntityProxy<TProxyTypes[I]> }, ...IEntityProxy[]];
|
|
158
|
+
/**
|
|
159
|
+
* Extracts the union of EntityTypeUid values declared as required proxies on an entity model.
|
|
160
|
+
* Resolves to `never` if the model declares no required proxies, which makes proxy lookups
|
|
161
|
+
* via that union uncallable at compile time.
|
|
162
|
+
*
|
|
163
|
+
* @template TModel - The entity model to inspect.
|
|
164
|
+
*/
|
|
165
|
+
type ProxyTypesOf<TModel> = TModel extends IEntityModel<infer P> ? P[number] : never;
|
|
158
166
|
/**
|
|
159
167
|
* Central registry for managing entity-to-entity relationships through proxies.
|
|
160
168
|
* Maintains bidirectional proxy links, ensuring consistency across all entity references.
|
|
@@ -328,5 +336,5 @@ interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
|
|
|
328
336
|
readonly lastUpdated?: Date;
|
|
329
337
|
}
|
|
330
338
|
//#endregion
|
|
331
|
-
export {
|
|
332
|
-
//# sourceMappingURL=index-
|
|
339
|
+
export { ConfigOption as _, IEntity as a, IEntityProxy as c, RequiredProxies as d, TypedEntityProxy as f, ConfigCustomControlOptions as g, IComponentWithConfig as h, EntityUid as i, IEntityProxyRepository as l, IComponent as m, IdentityComponent as n, IEntityModel as o, ComponentTypeUid as p, EntityTypeUid as r, EntityProxy as s, BasicComponentType as t, ProxyTypesOf as u, ConfigRecord as v };
|
|
340
|
+
//# sourceMappingURL=index-HeCQLTSE.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Immutable } from "./types-
|
|
1
|
+
import { r as Immutable } from "./types-UnqKSA14.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/components/config.d.ts
|
|
4
4
|
/**
|
|
@@ -155,6 +155,14 @@ type TypedEntityProxy<T extends EntityTypeUid> = {
|
|
|
155
155
|
* A mapped type that transforms an array of EntityType into an array of TypedEntityProxy.
|
|
156
156
|
*/
|
|
157
157
|
type RequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> = [...{ [I in keyof TProxyTypes]: TypedEntityProxy<TProxyTypes[I]> }, ...IEntityProxy[]];
|
|
158
|
+
/**
|
|
159
|
+
* Extracts the union of EntityTypeUid values declared as required proxies on an entity model.
|
|
160
|
+
* Resolves to `never` if the model declares no required proxies, which makes proxy lookups
|
|
161
|
+
* via that union uncallable at compile time.
|
|
162
|
+
*
|
|
163
|
+
* @template TModel - The entity model to inspect.
|
|
164
|
+
*/
|
|
165
|
+
type ProxyTypesOf<TModel> = TModel extends IEntityModel<infer P> ? P[number] : never;
|
|
158
166
|
/**
|
|
159
167
|
* Central registry for managing entity-to-entity relationships through proxies.
|
|
160
168
|
* Maintains bidirectional proxy links, ensuring consistency across all entity references.
|
|
@@ -328,5 +336,5 @@ interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
|
|
|
328
336
|
readonly lastUpdated?: Date;
|
|
329
337
|
}
|
|
330
338
|
//#endregion
|
|
331
|
-
export {
|
|
332
|
-
//# sourceMappingURL=index-
|
|
339
|
+
export { ConfigOption as _, IEntity as a, IEntityProxy as c, RequiredProxies as d, TypedEntityProxy as f, ConfigCustomControlOptions as g, IComponentWithConfig as h, EntityUid as i, IEntityProxyRepository as l, IComponent as m, IdentityComponent as n, IEntityModel as o, ComponentTypeUid as p, EntityTypeUid as r, EntityProxy as s, BasicComponentType as t, ProxyTypesOf as u, ConfigRecord as v };
|
|
340
|
+
//# sourceMappingURL=index-Tznk33g6.d.mts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as IParentMiddleware, c as IMiddleware, i as IParentContext, l as IPipelineContext, n as INestedContext, o as IPipeline, r as INestedMiddleware, s as IMiddlewareRunner, t as IPipelineRunner, u as
|
|
2
|
-
export { IMiddleware, IMiddlewareRunner, INestedContext, INestedMiddleware, IParentContext, IParentMiddleware, IPipeline, IPipelineContext, IPipelineRunner,
|
|
1
|
+
import { a as IParentMiddleware, c as IMiddleware, i as IParentContext, l as IPipelineContext, n as INestedContext, o as IPipeline, r as INestedMiddleware, s as IMiddlewareRunner, t as IPipelineRunner, u as PipelineDispatch } from "../index-Bl7Cf9gi.cjs";
|
|
2
|
+
export { IMiddleware, IMiddlewareRunner, INestedContext, INestedMiddleware, IParentContext, IParentMiddleware, IPipeline, IPipelineContext, IPipelineRunner, PipelineDispatch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as IParentMiddleware, c as IMiddleware, i as IParentContext, l as IPipelineContext, n as INestedContext, o as IPipeline, r as INestedMiddleware, s as IMiddlewareRunner, t as IPipelineRunner, u as
|
|
2
|
-
export { IMiddleware, IMiddlewareRunner, INestedContext, INestedMiddleware, IParentContext, IParentMiddleware, IPipeline, IPipelineContext, IPipelineRunner,
|
|
1
|
+
import { a as IParentMiddleware, c as IMiddleware, i as IParentContext, l as IPipelineContext, n as INestedContext, o as IPipeline, r as INestedMiddleware, s as IMiddlewareRunner, t as IPipelineRunner, u as PipelineDispatch } from "../index-DXbpfhHa.mjs";
|
|
2
|
+
export { IMiddleware, IMiddlewareRunner, INestedContext, INestedMiddleware, IParentContext, IParentMiddleware, IPipeline, IPipelineContext, IPipelineRunner, PipelineDispatch };
|
package/dist/systems/index.cjs
CHANGED
|
@@ -4,8 +4,6 @@ let SystemContextControlState = /* @__PURE__ */ function(SystemContextControlSta
|
|
|
4
4
|
SystemContextControlState["none"] = "none";
|
|
5
5
|
SystemContextControlState["enableCurrentSystem"] = "enableCurrentSystem";
|
|
6
6
|
SystemContextControlState["disableCurrentSystem"] = "disableCurrentSystem";
|
|
7
|
-
SystemContextControlState["enableCurrentModule"] = "enableCurrentModule";
|
|
8
|
-
SystemContextControlState["disableCurrentModule"] = "disableCurrentModule";
|
|
9
7
|
return SystemContextControlState;
|
|
10
8
|
}({});
|
|
11
9
|
//#endregion
|
|
@@ -27,20 +25,25 @@ let SystemType = /* @__PURE__ */ function(SystemType) {
|
|
|
27
25
|
*/
|
|
28
26
|
SystemType[SystemType["config"] = 1] = "config";
|
|
29
27
|
/**
|
|
28
|
+
* Event reactions routed by event uid.
|
|
29
|
+
* Runs after config and before update for updates carrying events.
|
|
30
|
+
*/
|
|
31
|
+
SystemType[SystemType["event"] = 2] = "event";
|
|
32
|
+
/**
|
|
30
33
|
* Main logic and state updates for the entity.
|
|
31
34
|
* Runs on every update to change entity behavior and properties.
|
|
32
35
|
*/
|
|
33
|
-
SystemType[SystemType["update"] =
|
|
36
|
+
SystemType[SystemType["update"] = 3] = "update";
|
|
34
37
|
/**
|
|
35
38
|
* Output and visualization operations.
|
|
36
39
|
* Runs after updates to render or display the entity state.
|
|
37
40
|
*/
|
|
38
|
-
SystemType[SystemType["render"] =
|
|
41
|
+
SystemType[SystemType["render"] = 4] = "render";
|
|
39
42
|
/**
|
|
40
43
|
* Synchronization and persistence.
|
|
41
44
|
* Runs last to synchronize state with external systems or storage.
|
|
42
45
|
*/
|
|
43
|
-
SystemType[SystemType["sync"] =
|
|
46
|
+
SystemType[SystemType["sync"] = 5] = "sync";
|
|
44
47
|
return SystemType;
|
|
45
48
|
}({});
|
|
46
49
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/systems/pipeline/system-context-control.ts","../../src/systems/system-type.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/systems/pipeline/system-context-control.ts","../../src/systems/system-type.ts"],"sourcesContent":["import type {\n EntityEventSubscriptionOptions,\n EntityEventUid\n} from '../../entities/entity-events';\nimport type { SystemModuleName } from './system-middleware';\n\nexport interface SystemContextControlTarget {\n readonly name?: string;\n}\n\nexport enum SystemContextControlState {\n none = 'none',\n enableCurrentSystem = 'enableCurrentSystem',\n disableCurrentSystem = 'disableCurrentSystem'\n}\n\n/**\n * Interface for controlling the execution of systems and modules within a system context.\n * This allows middleware to enable or disable specific systems or entire modules for the current entity.\n */\nexport interface ISystemContextControl {\n /**\n * Disables the current system for the current entity.\n */\n disableCurrentSystem(): void;\n\n /**\n * Re-enables the current system for the current entity.\n */\n enableCurrentSystem(): void;\n\n /**\n * Disables a module for the current entity.\n */\n disableModule(name: SystemModuleName): void;\n\n /**\n * Re-enables a module for the current entity.\n */\n enableModule(name: SystemModuleName): void;\n}\n\n/**\n * Extended system context interface that includes control state for middleware to manage system and module execution.\n * This allows middleware to query and modify the execution state of systems and modules during pipeline processing.\n */\nexport interface ISystemContextControlState extends ISystemContextControl {\n /**\n * Current state of system/module execution control, indicating whether the current system or module is enabled or disabled.\n */\n readonly state: SystemContextControlState;\n\n /**\n * Checks if a specific middleware is currently disabled in the context, allowing middleware to conditionally execute logic based on the enabled/disabled state of other middleware.\n * @param middleware - The middleware to check for disabled state.\n * @returns True if the specified middleware is currently disabled, false otherwise.\n */\n isMiddlewareDisabled(middleware: SystemContextControlTarget): boolean;\n\n /**\n * Disables a specific middleware in the context.\n * @param middleware - The middleware to disable.\n */\n disableMiddleware(middleware: SystemContextControlTarget): void;\n\n /**\n * Enables a specific middleware in the context.\n * @param middleware - The middleware to enable.\n */\n enableMiddleware(middleware: SystemContextControlTarget): void;\n\n /**\n * Registers an event subscription owned by a module. This is runtime-only state:\n * disabling the module should also detach its event subscriptions.\n */\n registerModuleEvent(\n moduleName: SystemModuleName,\n eventUid: EntityEventUid,\n options?: EntityEventSubscriptionOptions\n ): void;\n\n /**\n * Clears all runtime-owned module event subscriptions for the current entity.\n */\n clearModuleEvents(): void;\n}\n","/**\n * The five phases of entity system execution in each frame.\n * Each phase serves a specific purpose in the entity lifecycle and can be extended by custom system types.\n * The runtime handles each phase in order, allowing systems to perform stage-specific operations.\n */\nexport enum SystemType {\n /**\n * Initial setup and resource allocation for the entity.\n * Runs once when the entity is first created or initialized.\n */\n initialize = 0,\n\n /**\n * Config application and config-dependent resource reconciliation.\n * Runs on entity creation and on updates that carry a config payload.\n */\n config = 1,\n\n /**\n * Event reactions routed by event uid.\n * Runs after config and before update for updates carrying events.\n */\n event = 2,\n\n /**\n * Main logic and state updates for the entity.\n * Runs on every update to change entity behavior and properties.\n */\n update = 3,\n\n /**\n * Output and visualization operations.\n * Runs after updates to render or display the entity state.\n */\n render = 4,\n\n /**\n * Synchronization and persistence.\n * Runs last to synchronize state with external systems or storage.\n */\n sync = 5\n}\n"],"mappings":";;AAUA,IAAY,4BAAL,yBAAA,2BAAA;CACL,0BAAA,UAAA;CACA,0BAAA,yBAAA;CACA,0BAAA,0BAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;ACTA,IAAY,aAAL,yBAAA,YAAA;;;;;CAKL,WAAA,WAAA,gBAAA,KAAA;;;;;CAMA,WAAA,WAAA,YAAA,KAAA;;;;;CAMA,WAAA,WAAA,WAAA,KAAA;;;;;CAMA,WAAA,WAAA,YAAA,KAAA;;;;;CAMA,WAAA,WAAA,YAAA,KAAA;;;;;CAMA,WAAA,WAAA,UAAA,KAAA;;AACF,EAAA,CAAA,CAAA"}
|
package/dist/systems/index.d.cts
CHANGED
|
@@ -1,2 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { a as IEntity, l as IEntityProxyRepository, r as EntityTypeUid } from "../index-HeCQLTSE.cjs";
|
|
2
|
+
import { r as Immutable } from "../types-COxeVghs.cjs";
|
|
3
|
+
import { a as IEntityDispatchGroup } from "../index-0hg5PXZe.cjs";
|
|
4
|
+
import { c as IMiddleware, l as IPipelineContext, u as PipelineDispatch } from "../index-Bl7Cf9gi.cjs";
|
|
5
|
+
import { A as ISystemContextControlState, B as ISystemContextConfigReadonly, D as IMutableSystemContextEvents, E as ISystemContextProxies, F as MiddlewareRegistry, I as MiddlewareRegistryReadonly, L as SystemMiddlewareName, M as SystemContextControlTarget, N as ISystemEventMiddleware, O as ISystemContextEvents, P as ISystemMiddleware, R as SystemModuleName, S as ISystemContextSnapshot, T as ISystemContextRepository, a as SystemType, b as IMutableSystemContext, i as ISystemsModule, j as SystemContextControlState, k as ISystemContextControl, n as ISystemsModuleBuilder, r as ISystemsModuleBuilderReadonly, w as ISystemContextScheduler, x as ISystemContext, z as ISystemContextConfig } from "../index-CPGVaS-_.cjs";
|
|
6
|
+
|
|
7
|
+
//#region src/systems/module/systems-module-repository.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Central registry for all systems modules in the ECS.
|
|
10
|
+
* Maintains a module for each entity type, providing access to all system pipelines.
|
|
11
|
+
* This is the authoritative source for system module data.
|
|
12
|
+
*
|
|
13
|
+
* @template TEntity - The entity types managed by modules in this repository.
|
|
14
|
+
*/
|
|
15
|
+
interface ISystemsModuleRepository {
|
|
16
|
+
/**
|
|
17
|
+
* The total number of modules in the repository.
|
|
18
|
+
*/
|
|
19
|
+
readonly size: number;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the module for a specific entity type.
|
|
22
|
+
* @template TEntity - The entity type to retrieve module for.
|
|
23
|
+
* @param type - The entity type identifier.
|
|
24
|
+
* @returns The systems module for that entity type.
|
|
25
|
+
*/
|
|
26
|
+
get<TEntity extends IEntity>(type: EntityTypeUid): ISystemsModule<TEntity>;
|
|
27
|
+
/**
|
|
28
|
+
* Registers or updates a module for an entity type.
|
|
29
|
+
* @param type - The entity type identifier.
|
|
30
|
+
* @param module - The systems module to register.
|
|
31
|
+
*/
|
|
32
|
+
set(type: EntityTypeUid, module: ISystemsModule<IEntity>): void;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves all registered modules.
|
|
35
|
+
* @returns A read-only map of entity type to module.
|
|
36
|
+
*/
|
|
37
|
+
list(): ReadonlyMap<EntityTypeUid, Immutable<ISystemsModule<IEntity>>>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/systems/runtime/systems-runtime.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Executes system middleware for a scheduler-produced dispatch group.
|
|
43
|
+
*/
|
|
44
|
+
interface ISystemsRuntime {
|
|
45
|
+
/**
|
|
46
|
+
* Runs the system runtime for one entity-type dispatch group.
|
|
47
|
+
*/
|
|
48
|
+
runTick(group: IEntityDispatchGroup): PipelineDispatch | Promise<PipelineDispatch> | void;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/systems/runtime/systems-runtime-context.d.ts
|
|
52
|
+
interface IRuntimeContext extends IPipelineContext {}
|
|
53
|
+
/**
|
|
54
|
+
* Runtime context for system pipeline execution.
|
|
55
|
+
* Coordinates the execution of system pipelines across all entities.
|
|
56
|
+
* Maintains state about the current entity being processed and enabled pipeline stages.
|
|
57
|
+
*
|
|
58
|
+
* @template TEntity - The entity type being processed.
|
|
59
|
+
*/
|
|
60
|
+
interface ISystemsRuntimeContext<TEntity extends IEntity> extends IRuntimeContext {
|
|
61
|
+
/**
|
|
62
|
+
* The systems module for the current entity type.
|
|
63
|
+
*/
|
|
64
|
+
readonly systemsModule: ISystemsModule<TEntity> | undefined;
|
|
65
|
+
readonly systemContext: IMutableSystemContext<TEntity> | undefined;
|
|
66
|
+
readonly pipelineMask: number;
|
|
67
|
+
/**
|
|
68
|
+
* The proxy repository for managing entity proxy relationships and scopes.
|
|
69
|
+
*/
|
|
70
|
+
readonly proxyRepository: IEntityProxyRepository;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/systems/runtime/systems-runtime-middleware.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Middleware for orchestrating system execution across entities.
|
|
76
|
+
* Operates at the runtime level to coordinate system module pipelines.
|
|
77
|
+
* Can influence which pipelines execute and in what order.
|
|
78
|
+
*
|
|
79
|
+
* @template TEntity - The entity type being processed.
|
|
80
|
+
*/
|
|
81
|
+
type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { IMutableSystemContext, IMutableSystemContextEvents, IRuntimeContext, ISystemContext, ISystemContextConfig, ISystemContextConfigReadonly, ISystemContextControl, ISystemContextControlState, ISystemContextEvents, ISystemContextProxies, ISystemContextRepository, ISystemContextScheduler, ISystemContextSnapshot, ISystemEventMiddleware, ISystemMiddleware, ISystemsModule, ISystemsModuleBuilder, ISystemsModuleBuilderReadonly, ISystemsModuleRepository, ISystemsRuntime, ISystemsRuntimeContext, ISystemsRuntimeMiddleware, MiddlewareRegistry, MiddlewareRegistryReadonly, SystemContextControlState, SystemContextControlTarget, SystemMiddlewareName, SystemModuleName, SystemType };
|
|
84
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/systems/index.d.mts
CHANGED
|
@@ -1,2 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { a as IEntity, l as IEntityProxyRepository, r as EntityTypeUid } from "../index-Tznk33g6.mjs";
|
|
2
|
+
import { r as Immutable } from "../types-UnqKSA14.mjs";
|
|
3
|
+
import { a as IEntityDispatchGroup } from "../index--9JJtMKF.mjs";
|
|
4
|
+
import { c as IMiddleware, l as IPipelineContext, u as PipelineDispatch } from "../index-DXbpfhHa.mjs";
|
|
5
|
+
import { A as ISystemContextControlState, B as ISystemContextConfigReadonly, D as IMutableSystemContextEvents, E as ISystemContextProxies, F as MiddlewareRegistry, I as MiddlewareRegistryReadonly, L as SystemMiddlewareName, M as SystemContextControlTarget, N as ISystemEventMiddleware, O as ISystemContextEvents, P as ISystemMiddleware, R as SystemModuleName, S as ISystemContextSnapshot, T as ISystemContextRepository, a as SystemType, b as IMutableSystemContext, i as ISystemsModule, j as SystemContextControlState, k as ISystemContextControl, n as ISystemsModuleBuilder, r as ISystemsModuleBuilderReadonly, w as ISystemContextScheduler, x as ISystemContext, z as ISystemContextConfig } from "../index-BOS-47DQ.mjs";
|
|
6
|
+
|
|
7
|
+
//#region src/systems/module/systems-module-repository.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Central registry for all systems modules in the ECS.
|
|
10
|
+
* Maintains a module for each entity type, providing access to all system pipelines.
|
|
11
|
+
* This is the authoritative source for system module data.
|
|
12
|
+
*
|
|
13
|
+
* @template TEntity - The entity types managed by modules in this repository.
|
|
14
|
+
*/
|
|
15
|
+
interface ISystemsModuleRepository {
|
|
16
|
+
/**
|
|
17
|
+
* The total number of modules in the repository.
|
|
18
|
+
*/
|
|
19
|
+
readonly size: number;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the module for a specific entity type.
|
|
22
|
+
* @template TEntity - The entity type to retrieve module for.
|
|
23
|
+
* @param type - The entity type identifier.
|
|
24
|
+
* @returns The systems module for that entity type.
|
|
25
|
+
*/
|
|
26
|
+
get<TEntity extends IEntity>(type: EntityTypeUid): ISystemsModule<TEntity>;
|
|
27
|
+
/**
|
|
28
|
+
* Registers or updates a module for an entity type.
|
|
29
|
+
* @param type - The entity type identifier.
|
|
30
|
+
* @param module - The systems module to register.
|
|
31
|
+
*/
|
|
32
|
+
set(type: EntityTypeUid, module: ISystemsModule<IEntity>): void;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves all registered modules.
|
|
35
|
+
* @returns A read-only map of entity type to module.
|
|
36
|
+
*/
|
|
37
|
+
list(): ReadonlyMap<EntityTypeUid, Immutable<ISystemsModule<IEntity>>>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/systems/runtime/systems-runtime.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Executes system middleware for a scheduler-produced dispatch group.
|
|
43
|
+
*/
|
|
44
|
+
interface ISystemsRuntime {
|
|
45
|
+
/**
|
|
46
|
+
* Runs the system runtime for one entity-type dispatch group.
|
|
47
|
+
*/
|
|
48
|
+
runTick(group: IEntityDispatchGroup): PipelineDispatch | Promise<PipelineDispatch> | void;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/systems/runtime/systems-runtime-context.d.ts
|
|
52
|
+
interface IRuntimeContext extends IPipelineContext {}
|
|
53
|
+
/**
|
|
54
|
+
* Runtime context for system pipeline execution.
|
|
55
|
+
* Coordinates the execution of system pipelines across all entities.
|
|
56
|
+
* Maintains state about the current entity being processed and enabled pipeline stages.
|
|
57
|
+
*
|
|
58
|
+
* @template TEntity - The entity type being processed.
|
|
59
|
+
*/
|
|
60
|
+
interface ISystemsRuntimeContext<TEntity extends IEntity> extends IRuntimeContext {
|
|
61
|
+
/**
|
|
62
|
+
* The systems module for the current entity type.
|
|
63
|
+
*/
|
|
64
|
+
readonly systemsModule: ISystemsModule<TEntity> | undefined;
|
|
65
|
+
readonly systemContext: IMutableSystemContext<TEntity> | undefined;
|
|
66
|
+
readonly pipelineMask: number;
|
|
67
|
+
/**
|
|
68
|
+
* The proxy repository for managing entity proxy relationships and scopes.
|
|
69
|
+
*/
|
|
70
|
+
readonly proxyRepository: IEntityProxyRepository;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/systems/runtime/systems-runtime-middleware.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Middleware for orchestrating system execution across entities.
|
|
76
|
+
* Operates at the runtime level to coordinate system module pipelines.
|
|
77
|
+
* Can influence which pipelines execute and in what order.
|
|
78
|
+
*
|
|
79
|
+
* @template TEntity - The entity type being processed.
|
|
80
|
+
*/
|
|
81
|
+
type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { IMutableSystemContext, IMutableSystemContextEvents, IRuntimeContext, ISystemContext, ISystemContextConfig, ISystemContextConfigReadonly, ISystemContextControl, ISystemContextControlState, ISystemContextEvents, ISystemContextProxies, ISystemContextRepository, ISystemContextScheduler, ISystemContextSnapshot, ISystemEventMiddleware, ISystemMiddleware, ISystemsModule, ISystemsModuleBuilder, ISystemsModuleBuilderReadonly, ISystemsModuleRepository, ISystemsRuntime, ISystemsRuntimeContext, ISystemsRuntimeMiddleware, MiddlewareRegistry, MiddlewareRegistryReadonly, SystemContextControlState, SystemContextControlTarget, SystemMiddlewareName, SystemModuleName, SystemType };
|
|
84
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/systems/index.mjs
CHANGED
|
@@ -3,8 +3,6 @@ let SystemContextControlState = /* @__PURE__ */ function(SystemContextControlSta
|
|
|
3
3
|
SystemContextControlState["none"] = "none";
|
|
4
4
|
SystemContextControlState["enableCurrentSystem"] = "enableCurrentSystem";
|
|
5
5
|
SystemContextControlState["disableCurrentSystem"] = "disableCurrentSystem";
|
|
6
|
-
SystemContextControlState["enableCurrentModule"] = "enableCurrentModule";
|
|
7
|
-
SystemContextControlState["disableCurrentModule"] = "disableCurrentModule";
|
|
8
6
|
return SystemContextControlState;
|
|
9
7
|
}({});
|
|
10
8
|
//#endregion
|
|
@@ -26,20 +24,25 @@ let SystemType = /* @__PURE__ */ function(SystemType) {
|
|
|
26
24
|
*/
|
|
27
25
|
SystemType[SystemType["config"] = 1] = "config";
|
|
28
26
|
/**
|
|
27
|
+
* Event reactions routed by event uid.
|
|
28
|
+
* Runs after config and before update for updates carrying events.
|
|
29
|
+
*/
|
|
30
|
+
SystemType[SystemType["event"] = 2] = "event";
|
|
31
|
+
/**
|
|
29
32
|
* Main logic and state updates for the entity.
|
|
30
33
|
* Runs on every update to change entity behavior and properties.
|
|
31
34
|
*/
|
|
32
|
-
SystemType[SystemType["update"] =
|
|
35
|
+
SystemType[SystemType["update"] = 3] = "update";
|
|
33
36
|
/**
|
|
34
37
|
* Output and visualization operations.
|
|
35
38
|
* Runs after updates to render or display the entity state.
|
|
36
39
|
*/
|
|
37
|
-
SystemType[SystemType["render"] =
|
|
40
|
+
SystemType[SystemType["render"] = 4] = "render";
|
|
38
41
|
/**
|
|
39
42
|
* Synchronization and persistence.
|
|
40
43
|
* Runs last to synchronize state with external systems or storage.
|
|
41
44
|
*/
|
|
42
|
-
SystemType[SystemType["sync"] =
|
|
45
|
+
SystemType[SystemType["sync"] = 5] = "sync";
|
|
43
46
|
return SystemType;
|
|
44
47
|
}({});
|
|
45
48
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/systems/pipeline/system-context-control.ts","../../src/systems/system-type.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/systems/pipeline/system-context-control.ts","../../src/systems/system-type.ts"],"sourcesContent":["import type {\n EntityEventSubscriptionOptions,\n EntityEventUid\n} from '../../entities/entity-events';\nimport type { SystemModuleName } from './system-middleware';\n\nexport interface SystemContextControlTarget {\n readonly name?: string;\n}\n\nexport enum SystemContextControlState {\n none = 'none',\n enableCurrentSystem = 'enableCurrentSystem',\n disableCurrentSystem = 'disableCurrentSystem'\n}\n\n/**\n * Interface for controlling the execution of systems and modules within a system context.\n * This allows middleware to enable or disable specific systems or entire modules for the current entity.\n */\nexport interface ISystemContextControl {\n /**\n * Disables the current system for the current entity.\n */\n disableCurrentSystem(): void;\n\n /**\n * Re-enables the current system for the current entity.\n */\n enableCurrentSystem(): void;\n\n /**\n * Disables a module for the current entity.\n */\n disableModule(name: SystemModuleName): void;\n\n /**\n * Re-enables a module for the current entity.\n */\n enableModule(name: SystemModuleName): void;\n}\n\n/**\n * Extended system context interface that includes control state for middleware to manage system and module execution.\n * This allows middleware to query and modify the execution state of systems and modules during pipeline processing.\n */\nexport interface ISystemContextControlState extends ISystemContextControl {\n /**\n * Current state of system/module execution control, indicating whether the current system or module is enabled or disabled.\n */\n readonly state: SystemContextControlState;\n\n /**\n * Checks if a specific middleware is currently disabled in the context, allowing middleware to conditionally execute logic based on the enabled/disabled state of other middleware.\n * @param middleware - The middleware to check for disabled state.\n * @returns True if the specified middleware is currently disabled, false otherwise.\n */\n isMiddlewareDisabled(middleware: SystemContextControlTarget): boolean;\n\n /**\n * Disables a specific middleware in the context.\n * @param middleware - The middleware to disable.\n */\n disableMiddleware(middleware: SystemContextControlTarget): void;\n\n /**\n * Enables a specific middleware in the context.\n * @param middleware - The middleware to enable.\n */\n enableMiddleware(middleware: SystemContextControlTarget): void;\n\n /**\n * Registers an event subscription owned by a module. This is runtime-only state:\n * disabling the module should also detach its event subscriptions.\n */\n registerModuleEvent(\n moduleName: SystemModuleName,\n eventUid: EntityEventUid,\n options?: EntityEventSubscriptionOptions\n ): void;\n\n /**\n * Clears all runtime-owned module event subscriptions for the current entity.\n */\n clearModuleEvents(): void;\n}\n","/**\n * The five phases of entity system execution in each frame.\n * Each phase serves a specific purpose in the entity lifecycle and can be extended by custom system types.\n * The runtime handles each phase in order, allowing systems to perform stage-specific operations.\n */\nexport enum SystemType {\n /**\n * Initial setup and resource allocation for the entity.\n * Runs once when the entity is first created or initialized.\n */\n initialize = 0,\n\n /**\n * Config application and config-dependent resource reconciliation.\n * Runs on entity creation and on updates that carry a config payload.\n */\n config = 1,\n\n /**\n * Event reactions routed by event uid.\n * Runs after config and before update for updates carrying events.\n */\n event = 2,\n\n /**\n * Main logic and state updates for the entity.\n * Runs on every update to change entity behavior and properties.\n */\n update = 3,\n\n /**\n * Output and visualization operations.\n * Runs after updates to render or display the entity state.\n */\n render = 4,\n\n /**\n * Synchronization and persistence.\n * Runs last to synchronize state with external systems or storage.\n */\n sync = 5\n}\n"],"mappings":";AAUA,IAAY,4BAAL,yBAAA,2BAAA;CACL,0BAAA,UAAA;CACA,0BAAA,yBAAA;CACA,0BAAA,0BAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;ACTA,IAAY,aAAL,yBAAA,YAAA;;;;;CAKL,WAAA,WAAA,gBAAA,KAAA;;;;;CAMA,WAAA,WAAA,YAAA,KAAA;;;;;CAMA,WAAA,WAAA,WAAA,KAAA;;;;;CAMA,WAAA,WAAA,YAAA,KAAA;;;;;CAMA,WAAA,WAAA,YAAA,KAAA;;;;;CAMA,WAAA,WAAA,UAAA,KAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -52,12 +52,27 @@ type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
|
52
52
|
* @template T - Element type of the set.
|
|
53
53
|
*/
|
|
54
54
|
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
55
|
+
declare const __immutableBrand: unique symbol;
|
|
55
56
|
/**
|
|
56
|
-
*
|
|
57
|
+
* Marks an object as immutable while preserving the original type T.
|
|
57
58
|
*
|
|
58
|
-
*
|
|
59
|
+
* Implemented as an intersection (T & brand) rather than a mapped type
|
|
60
|
+
* (`{ readonly [K in keyof T]: T[K] }`) on purpose: a mapped type strips
|
|
61
|
+
* away nominal information from class types, so any `protected`/`private`
|
|
62
|
+
* members on the source class become structurally invisible. That makes
|
|
63
|
+
* `ImmutableObject<MyEntity>` no longer assignable to `MyEntity`, which
|
|
64
|
+
* breaks ergonomic patterns like passing `context.entity` to a helper
|
|
65
|
+
* method typed as `(entity: MyEntity) => ...`.
|
|
66
|
+
*
|
|
67
|
+
* By intersecting with T directly, the original class identity is kept
|
|
68
|
+
* (including protected members), and immutability is enforced at the
|
|
69
|
+
* source declaration via `readonly` fields rather than via the wrapper.
|
|
70
|
+
*
|
|
71
|
+
* @template T - The type to mark immutable.
|
|
59
72
|
*/
|
|
60
|
-
type ImmutableObject<T> =
|
|
73
|
+
type ImmutableObject<T> = T & {
|
|
74
|
+
readonly [__immutableBrand]?: never;
|
|
75
|
+
};
|
|
61
76
|
/**
|
|
62
77
|
* Recursively makes all properties readonly at all nesting levels.
|
|
63
78
|
* Provides complete immutability guarantee for the entire object graph.
|
|
@@ -71,4 +86,4 @@ type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
|
|
|
71
86
|
type DeepPartial<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends readonly unknown[] ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
72
87
|
//#endregion
|
|
73
88
|
export { ImmutableMap as a, ImmutableSet as c, ImmutableArray as i, Mutable as l, DeepPartial as n, ImmutableObject as o, Immutable as r, ImmutableObjectDeep as s, BooleanProps as t, MutableDeep as u };
|
|
74
|
-
//# sourceMappingURL=types-
|
|
89
|
+
//# sourceMappingURL=types-COxeVghs.d.cts.map
|
|
@@ -52,12 +52,27 @@ type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
|
52
52
|
* @template T - Element type of the set.
|
|
53
53
|
*/
|
|
54
54
|
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
55
|
+
declare const __immutableBrand: unique symbol;
|
|
55
56
|
/**
|
|
56
|
-
*
|
|
57
|
+
* Marks an object as immutable while preserving the original type T.
|
|
57
58
|
*
|
|
58
|
-
*
|
|
59
|
+
* Implemented as an intersection (T & brand) rather than a mapped type
|
|
60
|
+
* (`{ readonly [K in keyof T]: T[K] }`) on purpose: a mapped type strips
|
|
61
|
+
* away nominal information from class types, so any `protected`/`private`
|
|
62
|
+
* members on the source class become structurally invisible. That makes
|
|
63
|
+
* `ImmutableObject<MyEntity>` no longer assignable to `MyEntity`, which
|
|
64
|
+
* breaks ergonomic patterns like passing `context.entity` to a helper
|
|
65
|
+
* method typed as `(entity: MyEntity) => ...`.
|
|
66
|
+
*
|
|
67
|
+
* By intersecting with T directly, the original class identity is kept
|
|
68
|
+
* (including protected members), and immutability is enforced at the
|
|
69
|
+
* source declaration via `readonly` fields rather than via the wrapper.
|
|
70
|
+
*
|
|
71
|
+
* @template T - The type to mark immutable.
|
|
59
72
|
*/
|
|
60
|
-
type ImmutableObject<T> =
|
|
73
|
+
type ImmutableObject<T> = T & {
|
|
74
|
+
readonly [__immutableBrand]?: never;
|
|
75
|
+
};
|
|
61
76
|
/**
|
|
62
77
|
* Recursively makes all properties readonly at all nesting levels.
|
|
63
78
|
* Provides complete immutability guarantee for the entire object graph.
|
|
@@ -71,4 +86,4 @@ type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
|
|
|
71
86
|
type DeepPartial<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends readonly unknown[] ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
72
87
|
//#endregion
|
|
73
88
|
export { ImmutableMap as a, ImmutableSet as c, ImmutableArray as i, Mutable as l, DeepPartial as n, ImmutableObject as o, Immutable as r, ImmutableObjectDeep as s, BooleanProps as t, MutableDeep as u };
|
|
74
|
-
//# sourceMappingURL=types-
|
|
89
|
+
//# sourceMappingURL=types-UnqKSA14.d.mts.map
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ImmutableMap, c as ImmutableSet, i as ImmutableArray, l as Mutable, n as DeepPartial, o as ImmutableObject, r as Immutable, s as ImmutableObjectDeep, t as BooleanProps, u as MutableDeep } from "../types-
|
|
2
|
-
import { C as
|
|
1
|
+
import { a as ImmutableMap, c as ImmutableSet, i as ImmutableArray, l as Mutable, n as DeepPartial, o as ImmutableObject, r as Immutable, s as ImmutableObjectDeep, t as BooleanProps, u as MutableDeep } from "../types-COxeVghs.cjs";
|
|
2
|
+
import { C as IJsonSerializer, H as ILoggerOptions, U as LogLevel, V as ILogger, c as PerformanceTimeEntry, d as RenderSnapshot, f as TickMetricEntry, l as PerformanceTimerUid, m as dispatchSequential, o as IPerformanceTimer, p as TickSnapshot, s as PerformanceMetricOptions, u as MiddlewareMetricsSummary } from "../index-CPGVaS-_.cjs";
|
|
3
3
|
export { BooleanProps, DeepPartial, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, MiddlewareMetricsSummary, Mutable, MutableDeep, PerformanceMetricOptions, PerformanceTimeEntry, PerformanceTimerUid, RenderSnapshot, TickMetricEntry, TickSnapshot, dispatchSequential };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ImmutableMap, c as ImmutableSet, i as ImmutableArray, l as Mutable, n as DeepPartial, o as ImmutableObject, r as Immutable, s as ImmutableObjectDeep, t as BooleanProps, u as MutableDeep } from "../types-
|
|
2
|
-
import { C as
|
|
1
|
+
import { a as ImmutableMap, c as ImmutableSet, i as ImmutableArray, l as Mutable, n as DeepPartial, o as ImmutableObject, r as Immutable, s as ImmutableObjectDeep, t as BooleanProps, u as MutableDeep } from "../types-UnqKSA14.mjs";
|
|
2
|
+
import { C as IJsonSerializer, H as ILoggerOptions, U as LogLevel, V as ILogger, c as PerformanceTimeEntry, d as RenderSnapshot, f as TickMetricEntry, l as PerformanceTimerUid, m as dispatchSequential, o as IPerformanceTimer, p as TickSnapshot, s as PerformanceMetricOptions, u as MiddlewareMetricsSummary } from "../index-BOS-47DQ.mjs";
|
|
3
3
|
export { BooleanProps, DeepPartial, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, MiddlewareMetricsSummary, Mutable, MutableDeep, PerformanceMetricOptions, PerformanceTimeEntry, PerformanceTimerUid, RenderSnapshot, TickMetricEntry, TickSnapshot, dispatchSequential };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awesome-ecs/abstract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"url": "https://github.com/privatebytes/awesome-ecs/issues"
|
|
98
98
|
},
|
|
99
99
|
"homepage": "https://github.com/privatebytes/awesome-ecs#readme",
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "bdefa30e24f27c812d999f75483cb59571d66e7d"
|
|
101
101
|
}
|