@axi-engine/states 0.1.0 → 0.1.1

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/index.js CHANGED
@@ -27,23 +27,26 @@ module.exports = __toCommonJS(index_exports);
27
27
  // src/state-machine.ts
28
28
  var import_utils = require("@axi-engine/utils");
29
29
  var StateMachine = class {
30
- constructor() {
31
- /**
32
- * @protected
33
- * A map storing all registered state configurations.
34
- */
35
- this.states = /* @__PURE__ */ new Map();
36
- /**
37
- * Public emitter that fires an event whenever the state changes.
38
- * The event provides the old state, the new state, and the payload.
39
- * @see Emitter
40
- * @example
41
- * fsm.onChange.subscribe((from, to, payload) => {
42
- * console.log(`State transitioned from ${from} to ${to}`);
43
- * });
44
- */
45
- this.onChange = new import_utils.Emitter();
46
- }
30
+ /**
31
+ * @protected
32
+ * The internal representation of the current state.
33
+ */
34
+ _state;
35
+ /**
36
+ * @protected
37
+ * A map storing all registered state configurations.
38
+ */
39
+ states = /* @__PURE__ */ new Map();
40
+ /**
41
+ * Public emitter that fires an event whenever the state changes.
42
+ * The event provides the old state, the new state, and the payload.
43
+ * @see Emitter
44
+ * @example
45
+ * fsm.onChange.subscribe((from, to, payload) => {
46
+ * console.log(`State transitioned from ${from} to ${to}`);
47
+ * });
48
+ */
49
+ onChange = new import_utils.Emitter();
47
50
  /**
48
51
  * Gets the current state of the machine.
49
52
  * @returns The current state identifier, or `undefined` if the machine has not been started.
package/dist/index.mjs CHANGED
@@ -1,23 +1,26 @@
1
1
  // src/state-machine.ts
2
2
  import { Emitter, isNullOrUndefined, isUndefined, throwIf, throwIfEmpty } from "@axi-engine/utils";
3
3
  var StateMachine = class {
4
- constructor() {
5
- /**
6
- * @protected
7
- * A map storing all registered state configurations.
8
- */
9
- this.states = /* @__PURE__ */ new Map();
10
- /**
11
- * Public emitter that fires an event whenever the state changes.
12
- * The event provides the old state, the new state, and the payload.
13
- * @see Emitter
14
- * @example
15
- * fsm.onChange.subscribe((from, to, payload) => {
16
- * console.log(`State transitioned from ${from} to ${to}`);
17
- * });
18
- */
19
- this.onChange = new Emitter();
20
- }
4
+ /**
5
+ * @protected
6
+ * The internal representation of the current state.
7
+ */
8
+ _state;
9
+ /**
10
+ * @protected
11
+ * A map storing all registered state configurations.
12
+ */
13
+ states = /* @__PURE__ */ new Map();
14
+ /**
15
+ * Public emitter that fires an event whenever the state changes.
16
+ * The event provides the old state, the new state, and the payload.
17
+ * @see Emitter
18
+ * @example
19
+ * fsm.onChange.subscribe((from, to, payload) => {
20
+ * console.log(`State transitioned from ${from} to ${to}`);
21
+ * });
22
+ */
23
+ onChange = new Emitter();
21
24
  /**
22
25
  * Gets the current state of the machine.
23
26
  * @returns The current state identifier, or `undefined` if the machine has not been started.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axi-engine/states",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -33,7 +33,10 @@
33
33
  "files": [
34
34
  "dist"
35
35
  ],
36
- "dependencies": {
37
- "@axi-engine/utils": "^0.1.5"
36
+ "devDependencies": {
37
+ "@axi-engine/utils": "^0.1.6"
38
+ },
39
+ "peerDependencies": {
40
+ "@axi-engine/utils": "^0.1.6"
38
41
  }
39
42
  }