{"_id":"@axi-engine/states","_rev":"10-c0eee5c407217f239892976bc214c858","name":"@axi-engine/states","dist-tags":{"latest":"0.3.3"},"versions":{"0.1.0":{"name":"@axi-engine/states","version":"0.1.0","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.1.0","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"dist":{"shasum":"a24b115a5b9c7617593b6f8166df84617e34742c","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.1.0.tgz","fileCount":6,"integrity":"sha512-UuAfjTT8uv1eScrFoWyd6hB4zbG+v3GKMTWoMNMRX/1HDhj0pPKbNvWrxuWadFwP+jPMk4B9S6Rxtv0HGhMRlw==","signatures":[{"sig":"MEUCIQDKX85gAJtHJsQ21mAh0KkY7OxsahSkGv3rsblvpM8atgIgIL4bj0bR3I2abVtaZ35qmzKPjtxwyW1L7CfYvjKnSM0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27018},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"b607d8f73c200963c50da9877c2ceacc490ebbc4","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"_npmVersion":"10.8.2","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","dependencies":{"@axi-engine/utils":"^0.1.5"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/states_0.1.0_1764678793263_0.5696186791267035","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@axi-engine/states","version":"0.1.1","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.1.1","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"dist":{"shasum":"bf09e827c064e0d950de295b4e85c89ccc8975d6","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.1.1.tgz","fileCount":6,"integrity":"sha512-yKL0YtiUAkftEHo/rdzlbxSc+zbP82XLy5/Z7XVghDXRiRhrXXRBIK7W7AYKBSwjkC82BD+xfH8vY8f93ofrQA==","signatures":[{"sig":"MEYCIQD7G3fSecOnJTR8+ffntd8t7JCfOfuBxV3nTzJB7SHxqAIhALeLN7ULZhsq4UBf8OeHWIvmn3coZ1NvtpgpzG6QUZ/x","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27149},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"db1c074916336041b5af59ebe8bfc5c6a36d2584","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"_npmVersion":"10.8.2","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"devDependencies":{"@axi-engine/utils":"^0.1.6"},"peerDependencies":{"@axi-engine/utils":"^0.1.6"},"_npmOperationalInternal":{"tmp":"tmp/states_0.1.1_1766506009847_0.9905883838620857","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@axi-engine/states","version":"0.1.2","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.1.2","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"4bfff7481468133c684f624369e63ccad9ef0478","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.1.2.tgz","fileCount":9,"integrity":"sha512-O1aF7pik2EsA1adky4tWbcV5Z/w6uhGFr3OkNVG1oPebwsUPwmb3LTLJcr2Sj4PxDq7L5LnTDod593W7GB9NRg==","signatures":[{"sig":"MEUCIQCK0osHpzmbtD5ayM6QIywQTumN6eIbXeIMg2eKxYaq4wIgdxQeYjW5gjc2n2GWAYOG7CC8YyshULLJ+zWuCDJ5lgk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36209},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"000fce5e5b62fa940f00748bc46c980fc40b2e9d","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsdown"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.6.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"devDependencies":{"@axi-engine/utils":"^0.1.6"},"peerDependencies":{"@axi-engine/utils":"^0.1.6"},"_npmOperationalInternal":{"tmp":"tmp/states_0.1.2_1768524626657_0.8186523304801554","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@axi-engine/states","version":"0.1.3","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.1.3","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"bfd2b08283f1f69d05f101e43430721551c079f0","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.1.3.tgz","fileCount":16,"integrity":"sha512-xCREALGwLsqJNLZGz0RerExqcNduUDkStX/eNF2q8v2Vcxre5kpqCiJwdrvGhVqmb8GZTlr8ksRe9zu2x3Sl5A==","signatures":[{"sig":"MEQCICd/Ozh4WFr4yD6oQo+FwJHuSKTTgP/5NgL4Y02JNrxfAiAJX3pSW9Tci7xn2GUhKfk7ymZgahObE38P1QLyhSjzxw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31293},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"4613ab7c31bcb8cf64c36306cdc17fb57a1092ef","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.6.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"devDependencies":{"@axi-engine/utils":"^0.1.6"},"peerDependencies":{"@axi-engine/utils":"^0.1.6"},"_npmOperationalInternal":{"tmp":"tmp/states_0.1.3_1768610447383_0.10966369665790676","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@axi-engine/states","version":"0.2.0","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.2.0","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"c8899843d2aa7aa07e7a0aac146bdf5f25bda79d","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.2.0.tgz","fileCount":16,"integrity":"sha512-EOIbSY3t5bSubTXtpN/DlHjI6H5M795bO8YFsM8HuwMlb7Qk/PDKHXQPMu8I5Xs2xTUSqzzXiOoK7ADfi7sxzA==","signatures":[{"sig":"MEUCIHmOOWIfO+p7Db/5gK+/Fsr4ZyPOt9Cs+qhaskf4gfFUAiEAn4+U1Pp8b1xYCo4xc2LJiHZYm/fc1Uuw4nRrwIkbGAU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31293},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"e5335f1def7555a8b8c5c9e10bab744ab0060b38","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.6.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"devDependencies":{"@axi-engine/utils":"^0.2.0"},"peerDependencies":{"@axi-engine/utils":"^0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/states_0.2.0_1768696115866_0.9737302920001876","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@axi-engine/states","version":"0.2.1","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.2.1","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"e7aa5ce14ac736d23fb5f827d2d916c627770adb","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.2.1.tgz","fileCount":6,"integrity":"sha512-Ufv3C1gCzvUGizGIpTQdioW58irC34G4e4RDKAgPjwSjukGgWa53M/FruLK+VTUaJNn84KfVbtovrzaJjJXfSg==","signatures":[{"sig":"MEUCICZSm80zm1hgzYK3M3ZKoZySCLxKDv7Q4DXouiGJR/1nAiEA8WHpBtTKUayV8kqlldkB5tJe95uGkFX8dPO7GXcmPoo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27281},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"c532e64802f61005601c5353ec6d9e39b0c4f201","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.6.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"devDependencies":{"@axi-engine/utils":"^0.2.1"},"peerDependencies":{"@axi-engine/utils":"^0.2.1"},"_npmOperationalInternal":{"tmp":"tmp/states_0.2.1_1768696771795_0.41271439998371173","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@axi-engine/states","version":"0.3.0","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.3.0","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"dfcf44d9c90a1e5dc6131956d59302cf62ff197a","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.3.0.tgz","fileCount":6,"integrity":"sha512-ekZNX+F3Uezl8ipmLAr496bO2+EqRqNbMbT4Y1iatOJA7Zj92mYk9wtCBeAqYbwGFKPBIzdJ32ZGv8kcVtl8cw==","signatures":[{"sig":"MEQCIFFnD5TtKB3N+EWl6kqyyuqwWgWaqJQCR2A4qZWavzzwAiAaQl8WAmNxs4rlH8yuKWmXAZsEPcJhQsGEZari+V66xw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27465},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"5767b98fc907acf331cb41f1911084bae7df98a7","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.10.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"peerDependencies":{"@axijs/ensure":"^1.0.0","@axijs/emitter":"^1.0.0","@axi-engine/utils":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/states_0.3.0_1776341147476_0.2887441813598195","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@axi-engine/states","version":"0.3.1","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.3.1","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"c1fb4abd82673f798d9faa60ec7b1b0337587a9e","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.3.1.tgz","fileCount":6,"integrity":"sha512-LOZ2Wog9jIXT8+7Ptn8a5JzzAUV5k0MSMpwxzBKct/KzioEP4TfVt4/CNXKy8agEaSK7NzWC238mu2EGBtEh4w==","signatures":[{"sig":"MEQCIEphlvbfe0tVVNLNBqa5k8sc892w4rFL3nvP58VmGXL6AiAEZLHU7uDcMUXss0jv9RLiXaR29LEtmhwL5hrSSZI+GA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27367},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"5767b98fc907acf331cb41f1911084bae7df98a7","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"echo 'No tests yet for @axi-engine/states'","build":"tsup"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.10.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"peerDependencies":{"@axijs/ensure":"^1.0.0","@axijs/emitter":"^1.0.0","@axi-engine/utils":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/states_0.3.1_1776345409109_0.08630867238237228","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@axi-engine/states","version":"0.3.2","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"license":"MIT","_id":"@axi-engine/states@0.3.2","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"homepage":"https://github.com/axijs/engine#readme","bugs":{"url":"https://github.com/axijs/engine/issues"},"dist":{"shasum":"eab74549a6aed27378ad5cc2e8bd5169ff30b14b","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.3.2.tgz","fileCount":6,"integrity":"sha512-UOzDGRHtgH/Vc+OT8E3rmJ0sFdM3I40DuAb7nsNwAQEzBvEMjt9qmCAFcLvRz8Xt4mQNysr6h1mhDpTMDui5OA==","signatures":[{"sig":"MEQCIBRBEEUJr/UB31D9sMdifyDHj77gUKMz4Q9cisU1PoD1AiBosL9yy0la0ytU1R3ELq0dFXplIGIfmh+UGR16ynFsrA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29005},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"5767b98fc907acf331cb41f1911084bae7df98a7","scripts":{"docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json","test":"vitest run","build":"tsup","prebuild":"npm test"},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"repository":{"url":"git+https://github.com/axijs/engine.git","type":"git","directory":"packages/states"},"_npmVersion":"11.10.0","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","directories":{},"_nodeVersion":"20.19.3","_hasShrinkwrap":false,"peerDependencies":{"@axijs/ensure":"^1.0.0","@axijs/emitter":"^1.0.0","@axi-engine/utils":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/states_0.3.2_1776347745383_0.8583353734997654","host":"s3://npm-registry-packages-npm-production"}},"0.3.3":{"name":"@axi-engine/states","version":"0.3.3","description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/axijs/engine.git","directory":"packages/states"},"keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"types":"./dist/index.d.ts","main":"./dist/index.js","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup","prebuild":"npm test","test":"vitest run","docs":"typedoc src/index.ts --out docs/api --options ../../typedoc.json"},"peerDependencies":{"@axijs/emitter":"^1.1.1","@axijs/ensure":"^1.0.2","@axi-engine/utils":"^0.3.0"},"gitHead":"6bd013efd250407aaddf2ebfc9dc2c34068a2afa","_id":"@axi-engine/states@0.3.3","bugs":{"url":"https://github.com/axijs/engine/issues"},"homepage":"https://github.com/axijs/engine#readme","_nodeVersion":"20.19.3","_npmVersion":"11.11.0","dist":{"integrity":"sha512-USe+N5y5FXTMpg0GK+C8KuMMTm/qXs1AZo6qPUp5+3YSgunW/z30UiwDObEUrawc0MhriJUmr0sZlfoKe4QQpA==","shasum":"1e76cc0c0b413ed0163792a0020777ef13542716","tarball":"https://registry.npmjs.org/@axi-engine/states/-/states-0.3.3.tgz","fileCount":6,"unpackedSize":28983,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHnrsDjOHy89FCLEwFovs4lru7+7Gjp/zZcrHPe203F7AiEAi8UyKMw0M2DZq2GCp38vpPM4xWL7lPF8zdRWsUUJdmc="}]},"_npmUser":{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"},"directories":{},"maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/states_0.3.3_1783985837212_0.35108506219830504"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-02T12:33:13.196Z","modified":"2026-07-13T23:37:17.457Z","0.1.0":"2025-12-02T12:33:13.460Z","0.1.1":"2025-12-23T16:06:49.999Z","0.1.2":"2026-01-16T00:50:26.806Z","0.1.3":"2026-01-17T00:40:47.603Z","0.2.0":"2026-01-18T00:28:36.022Z","0.2.1":"2026-01-18T00:39:31.940Z","0.3.0":"2026-04-16T12:05:47.621Z","0.3.1":"2026-04-16T13:16:49.259Z","0.3.2":"2026-04-16T13:55:45.516Z","0.3.3":"2026-07-13T23:37:17.344Z"},"bugs":{"url":"https://github.com/axijs/engine/issues"},"license":"MIT","homepage":"https://github.com/axijs/engine#readme","keywords":["axi-engine","typescript","gamedev","game-development","game-engine","state-machine","finite-state-machine","fsm","state-management","events"],"repository":{"type":"git","url":"git+https://github.com/axijs/engine.git","directory":"packages/states"},"description":"A minimal, type-safe state machine for the Axi Engine, designed for managing game logic and component states with a simple API.","maintainers":[{"name":"nimbuspaw","email":"nimbuspaw@gmail.com"}],"readme":"# StateMachine\r\n\r\nA lightweight, type-safe, and easy-to-use state machine \r\ndesigned for managing game logic and component states\r\nwithin the Axi Engine.\r\n\r\nThis implementation prioritizes simplicity, \r\na clean API, and robust error handling for common use cases. \r\nIt is perfect for managing character states, \r\nUI flows, game session lifecycles, and more. \r\nIt has minimal dependencies, relying only on the `Emitter` \r\nutility from `@axi-engine/utils` for its event system.\r\n\r\nFor highly complex scenarios involving hierarchical (nested) states, \r\nparallel states, or state history, \r\nI recommend considering more powerful, \r\ndedicated libraries like [XState](https://xstate.js.org/). \r\n\r\nMy goal is to provide a solid, built-in tool that covers 80% of typical game development needs \r\nwithout adding external dependencies or unnecessary complexity.\r\n\r\n## Features\r\n\r\n-   **Simple and Clean API:** Registering states and transitioning between them is straightforward.\r\n-   **Type-Safe:** Leverages TypeScript generics to provide type safety for state names and event payloads.\r\n-   **Lifecycle Hooks:** States can have `onEnter` and `onExit` handlers for setup and cleanup logic.\r\n-   **Transition Guards:** You can define which states are allowed to transition to a new state, preventing logical errors.\r\n-   **Observable State:** A public `onChange` emitter allows you to subscribe to all state transitions for debugging, logging, or reacting to changes.\r\n-   **Minimal Dependencies:** Relies only on a tiny, self-contained `Emitter` utility.\r\n\r\n## Getting Started\r\n\r\nFirst, define the possible states, typically using an `enum` for type safety.\r\n\r\n```typescript\r\nenum GameState {\r\n  MainMenu,\r\n  Loading,\r\n  Playing,\r\n  Paused,\r\n  GameOver,\r\n}\r\n```\r\n\r\nThen, create an instance of the `StateMachine`. The machine starts in an `undefined` state.\r\n\r\n```typescript\r\nimport { StateMachine } from './@axi-engine/states';\r\n\r\nconst gameState = new StateMachine<GameState>();\r\n```\r\n\r\n## API and Usage\r\n\r\n### 1. Registering States\r\n\r\nYou can register a state with a simple handler function. This function will be treated as the `onEnter` hook.\r\n\r\n```typescript\r\n// Simple registration\r\ngameState.register(GameState.MainMenu, () => {\r\n  console.log('Welcome to the Main Menu!');\r\n  showMainMenu();\r\n});\r\n\r\ngameState.register(GameState.GameOver, () => {\r\n  console.log('Game Over!');\r\n  showGameOverScreen();\r\n});\r\n```\r\n\r\n### 2. Changing States\r\n\r\nUse the `call` method to transition to a new state. The method is asynchronous to handle any `async` logic within state handlers. The first call will formally start the machine.\r\n\r\n```typescript\r\n// Start the machine by calling the initial state\r\nawait gameState.call(GameState.MainMenu);\r\n\r\n// ... later in the game\r\nawait gameState.call(GameState.GameOver);\r\n```\r\n\r\n### 3. Using Payloads\r\n\r\nYou can pass data during a state transition. The payload type can be defined in the `StateMachine` generic.\r\n\r\n```typescript\r\n// State machine that accepts a string payload for the 'Loading' state\r\nconst sm = new StateMachine<GameState, string>();\r\n\r\nsm.register(GameState.Loading, async (levelId: string) => {\r\n  console.log(`Loading level: ${levelId}...`);\r\n  await loadLevelAssets(levelId);\r\n});\r\n\r\nawait sm.call(GameState.Loading, 'level-2');\r\n```\r\n\r\n### 4. Advanced Registration\r\n\r\nFor more control, you can register a state with a configuration object. This allows you to define `onEnter`, `onExit` hooks, and transition guards.\r\n\r\n#### `onEnter` and `onExit`\r\n\r\n-   `onEnter`: Called when the machine enters the state.\r\n-   `onExit`: Called when the machine leaves the state. This is perfect for cleanup.\r\n\r\n```typescript\r\ngameState.register(GameState.Playing, {\r\n  onEnter: () => {\r\n    console.log('Starting game...');\r\n    gameMusic.play();\r\n    player.enableControls();\r\n  },\r\n  onExit: () => {\r\n    console.log('Exiting gameplay...');\r\n    gameMusic.stop();\r\n    player.disableControls();\r\n  },\r\n});\r\n```\r\n\r\n#### `allowedFrom` (Transition Guards)\r\n\r\nSpecify an array of states from which a transition to this state is permitted. An attempt to transition from any other state will throw an error.\r\n\r\n```typescript\r\ngameState.register(GameState.Paused, {\r\n  // You can only pause the game if you are currently playing.\r\n  allowedFrom: [GameState.Playing],\r\n  onEnter: () => {\r\n    console.log('Game paused.');\r\n    showPauseMenu();\r\n  },\r\n});\r\n\r\n// This will work:\r\nawait gameState.call(GameState.Playing);\r\nawait gameState.call(GameState.Paused);\r\n\r\n// This will throw an error:\r\nawait gameState.call(GameState.MainMenu);\r\nawait gameState.call(GameState.Paused); // Error: Transition from MainMenu to Paused is not allowed.\r\n```\r\n\r\n### 5. Subscribing to Changes\r\n\r\nThe public `onChange` property is an `Emitter`. You can use its `subscribe` method to be notified of any state change. The method returns a function to unsubscribe.\r\n\r\n```typescript\r\nconst unsubscribe = gameState.onChange.subscribe(event => {\r\n  const fromState = event.from !== undefined ? GameState[event.from] : 'Start';\r\n  console.log(`State changed from ${fromState} to ${GameState[event.to]}`, { payload: event.payload });\r\n});\r\n\r\nawait gameState.call(GameState.MainMenu);\r\n// Console output: State changed from Start to MainMenu\r\n\r\n// To stop listening later:\r\nunsubscribe();\r\n```\r\n\r\n## Full Example\r\n\r\n```typescript\r\nimport { StateMachine } from '@axi-engine/states';\r\n\r\nenum GameState {\r\n  MainMenu,\r\n  Playing,\r\n  Paused,\r\n  GameOver,\r\n}\r\n\r\n// --- Setup ---\r\nconst game = new StateMachine<GameState>();\r\n\r\ngame.onChange.subscribe(e => {\r\n  const fromState = e.from !== undefined ? GameState[e.from] : 'Start';\r\n  console.log(`[SYSTEM] Transition: ${fromState} -> ${GameState[e.to]}`);\r\n});\r\n\r\ngame.register(GameState.MainMenu, {\r\n  onEnter: () => console.log('Showing Main Menu.'),\r\n});\r\n\r\ngame.register(GameState.Playing, {\r\n  allowedFrom: [GameState.MainMenu, GameState.Paused],\r\n  onEnter: () => console.log('Game has started! Player controls enabled.'),\r\n  onExit: () => console.log('Player controls disabled.'),\r\n});\r\n\r\ngame.register(GameState.Paused, {\r\n  allowedFrom: [GameState.Playing],\r\n  onEnter: () => console.log('Game is paused.'),\r\n});\r\n\r\ngame.register(GameState.GameOver, {\r\n  allowedFrom: [GameState.Playing],\r\n  onEnter: () => console.log('You lose!'),\r\n});\r\n\r\n// --- Simulation ---\r\nasync function runGame() {\r\n  await game.call(GameState.MainMenu);\r\n  // [SYSTEM] Transition: Start -> MainMenu\r\n  // Showing Main Menu.\r\n\r\n  await game.call(GameState.Playing);\r\n  // [SYSTEM] Transition: MainMenu -> Playing\r\n  // Game has started! Player controls enabled.\r\n\r\n  await game.call(GameState.Paused);\r\n  // [SYSTEM] Transition: Playing -> Paused\r\n  // Player controls disabled.\r\n  // Game is paused.\r\n\r\n  try {\r\n    // This transition will fail because of the 'allowedFrom' guard\r\n    await game.call(GameState.MainMenu);\r\n  } catch (e) {\r\n    console.error(e.message); // Error: Transition from Paused to MainMenu is not allowed.\r\n  }\r\n}\r\n\r\nrunGame();\r\n```\r\n","readmeFilename":"README.md"}