@awesome-ecs/abstract 0.28.0 → 0.30.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.
Files changed (48) hide show
  1. package/dist/components/index.cjs +2 -2
  2. package/dist/components/index.cjs.map +1 -1
  3. package/dist/components/index.d.cts +1 -1
  4. package/dist/components/index.d.mts +1 -1
  5. package/dist/components/index.mjs +1 -1
  6. package/dist/components/index.mjs.map +1 -1
  7. package/dist/entities/index.cjs +2 -3
  8. package/dist/entities/index.cjs.map +1 -1
  9. package/dist/entities/index.d.cts +3 -3
  10. package/dist/entities/index.d.mts +3 -3
  11. package/dist/entities/index.mjs +1 -2
  12. package/dist/entities/index.mjs.map +1 -1
  13. package/dist/factories/index.cjs +2 -2
  14. package/dist/factories/index.cjs.map +1 -1
  15. package/dist/factories/index.d.cts +2 -95
  16. package/dist/factories/index.d.mts +2 -95
  17. package/dist/factories/index.mjs +1 -1
  18. package/dist/factories/index.mjs.map +1 -1
  19. package/dist/{identity-component-CgzvgBVh.d.mts → identity-component-CuWHf7jX.d.mts} +76 -10
  20. package/dist/{identity-component-uU0yDR-y.d.cts → identity-component-DLDaOTyK.d.cts} +76 -10
  21. package/dist/index-8XDo0pla.d.mts +1065 -0
  22. package/dist/index-BVkmidEx.d.cts +1065 -0
  23. package/dist/{index-C1Ojam4M.d.cts → index-BguFn1Xj.d.cts} +62 -3
  24. package/dist/{index-C0v9GTM7.d.mts → index-kNcUiDBd.d.mts} +62 -3
  25. package/dist/pipelines/index.d.cts +1 -1
  26. package/dist/pipelines/index.d.mts +1 -1
  27. package/dist/pipelines/index.mjs +1 -1
  28. package/dist/systems/index.cjs +2 -2
  29. package/dist/systems/index.cjs.map +1 -1
  30. package/dist/systems/index.d.cts +2 -2
  31. package/dist/systems/index.d.mts +2 -2
  32. package/dist/systems/index.mjs +1 -1
  33. package/dist/systems/index.mjs.map +1 -1
  34. package/dist/utils/index.cjs +2 -3
  35. package/dist/utils/index.cjs.map +1 -1
  36. package/dist/utils/index.d.cts +3 -3
  37. package/dist/utils/index.d.mts +3 -3
  38. package/dist/utils/index.mjs +1 -2
  39. package/dist/utils/index.mjs.map +1 -1
  40. package/package.json +2 -2
  41. package/dist/index-BQojRXVz.d.cts +0 -224
  42. package/dist/index-CrMUhuEK.d.cts +0 -544
  43. package/dist/index-Cs9Eerjt.d.cts +0 -175
  44. package/dist/index-DQYLun1o.d.mts +0 -544
  45. package/dist/index-DeYfvKO0.d.mts +0 -224
  46. package/dist/index-hHkhvmkO.d.mts +0 -175
  47. package/dist/types-CnDtpKsY.d.mts +0 -70
  48. package/dist/types-DLOd2zXO.d.cts +0 -70
@@ -1,5 +1,3 @@
1
- import { n as Immutable } from "./types-DLOd2zXO.cjs";
2
-
3
1
  //#region src/components/component.d.ts
4
2
  type ComponentTypeUid = string | number;
5
3
  /**
@@ -169,8 +167,9 @@ type EntityUid = string | number;
169
167
  /**
170
168
  * Represents the core identification and initialization data for an entity.
171
169
  * @template TProxyTypes - A readonly array of entity type IDs that must be provided as proxies when creating an entity.
170
+ * When non-empty, the `proxies` property is required on the model.
172
171
  */
