{"_id":"@dreams-engine/slot-flow","_rev":"3-b2a2d45ea87f78589a4a5ac86a85e9c8","name":"@dreams-engine/slot-flow","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@dreams-engine/slot-flow","version":"0.1.0","_id":"@dreams-engine/slot-flow@0.1.0","maintainers":[{"name":"yujio","email":"xhuliomalaj37@gmail.com"}],"dist":{"shasum":"e97627e26dbe66841755f59227ed80ebef622543","tarball":"https://registry.npmjs.org/@dreams-engine/slot-flow/-/slot-flow-0.1.0.tgz","fileCount":26,"integrity":"sha512-XGIDM0+R1Df4gxxpcjohVbCdyKqqp4uiboDV81UHRc2Hvfm/hNwwl000tPdoTRmk4iDSaffl5DEH982/zh862A==","signatures":[{"sig":"MEUCIFcFTa+yPCtfy36Y4BQpELa76wmKR7S9rUdPlbtDLZnpAiEAnQIdaI+Cp5h0zahEN4rDVlM+9CUvCkYSV2CbzSUDxCk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26514},"main":"./dist/slot-engine-slot-flow.umd.js","types":"./dist/index.d.ts","module":"./dist/slot-engine-slot-flow.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/slot-engine-slot-flow.mjs","require":"./dist/slot-engine-slot-flow.umd.js"}},"gitHead":"feb9a96541a896e0aba1936690007acc6f2aaf01","scripts":{"dev":"vite build --watch","test":"vitest --config ../../vitest.config.ts","build":"vite build","clean":"rimraf dist","test:run":"vitest run --config ../../vitest.config.ts"},"_npmUser":{"name":"yujio","email":"xhuliomalaj37@gmail.com"},"_npmVersion":"10.9.2","description":"Command-based presentation framework for orchestrating visual effects and animations in slot machine games with support for cancellation and parallel execution.","directories":{},"_nodeVersion":"22.14.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.1.4","rimraf":"^5.0.5","typescript":"^5.3.3","@types/node":"^20.11.24","vite-plugin-dts":"^4.5.4","@dreams-engine/common":"workspace:*"},"peerDependencies":{"tslib":"^2.6.2","@dreams-engine/slot":"workspace:*"},"peerDependenciesMeta":{"@dreams-engine/slot":{"optional":false}},"_npmOperationalInternal":{"tmp":"tmp/slot-flow_0.1.0_1777804274721_0.05509127088634114","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dreams-engine/slot-flow","version":"0.1.1","_id":"@dreams-engine/slot-flow@0.1.1","maintainers":[{"name":"yujio","email":"xhuliomalaj37@gmail.com"}],"dist":{"shasum":"4213b7a6489b7a683a8feb5cfb0a45596b3c89c5","tarball":"https://registry.npmjs.org/@dreams-engine/slot-flow/-/slot-flow-0.1.1.tgz","fileCount":26,"integrity":"sha512-VUny8EH/9vYkihoBvUk63nJf0YckMHtb13F7T5Zyv4EkcG0qfeX6Lf6dfOaPJyiPvfKJ/6F1ZC7JWjdx37Wi6w==","signatures":[{"sig":"MEUCIQDRq6ZPqI+g1CrND/I31vXQaN5gtlHTBb80vXR1IUhCWgIgCW+IgoEMsyF/3YWTSPUoGGOcom8toh0xpC1fwgj5imA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26457},"main":"./dist/slot-engine-slot-flow.umd.js","_from":"file:dreams-engine-slot-flow-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/slot-engine-slot-flow.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/slot-engine-slot-flow.mjs","require":"./dist/slot-engine-slot-flow.umd.js"}},"scripts":{"dev":"vite build --watch","test":"vitest --config ../../vitest.config.ts","build":"vite build","clean":"rimraf dist","test:run":"vitest run --config ../../vitest.config.ts"},"_npmUser":{"name":"yujio","email":"xhuliomalaj37@gmail.com"},"_resolved":"C:\\Users\\GIGABYTE\\AppData\\Local\\Temp\\313eefe30d47b3d66ed7399789b0ac85\\dreams-engine-slot-flow-0.1.1.tgz","_integrity":"sha512-VUny8EH/9vYkihoBvUk63nJf0YckMHtb13F7T5Zyv4EkcG0qfeX6Lf6dfOaPJyiPvfKJ/6F1ZC7JWjdx37Wi6w==","_npmVersion":"10.9.2","description":"Command-based presentation framework for orchestrating visual effects and animations in slot machine games with support for cancellation and parallel execution.","directories":{},"_nodeVersion":"22.14.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.1.4","rimraf":"^5.0.5","typescript":"^5.3.3","@types/node":"^20.11.24","vite-plugin-dts":"^4.5.4","@dreams-engine/common":"1.0.1"},"peerDependencies":{"tslib":"^2.6.2","@dreams-engine/slot":"1.0.1"},"peerDependenciesMeta":{"@dreams-engine/slot":{"optional":false}},"_npmOperationalInternal":{"tmp":"tmp/slot-flow_0.1.1_1777806909988_0.44502538214653464","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@dreams-engine/slot-flow","version":"0.1.2","main":"./dist/slot-engine-slot-flow.umd.js","module":"./dist/slot-engine-slot-flow.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/slot-engine-slot-flow.mjs","require":"./dist/slot-engine-slot-flow.umd.js","types":"./dist/index.d.ts"}},"dependencies":{},"peerDependencies":{"tslib":"^2.6.2","@dreams-engine/slot":"1.0.2"},"peerDependenciesMeta":{"@dreams-engine/slot":{"optional":false}},"devDependencies":{"@types/node":"^20.11.24","rimraf":"^5.0.5","typescript":"^5.3.3","vite":"^5.1.4","vite-plugin-dts":"^4.5.4","@dreams-engine/common":"1.0.2"},"scripts":{"build":"vite build","dev":"vite build --watch","clean":"rimraf dist","test":"vitest --config ../../vitest.config.ts","test:run":"vitest run --config ../../vitest.config.ts"},"_id":"@dreams-engine/slot-flow@0.1.2","description":"Command-based presentation framework for orchestrating visual effects and animations in slot machine games with support for cancellation and parallel execution.","_integrity":"sha512-7ZmcnX8+HN+q8ew8k2FRPvNYdanJREz+r3slQlvycxX7ooBpaiUPs2ARqGhsj/VSRRCCNtVgsfMmkNj+36LpVQ==","_resolved":"C:\\Users\\GIGABYTE\\AppData\\Local\\Temp\\b829f402318aeb5973d4aa142364a40a\\dreams-engine-slot-flow-0.1.2.tgz","_from":"file:dreams-engine-slot-flow-0.1.2.tgz","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-7ZmcnX8+HN+q8ew8k2FRPvNYdanJREz+r3slQlvycxX7ooBpaiUPs2ARqGhsj/VSRRCCNtVgsfMmkNj+36LpVQ==","shasum":"de5b924eb92e2bc6c629b4dd41b41eed63b6e2eb","tarball":"https://registry.npmjs.org/@dreams-engine/slot-flow/-/slot-flow-0.1.2.tgz","fileCount":26,"unpackedSize":26468,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCVYyLE4MkxvuC/oEv+LzOUhPaQzVIrZNfwBky/TxA8sAIhAMfU7OuMYcRYkth3uL6BfuqTV/dG2kTkR3vGXGhfwbGX"}]},"_npmUser":{"name":"yujio","email":"xhuliomalaj37@gmail.com"},"directories":{},"maintainers":[{"name":"yujio","email":"xhuliomalaj37@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/slot-flow_0.1.2_1777929827938_0.07559179040619424"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-03T10:31:14.567Z","modified":"2026-05-04T21:23:48.193Z","0.1.0":"2026-05-03T10:31:14.893Z","0.1.1":"2026-05-03T11:15:10.143Z","0.1.2":"2026-05-04T21:23:48.069Z"},"description":"Command-based presentation framework for orchestrating visual effects and animations in slot machine games with support for cancellation and parallel execution.","maintainers":[{"name":"yujio","email":"xhuliomalaj37@gmail.com"}],"readme":"# Slot Flow\r\n\r\nCommand-based presentation framework for orchestrating visual effects and animations in slot machine games with support for cancellation and parallel execution.\r\n\r\n## Features\r\n\r\n- Command pattern for atomic visual actions\r\n- Sequential and parallel execution with Runner  \r\n- Presenter pattern for complex visual sequences\r\n- Cooperative cancellation via AbortSignal\r\n- Built-in commands for common slot effects\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm i @dreams-engine/slot-flow\r\n```\r\n\r\n## Core Architecture\r\n\r\n### ICommand\r\nAtomic visual action with execution and cancellation:\r\n\r\n```typescript\r\ninterface ICommand {\r\n  readonly name: string;\r\n  execute(signal: AbortSignal): Promise<void>;\r\n  cancel?(reason?: string): void;\r\n}\r\n```\r\n\r\n### Runner\r\nExecutes command plans sequentially or in parallel:\r\n\r\n```typescript\r\nconst runner = new Runner();\r\nawait runner.run([\r\n  command1,                    // Sequential\r\n  [command2, command3],        // Parallel\r\n  command4                     // Sequential\r\n]);\r\n```\r\n\r\n### IPresenter\r\nHigh-level strategy for presentation sequences:\r\n\r\n```typescript\r\ninterface IPresenter<TPlanInput, TMachine> {\r\n  present(input: TPlanInput, signal?: AbortSignal): Promise<void>;\r\n  cancel(reason?: string): void;\r\n}\r\n```\r\n\r\n## Built-in Commands\r\n\r\n### DimCommand\r\nDims non-target symbols (default alpha: 0.4), with clear mode to restore all symbols:\r\n\r\n```typescript\r\nnew DimCommand(machine, positions, { alpha: 0.4, clear: false });\r\n```\r\n\r\n### HighlightCommand  \r\nEnsures target symbols are fully visible (alpha: 1.0):\r\n\r\n```typescript\r\nnew HighlightCommand(machine, positions);\r\n```\r\n\r\n### PlayWinCommand\r\nPlays win animations with configurable duration:\r\n\r\n```typescript\r\nnew PlayWinCommand(machine, positions, { durationMs: 1200, revertToIdle: false });\r\n```\r\n\r\n## Built-in Presenters\r\n\r\n### WinPresenter\r\nOrchestrates standard win sequences: dim → highlight/animate → clear\r\n\r\n```typescript\r\nconst presenter = new WinPresenter(machine);\r\nawait presenter.present(winData);\r\n```\r\n\r\n## Usage Examples\r\n\r\n### Basic Command Execution\r\n\r\n```typescript\r\nimport { Runner, DimCommand, HighlightCommand } from '@dreams-engine/slot-flow';\r\n\r\nconst runner = new Runner();\r\nawait runner.run([\r\n  new DimCommand(machine, winMatrix),\r\n  [\r\n    new HighlightCommand(machine, winMatrix),\r\n    new PlayWinCommand(machine, winMatrix)\r\n  ],\r\n  new DimCommand(machine, [], { clear: true })\r\n]);\r\n```\r\n\r\n### Win Presentation\r\n\r\n```typescript\r\nconst winData = [{\r\n  symbolId: 'A',\r\n  matrix: [0, 0, 0, null, null], // Win on first 3 reels, row 0\r\n  amount: 100,\r\n  total: 100\r\n}];\r\n\r\nconst presenter = new WinPresenter(machine);\r\nawait presenter.present(winData);\r\n```\r\n\r\n### Cancellation\r\n\r\n```typescript\r\nconst controller = new AbortController();\r\nconst execution = runner.run(plan, controller.signal);\r\n\r\n// Cancel execution\r\nsetTimeout(() => {\r\n  controller.abort();\r\n  runner.cancel('timeout');\r\n}, 2000);\r\n```\r\n\r\n## Data Types\r\n\r\n### WinMatrix\r\nDefines symbol positions for commands:\r\n\r\n```typescript\r\ntype WinMatrix = (number | number[] | null)[];\r\n\r\n// Examples:\r\n[0, 0, 0, null, null]           // Single row win\r\n[[0, 1], [1, 2], 0, null, null] // Multiple positions\r\n```\r\n\r\n### WinData\r\nWin information for presentations:\r\n\r\n```typescript\r\ninterface WinData {\r\n  symbolId: string;\r\n  matrix: WinMatrix;\r\n  amount: number;\r\n  total: number;\r\n  multiplier?: number;\r\n  lineNumber?: number | null;\r\n  cascade?: CascadeMatrix | null;\r\n  wildWin?: boolean;\r\n  meta?: Record<string, unknown>;\r\n}\r\n```\r\n\r\n## Symbol States\r\n\r\nCommands manipulate symbols through:\r\n- **Visual properties**: `alpha` and `resetFilter()` \r\n- **Animation states**: `setState('win')` and `setState('idle')`\r\n- **Position calculation**: Uses `reel.extraCount + row` formula\r\n\r\n## Dependencies\r\n\r\n- **@dreams-engine/slot**: Core slot machine interfaces\r\n- **TypeScript**: Full type safety support\r\n\r\nZero runtime dependencies beyond peer dependencies.\r\n","readmeFilename":"README.md"}