@awesome-ecs/abstract 0.15.0 → 0.18.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 +35 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +7 -17
- package/dist/components/index.js.map +1 -1
- package/dist/entities/index.cjs +36 -0
- package/dist/entities/index.cjs.map +1 -0
- package/dist/entities/index.d.cts +17 -0
- package/dist/entities/index.d.ts +17 -7
- package/dist/entities/index.js +8 -22
- package/dist/entities/index.js.map +1 -1
- package/dist/entity-repository-Bu6rH-m5.d.ts +119 -0
- package/dist/entity-repository-awW_H993.d.cts +119 -0
- package/dist/factories/index.cjs +18 -0
- package/dist/factories/index.cjs.map +1 -0
- package/dist/factories/index.d.cts +27 -0
- package/dist/factories/index.d.ts +27 -2
- package/dist/factories/index.js +0 -18
- package/dist/factories/index.js.map +1 -1
- package/dist/index-BPDsRt_F.d.ts +117 -0
- package/dist/index-DK2CXVZ8.d.cts +117 -0
- package/dist/{utils/performance-timer.d.ts → performance-timer-XvdCbcAE.d.cts} +5 -3
- package/dist/performance-timer-XvdCbcAE.d.ts +13 -0
- package/dist/pipeline-BowCAITe.d.cts +83 -0
- package/dist/pipeline-D43CXxWG.d.ts +83 -0
- package/dist/pipelines/index.cjs +38 -0
- package/dist/pipelines/index.cjs.map +1 -0
- package/dist/pipelines/index.d.cts +44 -0
- package/dist/pipelines/index.d.ts +44 -4
- package/dist/pipelines/index.js +10 -19
- package/dist/pipelines/index.js.map +1 -1
- package/dist/systems/index.cjs +38 -0
- package/dist/systems/index.cjs.map +1 -0
- package/dist/systems/index.d.cts +55 -0
- package/dist/systems/index.d.ts +55 -13
- package/dist/systems/index.js +10 -28
- package/dist/systems/index.js.map +1 -1
- package/dist/systems-runtime-context-Cq4vxbHX.d.cts +163 -0
- package/dist/systems-runtime-context-DjppCqs4.d.ts +163 -0
- package/dist/types-BNwBqRWY.d.cts +22 -0
- package/dist/types-BNwBqRWY.d.ts +22 -0
- package/dist/utils/index.cjs +38 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +32 -0
- package/dist/utils/index.d.ts +32 -4
- package/dist/utils/index.js +10 -19
- package/dist/utils/index.js.map +1 -1
- package/package.json +61 -23
- package/dist/components/component.d.ts +0 -36
- package/dist/components/component.js +0 -3
- package/dist/components/component.js.map +0 -1
- package/dist/components/identity-component.d.ts +0 -24
- package/dist/components/identity-component.js +0 -8
- package/dist/components/identity-component.js.map +0 -1
- package/dist/entities/entity-events.d.ts +0 -52
- package/dist/entities/entity-events.js +0 -3
- package/dist/entities/entity-events.js.map +0 -1
- package/dist/entities/entity-proxies.d.ts +0 -25
- package/dist/entities/entity-proxies.js +0 -3
- package/dist/entities/entity-proxies.js.map +0 -1
- package/dist/entities/entity-queue.d.ts +0 -31
- package/dist/entities/entity-queue.js +0 -12
- package/dist/entities/entity-queue.js.map +0 -1
- package/dist/entities/entity-repository.d.ts +0 -16
- package/dist/entities/entity-repository.js +0 -3
- package/dist/entities/entity-repository.js.map +0 -1
- package/dist/entities/entity-scheduler.d.ts +0 -11
- package/dist/entities/entity-scheduler.js +0 -3
- package/dist/entities/entity-scheduler.js.map +0 -1
- package/dist/entities/entity-snapshot.d.ts +0 -24
- package/dist/entities/entity-snapshot.js +0 -3
- package/dist/entities/entity-snapshot.js.map +0 -1
- package/dist/entities/entity.d.ts +0 -33
- package/dist/entities/entity.js +0 -3
- package/dist/entities/entity.js.map +0 -1
- package/dist/factories/context-factory.d.ts +0 -9
- package/dist/factories/context-factory.js +0 -3
- package/dist/factories/context-factory.js.map +0 -1
- package/dist/factories/pipeline-factory.d.ts +0 -11
- package/dist/factories/pipeline-factory.js +0 -3
- package/dist/factories/pipeline-factory.js.map +0 -1
- package/dist/pipelines/middleware-result.d.ts +0 -5
- package/dist/pipelines/middleware-result.js +0 -3
- package/dist/pipelines/middleware-result.js.map +0 -1
- package/dist/pipelines/middleware-stop.d.ts +0 -5
- package/dist/pipelines/middleware-stop.js +0 -3
- package/dist/pipelines/middleware-stop.js.map +0 -1
- package/dist/pipelines/middleware.d.ts +0 -25
- package/dist/pipelines/middleware.js +0 -3
- package/dist/pipelines/middleware.js.map +0 -1
- package/dist/pipelines/pipeline.d.ts +0 -21
- package/dist/pipelines/pipeline.js +0 -3
- package/dist/pipelines/pipeline.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -3
- package/dist/runtime/index.js +0 -20
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/runtime-pipeline.d.ts +0 -11
- package/dist/runtime/runtime-pipeline.js +0 -3
- package/dist/runtime/runtime-pipeline.js.map +0 -1
- package/dist/runtime/runtime-result.d.ts +0 -20
- package/dist/runtime/runtime-result.js +0 -3
- package/dist/runtime/runtime-result.js.map +0 -1
- package/dist/runtime/runtime-status.d.ts +0 -7
- package/dist/runtime/runtime-status.js +0 -12
- package/dist/runtime/runtime-status.js.map +0 -1
- package/dist/systems/context/system-context-entity.d.ts +0 -8
- package/dist/systems/context/system-context-entity.js +0 -3
- package/dist/systems/context/system-context-entity.js.map +0 -1
- package/dist/systems/context/system-context-events.d.ts +0 -65
- package/dist/systems/context/system-context-events.js +0 -3
- package/dist/systems/context/system-context-events.js.map +0 -1
- package/dist/systems/context/system-context-proxies.d.ts +0 -12
- package/dist/systems/context/system-context-proxies.js +0 -3
- package/dist/systems/context/system-context-proxies.js.map +0 -1
- package/dist/systems/context/system-context-repository.d.ts +0 -15
- package/dist/systems/context/system-context-repository.js +0 -3
- package/dist/systems/context/system-context-repository.js.map +0 -1
- package/dist/systems/context/system-context-scheduler.d.ts +0 -9
- package/dist/systems/context/system-context-scheduler.js +0 -3
- package/dist/systems/context/system-context-scheduler.js.map +0 -1
- package/dist/systems/context/system-context-snapshot.d.ts +0 -14
- package/dist/systems/context/system-context-snapshot.js +0 -3
- package/dist/systems/context/system-context-snapshot.js.map +0 -1
- package/dist/systems/runtime/systems-runtime-context.d.ts +0 -20
- package/dist/systems/runtime/systems-runtime-context.js +0 -3
- package/dist/systems/runtime/systems-runtime-context.js.map +0 -1
- package/dist/systems/runtime/systems-runtime-middleware.d.ts +0 -8
- package/dist/systems/runtime/systems-runtime-middleware.js +0 -3
- package/dist/systems/runtime/systems-runtime-middleware.js.map +0 -1
- package/dist/systems/system-context.d.ts +0 -26
- package/dist/systems/system-context.js +0 -3
- package/dist/systems/system-context.js.map +0 -1
- package/dist/systems/system-middleware.d.ts +0 -8
- package/dist/systems/system-middleware.js +0 -3
- package/dist/systems/system-middleware.js.map +0 -1
- package/dist/systems/system-type.d.ts +0 -10
- package/dist/systems/system-type.js +0 -15
- package/dist/systems/system-type.js.map +0 -1
- package/dist/systems/systems-module.d.ts +0 -22
- package/dist/systems/systems-module.js +0 -3
- package/dist/systems/systems-module.js.map +0 -1
- package/dist/systems/systems-runtime.d.ts +0 -16
- package/dist/systems/systems-runtime.js +0 -3
- package/dist/systems/systems-runtime.js.map +0 -1
- package/dist/utils/json-serializer.d.ts +0 -7
- package/dist/utils/json-serializer.js +0 -4
- package/dist/utils/json-serializer.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -19
- package/dist/utils/logger.js +0 -11
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/performance-timer.js +0 -3
- package/dist/utils/performance-timer.js.map +0 -1
- package/dist/utils/types.d.ts +0 -21
- package/dist/utils/types.js +0 -3
- package/dist/utils/types.js.map +0 -1
- package/runtime.d.ts +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { I as ISystemsRuntimeContext, a as ISystemContext, S as SystemType } from '../systems-runtime-context-Cq4vxbHX.cjs';
|
|
2
|
+
export { b as ISystemContextEntity, c as ISystemContextEvents, d as ISystemContextProxies, e as ISystemContextRepository, f as ISystemContextScheduler, g as ISystemContextSnapshot } from '../systems-runtime-context-Cq4vxbHX.cjs';
|
|
3
|
+
import { c as IEntity } from '../index-DK2CXVZ8.cjs';
|
|
4
|
+
import { b as IMiddleware, P as PipelineResult } from '../pipeline-BowCAITe.cjs';
|
|
5
|
+
import { f as IEntityUpdate } from '../entity-repository-awW_H993.cjs';
|
|
6
|
+
import '../types-BNwBqRWY.cjs';
|
|
7
|
+
import '../utils/index.cjs';
|
|
8
|
+
import '../performance-timer-XvdCbcAE.cjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The ISystemsRuntimeMiddleware represents the building blocks of executing SystemsModule's registered Pipelines.
|
|
12
|
+
* It receives the current State in the Context, and can decide which SystemPipelines to execute.
|
|
13
|
+
*/
|
|
14
|
+
type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The SystemMiddleware is the basic System implementation that can be registered as a Middleware in a SystemPipeline.
|
|
18
|
+
* It provides a SystemPipelineContext to it's exposed methods.
|
|
19
|
+
*/
|
|
20
|
+
type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
|
|
24
|
+
* It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
|
|
25
|
+
*/
|
|
26
|
+
interface ISystemsModule<TEntity extends IEntity> {
|
|
27
|
+
/**
|
|
28
|
+
* @param type The SystemPipelineType to append the provided SystemMiddlewares to.
|
|
29
|
+
* @param systems The SystemMiddlewares will be registered in the provided SystemPipelineType in the same order as the provided array.
|
|
30
|
+
* The SystemMiddlewares will be appended to existing Pipelines to allow easy extension of existing behaviors.
|
|
31
|
+
*/
|
|
32
|
+
registerSystems(type: SystemType, systems: ISystemMiddleware<TEntity>[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Trigger all registered SystemPipelines, to apply the changes from the provided EntityUpdate to an Entity instance.
|
|
35
|
+
* @param update The EntityUpdate containing the desired changes to be applied on an Entity instance.
|
|
36
|
+
*/
|
|
37
|
+
triggerSystems(update: IEntityUpdate): PipelineResult;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The System Runtime allows running a loop of Ticks.
|
|
42
|
+
*
|
|
43
|
+
* Each RunTick can process one or more Entity Updates, from the EntityQueue.
|
|
44
|
+
* We can have multiple implementations of a SystemRuntime, based on the use-case.
|
|
45
|
+
* A different implementation can be chosen at runtime, based for example on performance.
|
|
46
|
+
*/
|
|
47
|
+
interface ISystemsRuntime {
|
|
48
|
+
/**
|
|
49
|
+
* The method should trigger the SystemsModule logic for the provided IEntityUpdate.
|
|
50
|
+
* If no EntityUpdate is given, the SystemRuntime implementation can choose to dequeue one from the IEntityUpdateQueue.
|
|
51
|
+
*/
|
|
52
|
+
runTick(update?: IEntityUpdate): PipelineResult;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { ISystemContext, type ISystemMiddleware, type ISystemsModule, type ISystemsRuntime, ISystemsRuntimeContext, type ISystemsRuntimeMiddleware, SystemType };
|
package/dist/systems/index.d.ts
CHANGED
|
@@ -1,13 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { I as ISystemsRuntimeContext, a as ISystemContext, S as SystemType } from '../systems-runtime-context-DjppCqs4.js';
|
|
2
|
+
export { b as ISystemContextEntity, c as ISystemContextEvents, d as ISystemContextProxies, e as ISystemContextRepository, f as ISystemContextScheduler, g as ISystemContextSnapshot } from '../systems-runtime-context-DjppCqs4.js';
|
|
3
|
+
import { c as IEntity } from '../index-BPDsRt_F.js';
|
|
4
|
+
import { b as IMiddleware, P as PipelineResult } from '../pipeline-D43CXxWG.js';
|
|
5
|
+
import { f as IEntityUpdate } from '../entity-repository-Bu6rH-m5.js';
|
|
6
|
+
import '../types-BNwBqRWY.js';
|
|
7
|
+
import '../utils/index.js';
|
|
8
|
+
import '../performance-timer-XvdCbcAE.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The ISystemsRuntimeMiddleware represents the building blocks of executing SystemsModule's registered Pipelines.
|
|
12
|
+
* It receives the current State in the Context, and can decide which SystemPipelines to execute.
|
|
13
|
+
*/
|
|
14
|
+
type ISystemsRuntimeMiddleware<TEntity extends IEntity> = IMiddleware<ISystemsRuntimeContext<TEntity>>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The SystemMiddleware is the basic System implementation that can be registered as a Middleware in a SystemPipeline.
|
|
18
|
+
* It provides a SystemPipelineContext to it's exposed methods.
|
|
19
|
+
*/
|
|
20
|
+
type ISystemMiddleware<TEntity extends IEntity> = IMiddleware<ISystemContext<TEntity>>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The SystemModule is the main way of registering and triggering the SystemMiddlewares registered for an Entity.
|
|
24
|
+
* It can handle EntityUpdate objects and decides which SystemPipelines to trigger based on the information in the EntityUpdate.
|
|
25
|
+
*/
|
|
26
|
+
interface ISystemsModule<TEntity extends IEntity> {
|
|
27
|
+
/**
|
|
28
|
+
* @param type The SystemPipelineType to append the provided SystemMiddlewares to.
|
|
29
|
+
* @param systems The SystemMiddlewares will be registered in the provided SystemPipelineType in the same order as the provided array.
|
|
30
|
+
* The SystemMiddlewares will be appended to existing Pipelines to allow easy extension of existing behaviors.
|
|
31
|
+
*/
|
|
32
|
+
registerSystems(type: SystemType, systems: ISystemMiddleware<TEntity>[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Trigger all registered SystemPipelines, to apply the changes from the provided EntityUpdate to an Entity instance.
|
|
35
|
+
* @param update The EntityUpdate containing the desired changes to be applied on an Entity instance.
|
|
36
|
+
*/
|
|
37
|
+
triggerSystems(update: IEntityUpdate): PipelineResult;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The System Runtime allows running a loop of Ticks.
|
|
42
|
+
*
|
|
43
|
+
* Each RunTick can process one or more Entity Updates, from the EntityQueue.
|
|
44
|
+
* We can have multiple implementations of a SystemRuntime, based on the use-case.
|
|
45
|
+
* A different implementation can be chosen at runtime, based for example on performance.
|
|
46
|
+
*/
|
|
47
|
+
interface ISystemsRuntime {
|
|
48
|
+
/**
|
|
49
|
+
* The method should trigger the SystemsModule logic for the provided IEntityUpdate.
|
|
50
|
+
* If no EntityUpdate is given, the SystemRuntime implementation can choose to dequeue one from the IEntityUpdateQueue.
|
|
51
|
+
*/
|
|
52
|
+
runTick(update?: IEntityUpdate): PipelineResult;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { ISystemContext, type ISystemMiddleware, type ISystemsModule, type ISystemsRuntime, ISystemsRuntimeContext, type ISystemsRuntimeMiddleware, SystemType };
|
package/dist/systems/index.js
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1
|
+
// src/systems/module/system-type.ts
|
|
2
|
+
var SystemType = /* @__PURE__ */ ((SystemType2) => {
|
|
3
|
+
SystemType2["initialize"] = "initialize";
|
|
4
|
+
SystemType2["update"] = "update";
|
|
5
|
+
SystemType2["render"] = "render";
|
|
6
|
+
SystemType2["sync"] = "sync";
|
|
7
|
+
return SystemType2;
|
|
8
|
+
})(SystemType || {});
|
|
9
|
+
export {
|
|
10
|
+
SystemType
|
|
15
11
|
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./context/system-context-entity"), exports);
|
|
18
|
-
__exportStar(require("./context/system-context-events"), exports);
|
|
19
|
-
__exportStar(require("./context/system-context-proxies"), exports);
|
|
20
|
-
__exportStar(require("./context/system-context-repository"), exports);
|
|
21
|
-
__exportStar(require("./context/system-context-scheduler"), exports);
|
|
22
|
-
__exportStar(require("./context/system-context-snapshot"), exports);
|
|
23
|
-
__exportStar(require("./runtime/systems-runtime-context"), exports);
|
|
24
|
-
__exportStar(require("./runtime/systems-runtime-middleware"), exports);
|
|
25
|
-
__exportStar(require("./system-middleware"), exports);
|
|
26
|
-
__exportStar(require("./system-context"), exports);
|
|
27
|
-
__exportStar(require("./system-type"), exports);
|
|
28
|
-
__exportStar(require("./systems-module"), exports);
|
|
29
|
-
__exportStar(require("./systems-runtime"), exports);
|
|
30
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/systems/module/system-type.ts"],"sourcesContent":["/**\n * The built-in ECS pipeline types. They can be extended to introduce more types, and the System Runtime Pipeline should\n * add Middleware to handle the newly added types.\n */\nexport enum SystemType {\n initialize = \"initialize\",\n update = \"update\",\n render = \"render\",\n sync = \"sync\",\n}\n"],"mappings":";AAIO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,gBAAa;AACb,EAAAA,YAAA,YAAS;AACT,EAAAA,YAAA,YAAS;AACT,EAAAA,YAAA,UAAO;AAJG,SAAAA;AAAA,GAAA;","names":["SystemType"]}
|
|
@@ -0,0 +1,163 @@
|
|
|
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-awW_H993.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 initEntity: (model: IEntityModel) => IEntity;
|
|
159
|
+
readonly systemPipelines: Map<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
160
|
+
readonly systemContext: ISystemContext<TEntity>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
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 };
|
|
@@ -0,0 +1,163 @@
|
|
|
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-Bu6rH-m5.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 initEntity: (model: IEntityModel) => IEntity;
|
|
159
|
+
readonly systemPipelines: Map<SystemType, IPipeline<ISystemContext<TEntity>>>;
|
|
160
|
+
readonly systemContext: ISystemContext<TEntity>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
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 };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/index.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
LogLevel: () => LogLevel
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
|
25
|
+
|
|
26
|
+
// src/utils/logger.ts
|
|
27
|
+
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
28
|
+
LogLevel2[LogLevel2["trace"] = 0] = "trace";
|
|
29
|
+
LogLevel2[LogLevel2["debug"] = 1] = "debug";
|
|
30
|
+
LogLevel2[LogLevel2["warn"] = 2] = "warn";
|
|
31
|
+
LogLevel2[LogLevel2["error"] = 3] = "error";
|
|
32
|
+
return LogLevel2;
|
|
33
|
+
})(LogLevel || {});
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
LogLevel
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/logger.ts"],"sourcesContent":["export * from \"./json-serializer\";\nexport * from \"./performance-timer\";\nexport * from \"./types\";\nexport * from \"./logger\";\n","/**\n * An ILogger instance allows printing messages to console or other targets.\n */\nexport interface ILogger {\n log(level: LogLevel, message: any, ...args: any[]): void;\n\n trace(message: any, ...args: any[]): void;\n debug(message: any, ...args: any[]): void;\n warn(message: any, ...args: any[]): void;\n error(message: any, ...args: any[]): void;\n}\n\nexport enum LogLevel {\n trace,\n debug,\n warn,\n error,\n}\n\nexport interface ILoggerOptions {\n enabled: Map<LogLevel, boolean>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAK,WAAL,kBAAKA,cAAL;AACL,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AAJU,SAAAA;AAAA,GAAA;","names":["LogLevel"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { I as IPerformanceTimer, P as PerformanceTimeEntry, a as PerformanceTimerUid } from '../performance-timer-XvdCbcAE.cjs';
|
|
2
|
+
export { B as BooleanProps, I as Immutable, b as ImmutableArray, c as ImmutableMap, e as ImmutableObject, f as ImmutableObjectDeep, d as ImmutableSet, M as Mutable, a as MutableDeep } from '../types-BNwBqRWY.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom `IJsonSerializer` implementation can provide different ways of serializing objects.
|
|
6
|
+
*/
|
|
7
|
+
interface IJsonSerializer {
|
|
8
|
+
serializeCustom(value: object): string;
|
|
9
|
+
parseCustom<TObject>(text: string): TObject;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An ILogger instance allows printing messages to console or other targets.
|
|
14
|
+
*/
|
|
15
|
+
interface ILogger {
|
|
16
|
+
log(level: LogLevel, message: any, ...args: any[]): void;
|
|
17
|
+
trace(message: any, ...args: any[]): void;
|
|
18
|
+
debug(message: any, ...args: any[]): void;
|
|
19
|
+
warn(message: any, ...args: any[]): void;
|
|
20
|
+
error(message: any, ...args: any[]): void;
|
|
21
|
+
}
|
|
22
|
+
declare enum LogLevel {
|
|
23
|
+
trace = 0,
|
|
24
|
+
debug = 1,
|
|
25
|
+
warn = 2,
|
|
26
|
+
error = 3
|
|
27
|
+
}
|
|
28
|
+
interface ILoggerOptions {
|
|
29
|
+
enabled: Map<LogLevel, boolean>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { type IJsonSerializer, type ILogger, type ILoggerOptions, LogLevel };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { I as IPerformanceTimer, P as PerformanceTimeEntry, a as PerformanceTimerUid } from '../performance-timer-XvdCbcAE.js';
|
|
2
|
+
export { B as BooleanProps, I as Immutable, b as ImmutableArray, c as ImmutableMap, e as ImmutableObject, f as ImmutableObjectDeep, d as ImmutableSet, M as Mutable, a as MutableDeep } from '../types-BNwBqRWY.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom `IJsonSerializer` implementation can provide different ways of serializing objects.
|
|
6
|
+
*/
|
|
7
|
+
interface IJsonSerializer {
|
|
8
|
+
serializeCustom(value: object): string;
|
|
9
|
+
parseCustom<TObject>(text: string): TObject;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An ILogger instance allows printing messages to console or other targets.
|
|
14
|
+
*/
|
|
15
|
+
interface ILogger {
|
|
16
|
+
log(level: LogLevel, message: any, ...args: any[]): void;
|
|
17
|
+
trace(message: any, ...args: any[]): void;
|
|
18
|
+
debug(message: any, ...args: any[]): void;
|
|
19
|
+
warn(message: any, ...args: any[]): void;
|
|
20
|
+
error(message: any, ...args: any[]): void;
|
|
21
|
+
}
|
|
22
|
+
declare enum LogLevel {
|
|
23
|
+
trace = 0,
|
|
24
|
+
debug = 1,
|
|
25
|
+
warn = 2,
|
|
26
|
+
error = 3
|
|
27
|
+
}
|
|
28
|
+
interface ILoggerOptions {
|
|
29
|
+
enabled: Map<LogLevel, boolean>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { type IJsonSerializer, type ILogger, type ILoggerOptions, LogLevel };
|