@awesome-ecs/abstract 0.13.0 → 0.13.2

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 (76) hide show
  1. package/LICENSE.md +201 -201
  2. package/README.md +99 -99
  3. package/dist/components/component.d.ts +36 -36
  4. package/dist/components/component.js +2 -2
  5. package/dist/components/identity-component.d.ts +24 -24
  6. package/dist/components/identity-component.js +7 -7
  7. package/dist/entities/entity-events.d.ts +52 -39
  8. package/dist/entities/entity-events.js +2 -2
  9. package/dist/entities/entity-proxies.d.ts +25 -25
  10. package/dist/entities/entity-proxies.js +2 -2
  11. package/dist/entities/entity-queue.d.ts +31 -31
  12. package/dist/entities/entity-queue.js +11 -11
  13. package/dist/entities/entity-repository.d.ts +16 -16
  14. package/dist/entities/entity-repository.js +2 -2
  15. package/dist/entities/entity-scheduler.d.ts +11 -11
  16. package/dist/entities/entity-scheduler.js +2 -2
  17. package/dist/entities/entity-snapshot.d.ts +24 -24
  18. package/dist/entities/entity-snapshot.js +2 -2
  19. package/dist/entities/entity.d.ts +33 -31
  20. package/dist/entities/entity.js +2 -2
  21. package/dist/factories/context-factory.d.ts +9 -9
  22. package/dist/factories/context-factory.js +2 -2
  23. package/dist/factories/pipeline-factory.d.ts +11 -11
  24. package/dist/factories/pipeline-factory.js +2 -2
  25. package/dist/factories/runtime-factory.d.ts +10 -10
  26. package/dist/factories/runtime-factory.js +2 -2
  27. package/dist/index.d.ts +35 -35
  28. package/dist/index.js +51 -51
  29. package/dist/index.js.map +1 -1
  30. package/dist/pipelines/middleware-result.d.ts +5 -5
  31. package/dist/pipelines/middleware-result.js +2 -2
  32. package/dist/pipelines/middleware-stop.d.ts +4 -4
  33. package/dist/pipelines/middleware-stop.js +2 -2
  34. package/dist/pipelines/middleware.d.ts +24 -24
  35. package/dist/pipelines/middleware.js +2 -2
  36. package/dist/pipelines/pipeline-type.d.ts +7 -7
  37. package/dist/pipelines/pipeline-type.js +11 -11
  38. package/dist/pipelines/pipeline.d.ts +22 -22
  39. package/dist/pipelines/pipeline.js +2 -2
  40. package/dist/runtime/runtime-pipeline.d.ts +11 -11
  41. package/dist/runtime/runtime-pipeline.js +2 -2
  42. package/dist/runtime/runtime-result.d.ts +20 -20
  43. package/dist/runtime/runtime-result.js +2 -2
  44. package/dist/runtime/runtime-status.d.ts +7 -7
  45. package/dist/runtime/runtime-status.js +11 -11
  46. package/dist/systems/context/system-context-events.d.ts +65 -19
  47. package/dist/systems/context/system-context-events.js +2 -2
  48. package/dist/systems/context/system-context-proxies.d.ts +12 -12
  49. package/dist/systems/context/system-context-proxies.js +2 -2
  50. package/dist/systems/context/system-context-repository.d.ts +15 -15
  51. package/dist/systems/context/system-context-repository.js +2 -2
  52. package/dist/systems/context/system-context-scheduler.d.ts +9 -9
  53. package/dist/systems/context/system-context-scheduler.js +2 -2
  54. package/dist/systems/context/system-context-snapshot.d.ts +15 -15
  55. package/dist/systems/context/system-context-snapshot.js +2 -2
  56. package/dist/systems/runtime/systems-runtime-context.d.ts +18 -18
  57. package/dist/systems/runtime/systems-runtime-context.js +2 -2
  58. package/dist/systems/runtime/systems-runtime-middleware.d.ts +8 -8
  59. package/dist/systems/runtime/systems-runtime-middleware.js +2 -2
  60. package/dist/systems/system-pipeline-context.d.ts +21 -21
  61. package/dist/systems/system-pipeline-context.js +2 -2
  62. package/dist/systems/system-pipeline-middleware.d.ts +8 -8
  63. package/dist/systems/system-pipeline-middleware.js +2 -2
  64. package/dist/systems/system-pipeline-type.d.ts +10 -10
  65. package/dist/systems/system-pipeline-type.js +14 -14
  66. package/dist/systems/systems-module.d.ts +22 -22
  67. package/dist/systems/systems-module.js +2 -2
  68. package/dist/systems/systems-runtime.d.ts +16 -16
  69. package/dist/systems/systems-runtime.js +2 -2
  70. package/dist/utils/json-serializer.d.ts +7 -7
  71. package/dist/utils/json-serializer.js +3 -3
  72. package/dist/utils/performance-timer.d.ts +11 -11
  73. package/dist/utils/performance-timer.js +2 -2
  74. package/dist/utils/types.d.ts +21 -18
  75. package/dist/utils/types.js +2 -2
  76. package/package.json +3 -3
