{"_id":"@b7az3/robowhale-phaser","_rev":"3-14441567f1f26ef8e0d65e3b51eec29c","name":"@b7az3/robowhale-phaser","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@b7az3/robowhale-phaser","version":"1.0.0","keywords":["phaser","phaser3","game","ui","components","grid","kinetic-scroll","buttons","toast","storage","utils"],"author":{"name":"b7az3"},"license":"MIT","_id":"@b7az3/robowhale-phaser@1.0.0","maintainers":[{"name":"b7az3","email":"gellato.blaze@proton.me"}],"dist":{"shasum":"e25d94d15212694338dc0362ae7be6bf1b819b9f","tarball":"https://registry.npmjs.org/@b7az3/robowhale-phaser/-/robowhale-phaser-1.0.0.tgz","fileCount":39,"integrity":"sha512-1g979hWRnvRwAozKEeH23ZVHk8GOR/NIIWPMdcrEE3W8naqTWAxbHSphPDv4f89F0wBezSNsh0vf9xJFmL2QxA==","signatures":[{"sig":"MEUCIFxgN/ZMAx5Vjh1MXs4bupNFPKYgXi+jUGvyNJ6k2rTlAiEA11tMHilzO97l50KlcdR3eJKbYix1M7AkaciONDznlBA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":161277},"main":"index.js","type":"module","exports":{".":"./index.js","./grid/*":"./src/grid/*.js","./utils/*":"./src/utils/*.js","./Polyfills":"./src/Polyfills.js","./phaser3/*":"./src/phaser3/*.js","./storage/*":"./src/storage/*.js","./phaser3/camera/*":"./src/phaser3/camera/*.js","./phaser3/scenes/*":"./src/phaser3/scenes/*.js","./phaser3/particles/*":"./src/phaser3/particles/*.js","./phaser3/gameObjects/*":"./src/phaser3/gameObjects/*.js","./phaser3/gameObjects/text/*":"./src/phaser3/gameObjects/text/*.js","./phaser3/gameObjects/toast/*":"./src/phaser3/gameObjects/toast/*.js","./phaser3/gameObjects/buttons/*":"./src/phaser3/gameObjects/buttons/*.js","./phaser3/gameObjects/container/*":"./src/phaser3/gameObjects/container/*.js","./phaser3/gameObjects/container/screen/*":"./src/phaser3/gameObjects/container/screen/*.js"},"_npmUser":{"name":"b7az3","email":"gellato.blaze@proton.me"},"_npmVersion":"10.9.3","description":"Reusable Phaser 3 utilities and UI components","directories":{},"_nodeVersion":"22.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"phaser":"^3.60.0"},"_npmOperationalInternal":{"tmp":"tmp/robowhale-phaser_1.0.0_1776464959449_0.2548480666475219","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@b7az3/robowhale-phaser","version":"1.0.1","keywords":["phaser","phaser3","game","ui","components","grid","kinetic-scroll","buttons","toast","storage","utils"],"author":{"name":"b7az3"},"license":"MIT","_id":"@b7az3/robowhale-phaser@1.0.1","maintainers":[{"name":"b7az3","email":"gellato.blaze@proton.me"}],"dist":{"shasum":"c8f7d0e97a01770ed162324e0e5be7a1ea5a6663","tarball":"https://registry.npmjs.org/@b7az3/robowhale-phaser/-/robowhale-phaser-1.0.1.tgz","fileCount":39,"integrity":"sha512-X9xzBFdAZZxUd/6/O16QwpXWyX6+4tBnCbpYR3nC8lyRAsg4FwJJTRa7dBThbuXfadSYgpxkcGcXWHcPfNSuHQ==","signatures":[{"sig":"MEQCIEZimwnrtIIClb7GwYZpjNbtXNVWr3oCdIfz8hXYNyVtAiBoMm8Q1GvTRrm+c8T8LtW8ObNbLcjdKiWoMR2rmXGzzg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":161372},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":"./index.js","./grid/*":"./src/grid/*.js","./utils/*":"./src/utils/*.js","./Polyfills":"./src/Polyfills.js","./phaser3/*":"./src/phaser3/*.js","./storage/*":"./src/storage/*.js","./phaser3/camera/*":"./src/phaser3/camera/*.js","./phaser3/scenes/*":"./src/phaser3/scenes/*.js","./phaser3/particles/*":"./src/phaser3/particles/*.js","./phaser3/gameObjects/*":"./src/phaser3/gameObjects/*.js","./phaser3/gameObjects/text/*":"./src/phaser3/gameObjects/text/*.js","./phaser3/gameObjects/toast/*":"./src/phaser3/gameObjects/toast/*.js","./phaser3/gameObjects/buttons/*":"./src/phaser3/gameObjects/buttons/*.js","./phaser3/gameObjects/container/*":"./src/phaser3/gameObjects/container/*.js","./phaser3/gameObjects/container/screen/*":"./src/phaser3/gameObjects/container/screen/*.js"},"gitHead":"ed1636853fdd79969b5526eacd2d29dbbf348bb1","_npmUser":{"name":"b7az3","email":"gellato.blaze@proton.me"},"_npmVersion":"10.9.3","description":"Reusable Phaser 3 utilities and UI components","directories":{},"_nodeVersion":"22.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"phaser":"^3.60.0"},"_npmOperationalInternal":{"tmp":"tmp/robowhale-phaser_1.0.1_1776546028354_0.5619034730746486","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@b7az3/robowhale-phaser","version":"1.0.2","description":"Reusable Phaser 3 utilities and UI components","type":"module","main":"index.js","types":"index.d.ts","exports":{".":"./index.js","./grid/*":"./src/grid/*.js","./phaser3/*":"./src/phaser3/*.js","./phaser3/camera/*":"./src/phaser3/camera/*.js","./phaser3/gameObjects/*":"./src/phaser3/gameObjects/*.js","./phaser3/gameObjects/buttons/*":"./src/phaser3/gameObjects/buttons/*.js","./phaser3/gameObjects/container/*":"./src/phaser3/gameObjects/container/*.js","./phaser3/gameObjects/container/screen/*":"./src/phaser3/gameObjects/container/screen/*.js","./phaser3/gameObjects/text/*":"./src/phaser3/gameObjects/text/*.js","./phaser3/gameObjects/toast/*":"./src/phaser3/gameObjects/toast/*.js","./phaser3/particles/*":"./src/phaser3/particles/*.js","./phaser3/scenes/*":"./src/phaser3/scenes/*.js","./storage/*":"./src/storage/*.js","./utils/*":"./src/utils/*.js","./Polyfills":"./src/Polyfills.js"},"peerDependencies":{"phaser":"^3.60.0"},"publishConfig":{"access":"public"},"keywords":["phaser","phaser3","game","ui","components","grid","kinetic-scroll","buttons","toast","storage","utils"],"author":{"name":"b7az3"},"license":"MIT","_id":"@b7az3/robowhale-phaser@1.0.2","gitHead":"9e51d0d4ba80066a573ac4bc9bb89f499ed3bf7b","_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-hIwpduVX5s+q3qz1LYc0Z/YdeSbG2kPGmEa8c5+piX/n0kPWsPHFFoZQoyMV39+lgTuJdUIN5P3wFSVYdIl6Ow==","shasum":"dfaa08b19c532a390b552f0f665878166271f294","tarball":"https://registry.npmjs.org/@b7az3/robowhale-phaser/-/robowhale-phaser-1.0.2.tgz","fileCount":40,"unpackedSize":178618,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB4NCHLDYDQzZu7NucypESi84cbsHWLBfqV47GQHfZoxAiAs0eYiU9q/EC//CN/+Kf84Flg7PizbTkyV41c8+FsKOA=="}]},"_npmUser":{"name":"b7az3","email":"gellato.blaze@proton.me"},"directories":{},"maintainers":[{"name":"b7az3","email":"gellato.blaze@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/robowhale-phaser_1.0.2_1776546637606_0.38405913959522264"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-17T22:29:19.379Z","modified":"2026-04-18T21:10:37.858Z","1.0.0":"2026-04-17T22:29:19.598Z","1.0.1":"2026-04-18T21:00:28.506Z","1.0.2":"2026-04-18T21:10:37.758Z"},"author":{"name":"b7az3"},"license":"MIT","keywords":["phaser","phaser3","game","ui","components","grid","kinetic-scroll","buttons","toast","storage","utils"],"description":"Reusable Phaser 3 utilities and UI components","maintainers":[{"name":"b7az3","email":"gellato.blaze@proton.me"}],"readme":"# @b7az3/robowhale-phaser\n\n[![npm version](https://img.shields.io/npm/v/@b7az3/robowhale-phaser.svg)](https://www.npmjs.com/package/@b7az3/robowhale-phaser)\n[![Phaser 3](https://img.shields.io/badge/Phaser-3.60+-green.svg)](https://phaser.io/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA collection of reusable, generic **Phaser 3** utilities and UI components.  \nDesigned to be **dependency‑free** (except Phaser itself), fully configurable, and well‑documented.\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Modules Overview](#modules-overview)\n  - [Grid](#grid)\n  - [Phaser 3 Extensions](#phaser-3-extensions)\n  - [Camera](#camera)\n  - [Game Objects](#game-objects)\n    - [Buttons](#buttons)\n    - [Container](#container)\n    - [Text](#text)\n    - [Toast](#toast)\n    - [CameraScrollbar](#camerascrollbar)\n  - [Particles](#particles)\n  - [Scenes](#scenes)\n  - [Easing](#easing)\n  - [RenderStatsDOM](#renderstatsdom)\n  - [Storage](#storage)\n  - [Utils](#utils)\n  - [Polyfills](#polyfills)\n- [Building / Publishing](#building--publishing)\n- [License](#license)\n\n---\n\n## GitHub Repo\n```sh\nhttps://github.com/B7AZ3/robowhale-phaser\n```\n\n\n## Installation\n\n```bash\nnpm install @b7az3/robowhale-phaser\n```\n\n## Usage\nImport components directly from the main entry or from subpaths (recommended for tree‑shaking):\n```js\n// Main entry (exports everything)\nimport { SimpleButton, GridArray, BaseScene } from '@b7az3/robowhale-phaser';\n\n// Deep imports – more granular\nimport SimpleButton from '@b7az3/robowhale-phaser/phaser3/gameObjects/buttons/SimpleButton.js';\nimport { Direction } from '@b7az3/robowhale-phaser/utils/Direction.js';\n```\n\n🚀 Quick Start\n```js\nimport { BaseScene, SimpleButton, GridArray, DeviceUtil } from '@b7az3/robowhale-phaser';\n\nclass MyScene extends BaseScene {\n    create() {\n        // Simple button with press feedback\n        const btn = new SimpleButton(this, {\n            texture: 'ui_atlas',\n            frame: 'btn_blue',\n            onPress: () => console.log('Clicked!')\n        });\n        this.add.existing(btn);\n        \n        // Grid storage\n        const grid = new GridArray(5, 5);\n        grid.addAt(2, 2, { name: 'player' });\n        \n        // Device detection\n        if (DeviceUtil.isDesktop()) {\n            console.log('Running on desktop');\n        }\n    }\n}\n```\n\n📚 Modules Overview\n🧩 Grid\n\n    GridArray – 2D grid data structure with neighbor queries, dynamic resizing, and iteration helpers.\n\n🎮 Phaser 3 Extensions\n\n    Phaser3Extensions – Augments Phaser prototypes with extra methods (tween helpers, factory methods, scaling, etc.). Call Phaser3Extensions.polyfill() once.\n\n    KineticScroll – Inertial (kinetic) scrolling for cameras with touch/mouse wheel support.\n\n    RenderStatsDOM – Real‑time FPS / draw call overlay.\n\n🔘 Buttons\n\n    SimpleButton – Basic image button with press tween and optional sound.\n\n    ComplexButton – Container‑based button with icon, text, and flexible layout.\n\n    ToggleButton – Two‑state button that swaps frames.\n\n    SoundButton / MusicButton – Specialised buttons for toggling sound/music mute (customisable callbacks).\n\n    SwitchButton – Left/right arrow selector with title and dynamic text.\n\n🖼️ Containers & Screens\n\n    PhaserScreen – Full‑screen overlay with background and responsive pinning.\n\n    SwitchButton – See above.\n\n📝 Text\n\n    AutosizeText – Automatically scales text to fit within a bounding box.\n\n🍞 Toast Notifications\n\n    Toast – Popup message with auto‑dismiss.\n\n    ToastsManager – Manages a queue of toasts (extends PhaserScreen).\n\n🌊 Particles\n\n    ParticleUtil – Helper methods for particle emission zones (texture‑based, circle edge, random values).\n\n🎬 Scenes\n\n    BaseScene – Extended scene with pinning, scaling, fast‑forward, and keyboard shortcuts.\n\n    FastForward – Speeds up / slows down scene tweens and time.\n\n    Pinner – Pin objects to relative screen positions.\n\n    Scaler – Responsive scaling of game objects (fit, fill, cover).\n\n💾 Storage\n\n    IdbKeyvalWrapper – IndexedDB wrapper (native, no external lib).\n\n    LocalStorageWrapper – Namespaced localStorage.\n\n    RuntimeStorage – In‑memory store.\n\n🛠️ Utilities\n\n    Direction / getOrthoDirection – 8‑directional constants.\n\n    DeviceUtil – Desktop detection, device memory.\n\n    NetUtil – Host detection, iframe check.\n\n    parseMilliseconds, toMs – Time conversion.\n\n    updateUrlQuery – URL parameter manipulation.\n\n    isAvifSupported, isWebpSupported, isWebAssemblySupported – Feature detection.\n\n    cssAnimate – Promise‑based CSS animation helper.\n\n🔧 Polyfills\n\n    Polyfills – Adds Element.remove() if missing.\n\n🧪 Advanced Usage Examples\nKinetic scrolling with bounds checking\n```js\nimport { KineticScroll } from '@b7az3/robowhale-phaser';\n\nconst scroller = new KineticScroll(this, {\n    camera: this.cameras.main,\n    horizontalScroll: true,\n    verticalScroll: true,\n    kineticMovement: true\n});\nscroller.addPointerListeners();\n// In update() call scroller.update();\n```\n\nAutosize text inside a fixed rectangle\n```js\nimport { AutosizeText } from '@b7az3/robowhale-phaser';\n\nconst text = new AutosizeText(scene, 400, 300, 'Long text...', {\n    fontFamily: 'Arial',\n    fontSize: '32px',\n    color: '#fff'\n}, { maxWidth: 200, maxHeight: 100 });\nscene.add.existing(text);\n```\n\nUsing storage with fallback\n```js\nimport { IdbKeyvalWrapper, LocalStorageWrapper } from '@b7az3/robowhale-phaser';\n\nlet storage;\nif (window.indexedDB) {\n    storage = new IdbKeyvalWrapper('my_game');\n    await storage.init();\n} else {\n    storage = new LocalStorageWrapper('my_game');\n}\nawait storage.saveValue('score', 100);\nconst score = await storage.getNumber('score');\n```\n\nCreating a toggle button with custom callback\n```js\nimport { ToggleButton } from '@b7az3/robowhale-phaser';\n\nconst toggle = new ToggleButton(scene, {\n    texture: 'ui_atlas',\n    frameState1: 'sound_on',\n    frameState2: 'sound_off',\n    onStateChange: (state) => {\n        console.log(state === 1 ? 'ON' : 'OFF');\n    }\n});\n```\n\nYou can import sub‑modules directly to reduce bundle size:\n\n```js\nimport SimpleButton from '@b7az3/robowhale-phaser/phaser3/gameObjects/buttons/SimpleButton.js';\n```\n\n⚙️ Configuration & Extensibility\n\nMost components accept a configuration object rather than many positional arguments.\nAll callbacks (onPress, onRelease, onUpdate, etc.) are optional, and sound is only played if you provide sound.key.\n\nTo add your own global extensions, use the Phaser3Extensions class – you can cherry‑pick which extensions to apply.\n🤝 Contributing\n\nContributions are welcome! Please follow the existing code style and add JSDoc for any new methods.\n📄 License\n\nMIT © b7az3","readmeFilename":"README.md"}