@awesome-ecs/abstract 0.22.0 → 0.23.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 +126 -228
- package/dist/components/index.cjs +3 -3
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +1 -2
- package/dist/components/index.d.mts +2 -0
- package/dist/components/{index.js → index.mjs} +4 -4
- package/dist/components/index.mjs.map +1 -0
- package/dist/entities/index.cjs +12 -5
- package/dist/entities/index.cjs.map +1 -1
- package/dist/entities/index.d.cts +3 -4
- package/dist/entities/index.d.mts +3 -0
- package/dist/entities/index.mjs +20 -0
- package/dist/entities/index.mjs.map +1 -0
- package/dist/factories/index.d.cts +47 -35
- package/dist/factories/index.d.mts +69 -0
- package/dist/factories/index.mjs +1 -0
- package/dist/identity-component-5neFUd2Q.d.cts +241 -0
- package/dist/identity-component-BCmEilvk.d.mts +241 -0
- package/dist/index-6OSsa_UD.d.cts +309 -0
- package/dist/index-BUadwkVZ.d.cts +224 -0
- package/dist/index-BWmhFdFg.d.mts +148 -0
- package/dist/index-BtPTY71-.d.cts +485 -0
- package/dist/index-CQpE-5sx.d.mts +309 -0
- package/dist/index-CW6-OhB4.d.mts +485 -0
- package/dist/index-DcirKLCP.d.mts +224 -0
- package/dist/index-eECJUE_O.d.cts +148 -0
- package/dist/pipelines/index.cjs +0 -31
- package/dist/pipelines/index.d.cts +2 -4
- package/dist/pipelines/index.d.mts +2 -0
- package/dist/pipelines/index.mjs +1 -0
- package/dist/systems/index.cjs +18 -18
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -7
- package/dist/systems/index.d.mts +2 -0
- package/dist/systems/index.mjs +33 -0
- package/dist/systems/index.mjs.map +1 -0
- package/dist/types-CnDtpKsY.d.mts +70 -0
- package/dist/types-DLOd2zXO.d.cts +70 -0
- package/dist/utils/index.cjs +11 -11
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.mjs +27 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +14 -14
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js.map +0 -1
- package/dist/entities/index.d.ts +0 -4
- package/dist/entities/index.js +0 -13
- package/dist/entities/index.js.map +0 -1
- package/dist/factories/index.d.ts +0 -57
- package/dist/factories/index.js +0 -0
- package/dist/identity-component-BDWEtAXA.d.cts +0 -238
- package/dist/identity-component-CR1ULadR.d.ts +0 -238
- package/dist/index-C3UGZqUG.d.ts +0 -288
- package/dist/index-CH8ucsKZ.d.ts +0 -472
- package/dist/index-ChV4Q5j6.d.cts +0 -137
- package/dist/index-CjNeb3ML.d.cts +0 -472
- package/dist/index-Cm-YSPhK.d.ts +0 -254
- package/dist/index-D81Fo9XN.d.cts +0 -254
- package/dist/index-DLm-DKAk.d.cts +0 -288
- package/dist/index-oenqxDCa.d.ts +0 -137
- package/dist/pipelines/index.cjs.map +0 -1
- package/dist/pipelines/index.d.ts +0 -4
- package/dist/pipelines/index.js +0 -30
- package/dist/pipelines/index.js.map +0 -1
- package/dist/systems/index.d.ts +0 -7
- package/dist/systems/index.js +0 -33
- package/dist/systems/index.js.map +0 -1
- package/dist/types-DvzdpbLu.d.cts +0 -69
- package/dist/types-yh4pOGEm.d.ts +0 -69
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -27
- package/dist/utils/index.js.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//#region src/utils/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Maps all properties of a type to boolean flags.
|
|
4
|
+
* Useful for feature flags, capability indicators, or boolean option sets.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type whose properties are mapped to booleans.
|
|
7
|
+
* @example type Features = BooleanProps<{health: any; armor: any}>; // => {health: boolean, armor: boolean}
|
|
8
|
+
*/
|
|
9
|
+
type BooleanProps<T> = { [Property in keyof T]: boolean };
|
|
10
|
+
/**
|
|
11
|
+
* Removes readonly modifiers from all properties, making them mutable.
|
|
12
|
+
* One level of immutability removal (see MutableDeep for recursive removal).
|
|
13
|
+
*
|
|
14
|
+
* @template T - The type to make mutable.
|
|
15
|
+
* @example type Mut = Mutable<{readonly x: number}>; // => {x: number}
|
|
16
|
+
*/
|
|
17
|
+
type Mutable<T> = { -readonly [K in keyof T]: T[K] };
|
|
18
|
+
/**
|
|
19
|
+
* Recursively removes readonly modifiers from all properties at all nesting levels.
|
|
20
|
+
* Makes entire object graph mutable.
|
|
21
|
+
*
|
|
22
|
+
* @template T - The type to make mutable recursively.
|
|
23
|
+
*/
|
|
24
|
+
type MutableDeep<T> = { -readonly [K in keyof T]: Mutable<T[K]> };
|
|
25
|
+
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
26
|
+
/**
|
|
27
|
+
* Makes a type fully immutable at the top level only.
|
|
28
|
+
* Primitives and functions remain unchanged.
|
|
29
|
+
* Collections (Array, Map, Set) become readonly.
|
|
30
|
+
* Objects have their properties made readonly.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type to make immutable.
|
|
33
|
+
* @example type Imm = Immutable<{x: number}>; // => {readonly x: number}
|
|
34
|
+
*/
|
|
35
|
+
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>;
|
|
36
|
+
/**
|
|
37
|
+
* Readonly array variant for use in Immutable type transformation.
|
|
38
|
+
*
|
|
39
|
+
* @template T - Element type of the array.
|
|
40
|
+
*/
|
|
41
|
+
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
42
|
+
/**
|
|
43
|
+
* Readonly map variant for use in Immutable type transformation.
|
|
44
|
+
*
|
|
45
|
+
* @template K - Key type of the map.
|
|
46
|
+
* @template V - Value type of the map.
|
|
47
|
+
*/
|
|
48
|
+
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
49
|
+
/**
|
|
50
|
+
* Readonly set variant for use in Immutable type transformation.
|
|
51
|
+
*
|
|
52
|
+
* @template T - Element type of the set.
|
|
53
|
+
*/
|
|
54
|
+
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
55
|
+
/**
|
|
56
|
+
* Makes all object properties readonly (one level only).
|
|
57
|
+
*
|
|
58
|
+
* @template T - The type to make immutable.
|
|
59
|
+
*/
|
|
60
|
+
type ImmutableObject<T> = { readonly [K in keyof T]: T[K] };
|
|
61
|
+
/**
|
|
62
|
+
* Recursively makes all properties readonly at all nesting levels.
|
|
63
|
+
* Provides complete immutability guarantee for the entire object graph.
|
|
64
|
+
*
|
|
65
|
+
* @template T - The type to make deeply immutable.
|
|
66
|
+
*/
|
|
67
|
+
type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ImmutableObject as a, Mutable as c, ImmutableMap as i, MutableDeep as l, Immutable as n, ImmutableObjectDeep as o, ImmutableArray as r, ImmutableSet as s, BooleanProps as t };
|
|
70
|
+
//# sourceMappingURL=types-DLOd2zXO.d.cts.map
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/utils/logger.ts
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Logging severity levels in increasing order.
|
|
5
5
|
*/
|
|
6
|
-
let LogLevel = /* @__PURE__ */ function(LogLevel
|
|
6
|
+
let LogLevel = /* @__PURE__ */ function(LogLevel) {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Most detailed, diagnostic-level logging.
|
|
9
9
|
*/
|
|
10
|
-
LogLevel
|
|
10
|
+
LogLevel[LogLevel["trace"] = 0] = "trace";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Development and debugging information.
|
|
13
13
|
*/
|
|
14
|
-
LogLevel
|
|
14
|
+
LogLevel[LogLevel["debug"] = 1] = "debug";
|
|
15
15
|
/**
|
|
16
|
-
* Warning-level
|
|
16
|
+
* Warning-level conditions.
|
|
17
17
|
*/
|
|
18
|
-
LogLevel
|
|
18
|
+
LogLevel[LogLevel["warn"] = 2] = "warn";
|
|
19
19
|
/**
|
|
20
|
-
* Error-level
|
|
20
|
+
* Error-level conditions.
|
|
21
21
|
*/
|
|
22
|
-
LogLevel
|
|
23
|
-
return LogLevel
|
|
22
|
+
LogLevel[LogLevel["error"] = 3] = "error";
|
|
23
|
+
return LogLevel;
|
|
24
24
|
}({});
|
|
25
25
|
|
|
26
26
|
//#endregion
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":["/**\r\n * Logger interface for debug and diagnostic output.\r\n * Supports multiple log levels for controlling verbosity.\r\n * Implementations can target different outputs (console, file, remote, etc.).\r\n */\r\nexport interface ILogger {\r\n /**\r\n * Logs a message with a specified severity level.\r\n * @param level - The severity level of the message.\r\n * @param message - The primary message content.\r\n * @param args - Additional arguments to include in the log output.\r\n */\r\n log(level: LogLevel, message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs detailed diagnostic information.\r\n * Typically the lowest level, most verbose output.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n trace(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs debug-level information.\r\n * Useful during development and troubleshooting.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n debug(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs warning-level messages.\r\n * Indicates potentially problematic conditions.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n warn(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs error-level messages.\r\n * Indicates error conditions that may require attention.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n error(message: any, ...args: any[]): void;\r\n}\r\n\r\n/**\r\n * Logging severity levels in increasing order.\r\n */\r\nexport enum LogLevel {\r\n /**\r\n * Most detailed, diagnostic-level logging.\r\n */\r\n trace,\r\n\r\n /**\r\n * Development and debugging information.\r\n */\r\n debug,\r\n\r\n /**\r\n * Warning-level conditions.\r\n */\r\n warn,\r\n\r\n /**\r\n * Error-level conditions.\r\n */\r\n error\r\n}\r\n\r\n/**\r\n * Configuration options for logger instances.\r\n */\r\nexport interface ILoggerOptions {\r\n /**\r\n * Enables/disables each log level.\r\n * If a level is disabled, log calls at that level are ignored.\r\n */\r\n enabled: Map<LogLevel, boolean>;\r\n}\r\n"],"mappings":";;;;;AAkDA,IAAY,8CAAL;;;;AAIL;;;;AAKA;;;;AAKA;;;;AAKA"}
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as ImmutableObject, c as Mutable, i as ImmutableMap, l as MutableDeep, n as Immutable, o as ImmutableObjectDeep, r as ImmutableArray, s as ImmutableSet, t as BooleanProps } from "../types-DLOd2zXO.cjs";
|
|
2
|
+
import { a as ILoggerOptions, i as ILogger, n as PerformanceTimeEntry, o as LogLevel, r as PerformanceTimerUid, s as IJsonSerializer, t as IPerformanceTimer } from "../index-eECJUE_O.cjs";
|
|
3
3
|
export { BooleanProps, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, Mutable, MutableDeep, PerformanceTimeEntry, PerformanceTimerUid };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as ImmutableObject, c as Mutable, i as ImmutableMap, l as MutableDeep, n as Immutable, o as ImmutableObjectDeep, r as ImmutableArray, s as ImmutableSet, t as BooleanProps } from "../types-CnDtpKsY.mjs";
|
|
2
|
+
import { a as ILoggerOptions, i as ILogger, n as PerformanceTimeEntry, o as LogLevel, r as PerformanceTimerUid, s as IJsonSerializer, t as IPerformanceTimer } from "../index-BWmhFdFg.mjs";
|
|
3
|
+
export { BooleanProps, IJsonSerializer, ILogger, ILoggerOptions, IPerformanceTimer, Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableObjectDeep, ImmutableSet, LogLevel, Mutable, MutableDeep, PerformanceTimeEntry, PerformanceTimerUid };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/utils/logger.ts
|
|
2
|
+
/**
|
|
3
|
+
* Logging severity levels in increasing order.
|
|
4
|
+
*/
|
|
5
|
+
let LogLevel = /* @__PURE__ */ function(LogLevel) {
|
|
6
|
+
/**
|
|
7
|
+
* Most detailed, diagnostic-level logging.
|
|
8
|
+
*/
|
|
9
|
+
LogLevel[LogLevel["trace"] = 0] = "trace";
|
|
10
|
+
/**
|
|
11
|
+
* Development and debugging information.
|
|
12
|
+
*/
|
|
13
|
+
LogLevel[LogLevel["debug"] = 1] = "debug";
|
|
14
|
+
/**
|
|
15
|
+
* Warning-level conditions.
|
|
16
|
+
*/
|
|
17
|
+
LogLevel[LogLevel["warn"] = 2] = "warn";
|
|
18
|
+
/**
|
|
19
|
+
* Error-level conditions.
|
|
20
|
+
*/
|
|
21
|
+
LogLevel[LogLevel["error"] = 3] = "error";
|
|
22
|
+
return LogLevel;
|
|
23
|
+
}({});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { LogLevel };
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":["/**\r\n * Logger interface for debug and diagnostic output.\r\n * Supports multiple log levels for controlling verbosity.\r\n * Implementations can target different outputs (console, file, remote, etc.).\r\n */\r\nexport interface ILogger {\r\n /**\r\n * Logs a message with a specified severity level.\r\n * @param level - The severity level of the message.\r\n * @param message - The primary message content.\r\n * @param args - Additional arguments to include in the log output.\r\n */\r\n log(level: LogLevel, message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs detailed diagnostic information.\r\n * Typically the lowest level, most verbose output.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n trace(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs debug-level information.\r\n * Useful during development and troubleshooting.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n debug(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs warning-level messages.\r\n * Indicates potentially problematic conditions.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n warn(message: any, ...args: any[]): void;\r\n\r\n /**\r\n * Logs error-level messages.\r\n * Indicates error conditions that may require attention.\r\n * @param message - The message to log.\r\n * @param args - Additional data.\r\n */\r\n error(message: any, ...args: any[]): void;\r\n}\r\n\r\n/**\r\n * Logging severity levels in increasing order.\r\n */\r\nexport enum LogLevel {\r\n /**\r\n * Most detailed, diagnostic-level logging.\r\n */\r\n trace,\r\n\r\n /**\r\n * Development and debugging information.\r\n */\r\n debug,\r\n\r\n /**\r\n * Warning-level conditions.\r\n */\r\n warn,\r\n\r\n /**\r\n * Error-level conditions.\r\n */\r\n error\r\n}\r\n\r\n/**\r\n * Configuration options for logger instances.\r\n */\r\nexport interface ILoggerOptions {\r\n /**\r\n * Enables/disables each log level.\r\n * If a level is disabled, log calls at that level are ignored.\r\n */\r\n enabled: Map<LogLevel, boolean>;\r\n}\r\n"],"mappings":";;;;AAkDA,IAAY,8CAAL;;;;AAIL;;;;AAKA;;;;AAKA;;;;AAKA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awesome-ecs/abstract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "A comprehensive Entity-Component-System (ECS) Architecture implementation. Abstract components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
"./components": {
|
|
16
16
|
"import": {
|
|
17
|
-
"types": "./dist/components/index.d.
|
|
18
|
-
"default": "./dist/components/index.
|
|
17
|
+
"types": "./dist/components/index.d.mts",
|
|
18
|
+
"default": "./dist/components/index.mjs"
|
|
19
19
|
},
|
|
20
20
|
"require": {
|
|
21
21
|
"types": "./dist/components/index.d.cts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"./entities": {
|
|
26
26
|
"import": {
|
|
27
|
-
"types": "./dist/entities/index.d.
|
|
28
|
-
"default": "./dist/entities/index.
|
|
27
|
+
"types": "./dist/entities/index.d.mts",
|
|
28
|
+
"default": "./dist/entities/index.mjs"
|
|
29
29
|
},
|
|
30
30
|
"require": {
|
|
31
31
|
"types": "./dist/entities/index.d.cts",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"./factories": {
|
|
36
36
|
"import": {
|
|
37
|
-
"types": "./dist/factories/index.d.
|
|
38
|
-
"default": "./dist/factories/index.
|
|
37
|
+
"types": "./dist/factories/index.d.mts",
|
|
38
|
+
"default": "./dist/factories/index.mjs"
|
|
39
39
|
},
|
|
40
40
|
"require": {
|
|
41
41
|
"types": "./dist/factories/index.d.cts",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"./pipelines": {
|
|
46
46
|
"import": {
|
|
47
|
-
"types": "./dist/pipelines/index.d.
|
|
48
|
-
"default": "./dist/pipelines/index.
|
|
47
|
+
"types": "./dist/pipelines/index.d.mts",
|
|
48
|
+
"default": "./dist/pipelines/index.mjs"
|
|
49
49
|
},
|
|
50
50
|
"require": {
|
|
51
51
|
"types": "./dist/pipelines/index.d.cts",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"./systems": {
|
|
56
56
|
"import": {
|
|
57
|
-
"types": "./dist/systems/index.d.
|
|
58
|
-
"default": "./dist/systems/index.
|
|
57
|
+
"types": "./dist/systems/index.d.mts",
|
|
58
|
+
"default": "./dist/systems/index.mjs"
|
|
59
59
|
},
|
|
60
60
|
"require": {
|
|
61
61
|
"types": "./dist/systems/index.d.cts",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
},
|
|
65
65
|
"./utils": {
|
|
66
66
|
"import": {
|
|
67
|
-
"types": "./dist/utils/index.d.
|
|
68
|
-
"default": "./dist/utils/index.
|
|
67
|
+
"types": "./dist/utils/index.d.mts",
|
|
68
|
+
"default": "./dist/utils/index.mjs"
|
|
69
69
|
},
|
|
70
70
|
"require": {
|
|
71
71
|
"types": "./dist/utils/index.d.cts",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"url": "https://github.com/privatebytes/awesome-ecs/issues"
|
|
98
98
|
},
|
|
99
99
|
"homepage": "https://github.com/privatebytes/awesome-ecs#readme",
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "8409c84b5ac82181b01ad384d5732e84f6f5e13a"
|
|
101
101
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/identity-component.ts"],"sourcesContent":["import { EntityTypeUid, IEntityModel } from '../entities/entity';\nimport { Immutable } from '../utils/types';\nimport { IComponent } from './component';\n\n/**\n * The `BasicComponentType` enum defines the types of basic components available.\n */\nexport enum BasicComponentType {\n identity = 'identity'\n}\n\n/**\n * IdentityComponent interface represents the basic information regarding what makes the current Entity unique.\n * It extends the IComponent interface.\n *\n * @template TModel - The type of the model that extends IEntityModel.\n */\nexport interface IdentityComponent<TModel extends IEntityModel> extends IComponent {\n /**\n * The Entity Type that defines what Category type the Entity is part of.\n * There can be multiple Entities sharing the same EntityType.\n */\n readonly entityType: EntityTypeUid;\n\n /**\n * The Model is the basic information needed to create an `IEntity` when it's first initialized.\n * It provides a first snapshot of information needed for the successful creation of an Entity instance.\n *\n * @type {Immutable<TModel>}\n */\n readonly model: Immutable<TModel>;\n\n /**\n * Keeps track when the Entity's systems have ran last.\n * Useful to calculate the `DeltaTime` between runs.\n *\n * @type {Date | undefined}\n */\n readonly lastUpdated?: Date;\n}\n"],"mappings":";;;;AAOA,IAAY,oEAAL;AACL;;AACD"}
|
package/dist/entities/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { EntityProxy, EntityTypeUid, EntityUid, IEntity, IEntityModel, IEntityModelWithFeatures, IEntityModelWithRequiredProxies, IEntityProxy, IEntityProxyRepository, RequiredProxies, TypedEntityProxy } from "../identity-component-CR1ULadR.js";
|
|
2
|
-
import "../types-yh4pOGEm.js";
|
|
3
|
-
import { EntityEventSubscriptionFilter, EntityEventUid, EntityUpdateType, IEntityEvent, IEntityEventsDispatcher, IEntityEventsManager, IEntityRepository, IEntityScheduler, IEntitySnapshot, IEntitySnapshotProvider, IEntityUpdate, IEntityUpdateQueue, IEventData } from "../index-C3UGZqUG.js";
|
|
4
|
-
export { EntityEventSubscriptionFilter, EntityEventUid, EntityProxy, EntityTypeUid, EntityUid, EntityUpdateType, IEntity, IEntityEvent, IEntityEventsDispatcher, IEntityEventsManager, IEntityModel, IEntityModelWithFeatures, IEntityModelWithRequiredProxies, IEntityProxy, IEntityProxyRepository, IEntityRepository, IEntityScheduler, IEntitySnapshot, IEntitySnapshotProvider, IEntityUpdate, IEntityUpdateQueue, IEventData, RequiredProxies, TypedEntityProxy };
|
package/dist/entities/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region src/entities/entity-queue.ts
|
|
2
|
-
/**
|
|
3
|
-
* The `EntityUpdateType` enum specifies whether the current Entity should be `updated` or `removed`.
|
|
4
|
-
*/
|
|
5
|
-
let EntityUpdateType = /* @__PURE__ */ function(EntityUpdateType$1) {
|
|
6
|
-
EntityUpdateType$1["update"] = "update";
|
|
7
|
-
EntityUpdateType$1["remove"] = "remove";
|
|
8
|
-
return EntityUpdateType$1;
|
|
9
|
-
}({});
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { EntityUpdateType };
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/entities/entity-queue.ts"],"sourcesContent":["import { IEntityModel } from './entity';\nimport { IEntityProxy } from './entity-proxies';\nimport { IEntitySnapshot } from './entity-snapshot';\n\n/**\n * The `EntityUpdateType` enum specifies whether the current Entity should be `updated` or `removed`.\n */\nexport enum EntityUpdateType {\n update = 'update',\n remove = 'remove'\n}\n\n/**\n * The `IEntityUpdate` interface represents an Entity update that should be applied over an existing Entity.\n */\nexport interface IEntityUpdate {\n /**\n * The type of the update, which can be either `update` or `remove`.\n */\n type: EntityUpdateType;\n\n /**\n * The proxy of the Entity that needs to be updated.\n */\n entity: IEntityProxy;\n\n /**\n * Optional. The model of the Entity that needs to be updated.\n */\n model?: IEntityModel;\n\n /**\n * Optional. The snapshot of the Entity that needs to be updated.\n */\n snapshot?: IEntitySnapshot;\n}\n\n/**\n * The `IEntityUpdateQueue` interface is the main mechanism to queue and retrieve `EntityUpdate` instances.\n *\n * The interface can be implemented using a simple queue mechanism, or perhaps, a Priority Queue.\n */\nexport interface IEntityUpdateQueue {\n /**\n * The number of `EntityUpdate` instances currently in the queue.\n */\n readonly size: number;\n\n /**\n * Adds an `EntityUpdate` instance to the end of the queue.\n * @param change - The `EntityUpdate` instance to be added.\n */\n enqueue(change: IEntityUpdate): void;\n\n /**\n * Removes and returns the `EntityUpdate` instance at the front of the queue.\n * @returns The `EntityUpdate` instance at the front of the queue.\n */\n dequeue(): IEntityUpdate;\n\n /**\n * Returns the `EntityUpdate` instance at the front of the queue without removing it.\n * @returns The `EntityUpdate` instance at the front of the queue.\n */\n peek(): IEntityUpdate;\n\n /**\n * Removes all `EntityUpdate` instances from the queue.\n */\n clear(): void;\n}\n"],"mappings":";;;;AAOA,IAAY,gEAAL;AACL;AACA;;AACD"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { IEntity } from "../identity-component-CR1ULadR.js";
|
|
2
|
-
import "../types-yh4pOGEm.js";
|
|
3
|
-
import "../index-C3UGZqUG.js";
|
|
4
|
-
import { IPipeline, IPipelineContext } from "../index-Cm-YSPhK.js";
|
|
5
|
-
import "../index-oenqxDCa.js";
|
|
6
|
-
import { ISystemContext, ISystemsRuntimeContext } from "../index-CH8ucsKZ.js";
|
|
7
|
-
|
|
8
|
-
//#region src/factories/context-factory.d.ts
|
|
9
|
-
/**
|
|
10
|
-
* The IContextFactory interface is used to create abstraction layers for quickly creating Pipeline Contexts.
|
|
11
|
-
* It helps to avoid manually resolving all dependencies when creating these contexts.
|
|
12
|
-
*/
|
|
13
|
-
interface IContextFactory {
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new instance of ISystemsRuntimeContext.
|
|
16
|
-
*
|
|
17
|
-
* @template TEntity - The type of entity to be used in the runtime context. It must extend IEntity.
|
|
18
|
-
* @returns A new instance of ISystemsRuntimeContext with the specified entity type.
|
|
19
|
-
*/
|
|
20
|
-
createRuntimeContext<TEntity extends IEntity>(): ISystemsRuntimeContext<TEntity>;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/factories/pipeline-factory.d.ts
|
|
24
|
-
/**
|
|
25
|
-
* The PipelineFactory interface provides methods to create different types of pipelines.
|
|
26
|
-
* It helps to quickly create IPipeline objects without manually resolving their dependencies.
|
|
27
|
-
*/
|
|
28
|
-
interface IPipelineFactory {
|
|
29
|
-
/**
|
|
30
|
-
* Creates a new pipeline with the specified context and result type.
|
|
31
|
-
*
|
|
32
|
-
* @template TContext - The type of the pipeline context. It must extend IPipelineContext.
|
|
33
|
-
* @param name - Optional name for the pipeline. If not provided, a default name will be assigned.
|
|
34
|
-
* @returns A new instance of IPipeline with the specified context and result type.
|
|
35
|
-
*/
|
|
36
|
-
createPipeline<TContext extends IPipelineContext>(name?: string): IPipeline<TContext>;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new pipeline specifically for systems with the specified entity type and result type.
|
|
39
|
-
*
|
|
40
|
-
* @template TEntity - The type of the entity. It must extend IEntity.
|
|
41
|
-
* @param name - Optional name for the pipeline. If not provided, a default name will be assigned.
|
|
42
|
-
* @returns A new instance of IPipeline with the specified system context and result type.
|
|
43
|
-
*/
|
|
44
|
-
createSystemsPipeline<TEntity extends IEntity>(name?: string): IPipeline<ISystemContext<TEntity>>;
|
|
45
|
-
/**
|
|
46
|
-
* Creates a new pipeline specifically for systems runtime with the specified entity type and result type.
|
|
47
|
-
*
|
|
48
|
-
* @template TEntity - The type of the entity. It must extend IEntity.
|
|
49
|
-
* @template TResult - The type of the result returned by the pipeline. Default is MiddlewareResult.
|
|
50
|
-
* @param name - Optional name for the pipeline. If not provided, a default name will be assigned.
|
|
51
|
-
* @returns A new instance of IPipeline with the specified systems runtime context and result type.
|
|
52
|
-
*/
|
|
53
|
-
createRuntimePipeline<TEntity extends IEntity>(name?: string): IPipeline<ISystemsRuntimeContext<TEntity>>;
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
export { IContextFactory, IPipelineFactory };
|
|
57
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/factories/index.js
DELETED
|
File without changes
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { BooleanProps, Immutable } from "./types-DvzdpbLu.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/components/component.d.ts
|
|
4
|
-
type ComponentTypeUid = string | number;
|
|
5
|
-
/**
|
|
6
|
-
* The `IComponent` interface provides the main storage mechanism of `IEntity` state, and can be accessed and modified by `Systems`.
|
|
7
|
-
*
|
|
8
|
-
* The `IComponent` implementations should not contain any logic methods, apart from quick-access functionality.
|
|
9
|
-
*/
|
|
10
|
-
interface IComponent {
|
|
11
|
-
/**
|
|
12
|
-
* The `ComponentTypeUid` is a unique identifier for each Component type.
|
|
13
|
-
* @type {ComponentTypeUid}
|
|
14
|
-
*/
|
|
15
|
-
readonly componentType: ComponentTypeUid;
|
|
16
|
-
/**
|
|
17
|
-
* Specifies whether the Component state should be serialized as part of an `IEntitySnapshot`.
|
|
18
|
-
* This is useful if the state needs to be replicated or updated through remote updates (e.g., coming from the server or peers).
|
|
19
|
-
* @type {boolean}
|
|
20
|
-
*/
|
|
21
|
-
readonly isSerializable: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @optional
|
|
24
|
-
* Specifies the current version of the component.
|
|
25
|
-
* This is useful for keeping backwards-compatibility when the stored state might be of a different version.
|
|
26
|
-
* @type {number}
|
|
27
|
-
*/
|
|
28
|
-
readonly version?: number;
|
|
29
|
-
/**
|
|
30
|
-
* @optional
|
|
31
|
-
* The custom serialization function of this Component, used to transfer it into a Snapshot, or used for logging the Component stored state.
|
|
32
|
-
* If not provided, the standard `JSON.stringify()` functionality applies.
|
|
33
|
-
* @returns {string | object} The serialized form of the Component.
|
|
34
|
-
*/
|
|
35
|
-
toJSON?(): string | object;
|
|
36
|
-
/**
|
|
37
|
-
* Allows for custom logic when loading the current from an `IEntitySnapshot`.
|
|
38
|
-
* The default behavior simply overwrites the fields with the target state.
|
|
39
|
-
* @param {this} targetState The target state to load from.
|
|
40
|
-
*/
|
|
41
|
-
load?(targetState: this): void;
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/entities/entity-proxies.d.ts
|
|
45
|
-
/**
|
|
46
|
-
* The `IEntityProxy` represents a pointer to another `Entity`.
|
|
47
|
-
*/
|
|
48
|
-
interface IEntityProxy {
|
|
49
|
-
/**
|
|
50
|
-
* The type of the entity that the proxy points to.
|
|
51
|
-
*/
|
|
52
|
-
readonly entityType: EntityTypeUid;
|
|
53
|
-
/**
|
|
54
|
-
* The unique identifier of the entity that the proxy points to.
|
|
55
|
-
*/
|
|
56
|
-
readonly entityUid: EntityUid;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* A utility extension of `IEntityProxy`.
|
|
60
|
-
* Useful for providing strong `Type` information when using the IEntityProxy.
|
|
61
|
-
*
|
|
62
|
-
* @template TEntity - The type of the entity that the proxy points to.
|
|
63
|
-
*/
|
|
64
|
-
interface EntityProxy<TEntity extends IEntity> extends IEntityProxy {}
|
|
65
|
-
/**
|
|
66
|
-
* A helper type to create a typed entity proxy.
|
|
67
|
-
*/
|
|
68
|
-
type TypedEntityProxy<T extends EntityTypeUid> = {
|
|
69
|
-
entityType: T;
|
|
70
|
-
entityUid: EntityUid;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* A mapped type that transforms an array of EntityType into an array of TypedEntityProxy.
|
|
74
|
-
*/
|
|
75
|
-
type RequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> = [...{ [I in keyof TProxyTypes]: TypedEntityProxy<TProxyTypes[I]> }, ...IEntityProxy[]];
|
|
76
|
-
/**
|
|
77
|
-
* A repository for managing entity-to-entity relationships (proxies).
|
|
78
|
-
* This centralized repository is the single source of truth for all proxy data.
|
|
79
|
-
*/
|
|
80
|
-
interface IEntityProxyRepository {
|
|
81
|
-
/**
|
|
82
|
-
* Registers a bi-directional proxy relationship between a source and a target.
|
|
83
|
-
* @param source - The proxy of the source entity.
|
|
84
|
-
* @param target - The proxy of the target entity.
|
|
85
|
-
* @param cleanup - If true, any existing proxies of the same type on the source and target will be removed before registering the new one.
|
|
86
|
-
*/
|
|
87
|
-
register(source: IEntityProxy, target: IEntityProxy, cleanup?: boolean): void;
|
|
88
|
-
/**
|
|
89
|
-
* Registers multiple bi-directional proxy relationships for a source entity.
|
|
90
|
-
* @param source - The proxy of the source entity.
|
|
91
|
-
* @param targets - The proxies of the target entities.
|
|
92
|
-
* @param cleanup - If true, any existing proxies of the same types as the new targets will be removed from the source before registering.
|
|
93
|
-
*/
|
|
94
|
-
registerMany(source: IEntityProxy, targets: readonly IEntityProxy[], cleanup?: boolean): void;
|
|
95
|
-
/**
|
|
96
|
-
* Removes a bi-directional proxy relationship between a source and a target.
|
|
97
|
-
* @param source - The proxy of the source entity.
|
|
98
|
-
* @param target - The proxy of the target entity.
|
|
99
|
-
*/
|
|
100
|
-
remove(source: IEntityProxy, target: IEntityProxy): void;
|
|
101
|
-
/**
|
|
102
|
-
* Removes all proxies from a source entity, optionally filtered by the target entity type.
|
|
103
|
-
* This will also remove the corresponding back-references from the target entities.
|
|
104
|
-
* @param source - The proxy of the source entity.
|
|
105
|
-
* @param targetType - The optional entity type of the targets to remove. If not provided, all proxies for the source are removed.
|
|
106
|
-
*/
|
|
107
|
-
removeAllFor(source: IEntityProxy, targetType?: EntityTypeUid): void;
|
|
108
|
-
/**
|
|
109
|
-
* Retrieves a single proxy of a specific type for a source entity.
|
|
110
|
-
* If multiple proxies of the same type exist, it returns the first one found.
|
|
111
|
-
* @param source - The proxy of the source entity.
|
|
112
|
-
* @param targetType - The entity type of the target proxy to retrieve.
|
|
113
|
-
* @returns The entity proxy, or null if not found.
|
|
114
|
-
*/
|
|
115
|
-
get(source: IEntityProxy, targetType: EntityTypeUid): IEntityProxy | null;
|
|
116
|
-
/**
|
|
117
|
-
* Retrieves all proxies of a specific type for a source entity.
|
|
118
|
-
* @param source - The proxy of the source entity.
|
|
119
|
-
* @param targetType - The entity type of the target proxies to retrieve.
|
|
120
|
-
* @returns A readonly array of entity proxies.
|
|
121
|
-
*/
|
|
122
|
-
getMany(source: IEntityProxy, targetType: EntityTypeUid): Readonly<IEntityProxy[]>;
|
|
123
|
-
/**
|
|
124
|
-
* Retrieves all proxies for a source entity.
|
|
125
|
-
* @param source - The proxy of the source entity.
|
|
126
|
-
* @returns A readonly map of entity type UIDs to an array of their proxies.
|
|
127
|
-
*/
|
|
128
|
-
getAll(source: IEntityProxy): ReadonlyMap<EntityTypeUid, Readonly<IEntityProxy[]>>;
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region src/entities/entity.d.ts
|
|
132
|
-
/**
|
|
133
|
-
* Represents the unique identifier for an entity type.
|
|
134
|
-
* Can be either a string or a number.
|
|
135
|
-
*/
|
|
136
|
-
type EntityTypeUid = string | number;
|
|
137
|
-
/**
|
|
138
|
-
* Represents the unique identifier for an entity.
|
|
139
|
-
* Can be either a string or a number.
|
|
140
|
-
*/
|
|
141
|
-
type EntityUid = string | number;
|
|
142
|
-
/**
|
|
143
|
-
* The `IEntityModel` represents the basic identity information about the current `IEntity`.
|
|
144
|
-
* It's mandatory for each Entity, and it contains the minimal-required information needed for instantiating the Entity.
|
|
145
|
-
*
|
|
146
|
-
* The Features property can be used to toggle Entity features on and off.
|
|
147
|
-
*
|
|
148
|
-
* @template TFeatures - A type that extends `BooleanProps<TFeatures>` to represent the features of the entity.
|
|
149
|
-
* Defaults to `unknown` if not provided.
|
|
150
|
-
*/
|
|
151
|
-
interface IEntityModel {
|
|
152
|
-
/**
|
|
153
|
-
* The unique identifier of the entity.
|
|
154
|
-
*/
|
|
155
|
-
readonly uid: EntityUid;
|
|
156
|
-
/**
|
|
157
|
-
* Optional proxies of the entity.
|
|
158
|
-
*/
|
|
159
|
-
readonly proxies?: readonly IEntityProxy[];
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Base interface for entity models that require feature flags.
|
|
163
|
-
* @template TFeatures - A type that extends `BooleanProps<TFeatures>` to represent the features of the entity.
|
|
164
|
-
*/
|
|
165
|
-
interface IEntityModelWithFeatures<TFeatures extends BooleanProps<TFeatures> = unknown> extends IEntityModel {
|
|
166
|
-
readonly features: TFeatures;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Base interface for entity models that require specific proxies.
|
|
170
|
-
* @template TProxyTypes An array of EntityType that are required as proxies.
|
|
171
|
-
*/
|
|
172
|
-
interface IEntityModelWithRequiredProxies<TProxyTypes extends readonly EntityTypeUid[]> extends Omit<IEntityModel, 'proxies'> {
|
|
173
|
-
readonly proxies: RequiredProxies<TProxyTypes>;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* The `IEntity` interface represents a container of Components and Entity Proxies.
|
|
177
|
-
* It is designed to be immutable and only modifiable through System operations.
|
|
178
|
-
*
|
|
179
|
-
* Implementations of `IEntity` can contain quick-access methods for `Components` or `Proxies`,
|
|
180
|
-
* but should not contain any state-changing logic apart from quick-access functionality.
|
|
181
|
-
*/
|
|
182
|
-
interface IEntity {
|
|
183
|
-
/**
|
|
184
|
-
* A Map of Components associated with this Entity.
|
|
185
|
-
* The keys are ComponentTypeUid, and the values are IComponent instances.
|
|
186
|
-
*/
|
|
187
|
-
readonly components: ReadonlyMap<ComponentTypeUid, IComponent>;
|
|
188
|
-
/**
|
|
189
|
-
* The IdentityComponent represents mandatory state any Entity needs to have.
|
|
190
|
-
* It is a readonly reference to an IdentityComponent instance, which contains the minimal-required information
|
|
191
|
-
* needed for instantiating the Entity.
|
|
192
|
-
*/
|
|
193
|
-
readonly identity: Readonly<IdentityComponent<IEntityModel>>;
|
|
194
|
-
/**
|
|
195
|
-
* A reference to the own Proxy of this Entity.
|
|
196
|
-
* It is a readonly reference to an IEntityProxy instance, which points to this Entity.
|
|
197
|
-
* This is useful for quick access of Proxy data.
|
|
198
|
-
*/
|
|
199
|
-
readonly myProxy: Readonly<EntityProxy<this>>;
|
|
200
|
-
}
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/components/identity-component.d.ts
|
|
203
|
-
/**
|
|
204
|
-
* The `BasicComponentType` enum defines the types of basic components available.
|
|
205
|
-
*/
|
|
206
|
-
declare enum BasicComponentType {
|
|
207
|
-
identity = "identity",
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* IdentityComponent interface represents the basic information regarding what makes the current Entity unique.
|
|
211
|
-
* It extends the IComponent interface.
|
|
212
|
-
*
|
|
213
|
-
* @template TModel - The type of the model that extends IEntityModel.
|
|
214
|
-
*/
|
|
215
|
-
interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
|
|
216
|
-
/**
|
|
217
|
-
* The Entity Type that defines what Category type the Entity is part of.
|
|
218
|
-
* There can be multiple Entities sharing the same EntityType.
|
|
219
|
-
*/
|
|
220
|
-
readonly entityType: EntityTypeUid;
|
|
221
|
-
/**
|
|
222
|
-
* The Model is the basic information needed to create an `IEntity` when it's first initialized.
|
|
223
|
-
* It provides a first snapshot of information needed for the successful creation of an Entity instance.
|
|
224
|
-
*
|
|
225
|
-
* @type {Immutable<TModel>}
|
|
226
|
-
*/
|
|
227
|
-
readonly model: Immutable<TModel>;
|
|
228
|
-
/**
|
|
229
|
-
* Keeps track when the Entity's systems have ran last.
|
|
230
|
-
* Useful to calculate the `DeltaTime` between runs.
|
|
231
|
-
*
|
|
232
|
-
* @type {Date | undefined}
|
|
233
|
-
*/
|
|
234
|
-
readonly lastUpdated?: Date;
|
|
235
|
-
}
|
|
236
|
-
//#endregion
|
|
237
|
-
export { BasicComponentType, ComponentTypeUid, EntityProxy, EntityTypeUid, EntityUid, IComponent, IEntity, IEntityModel, IEntityModelWithFeatures, IEntityModelWithRequiredProxies, IEntityProxy, IEntityProxyRepository, IdentityComponent, RequiredProxies, TypedEntityProxy };
|
|
238
|
-
//# sourceMappingURL=identity-component-BDWEtAXA.d.cts.map
|