pixi-reels 4.2.0 → 4.3.0

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/PhaseCardSymbol-Ct9bCE4I.cjs.map +1 -1
  3. package/dist/PhaseCardSymbol-bVa7GpDn.js.map +1 -1
  4. package/dist/audio/BoardSounds.d.ts +45 -0
  5. package/dist/audio/BoardSounds.d.ts.map +1 -0
  6. package/dist/audio/ReelSounds.d.ts +64 -0
  7. package/dist/audio/ReelSounds.d.ts.map +1 -0
  8. package/dist/audio/cues.d.ts +109 -0
  9. package/dist/audio/cues.d.ts.map +1 -0
  10. package/dist/audio/zvukPort.d.ts +40 -0
  11. package/dist/audio/zvukPort.d.ts.map +1 -0
  12. package/dist/board/HoldAndWinBuilder.d.ts +1 -1
  13. package/dist/board/HoldAndWinBuilder.d.ts.map +1 -1
  14. package/dist/config/SpeedPresets.d.ts +11 -9
  15. package/dist/config/SpeedPresets.d.ts.map +1 -1
  16. package/dist/core/ReelSet.d.ts +7 -1
  17. package/dist/core/ReelSet.d.ts.map +1 -1
  18. package/dist/debug/DebugPlaque.d.ts +1 -1
  19. package/dist/debug/DebugPlaque.d.ts.map +1 -1
  20. package/dist/debug/debugOverlay.d.ts +3 -3
  21. package/dist/debug/debugOverlay.d.ts.map +1 -1
  22. package/dist/{debug-DckAC5l6.js → debug-Dlo9liNY.js} +53 -47
  23. package/dist/debug-Dlo9liNY.js.map +1 -0
  24. package/dist/debug-jrfEZUFK.cjs +4 -0
  25. package/dist/debug-jrfEZUFK.cjs.map +1 -0
  26. package/dist/debug.cjs +1 -1
  27. package/dist/debug.cjs.map +1 -1
  28. package/dist/debug.js +61 -52
  29. package/dist/debug.js.map +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.ts +8 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +271 -60
  35. package/dist/index.js.map +1 -1
  36. package/dist/spin/SpinController.d.ts +2 -0
  37. package/dist/spin/SpinController.d.ts.map +1 -1
  38. package/dist/symbols/CardSymbol.d.ts +1 -0
  39. package/dist/symbols/CardSymbol.d.ts.map +1 -1
  40. package/dist/testing.cjs +1 -1
  41. package/dist/testing.js +1 -1
  42. package/package.json +2 -2
  43. package/dist/debug-DckAC5l6.js.map +0 -1
  44. package/dist/debug-Dfk92N1O.cjs +0 -4
  45. package/dist/debug-Dfk92N1O.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # pixi-reels
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Add: `attachReelSounds(reelSet, port, cues)` snaps a table of sound cues onto a reel set's events: a `spin` loop from `spin:start` to `spin:allLanded`, a `reelStop` one-shot per landing reel, an `anticipation` loop per teasing reel with a pitch that can climb by `order`, `skip`, `win`, `cascadeDestroy`, and `on` for any other event. `attachBoardSounds(board, port, cues)` is the same table over a Hold & Win board (`featureEnter`, `respinStart`, `cellLanded` with the cell and whether it hit, `coinLocked`, `boardFull`, `featureEnd`, `on`). A cue can wait `delay` seconds after its beat (a thud timed to the bottom of the landing bounce). Every cue sees the active `speed`, its `profile`, and the spin's `mode` (`reelSet.spinMode`, new: `'standard'` or `'cascade'`) and can stay quiet with `when(ctx)`. Loops fade in and out; `destroy()` detaches and stops everything. `zvukPort(engine)` adapts a `@schmooky/zvuk` engine (sounds or variants by name, a missing name warns once) with no dependency on zvuk.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Change: the default Hold & Win landing wave steps 110 ms per cell instead of 70, so a board lands as a readable wave rather than a near-simultaneous drop. Boards that set their own `stagger` or `speeds` are unaffected.
12
+
13
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: `CARD_DECK` entries carry an optional `textColor`, so a deck spread together with `WILD_CARD` reads `card.textColor` without a type error.
14
+
15
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: the `hud` layer of `debugOverlay` no longer covers the reels. Its per-reel plaque now sits above the mask (and above the buffer cells and feed markers drawn there) instead of inside its top-left corner, so it grows the reel set's bounds the way the `metrics` and `timeline` panels below it do: fit your camera after turning it on.
16
+
17
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Change: the built-in speed presets land with a short, firm bounce instead of a long spring. NORMAL overshoots 22 px over 220 ms (was 56 px over 600 ms), TURBO 14 px over 140 ms (was 42 over 200), SUPER_TURBO 8 px over 90 ms (was 14 over 120). A custom profile keeps whatever it sets.
18
+
19
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: `zvukPort` loops crossfade 30 ms at their seam, so an encoded loop that does not end on a zero crossing, or an AAC loop with a padded tail, no longer clicks or gaps each time it wraps. `ZvukPlayOptions` gains `loopCrossfade`.
20
+
21
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: a `runCascade()`, `refill()` or `expand()` that settled after its reel set was destroyed threw `this._events.off is not a function` instead of resolving. `ReelSet` kept its typed bus in a field that shadowed the PixiJS Container's own listener store; it now lives under its own name, so `destroy()` no longer breaks that cleanup.
22
+
23
+ - [#278](https://github.com/schmooky/pixi-reels/pull/278) [`4f53570`](https://github.com/schmooky/pixi-reels/commit/4f5357030124c0866c0176d5661f8dfcb5513b6c) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Change: `DebugPlaque` plates, the metrics panel and the overlay's cell and block outlines draw square corners by default. `radius` on `DebugPlaque` still rounds a plate on request, and `'pill'` still makes a pill.
24
+
3
25
  ## 4.2.0
4
26
 
5
27
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"PhaseCardSymbol-Ct9bCE4I.cjs","names":[],"sources":["../src/symbols/CardSymbol.ts","../src/symbols/PhaseCardSymbol.ts"],"sourcesContent":["import { Graphics, Text } from 'pixi.js';\nimport { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * `CardSymbol` is a flat-rectangle-plus-centered-text `ReelSymbol` drawn\n * entirely with `PIXI.Graphics`. It exists to give recipes, demos, and\n * mechanic tests a no-asset, no-loader, infinitely-resizable visual that\n * always renders crisply at any cell size, showing how the engine treats\n * cell space across MultiWays reshapes, big-symbol blocks, and pyramid\n * layouts.\n *\n * In a real game, ship one of:\n *\n * - `SpriteSymbol` - pre-rendered art at one resolution. Cheapest.\n * - `AnimatedSpriteSymbol` - frame-by-frame win/idle animation.\n * - `SpineSymbol` (via `pixi-reels/spine`) - vector skeletal animation\n * that scales without quality loss. Best for MultiWays where cells\n * resize across spins.\n * - Or a custom `ReelSymbol` subclass for game-specific visuals.\n *\n * Ships from the package so a prototype runs with no art at all. It is\n * deliberately plain `Graphics`: swap it for real art before you ship.\n *\n * ```ts\n * import { CardSymbol, CARD_DECK } from 'pixi-reels';\n *\n * builder.symbols((registry) => {\n * for (const card of CARD_DECK) {\n * registry.register(card.id, CardSymbol, { color: card.color, label: card.label });\n * }\n * });\n * ```\n */\nexport interface CardSymbolOptions {\n /** Hex fill color (e.g. `0xc0392b`). */\n color: number;\n /** Centered label text (e.g. `'A'`, `'10'`, `'WILD'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n}\n\nexport class CardSymbol extends ReelSymbol {\n protected _color: number;\n private _label: string;\n private _textColor: number;\n private _gfx: Graphics;\n private _text: Text;\n /** The win in flight: its timeline, its two fill calls and the promise to settle. */\n private _win: { tl: gsap.core.Timeline; calls: gsap.core.Tween[]; resolve: () => void } | null = null;\n\n constructor(opts: CardSymbolOptions) {\n super();\n this._color = opts.color;\n this._label = opts.label;\n this._textColor = opts.textColor ?? 0xffffff;\n this._gfx = new Graphics();\n this._text = new Text({\n text: this._label,\n style: {\n // Roboto Condensed if installed (the site loads it via @fontsource);\n // falls through to a system condensed sans-serif on plain pages.\n fontFamily:\n '\"Roboto Condensed\", \"Arial Narrow\", \"Helvetica Neue Condensed\", \"Liberation Sans Narrow\", system-ui, sans-serif',\n fontSize: 32,\n fontWeight: '700',\n fill: this._textColor,\n align: 'center',\n },\n });\n this._text.anchor.set(0.5);\n this.view.addChild(this._gfx);\n this.view.addChild(this._text);\n }\n\n protected onActivate(_symbolId: string): void {\n // No-op - this symbol's visual identity is set at construction.\n }\n\n protected onDeactivate(): void {\n // No-op - leave _gfx/_text in their last state until next activate.\n }\n\n async playWin(): Promise<void> {\n // A win already playing ends here, its promise settled, before this one starts.\n this._endWin();\n return new Promise((resolve) => {\n // Animate only the glyph - the card body stays put. Useful for big\n // symbols (the rectangle is the cell footprint) and any setting\n // where movement of the cell border is distracting (cascade refills,\n // MultiWays adjust). The text is anchored at (0.5, 0.5) so its\n // scale tween pivots about the centre.\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n const originalFill = this._textColor;\n const tl = this.gsap.timeline({\n onComplete: () => {\n this._win = null;\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = originalFill;\n resolve();\n },\n });\n tl.to(this._text.scale, { x: 1.4, y: 1.4, duration: 0.18, ease: 'back.out(2)' }, 0)\n .to(this._text, { rotation: -0.12, duration: 0.09, ease: 'sine.inOut' }, 0)\n .to(this._text, { rotation: 0.12, duration: 0.18, ease: 'sine.inOut' }, 0.09)\n .to(this._text, { rotation: 0, duration: 0.09, ease: 'sine.inOut' }, 0.27)\n .to(this._text.scale, { x: 1, y: 1, duration: 0.18, ease: 'power2.out' }, 0.32);\n // Glyph fill flashes warm gold mid-pulse - `Text.style.fill` isn't\n // a tweenable target on every Pixi version, so we set it discretely.\n const calls = [\n this.gsap.delayedCall(0.06, () => (this._text.style.fill = 0xffe168)),\n this.gsap.delayedCall(0.42, () => (this._text.style.fill = originalFill)),\n ];\n this._win = { tl, calls, resolve };\n });\n }\n\n stopAnimation(): void {\n this._endWin();\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = this._textColor;\n this._gfx.alpha = 1;\n }\n\n protected override onDestroy(): void {\n this._endWin();\n }\n\n /**\n * Kill the win in flight and settle its promise. Killing the glyph's tweens\n * alone would leave the timeline's `onComplete` and both fill calls armed,\n * and they would fire into a symbol that has since been recycled or\n * destroyed, with the `await playWin()` never settling.\n */\n private _endWin(): void {\n const win = this._win;\n if (!win) return;\n this._win = null;\n win.tl.kill();\n for (const call of win.calls) call.kill();\n win.resolve();\n }\n\n resize(width: number, height: number): void {\n this._gfx.clear();\n this._gfx.rect(0, 0, width, height).fill({ color: this._color });\n // Inner darker stroke so adjacent cells are visually separated even\n // when they share the same color.\n this._gfx.rect(1, 1, width - 2, height - 2).stroke({ color: 0x000000, width: 2, alpha: 0.25 });\n this._text.x = width / 2;\n this._text.y = height / 2;\n // Font size constrained by both height (~38%) and label width (so\n // multi-char labels like '10' or 'WILD' don't overflow narrow cells).\n // Smaller than half-cell to leave breathing room - looks less crowded.\n const labelLen = Math.max(1, this._label.length);\n const fitH = height * 0.38;\n // Roboto Condensed glyphs are narrower (~0.45 avg ratio) than serif fonts.\n const fitW = (width * 0.7) / (labelLen * 0.45);\n this._text.style.fontSize = Math.max(7, Math.floor(Math.min(fitH, fitW)));\n }\n}\n\n/**\n * Standard high-card deck for prototyping. Each card has its own color\n * so a full grid is visually unambiguous at a glance.\n */\nexport const CARD_DECK: ReadonlyArray<{ id: string; color: number; label: string }> = [\n { id: '7', color: 0xc0392b, label: '7' }, // crimson\n { id: '8', color: 0xe67e22, label: '8' }, // orange\n { id: '9', color: 0xf1c40f, label: '9' }, // amber\n { id: '10', color: 0x27ae60, label: '10' }, // green\n { id: 'J', color: 0x16a085, label: 'J' }, // teal\n { id: 'Q', color: 0x2980b9, label: 'Q' }, // blue\n { id: 'K', color: 0x8e44ad, label: 'K' }, // purple\n { id: 'A', color: 0x2c3e50, label: 'A' }, // navy\n];\n\n/** A pale-yellow `WILD` card for sticky/expanding-wild prototypes. */\nexport const WILD_CARD = {\n id: 'wild',\n color: 0xfff3a0,\n label: 'WILD',\n textColor: 0x6b5400,\n} as const;\n","import type { gsap } from 'gsap';\nimport type { EventEmitter } from '../events/EventEmitter.js';\nimport type { ReelEvents } from '../events/ReelEvents.js';\nimport { CardSymbol } from './CardSymbol.js';\nimport type { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * Fill per phase for {@link PhaseCardSymbol}. Keys are the names phases\n * register under (`'start'`, `'spin'`, `'anticipation'`, `'stop'`, the\n * cascade and MultiWays keys, and any custom key), plus `rest` (at rest,\n * the default) and `landed` (the beat between landing and rest). A phase\n * with no entry draws `other`.\n */\nexport const PHASE_CARD_COLORS: Readonly<Record<string, number>> = {\n rest: 0x4b5563,\n start: 0x38bdf8,\n spin: 0x2563eb,\n anticipation: 0xf59e0b,\n stop: 0x8b5cf6,\n landed: 0x22c55e,\n adjust: 0xec4899,\n 'cascade:fall': 0x0ea5e9,\n 'cascade:place': 0x14b8a6,\n 'cascade:dropIn': 0x06b6d4,\n other: 0x9ca3af,\n};\n\nexport interface PhaseCardSymbolOptions {\n /** Centered label text (e.g. `'A'`, `'10'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n /** Fills to override or add; unlisted phases keep {@link PHASE_CARD_COLORS}. */\n colors?: Partial<Record<string, number>>;\n /** How long the `landed` fill shows before the card rests, in ms. `0` rests at once. Default 350. */\n landedMs?: number;\n}\n\n/**\n * The slice of a `Reel` that {@link PhaseCardSymbol.watch} reads. Every\n * entry of `ReelSet.reels` satisfies it.\n */\nexport interface PhaseWatchedReel {\n readonly symbols: readonly ReelSymbol[];\n readonly events: EventEmitter<ReelEvents>;\n}\n\n/** The `landed` beat, in ms, when the options do not say. */\nconst DEFAULT_LANDED_MS = 350;\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * A {@link CardSymbol} that is grey at rest and takes the colour of whatever\n * phase its reel is running, so a spin can be read off the board: sky while\n * the reel accelerates, blue at full speed, amber through a tease, violet\n * while the stop spins the frame in, a green beat on landing, then grey\n * again. A slam shows as amber or blue going straight to green; a quicken\n * shows the violet in between.\n *\n * The card does not know its reel. Point a watcher at the reels once and it\n * paints every card on them from the reel's own `phase:enter`, `landed` and\n * `symbol:created` events, custom phases included:\n *\n * ```ts\n * import { PhaseCardSymbol } from 'pixi-reels';\n *\n * builder.symbols((r) => r.register('A', PhaseCardSymbol, { label: 'A' }));\n * const stop = PhaseCardSymbol.watch(reelSet.reels);\n * // ...later, before reelSet.destroy():\n * stop();\n * ```\n *\n * `setPhase()` is public, so anything else that knows the phase can drive a\n * card directly.\n */\nexport class PhaseCardSymbol extends CardSymbol {\n private readonly _colors: Record<string, number>;\n private readonly _landedMs: number;\n private _phase = 'rest';\n private _width = 0;\n private _height = 0;\n private _restCall: gsap.core.Tween | null = null;\n\n constructor(opts: PhaseCardSymbolOptions) {\n const colors: Record<string, number> = { ...PHASE_CARD_COLORS };\n for (const [phase, color] of Object.entries(opts.colors ?? {})) {\n if (color !== undefined) colors[phase] = color;\n }\n super({ color: colors.rest, label: opts.label, textColor: opts.textColor });\n this._colors = colors;\n this._landedMs = opts.landedMs ?? DEFAULT_LANDED_MS;\n }\n\n /** The phase the card currently shows: a phase name, `'landed'` or `'rest'`. */\n get phase(): string {\n return this._phase;\n }\n\n /**\n * Show `phase`. A phase with no colour of its own draws `other`. `'landed'`\n * shows its beat and then rests on its own; anything set in the meantime\n * cancels that.\n */\n setPhase(phase: string): void {\n this._cancelRest();\n this._phase = phase;\n this._color = this._colors[phase] ?? this._colors.other;\n if (this._width > 0) this.resize(this._width, this._height);\n if (phase === 'landed') {\n if (this._landedMs <= 0) {\n this.setPhase('rest');\n return;\n }\n this._restCall = this.gsap.delayedCall(this._landedMs / 1000, () => {\n this._restCall = null;\n this.setPhase('rest');\n });\n }\n }\n\n override resize(width: number, height: number): void {\n this._width = width;\n this._height = height;\n super.resize(width, height);\n }\n\n /**\n * Paint every {@link PhaseCardSymbol} on `reels` from the reels' own\n * events, for as long as the returned function has not been called. Other\n * symbol classes on the same reels are left alone. A card that arrives\n * mid-phase (a pool swap as the strip wraps) is painted on arrival.\n */\n static watch(reels: Iterable<PhaseWatchedReel>): () => void {\n const stops: Array<() => void> = [];\n for (const reel of reels) {\n // What a card created from now on should show. `rest` after a landing:\n // the landed beat is for the cards that landed, not for a swap-in.\n let current = 'rest';\n const paint = (symbol: ReelSymbol, phase: string): void => {\n if (symbol instanceof PhaseCardSymbol) symbol.setPhase(phase);\n };\n const paintAll = (phase: string): void => {\n for (const symbol of reel.symbols) paint(symbol, phase);\n };\n const onEnter = (name: string): void => {\n current = name;\n paintAll(name);\n };\n const onLanded = (): void => {\n current = 'rest';\n paintAll('landed');\n };\n const onCreated = (_id: string, stripIndex: number): void => {\n const symbol = reel.symbols[stripIndex];\n if (symbol) paint(symbol, current);\n };\n reel.events.on('phase:enter', onEnter);\n reel.events.on('landed', onLanded);\n reel.events.on('symbol:created', onCreated);\n stops.push(() => {\n reel.events.off('phase:enter', onEnter);\n reel.events.off('landed', onLanded);\n reel.events.off('symbol:created', onCreated);\n });\n }\n return () => {\n for (const stop of stops) stop();\n stops.length = 0;\n };\n }\n\n protected override onDeactivate(): void {\n // A pooled card must not carry a phase into whichever cell takes it next.\n this._cancelRest();\n this._phase = 'rest';\n this._color = this._colors.rest;\n super.onDeactivate();\n }\n\n protected override onDestroy(): void {\n this._cancelRest();\n super.onDestroy();\n }\n\n private _cancelRest(): void {\n if (this._restCall) {\n this._restCall.kill();\n this._restCall = null;\n }\n }\n}\n"],"mappings":"sEA4CA,IAAa,EAAb,cAAgC,EAAA,CAAW,CACzC,OACA,OACA,WACA,KACA,MAEA,KAAiG,KAEjG,YAAY,EAAyB,CACnC,MAAM,EACN,KAAK,OAAS,EAAK,MACnB,KAAK,OAAS,EAAK,MACnB,KAAK,WAAa,EAAK,WAAa,SACpC,KAAK,KAAO,IAAI,EAAA,SAChB,KAAK,MAAQ,IAAI,EAAA,KAAK,CACpB,KAAM,KAAK,OACX,MAAO,CAGL,WACE,kHACF,SAAU,GACV,WAAY,MACZ,KAAM,KAAK,WACX,MAAO,QACT,CACF,CAAC,EACD,KAAK,MAAM,OAAO,IAAI,EAAG,EACzB,KAAK,KAAK,SAAS,KAAK,IAAI,EAC5B,KAAK,KAAK,SAAS,KAAK,KAAK,CAC/B,CAEA,WAAqB,EAAyB,CAE9C,CAEA,cAA+B,CAE/B,CAEA,MAAM,SAAyB,CAG7B,OADA,KAAK,QAAQ,EACN,IAAI,QAAS,GAAY,CAM9B,KAAK,KAAK,aAAa,KAAK,KAAK,EACjC,KAAK,KAAK,aAAa,KAAK,MAAM,KAAK,EACvC,IAAM,EAAe,KAAK,WACpB,EAAK,KAAK,KAAK,SAAS,CAC5B,eAAkB,C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,EAAS,QAAQ,CACnB,EACM,GAAa,EAAa,IAA6B,CAC3D,IAAM,EAAS,EAAK,QAAQ,GACxB,GAAQ,EAAM,EAAQ,CAAO,CACnC,EACA,EAAK,OAAO,GAAG,cAAe,CAAO,EACrC,EAAK,OAAO,GAAG,SAAU,CAAQ,EACjC,EAAK,OAAO,GAAG,iBAAkB,CAAS,EAC1C,EAAM,SAAW,CACf,EAAK,OAAO,IAAI,cAAe,CAAO,EACtC,EAAK,OAAO,IAAI,SAAU,CAAQ,EAClC,EAAK,OAAO,IAAI,iBAAkB,CAAS,CAC7C,CAAC,CACH,CACA,UAAa,CACX,IAAK,IAAM,KAAQ,EAAO,EAAK,EAC/B,EAAM,OAAS,CACjB,CACF,CAEA,cAAwC,CAEtC,KAAK,YAAY,EACjB,KAAK,OAAS,OACd,KAAK,OAAS,KAAK,QAAQ,KAC3B,MAAM,aAAa,CACrB,CAEA,WAAqC,CACnC,KAAK,YAAY,EACjB,MAAM,UAAU,CAClB,CAEA,aAA4B,CAC1B,AAEE,KAAK,aADL,KAAK,UAAU,KAAK,EACH,KAErB,CACF"}
1
+ {"version":3,"file":"PhaseCardSymbol-Ct9bCE4I.cjs","names":[],"sources":["../src/symbols/CardSymbol.ts","../src/symbols/PhaseCardSymbol.ts"],"sourcesContent":["import { Graphics, Text } from 'pixi.js';\nimport { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * `CardSymbol` is a flat-rectangle-plus-centered-text `ReelSymbol` drawn\n * entirely with `PIXI.Graphics`. It exists to give recipes, demos, and\n * mechanic tests a no-asset, no-loader, infinitely-resizable visual that\n * always renders crisply at any cell size, showing how the engine treats\n * cell space across MultiWays reshapes, big-symbol blocks, and pyramid\n * layouts.\n *\n * In a real game, ship one of:\n *\n * - `SpriteSymbol` - pre-rendered art at one resolution. Cheapest.\n * - `AnimatedSpriteSymbol` - frame-by-frame win/idle animation.\n * - `SpineSymbol` (via `pixi-reels/spine`) - vector skeletal animation\n * that scales without quality loss. Best for MultiWays where cells\n * resize across spins.\n * - Or a custom `ReelSymbol` subclass for game-specific visuals.\n *\n * Ships from the package so a prototype runs with no art at all. It is\n * deliberately plain `Graphics`: swap it for real art before you ship.\n *\n * ```ts\n * import { CardSymbol, CARD_DECK } from 'pixi-reels';\n *\n * builder.symbols((registry) => {\n * for (const card of CARD_DECK) {\n * registry.register(card.id, CardSymbol, { color: card.color, label: card.label });\n * }\n * });\n * ```\n */\nexport interface CardSymbolOptions {\n /** Hex fill color (e.g. `0xc0392b`). */\n color: number;\n /** Centered label text (e.g. `'A'`, `'10'`, `'WILD'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n}\n\nexport class CardSymbol extends ReelSymbol {\n protected _color: number;\n private _label: string;\n private _textColor: number;\n private _gfx: Graphics;\n private _text: Text;\n /** The win in flight: its timeline, its two fill calls and the promise to settle. */\n private _win: { tl: gsap.core.Timeline; calls: gsap.core.Tween[]; resolve: () => void } | null = null;\n\n constructor(opts: CardSymbolOptions) {\n super();\n this._color = opts.color;\n this._label = opts.label;\n this._textColor = opts.textColor ?? 0xffffff;\n this._gfx = new Graphics();\n this._text = new Text({\n text: this._label,\n style: {\n // Roboto Condensed if installed (the site loads it via @fontsource);\n // falls through to a system condensed sans-serif on plain pages.\n fontFamily:\n '\"Roboto Condensed\", \"Arial Narrow\", \"Helvetica Neue Condensed\", \"Liberation Sans Narrow\", system-ui, sans-serif',\n fontSize: 32,\n fontWeight: '700',\n fill: this._textColor,\n align: 'center',\n },\n });\n this._text.anchor.set(0.5);\n this.view.addChild(this._gfx);\n this.view.addChild(this._text);\n }\n\n protected onActivate(_symbolId: string): void {\n // No-op - this symbol's visual identity is set at construction.\n }\n\n protected onDeactivate(): void {\n // No-op - leave _gfx/_text in their last state until next activate.\n }\n\n async playWin(): Promise<void> {\n // A win already playing ends here, its promise settled, before this one starts.\n this._endWin();\n return new Promise((resolve) => {\n // Animate only the glyph - the card body stays put. Useful for big\n // symbols (the rectangle is the cell footprint) and any setting\n // where movement of the cell border is distracting (cascade refills,\n // MultiWays adjust). The text is anchored at (0.5, 0.5) so its\n // scale tween pivots about the centre.\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n const originalFill = this._textColor;\n const tl = this.gsap.timeline({\n onComplete: () => {\n this._win = null;\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = originalFill;\n resolve();\n },\n });\n tl.to(this._text.scale, { x: 1.4, y: 1.4, duration: 0.18, ease: 'back.out(2)' }, 0)\n .to(this._text, { rotation: -0.12, duration: 0.09, ease: 'sine.inOut' }, 0)\n .to(this._text, { rotation: 0.12, duration: 0.18, ease: 'sine.inOut' }, 0.09)\n .to(this._text, { rotation: 0, duration: 0.09, ease: 'sine.inOut' }, 0.27)\n .to(this._text.scale, { x: 1, y: 1, duration: 0.18, ease: 'power2.out' }, 0.32);\n // Glyph fill flashes warm gold mid-pulse - `Text.style.fill` isn't\n // a tweenable target on every Pixi version, so we set it discretely.\n const calls = [\n this.gsap.delayedCall(0.06, () => (this._text.style.fill = 0xffe168)),\n this.gsap.delayedCall(0.42, () => (this._text.style.fill = originalFill)),\n ];\n this._win = { tl, calls, resolve };\n });\n }\n\n stopAnimation(): void {\n this._endWin();\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = this._textColor;\n this._gfx.alpha = 1;\n }\n\n protected override onDestroy(): void {\n this._endWin();\n }\n\n /**\n * Kill the win in flight and settle its promise. Killing the glyph's tweens\n * alone would leave the timeline's `onComplete` and both fill calls armed,\n * and they would fire into a symbol that has since been recycled or\n * destroyed, with the `await playWin()` never settling.\n */\n private _endWin(): void {\n const win = this._win;\n if (!win) return;\n this._win = null;\n win.tl.kill();\n for (const call of win.calls) call.kill();\n win.resolve();\n }\n\n resize(width: number, height: number): void {\n this._gfx.clear();\n this._gfx.rect(0, 0, width, height).fill({ color: this._color });\n // Inner darker stroke so adjacent cells are visually separated even\n // when they share the same color.\n this._gfx.rect(1, 1, width - 2, height - 2).stroke({ color: 0x000000, width: 2, alpha: 0.25 });\n this._text.x = width / 2;\n this._text.y = height / 2;\n // Font size constrained by both height (~38%) and label width (so\n // multi-char labels like '10' or 'WILD' don't overflow narrow cells).\n // Smaller than half-cell to leave breathing room - looks less crowded.\n const labelLen = Math.max(1, this._label.length);\n const fitH = height * 0.38;\n // Roboto Condensed glyphs are narrower (~0.45 avg ratio) than serif fonts.\n const fitW = (width * 0.7) / (labelLen * 0.45);\n this._text.style.fontSize = Math.max(7, Math.floor(Math.min(fitH, fitW)));\n }\n}\n\n/**\n * Standard high-card deck for prototyping. Each card has its own color\n * so a full grid is visually unambiguous at a glance.\n */\nexport const CARD_DECK: ReadonlyArray<{ id: string; color: number; label: string; textColor?: number }> = [\n { id: '7', color: 0xc0392b, label: '7' }, // crimson\n { id: '8', color: 0xe67e22, label: '8' }, // orange\n { id: '9', color: 0xf1c40f, label: '9' }, // amber\n { id: '10', color: 0x27ae60, label: '10' }, // green\n { id: 'J', color: 0x16a085, label: 'J' }, // teal\n { id: 'Q', color: 0x2980b9, label: 'Q' }, // blue\n { id: 'K', color: 0x8e44ad, label: 'K' }, // purple\n { id: 'A', color: 0x2c3e50, label: 'A' }, // navy\n];\n\n/** A pale-yellow `WILD` card for sticky/expanding-wild prototypes. */\nexport const WILD_CARD = {\n id: 'wild',\n color: 0xfff3a0,\n label: 'WILD',\n textColor: 0x6b5400,\n} as const;\n","import type { gsap } from 'gsap';\nimport type { EventEmitter } from '../events/EventEmitter.js';\nimport type { ReelEvents } from '../events/ReelEvents.js';\nimport { CardSymbol } from './CardSymbol.js';\nimport type { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * Fill per phase for {@link PhaseCardSymbol}. Keys are the names phases\n * register under (`'start'`, `'spin'`, `'anticipation'`, `'stop'`, the\n * cascade and MultiWays keys, and any custom key), plus `rest` (at rest,\n * the default) and `landed` (the beat between landing and rest). A phase\n * with no entry draws `other`.\n */\nexport const PHASE_CARD_COLORS: Readonly<Record<string, number>> = {\n rest: 0x4b5563,\n start: 0x38bdf8,\n spin: 0x2563eb,\n anticipation: 0xf59e0b,\n stop: 0x8b5cf6,\n landed: 0x22c55e,\n adjust: 0xec4899,\n 'cascade:fall': 0x0ea5e9,\n 'cascade:place': 0x14b8a6,\n 'cascade:dropIn': 0x06b6d4,\n other: 0x9ca3af,\n};\n\nexport interface PhaseCardSymbolOptions {\n /** Centered label text (e.g. `'A'`, `'10'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n /** Fills to override or add; unlisted phases keep {@link PHASE_CARD_COLORS}. */\n colors?: Partial<Record<string, number>>;\n /** How long the `landed` fill shows before the card rests, in ms. `0` rests at once. Default 350. */\n landedMs?: number;\n}\n\n/**\n * The slice of a `Reel` that {@link PhaseCardSymbol.watch} reads. Every\n * entry of `ReelSet.reels` satisfies it.\n */\nexport interface PhaseWatchedReel {\n readonly symbols: readonly ReelSymbol[];\n readonly events: EventEmitter<ReelEvents>;\n}\n\n/** The `landed` beat, in ms, when the options do not say. */\nconst DEFAULT_LANDED_MS = 350;\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * A {@link CardSymbol} that is grey at rest and takes the colour of whatever\n * phase its reel is running, so a spin can be read off the board: sky while\n * the reel accelerates, blue at full speed, amber through a tease, violet\n * while the stop spins the frame in, a green beat on landing, then grey\n * again. A slam shows as amber or blue going straight to green; a quicken\n * shows the violet in between.\n *\n * The card does not know its reel. Point a watcher at the reels once and it\n * paints every card on them from the reel's own `phase:enter`, `landed` and\n * `symbol:created` events, custom phases included:\n *\n * ```ts\n * import { PhaseCardSymbol } from 'pixi-reels';\n *\n * builder.symbols((r) => r.register('A', PhaseCardSymbol, { label: 'A' }));\n * const stop = PhaseCardSymbol.watch(reelSet.reels);\n * // ...later, before reelSet.destroy():\n * stop();\n * ```\n *\n * `setPhase()` is public, so anything else that knows the phase can drive a\n * card directly.\n */\nexport class PhaseCardSymbol extends CardSymbol {\n private readonly _colors: Record<string, number>;\n private readonly _landedMs: number;\n private _phase = 'rest';\n private _width = 0;\n private _height = 0;\n private _restCall: gsap.core.Tween | null = null;\n\n constructor(opts: PhaseCardSymbolOptions) {\n const colors: Record<string, number> = { ...PHASE_CARD_COLORS };\n for (const [phase, color] of Object.entries(opts.colors ?? {})) {\n if (color !== undefined) colors[phase] = color;\n }\n super({ color: colors.rest, label: opts.label, textColor: opts.textColor });\n this._colors = colors;\n this._landedMs = opts.landedMs ?? DEFAULT_LANDED_MS;\n }\n\n /** The phase the card currently shows: a phase name, `'landed'` or `'rest'`. */\n get phase(): string {\n return this._phase;\n }\n\n /**\n * Show `phase`. A phase with no colour of its own draws `other`. `'landed'`\n * shows its beat and then rests on its own; anything set in the meantime\n * cancels that.\n */\n setPhase(phase: string): void {\n this._cancelRest();\n this._phase = phase;\n this._color = this._colors[phase] ?? this._colors.other;\n if (this._width > 0) this.resize(this._width, this._height);\n if (phase === 'landed') {\n if (this._landedMs <= 0) {\n this.setPhase('rest');\n return;\n }\n this._restCall = this.gsap.delayedCall(this._landedMs / 1000, () => {\n this._restCall = null;\n this.setPhase('rest');\n });\n }\n }\n\n override resize(width: number, height: number): void {\n this._width = width;\n this._height = height;\n super.resize(width, height);\n }\n\n /**\n * Paint every {@link PhaseCardSymbol} on `reels` from the reels' own\n * events, for as long as the returned function has not been called. Other\n * symbol classes on the same reels are left alone. A card that arrives\n * mid-phase (a pool swap as the strip wraps) is painted on arrival.\n */\n static watch(reels: Iterable<PhaseWatchedReel>): () => void {\n const stops: Array<() => void> = [];\n for (const reel of reels) {\n // What a card created from now on should show. `rest` after a landing:\n // the landed beat is for the cards that landed, not for a swap-in.\n let current = 'rest';\n const paint = (symbol: ReelSymbol, phase: string): void => {\n if (symbol instanceof PhaseCardSymbol) symbol.setPhase(phase);\n };\n const paintAll = (phase: string): void => {\n for (const symbol of reel.symbols) paint(symbol, phase);\n };\n const onEnter = (name: string): void => {\n current = name;\n paintAll(name);\n };\n const onLanded = (): void => {\n current = 'rest';\n paintAll('landed');\n };\n const onCreated = (_id: string, stripIndex: number): void => {\n const symbol = reel.symbols[stripIndex];\n if (symbol) paint(symbol, current);\n };\n reel.events.on('phase:enter', onEnter);\n reel.events.on('landed', onLanded);\n reel.events.on('symbol:created', onCreated);\n stops.push(() => {\n reel.events.off('phase:enter', onEnter);\n reel.events.off('landed', onLanded);\n reel.events.off('symbol:created', onCreated);\n });\n }\n return () => {\n for (const stop of stops) stop();\n stops.length = 0;\n };\n }\n\n protected override onDeactivate(): void {\n // A pooled card must not carry a phase into whichever cell takes it next.\n this._cancelRest();\n this._phase = 'rest';\n this._color = this._colors.rest;\n super.onDeactivate();\n }\n\n protected override onDestroy(): void {\n this._cancelRest();\n super.onDestroy();\n }\n\n private _cancelRest(): void {\n if (this._restCall) {\n this._restCall.kill();\n this._restCall = null;\n }\n }\n}\n"],"mappings":"sEA4CA,IAAa,EAAb,cAAgC,EAAA,CAAW,CACzC,OACA,OACA,WACA,KACA,MAEA,KAAiG,KAEjG,YAAY,EAAyB,CACnC,MAAM,EACN,KAAK,OAAS,EAAK,MACnB,KAAK,OAAS,EAAK,MACnB,KAAK,WAAa,EAAK,WAAa,SACpC,KAAK,KAAO,IAAI,EAAA,SAChB,KAAK,MAAQ,IAAI,EAAA,KAAK,CACpB,KAAM,KAAK,OACX,MAAO,CAGL,WACE,kHACF,SAAU,GACV,WAAY,MACZ,KAAM,KAAK,WACX,MAAO,QACT,CACF,CAAC,EACD,KAAK,MAAM,OAAO,IAAI,EAAG,EACzB,KAAK,KAAK,SAAS,KAAK,IAAI,EAC5B,KAAK,KAAK,SAAS,KAAK,KAAK,CAC/B,CAEA,WAAqB,EAAyB,CAE9C,CAEA,cAA+B,CAE/B,CAEA,MAAM,SAAyB,CAG7B,OADA,KAAK,QAAQ,EACN,IAAI,QAAS,GAAY,CAM9B,KAAK,KAAK,aAAa,KAAK,KAAK,EACj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S,EAAM,EAAQ,CAAK,CACxD,EACM,EAAW,GAAuB,CACtC,EAAU,EACV,EAAS,CAAI,CACf,EACM,MAAuB,CAC3B,EAAU,OACV,EAAS,QAAQ,CACnB,EACM,GAAa,EAAa,IAA6B,CAC3D,IAAM,EAAS,EAAK,QAAQ,GACxB,GAAQ,EAAM,EAAQ,CAAO,CACnC,EACA,EAAK,OAAO,GAAG,cAAe,CAAO,EACrC,EAAK,OAAO,GAAG,SAAU,CAAQ,EACjC,EAAK,OAAO,GAAG,iBAAkB,CAAS,EAC1C,EAAM,SAAW,CACf,EAAK,OAAO,IAAI,cAAe,CAAO,EACtC,EAAK,OAAO,IAAI,SAAU,CAAQ,EAClC,EAAK,OAAO,IAAI,iBAAkB,CAAS,CAC7C,CAAC,CACH,CACA,UAAa,CACX,IAAK,IAAM,KAAQ,EAAO,EAAK,EAC/B,EAAM,OAAS,CACjB,CACF,CAEA,cAAwC,CAEtC,KAAK,YAAY,EACjB,KAAK,OAAS,OACd,KAAK,OAAS,KAAK,QAAQ,KAC3B,MAAM,aAAa,CACrB,CAEA,WAAqC,CACnC,KAAK,YAAY,EACjB,MAAM,UAAU,CAClB,CAEA,aAA4B,CAC1B,AAEE,KAAK,aADL,KAAK,UAAU,KAAK,EACH,KAErB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"PhaseCardSymbol-bVa7GpDn.js","names":[],"sources":["../src/symbols/CardSymbol.ts","../src/symbols/PhaseCardSymbol.ts"],"sourcesContent":["import { Graphics, Text } from 'pixi.js';\nimport { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * `CardSymbol` is a flat-rectangle-plus-centered-text `ReelSymbol` drawn\n * entirely with `PIXI.Graphics`. It exists to give recipes, demos, and\n * mechanic tests a no-asset, no-loader, infinitely-resizable visual that\n * always renders crisply at any cell size, showing how the engine treats\n * cell space across MultiWays reshapes, big-symbol blocks, and pyramid\n * layouts.\n *\n * In a real game, ship one of:\n *\n * - `SpriteSymbol` - pre-rendered art at one resolution. Cheapest.\n * - `AnimatedSpriteSymbol` - frame-by-frame win/idle animation.\n * - `SpineSymbol` (via `pixi-reels/spine`) - vector skeletal animation\n * that scales without quality loss. Best for MultiWays where cells\n * resize across spins.\n * - Or a custom `ReelSymbol` subclass for game-specific visuals.\n *\n * Ships from the package so a prototype runs with no art at all. It is\n * deliberately plain `Graphics`: swap it for real art before you ship.\n *\n * ```ts\n * import { CardSymbol, CARD_DECK } from 'pixi-reels';\n *\n * builder.symbols((registry) => {\n * for (const card of CARD_DECK) {\n * registry.register(card.id, CardSymbol, { color: card.color, label: card.label });\n * }\n * });\n * ```\n */\nexport interface CardSymbolOptions {\n /** Hex fill color (e.g. `0xc0392b`). */\n color: number;\n /** Centered label text (e.g. `'A'`, `'10'`, `'WILD'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n}\n\nexport class CardSymbol extends ReelSymbol {\n protected _color: number;\n private _label: string;\n private _textColor: number;\n private _gfx: Graphics;\n private _text: Text;\n /** The win in flight: its timeline, its two fill calls and the promise to settle. */\n private _win: { tl: gsap.core.Timeline; calls: gsap.core.Tween[]; resolve: () => void } | null = null;\n\n constructor(opts: CardSymbolOptions) {\n super();\n this._color = opts.color;\n this._label = opts.label;\n this._textColor = opts.textColor ?? 0xffffff;\n this._gfx = new Graphics();\n this._text = new Text({\n text: this._label,\n style: {\n // Roboto Condensed if installed (the site loads it via @fontsource);\n // falls through to a system condensed sans-serif on plain pages.\n fontFamily:\n '\"Roboto Condensed\", \"Arial Narrow\", \"Helvetica Neue Condensed\", \"Liberation Sans Narrow\", system-ui, sans-serif',\n fontSize: 32,\n fontWeight: '700',\n fill: this._textColor,\n align: 'center',\n },\n });\n this._text.anchor.set(0.5);\n this.view.addChild(this._gfx);\n this.view.addChild(this._text);\n }\n\n protected onActivate(_symbolId: string): void {\n // No-op - this symbol's visual identity is set at construction.\n }\n\n protected onDeactivate(): void {\n // No-op - leave _gfx/_text in their last state until next activate.\n }\n\n async playWin(): Promise<void> {\n // A win already playing ends here, its promise settled, before this one starts.\n this._endWin();\n return new Promise((resolve) => {\n // Animate only the glyph - the card body stays put. Useful for big\n // symbols (the rectangle is the cell footprint) and any setting\n // where movement of the cell border is distracting (cascade refills,\n // MultiWays adjust). The text is anchored at (0.5, 0.5) so its\n // scale tween pivots about the centre.\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n const originalFill = this._textColor;\n const tl = this.gsap.timeline({\n onComplete: () => {\n this._win = null;\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = originalFill;\n resolve();\n },\n });\n tl.to(this._text.scale, { x: 1.4, y: 1.4, duration: 0.18, ease: 'back.out(2)' }, 0)\n .to(this._text, { rotation: -0.12, duration: 0.09, ease: 'sine.inOut' }, 0)\n .to(this._text, { rotation: 0.12, duration: 0.18, ease: 'sine.inOut' }, 0.09)\n .to(this._text, { rotation: 0, duration: 0.09, ease: 'sine.inOut' }, 0.27)\n .to(this._text.scale, { x: 1, y: 1, duration: 0.18, ease: 'power2.out' }, 0.32);\n // Glyph fill flashes warm gold mid-pulse - `Text.style.fill` isn't\n // a tweenable target on every Pixi version, so we set it discretely.\n const calls = [\n this.gsap.delayedCall(0.06, () => (this._text.style.fill = 0xffe168)),\n this.gsap.delayedCall(0.42, () => (this._text.style.fill = originalFill)),\n ];\n this._win = { tl, calls, resolve };\n });\n }\n\n stopAnimation(): void {\n this._endWin();\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = this._textColor;\n this._gfx.alpha = 1;\n }\n\n protected override onDestroy(): void {\n this._endWin();\n }\n\n /**\n * Kill the win in flight and settle its promise. Killing the glyph's tweens\n * alone would leave the timeline's `onComplete` and both fill calls armed,\n * and they would fire into a symbol that has since been recycled or\n * destroyed, with the `await playWin()` never settling.\n */\n private _endWin(): void {\n const win = this._win;\n if (!win) return;\n this._win = null;\n win.tl.kill();\n for (const call of win.calls) call.kill();\n win.resolve();\n }\n\n resize(width: number, height: number): void {\n this._gfx.clear();\n this._gfx.rect(0, 0, width, height).fill({ color: this._color });\n // Inner darker stroke so adjacent cells are visually separated even\n // when they share the same color.\n this._gfx.rect(1, 1, width - 2, height - 2).stroke({ color: 0x000000, width: 2, alpha: 0.25 });\n this._text.x = width / 2;\n this._text.y = height / 2;\n // Font size constrained by both height (~38%) and label width (so\n // multi-char labels like '10' or 'WILD' don't overflow narrow cells).\n // Smaller than half-cell to leave breathing room - looks less crowded.\n const labelLen = Math.max(1, this._label.length);\n const fitH = height * 0.38;\n // Roboto Condensed glyphs are narrower (~0.45 avg ratio) than serif fonts.\n const fitW = (width * 0.7) / (labelLen * 0.45);\n this._text.style.fontSize = Math.max(7, Math.floor(Math.min(fitH, fitW)));\n }\n}\n\n/**\n * Standard high-card deck for prototyping. Each card has its own color\n * so a full grid is visually unambiguous at a glance.\n */\nexport const CARD_DECK: ReadonlyArray<{ id: string; color: number; label: string }> = [\n { id: '7', color: 0xc0392b, label: '7' }, // crimson\n { id: '8', color: 0xe67e22, label: '8' }, // orange\n { id: '9', color: 0xf1c40f, label: '9' }, // amber\n { id: '10', color: 0x27ae60, label: '10' }, // green\n { id: 'J', color: 0x16a085, label: 'J' }, // teal\n { id: 'Q', color: 0x2980b9, label: 'Q' }, // blue\n { id: 'K', color: 0x8e44ad, label: 'K' }, // purple\n { id: 'A', color: 0x2c3e50, label: 'A' }, // navy\n];\n\n/** A pale-yellow `WILD` card for sticky/expanding-wild prototypes. */\nexport const WILD_CARD = {\n id: 'wild',\n color: 0xfff3a0,\n label: 'WILD',\n textColor: 0x6b5400,\n} as const;\n","import type { gsap } from 'gsap';\nimport type { EventEmitter } from '../events/EventEmitter.js';\nimport type { ReelEvents } from '../events/ReelEvents.js';\nimport { CardSymbol } from './CardSymbol.js';\nimport type { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * Fill per phase for {@link PhaseCardSymbol}. Keys are the names phases\n * register under (`'start'`, `'spin'`, `'anticipation'`, `'stop'`, the\n * cascade and MultiWays keys, and any custom key), plus `rest` (at rest,\n * the default) and `landed` (the beat between landing and rest). A phase\n * with no entry draws `other`.\n */\nexport const PHASE_CARD_COLORS: Readonly<Record<string, number>> = {\n rest: 0x4b5563,\n start: 0x38bdf8,\n spin: 0x2563eb,\n anticipation: 0xf59e0b,\n stop: 0x8b5cf6,\n landed: 0x22c55e,\n adjust: 0xec4899,\n 'cascade:fall': 0x0ea5e9,\n 'cascade:place': 0x14b8a6,\n 'cascade:dropIn': 0x06b6d4,\n other: 0x9ca3af,\n};\n\nexport interface PhaseCardSymbolOptions {\n /** Centered label text (e.g. `'A'`, `'10'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n /** Fills to override or add; unlisted phases keep {@link PHASE_CARD_COLORS}. */\n colors?: Partial<Record<string, number>>;\n /** How long the `landed` fill shows before the card rests, in ms. `0` rests at once. Default 350. */\n landedMs?: number;\n}\n\n/**\n * The slice of a `Reel` that {@link PhaseCardSymbol.watch} reads. Every\n * entry of `ReelSet.reels` satisfies it.\n */\nexport interface PhaseWatchedReel {\n readonly symbols: readonly ReelSymbol[];\n readonly events: EventEmitter<ReelEvents>;\n}\n\n/** The `landed` beat, in ms, when the options do not say. */\nconst DEFAULT_LANDED_MS = 350;\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * A {@link CardSymbol} that is grey at rest and takes the colour of whatever\n * phase its reel is running, so a spin can be read off the board: sky while\n * the reel accelerates, blue at full speed, amber through a tease, violet\n * while the stop spins the frame in, a green beat on landing, then grey\n * again. A slam shows as amber or blue going straight to green; a quicken\n * shows the violet in between.\n *\n * The card does not know its reel. Point a watcher at the reels once and it\n * paints every card on them from the reel's own `phase:enter`, `landed` and\n * `symbol:created` events, custom phases included:\n *\n * ```ts\n * import { PhaseCardSymbol } from 'pixi-reels';\n *\n * builder.symbols((r) => r.register('A', PhaseCardSymbol, { label: 'A' }));\n * const stop = PhaseCardSymbol.watch(reelSet.reels);\n * // ...later, before reelSet.destroy():\n * stop();\n * ```\n *\n * `setPhase()` is public, so anything else that knows the phase can drive a\n * card directly.\n */\nexport class PhaseCardSymbol extends CardSymbol {\n private readonly _colors: Record<string, number>;\n private readonly _landedMs: number;\n private _phase = 'rest';\n private _width = 0;\n private _height = 0;\n private _restCall: gsap.core.Tween | null = null;\n\n constructor(opts: PhaseCardSymbolOptions) {\n const colors: Record<string, number> = { ...PHASE_CARD_COLORS };\n for (const [phase, color] of Object.entries(opts.colors ?? {})) {\n if (color !== undefined) colors[phase] = color;\n }\n super({ color: colors.rest, label: opts.label, textColor: opts.textColor });\n this._colors = colors;\n this._landedMs = opts.landedMs ?? DEFAULT_LANDED_MS;\n }\n\n /** The phase the card currently shows: a phase name, `'landed'` or `'rest'`. */\n get phase(): string {\n return this._phase;\n }\n\n /**\n * Show `phase`. A phase with no colour of its own draws `other`. `'landed'`\n * shows its beat and then rests on its own; anything set in the meantime\n * cancels that.\n */\n setPhase(phase: string): void {\n this._cancelRest();\n this._phase = phase;\n this._color = this._colors[phase] ?? this._colors.other;\n if (this._width > 0) this.resize(this._width, this._height);\n if (phase === 'landed') {\n if (this._landedMs <= 0) {\n this.setPhase('rest');\n return;\n }\n this._restCall = this.gsap.delayedCall(this._landedMs / 1000, () => {\n this._restCall = null;\n this.setPhase('rest');\n });\n }\n }\n\n override resize(width: number, height: number): void {\n this._width = width;\n this._height = height;\n super.resize(width, height);\n }\n\n /**\n * Paint every {@link PhaseCardSymbol} on `reels` from the reels' own\n * events, for as long as the returned function has not been called. Other\n * symbol classes on the same reels are left alone. A card that arrives\n * mid-phase (a pool swap as the strip wraps) is painted on arrival.\n */\n static watch(reels: Iterable<PhaseWatchedReel>): () => void {\n const stops: Array<() => void> = [];\n for (const reel of reels) {\n // What a card created from now on should show. `rest` after a landing:\n // the landed beat is for the cards that landed, not for a swap-in.\n let current = 'rest';\n const paint = (symbol: ReelSymbol, phase: string): void => {\n if (symbol instanceof PhaseCardSymbol) symbol.setPhase(phase);\n };\n const paintAll = (phase: string): void => {\n for (const symbol of reel.symbols) paint(symbol, phase);\n };\n const onEnter = (name: string): void => {\n current = name;\n paintAll(name);\n };\n const onLanded = (): void => {\n current = 'rest';\n paintAll('landed');\n };\n const onCreated = (_id: string, stripIndex: number): void => {\n const symbol = reel.symbols[stripIndex];\n if (symbol) paint(symbol, current);\n };\n reel.events.on('phase:enter', onEnter);\n reel.events.on('landed', onLanded);\n reel.events.on('symbol:created', onCreated);\n stops.push(() => {\n reel.events.off('phase:enter', onEnter);\n reel.events.off('landed', onLanded);\n reel.events.off('symbol:created', onCreated);\n });\n }\n return () => {\n for (const stop of stops) stop();\n stops.length = 0;\n };\n }\n\n protected override onDeactivate(): void {\n // A pooled card must not carry a phase into whichever cell takes it next.\n this._cancelRest();\n this._phase = 'rest';\n this._color = this._colors.rest;\n super.onDeactivate();\n }\n\n protected override onDestroy(): void {\n this._cancelRest();\n super.onDestroy();\n }\n\n private _cancelRest(): void {\n if (this._restCall) {\n this._restCall.kill();\n this._restCall = null;\n }\n }\n}\n"],"mappings":";;;AA4CA,IAAa,IAAb,cAAgC,EAAW;CACzC;CACA;CACA;CACA;CACA;CAEA,OAAiG;CAEjG,YAAY,GAAyB;EAqBnC,AApBA,MAAM,GACN,KAAK,SAAS,EAAK,OACnB,KAAK,SAAS,EAAK,OACnB,KAAK,aAAa,EAAK,aAAa,UACpC,KAAK,OAAO,IAAI,EAAS,GACzB,KAAK,QAAQ,IAAI,EAAK;GACpB,MAAM,KAAK;GACX,OAAO;IAGL,YACE;IACF,UAAU;IACV,YAAY;IACZ,MAAM,KAAK;IACX,OAAO;GACT;EACF,CAAC,GACD,KAAK,MAAM,OAAO,IAAI,EAAG,GACzB,KAAK,KAAK,SAAS,KAAK,IAAI,GAC5B,KAAK,KAAK,SAAS,KAAK,KAAK;CAC/B;CAEA,WAAqB,GAAyB,CAE9C;CAEA,eAA+B,CAE/B;CA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M,KAAQ,GAAO;GAGxB,IAAI,IAAU,QACR,KAAS,GAAoB,MAAwB;IACzD,AAAI,aAAkB,KAAiB,EAAO,SAAS,CAAK;GAC9D,GACM,KAAY,MAAwB;IACxC,KAAK,IAAM,KAAU,EAAK,SAAS,EAAM,GAAQ,CAAK;GACxD,GACM,KAAW,MAAuB;IAEtC,AADA,IAAU,GACV,EAAS,CAAI;GACf,GACM,UAAuB;IAE3B,AADA,IAAU,QACV,EAAS,QAAQ;GACnB,GACM,KAAa,GAAa,MAA6B;IAC3D,IAAM,IAAS,EAAK,QAAQ;IAC5B,AAAI,KAAQ,EAAM,GAAQ,CAAO;GACnC;GAIA,AAHA,EAAK,OAAO,GAAG,eAAe,CAAO,GACrC,EAAK,OAAO,GAAG,UAAU,CAAQ,GACjC,EAAK,OAAO,GAAG,kBAAkB,CAAS,GAC1C,EAAM,WAAW;IAGf,AAFA,EAAK,OAAO,IAAI,eAAe,CAAO,GACtC,EAAK,OAAO,IAAI,UAAU,CAAQ,GAClC,EAAK,OAAO,IAAI,kBAAkB,CAAS;GAC7C,CAAC;EACH;EACA,aAAa;GACX,KAAK,IAAM,KAAQ,GAAO,EAAK;GAC/B,EAAM,SAAS;EACjB;CACF;CAEA,eAAwC;EAKtC,AAHA,KAAK,YAAY,GACjB,KAAK,SAAS,QACd,KAAK,SAAS,KAAK,QAAQ,MAC3B,MAAM,aAAa;CACrB;CAEA,YAAqC;EAEnC,AADA,KAAK,YAAY,GACjB,MAAM,UAAU;CAClB;CAEA,cAA4B;EAC1B,AAEE,KAAK,eADL,KAAK,UAAU,KAAK,GACH;CAErB;AACF"}
1
+ {"version":3,"file":"PhaseCardSymbol-bVa7GpDn.js","names":[],"sources":["../src/symbols/CardSymbol.ts","../src/symbols/PhaseCardSymbol.ts"],"sourcesContent":["import { Graphics, Text } from 'pixi.js';\nimport { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * `CardSymbol` is a flat-rectangle-plus-centered-text `ReelSymbol` drawn\n * entirely with `PIXI.Graphics`. It exists to give recipes, demos, and\n * mechanic tests a no-asset, no-loader, infinitely-resizable visual that\n * always renders crisply at any cell size, showing how the engine treats\n * cell space across MultiWays reshapes, big-symbol blocks, and pyramid\n * layouts.\n *\n * In a real game, ship one of:\n *\n * - `SpriteSymbol` - pre-rendered art at one resolution. Cheapest.\n * - `AnimatedSpriteSymbol` - frame-by-frame win/idle animation.\n * - `SpineSymbol` (via `pixi-reels/spine`) - vector skeletal animation\n * that scales without quality loss. Best for MultiWays where cells\n * resize across spins.\n * - Or a custom `ReelSymbol` subclass for game-specific visuals.\n *\n * Ships from the package so a prototype runs with no art at all. It is\n * deliberately plain `Graphics`: swap it for real art before you ship.\n *\n * ```ts\n * import { CardSymbol, CARD_DECK } from 'pixi-reels';\n *\n * builder.symbols((registry) => {\n * for (const card of CARD_DECK) {\n * registry.register(card.id, CardSymbol, { color: card.color, label: card.label });\n * }\n * });\n * ```\n */\nexport interface CardSymbolOptions {\n /** Hex fill color (e.g. `0xc0392b`). */\n color: number;\n /** Centered label text (e.g. `'A'`, `'10'`, `'WILD'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n}\n\nexport class CardSymbol extends ReelSymbol {\n protected _color: number;\n private _label: string;\n private _textColor: number;\n private _gfx: Graphics;\n private _text: Text;\n /** The win in flight: its timeline, its two fill calls and the promise to settle. */\n private _win: { tl: gsap.core.Timeline; calls: gsap.core.Tween[]; resolve: () => void } | null = null;\n\n constructor(opts: CardSymbolOptions) {\n super();\n this._color = opts.color;\n this._label = opts.label;\n this._textColor = opts.textColor ?? 0xffffff;\n this._gfx = new Graphics();\n this._text = new Text({\n text: this._label,\n style: {\n // Roboto Condensed if installed (the site loads it via @fontsource);\n // falls through to a system condensed sans-serif on plain pages.\n fontFamily:\n '\"Roboto Condensed\", \"Arial Narrow\", \"Helvetica Neue Condensed\", \"Liberation Sans Narrow\", system-ui, sans-serif',\n fontSize: 32,\n fontWeight: '700',\n fill: this._textColor,\n align: 'center',\n },\n });\n this._text.anchor.set(0.5);\n this.view.addChild(this._gfx);\n this.view.addChild(this._text);\n }\n\n protected onActivate(_symbolId: string): void {\n // No-op - this symbol's visual identity is set at construction.\n }\n\n protected onDeactivate(): void {\n // No-op - leave _gfx/_text in their last state until next activate.\n }\n\n async playWin(): Promise<void> {\n // A win already playing ends here, its promise settled, before this one starts.\n this._endWin();\n return new Promise((resolve) => {\n // Animate only the glyph - the card body stays put. Useful for big\n // symbols (the rectangle is the cell footprint) and any setting\n // where movement of the cell border is distracting (cascade refills,\n // MultiWays adjust). The text is anchored at (0.5, 0.5) so its\n // scale tween pivots about the centre.\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n const originalFill = this._textColor;\n const tl = this.gsap.timeline({\n onComplete: () => {\n this._win = null;\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = originalFill;\n resolve();\n },\n });\n tl.to(this._text.scale, { x: 1.4, y: 1.4, duration: 0.18, ease: 'back.out(2)' }, 0)\n .to(this._text, { rotation: -0.12, duration: 0.09, ease: 'sine.inOut' }, 0)\n .to(this._text, { rotation: 0.12, duration: 0.18, ease: 'sine.inOut' }, 0.09)\n .to(this._text, { rotation: 0, duration: 0.09, ease: 'sine.inOut' }, 0.27)\n .to(this._text.scale, { x: 1, y: 1, duration: 0.18, ease: 'power2.out' }, 0.32);\n // Glyph fill flashes warm gold mid-pulse - `Text.style.fill` isn't\n // a tweenable target on every Pixi version, so we set it discretely.\n const calls = [\n this.gsap.delayedCall(0.06, () => (this._text.style.fill = 0xffe168)),\n this.gsap.delayedCall(0.42, () => (this._text.style.fill = originalFill)),\n ];\n this._win = { tl, calls, resolve };\n });\n }\n\n stopAnimation(): void {\n this._endWin();\n this.gsap.killTweensOf(this._text);\n this.gsap.killTweensOf(this._text.scale);\n this._text.scale.set(1, 1);\n this._text.rotation = 0;\n this._text.style.fill = this._textColor;\n this._gfx.alpha = 1;\n }\n\n protected override onDestroy(): void {\n this._endWin();\n }\n\n /**\n * Kill the win in flight and settle its promise. Killing the glyph's tweens\n * alone would leave the timeline's `onComplete` and both fill calls armed,\n * and they would fire into a symbol that has since been recycled or\n * destroyed, with the `await playWin()` never settling.\n */\n private _endWin(): void {\n const win = this._win;\n if (!win) return;\n this._win = null;\n win.tl.kill();\n for (const call of win.calls) call.kill();\n win.resolve();\n }\n\n resize(width: number, height: number): void {\n this._gfx.clear();\n this._gfx.rect(0, 0, width, height).fill({ color: this._color });\n // Inner darker stroke so adjacent cells are visually separated even\n // when they share the same color.\n this._gfx.rect(1, 1, width - 2, height - 2).stroke({ color: 0x000000, width: 2, alpha: 0.25 });\n this._text.x = width / 2;\n this._text.y = height / 2;\n // Font size constrained by both height (~38%) and label width (so\n // multi-char labels like '10' or 'WILD' don't overflow narrow cells).\n // Smaller than half-cell to leave breathing room - looks less crowded.\n const labelLen = Math.max(1, this._label.length);\n const fitH = height * 0.38;\n // Roboto Condensed glyphs are narrower (~0.45 avg ratio) than serif fonts.\n const fitW = (width * 0.7) / (labelLen * 0.45);\n this._text.style.fontSize = Math.max(7, Math.floor(Math.min(fitH, fitW)));\n }\n}\n\n/**\n * Standard high-card deck for prototyping. Each card has its own color\n * so a full grid is visually unambiguous at a glance.\n */\nexport const CARD_DECK: ReadonlyArray<{ id: string; color: number; label: string; textColor?: number }> = [\n { id: '7', color: 0xc0392b, label: '7' }, // crimson\n { id: '8', color: 0xe67e22, label: '8' }, // orange\n { id: '9', color: 0xf1c40f, label: '9' }, // amber\n { id: '10', color: 0x27ae60, label: '10' }, // green\n { id: 'J', color: 0x16a085, label: 'J' }, // teal\n { id: 'Q', color: 0x2980b9, label: 'Q' }, // blue\n { id: 'K', color: 0x8e44ad, label: 'K' }, // purple\n { id: 'A', color: 0x2c3e50, label: 'A' }, // navy\n];\n\n/** A pale-yellow `WILD` card for sticky/expanding-wild prototypes. */\nexport const WILD_CARD = {\n id: 'wild',\n color: 0xfff3a0,\n label: 'WILD',\n textColor: 0x6b5400,\n} as const;\n","import type { gsap } from 'gsap';\nimport type { EventEmitter } from '../events/EventEmitter.js';\nimport type { ReelEvents } from '../events/ReelEvents.js';\nimport { CardSymbol } from './CardSymbol.js';\nimport type { ReelSymbol } from './ReelSymbol.js';\n\n/**\n * Fill per phase for {@link PhaseCardSymbol}. Keys are the names phases\n * register under (`'start'`, `'spin'`, `'anticipation'`, `'stop'`, the\n * cascade and MultiWays keys, and any custom key), plus `rest` (at rest,\n * the default) and `landed` (the beat between landing and rest). A phase\n * with no entry draws `other`.\n */\nexport const PHASE_CARD_COLORS: Readonly<Record<string, number>> = {\n rest: 0x4b5563,\n start: 0x38bdf8,\n spin: 0x2563eb,\n anticipation: 0xf59e0b,\n stop: 0x8b5cf6,\n landed: 0x22c55e,\n adjust: 0xec4899,\n 'cascade:fall': 0x0ea5e9,\n 'cascade:place': 0x14b8a6,\n 'cascade:dropIn': 0x06b6d4,\n other: 0x9ca3af,\n};\n\nexport interface PhaseCardSymbolOptions {\n /** Centered label text (e.g. `'A'`, `'10'`). */\n label: string;\n /** Text fill color. Defaults to white. */\n textColor?: number;\n /** Fills to override or add; unlisted phases keep {@link PHASE_CARD_COLORS}. */\n colors?: Partial<Record<string, number>>;\n /** How long the `landed` fill shows before the card rests, in ms. `0` rests at once. Default 350. */\n landedMs?: number;\n}\n\n/**\n * The slice of a `Reel` that {@link PhaseCardSymbol.watch} reads. Every\n * entry of `ReelSet.reels` satisfies it.\n */\nexport interface PhaseWatchedReel {\n readonly symbols: readonly ReelSymbol[];\n readonly events: EventEmitter<ReelEvents>;\n}\n\n/** The `landed` beat, in ms, when the options do not say. */\nconst DEFAULT_LANDED_MS = 350;\n\n/**\n * **Debug / prototyping symbol - NOT for production.**\n *\n * A {@link CardSymbol} that is grey at rest and takes the colour of whatever\n * phase its reel is running, so a spin can be read off the board: sky while\n * the reel accelerates, blue at full speed, amber through a tease, violet\n * while the stop spins the frame in, a green beat on landing, then grey\n * again. A slam shows as amber or blue going straight to green; a quicken\n * shows the violet in between.\n *\n * The card does not know its reel. Point a watcher at the reels once and it\n * paints every card on them from the reel's own `phase:enter`, `landed` and\n * `symbol:created` events, custom phases included:\n *\n * ```ts\n * import { PhaseCardSymbol } from 'pixi-reels';\n *\n * builder.symbols((r) => r.register('A', PhaseCardSymbol, { label: 'A' }));\n * const stop = PhaseCardSymbol.watch(reelSet.reels);\n * // ...later, before reelSet.destroy():\n * stop();\n * ```\n *\n * `setPhase()` is public, so anything else that knows the phase can drive a\n * card directly.\n */\nexport class PhaseCardSymbol extends CardSymbol {\n private readonly _colors: Record<string, number>;\n private readonly _landedMs: number;\n private _phase = 'rest';\n private _width = 0;\n private _height = 0;\n private _restCall: gsap.core.Tween | null = null;\n\n constructor(opts: PhaseCardSymbolOptions) {\n const colors: Record<string, number> = { ...PHASE_CARD_COLORS };\n for (const [phase, color] of Object.entries(opts.colors ?? {})) {\n if (color !== undefined) colors[phase] = color;\n }\n super({ color: colors.rest, label: opts.label, textColor: opts.textColor });\n this._colors = colors;\n this._landedMs = opts.landedMs ?? DEFAULT_LANDED_MS;\n }\n\n /** The phase the card currently shows: a phase name, `'landed'` or `'rest'`. */\n get phase(): string {\n return this._phase;\n }\n\n /**\n * Show `phase`. A phase with no colour of its own draws `other`. `'landed'`\n * shows its beat and then rests on its own; anything set in the meantime\n * cancels that.\n */\n setPhase(phase: string): void {\n this._cancelRest();\n this._phase = phase;\n this._color = this._colors[phase] ?? this._colors.other;\n if (this._width > 0) this.resize(this._width, this._height);\n if (phase === 'landed') {\n if (this._landedMs <= 0) {\n this.setPhase('rest');\n return;\n }\n this._restCall = this.gsap.delayedCall(this._landedMs / 1000, () => {\n this._restCall = null;\n this.setPhase('rest');\n });\n }\n }\n\n override resize(width: number, height: number): void {\n this._width = width;\n this._height = height;\n super.resize(width, height);\n }\n\n /**\n * Paint every {@link PhaseCardSymbol} on `reels` from the reels' own\n * events, for as long as the returned function has not been called. Other\n * symbol classes on the same reels are left alone. A card that arrives\n * mid-phase (a pool swap as the strip wraps) is painted on arrival.\n */\n static watch(reels: Iterable<PhaseWatchedReel>): () => void {\n const stops: Array<() => void> = [];\n for (const reel of reels) {\n // What a card created from now on should show. `rest` after a landing:\n // the landed beat is for the cards that landed, not for a swap-in.\n let current = 'rest';\n const paint = (symbol: ReelSymbol, phase: string): void => {\n if (symbol instanceof PhaseCardSymbol) symbol.setPhase(phase);\n };\n const paintAll = (phase: string): void => {\n for (const symbol of reel.symbols) paint(symbol, phase);\n };\n const onEnter = (name: string): void => {\n current = name;\n paintAll(name);\n };\n const onLanded = (): void => {\n current = 'rest';\n paintAll('landed');\n };\n const onCreated = (_id: string, stripIndex: number): void => {\n const symbol = reel.symbols[stripIndex];\n if (symbol) paint(symbol, current);\n };\n reel.events.on('phase:enter', onEnter);\n reel.events.on('landed', onLanded);\n reel.events.on('symbol:created', onCreated);\n stops.push(() => {\n reel.events.off('phase:enter', onEnter);\n reel.events.off('landed', onLanded);\n reel.events.off('symbol:created', onCreated);\n });\n }\n return () => {\n for (const stop of stops) stop();\n stops.length = 0;\n };\n }\n\n protected override onDeactivate(): void {\n // A pooled card must not carry a phase into whichever cell takes it next.\n this._cancelRest();\n this._phase = 'rest';\n this._color = this._colors.rest;\n super.onDeactivate();\n }\n\n protected override onDestroy(): void {\n this._cancelRest();\n super.onDestroy();\n }\n\n private _cancelRest(): void {\n if (this._restCall) {\n this._restCall.kill();\n this._restCall = null;\n }\n }\n}\n"],"mappings":";;;AA4CA,IAAa,IAAb,cAAgC,EAAW;CACzC;CACA;CACA;CACA;CACA;CAEA,OAAiG;CAEjG,YAAY,GAAyB;EAqBnC,AApBA,MAAM,GACN,KAAK,SAAS,EAAK,OACnB,KAAK,SAAS,EAAK,OACnB,KAAK,aAAa,EAAK,aAAa,UACpC,KAAK,OAAO,IAAI,EAAS,GACzB,KAAK,QAAQ,IAAI,EAAK;GACpB,MAAM,KAAK;GACX,OAAO;IAGL,YACE;IACF,UAAU;IACV,YAAY;IACZ,M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HoldAndWinBoard } from '../board/HoldAndWinBoard.js';
2
+ import { HoldAndWinBoardEvents } from '../board/HwTypes.js';
3
+ import { Cue, LoopCue, OneShotCue, ReelAudioPort, ReelSoundsHandle } from './cues.js';
4
+ /**
5
+ * Board sounds: the same cue table, snapped onto a Hold & Win board.
6
+ *
7
+ * ```ts
8
+ * const sounds = attachBoardSounds(board, zvukPort(engine), {
9
+ * respinStart: { play: 'spin', volume: 0.5 },
10
+ * cellLanded: { play: 'reel-stop', volume: ({ hit }) => (hit ? 0.7 : 0.4) },
11
+ * coinLocked: { play: 'pop' },
12
+ * featureEnd: { play: 'win' },
13
+ * });
14
+ * ```
15
+ */
16
+ /** A cue on any board event: a one-shot, or a loop that runs until `until` fires. */
17
+ export type BoardEventCue = OneShotCue | (LoopCue & {
18
+ until: keyof HoldAndWinBoardEvents;
19
+ });
20
+ export interface BoardCues {
21
+ /** The feature opening (`feature:enter`). */
22
+ featureEnter?: Cue;
23
+ /** A respin's cells starting to spin (`respin:start`). A loop runs until `respin:end`. */
24
+ respinStart?: Cue;
25
+ /**
26
+ * A cell landing (`cell:landed`): `ctx.reelIndex` / `ctx.cell` is the cell,
27
+ * `ctx.hit` says whether a coin landed.
28
+ */
29
+ cellLanded?: Cue;
30
+ /** A coin locking in (`coin:locked`). */
31
+ coinLocked?: Cue;
32
+ /** Every cell taken (`board:full`). */
33
+ boardFull?: Cue;
34
+ /** The feature ending (`feature:end`). */
35
+ featureEnd?: Cue;
36
+ /** Any other board event by name. */
37
+ on?: Partial<Record<keyof HoldAndWinBoardEvents, BoardEventCue>>;
38
+ }
39
+ /**
40
+ * Snap a table of cues onto a Hold & Win board. Every cue sees the board's
41
+ * active speed name. Returns a handle whose `destroy()` detaches every
42
+ * listener and stops every loop; call it when the board goes.
43
+ */
44
+ export declare function attachBoardSounds<TData = unknown>(board: HoldAndWinBoard<TData>, port: ReelAudioPort, cues: BoardCues): ReelSoundsHandle;
45
+ //# sourceMappingURL=BoardSounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoardSounds.d.ts","sourceRoot":"","sources":["../../src/audio/BoardSounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EAAE,GAAG,EAAc,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEvG;;;;;;;;;;;GAWG;AAEH,qFAAqF;AACrF,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,CAAC,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;CAAE,CAAC,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,0FAA0F;IAC1F,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,yCAAyC;IACzC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,uCAAuC;IACvC,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,qCAAqC;IACrC,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,qBAAqB,EAAE,aAAa,CAAC,CAAC,CAAC;CAClE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAG,OAAO,EAC/C,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,EAC7B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,SAAS,GACd,gBAAgB,CA4DlB"}
@@ -0,0 +1,64 @@
1
+ import { ReelSet } from '../core/ReelSet.js';
2
+ import { ReelSetEvents } from '../events/ReelEvents.js';
3
+ import { Cue, LoopCue, OneShotCue, ReelAudioPort, ReelSoundsHandle } from './cues.js';
4
+ /**
5
+ * Reel sounds: a table of cues snapped onto a `ReelSet`'s events.
6
+ *
7
+ * The engine knows the beats (a spin starts, a reel lands, a reel teases, a
8
+ * press skips, winners show, a cascade pops) and the audio engine knows the
9
+ * sounds; this is the thin layer that says which sound plays on which beat,
10
+ * when a loop starts and when it fades out. It talks to the audio engine
11
+ * through {@link ReelAudioPort}, a two-method surface (`play` a one-shot,
12
+ * `loop` a bed and get a handle to stop it), so any engine fits. For
13
+ * `@schmooky/zvuk` use {@link zvukPort}.
14
+ *
15
+ * ```ts
16
+ * const sounds = attachReelSounds(reelSet, zvukPort(engine), {
17
+ * spin: { play: 'spin' },
18
+ * reelStop: { play: 'reel-stop', pitch: { jitter: 0.04 },
19
+ * delay: ({ profile }) => profile.bounceDuration / 2000 },
20
+ * anticipation: { loop: 'anticipation', fadeIn: 0.12, fadeOut: 0.25,
21
+ * pitch: ({ order }) => 1 + 0.08 * order },
22
+ * skip: { play: 'skip' },
23
+ * win: { play: 'win' },
24
+ * });
25
+ * sounds.destroy(); // with the reel set
26
+ * ```
27
+ */
28
+ /** A cue on any reel-set event: a one-shot, or a loop that runs until `until` fires. */
29
+ export type EventCue = OneShotCue | (LoopCue & {
30
+ until: keyof ReelSetEvents;
31
+ });
32
+ export interface ReelCues {
33
+ /**
34
+ * The spin: from `spin:start` until every reel has landed
35
+ * (`spin:allLanded`). A loop is the usual choice.
36
+ */
37
+ spin?: Cue;
38
+ /**
39
+ * A reel landing on its result (`spin:reelLanding`), on every landing path:
40
+ * an animated stop, a slam, a cascade refill. `ctx.reelIndex` is the reel.
41
+ */
42
+ reelStop?: Cue;
43
+ /**
44
+ * A reel teasing, from `anticipation:reel` until its `anticipation:reelEnd`.
45
+ * `ctx.order` / `ctx.total` say where the reel sits in the tease, so a
46
+ * pitch can climb from reel to reel.
47
+ */
48
+ anticipation?: Cue;
49
+ /** A skip press (`skip:requested`). */
50
+ skip?: Cue;
51
+ /** Winners shown (`spotlight:start`, and `win:group` for each presented win). */
52
+ win?: Cue;
53
+ /** A cascade destroying its winners (`cascade:destroy:start`). */
54
+ cascadeDestroy?: Cue;
55
+ /** Any other reel-set event by name. */
56
+ on?: Partial<Record<keyof ReelSetEvents, EventCue>>;
57
+ }
58
+ /**
59
+ * Snap a table of cues onto a reel set. Every cue sees the active speed
60
+ * profile and the spin's mode. Returns a handle whose `destroy()` detaches
61
+ * every listener and stops every loop; call it when the reel set goes.
62
+ */
63
+ export declare function attachReelSounds(reelSet: ReelSet, port: ReelAudioPort, cues: ReelCues): ReelSoundsHandle;
64
+ //# sourceMappingURL=ReelSounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReelSounds.d.ts","sourceRoot":"","sources":["../../src/audio/ReelSounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAE,GAAG,EAAc,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEvG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,wFAAwF;AACxF,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,CAAC,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,aAAa,CAAA;CAAE,CAAC,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;IACX;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,uCAAuC;IACvC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,iFAAiF;IACjF,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,kEAAkE;IAClE,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,wCAAwC;IACxC,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;CACrD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,QAAQ,GACb,gBAAgB,CAmElB"}
@@ -0,0 +1,109 @@
1
+ import { SpeedProfile } from '../config/types.js';
2
+ import { Disposable } from '../utils/Disposable.js';
3
+ /**
4
+ * The cue vocabulary shared by `attachReelSounds` and `attachBoardSounds`,
5
+ * and the player that fires cues through a {@link ReelAudioPort}.
6
+ */
7
+ /** A number, or a centre with a random spread per voice (`{ base, jitter }`). */
8
+ export type SoundValue = number | {
9
+ base?: number;
10
+ jitter?: number;
11
+ };
12
+ /** What a cue knows about the beat it fires on. */
13
+ export interface CueContext {
14
+ /** The active speed profile's name (`'normal'`, `'turbo'`, ...). */
15
+ speed: string;
16
+ /** The active speed profile itself (a reel set's; a board has none). */
17
+ profile?: Readonly<SpeedProfile>;
18
+ /** A reel set's spin mode: `'standard'`, or `'cascade'` for a tumble and its refills. */
19
+ mode?: 'standard' | 'cascade';
20
+ /** The reel the beat belongs to, when it belongs to one. */
21
+ reelIndex?: number;
22
+ /** The cell on that reel, for a board beat. */
23
+ cell?: number;
24
+ /** A teasing reel's place in the tease sequence, 0-based. */
25
+ order?: number;
26
+ /** How many reels tease this spin. */
27
+ total?: number;
28
+ /** A board cell landed a coin (`true`) or an empty (`false`). */
29
+ hit?: boolean;
30
+ }
31
+ /** A value, or a function of the beat (a pitch that climbs with each teasing reel). */
32
+ export type CueValue = SoundValue | ((ctx: CueContext) => SoundValue);
33
+ /** What every cue shares: the bus, a level, a pitch, a delay and a guard. */
34
+ export interface CueBase {
35
+ bus?: string;
36
+ volume?: CueValue;
37
+ pitch?: CueValue;
38
+ /**
39
+ * Seconds between the beat and the sound: a thud timed to the bottom of
40
+ * the landing bounce instead of the frame the reel snaps on.
41
+ */
42
+ delay?: CueValue;
43
+ /** Fire only when this says so: a thud that stays quiet on a cascade. */
44
+ when?: (ctx: CueContext) => boolean;
45
+ }
46
+ export interface OneShotCue extends CueBase {
47
+ /** The sound to fire. A variants set plays its next take. */
48
+ play: string;
49
+ }
50
+ export interface LoopCue extends CueBase {
51
+ /** The sound to loop for as long as the beat lasts. */
52
+ loop: string;
53
+ /** Seconds. Default 0.05. */
54
+ fadeIn?: number;
55
+ /** Seconds. Default 0.1. */
56
+ fadeOut?: number;
57
+ }
58
+ export type Cue = OneShotCue | LoopCue;
59
+ export interface ReelAudioLoop {
60
+ /** Stop the loop, fading over `fade` seconds. Safe to call twice. */
61
+ stop(opts?: {
62
+ fade?: number;
63
+ }): void;
64
+ }
65
+ /** The audio engine as the cues see it. */
66
+ export interface ReelAudioPort {
67
+ /** Fire a one-shot. An unknown name must not throw. */
68
+ play(name: string, opts: {
69
+ bus?: string;
70
+ volume?: SoundValue;
71
+ pitch?: SoundValue;
72
+ }): void;
73
+ /** Start a loop and hand back its handle. An unknown name returns a no-op handle. */
74
+ loop(name: string, opts: {
75
+ bus?: string;
76
+ volume?: SoundValue;
77
+ pitch?: SoundValue;
78
+ fadeIn?: number;
79
+ }): ReelAudioLoop;
80
+ }
81
+ export interface ReelSoundsHandle extends Disposable {
82
+ /** Stop every running loop now (a scene change, a mute). */
83
+ stopAll(opts?: {
84
+ fade?: number;
85
+ }): void;
86
+ }
87
+ /**
88
+ * Fires cues through a port and keeps every loop and pending delay so
89
+ * `destroy()` can silence the lot.
90
+ */
91
+ export declare class CuePlayer implements ReelSoundsHandle {
92
+ private readonly port;
93
+ private readonly loops;
94
+ private readonly timers;
95
+ private destroyed;
96
+ constructor(port: ReelAudioPort);
97
+ get isDestroyed(): boolean;
98
+ /** Fire a cue for a beat; a loop cue is keyed so its end can find it. */
99
+ fire(cue: Cue, key: string, ctx: CueContext): void;
100
+ /** End a loop cue's loop; a one-shot has nothing to end. */
101
+ endLoop(cue: Cue | undefined, key: string): void;
102
+ stopAll(opts?: {
103
+ fade?: number;
104
+ }): void;
105
+ destroy(): void;
106
+ private fireNow;
107
+ private stopLoop;
108
+ }
109
+ //# sourceMappingURL=cues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cues.d.ts","sourceRoot":"","sources":["../../src/audio/cues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AAEH,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjC,yFAAyF;IACzF,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,uFAAuF;AACvF,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,CAAC,CAAC,GAAG,EAAE,UAAU,KAAK,UAAU,CAAC,CAAC;AAEtE,6EAA6E;AAC7E,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAA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ACH,qBAAa,SAAU,YAAW,gBAAgB;IAKpC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IACnE,OAAO,CAAC,SAAS,CAAS;gBAEG,IAAI,EAAE,aAAa;IAEhD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,yEAAyE;IACzE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;IAelD,4DAA4D;IAC5D,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAIhD,OAAO,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAMvC,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,QAAQ;CAMjB"}
@@ -0,0 +1,40 @@
1
+ import { ReelAudioPort, SoundValue } from './cues.js';
2
+ /**
3
+ * The slice of a `@schmooky/zvuk` `Engine` the port uses. Structural, so the
4
+ * library needs no dependency on zvuk: pass the engine `createEngine()` gave
5
+ * you and it fits.
6
+ */
7
+ export interface ZvukEngineLike {
8
+ hasSound(name: string): boolean;
9
+ hasVariants(name: string): boolean;
10
+ sound(name: string): {
11
+ play(options?: ZvukPlayOptions): ZvukVoiceLike;
12
+ };
13
+ variants(name: string): {
14
+ play(options?: ZvukPlayOptions): ZvukVoiceLike;
15
+ };
16
+ }
17
+ export interface ZvukPlayOptions {
18
+ bus?: string;
19
+ volume?: SoundValue;
20
+ pitch?: SoundValue;
21
+ loop?: boolean;
22
+ fadeIn?: number;
23
+ /** Seconds of equal-power crossfade at a loop's seam. */
24
+ loopCrossfade?: number;
25
+ }
26
+ export interface ZvukVoiceLike {
27
+ stop(opts?: {
28
+ fade?: number;
29
+ }): void;
30
+ }
31
+ /**
32
+ * A {@link ReelAudioPort} over a zvuk engine. A name loaded with
33
+ * `loadVariants` plays its next take; one loaded with `loadSound` plays as
34
+ * is. A name that is not loaded is skipped with one warning, so a missing
35
+ * file never breaks a spin.
36
+ */
37
+ export declare function zvukPort(engine: ZvukEngineLike, opts?: {
38
+ warn?: (message: string) => void;
39
+ }): ReelAudioPort;
40
+ //# sourceMappingURL=zvukPort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zvukPort.d.ts","sourceRoot":"","sources":["../../src/audio/zvukPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,aAAa,CAAA;KAAE,CAAC;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,aAAa,CAAA;KAAE,CAAC;CAC5E;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACtC;AAID;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,GAC9C,aAAa,CAwCf"}
@@ -122,7 +122,7 @@ export declare class HoldAndWinBuilder<TData = unknown> {
122
122
  cellZIndex(resolver: BoardCellZIndexResolver): this;
123
123
  /**
124
124
  * The `'normal'` spin feel for every cell. Default: NORMAL with a 320ms
125
- * floor and a 70ms `stopDelay` (the step of the landing wave, see
125
+ * floor and a 110ms `stopDelay` (the step of the landing wave, see
126
126
  * {@link HoldAndWinBuilder.stagger}). Shorthand for `speeds({ normal: profile })`.
127
127
  */
128
128
  speedProfile(profile: SpeedProfile): this;
@@ -1 +1 @@
1
- {"version":3,"file":"HoldAndWinBuilder.d.ts","sourceRoot":"","sources":["../../src/board/HoldAndWinBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,KAAK,EAAC,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9F;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB,CAAC,KAAK,GAAG,OAAO;IAC5C,OAAO,CAAC,KAAK,C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,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAK5E;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,YAAY,GAAG,IAAI;IAKhF;;;;OAIG;IACH,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,GAAE,SAAqB,GAAG,IAAI;IAMtE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK5B,sEAAsE;IACtE,GAAG,CAAC,EAAE,EAAE,MAAM,MAAM,GAAG,IAAI;IAK3B,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC;CA0ChC"}
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Built-in speed profiles covering common slot game needs.
3
3
  *
4
- * Bounce values are tuned for the typical 120–200px symbol range. For larger
5
- * or smaller symbols, register a custom profile or override `bounceDistance`.
6
- * `bounceDuration` is the total time for the two-leg bounce (down then back).
4
+ * Bounce values are tuned for the typical 120-200px symbol range: a short,
5
+ * firm settle, about a sixth of a cell, so a landing reads as a stop and not
6
+ * a spring. For larger or smaller symbols, register a custom profile or
7
+ * override `bounceDistance`. `bounceDuration` is the total time for the
8
+ * two-leg bounce (down then back).
7
9
  */
8
10
  export declare const SpeedPresets: {
9
11
  readonly NORMAL: {
@@ -12,8 +14,8 @@ export declare const SpeedPresets: {
12
14
  readonly spinSpeed: 30;
13
15
  readonly stopDelay: 140;
14
16
  readonly anticipationDelay: 450;
15
- readonly bounceDistance: 56;
16
- readonly bounceDuration: 600;
17
+ readonly bounceDistance: 22;
18
+ readonly bounceDuration: 220;
17
19
  readonly accelerationEase: "power2.in";
18
20
  readonly decelerationEase: "power2.out";
19
21
  readonly accelerationDuration: 300;
@@ -25,8 +27,8 @@ export declare const SpeedPresets: {
25
27
  readonly spinSpeed: 50;
26
28
  readonly stopDelay: 0;
27
29
  readonly anticipationDelay: 250;
28
- readonly bounceDistance: 42;
29
- readonly bounceDuration: 200;
30
+ readonly bounceDistance: 14;
31
+ readonly bounceDuration: 140;
30
32
  readonly accelerationEase: "power2.in";
31
33
  readonly decelerationEase: "power2.out";
32
34
  readonly accelerationDuration: 200;
@@ -38,8 +40,8 @@ export declare const SpeedPresets: {
38
40
  readonly spinSpeed: 80;
39
41
  readonly stopDelay: 0;
40
42
  readonly anticipationDelay: 0;
41
- readonly bounceDistance: 14;
42
- readonly bounceDuration: 120;
43
+ readonly bounceDistance: 8;
44
+ readonly bounceDuration: 90;
43
45
  readonly accelerationEase: "power1.in";
44
46
  readonly decelerationEase: "power1.out";
45
47
  readonly accelerationDuration: 50;
@@ -1 +1 @@
1
- {"version":3,"file":"SpeedPresets.d.ts","sourceRoot":"","sources":["../../src/config/SpeedPresets.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCwB,CAAC"}
1
+ {"version":3,"file":"SpeedPresets.d.ts","sourceRoot":"","sources":["../../src/config/SpeedPresets.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCwB,CAAC"}
@@ -469,7 +469,7 @@ export declare class ReelSet extends Container implements Disposable {
469
469
  * above pin overlays.
470
470
  */
471
471
  private static readonly PIN_OVERLAY_Z_INDEX;
472
- private _events;
472
+ private _bus;
473
473
  private _reels;
474
474
  private _viewport;
475
475
  private _spinController;
@@ -1551,6 +1551,12 @@ export declare class ReelSet extends Container implements Disposable {
1551
1551
  * starts from the anchor cell's bounds.
1552
1552
  */
1553
1553
  getBlockBounds(reel: number, cell: number): CellBounds;
1554
+ /**
1555
+ * The mode of the spin running now, or of the last one: `'standard'` or
1556
+ * `'cascade'` (a cascade refill counts as `'cascade'`). What a sound cue
1557
+ * reads to stay quiet on a tumble.
1558
+ */
1559
+ get spinMode(): 'standard' | 'cascade';
1554
1560
  /** Speed profile manager. */
1555
1561
  get speed(): SpeedManager;
1556
1562
  /** Change speed and emit event. */