@codehz/ecs 0.3.13 → 0.3.14

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 (3) hide show
  1. package/index.d.mts +11 -1
  2. package/index.mjs +1 -1
  3. package/package.json +1 -1
package/index.d.mts CHANGED
@@ -50,6 +50,16 @@ declare function isRelationId<T>(id: EntityId<T>): id is RelationId<T>;
50
50
  * Check if an ID is a wildcard relation id
51
51
  */
52
52
  declare function isWildcardRelationId<T>(id: EntityId<T>): id is WildcardRelationId<T>;
53
+ /**
54
+ * Decode a relation ID into component and target IDs
55
+ * @param relationId The relation ID (must be negative)
56
+ * @returns Object with componentId, targetId, and relation type
57
+ */
58
+ declare function decodeRelationId(relationId: RelationId<any>): {
59
+ componentId: ComponentId<any>;
60
+ targetId: EntityId<any>;
61
+ type: "entity" | "component" | "wildcard";
62
+ };
53
63
  /**
54
64
  * Component options that define intrinsic properties
55
65
  */
@@ -769,5 +779,5 @@ type SerializedComponent = {
769
779
  value: any;
770
780
  };
771
781
  //#endregion
772
- export { type ComponentId, type ComponentOptions, type ComponentRelationId, type ComponentTuple, type ComponentType, type EntityId, type EntityRelationId, type LifecycleHook, Query, type RelationId, type SerializedWorld, type System, type WildcardRelationId, World, component, getComponentIdByName, getComponentNameById, isComponentId, isEntityId, isRelationId, isWildcardRelationId, relation };
782
+ export { type ComponentId, type ComponentOptions, type ComponentRelationId, type ComponentTuple, type ComponentType, type EntityId, type EntityRelationId, type LifecycleHook, Query, type RelationId, type SerializedWorld, type System, type WildcardRelationId, World, component, decodeRelationId, getComponentIdByName, getComponentNameById, isComponentId, isEntityId, isRelationId, isWildcardRelationId, relation };
773
783
  //# sourceMappingURL=index.d.mts.map
package/index.mjs CHANGED
@@ -2134,5 +2134,5 @@ var World = class {
2134
2134
  };
2135
2135
 
2136
2136
  //#endregion
2137
- export { Query, World, component, getComponentIdByName, getComponentNameById, isComponentId, isEntityId, isRelationId, isWildcardRelationId, relation };
2137
+ export { Query, World, component, decodeRelationId, getComponentIdByName, getComponentNameById, isComponentId, isEntityId, isRelationId, isWildcardRelationId, relation };
2138
2138
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codehz/ecs",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "type": "module",
5
5
  "main": "./index.mjs",
6
6
  "types": "./index.d.mts",