@@ -1,19 +1,65 @@
1
- import { EntityEventUid, IEntityEvent, IEventData } from "../../entities/entity-events";
2
- import { IEntityProxy } from "../../entities/entity-proxies";
3
- /**
4
- * The ISystemContextEvents is the access point for Event related APIs.
5
- * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
6
- */
7
- export interface ISystemContextEvents {
8
- dispatchEvent<TEventData extends IEventData>(data: TEventData, ...targets: IEntityProxy[]): void;
9
- dispatchEvents<TEventData extends IEventData>(data: TEventData[], ...targets: IEntityProxy[]): void;
10
- getEvent<TEventData extends IEventData>(uid: EntityEventUid): IEntityEvent<TEventData>;
11
- listEvents<TEventData extends IEventData>(): IEntityEvent<TEventData>[];
12
- hasEvent(uid?: EntityEventUid): boolean;
13
- subscribeTo<TEventData extends IEventData>(uid: EntityEventUid, filter?: (event: IEntityEvent<TEventData>) => boolean): void;
14
- unsubscribeFrom(uid: EntityEventUid): void;
15
- clearSubscriptions(uid?: EntityEventUid): void;
16
- setContextEvents(events: IEntityEvent<IEventData>[]): void;
17
- setContextEvent(event: IEntityEvent<IEventData>): void;
18
- clearContextEvents(): void;
19
- }
1
+ import { EntityEventUid, IEntityEvent, IEventData } from "../../entities/entity-events";
2
+ import { IEntityProxy } from "../../entities/entity-proxies";
3
+ /**
4
+ * The ISystemContextEvents is the access point for Event related APIs.
5
+ * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
6
+ */
7
+ export interface ISystemContextEvents {
8
+ /**
9
+ * Dispatches and schedules the Event to it's Subscribers or provided Entity Targets.
10
+ * @param data The EventData to dispatch.
11
+ * @param targets (optional) The Entities to send this event to. Providing this parameter will not broadcast this event.
12
+ */
13
+ dispatchEvent<TEventData extends IEventData>(data: TEventData, ...targets: IEntityProxy[]): void;
14
+ /**
15
+ * Dispatches and schedules the Events to their Subscribers or provided Entity Targets.
16
+ * @param data The EventData Array to dispatch.
17
+ * @param targets (optional) The Entities to send this event to. Providing this parameter will not broadcast this event.
18
+ */
19
+ dispatchEvents<TEventData extends IEventData>(data: TEventData[], ...targets: IEntityProxy[]): void;
20
+ /**
21
+ * Retrieves the Event with the given UID if it has been previously set on the current Context.
22
+ * @param uid The Event UID to retrieve.
23
+ */
24
+ getEvent<TEventData extends IEventData>(uid: EntityEventUid): IEntityEvent<TEventData>;
25
+ /**
26
+ * Retrieves all the Events currently set on the Context.
27
+ */
28
+ listEvents<TEventData extends IEventData>(): IEntityEvent<TEventData>[];
29
+ /**
30
+ * Returns whether the Event with the given UID has previously been set on the current Context.
31
+ * @param uid The Event UID to check for existence.
32
+ */
33
+ hasEvent(uid?: EntityEventUid): boolean;
34
+ /**
35
+ * Subscribes to Events with the given UID. When the matching Event is dispatched,
36
+ * the Entity update loop will set this Event on the Pipeline Context.
37
+ * @param uid The Event UID to subscribe to.
38
+ * @param filter (optional) Provides a callback function that will be executed on all matching Events.
39
+ * Can be used to filter what Event to schedule through to the current Entity update.
40
+ */
41
+ subscribeTo<TEventData extends IEventData>(uid: EntityEventUid, filter?: (event: IEntityEvent<TEventData>) => boolean): void;
42
+ /**
43
+ * Stops subscribing to Events with the given UID. The Entity will not receive any future Events with this UID.
44
+ * @param uid The Event UID to stop listening to.
45
+ */
46
+ unsubscribeFrom(uid: EntityEventUid): void;
47
+ /**
48
+ * Adds the given Events into the Context instance.
49
+ * @param events The Event instances to be set on the Context.
50
+ */
51
+ setContextEvents(events: IEntityEvent<IEventData>[]): void;
52
+ /**
53
+ * Adds the given Event into the Context instance.
54
+ * @param event The Event instance to be set on the Context.
55
+ */
56
+ setContextEvent(event: IEntityEvent<IEventData>): void;
57
+ /**
58
+ * Removes all the Events currently set on the Context instance.
59
+ */
60
+ clearContextEvents(): void;
61
+ /**
62
+ * Removes all the Event Subscriptions for the current Entity.
63
+ */
64
+ clearSubscriptions(): void;
65
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-context-events.js.map
@@ -1,12 +1,12 @@
1
- import { EntityTypeUid } from "../../entities/entity";
2
- import { IEntityProxy } from "../../entities/entity-proxies";
3
- /**
4
- * The ISystemContextProxies is the access point for EntityProxy related APIs.
5
- * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
6
- */
7
- export interface ISystemContextProxies {
8
- registerProxy(proxy: IEntityProxy, cleanup?: boolean): void;
9
- registerProxies(proxies: IEntityProxy[], cleanup?: boolean): void;
10
- removeProxy(proxy: IEntityProxy): void;
11
- removeProxies(proxyEntityType?: EntityTypeUid): void;
12
- }
1
+ import { EntityTypeUid } from "../../entities/entity";
2
+ import { IEntityProxy } from "../../entities/entity-proxies";
3
+ /**
4
+ * The ISystemContextProxies is the access point for EntityProxy related APIs.
5
+ * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
6
+ */
7
+ export interface ISystemContextProxies {
8
+ registerProxy(proxy: IEntityProxy, cleanup?: boolean): void;
9
+ registerProxies(proxies: IEntityProxy[], cleanup?: boolean): void;
10
+ removeProxy(proxy: IEntityProxy): void;
11
+ removeProxies(proxyEntityType?: EntityTypeUid): void;
12
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-context-proxies.js.map
@@ -1,15 +1,15 @@
1
- import { EntityTypeUid, IEntityModel, IEntity } from "../../entities/entity";
2
- import { EntityProxy, IEntityProxy } from "../../entities/entity-proxies";
3
- import { IEntitySnapshot } from "../../entities/entity-snapshot";
4
- import { Immutable } from "../../utils/types";
5
- /**
6
- * The `ISystemContextRepository` is the access point for the `IEntityRepository` related APIs.
7
- *
8
- * The access is made in an `ISystemMiddleware` through the provided `ISystemPipelineContext`.
9
- */
10
- export interface ISystemContextRepository {
11
- addEntity(entityType: EntityTypeUid, model: IEntityModel, snapshot?: IEntitySnapshot): void;
12
- getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity>): Immutable<TEntity>;
13
- updateEntity(target?: IEntityProxy): void;
14
- removeEntity(target: IEntityProxy): void;
15
- }
1
+ import { EntityTypeUid, IEntityModel, IEntity } from "../../entities/entity";
2
+ import { EntityProxy, IEntityProxy } from "../../entities/entity-proxies";
3
+ import { IEntitySnapshot } from "../../entities/entity-snapshot";
4
+ import { Immutable } from "../../utils/types";
5
+ /**
6
+ * The `ISystemContextRepository` is the access point for the `IEntityRepository` related APIs.
7
+ *
8
+ * The access is made in an `ISystemMiddleware` through the provided `ISystemPipelineContext`.
9
+ */
10
+ export interface ISystemContextRepository {
11
+ addEntity(entityType: EntityTypeUid, model: IEntityModel, snapshot?: IEntitySnapshot): void;
12
+ getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity>): Immutable<TEntity>;
13
+ updateEntity(target?: IEntityProxy): void;
14
+ removeEntity(target: IEntityProxy): void;
15
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-context-repository.js.map
@@ -1,9 +1,9 @@
1
- import { IEntityProxy } from "../../entities/entity-proxies";
2
- /**
3
- * The ISystemContextRepository is the access point for Scheduler related APIs.
4
- * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
5
- */
6
- export interface ISystemContextScheduler {
7
- scheduleUpdateOnInterval(target?: IEntityProxy, intervalMs?: number): void;
8
- clearUpdateOnInterval(target?: IEntityProxy): void;
9
- }
1
+ import { IEntityProxy } from "../../entities/entity-proxies";
2
+ /**
3
+ * The ISystemContextRepository is the access point for Scheduler related APIs.
4
+ * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
5
+ */
6
+ export interface ISystemContextScheduler {
7
+ scheduleUpdateOnInterval(target?: IEntityProxy, intervalMs?: number): void;
8
+ clearUpdateOnInterval(target?: IEntityProxy): void;
9
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-context-scheduler.js.map
@@ -1,15 +1,15 @@
1
- import { IEntity } from "../../entities/entity";
2
- import { IEntityProxy } from "../../entities/entity-proxies";
3
- import { IEntitySnapshot } from "../../entities/entity-snapshot";
4
- import { IJsonSerializer } from "../../utils/json-serializer";
5
- /**
6
- * The ISystemContextSnapshot is the access point for Snapshot related APIs.
7
- * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
8
- */
9
- export interface ISystemContextSnapshot {
10
- readonly appliedSnapshot: IEntitySnapshot;
11
- readonly serializer: IJsonSerializer;
12
- applySnapshot(snapshot: IEntitySnapshot): void;
13
- createSnapshot(entity?: IEntity): IEntitySnapshot;
14
- dispatchSnapshot(snapshot: IEntitySnapshot, proxy?: IEntityProxy): void;
15
- }
1
+ import { IEntity } from "../../entities/entity";
2
+ import { IEntityProxy } from "../../entities/entity-proxies";
3
+ import { IEntitySnapshot } from "../../entities/entity-snapshot";
4
+ import { IJsonSerializer } from "../../utils/json-serializer";
5
+ /**
6
+ * The ISystemContextSnapshot is the access point for Snapshot related APIs.
7
+ * The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
8
+ */
9
+ export interface ISystemContextSnapshot {
10
+ readonly appliedSnapshot: IEntitySnapshot;
11
+ readonly serializer: IJsonSerializer;
12
+ applySnapshot(snapshot: IEntitySnapshot): void;
13
+ createSnapshot(entity?: IEntity): IEntitySnapshot;
14
+ dispatchSnapshot(snapshot: IEntitySnapshot, proxy?: IEntityProxy): void;
15
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-context-snapshot.js.map
@@ -1,18 +1,18 @@
1
- import { IEntity } from "../../entities/entity";
2
- import { IEntityUpdate } from "../../entities/entity-queue";
3
- import { IEntityRepository } from "../../entities/entity-repository";
4
- import { IPipeline } from "../../pipelines/pipeline";
5
- import { ISystemPipelineContext } from "../system-pipeline-context";
6
- import { SystemPipelineType } from "../system-pipeline-type";
7
- /**
8
- * The ISystemsRuntimeContext is the Context passed by a SystemsRuntimePipeline.
9
- * It helps orchestrate the execution of SystemPipelines registered in the SystemsModule.
10
- */
11
- export interface ISystemsRuntimeContext<TEntity extends IEntity> {
12
- readonly entityRepository: IEntityRepository;
13
- readonly entityUpdate: IEntityUpdate;
14
- readonly initializeEntity?: boolean;
15
- readonly allowedSteps: Map<SystemPipelineType, boolean>;
16
- readonly pipelineContext: ISystemPipelineContext<TEntity>;
17
- readonly systemPipelines: ReadonlyMap<SystemPipelineType, IPipeline<ISystemPipelineContext<TEntity>>>;
18
- }
1
+ import { IEntity } from "../../entities/entity";
2
+ import { IEntityUpdate } from "../../entities/entity-queue";
3
+ import { IEntityRepository } from "../../entities/entity-repository";
4
+ import { IPipeline } from "../../pipelines/pipeline";
5
+ import { ISystemPipelineContext } from "../system-pipeline-context";
6
+ import { SystemPipelineType } from "../system-pipeline-type";
7
+ /**
8
+ * The ISystemsRuntimeContext is the Context passed by a SystemsRuntimePipeline.
9
+ * It helps orchestrate the execution of SystemPipelines registered in the SystemsModule.
10
+ */
11
+ export interface ISystemsRuntimeContext<TEntity extends IEntity> {
12
+ readonly entityRepository: IEntityRepository;
13
+ readonly entityUpdate: IEntityUpdate;
14
+ readonly initializeEntity?: boolean;
15
+ readonly allowedSteps: Map<SystemPipelineType, boolean>;
16
+ readonly pipelineContext: ISystemPipelineContext<TEntity>;
17
+ readonly systemPipelines: ReadonlyMap<SystemPipelineType, IPipeline<ISystemPipelineContext<TEntity>>>;
18
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=systems-runtime-context.js.map
@@ -1,8 +1,8 @@
1
- import { IEntity } from "../../entities/entity";
2
- import { IMiddleware } from "../../pipelines/middleware";
3
- import { ISystemsRuntimeContext } from "./systems-runtime-context";
4
- /**
5
- * The ISystemsRuntimeMiddleware represents the building blocks of executing SystemsModule registered Pipelines.
6
- * It receives the current State in the Context, and can decide which SystemPipelines to execute.
7
- */
8
- export type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
1
+ import { IEntity } from "../../entities/entity";
2
+ import { IMiddleware } from "../../pipelines/middleware";
3
+ import { ISystemsRuntimeContext } from "./systems-runtime-context";
4
+ /**
5
+ * The ISystemsRuntimeMiddleware represents the building blocks of executing SystemsModule registered Pipelines.
6
+ * It receives the current State in the Context, and can decide which SystemPipelines to execute.
7
+ */
8
+ export type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=systems-runtime-middleware.js.map
@@ -1,21 +1,21 @@
1
- import { IEntity } from "../entities/entity";
2
- import { ISystemContextEvents } from "./context/system-context-events";
3
- import { ISystemContextProxies } from "./context/system-context-proxies";
4
- import { ISystemContextRepository } from "./context/system-context-repository";
5
- import { ISystemContextScheduler } from "./context/system-context-scheduler";
6
- import { ISystemContextSnapshot } from "./context/system-context-snapshot";
7
- /**
8
- * The ISystemPipelineContext is the Context passed to a SystemMiddleware as part of the Pipeline Dispatch.
9
- * It's an abstraction layer so that the Middleware code won't have explicit dependencies on other parts of the ECS.
10
- *
11
- * Any State changes done by the SystemMiddleware are executed using the APIs provided by the ISystemPipelineContext.
12
- */
13
- export interface ISystemPipelineContext<TEntity extends IEntity> {
14
- readonly deltaTimeMs: number;
15
- readonly entity: Readonly<TEntity>;
16
- readonly events: Readonly<ISystemContextEvents>;
17
- readonly proxies: Readonly<ISystemContextProxies>;
18
- readonly repository: Readonly<ISystemContextRepository>;
19
- readonly scheduler: Readonly<ISystemContextScheduler>;
20
- readonly snapshot: Readonly<ISystemContextSnapshot>;
21
- }
1
+ import { IEntity } from "../entities/entity";
2
+ import { ISystemContextEvents } from "./context/system-context-events";
3
+ import { ISystemContextProxies } from "./context/system-context-proxies";
4
+ import { ISystemContextRepository } from "./context/system-context-repository";
5
+ import { ISystemContextScheduler } from "./context/system-context-scheduler";
6
+ import { ISystemContextSnapshot } from "./context/system-context-snapshot";
7
+ /**
8
+ * The ISystemPipelineContext is the Context passed to a SystemMiddleware as part of the Pipeline Dispatch.
9
+ * It's an abstraction layer so that the Middleware code won't have explicit dependencies on other parts of the ECS.
10
+ *
11
+ * Any State changes done by the SystemMiddleware are executed using the APIs provided by the ISystemPipelineContext.
12
+ */
13
+ export interface ISystemPipelineContext<TEntity extends IEntity> {
14
+ readonly deltaTimeMs: number;
15
+ readonly entity: Readonly<TEntity>;
16
+ readonly events: Readonly<ISystemContextEvents>;
17
+ readonly proxies: Readonly<ISystemContextProxies>;
18
+ readonly repository: Readonly<ISystemContextRepository>;
19
+ readonly scheduler: Readonly<ISystemContextScheduler>;
20
+ readonly snapshot: Readonly<ISystemContextSnapshot>;
21
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-pipeline-context.js.map
@@ -1,8 +1,8 @@
1
- import { IEntity } from "../entities/entity";
2
- import { IMiddleware } from "../pipelines/middleware";
3
- import { ISystemPipelineContext } from "./system-pipeline-context";
4
- /**
5
- * The SystemMiddleware is the basic System implementation that can be registered as a Middleware in a SystemPipeline.
6
- * It provides a SystemPipelineContext to it's exposed methods.
7
- */
8
- export type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemPipelineContext<TEntity>>;
1
+ import { IEntity } from "../entities/entity";
2
+ import { IMiddleware } from "../pipelines/middleware";
3
+ import { ISystemPipelineContext } from "./system-pipeline-context";
4
+ /**
5
+ * The SystemMiddleware is the basic System implementation that can be registered as a Middleware in a SystemPipeline.
6
+ * It provides a SystemPipelineContext to it's exposed methods.
7
+ */
8
+ export type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemPipelineContext<TEntity>>;
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=system-pipeline-middleware.js.map
@@ -1,10 +1,10 @@
1
- /**
2
- * The built-in ECS pipeline types. They can be extended to introduce more types, and the SystemRuntimePipeline should
3
- * add Middlewares to handle the newly added types.
4
- */
5
- export declare enum SystemPipelineType {
6
- initialize = "initialize",
7
- update = "update",
8
- render = "render",
9
- sync = "sync"
10
- }
1
+ /**
2
+ * The built-in ECS pipeline types. They can be extended to introduce more types, and the SystemRuntimePipeline should
3
+ * add Middlewares to handle the newly added types.
4
+ */
5
+ export declare enum SystemPipelineType {
6
+ initialize = "initialize",
7
+ update = "update",
8
+ render = "render",
9
+ sync = "sync"
10
+ }
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SystemPipelineType = void 0;
4
- /**
5
- * The built-in ECS pipeline types. They can be extended to introduce more types, and the SystemRuntimePipeline should
6
- * add Middlewares to handle the newly added types.
7
- */
8
- var SystemPipelineType;
9
- (function (SystemPipelineType) {
10
- SystemPipelineType["initialize"] = "initialize";
11
- SystemPipelineType["update"] = "update";
12
- SystemPipelineType["render"] = "render";
13
- SystemPipelineType["sync"] = "sync";
14
- })(SystemPipelineType = exports.SystemPipelineType || (exports.SystemPipelineType = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SystemPipelineType = void 0;
4
+ /**
5
+ * The built-in ECS pipeline types. They can be extended to introduce more types, and the SystemRuntimePipeline should
6
+ * add Middlewares to handle the newly added types.
7
+ */
8
+ var SystemPipelineType;
9
+ (function (SystemPipelineType) {
10
+ SystemPipelineType["initialize"] = "initialize";
11
+ SystemPipelineType["update"] = "update";
12
+ SystemPipelineType["render"] = "render";
13
+ SystemPipelineType["sync"] = "sync";
14
+ })(SystemPipelineType = exports.SystemPipelineType || (exports.SystemPipelineType = {}));
15
15
  //# sourceMappingURL=system-pipeline-type.js.map
@@ -1,22 +1,22 @@
1
- import { IEntity } from "../entities/entity";
2
- import { IEntityUpdate } from "../entities/entity-queue";
3
- import { IRuntimeResult } from "../runtime/runtime-result";
4
- import { ISystemMiddleware } from "./system-pipeline-middleware";
5
- import { SystemPipelineType } from "./system-pipeline-type";
6
- /**
7
- * The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
8
- * It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
9
- */
10
- export interface ISystemsModule<TEntity extends IEntity> {
11
- /**
12
- * @param type The SystemPipelineType to append the provided SystemMiddlewares to.
13
- * @param systems The SystemMiddlewares will be registered in the provided SystemPipelineType in the same order as the provided array.
14
- * The SystemMiddlewares will be appended to existing Pipelines to allow easy extension of existing behaviors.
15
- */
16
- registerSystems(type: SystemPipelineType, systems: ISystemMiddleware<TEntity>[]): void;
17
- /**
18
- * Trigger all registered SystemPipelines, to apply the changes from the provided EntityUpdate to an Entity instance.
19
- * @param update The EntityUpdate containing the desired changes to be applied on an Entity instance.
20
- */
21
- triggerSystems(update: IEntityUpdate): IRuntimeResult | Promise<IRuntimeResult>;
22
- }
1
+ import { IEntity } from "../entities/entity";
2
+ import { IEntityUpdate } from "../entities/entity-queue";
3
+ import { IRuntimeResult } from "../runtime/runtime-result";
4
+ import { ISystemMiddleware } from "./system-pipeline-middleware";
5
+ import { SystemPipelineType } from "./system-pipeline-type";
6
+ /**
7
+ * The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
8
+ * It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
9
+ */
10
+ export interface ISystemsModule<TEntity extends IEntity> {
11
+ /**
12
+ * @param type The SystemPipelineType to append the provided SystemMiddlewares to.
13
+ * @param systems The SystemMiddlewares will be registered in the provided SystemPipelineType in the same order as the provided array.
14
+ * The SystemMiddlewares will be appended to existing Pipelines to allow easy extension of existing behaviors.
15
+ */
16
+ registerSystems(type: SystemPipelineType, systems: ISystemMiddleware<TEntity>[]): void;
17
+ /**
18
+ * Trigger all registered SystemPipelines, to apply the changes from the provided EntityUpdate to an Entity instance.
19
+ * @param update The EntityUpdate containing the desired changes to be applied on an Entity instance.
20
+ */
21
+ triggerSystems(update: IEntityUpdate): IRuntimeResult | Promise<IRuntimeResult>;
22
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=systems-module.js.map
@@ -1,16 +1,16 @@
1
- import { IEntityUpdate } from "../entities/entity-queue";
2
- import { IRuntimeResult } from "../runtime/runtime-result";
3
- /**
4
- * The System Runtime allows running a loop of Ticks.
5
- *
6
- * Each RunTick can process one or more Entity Updates, from the EntityQueue.
7
- * We can have multiple implementations of a SystemRuntime, based on the use-case.
8
- * A different implementation can be chosen at runtime, based for example on performance.
9
- */
10
- export interface ISystemsRuntime {
11
- /**
12
- * The method should trigger the SystemsModule logic for the provided IEntityUpdate.
13
- * If no EntityUpdate is given, the SystemRuntime implementation can choose to dequeue one from the IEntityUpdateQueue.
14
- */
15
- runTick(update?: IEntityUpdate): IRuntimeResult | Promise<IRuntimeResult>;
16
- }
1
+ import { IEntityUpdate } from "../entities/entity-queue";
2
+ import { IRuntimeResult } from "../runtime/runtime-result";
3
+ /**
4
+ * The System Runtime allows running a loop of Ticks.
5
+ *
6
+ * Each RunTick can process one or more Entity Updates, from the EntityQueue.
7
+ * We can have multiple implementations of a SystemRuntime, based on the use-case.
8
+ * A different implementation can be chosen at runtime, based for example on performance.
9
+ */
10
+ export interface ISystemsRuntime {
11
+ /**
12
+ * The method should trigger the SystemsModule logic for the provided IEntityUpdate.
13
+ * If no EntityUpdate is given, the SystemRuntime implementation can choose to dequeue one from the IEntityUpdateQueue.
14
+ */
15
+ runTick(update?: IEntityUpdate): IRuntimeResult | Promise<IRuntimeResult>;
16
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=systems-runtime.js.map
@@ -1,7 +1,7 @@
1
- /**
2
- * A custom `IJsonSerializer` implementation can provide different ways of serializing objects.
3
- */
4
- export interface IJsonSerializer {
5
- serializeCustom(value: object): string;
6
- parseCustom<TObject>(text: string): TObject;
7
- }
1
+ /**
2
+ * A custom `IJsonSerializer` implementation can provide different ways of serializing objects.
3
+ */
4
+ export interface IJsonSerializer {
5
+ serializeCustom(value: object): string;
6
+ parseCustom<TObject>(text: string): TObject;
7
+ }
@@ -1,4 +1,4 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  //# sourceMappingURL=json-serializer.js.map
@@ -1,11 +1,11 @@
1
- export type PerformanceTimerUid = number;
2
- export interface PerformanceTimeEntry {
3
- name: string;
4
- startedAt: number;
5
- endedAt?: number;
6
- msPassed?: number;
7
- }
8
- export interface IPerformanceTimer {
9
- startTimer(name: string): PerformanceTimerUid;
10
- endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
11
- }
1
+ export type PerformanceTimerUid = number;
2
+ export interface PerformanceTimeEntry {
3
+ name: string;
4
+ startedAt: number;
5
+ endedAt?: number;
6
+ msPassed?: number;
7
+ }
8
+ export interface IPerformanceTimer {
9
+ startTimer(name: string): PerformanceTimerUid;
10
+ endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
11
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=performance-timer.js.map
@@ -1,18 +1,21 @@
1
- export type Mutable<T> = {
2
- -readonly [K in keyof T]: T[K];
3
- };
4
- export type MutableDeep<T> = {
5
- -readonly [K in keyof T]: Mutable<T[K]>;
6
- };
7
- type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
8
- export type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
9
- export type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
10
- export type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
11
- export type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
12
- export type ImmutableObject<T> = {
13
- readonly [K in keyof T]: T[K];
14
- };
15
- export type ImmutableObjectDeep<T> = {
16
- readonly [K in keyof T]: Immutable<T[K]>;
17
- };
18
- export {};
1
+ export type BooleanProps<T> = {
2
+ [Property in keyof T]: boolean;
3
+ };
4
+ export type Mutable<T> = {
5
+ -readonly [K in keyof T]: T[K];
6
+ };
7
+ export type MutableDeep<T> = {
8
+ -readonly [K in keyof T]: Mutable<T[K]>;
9
+ };
10
+ type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
11
+ export type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
12
+ export type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
13
+ export type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
14
+ export type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
15
+ export type ImmutableObject<T> = {
16
+ readonly [K in keyof T]: T[K];
17
+ };
18
+ export type ImmutableObjectDeep<T> = {
19
+ readonly [K in keyof T]: Immutable<T[K]>;
20
+ };
21
+ export {};