@awesome-ecs/abstract 0.20.1 → 0.20.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.
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/entities/index.cjs.map +1 -1
- package/dist/entities/index.d.cts +21 -4
- package/dist/entities/index.d.ts +21 -4
- package/dist/entities/index.js.map +1 -1
- package/dist/entity-repository-BlSpo-x2.d.ts +253 -0
- package/dist/entity-repository-DJ1xbvaN.d.cts +253 -0
- package/dist/factories/index.d.cts +40 -10
- package/dist/factories/index.d.ts +40 -10
- package/dist/index-B1KXekZD.d.ts +199 -0
- package/dist/index-CnlpX7ys.d.cts +199 -0
- package/dist/performance-timer-BVyl0SRs.d.cts +45 -0
- package/dist/performance-timer-BVyl0SRs.d.ts +45 -0
- package/dist/pipeline-BGsQiSer.d.ts +161 -0
- package/dist/pipeline-DunwPUPZ.d.cts +161 -0
- package/dist/pipelines/index.cjs.map +1 -1
- package/dist/pipelines/index.d.cts +23 -11
- package/dist/pipelines/index.d.ts +23 -11
- package/dist/pipelines/index.js.map +1 -1
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +58 -19
- package/dist/systems/index.d.ts +58 -19
- package/dist/systems/index.js.map +1 -1
- package/dist/systems-runtime-context-BTNdV8Z-.d.ts +330 -0
- package/dist/systems-runtime-context-DhtHMczN.d.cts +330 -0
- package/dist/types-cZ-1lGPD.d.cts +77 -0
- package/dist/types-cZ-1lGPD.d.ts +77 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +63 -3
- package/dist/utils/index.d.ts +63 -3
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/entity-repository-BASmOrq7.d.ts +0 -120
- package/dist/entity-repository-DmfcUSrX.d.cts +0 -120
- package/dist/index-BPDsRt_F.d.ts +0 -117
- package/dist/index-DK2CXVZ8.d.cts +0 -117
- package/dist/performance-timer-XvdCbcAE.d.cts +0 -13
- package/dist/performance-timer-XvdCbcAE.d.ts +0 -13
- package/dist/pipeline-BowCAITe.d.cts +0 -83
- package/dist/pipeline-D43CXxWG.d.ts +0 -83
- package/dist/systems-runtime-context-CDVzeB9f.d.ts +0 -162
- package/dist/systems-runtime-context-CpgxOdc8.d.cts +0 -162
- package/dist/types-BNwBqRWY.d.cts +0 -22
- package/dist/types-BNwBqRWY.d.ts +0 -22
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { P as PerformanceTimeEntry } from './performance-timer-XvdCbcAE.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The PipelineResult can provide Performance metrics collected from self or inner middleware & pipeline calls.
|
|
5
|
-
*/
|
|
6
|
-
type PipelineResult = {
|
|
7
|
-
readonly performance?: PerformanceTimeEntry;
|
|
8
|
-
readonly inner?: PipelineResult[];
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The MiddlewareResult can provide Pipeline Results inner pipeline calls.
|
|
13
|
-
*/
|
|
14
|
-
type MiddlewareResult = void | PipelineResult;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The PipelineStatus tracks the current status of the pipeline.
|
|
18
|
-
*/
|
|
19
|
-
declare enum PipelineStatus {
|
|
20
|
-
idle = "idle",
|
|
21
|
-
ongoing = "ongoing",
|
|
22
|
-
completed = "completed",
|
|
23
|
-
halted = "halted"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The Pipeline Context allows exposing state to the Pipeline's middlewares.
|
|
28
|
-
*/
|
|
29
|
-
interface IPipelineContext {
|
|
30
|
-
readonly runtime: PipelineRuntime;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The Pipeline Runtime exposes runtime status controls for Middlewares, as part of tbe PipelineContext.
|
|
34
|
-
*/
|
|
35
|
-
type PipelineRuntime = {
|
|
36
|
-
shouldStop: boolean;
|
|
37
|
-
status?: PipelineStatus;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A middleware, the building block of a Pipeline. The middlewares will provide a unit-of-work implementation
|
|
42
|
-
* dealing with potential state changes over the input Context, or running cleanup logic over the input Context.
|
|
43
|
-
*/
|
|
44
|
-
interface IMiddleware<TContext extends IPipelineContext, TResult = MiddlewareResult> {
|
|
45
|
-
readonly name?: string;
|
|
46
|
-
/**
|
|
47
|
-
* This (optional) function gets called before executing the middleware. It acts as a boolean gateway whether enough conditions are
|
|
48
|
-
* being met so this middleware's action should run.
|
|
49
|
-
* @param context The Context to determine whether the run condition is satisfied.
|
|
50
|
-
*/
|
|
51
|
-
shouldRun?(context: TContext): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* The function gets called as part of the pipeline, based on the registration order.
|
|
54
|
-
* @param context The Context can be read or updated. The Context holds all the state necessary for the execution of the middleware.
|
|
55
|
-
*/
|
|
56
|
-
action(context: TContext): TResult;
|
|
57
|
-
/**
|
|
58
|
-
* This (optional) function gets called when the cleanup of the Pipeline is necessary, based on reverse order of Middleware registration.
|
|
59
|
-
* @param context Part of the Context should be cleaned, and any allocated resources in the Action, should be disposed.
|
|
60
|
-
*/
|
|
61
|
-
cleanup?(context: TContext): TResult;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* An {@link IMiddleware} container and dispatcher.
|
|
66
|
-
*/
|
|
67
|
-
interface IPipeline<TContext extends IPipelineContext, TResult = MiddlewareResult> {
|
|
68
|
-
readonly name?: string;
|
|
69
|
-
/**
|
|
70
|
-
* Register middleware for this pipeline.
|
|
71
|
-
*/
|
|
72
|
-
use(middleware: IMiddleware<TContext, TResult>): this;
|
|
73
|
-
/**
|
|
74
|
-
* Execute the Dispatch on the chain of middleware, with the given Context.
|
|
75
|
-
*/
|
|
76
|
-
dispatch(context: TContext): PipelineResult;
|
|
77
|
-
/**
|
|
78
|
-
* Execute the Cleanup on the chain of middleware, with the given Context.
|
|
79
|
-
*/
|
|
80
|
-
cleanup(context: TContext): PipelineResult;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export { type IPipelineContext as I, type MiddlewareResult as M, type PipelineResult as P, type IPipeline as a, type IMiddleware as b, type PipelineRuntime as c, PipelineStatus as d };
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { c as IEntity, I as IEntityProxy, E as EntityTypeUid, b as IEntityModel, d as EntityProxy } from './index-BPDsRt_F.js';
|
|
2
|
-
import { f as IEntityUpdate, I as IEventData, E as EntityEventUid, b as IEntityEvent, i as IEntitySnapshot, h as IEntityRepository } from './entity-repository-BASmOrq7.js';
|
|
3
|
-
import { I as IPipelineContext, a as IPipeline } from './pipeline-D43CXxWG.js';
|
|
4
|
-
import { I as Immutable } from './types-BNwBqRWY.js';
|
|
5
|
-
import { IJsonSerializer, ILogger } from './utils/index.js';
|
|
6
|
-
|
|
7
|
-
interface ISystemContextEntity {
|
|
8
|
-
readonly entity: Immutable<IEntity>;
|
|
9
|
-
readonly update: Immutable<IEntityUpdate>;
|
|
10
|
-
setEntity(entity: IEntity): void;
|
|
11
|
-
setUpdate(update: IEntityUpdate): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The ISystemContextEvents is the access point for Event related APIs.
|
|
16
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
17
|
-
*/
|
|
18
|
-
interface ISystemContextEvents {
|
|
19
|
-
/**
|
|
20
|
-
* Dispatches and schedules the Event to it's Subscribers or provided Entity Targets.
|
|
21
|
-
* @param data The EventData to dispatch.
|
|
22
|
-
* @param targets (optional) The Entities to send this event to. Providing this parameter will not broadcast this event.
|
|
23
|
-
*/
|
|
24
|
-
dispatchEvent<TEventData extends IEventData>(data: TEventData, ...targets: IEntityProxy[]): void;
|
|
25
|
-
/**
|
|
26
|
-
* Dispatches and schedules the Events to their Subscribers or provided Entity Targets.
|
|
27
|
-
* @param data The EventData Array to dispatch.
|
|
28
|
-
* @param targets (optional) The Entities to send this event to. Providing this parameter will not broadcast this event.
|
|
29
|
-
*/
|
|
30
|
-
dispatchEvents<TEventData extends IEventData>(data: TEventData[], ...targets: IEntityProxy[]): void;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves the Event with the given UID if it has been previously set on the current Context.
|
|
33
|
-
* @param uid The Event UID to retrieve.
|
|
34
|
-
*/
|
|
35
|
-
getEvent<TEventData extends IEventData>(uid: EntityEventUid): IEntityEvent<TEventData>;
|
|
36
|
-
/**
|
|
37
|
-
* Retrieves all the Events currently set on the Context.
|
|
38
|
-
*/
|
|
39
|
-
listEvents<TEventData extends IEventData>(): IEntityEvent<TEventData>[];
|
|
40
|
-
/**
|
|
41
|
-
* Returns whether the Event with the given UID has previously been set on the current Context.
|
|
42
|
-
* @param uid The Event UID to check for existence.
|
|
43
|
-
*/
|
|
44
|
-
hasEvent(uid?: EntityEventUid): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Subscribes to Events with the given UID. When the matching Event is dispatched,
|
|
47
|
-
* the Entity update loop will set this Event on the Pipeline Context.
|
|
48
|
-
* @param uid The Event UID to subscribe to.
|
|
49
|
-
* @param filter (optional) Provides a callback function that will be executed on all matching Events.
|
|
50
|
-
* Can be used to filter what Event to schedule through to the current Entity update.
|
|
51
|
-
*/
|
|
52
|
-
subscribeTo<TEventData extends IEventData>(uid: EntityEventUid, filter?: (event: IEntityEvent<TEventData>) => boolean): void;
|
|
53
|
-
/**
|
|
54
|
-
* Stops subscribing to Events with the given UID. The Entity will not receive any future Events with this UID.
|
|
55
|
-
* @param uid The Event UID to stop listening to.
|
|
56
|
-
*/
|
|
57
|
-
unsubscribeFrom(uid: EntityEventUid): void;
|
|
58
|
-
/**
|
|
59
|
-
* Adds the given Events into the Context instance.
|
|
60
|
-
* @param events The Event instances to be set on the Context.
|
|
61
|
-
*/
|
|
62
|
-
setContextEvents(events: IEntityEvent<IEventData>[]): void;
|
|
63
|
-
/**
|
|
64
|
-
* Adds the given Event into the Context instance.
|
|
65
|
-
* @param event The Event instance to be set on the Context.
|
|
66
|
-
*/
|
|
67
|
-
setContextEvent(event: IEntityEvent<IEventData>): void;
|
|
68
|
-
/**
|
|
69
|
-
* Removes all the Events currently set on the Context instance.
|
|
70
|
-
*/
|
|
71
|
-
clearContextEvents(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Removes all the Event Subscriptions for the current Entity.
|
|
74
|
-
*/
|
|
75
|
-
clearSubscriptions(): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* The ISystemContextProxies is the access point for EntityProxy related APIs.
|
|
80
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
81
|
-
*/
|
|
82
|
-
interface ISystemContextProxies {
|
|
83
|
-
registerProxy(proxy: IEntityProxy, cleanup?: boolean): void;
|
|
84
|
-
registerProxies(proxies: IEntityProxy[], cleanup?: boolean): void;
|
|
85
|
-
removeProxy(proxy: IEntityProxy): void;
|
|
86
|
-
removeProxies(proxyEntityType?: EntityTypeUid): void;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The `ISystemContextRepository` is the access point for the `IEntityRepository` related APIs.
|
|
91
|
-
*
|
|
92
|
-
* The access is made in an `ISystemMiddleware` through the provided `ISystemPipelineContext`.
|
|
93
|
-
*/
|
|
94
|
-
interface ISystemContextRepository {
|
|
95
|
-
addEntity(entityType: EntityTypeUid, model: IEntityModel, snapshot?: IEntitySnapshot): void;
|
|
96
|
-
getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity>): Immutable<TEntity>;
|
|
97
|
-
updateEntity(target?: IEntityProxy): void;
|
|
98
|
-
removeEntity(target: IEntityProxy): void;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The ISystemContextRepository is the access point for Scheduler related APIs.
|
|
103
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
104
|
-
*/
|
|
105
|
-
interface ISystemContextScheduler {
|
|
106
|
-
scheduleUpdate(target?: IEntityProxy, intervalMs?: number): void;
|
|
107
|
-
removeSchedule(target?: IEntityProxy): void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* The ISystemContextSnapshot is the access point for Snapshot related APIs.
|
|
112
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
113
|
-
*/
|
|
114
|
-
interface ISystemContextSnapshot {
|
|
115
|
-
readonly serializer: Immutable<IJsonSerializer>;
|
|
116
|
-
applyToEntity(snapshot: IEntitySnapshot): void;
|
|
117
|
-
createFromEntity(entity?: IEntity): IEntitySnapshot;
|
|
118
|
-
dispatchToUpdate(snapshot: IEntitySnapshot, proxy?: IEntityProxy): void;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The ISystemContext is the Context passed to a SystemMiddleware as part of the Pipeline Dispatch.
|
|
123
|
-
* It's an abstraction layer so that the Middleware code won't have explicit dependencies on other parts of the ECS.
|
|
124
|
-
*
|
|
125
|
-
* Any State changes done by the SystemMiddleware are executed using the APIs provided by the ISystemContext.
|
|
126
|
-
*/
|
|
127
|
-
interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
128
|
-
readonly deltaTimeMs: Immutable<number>;
|
|
129
|
-
readonly entity: Immutable<TEntity>;
|
|
130
|
-
readonly update: Immutable<IEntityUpdate>;
|
|
131
|
-
readonly events: Immutable<ISystemContextEvents>;
|
|
132
|
-
readonly proxies: Immutable<ISystemContextProxies>;
|
|
133
|
-
readonly repository: Immutable<ISystemContextRepository>;
|
|
134
|
-
readonly scheduler: Immutable<ISystemContextScheduler>;
|
|
135
|
-
readonly snapshot: Immutable<ISystemContextSnapshot>;
|
|
136
|
-
readonly logger: Immutable<ILogger>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* The built-in ECS pipeline types. They can be extended to introduce more types, and the System Runtime Pipeline should
|
|
141
|
-
* add Middleware to handle the newly added types.
|
|
142
|
-
*/
|
|
143
|
-
declare enum SystemType {
|
|
144
|
-
initialize = "initialize",
|
|
145
|
-
update = "update",
|
|
146
|
-
render = "render",
|
|
147
|
-
sync = "sync"
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* The ISystemsRuntimeContext is the Context passed by a SystemsRuntimePipeline.
|
|
152
|
-
* It helps orchestrate the execution of SystemPipelines registered in the SystemsModule.
|
|
153
|
-
*/
|
|
154
|
-
interface ISystemsRuntimeContext<TEntity extends IEntity> extends IPipelineContext {
|
|
155
|
-
readonly allowedSteps: Set<SystemType>;
|
|
156
|
-
readonly entityProvider: ISystemContextEntity;
|
|
157
|
-
readonly entityRepository: IEntityRepository;
|
|
158
|
-
readonly systemPipelines: Map<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
159
|
-
readonly systemContext: ISystemContext<TEntity>;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export { type ISystemsRuntimeContext as I, SystemType as S, type ISystemContext as a, type ISystemContextEntity as b, type ISystemContextEvents as c, type ISystemContextProxies as d, type ISystemContextRepository as e, type ISystemContextScheduler as f, type ISystemContextSnapshot as g };
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { c as IEntity, I as IEntityProxy, E as EntityTypeUid, b as IEntityModel, d as EntityProxy } from './index-DK2CXVZ8.cjs';
|
|
2
|
-
import { f as IEntityUpdate, I as IEventData, E as EntityEventUid, b as IEntityEvent, i as IEntitySnapshot, h as IEntityRepository } from './entity-repository-DmfcUSrX.cjs';
|
|
3
|
-
import { I as IPipelineContext, a as IPipeline } from './pipeline-BowCAITe.cjs';
|
|
4
|
-
import { I as Immutable } from './types-BNwBqRWY.cjs';
|
|
5
|
-
import { IJsonSerializer, ILogger } from './utils/index.cjs';
|
|
6
|
-
|
|
7
|
-
interface ISystemContextEntity {
|
|
8
|
-
readonly entity: Immutable<IEntity>;
|
|
9
|
-
readonly update: Immutable<IEntityUpdate>;
|
|
10
|
-
setEntity(entity: IEntity): void;
|
|
11
|
-
setUpdate(update: IEntityUpdate): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The ISystemContextEvents is the access point for Event related APIs.
|
|
16
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
17
|
-
*/
|
|
18
|
-
interface ISystemContextEvents {
|
|
19
|
-
/**
|
|
20
|
-
* Dispatches and schedules the Event to it's Subscribers or provided Entity Targets.
|
|
21
|
-
* @param data The EventData to dispatch.
|
|
22
|
-
* @param targets (optional) The Entities to send this event to. Providing this parameter will not broadcast this event.
|
|
23
|
-
*/
|
|
24
|
-
dispatchEvent<TEventData extends IEventData>(data: TEventData, ...targets: IEntityProxy[]): void;
|
|
25
|
-
/**
|
|
26
|
-
* Dispatches and schedules the Events to their Subscribers or provided Entity Targets.
|
|
27
|
-
* @param data The EventData Array to dispatch.
|
|
28
|
-
* @param targets (optional) The Entities to send this event to. Providing this parameter will not broadcast this event.
|
|
29
|
-
*/
|
|
30
|
-
dispatchEvents<TEventData extends IEventData>(data: TEventData[], ...targets: IEntityProxy[]): void;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves the Event with the given UID if it has been previously set on the current Context.
|
|
33
|
-
* @param uid The Event UID to retrieve.
|
|
34
|
-
*/
|
|
35
|
-
getEvent<TEventData extends IEventData>(uid: EntityEventUid): IEntityEvent<TEventData>;
|
|
36
|
-
/**
|
|
37
|
-
* Retrieves all the Events currently set on the Context.
|
|
38
|
-
*/
|
|
39
|
-
listEvents<TEventData extends IEventData>(): IEntityEvent<TEventData>[];
|
|
40
|
-
/**
|
|
41
|
-
* Returns whether the Event with the given UID has previously been set on the current Context.
|
|
42
|
-
* @param uid The Event UID to check for existence.
|
|
43
|
-
*/
|
|
44
|
-
hasEvent(uid?: EntityEventUid): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Subscribes to Events with the given UID. When the matching Event is dispatched,
|
|
47
|
-
* the Entity update loop will set this Event on the Pipeline Context.
|
|
48
|
-
* @param uid The Event UID to subscribe to.
|
|
49
|
-
* @param filter (optional) Provides a callback function that will be executed on all matching Events.
|
|
50
|
-
* Can be used to filter what Event to schedule through to the current Entity update.
|
|
51
|
-
*/
|
|
52
|
-
subscribeTo<TEventData extends IEventData>(uid: EntityEventUid, filter?: (event: IEntityEvent<TEventData>) => boolean): void;
|
|
53
|
-
/**
|
|
54
|
-
* Stops subscribing to Events with the given UID. The Entity will not receive any future Events with this UID.
|
|
55
|
-
* @param uid The Event UID to stop listening to.
|
|
56
|
-
*/
|
|
57
|
-
unsubscribeFrom(uid: EntityEventUid): void;
|
|
58
|
-
/**
|
|
59
|
-
* Adds the given Events into the Context instance.
|
|
60
|
-
* @param events The Event instances to be set on the Context.
|
|
61
|
-
*/
|
|
62
|
-
setContextEvents(events: IEntityEvent<IEventData>[]): void;
|
|
63
|
-
/**
|
|
64
|
-
* Adds the given Event into the Context instance.
|
|
65
|
-
* @param event The Event instance to be set on the Context.
|
|
66
|
-
*/
|
|
67
|
-
setContextEvent(event: IEntityEvent<IEventData>): void;
|
|
68
|
-
/**
|
|
69
|
-
* Removes all the Events currently set on the Context instance.
|
|
70
|
-
*/
|
|
71
|
-
clearContextEvents(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Removes all the Event Subscriptions for the current Entity.
|
|
74
|
-
*/
|
|
75
|
-
clearSubscriptions(): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* The ISystemContextProxies is the access point for EntityProxy related APIs.
|
|
80
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
81
|
-
*/
|
|
82
|
-
interface ISystemContextProxies {
|
|
83
|
-
registerProxy(proxy: IEntityProxy, cleanup?: boolean): void;
|
|
84
|
-
registerProxies(proxies: IEntityProxy[], cleanup?: boolean): void;
|
|
85
|
-
removeProxy(proxy: IEntityProxy): void;
|
|
86
|
-
removeProxies(proxyEntityType?: EntityTypeUid): void;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The `ISystemContextRepository` is the access point for the `IEntityRepository` related APIs.
|
|
91
|
-
*
|
|
92
|
-
* The access is made in an `ISystemMiddleware` through the provided `ISystemPipelineContext`.
|
|
93
|
-
*/
|
|
94
|
-
interface ISystemContextRepository {
|
|
95
|
-
addEntity(entityType: EntityTypeUid, model: IEntityModel, snapshot?: IEntitySnapshot): void;
|
|
96
|
-
getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity>): Immutable<TEntity>;
|
|
97
|
-
updateEntity(target?: IEntityProxy): void;
|
|
98
|
-
removeEntity(target: IEntityProxy): void;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The ISystemContextRepository is the access point for Scheduler related APIs.
|
|
103
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
104
|
-
*/
|
|
105
|
-
interface ISystemContextScheduler {
|
|
106
|
-
scheduleUpdate(target?: IEntityProxy, intervalMs?: number): void;
|
|
107
|
-
removeSchedule(target?: IEntityProxy): void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* The ISystemContextSnapshot is the access point for Snapshot related APIs.
|
|
112
|
-
* The access is made in a SystemMiddleware through the provided ISystemPipelineContext.
|
|
113
|
-
*/
|
|
114
|
-
interface ISystemContextSnapshot {
|
|
115
|
-
readonly serializer: Immutable<IJsonSerializer>;
|
|
116
|
-
applyToEntity(snapshot: IEntitySnapshot): void;
|
|
117
|
-
createFromEntity(entity?: IEntity): IEntitySnapshot;
|
|
118
|
-
dispatchToUpdate(snapshot: IEntitySnapshot, proxy?: IEntityProxy): void;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The ISystemContext is the Context passed to a SystemMiddleware as part of the Pipeline Dispatch.
|
|
123
|
-
* It's an abstraction layer so that the Middleware code won't have explicit dependencies on other parts of the ECS.
|
|
124
|
-
*
|
|
125
|
-
* Any State changes done by the SystemMiddleware are executed using the APIs provided by the ISystemContext.
|
|
126
|
-
*/
|
|
127
|
-
interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
128
|
-
readonly deltaTimeMs: Immutable<number>;
|
|
129
|
-
readonly entity: Immutable<TEntity>;
|
|
130
|
-
readonly update: Immutable<IEntityUpdate>;
|
|
131
|
-
readonly events: Immutable<ISystemContextEvents>;
|
|
132
|
-
readonly proxies: Immutable<ISystemContextProxies>;
|
|
133
|
-
readonly repository: Immutable<ISystemContextRepository>;
|
|
134
|
-
readonly scheduler: Immutable<ISystemContextScheduler>;
|
|
135
|
-
readonly snapshot: Immutable<ISystemContextSnapshot>;
|
|
136
|
-
readonly logger: Immutable<ILogger>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* The built-in ECS pipeline types. They can be extended to introduce more types, and the System Runtime Pipeline should
|
|
141
|
-
* add Middleware to handle the newly added types.
|
|
142
|
-
*/
|
|
143
|
-
declare enum SystemType {
|
|
144
|
-
initialize = "initialize",
|
|
145
|
-
update = "update",
|
|
146
|
-
render = "render",
|
|
147
|
-
sync = "sync"
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* The ISystemsRuntimeContext is the Context passed by a SystemsRuntimePipeline.
|
|
152
|
-
* It helps orchestrate the execution of SystemPipelines registered in the SystemsModule.
|
|
153
|
-
*/
|
|
154
|
-
interface ISystemsRuntimeContext<TEntity extends IEntity> extends IPipelineContext {
|
|
155
|
-
readonly allowedSteps: Set<SystemType>;
|
|
156
|
-
readonly entityProvider: ISystemContextEntity;
|
|
157
|
-
readonly entityRepository: IEntityRepository;
|
|
158
|
-
readonly systemPipelines: Map<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
159
|
-
readonly systemContext: ISystemContext<TEntity>;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export { type ISystemsRuntimeContext as I, SystemType as S, type ISystemContext as a, type ISystemContextEntity as b, type ISystemContextEvents as c, type ISystemContextProxies as d, type ISystemContextRepository as e, type ISystemContextScheduler as f, type ISystemContextSnapshot as g };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
type BooleanProps<T> = {
|
|
2
|
-
[Property in keyof T]: boolean;
|
|
3
|
-
};
|
|
4
|
-
type Mutable<T> = {
|
|
5
|
-
-readonly [K in keyof T]: T[K];
|
|
6
|
-
};
|
|
7
|
-
type MutableDeep<T> = {
|
|
8
|
-
-readonly [K in keyof T]: Mutable<T[K]>;
|
|
9
|
-
};
|
|
10
|
-
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
11
|
-
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
|
-
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
13
|
-
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
14
|
-
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
15
|
-
type ImmutableObject<T> = {
|
|
16
|
-
readonly [K in keyof T]: T[K];
|
|
17
|
-
};
|
|
18
|
-
type ImmutableObjectDeep<T> = {
|
|
19
|
-
readonly [K in keyof T]: Immutable<T[K]>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
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 };
|
package/dist/types-BNwBqRWY.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
type BooleanProps<T> = {
|
|
2
|
-
[Property in keyof T]: boolean;
|
|
3
|
-
};
|
|
4
|
-
type Mutable<T> = {
|
|
5
|
-
-readonly [K in keyof T]: T[K];
|
|
6
|
-
};
|
|
7
|
-
type MutableDeep<T> = {
|
|
8
|
-
-readonly [K in keyof T]: Mutable<T[K]>;
|
|
9
|
-
};
|
|
10
|
-
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
11
|
-
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
|
-
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
13
|
-
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
14
|
-
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
15
|
-
type ImmutableObject<T> = {
|
|
16
|
-
readonly [K in keyof T]: T[K];
|
|
17
|
-
};
|
|
18
|
-
type ImmutableObjectDeep<T> = {
|
|
19
|
-
readonly [K in keyof T]: Immutable<T[K]>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
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 };
|