Vue phaserjs

From Esposter/Esposter · View interactive version

Vue phaserjs is an AI agent skill from the GitHub repository Esposter/Esposter. Apply when writing Phaser game objects, stores that hold them, or vue-phaserjs components. Esposter's vue-phaserjs integration of Phaser game objects into Vue components and stores.

How to use this skill

Skill file

vue-phaserjs Conventions

Settled — do not re-propose

Each refused addition has its reason on the library additions page.

Components

Every game object component follows the same 5-file pattern, split across five trees, and omits a file it does not need, such as <Circle>, which takes <Arc>'s configuration, emits and setter map — which is the whole inventory rule: what exists is whatever src/components/ holds, and adding one means adding the files it needs.

| File | Path |

| ---------------------------- | ------------------------------------------------- |

| {Name}.vue | packages/vue-phaserjs/src/components/ |

| {Name}Configuration.ts | packages/vue-phaserjs/src/models/configuration/ |

| {Name}EventEmitsOptions.ts | packages/vue-phaserjs/src/models/emit/ |

| {Name}Setter.ts | packages/vue-phaserjs/src/models/setterMap/ |

| {Name}SetterMap.ts | packages/vue-phaserjs/src/services/setterMap/ |

<Game> mounts the Phaser game and hosts <Scene>; every shape component extends ShapeConfiguration. One naming trap: the component is <Nineslice> with a lowercase s — <NineSlice> resolves to nothing.

Configuration Interfaces — `Pick` from Game Object Types

A new component's configuration Picks from the Phaser game object type, and a setter returning a fluent value is wrapped in braces, never void (references/adding-a-component.md).

Configuration Keys

useInitializeGameObjectSetters watches every key its setter map names, whatever the configuration held at setup, so a key may be left out, handed undefined or given a value later, and the game object follows it. A key with no value leaves the game object as Phaser made it, and the component emits that intrinsic value so a v-model still reads one; a missing key and an undefined one are the same thing here, as everywhere (the absent-values skill).

Phaser Objects in Pinia Stores

A Phaser object assigned to reactive store state is markRawed — the rule is the pinia skill's (references/class-instances-in-state.md), and which Phaser classes it bites is references/phaser-objects-in-stores.md.

SSR / "Phaser is not defined"

phaser must stay externalized. It reads window at import (its device detection runs in init() at module evaluation), so a page that imports it stays ssr: false: import("phaser") throws window is not defined in plain Node, and the route rule's comment names that import.

Nothing in this package configures that: it is a peer dependency, which tsdown externalizes. Keep it a peer.

Reference pages

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.