@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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as Immutable } from "./types-
|
|
3
|
-
import {
|
|
4
|
-
import { c as IMiddleware, l as IPipelineContext, o as IPipeline, u as
|
|
1
|
+
import { a as IEntity, c as IEntityProxy, i as EntityUid, o as IEntityModel, p as ComponentTypeUid, r as EntityTypeUid, s as EntityProxy, v as ConfigRecord } from "./index-HeCQLTSE.cjs";
|
|
2
|
+
import { r as Immutable } from "./types-COxeVghs.cjs";
|
|
3
|
+
import { b as IEntityConfigSnapshot, h as IEntityEvent, l as IEntitySnapshot, m as EntityEventUid, p as EntityEventSubscriptionOptions, s as IEntityUpdate, v as IEventData } from "./index-0hg5PXZe.cjs";
|
|
4
|
+
import { c as IMiddleware, l as IPipelineContext, o as IPipeline, u as PipelineDispatch } from "./index-Bl7Cf9gi.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/logger.d.ts
|
|
7
7
|
/**
|
|
@@ -142,14 +142,25 @@ type MiddlewareRegistryReadonly = ReadonlyMap<SystemMiddlewareName, SystemModule
|
|
|
142
142
|
* @template TEntity - The entity type this middleware handles.
|
|
143
143
|
*/
|
|
144
144
|
type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
|
|
145
|
+
/**
|
|
146
|
+
* Event-routed middleware. Unlike normal system middleware, event middleware is
|
|
147
|
+
* invoked once per matching event instance and receives that event explicitly.
|
|
148
|
+
*/
|
|
149
|
+
interface ISystemEventMiddleware<TEntity extends IEntity, TEventData extends IEventData = IEventData> {
|
|
150
|
+
readonly name?: string;
|
|
151
|
+
shouldRun?(context: ISystemContext<TEntity>, event: IEntityEvent<TEventData>): boolean;
|
|
152
|
+
action(context: ISystemContext<TEntity>, event: IEntityEvent<TEventData>): void | Promise<void>;
|
|
153
|
+
cleanup?(context: ISystemContext<TEntity>): void | Promise<void>;
|
|
154
|
+
}
|
|
145
155
|
//#endregion
|
|
146
156
|
//#region src/systems/pipeline/system-context-control.d.ts
|
|
157
|
+
interface SystemContextControlTarget {
|
|
158
|
+
readonly name?: string;
|
|
159
|
+
}
|
|
147
160
|
declare enum SystemContextControlState {
|
|
148
161
|
none = "none",
|
|
149
162
|
enableCurrentSystem = "enableCurrentSystem",
|
|
150
|
-
disableCurrentSystem = "disableCurrentSystem"
|
|
151
|
-
enableCurrentModule = "enableCurrentModule",
|
|
152
|
-
disableCurrentModule = "disableCurrentModule"
|
|
163
|
+
disableCurrentSystem = "disableCurrentSystem"
|
|
153
164
|
}
|
|
154
165
|
/**
|
|
155
166
|
* Interface for controlling the execution of systems and modules within a system context.
|
|
@@ -165,13 +176,13 @@ interface ISystemContextControl {
|
|
|
165
176
|
*/
|
|
166
177
|
enableCurrentSystem(): void;
|
|
167
178
|
/**
|
|
168
|
-
* Disables
|
|
179
|
+
* Disables a module for the current entity.
|
|
169
180
|
*/
|
|
170
|
-
|
|
181
|
+
disableModule(name: SystemModuleName): void;
|
|
171
182
|
/**
|
|
172
|
-
* Re-enables
|
|
183
|
+
* Re-enables a module for the current entity.
|
|
173
184
|
*/
|
|
174
|
-
|
|
185
|
+
enableModule(name: SystemModuleName): void;
|
|
175
186
|
}
|
|
176
187
|
/**
|
|
177
188
|
* Extended system context interface that includes control state for middleware to manage system and module execution.
|
|
@@ -187,33 +198,32 @@ interface ISystemContextControlState extends ISystemContextControl {
|
|
|
187
198
|
* @param middleware - The middleware to check for disabled state.
|
|
188
199
|
* @returns True if the specified middleware is currently disabled, false otherwise.
|
|
189
200
|
*/
|
|
190
|
-
isMiddlewareDisabled(middleware:
|
|
201
|
+
isMiddlewareDisabled(middleware: SystemContextControlTarget): boolean;
|
|
191
202
|
/**
|
|
192
203
|
* Disables a specific middleware in the context.
|
|
193
204
|
* @param middleware - The middleware to disable.
|
|
194
205
|
*/
|
|
195
|
-
disableMiddleware(middleware:
|
|
206
|
+
disableMiddleware(middleware: SystemContextControlTarget): void;
|
|
196
207
|
/**
|
|
197
208
|
* Enables a specific middleware in the context.
|
|
198
209
|
* @param middleware - The middleware to enable.
|
|
199
210
|
*/
|
|
200
|
-
enableMiddleware(middleware:
|
|
211
|
+
enableMiddleware(middleware: SystemContextControlTarget): void;
|
|
201
212
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
213
|
+
* Registers an event subscription owned by a module. This is runtime-only state:
|
|
214
|
+
* disabling the module should also detach its event subscriptions.
|
|
204
215
|
*/
|
|
205
|
-
|
|
216
|
+
registerModuleEvent(moduleName: SystemModuleName, eventUid: EntityEventUid, options?: EntityEventSubscriptionOptions): void;
|
|
206
217
|
/**
|
|
207
|
-
*
|
|
208
|
-
* @param middleware - A middleware from the module to enable.
|
|
218
|
+
* Clears all runtime-owned module event subscriptions for the current entity.
|
|
209
219
|
*/
|
|
210
|
-
|
|
220
|
+
clearModuleEvents(): void;
|
|
211
221
|
}
|
|
212
222
|
//#endregion
|
|
213
223
|
//#region src/systems/pipeline/system-context-events.d.ts
|
|
214
224
|
/**
|
|
215
225
|
* System context API for event-driven entity communication.
|
|
216
|
-
*
|
|
226
|
+
* System middleware can dispatch events, while subscriptions are owned by the runtime.
|
|
217
227
|
* Events enable decoupled communication between distant or unrelated entities.
|
|
218
228
|
*/
|
|
219
229
|
interface ISystemContextEvents {
|
|
@@ -243,56 +253,10 @@ interface ISystemContextEvents {
|
|
|
243
253
|
* @param data - Array of event payloads to broadcast.
|
|
244
254
|
*/
|
|
245
255
|
broadcastEvents<TEventData extends IEventData>(data: TEventData[]): void;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
* Useful for checking if an event was received this frame.
|
|
249
|
-
* @param uid - The event type identifier.
|
|
250
|
-
* @returns The event if present, undefined otherwise.
|
|
251
|
-
*/
|
|
252
|
-
getEvent<TEventData extends IEventData>(uid: EntityEventUid): IEntityEvent<TEventData> | undefined;
|
|
253
|
-
/**
|
|
254
|
-
* Retrieves all events currently set on this context.
|
|
255
|
-
* Events are cleared between frames.
|
|
256
|
-
* @returns Array of all active events for this context.
|
|
257
|
-
*/
|
|
258
|
-
listEvents<TEventData extends IEventData>(): IEntityEvent<TEventData>[];
|
|
259
|
-
/**
|
|
260
|
-
* Checks if a specific event is present in the current context.
|
|
261
|
-
* If no uid is provided, checks if any events exist.
|
|
262
|
-
* @param uid - Optional event type to check for. If omitted, checks for any event.
|
|
263
|
-
* @returns True if matching event(s) found, false otherwise.
|
|
264
|
-
*/
|
|
265
|
-
hasEvent(uid?: EntityEventUid): boolean;
|
|
266
|
-
/**
|
|
267
|
-
* Subscribes to events of a specific type.
|
|
268
|
-
* The entity will be notified of matching events through the update system.
|
|
269
|
-
* @param uid - The event type to listen for.
|
|
270
|
-
* @param options - Optional subscription options (filter, scopeId).
|
|
271
|
-
*/
|
|
256
|
+
}
|
|
257
|
+
interface IMutableSystemContextEvents extends ISystemContextEvents {
|
|
272
258
|
subscribeTo(uid: EntityEventUid, options?: EntityEventSubscriptionOptions): void;
|
|
273
|
-
/**
|
|
274
|
-
* Stops listening for events of a specific type.
|
|
275
|
-
* @param uid - The event type to stop listening for.
|
|
276
|
-
*/
|
|
277
259
|
unsubscribeFrom(uid: EntityEventUid): void;
|
|
278
|
-
/**
|
|
279
|
-
* Adds events to the current context for processing by this and downstream middleware.
|
|
280
|
-
* @param events - Event array to add to context.
|
|
281
|
-
*/
|
|
282
|
-
setContextEvents(events: IEntityEvent<IEventData>[]): void;
|
|
283
|
-
/**
|
|
284
|
-
* Adds a single event to the current context.
|
|
285
|
-
* @param event - Event to add to context.
|
|
286
|
-
*/
|
|
287
|
-
setContextEvent(event: IEntityEvent<IEventData>): void;
|
|
288
|
-
/**
|
|
289
|
-
* Removes all events from the current context.
|
|
290
|
-
*/
|
|
291
|
-
clearContextEvents(): void;
|
|
292
|
-
/**
|
|
293
|
-
* Clears all event subscriptions for the current entity.
|
|
294
|
-
*/
|
|
295
|
-
clearSubscriptions(): void;
|
|
296
260
|
}
|
|
297
261
|
//#endregion
|
|
298
262
|
//#region src/systems/pipeline/system-context-proxies.d.ts
|
|
@@ -484,52 +448,52 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
484
448
|
* Time elapsed since the last system update for this entity, in milliseconds.
|
|
485
449
|
* Useful for time-based calculations and animations.
|
|
486
450
|
*/
|
|
487
|
-
readonly deltaTimeMs:
|
|
451
|
+
readonly deltaTimeMs: number;
|
|
488
452
|
/**
|
|
489
453
|
* The entity currently being processed by this middleware.
|
|
490
454
|
*/
|
|
491
|
-
readonly entity:
|
|
455
|
+
readonly entity: TEntity;
|
|
492
456
|
/**
|
|
493
457
|
* Config metadata and config-update API for the current update.
|
|
494
458
|
*/
|
|
495
|
-
readonly config:
|
|
459
|
+
readonly config: ISystemContextConfigReadonly;
|
|
496
460
|
/**
|
|
497
461
|
* Information about the update triggering this system execution.
|
|
498
462
|
* Contains type (update/remove) and optional model/snapshot data.
|
|
499
463
|
*/
|
|
500
|
-
readonly update:
|
|
464
|
+
readonly update: IEntityUpdate;
|
|
501
465
|
/**
|
|
502
|
-
* Event system API for publishing
|
|
466
|
+
* Event system API for publishing entity events.
|
|
503
467
|
*/
|
|
504
|
-
readonly events:
|
|
468
|
+
readonly events: ISystemContextEvents;
|
|
505
469
|
/**
|
|
506
470
|
* Logging interface for debug and diagnostic output.
|
|
507
471
|
*/
|
|
508
|
-
readonly logger:
|
|
472
|
+
readonly logger: ILogger;
|
|
509
473
|
/**
|
|
510
474
|
* Proxy management API for establishing and managing entity relationships.
|
|
511
475
|
*/
|
|
512
|
-
readonly proxies:
|
|
476
|
+
readonly proxies: ISystemContextProxies;
|
|
513
477
|
/**
|
|
514
478
|
* Repository access API for querying and modifying entity storage.
|
|
515
479
|
*/
|
|
516
|
-
readonly repository:
|
|
480
|
+
readonly repository: ISystemContextRepository;
|
|
517
481
|
/**
|
|
518
482
|
* Scheduling API for requesting follow-up entity updates.
|
|
519
483
|
*/
|
|
520
|
-
readonly scheduler:
|
|
484
|
+
readonly scheduler: ISystemContextScheduler;
|
|
521
485
|
/**
|
|
522
486
|
* Snapshot management API for serialization and state transfer.
|
|
523
487
|
*/
|
|
524
|
-
readonly snapshot:
|
|
488
|
+
readonly snapshot: ISystemContextSnapshot;
|
|
525
489
|
/**
|
|
526
490
|
* Control API for enabling/disabling the current system or entire module during execution.
|
|
527
491
|
*/
|
|
528
|
-
readonly systems:
|
|
492
|
+
readonly systems: ISystemContextControl;
|
|
529
493
|
/**
|
|
530
|
-
* The per-entity
|
|
494
|
+
* The per-entity dispatch state and control interface for this system context.
|
|
531
495
|
*/
|
|
532
|
-
readonly
|
|
496
|
+
readonly dispatch: PipelineDispatch;
|
|
533
497
|
}
|
|
534
498
|
//#endregion
|
|
535
499
|
//#region src/systems/pipeline/system-context-mutable.d.ts
|
|
@@ -541,9 +505,58 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
541
505
|
* @template TEntity - The specific entity type this context operates on.
|
|
542
506
|
*/
|
|
543
507
|
interface IMutableSystemContext<TEntity extends IEntity> extends ISystemContext<TEntity> {
|
|
508
|
+
readonly events: IMutableSystemContextEvents;
|
|
544
509
|
setUpdate(update: IEntityUpdate): void;
|
|
545
510
|
setDeltaTime(deltaTimeMs: number): void;
|
|
546
|
-
|
|
511
|
+
setDispatch(dispatch: PipelineDispatch): void;
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/factories/context-factory.d.ts
|
|
515
|
+
interface IContextFactory {
|
|
516
|
+
getOrCreateContext<TEntity extends IEntity>(entity: TEntity, registry?: MiddlewareRegistryReadonly): IMutableSystemContext<TEntity>;
|
|
517
|
+
getContext<TEntity extends IEntity>(entityUid: EntityUid): IMutableSystemContext<TEntity> | undefined;
|
|
518
|
+
disposeEntity(entityUid: EntityUid): void;
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/factories/pipeline-factory.d.ts
|
|
522
|
+
/**
|
|
523
|
+
* Category identifier for grouping performance metrics.
|
|
524
|
+
* Typed as string to allow extension beyond the built-in {@link PipelineCategory} values.
|
|
525
|
+
*/
|
|
526
|
+
type PipelineCategoryName = string;
|
|
527
|
+
/**
|
|
528
|
+
* Built-in metric categories for classifying pipeline and middleware performance entries.
|
|
529
|
+
*
|
|
530
|
+
* - `module` — System module pipelines (initialize, config, update, render, sync phases).
|
|
531
|
+
* - `runtime` — Runtime orchestration pipeline and its middleware.
|
|
532
|
+
* - `system` — Individual system middleware within a module pipeline.
|
|
533
|
+
*/
|
|
534
|
+
declare enum PipelineCategory {
|
|
535
|
+
module = "module",
|
|
536
|
+
runtime = "runtime",
|
|
537
|
+
system = "system"
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Options for identifying and categorizing performance metrics on pipelines.
|
|
541
|
+
*/
|
|
542
|
+
type PipelineOptions = {
|
|
543
|
+
/** Display name for the pipeline in performance metrics. */pipelineName: string; /** Category assigned to pipeline-level metric entries. */
|
|
544
|
+
pipelineCategory: PipelineCategoryName; /** Category assigned to per-middleware metric entries within this pipeline. */
|
|
545
|
+
middlewareCategory: PipelineCategoryName;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Creates pipeline instances for various contexts.
|
|
549
|
+
* Abstracts pipeline creation to support different implementations.
|
|
550
|
+
* Used by the system to instantiate pipelines without coupling to specific implementations.
|
|
551
|
+
*/
|
|
552
|
+
interface IPipelineFactory {
|
|
553
|
+
/**
|
|
554
|
+
* Creates a new pipeline for the specified context type.
|
|
555
|
+
* @template TContext - The context type for the pipeline. Must extend IPipelineContext.
|
|
556
|
+
* @param options - Optional performance metric options (name, category) for the pipeline.
|
|
557
|
+
* @returns A new pipeline instance ready for middleware registration.
|
|
558
|
+
*/
|
|
559
|
+
createPipeline<TContext extends IPipelineContext>(options?: PipelineOptions): IPipeline<TContext>;
|
|
547
560
|
}
|
|
548
561
|
//#endregion
|
|
549
562
|
//#region src/utils/dispatch-sequential.d.ts
|
|
@@ -657,81 +670,6 @@ interface IPerformanceTimer {
|
|
|
657
670
|
endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
|
|
658
671
|
}
|
|
659
672
|
//#endregion
|
|
660
|
-
//#region src/factories/context-factory.d.ts
|
|
661
|
-
/**
|
|
662
|
-
* Creates and caches per-entity system contexts.
|
|
663
|
-
*
|
|
664
|
-
* On the first call for a given entity, creates a new SystemContext with all sub-contexts
|
|
665
|
-
* (events, proxies, repository, scheduler, snapshot) bound to that entity.
|
|
666
|
-
* Subsequent calls return the cached context. Disposal removes all cache entries for an entity.
|
|
667
|
-
*/
|
|
668
|
-
interface IContextFactory {
|
|
669
|
-
/**
|
|
670
|
-
* Creates or retrieves the cached system context for the given entity.
|
|
671
|
-
* On first call, creates sub-contexts bound to the entity.
|
|
672
|
-
* On subsequent calls, returns the cached context.
|
|
673
|
-
* @template TEntity - The entity type for which the system context is being created.
|
|
674
|
-
* @param entity - The entity to create or retrieve the context for.
|
|
675
|
-
* @param registry - Optional middleware registry to associate with the context for pipeline execution.
|
|
676
|
-
* @returns The mutable system context for the entity.
|
|
677
|
-
*/
|
|
678
|
-
getOrCreateContext<TEntity extends IEntity>(entity: Immutable<TEntity>, registry?: MiddlewareRegistryReadonly): IMutableSystemContext<TEntity>;
|
|
679
|
-
/**
|
|
680
|
-
* Retrieves a previously cached system context by entity UID.
|
|
681
|
-
* @template TEntity - The entity type.
|
|
682
|
-
* @param entityUid - The entity's unique identifier.
|
|
683
|
-
* @returns The cached context, or undefined if not found.
|
|
684
|
-
*/
|
|
685
|
-
getContext<TEntity extends IEntity>(entityUid: EntityUid): IMutableSystemContext<TEntity> | undefined;
|
|
686
|
-
/**
|
|
687
|
-
* Disposes all cached contexts for the given entity.
|
|
688
|
-
* Removes the entity from the repository and clears all cache entries.
|
|
689
|
-
* @param entityUid - The entity's unique identifier.
|
|
690
|
-
*/
|
|
691
|
-
disposeEntity(entityUid: EntityUid): void;
|
|
692
|
-
}
|
|
693
|
-
//#endregion
|
|
694
|
-
//#region src/factories/pipeline-factory.d.ts
|
|
695
|
-
/**
|
|
696
|
-
* Category identifier for grouping performance metrics.
|
|
697
|
-
* Typed as string to allow extension beyond the built-in {@link PipelineCategory} values.
|
|
698
|
-
*/
|
|
699
|
-
type PipelineCategoryName = string;
|
|
700
|
-
/**
|
|
701
|
-
* Built-in metric categories for classifying pipeline and middleware performance entries.
|
|
702
|
-
*
|
|
703
|
-
* - `module` — System module pipelines (initialize, config, update, render, sync phases).
|
|
704
|
-
* - `runtime` — Runtime orchestration pipeline and its middleware.
|
|
705
|
-
* - `system` — Individual system middleware within a module pipeline.
|
|
706
|
-
*/
|
|
707
|
-
declare enum PipelineCategory {
|
|
708
|
-
module = "module",
|
|
709
|
-
runtime = "runtime",
|
|
710
|
-
system = "system"
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Options for identifying and categorizing performance metrics on pipelines.
|
|
714
|
-
*/
|
|
715
|
-
type PipelineOptions = {
|
|
716
|
-
/** Display name for the pipeline in performance metrics. */pipelineName: string; /** Category assigned to pipeline-level metric entries. */
|
|
717
|
-
pipelineCategory: PipelineCategoryName; /** Category assigned to per-middleware metric entries within this pipeline. */
|
|
718
|
-
middlewareCategory: PipelineCategoryName;
|
|
719
|
-
};
|
|
720
|
-
/**
|
|
721
|
-
* Creates pipeline instances for various contexts.
|
|
722
|
-
* Abstracts pipeline creation to support different implementations.
|
|
723
|
-
* Used by the system to instantiate pipelines without coupling to specific implementations.
|
|
724
|
-
*/
|
|
725
|
-
interface IPipelineFactory {
|
|
726
|
-
/**
|
|
727
|
-
* Creates a new pipeline for the specified context type.
|
|
728
|
-
* @template TContext - The context type for the pipeline. Must extend IPipelineContext.
|
|
729
|
-
* @param options - Optional performance metric options (name, category) for the pipeline.
|
|
730
|
-
* @returns A new pipeline instance ready for middleware registration.
|
|
731
|
-
*/
|
|
732
|
-
createPipeline<TContext extends IPipelineContext>(options?: PipelineOptions): IPipeline<TContext>;
|
|
733
|
-
}
|
|
734
|
-
//#endregion
|
|
735
673
|
//#region src/systems/system-type.d.ts
|
|
736
674
|
/**
|
|
737
675
|
* The five phases of entity system execution in each frame.
|
|
@@ -749,21 +687,47 @@ declare enum SystemType {
|
|
|
749
687
|
* Runs on entity creation and on updates that carry a config payload.
|
|
750
688
|
*/
|
|
751
689
|
config = 1,
|
|
690
|
+
/**
|
|
691
|
+
* Event reactions routed by event uid.
|
|
692
|
+
* Runs after config and before update for updates carrying events.
|
|
693
|
+
*/
|
|
694
|
+
event = 2,
|
|
752
695
|
/**
|
|
753
696
|
* Main logic and state updates for the entity.
|
|
754
697
|
* Runs on every update to change entity behavior and properties.
|
|
755
698
|
*/
|
|
756
|
-
update =
|
|
699
|
+
update = 3,
|
|
757
700
|
/**
|
|
758
701
|
* Output and visualization operations.
|
|
759
702
|
* Runs after updates to render or display the entity state.
|
|
760
703
|
*/
|
|
761
|
-
render =
|
|
704
|
+
render = 4,
|
|
762
705
|
/**
|
|
763
706
|
* Synchronization and persistence.
|
|
764
707
|
* Runs last to synchronize state with external systems or storage.
|
|
765
708
|
*/
|
|
766
|
-
sync =
|
|
709
|
+
sync = 5
|
|
710
|
+
}
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/systems/module/systems-module.d.ts
|
|
713
|
+
/**
|
|
714
|
+
* Collection of pipelines for a specific entity type.
|
|
715
|
+
* Defines the complete system processing flow for one entity category.
|
|
716
|
+
*
|
|
717
|
+
* @template TEntity - The entity type this module processes.
|
|
718
|
+
*/
|
|
719
|
+
interface ISystemsModule<TEntity extends IEntity> {
|
|
720
|
+
/**
|
|
721
|
+
* The builder instance used to construct this module.
|
|
722
|
+
*/
|
|
723
|
+
readonly builder: ISystemsModuleBuilderReadonly<TEntity>;
|
|
724
|
+
/**
|
|
725
|
+
* Optional factory function to initialize new entity instances.
|
|
726
|
+
* If provided, is called when a new entity of this type is created.
|
|
727
|
+
* @param model - The initialization model.
|
|
728
|
+
* @returns The initialized entity.
|
|
729
|
+
*/
|
|
730
|
+
readonly initEntity?: (model: IEntityModel) => TEntity;
|
|
767
731
|
}
|
|
768
732
|
//#endregion
|
|
769
733
|
//#region src/systems/module/systems-module-builder.d.ts
|
|
@@ -776,6 +740,10 @@ interface ISystemsModuleBuilderReadonly<TEntity extends IEntity> {
|
|
|
776
740
|
* Read-only map of system pipelines keyed by SystemType.
|
|
777
741
|
*/
|
|
778
742
|
readonly pipelines: ReadonlyMap<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
743
|
+
/**
|
|
744
|
+
* Event middleware keyed by event uid.
|
|
745
|
+
*/
|
|
746
|
+
readonly eventMiddlewares: ReadonlyMap<EntityEventUid, ReadonlyArray<ISystemEventMiddleware<TEntity>>>;
|
|
779
747
|
/**
|
|
780
748
|
* Read-only registry mapping middleware names to their originating module names.
|
|
781
749
|
*/
|
|
@@ -806,6 +774,11 @@ interface ISystemsModuleBuilder<TEntity extends IEntity> extends ISystemsModuleB
|
|
|
806
774
|
* @returns This builder for method chaining.
|
|
807
775
|
*/
|
|
808
776
|
addSystems(type: SystemType, systems: Immutable<ISystemMiddleware<TEntity>[]>): this;
|
|
777
|
+
/**
|
|
778
|
+
* Registers event-routed middleware for a specific event uid.
|
|
779
|
+
* Event middleware are invoked once per matching event instance.
|
|
780
|
+
*/
|
|
781
|
+
addEventSystems(uid: EntityEventUid, systems: Immutable<ISystemEventMiddleware<TEntity>[]>): this;
|
|
809
782
|
/**
|
|
810
783
|
* Integrates an entire module's pipelines into this builder.
|
|
811
784
|
* Allows composition of multiple modules into one.
|
|
@@ -830,140 +803,6 @@ interface ISystemsModuleBuilder<TEntity extends IEntity> extends ISystemsModuleB
|
|
|
830
803
|
setScopedProxy(): this;
|
|
831
804
|
}
|
|
832
805
|
//#endregion
|
|
833
|
-
//#region src/systems/module/systems-module.d.ts
|
|
834
|
-
/**
|
|
835
|
-
* Collection of pipelines for a specific entity type.
|
|
836
|
-
* Defines the complete system processing flow for one entity category.
|
|
837
|
-
*
|
|
838
|
-
* @template TEntity - The entity type this module processes.
|
|
839
|
-
*/
|
|
840
|
-
interface ISystemsModule<TEntity extends IEntity> {
|
|
841
|
-
/**
|
|
842
|
-
* The builder instance used to construct this module.
|
|
843
|
-
*/
|
|
844
|
-
readonly builder: ISystemsModuleBuilderReadonly<TEntity>;
|
|
845
|
-
/**
|
|
846
|
-
* Optional factory function to initialize new entity instances.
|
|
847
|
-
* If provided, is called when a new entity of this type is created.
|
|
848
|
-
* @param model - The initialization model.
|
|
849
|
-
* @returns The initialized entity.
|
|
850
|
-
*/
|
|
851
|
-
readonly initEntity?: (model: IEntityModel) => TEntity;
|
|
852
|
-
}
|
|
853
|
-
//#endregion
|
|
854
|
-
//#region src/systems/module/systems-module-repository.d.ts
|
|
855
|
-
/**
|
|
856
|
-
* Central registry for all systems modules in the ECS.
|
|
857
|
-
* Maintains a module for each entity type, providing access to all system pipelines.
|
|
858
|
-
* This is the authoritative source for system module data.
|
|
859
|
-
*
|
|
860
|
-
* @template TEntity - The entity types managed by modules in this repository.
|
|
861
|
-
*/
|
|
862
|
-
interface ISystemsModuleRepository {
|
|
863
|
-
/**
|
|
864
|
-
* The total number of modules in the repository.
|
|
865
|
-
*/
|
|
866
|
-
readonly size: number;
|
|
867
|
-
/**
|
|
868
|
-
* Retrieves the module for a specific entity type.
|
|
869
|
-
* @template TEntity - The entity type to retrieve module for.
|
|
870
|
-
* @param type - The entity type identifier.
|
|
871
|
-
* @returns The systems module for that entity type.
|
|
872
|
-
*/
|
|
873
|
-
get<TEntity extends IEntity>(type: EntityTypeUid): ISystemsModule<TEntity>;
|
|
874
|
-
/**
|
|
875
|
-
* Registers or updates a module for an entity type.
|
|
876
|
-
* @param type - The entity type identifier.
|
|
877
|
-
* @param module - The systems module to register.
|
|
878
|
-
*/
|
|
879
|
-
set(type: EntityTypeUid, module: ISystemsModule<IEntity>): void;
|
|
880
|
-
/**
|
|
881
|
-
* Retrieves all registered modules.
|
|
882
|
-
* @returns A read-only map of entity type to module.
|
|
883
|
-
*/
|
|
884
|
-
list(): ReadonlyMap<EntityTypeUid, Immutable<ISystemsModule<IEntity>>>;
|
|
885
|
-
}
|
|
886
|
-
//#endregion
|
|
887
|
-
//#region src/systems/runtime/systems-runtime.d.ts
|
|
888
|
-
/**
|
|
889
|
-
* Executes system middleware for entities.
|
|
890
|
-
* Processes entity updates by dispatching them through appropriate system modules.
|
|
891
|
-
* Different implementations may use different execution strategies or optimizations.
|
|
892
|
-
*/
|
|
893
|
-
interface ISystemsRuntime {
|
|
894
|
-
/**
|
|
895
|
-
* Processes a single entity update through its system pipeline.
|
|
896
|
-
* If no update is provided, may dequeue one from an internal queue.
|
|
897
|
-
* @param update - Optional specific update to process. If omitted, dequeues the next update.
|
|
898
|
-
* @returns Pipeline results containing execution data and metrics.
|
|
899
|
-
*/
|
|
900
|
-
runTick(update?: IEntityUpdate): PipelineRuntime | Promise<PipelineRuntime> | void;
|
|
901
|
-
}
|
|
902
|
-
//#endregion
|
|
903
|
-
//#region src/systems/runtime/systems-runtime-context.d.ts
|
|
904
|
-
/**
|
|
905
|
-
* Runtime context for system pipeline execution.
|
|
906
|
-
* Coordinates the execution of system pipelines across all entities.
|
|
907
|
-
* Maintains state about the current entity being processed and enabled pipeline stages.
|
|
908
|
-
*
|
|
909
|
-
* @template TEntity - The entity type being processed.
|
|
910
|
-
*/
|
|
911
|
-
interface ISystemsRuntimeContext<TEntity extends IEntity> extends IPipelineContext {
|
|
912
|
-
/**
|
|
913
|
-
* Indicates if the system pipeline should perform initialization for the current entity.
|
|
914
|
-
*/
|
|
915
|
-
readonly shouldInitialize?: boolean;
|
|
916
|
-
/**
|
|
917
|
-
* Indicates if the config system phase should run for the current entity.
|
|
918
|
-
*/
|
|
919
|
-
readonly shouldConfigure?: boolean;
|
|
920
|
-
/**
|
|
921
|
-
* The systems module for the current entity type.
|
|
922
|
-
*/
|
|
923
|
-
readonly systemsModule: ISystemsModule<TEntity>;
|
|
924
|
-
/**
|
|
925
|
-
* The mutable system context for the current entity execution.
|
|
926
|
-
* Provides infrastructure setters for update, delta time, and runtime state.
|
|
927
|
-
*/
|
|
928
|
-
readonly systemContext: IMutableSystemContext<TEntity>;
|
|
929
|
-
/**
|
|
930
|
-
* The proxy repository for managing entity proxy relationships and scopes.
|
|
931
|
-
*/
|
|
932
|
-
readonly proxyRepository: IEntityProxyRepository;
|
|
933
|
-
}
|
|
934
|
-
//#endregion
|
|
935
|
-
//#region src/systems/runtime/systems-runtime-middleware.d.ts
|
|
936
|
-
/**
|
|
937
|
-
* Middleware for orchestrating system execution across entities.
|
|
938
|
-
* Operates at the runtime level to coordinate system module pipelines.
|
|
939
|
-
* Can influence which pipelines execute and in what order.
|
|
940
|
-
*
|
|
941
|
-
* @template TEntity - The entity type being processed.
|
|
942
|
-
*/
|
|
943
|
-
type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
|
|
944
|
-
//#endregion
|
|
945
|
-
//#region src/factories/runtime-factory.d.ts
|
|
946
|
-
/**
|
|
947
|
-
* Creates runtime contexts and pipelines for system execution.
|
|
948
|
-
* Provides factory methods for constructing runtime infrastructure.
|
|
949
|
-
* Allows different runtime strategies through multiple implementations.
|
|
950
|
-
*/
|
|
951
|
-
interface IRuntimeFactory {
|
|
952
|
-
/**
|
|
953
|
-
* Creates a new runtime context for system execution.
|
|
954
|
-
* @template TEntity - The entity type for the runtime context.
|
|
955
|
-
* @returns A new systems runtime context instance.
|
|
956
|
-
*/
|
|
957
|
-
createRuntimeContext<TEntity extends IEntity>(): ISystemsRuntimeContext<TEntity>;
|
|
958
|
-
/**
|
|
959
|
-
* Creates a pipeline for systems runtime orchestration.
|
|
960
|
-
* @template TEntity - The entity type for this runtime pipeline.
|
|
961
|
-
* @param name - Optional name for debugging.
|
|
962
|
-
* @returns A new runtime pipeline for system execution.
|
|
963
|
-
*/
|
|
964
|
-
createRuntimePipeline<TEntity extends IEntity>(name?: string): IPipeline<ISystemsRuntimeContext<TEntity>>;
|
|
965
|
-
}
|
|
966
|
-
//#endregion
|
|
967
806
|
//#region src/factories/systems-factory.d.ts
|
|
968
807
|
/**
|
|
969
808
|
* Creates systems module builders for constructing entity system pipelines.
|
|
@@ -980,5 +819,5 @@ interface ISystemsFactory {
|
|
|
980
819
|
createSystemsModuleBuilder<TEntity extends IEntity>(name: string): ISystemsModuleBuilder<TEntity>;
|
|
981
820
|
}
|
|
982
821
|
//#endregion
|
|
983
|
-
export {
|
|
984
|
-
//# sourceMappingURL=index-
|
|
822
|
+
export { ISystemContextControlState as A, ISystemContextConfigReadonly as B, IJsonSerializer as C, IMutableSystemContextEvents as D, ISystemContextProxies as E, MiddlewareRegistry as F, ILoggerOptions as H, MiddlewareRegistryReadonly as I, SystemMiddlewareName as L, SystemContextControlTarget as M, ISystemEventMiddleware as N, ISystemContextEvents as O, ISystemMiddleware as P, SystemModuleName as R, ISystemContextSnapshot as S, ISystemContextRepository as T, LogLevel as U, ILogger as V, PipelineCategoryName as _, SystemType as a, IMutableSystemContext as b, PerformanceTimeEntry as c, RenderSnapshot as d, TickMetricEntry as f, PipelineCategory as g, IPipelineFactory as h, ISystemsModule as i, SystemContextControlState as j, ISystemContextControl as k, PerformanceTimerUid as l, dispatchSequential as m, ISystemsModuleBuilder as n, IPerformanceTimer as o, TickSnapshot as p, ISystemsModuleBuilderReadonly as r, PerformanceMetricOptions as s, ISystemsFactory as t, MiddlewareMetricsSummary as u, PipelineOptions as v, ISystemContextScheduler as w, ISystemContext as x, IContextFactory as y, ISystemContextConfig as z };
|
|
823
|
+
//# sourceMappingURL=index-CPGVaS-_.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/pipelines/pipeline-context.d.ts
|
|
4
4
|
/**
|
|
@@ -7,16 +7,16 @@ import { r as Immutable } from "./types-Bbmnq4ni.cjs";
|
|
|
7
7
|
*/
|
|
8
8
|
interface IPipelineContext {
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
10
|
+
* The dispatch state and control interface for the pipeline.
|
|
11
11
|
* Allows middleware to query and influence pipeline behavior.
|
|
12
12
|
*/
|
|
13
|
-
readonly
|
|
13
|
+
readonly dispatch?: PipelineDispatch;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Dispatch state and control interface for pipeline execution.
|
|
17
17
|
* Allows middleware to query status and influence pipeline flow.
|
|
18
18
|
*/
|
|
19
|
-
type
|
|
19
|
+
type PipelineDispatch = {
|
|
20
20
|
/**
|
|
21
21
|
* Flag to request pipeline halt.
|
|
22
22
|
* Set to true to stop executing remaining middleware (cleanup still runs).
|
|
@@ -25,7 +25,7 @@ type PipelineRuntime = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Optional error state if an exception occurred during execution.
|
|
27
27
|
*/
|
|
28
|
-
error?:
|
|
28
|
+
error?: unknown;
|
|
29
29
|
};
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/pipelines/middleware.d.ts
|
|
@@ -198,12 +198,12 @@ interface IPipelineRunner<TContext extends IPipelineContext> {
|
|
|
198
198
|
/**
|
|
199
199
|
* Executes the action phase of all middleware in sequence.
|
|
200
200
|
* Middleware at startIndex and onward are executed in order.
|
|
201
|
-
* Execution may terminate early if middleware requests it via context.
|
|
201
|
+
* Execution may terminate early if middleware requests it via context.dispatch.shouldStop.
|
|
202
202
|
* @param context - The context passed to each middleware action.
|
|
203
203
|
* @param middleware - The ordered middleware array to execute.
|
|
204
204
|
* @param startIndex - Optional starting position in the middleware array (default: 0).
|
|
205
205
|
*/
|
|
206
|
-
dispatch(context: Partial<TContext>, middleware: IMiddleware<TContext>[], startIndex?: number): void | Promise<void>;
|
|
206
|
+
dispatch(context: Partial<TContext>, middleware: readonly IMiddleware<TContext>[], startIndex?: number): void | Promise<void>;
|
|
207
207
|
/**
|
|
208
208
|
* Executes the cleanup phase of all middleware in reverse order.
|
|
209
209
|
* All middleware cleanup functions are called (if defined), regardless of errors.
|
|
@@ -211,8 +211,8 @@ interface IPipelineRunner<TContext extends IPipelineContext> {
|
|
|
211
211
|
* @param context - The context passed to each middleware cleanup.
|
|
212
212
|
* @param middleware - The ordered middleware array for cleanup (reversed during execution).
|
|
213
213
|
*/
|
|
214
|
-
cleanup(context: Partial<TContext>, middleware: IMiddleware<TContext>[]): void | Promise<void>;
|
|
214
|
+
cleanup(context: Partial<TContext>, middleware: readonly IMiddleware<TContext>[]): void | Promise<void>;
|
|
215
215
|
}
|
|
216
216
|
//#endregion
|
|
217
|
-
export { IParentMiddleware as a, IMiddleware as c, IParentContext as i, IPipelineContext as l, INestedContext as n, IPipeline as o, INestedMiddleware as r, IMiddlewareRunner as s, IPipelineRunner as t,
|
|
218
|
-
//# sourceMappingURL=index-
|
|
217
|
+
export { IParentMiddleware as a, IMiddleware as c, IParentContext as i, IPipelineContext as l, INestedContext as n, IPipeline as o, INestedMiddleware as r, IMiddlewareRunner as s, IPipelineRunner as t, PipelineDispatch as u };
|
|
218
|
+
//# sourceMappingURL=index-DXbpfhHa.d.mts.map
|