@awesome-ecs/abstract 0.30.0 → 0.32.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/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs.map +1 -1
- 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.map +1 -1
- package/dist/factories/index.cjs +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 +1 -1
- package/dist/factories/index.mjs.map +1 -1
- package/dist/{index-8XDo0pla.d.mts → index-B1OYkMOx.d.cts} +298 -379
- package/dist/{index-BguFn1Xj.d.cts → index-BGLTfuj8.d.cts} +24 -4
- package/dist/{identity-component-CuWHf7jX.d.mts → index-C0jDrUBA.d.cts} +81 -70
- package/dist/{index-kNcUiDBd.d.mts → index-C1hRAjM-.d.mts} +24 -4
- package/dist/index-CeqaKmWR.d.mts +218 -0
- package/dist/{index-BVkmidEx.d.cts → index-D3rS2RFG.d.mts} +298 -379
- package/dist/index-DMTkNY1e.d.cts +218 -0
- package/dist/{identity-component-DLDaOTyK.d.cts → index-b5BtWAvO.d.mts} +81 -70
- package/dist/pipelines/index.d.cts +1 -1
- package/dist/pipelines/index.d.mts +1 -1
- package/dist/systems/index.cjs +20 -4
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.mts +2 -2
- package/dist/systems/index.mjs +20 -5
- package/dist/systems/index.mjs.map +1 -1
- package/dist/types-Bbmnq4ni.d.cts +74 -0
- package/dist/types-C1ojaDL4.d.mts +74 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import {
|
|
1
|
+
import { _ as ConfigRecord, a as IEntity, c as IEntityProxy, f as ComponentTypeUid, i as EntityUid, l as IEntityProxyRepository, o as IEntityModel, r as EntityTypeUid, s as EntityProxy } from "./index-b5BtWAvO.mjs";
|
|
2
|
+
import { r as Immutable } from "./types-C1ojaDL4.mjs";
|
|
3
|
+
import { c as IEntitySnapshot, d as EntityEventSubscriptionOptions, f as EntityEventUid, g as IEventData, o as IEntityUpdate, p as IEntityEvent, v as IEntityConfigSnapshot } from "./index-C1hRAjM-.mjs";
|
|
4
|
+
import { c as IMiddleware, l as IPipelineContext, o as IPipeline, u as PipelineRuntime } from "./index-CeqaKmWR.mjs";
|
|
3
5
|
|
|
4
|
-
//#region src/utils/dispatch-sequential.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Executes a function for each item in an iterable, sequentially.
|
|
7
|
-
*
|
|
8
|
-
* Uses a sync fast-path: iterates synchronously until the first Promise is
|
|
9
|
-
* encountered, then switches to async for the remainder. If no item produces
|
|
10
|
-
* a Promise, the entire call stays synchronous with zero async overhead.
|
|
11
|
-
*
|
|
12
|
-
* @param items - The iterable to iterate over.
|
|
13
|
-
* @param fn - The function to call for each item. May return void or a Promise.
|
|
14
|
-
* @returns void if all calls were synchronous, or a Promise if any were async.
|
|
15
|
-
*/
|
|
16
|
-
declare function dispatchSequential<T>(items: Iterable<T>, fn: (item: T) => void | Promise<void>): void | Promise<void>;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/utils/json-serializer.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* Custom JSON serialization and deserialization interface.
|
|
21
|
-
* Allows different serialization strategies for handling complex types.
|
|
22
|
-
* Used for entity snapshots, events, and any data needing JSON conversion.
|
|
23
|
-
*/
|
|
24
|
-
interface IJsonSerializer {
|
|
25
|
-
/**
|
|
26
|
-
* Converts an object to a serializable JSON representation.
|
|
27
|
-
* Handles types that don't serialize naturally (dates, maps, custom objects, etc.).
|
|
28
|
-
* @param value - The object to serialize.
|
|
29
|
-
* @returns A JSON-serializable representation.
|
|
30
|
-
*/
|
|
31
|
-
serializeCustom(value: object): string;
|
|
32
|
-
/**
|
|
33
|
-
* Converts a JSON string back to its original object type.
|
|
34
|
-
* Reconstructs complex types from their serialized form.
|
|
35
|
-
* @template TObject - The target object type.
|
|
36
|
-
* @param text - The JSON string to deserialize.
|
|
37
|
-
* @returns The deserialized object of the specified type.
|
|
38
|
-
*/
|
|
39
|
-
parseCustom<TObject>(text: string): TObject;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
6
|
//#region src/utils/logger.d.ts
|
|
43
7
|
/**
|
|
44
8
|
* Logger interface for debug and diagnostic output.
|
|
@@ -114,320 +78,136 @@ interface ILoggerOptions {
|
|
|
114
78
|
enabled: Map<LogLevel, boolean>;
|
|
115
79
|
}
|
|
116
80
|
//#endregion
|
|
117
|
-
//#region src/
|
|
118
|
-
type TickMetricEntry = {
|
|
119
|
-
name: string;
|
|
120
|
-
category: string;
|
|
121
|
-
totalMs: number;
|
|
122
|
-
count: number;
|
|
123
|
-
};
|
|
124
|
-
type TickSnapshot = {
|
|
125
|
-
tickIndex: number;
|
|
126
|
-
tickDurationMs: number;
|
|
127
|
-
fps: number;
|
|
128
|
-
queueSize: number;
|
|
129
|
-
timestamp: number;
|
|
130
|
-
metrics: TickMetricEntry[];
|
|
131
|
-
render?: RenderSnapshot;
|
|
132
|
-
};
|
|
133
|
-
type RenderSnapshot = {
|
|
134
|
-
frameTimeMs: number;
|
|
135
|
-
renderTimeMs: number;
|
|
136
|
-
gpuFrameTimeMs: number;
|
|
137
|
-
drawCalls: number;
|
|
138
|
-
activeMeshesEvalMs: number;
|
|
139
|
-
cameraRenderMs: number;
|
|
140
|
-
totalVertices: number;
|
|
141
|
-
activeIndices: number;
|
|
142
|
-
};
|
|
143
|
-
type MiddlewareMetricsSummary = {
|
|
144
|
-
name: string;
|
|
145
|
-
category: PipelineCategoryName;
|
|
146
|
-
count: number;
|
|
147
|
-
totalMs: number;
|
|
148
|
-
avgMs: number;
|
|
149
|
-
minMs: number;
|
|
150
|
-
maxMs: number;
|
|
151
|
-
lastMs: number;
|
|
152
|
-
};
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/utils/performance-timer.d.ts
|
|
155
|
-
/**
|
|
156
|
-
* Unique identifier for a timer instance.
|
|
157
|
-
*/
|
|
158
|
-
type PerformanceTimerUid = number;
|
|
159
|
-
/**
|
|
160
|
-
* Options for identifying and categorizing performance metrics.
|
|
161
|
-
* Used by pipeline factories and performance decorators.
|
|
162
|
-
*/
|
|
163
|
-
type PerformanceMetricOptions = {
|
|
164
|
-
name?: string;
|
|
165
|
-
category?: string;
|
|
166
|
-
};
|
|
81
|
+
//#region src/systems/pipeline/system-context-config.d.ts
|
|
167
82
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
83
|
+
* Config-specific API for the current system execution.
|
|
84
|
+
*
|
|
85
|
+
* The runtime applies config patches before the config phase runs. This context
|
|
86
|
+
* records the component config values immediately before the patch was applied,
|
|
87
|
+
* then exposes both previous and current values to config middleware.
|
|
170
88
|
*/
|
|
171
|
-
interface
|
|
172
|
-
/**
|
|
173
|
-
* The name identifying this timer.
|
|
174
|
-
*/
|
|
175
|
-
name: string;
|
|
176
|
-
/**
|
|
177
|
-
* The category of this metric (e.g. 'module', 'runtime', 'system').
|
|
178
|
-
*/
|
|
179
|
-
category?: string;
|
|
89
|
+
interface ISystemContextConfigReadonly {
|
|
180
90
|
/**
|
|
181
|
-
*
|
|
91
|
+
* Returns true when the current entity update included a config patch for
|
|
92
|
+
* this component type.
|
|
182
93
|
*/
|
|
183
|
-
|
|
94
|
+
hasChanged(componentType: ComponentTypeUid): boolean;
|
|
184
95
|
/**
|
|
185
|
-
*
|
|
96
|
+
* Returns the component's current config values after the runtime-applied
|
|
97
|
+
* config patch.
|
|
186
98
|
*/
|
|
187
|
-
|
|
99
|
+
getCurrentValue<TConfig extends ConfigRecord>(componentType: ComponentTypeUid): Immutable<TConfig> | undefined;
|
|
188
100
|
/**
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Interface for measuring operation duration.
|
|
195
|
-
* Provides start/stop functionality for performance profiling.
|
|
196
|
-
* Used throughout the system to collect timing metrics.
|
|
197
|
-
*/
|
|
198
|
-
interface IPerformanceTimer {
|
|
199
|
-
/**
|
|
200
|
-
* Starts a new timer.
|
|
201
|
-
* @param name - Label for this timer (used in results).
|
|
202
|
-
* @param category - Optional category for grouping metrics.
|
|
203
|
-
* @returns A unique identifier for this timer instance.
|
|
204
|
-
*/
|
|
205
|
-
startTimer(name: string, category?: string): PerformanceTimerUid;
|
|
206
|
-
/**
|
|
207
|
-
* Stops a timer and returns the recorded metrics.
|
|
208
|
-
* @param timerUid - The timer identifier returned by startTimer.
|
|
209
|
-
* @returns Complete timing entry with start, end, and duration.
|
|
101
|
+
* Returns the component config values captured immediately before the
|
|
102
|
+
* runtime-applied config patch, or undefined when the component did not
|
|
103
|
+
* change in this update.
|
|
210
104
|
*/
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
//#endregion
|
|
214
|
-
//#region src/pipelines/pipeline-context.d.ts
|
|
215
|
-
/**
|
|
216
|
-
* Base interface for all pipeline context objects.
|
|
217
|
-
* Provides hooks for runtime state and control flow during pipeline execution.
|
|
218
|
-
*/
|
|
219
|
-
interface IPipelineContext {
|
|
105
|
+
getPreviousValue<TConfig extends ConfigRecord>(componentType: ComponentTypeUid): Immutable<TConfig> | undefined;
|
|
220
106
|
/**
|
|
221
|
-
*
|
|
222
|
-
*
|
|
107
|
+
* Queues a config update for an entity. Config updates use the normal entity
|
|
108
|
+
* update path, but carry only component config patches.
|
|
223
109
|
*/
|
|
224
|
-
|
|
110
|
+
updateConfig<TConfig extends ConfigRecord>(target: IEntityProxy, config: IEntityConfigSnapshot<TConfig>): void;
|
|
225
111
|
}
|
|
226
112
|
/**
|
|
227
|
-
*
|
|
228
|
-
* Allows middleware to query status and influence pipeline flow.
|
|
229
|
-
*/
|
|
230
|
-
type PipelineRuntime = {
|
|
231
|
-
/**
|
|
232
|
-
* Flag to request pipeline halt.
|
|
233
|
-
* Set to true to stop executing remaining middleware (cleanup still runs).
|
|
234
|
-
*/
|
|
235
|
-
shouldStop?: boolean;
|
|
236
|
-
/**
|
|
237
|
-
* Optional error state if an exception occurred during execution.
|
|
238
|
-
*/
|
|
239
|
-
error?: any;
|
|
240
|
-
/**
|
|
241
|
-
* Results collected from middleware execution.
|
|
242
|
-
* Typically includes performance metrics and operational results.
|
|
243
|
-
*/
|
|
244
|
-
readonly metrics?: PerformanceTimeEntry[];
|
|
245
|
-
};
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/pipelines/middleware.d.ts
|
|
248
|
-
/**
|
|
249
|
-
* The basic unit of work in a pipeline.
|
|
250
|
-
* Middleware are chained together to form processing pipelines.
|
|
251
|
-
* Each middleware can inspect/modify context during dispatch and perform cleanup on their changes.
|
|
113
|
+
* Config-specific API for the current system execution.
|
|
252
114
|
*
|
|
253
|
-
*
|
|
115
|
+
* The runtime applies config patches before the config phase runs. This context
|
|
116
|
+
* records the component config values immediately before the patch was applied,
|
|
117
|
+
* then exposes both previous and current values to config middleware.
|
|
118
|
+
*
|
|
119
|
+
* The mutable API includes an `applyConfig` method for the runtime to set the current update,
|
|
120
|
+
* apply its config patch, and capture previous values.
|
|
121
|
+
* Systems middleware should use the readonly variant.
|
|
254
122
|
*/
|
|
255
|
-
interface
|
|
256
|
-
/**
|
|
257
|
-
* Optional name for debugging and logging purposes.
|
|
258
|
-
*/
|
|
259
|
-
readonly name?: string;
|
|
123
|
+
interface ISystemContextConfig extends ISystemContextConfigReadonly {
|
|
260
124
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @param
|
|
264
|
-
* @returns True to execute action, false to skip.
|
|
125
|
+
* Sets the current entity update, applies its config patch, and captures previous values for change detection.
|
|
126
|
+
* @param update The current entity update.
|
|
127
|
+
* @param isInitializing Specify whether the entity is initializing.
|
|
265
128
|
*/
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* The main unit of work executed as part of the pipeline.
|
|
269
|
-
* Middlewares execute in registration order during dispatch phase.
|
|
270
|
-
* Can read and modify the context to influence downstream middleware and results.
|
|
271
|
-
* @param context The pipeline context containing all relevant state.
|
|
272
|
-
*/
|
|
273
|
-
action(context: TContext): void | Promise<void>;
|
|
274
|
-
/**
|
|
275
|
-
* Optional cleanup function executed during pipeline teardown.
|
|
276
|
-
* Middlewares execute in reverse registration order during cleanup phase.
|
|
277
|
-
* Used to release resources, clear temporary state, and perform final operations.
|
|
278
|
-
* @param context The pipeline context (may be in modified state from action phases).
|
|
279
|
-
*/
|
|
280
|
-
cleanup?(context: TContext): void | Promise<void>;
|
|
129
|
+
applyConfig(update: IEntityUpdate | undefined, isInitializing?: boolean): void;
|
|
281
130
|
}
|
|
282
131
|
//#endregion
|
|
283
|
-
//#region src/
|
|
132
|
+
//#region src/systems/pipeline/system-middleware.d.ts
|
|
133
|
+
type SystemMiddlewareName = string;
|
|
134
|
+
type SystemModuleName = string;
|
|
135
|
+
type MiddlewareRegistry = Map<SystemMiddlewareName, SystemModuleName>;
|
|
136
|
+
type MiddlewareRegistryReadonly = ReadonlyMap<SystemMiddlewareName, SystemModuleName>;
|
|
284
137
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
138
|
+
* A middleware unit that operates within the system pipeline.
|
|
139
|
+
* System middleware receive comprehensive context about the entity being processed
|
|
140
|
+
* and can influence entity state and behavior through various APIs.
|
|
288
141
|
*
|
|
289
|
-
* @template
|
|
142
|
+
* @template TEntity - The entity type this middleware handles.
|
|
290
143
|
*/
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Decides how to execute a middleware's action.
|
|
294
|
-
* Can add pre/post processing, error handling, or performance tracking around the middleware.
|
|
295
|
-
* @param context The current pipeline context.
|
|
296
|
-
* @param middleware The middleware whose action should be executed.
|
|
297
|
-
*/
|
|
298
|
-
dispatch(context: TContext, middleware: IMiddleware<TContext>): void | Promise<void>;
|
|
299
|
-
/**
|
|
300
|
-
* Decides how to execute a middleware's cleanup.
|
|
301
|
-
* Can add pre/post processing or error handling around cleanup operations.
|
|
302
|
-
* @param context The current pipeline context.
|
|
303
|
-
* @param middleware The middleware whose cleanup should be executed.
|
|
304
|
-
*/
|
|
305
|
-
cleanup(context: TContext, middleware: IMiddleware<TContext>): void | Promise<void>;
|
|
306
|
-
}
|
|
144
|
+
type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
|
|
307
145
|
//#endregion
|
|
308
|
-
//#region src/
|
|
146
|
+
//#region src/systems/pipeline/system-context-control.d.ts
|
|
147
|
+
declare enum SystemContextControlState {
|
|
148
|
+
none = "none",
|
|
149
|
+
enableCurrentSystem = "enableCurrentSystem",
|
|
150
|
+
disableCurrentSystem = "disableCurrentSystem",
|
|
151
|
+
enableCurrentModule = "enableCurrentModule",
|
|
152
|
+
disableCurrentModule = "disableCurrentModule"
|
|
153
|
+
}
|
|
309
154
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* Used throughout the ECS system for entity initialization, updates, rendering, and synchronization.
|
|
313
|
-
*
|
|
314
|
-
* @template TContext - The context type passed to all registered middleware.
|
|
155
|
+
* Interface for controlling the execution of systems and modules within a system context.
|
|
156
|
+
* This allows middleware to enable or disable specific systems or entire modules for the current entity.
|
|
315
157
|
*/
|
|
316
|
-
interface
|
|
317
|
-
/**
|
|
318
|
-
* The pipeline's name, useful for debugging and logging.
|
|
319
|
-
*/
|
|
320
|
-
readonly name?: string;
|
|
158
|
+
interface ISystemContextControl {
|
|
321
159
|
/**
|
|
322
|
-
*
|
|
160
|
+
* Disables the current system for the current entity.
|
|
323
161
|
*/
|
|
324
|
-
|
|
162
|
+
disableCurrentSystem(): void;
|
|
325
163
|
/**
|
|
326
|
-
*
|
|
327
|
-
* Allows inspection of the execution chain.
|
|
164
|
+
* Re-enables the current system for the current entity.
|
|
328
165
|
*/
|
|
329
|
-
|
|
166
|
+
enableCurrentSystem(): void;
|
|
330
167
|
/**
|
|
331
|
-
*
|
|
332
|
-
* Middleware is added to the end of the chain and executed in registration order during dispatch.
|
|
333
|
-
* @param middleware - The middleware to register.
|
|
334
|
-
* @returns This instance for method chaining.
|
|
168
|
+
* Disables the current module for the current entity.
|
|
335
169
|
*/
|
|
336
|
-
|
|
170
|
+
disableCurrentModule(): void;
|
|
337
171
|
/**
|
|
338
|
-
*
|
|
339
|
-
* Each middleware's action is called, allowing modifications to context state.
|
|
340
|
-
* Execution continues until all middleware complete or a middleware requests early termination.
|
|
341
|
-
* @param context - The context object passed to all middleware.
|
|
172
|
+
* Re-enables the current module for the current entity.
|
|
342
173
|
*/
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Executes the cleanup phase with all registered middleware in reverse order.
|
|
346
|
-
* Allows middleware to perform resource cleanup and final operations.
|
|
347
|
-
* Typically called after dispatch to ensure proper teardown.
|
|
348
|
-
*
|
|
349
|
-
* @param context - The context object that will be passed to each middleware function.
|
|
350
|
-
*/
|
|
351
|
-
cleanup(context: Partial<TContext>): void | Promise<void>;
|
|
174
|
+
enableCurrentModule(): void;
|
|
352
175
|
}
|
|
353
|
-
//#endregion
|
|
354
|
-
//#region src/pipelines/pipeline-nested.d.ts
|
|
355
176
|
/**
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* @template N - The context type for the nested pipelines.
|
|
177
|
+
* Extended system context interface that includes control state for middleware to manage system and module execution.
|
|
178
|
+
* This allows middleware to query and modify the execution state of systems and modules during pipeline processing.
|
|
360
179
|
*/
|
|
361
|
-
interface
|
|
180
|
+
interface ISystemContextControlState extends ISystemContextControl {
|
|
362
181
|
/**
|
|
363
|
-
*
|
|
182
|
+
* Current state of system/module execution control, indicating whether the current system or module is enabled or disabled.
|
|
364
183
|
*/
|
|
365
|
-
readonly
|
|
184
|
+
readonly state: SystemContextControlState;
|
|
366
185
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
186
|
+
* Checks if a specific middleware is currently disabled in the context, allowing middleware to conditionally execute logic based on the enabled/disabled state of other middleware.
|
|
187
|
+
* @param middleware - The middleware to check for disabled state.
|
|
188
|
+
* @returns True if the specified middleware is currently disabled, false otherwise.
|
|
369
189
|
*/
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Context for a nested pipeline.
|
|
374
|
-
* Provides access to both current and previous nested context data plus the parent context.
|
|
375
|
-
*
|
|
376
|
-
* @template P - The context type of the parent pipeline.
|
|
377
|
-
*/
|
|
378
|
-
interface INestedContext<P extends IParentContext<any>> extends IPipelineContext {
|
|
190
|
+
isMiddlewareDisabled(middleware: ISystemMiddleware<IEntity>): boolean;
|
|
379
191
|
/**
|
|
380
|
-
*
|
|
192
|
+
* Disables a specific middleware in the context.
|
|
193
|
+
* @param middleware - The middleware to disable.
|
|
381
194
|
*/
|
|
382
|
-
|
|
195
|
+
disableMiddleware(middleware: ISystemMiddleware<IEntity>): void;
|
|
383
196
|
/**
|
|
384
|
-
*
|
|
197
|
+
* Enables a specific middleware in the context.
|
|
198
|
+
* @param middleware - The middleware to enable.
|
|
385
199
|
*/
|
|
386
|
-
|
|
200
|
+
enableMiddleware(middleware: ISystemMiddleware<IEntity>): void;
|
|
387
201
|
/**
|
|
388
|
-
*
|
|
202
|
+
* Disables an entire module of middleware in the context.
|
|
203
|
+
* @param middleware - A middleware from the module to disable.
|
|
389
204
|
*/
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Middleware executing within a nested pipeline.
|
|
394
|
-
*
|
|
395
|
-
* @template P - The context type of the parent pipeline.
|
|
396
|
-
*/
|
|
397
|
-
type INestedMiddleware<P extends IParentContext<any>> = IMiddleware<INestedContext<P>>;
|
|
398
|
-
/**
|
|
399
|
-
* Middleware executing within a parent pipeline (containing nested pipelines).
|
|
400
|
-
*
|
|
401
|
-
* @template P - The context type of the parent pipeline.
|
|
402
|
-
*/
|
|
403
|
-
type IParentMiddleware<P extends IParentContext<any>> = IMiddleware<P>;
|
|
404
|
-
//#endregion
|
|
405
|
-
//#region src/pipelines/pipeline-runner.d.ts
|
|
406
|
-
/**
|
|
407
|
-
* Executes an array of middleware in a controlled sequence.
|
|
408
|
-
* Supports custom execution strategies through implementation flexibility.
|
|
409
|
-
* Used by pipelines to manage complex middleware chains with features like early termination and nested pipelines.
|
|
410
|
-
*
|
|
411
|
-
* @template TContext - The context type passed to all middleware.
|
|
412
|
-
*/
|
|
413
|
-
interface IPipelineRunner<TContext extends IPipelineContext> {
|
|
414
|
-
/**
|
|
415
|
-
* Executes the action phase of all middleware in sequence.
|
|
416
|
-
* Middleware at startIndex and onward are executed in order.
|
|
417
|
-
* Execution may terminate early if middleware requests it via context.runtime.shouldStop.
|
|
418
|
-
* @param context - The context passed to each middleware action.
|
|
419
|
-
* @param middleware - The ordered middleware array to execute.
|
|
420
|
-
* @param startIndex - Optional starting position in the middleware array (default: 0).
|
|
421
|
-
*/
|
|
422
|
-
dispatch(context: Partial<TContext>, middleware: IMiddleware<TContext>[], startIndex?: number): void | Promise<void>;
|
|
205
|
+
disableModule(middleware: ISystemMiddleware<IEntity>): void;
|
|
423
206
|
/**
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* Allows proper resource release and final state management.
|
|
427
|
-
* @param context - The context passed to each middleware cleanup.
|
|
428
|
-
* @param middleware - The ordered middleware array for cleanup (reversed during execution).
|
|
207
|
+
* Enables an entire module of middleware in the context.
|
|
208
|
+
* @param middleware - A middleware from the module to enable.
|
|
429
209
|
*/
|
|
430
|
-
|
|
210
|
+
enableModule(middleware: ISystemMiddleware<IEntity>): void;
|
|
431
211
|
}
|
|
432
212
|
//#endregion
|
|
433
213
|
//#region src/systems/pipeline/system-context-events.d.ts
|
|
@@ -591,7 +371,7 @@ interface ISystemContextRepository {
|
|
|
591
371
|
*/
|
|
592
372
|
getEntity<TEntity extends IEntity>(proxy: EntityProxy<TEntity> | EntityTypeUid): Immutable<TEntity>;
|
|
593
373
|
/**
|
|
594
|
-
*
|
|
374
|
+
* Enqueues an entity for update.
|
|
595
375
|
* Triggers the update pipeline for the entity.
|
|
596
376
|
* @param target - Optional specific entity to update. Defaults to current entity in context.
|
|
597
377
|
*/
|
|
@@ -612,7 +392,7 @@ interface ISystemContextRepository {
|
|
|
612
392
|
*/
|
|
613
393
|
interface ISystemContextScheduler {
|
|
614
394
|
/**
|
|
615
|
-
* Schedules an entity
|
|
395
|
+
* Schedules or replaces an entity update schedule.
|
|
616
396
|
* If no target is specified, schedules the current entity.
|
|
617
397
|
* If no interval is specified, schedules on a default interval.
|
|
618
398
|
* @param target - Optional entity to schedule. Defaults to current entity in context.
|
|
@@ -633,6 +413,30 @@ interface ISystemContextScheduler {
|
|
|
633
413
|
hasSchedule(target?: IEntityProxy): boolean;
|
|
634
414
|
}
|
|
635
415
|
//#endregion
|
|
416
|
+
//#region src/utils/json-serializer.d.ts
|
|
417
|
+
/**
|
|
418
|
+
* Custom JSON serialization and deserialization interface.
|
|
419
|
+
* Allows different serialization strategies for handling complex types.
|
|
420
|
+
* Used for entity snapshots, events, and any data needing JSON conversion.
|
|
421
|
+
*/
|
|
422
|
+
interface IJsonSerializer {
|
|
423
|
+
/**
|
|
424
|
+
* Converts an object to a serializable JSON representation.
|
|
425
|
+
* Handles types that don't serialize naturally (dates, maps, custom objects, etc.).
|
|
426
|
+
* @param value - The object to serialize.
|
|
427
|
+
* @returns A JSON-serializable representation.
|
|
428
|
+
*/
|
|
429
|
+
serializeCustom(value: object): string;
|
|
430
|
+
/**
|
|
431
|
+
* Converts a JSON string back to its original object type.
|
|
432
|
+
* Reconstructs complex types from their serialized form.
|
|
433
|
+
* @template TObject - The target object type.
|
|
434
|
+
* @param text - The JSON string to deserialize.
|
|
435
|
+
* @returns The deserialized object of the specified type.
|
|
436
|
+
*/
|
|
437
|
+
parseCustom<TObject>(text: string): TObject;
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
636
440
|
//#region src/systems/pipeline/system-context-snapshot.d.ts
|
|
637
441
|
/**
|
|
638
442
|
* System context API for entity serialization and state transfer.
|
|
@@ -685,6 +489,10 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
685
489
|
* The entity currently being processed by this middleware.
|
|
686
490
|
*/
|
|
687
491
|
readonly entity: Immutable<TEntity>;
|
|
492
|
+
/**
|
|
493
|
+
* Config metadata and config-update API for the current update.
|
|
494
|
+
*/
|
|
495
|
+
readonly config: Immutable<ISystemContextConfigReadonly>;
|
|
688
496
|
/**
|
|
689
497
|
* Information about the update triggering this system execution.
|
|
690
498
|
* Contains type (update/remove) and optional model/snapshot data.
|
|
@@ -694,6 +502,10 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
694
502
|
* Event system API for publishing and subscribing to entity events.
|
|
695
503
|
*/
|
|
696
504
|
readonly events: Immutable<ISystemContextEvents>;
|
|
505
|
+
/**
|
|
506
|
+
* Logging interface for debug and diagnostic output.
|
|
507
|
+
*/
|
|
508
|
+
readonly logger: Immutable<ILogger>;
|
|
697
509
|
/**
|
|
698
510
|
* Proxy management API for establishing and managing entity relationships.
|
|
699
511
|
*/
|
|
@@ -711,9 +523,13 @@ interface ISystemContext<TEntity extends IEntity> extends IPipelineContext {
|
|
|
711
523
|
*/
|
|
712
524
|
readonly snapshot: Immutable<ISystemContextSnapshot>;
|
|
713
525
|
/**
|
|
714
|
-
*
|
|
526
|
+
* Control API for enabling/disabling the current system or entire module during execution.
|
|
715
527
|
*/
|
|
716
|
-
readonly
|
|
528
|
+
readonly systems: Immutable<ISystemContextControl>;
|
|
529
|
+
/**
|
|
530
|
+
* The per-entity runtime state and control interface for this system context.
|
|
531
|
+
*/
|
|
532
|
+
readonly runtime: PipelineRuntime;
|
|
717
533
|
}
|
|
718
534
|
//#endregion
|
|
719
535
|
//#region src/systems/pipeline/system-context-mutable.d.ts
|
|
@@ -730,6 +546,117 @@ interface IMutableSystemContext<TEntity extends IEntity> extends ISystemContext<
|
|
|
730
546
|
setRuntime(runtime: PipelineRuntime): void;
|
|
731
547
|
}
|
|
732
548
|
//#endregion
|
|
549
|
+
//#region src/utils/dispatch-sequential.d.ts
|
|
550
|
+
/**
|
|
551
|
+
* Executes a function for each item in an iterable, sequentially.
|
|
552
|
+
*
|
|
553
|
+
* Uses a sync fast-path: iterates synchronously until the first Promise is
|
|
554
|
+
* encountered, then switches to async for the remainder. If no item produces
|
|
555
|
+
* a Promise, the entire call stays synchronous with zero async overhead.
|
|
556
|
+
*
|
|
557
|
+
* @param items - The iterable to iterate over.
|
|
558
|
+
* @param fn - The function to call for each item. May return void or a Promise.
|
|
559
|
+
* @returns void if all calls were synchronous, or a Promise if any were async.
|
|
560
|
+
*/
|
|
561
|
+
declare function dispatchSequential<T>(items: Iterable<T>, fn: (item: T) => void | Promise<void>): void | Promise<void>;
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/utils/performance.d.ts
|
|
564
|
+
type TickMetricEntry = {
|
|
565
|
+
name: string;
|
|
566
|
+
category: string;
|
|
567
|
+
totalMs: number;
|
|
568
|
+
count: number;
|
|
569
|
+
};
|
|
570
|
+
type TickSnapshot = {
|
|
571
|
+
tickIndex: number;
|
|
572
|
+
tickDurationMs: number;
|
|
573
|
+
fps: number;
|
|
574
|
+
queueSize: number;
|
|
575
|
+
timestamp: number;
|
|
576
|
+
metrics: TickMetricEntry[];
|
|
577
|
+
render?: RenderSnapshot;
|
|
578
|
+
};
|
|
579
|
+
type RenderSnapshot = {
|
|
580
|
+
frameTimeMs: number;
|
|
581
|
+
renderTimeMs: number;
|
|
582
|
+
gpuFrameTimeMs: number;
|
|
583
|
+
drawCalls: number;
|
|
584
|
+
activeMeshesEvalMs: number;
|
|
585
|
+
cameraRenderMs: number;
|
|
586
|
+
totalVertices: number;
|
|
587
|
+
activeIndices: number;
|
|
588
|
+
};
|
|
589
|
+
type MiddlewareMetricsSummary = {
|
|
590
|
+
name: string;
|
|
591
|
+
category: PipelineCategoryName;
|
|
592
|
+
count: number;
|
|
593
|
+
totalMs: number;
|
|
594
|
+
avgMs: number;
|
|
595
|
+
minMs: number;
|
|
596
|
+
maxMs: number;
|
|
597
|
+
lastMs: number;
|
|
598
|
+
};
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/utils/performance-timer.d.ts
|
|
601
|
+
/**
|
|
602
|
+
* Unique identifier for a timer instance.
|
|
603
|
+
*/
|
|
604
|
+
type PerformanceTimerUid = number;
|
|
605
|
+
/**
|
|
606
|
+
* Options for identifying and categorizing performance metrics.
|
|
607
|
+
* Used by pipeline factories and performance decorators.
|
|
608
|
+
*/
|
|
609
|
+
type PerformanceMetricOptions = {
|
|
610
|
+
name?: string;
|
|
611
|
+
category?: string;
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* Record of a completed timer measurement.
|
|
615
|
+
* Captures timing information for performance analysis and profiling.
|
|
616
|
+
*/
|
|
617
|
+
interface PerformanceTimeEntry {
|
|
618
|
+
/**
|
|
619
|
+
* The name identifying this timer.
|
|
620
|
+
*/
|
|
621
|
+
name: string;
|
|
622
|
+
/**
|
|
623
|
+
* The category of this metric (e.g. 'module', 'runtime', 'system').
|
|
624
|
+
*/
|
|
625
|
+
category?: string;
|
|
626
|
+
/**
|
|
627
|
+
* Timestamp in milliseconds when the timer started.
|
|
628
|
+
*/
|
|
629
|
+
startedAt: number;
|
|
630
|
+
/**
|
|
631
|
+
* Timestamp in milliseconds when the timer ended.
|
|
632
|
+
*/
|
|
633
|
+
endedAt?: number;
|
|
634
|
+
/**
|
|
635
|
+
* Duration in milliseconds that elapsed.
|
|
636
|
+
*/
|
|
637
|
+
msPassed?: number;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Interface for measuring operation duration.
|
|
641
|
+
* Provides start/stop functionality for performance profiling.
|
|
642
|
+
* Used throughout the system to collect timing metrics.
|
|
643
|
+
*/
|
|
644
|
+
interface IPerformanceTimer {
|
|
645
|
+
/**
|
|
646
|
+
* Starts a new timer.
|
|
647
|
+
* @param name - Label for this timer (used in results).
|
|
648
|
+
* @param category - Optional category for grouping metrics.
|
|
649
|
+
* @returns A unique identifier for this timer instance.
|
|
650
|
+
*/
|
|
651
|
+
startTimer(name: string, category?: string): PerformanceTimerUid;
|
|
652
|
+
/**
|
|
653
|
+
* Stops a timer and returns the recorded metrics.
|
|
654
|
+
* @param timerUid - The timer identifier returned by startTimer.
|
|
655
|
+
* @returns Complete timing entry with start, end, and duration.
|
|
656
|
+
*/
|
|
657
|
+
endTimer(timerUid: PerformanceTimerUid): PerformanceTimeEntry;
|
|
658
|
+
}
|
|
659
|
+
//#endregion
|
|
733
660
|
//#region src/factories/context-factory.d.ts
|
|
734
661
|
/**
|
|
735
662
|
* Creates and caches per-entity system contexts.
|
|
@@ -745,9 +672,10 @@ interface IContextFactory {
|
|
|
745
672
|
* On subsequent calls, returns the cached context.
|
|
746
673
|
* @template TEntity - The entity type for which the system context is being created.
|
|
747
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.
|
|
748
676
|
* @returns The mutable system context for the entity.
|
|
749
677
|
*/
|
|
750
|
-
getOrCreateContext<TEntity extends IEntity>(entity: Immutable<TEntity
|
|
678
|
+
getOrCreateContext<TEntity extends IEntity>(entity: Immutable<TEntity>, registry?: MiddlewareRegistryReadonly): IMutableSystemContext<TEntity>;
|
|
751
679
|
/**
|
|
752
680
|
* Retrieves a previously cached system context by entity UID.
|
|
753
681
|
* @template TEntity - The entity type.
|
|
@@ -772,7 +700,7 @@ type PipelineCategoryName = string;
|
|
|
772
700
|
/**
|
|
773
701
|
* Built-in metric categories for classifying pipeline and middleware performance entries.
|
|
774
702
|
*
|
|
775
|
-
* - `module` — System module pipelines (initialize, update, render, sync phases).
|
|
703
|
+
* - `module` — System module pipelines (initialize, config, update, render, sync phases).
|
|
776
704
|
* - `runtime` — Runtime orchestration pipeline and its middleware.
|
|
777
705
|
* - `system` — Individual system middleware within a module pipeline.
|
|
778
706
|
*/
|
|
@@ -784,7 +712,7 @@ declare enum PipelineCategory {
|
|
|
784
712
|
/**
|
|
785
713
|
* Options for identifying and categorizing performance metrics on pipelines.
|
|
786
714
|
*/
|
|
787
|
-
type
|
|
715
|
+
type PipelineOptions = {
|
|
788
716
|
/** Display name for the pipeline in performance metrics. */pipelineName: string; /** Category assigned to pipeline-level metric entries. */
|
|
789
717
|
pipelineCategory: PipelineCategoryName; /** Category assigned to per-middleware metric entries within this pipeline. */
|
|
790
718
|
middlewareCategory: PipelineCategoryName;
|
|
@@ -801,12 +729,12 @@ interface IPipelineFactory {
|
|
|
801
729
|
* @param options - Optional performance metric options (name, category) for the pipeline.
|
|
802
730
|
* @returns A new pipeline instance ready for middleware registration.
|
|
803
731
|
*/
|
|
804
|
-
createPipeline<TContext extends IPipelineContext>(options?:
|
|
732
|
+
createPipeline<TContext extends IPipelineContext>(options?: PipelineOptions): IPipeline<TContext>;
|
|
805
733
|
}
|
|
806
734
|
//#endregion
|
|
807
735
|
//#region src/systems/system-type.d.ts
|
|
808
736
|
/**
|
|
809
|
-
* The
|
|
737
|
+
* The five phases of entity system execution in each frame.
|
|
810
738
|
* Each phase serves a specific purpose in the entity lifecycle and can be extended by custom system types.
|
|
811
739
|
* The runtime handles each phase in order, allowing systems to perform stage-specific operations.
|
|
812
740
|
*/
|
|
@@ -816,69 +744,51 @@ declare enum SystemType {
|
|
|
816
744
|
* Runs once when the entity is first created or initialized.
|
|
817
745
|
*/
|
|
818
746
|
initialize = 0,
|
|
747
|
+
/**
|
|
748
|
+
* Config application and config-dependent resource reconciliation.
|
|
749
|
+
* Runs on entity creation and on updates that carry a config payload.
|
|
750
|
+
*/
|
|
751
|
+
config = 1,
|
|
819
752
|
/**
|
|
820
753
|
* Main logic and state updates for the entity.
|
|
821
754
|
* Runs on every update to change entity behavior and properties.
|
|
822
755
|
*/
|
|
823
|
-
update =
|
|
756
|
+
update = 2,
|
|
824
757
|
/**
|
|
825
758
|
* Output and visualization operations.
|
|
826
759
|
* Runs after updates to render or display the entity state.
|
|
827
760
|
*/
|
|
828
|
-
render =
|
|
761
|
+
render = 3,
|
|
829
762
|
/**
|
|
830
763
|
* Synchronization and persistence.
|
|
831
764
|
* Runs last to synchronize state with external systems or storage.
|
|
832
765
|
*/
|
|
833
|
-
sync =
|
|
766
|
+
sync = 4
|
|
834
767
|
}
|
|
835
768
|
//#endregion
|
|
836
|
-
//#region src/systems/module/systems-module.d.ts
|
|
837
|
-
|
|
838
|
-
* Collection of pipelines for a specific entity type.
|
|
839
|
-
* Defines the complete system processing flow for one entity category.
|
|
840
|
-
*
|
|
841
|
-
* @template TEntity - The entity type this module processes.
|
|
842
|
-
*/
|
|
843
|
-
interface ISystemsModule<TEntity extends IEntity> {
|
|
769
|
+
//#region src/systems/module/systems-module-builder.d.ts
|
|
770
|
+
interface ISystemsModuleBuilderReadonly<TEntity extends IEntity> {
|
|
844
771
|
/**
|
|
845
|
-
* The
|
|
846
|
-
* Each pipeline contains middleware that operates on the entity.
|
|
772
|
+
* The Module's name.
|
|
847
773
|
*/
|
|
848
|
-
readonly
|
|
774
|
+
readonly name: string;
|
|
849
775
|
/**
|
|
850
|
-
*
|
|
851
|
-
* If provided, is called when a new entity of this type is created.
|
|
852
|
-
* @param model - The initialization model.
|
|
853
|
-
* @returns The initialized entity.
|
|
776
|
+
* Read-only map of system pipelines keyed by SystemType.
|
|
854
777
|
*/
|
|
855
|
-
readonly
|
|
778
|
+
readonly pipelines: ReadonlyMap<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
856
779
|
/**
|
|
857
|
-
*
|
|
858
|
-
* A new scope ID is auto-generated. All child entities inherit this scope.
|
|
859
|
-
* Typically used for root entities like Engine.
|
|
780
|
+
* Read-only registry mapping middleware names to their originating module names.
|
|
860
781
|
*/
|
|
861
|
-
readonly
|
|
782
|
+
readonly middlewareRegistry: MiddlewareRegistryReadonly;
|
|
862
783
|
/**
|
|
863
|
-
*
|
|
864
|
-
* It joins the inherited scope and becomes resolvable via `context.proxies.get()`
|
|
865
|
-
* by any entity in the same scope. Throws if no scope exists.
|
|
866
|
-
* Typically used for scope-wide entities like Scene, Input, AssetsManager.
|
|
784
|
+
* Whether this entity type is a scope root. When initialized, a new scope is auto-generated and all child entities inherit it.
|
|
867
785
|
*/
|
|
868
|
-
readonly
|
|
786
|
+
readonly scopeRoot: boolean;
|
|
787
|
+
/**
|
|
788
|
+
* Whether this entity type is a scoped proxy. When initialized, the entity registers itself in the inherited scope, making it resolvable via `context.proxies.get()` by any entity in the same scope.
|
|
789
|
+
*/
|
|
790
|
+
readonly scopedProxy: boolean;
|
|
869
791
|
}
|
|
870
|
-
//#endregion
|
|
871
|
-
//#region src/systems/pipeline/system-middleware.d.ts
|
|
872
|
-
/**
|
|
873
|
-
* A middleware unit that operates within the system pipeline.
|
|
874
|
-
* System middleware receive comprehensive context about the entity being processed
|
|
875
|
-
* and can influence entity state and behavior through various APIs.
|
|
876
|
-
*
|
|
877
|
-
* @template TEntity - The entity type this middleware handles.
|
|
878
|
-
*/
|
|
879
|
-
type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
|
|
880
|
-
//#endregion
|
|
881
|
-
//#region src/systems/module/systems-module-builder.d.ts
|
|
882
792
|
/**
|
|
883
793
|
* Builder pattern interface for constructing system modules.
|
|
884
794
|
* Allows incremental registration of systems and modules for an entity type.
|
|
@@ -886,28 +796,12 @@ type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEn
|
|
|
886
796
|
*
|
|
887
797
|
* @template TEntity - The entity type for which systems are being added.
|
|
888
798
|
*/
|
|
889
|
-
interface ISystemsModuleBuilder<TEntity extends IEntity> {
|
|
890
|
-
|
|
891
|
-
* The Module Builder's name.
|
|
892
|
-
*/
|
|
893
|
-
readonly name: string;
|
|
894
|
-
/**
|
|
895
|
-
* The pipelines being built.
|
|
896
|
-
* Accessible during and after construction.
|
|
897
|
-
*/
|
|
898
|
-
readonly pipelines: ReadonlyMap<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
899
|
-
/**
|
|
900
|
-
* Whether this entity type is a scope root.
|
|
901
|
-
*/
|
|
902
|
-
readonly scopeRoot: boolean;
|
|
903
|
-
/**
|
|
904
|
-
* Whether this entity type is a scoped proxy.
|
|
905
|
-
*/
|
|
906
|
-
readonly scopedProxy: boolean;
|
|
799
|
+
interface ISystemsModuleBuilder<TEntity extends IEntity> extends ISystemsModuleBuilderReadonly<TEntity> {
|
|
800
|
+
readonly middlewareRegistry: MiddlewareRegistry;
|
|
907
801
|
/**
|
|
908
802
|
* Registers middleware systems for a specific pipeline stage.
|
|
909
803
|
* The middleware are added to the pipeline in the order provided.
|
|
910
|
-
* @param type - The pipeline stage (initialize, update, render, sync).
|
|
804
|
+
* @param type - The pipeline stage (initialize, config, update, render, sync).
|
|
911
805
|
* @param systems - Array of middleware to add.
|
|
912
806
|
* @returns This builder for method chaining.
|
|
913
807
|
*/
|
|
@@ -936,6 +830,27 @@ interface ISystemsModuleBuilder<TEntity extends IEntity> {
|
|
|
936
830
|
setScopedProxy(): this;
|
|
937
831
|
}
|
|
938
832
|
//#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
|
|
939
854
|
//#region src/systems/module/systems-module-repository.d.ts
|
|
940
855
|
/**
|
|
941
856
|
* Central registry for all systems modules in the ECS.
|
|
@@ -980,9 +895,9 @@ interface ISystemsRuntime {
|
|
|
980
895
|
* Processes a single entity update through its system pipeline.
|
|
981
896
|
* If no update is provided, may dequeue one from an internal queue.
|
|
982
897
|
* @param update - Optional specific update to process. If omitted, dequeues the next update.
|
|
983
|
-
* @returns
|
|
898
|
+
* @returns Pipeline results containing execution data and metrics.
|
|
984
899
|
*/
|
|
985
|
-
runTick(update?: IEntityUpdate):
|
|
900
|
+
runTick(update?: IEntityUpdate): PipelineRuntime | Promise<PipelineRuntime> | void;
|
|
986
901
|
}
|
|
987
902
|
//#endregion
|
|
988
903
|
//#region src/systems/runtime/systems-runtime-context.d.ts
|
|
@@ -998,6 +913,10 @@ interface ISystemsRuntimeContext<TEntity extends IEntity> extends IPipelineConte
|
|
|
998
913
|
* Indicates if the system pipeline should perform initialization for the current entity.
|
|
999
914
|
*/
|
|
1000
915
|
readonly shouldInitialize?: boolean;
|
|
916
|
+
/**
|
|
917
|
+
* Indicates if the config system phase should run for the current entity.
|
|
918
|
+
*/
|
|
919
|
+
readonly shouldConfigure?: boolean;
|
|
1001
920
|
/**
|
|
1002
921
|
* The systems module for the current entity type.
|
|
1003
922
|
*/
|
|
@@ -1061,5 +980,5 @@ interface ISystemsFactory {
|
|
|
1061
980
|
createSystemsModuleBuilder<TEntity extends IEntity>(name: string): ISystemsModuleBuilder<TEntity>;
|
|
1062
981
|
}
|
|
1063
982
|
//#endregion
|
|
1064
|
-
export {
|
|
1065
|
-
//# sourceMappingURL=index-
|
|
983
|
+
export { ISystemContextRepository as A, SystemModuleName as B, TickSnapshot as C, ISystemContextSnapshot as D, ISystemContext as E, SystemContextControlState as F, LogLevel as G, ISystemContextConfigReadonly as H, ISystemMiddleware as I, MiddlewareRegistry as L, ISystemContextEvents as M, ISystemContextControl as N, IJsonSerializer as O, ISystemContextControlState as P, MiddlewareRegistryReadonly as R, TickMetricEntry as S, IMutableSystemContext as T, ILogger as U, ISystemContextConfig as V, ILoggerOptions as W, PerformanceMetricOptions as _, ISystemsRuntime as a, MiddlewareMetricsSummary as b, ISystemsModuleBuilder as c, IPipelineFactory as d, PipelineCategory as f, IPerformanceTimer as g, IContextFactory as h, ISystemsRuntimeContext as i, ISystemContextProxies as j, ISystemContextScheduler as k, ISystemsModuleBuilderReadonly as l, PipelineOptions as m, IRuntimeFactory as n, ISystemsModuleRepository as o, PipelineCategoryName as p, ISystemsRuntimeMiddleware as r, ISystemsModule as s, ISystemsFactory as t, SystemType as u, PerformanceTimeEntry as v, dispatchSequential as w, RenderSnapshot as x, PerformanceTimerUid as y, SystemMiddlewareName as z };
|
|
984
|
+
//# sourceMappingURL=index-D3rS2RFG.d.mts.map
|