173
- interface IEntityModel<TProxyTypes extends readonly EntityTypeUid[] = undefined> {
172
+ type IEntityModel<TProxyTypes extends readonly EntityTypeUid[] = readonly []> = {
174
173
  /**
175
174
  * The unique identifier for this entity instance.
176
175
  */
@@ -181,12 +180,11 @@ interface IEntityModel<TProxyTypes extends readonly EntityTypeUid[] = undefined>
181
180
  * child entities inherit from their parent via addEntity().
182
181
  */
183
182
  readonly scopeId?: string;
184
- /**
185
- * Optional array of proxies (references) to other entities.
186
- * Used to establish relationships at entity creation time.
187
- */
183
+ } & (TProxyTypes extends readonly [] ? {
188
184
  readonly proxies?: RequiredProxies<TProxyTypes>;
189
- }
185
+ } : {
186
+ readonly proxies: RequiredProxies<TProxyTypes>;
187
+ });
190
188
  /**
191
189
  * The core entity interface representing a composition of components and relationships.
192
190
  * Entities are immutable containers that store data (components) and maintain relationships (proxies) to other entities.
@@ -212,6 +210,74 @@ interface IEntity {
212
210
  readonly myProxy: Readonly<EntityProxy<this>>;
213
211
  }
214
212
  //#endregion
213
+ //#region src/utils/types.d.ts
214
+ /**
215
+ * Maps all properties of a type to boolean flags.
216
+ * Useful for feature flags, capability indicators, or boolean option sets.
217
+ *
218
+ * @template T - The type whose properties are mapped to booleans.
219
+ * @example type Features = BooleanProps<{health: any; armor: any}>; // => {health: boolean, armor: boolean}
220
+ */
221
+ type BooleanProps<T> = { [Property in keyof T]: boolean };
222
+ /**
223
+ * Removes readonly modifiers from all properties, making them mutable.
224
+ * One level of immutability removal (see MutableDeep for recursive removal).
225
+ *
226
+ * @template T - The type to make mutable.
227
+ * @example type Mut = Mutable<{readonly x: number}>; // => {x: number}
228
+ */
229
+ type Mutable<T> = { -readonly [K in keyof T]: T[K] };
230
+ /**
231
+ * Recursively removes readonly modifiers from all properties at all nesting levels.
232
+ * Makes entire object graph mutable.
233
+ *
234
+ * @template T - The type to make mutable recursively.
235
+ */
236
+ type MutableDeep<T> = { -readonly [K in keyof T]: Mutable<T[K]> };
237
+ type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
238
+ /**
239
+ * Makes a type fully immutable at the top level only.
240
+ * Primitives and functions remain unchanged.
241
+ * Collections (Array, Map, Set) become readonly.
242
+ * Objects have their properties made readonly.
243
+ *
244
+ * @template T - The type to make immutable.
245
+ * @example type Imm = Immutable<{x: number}>; // => {readonly x: number}
246
+ */
247
+ 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>;
248
+ /**
249
+ * Readonly array variant for use in Immutable type transformation.
250
+ *
251
+ * @template T - Element type of the array.
252
+ */
253
+ type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
254
+ /**
255
+ * Readonly map variant for use in Immutable type transformation.
256
+ *
257
+ * @template K - Key type of the map.
258
+ * @template V - Value type of the map.
259
+ */
260
+ type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
261
+ /**
262
+ * Readonly set variant for use in Immutable type transformation.
263
+ *
264
+ * @template T - Element type of the set.
265
+ */
266
+ type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
267
+ /**
268
+ * Makes all object properties readonly (one level only).
269
+ *
270
+ * @template T - The type to make immutable.
271
+ */
272
+ type ImmutableObject<T> = { readonly [K in keyof T]: T[K] };
273
+ /**
274
+ * Recursively makes all properties readonly at all nesting levels.
275
+ * Provides complete immutability guarantee for the entire object graph.
276
+ *
277
+ * @template T - The type to make deeply immutable.
278
+ */
279
+ type ImmutableObjectDeep<T> = { readonly [K in keyof T]: Immutable<T[K]> };
280
+ //#endregion
215
281
  //#region src/components/identity-component.d.ts
216
282
  /**
217
283
  * The `BasicComponentType` enum defines the types of basic components available.
@@ -250,5 +316,5 @@ interface IdentityComponent<TModel extends IEntityModel> extends IComponent {
250
316
  readonly lastUpdated?: Date;
251
317
  }
252
318
  //#endregion
253
- export { IEntity as a, IEntityProxy as c, TypedEntityProxy as d, ComponentTypeUid as f, EntityUid as i, IEntityProxyRepository as l, IdentityComponent as n, IEntityModel as o, IComponent as p, EntityTypeUid as r, EntityProxy as s, BasicComponentType as t, RequiredProxies as u };
254
- //# sourceMappingURL=identity-component-uU0yDR-y.d.cts.map
319
+ export { IComponent as S, IEntityProxy as _, ImmutableArray as a, TypedEntityProxy as b, ImmutableObjectDeep as c, MutableDeep as d, EntityTypeUid as f, EntityProxy as g, IEntityModel as h, Immutable as i, ImmutableSet as l, IEntity as m, IdentityComponent as n, ImmutableMap as o, EntityUid as p, BooleanProps as r, ImmutableObject as s, BasicComponentType as t, Mutable as u, IEntityProxyRepository as v, ComponentTypeUid as x, RequiredProxies as y };
320
+ //# sourceMappingURL=identity-component-DLDaOTyK.d.cts.map