pixi-reels 0.0.0-dependabot-github-actions-github-codeql-action-4-35-4-20260514194131

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 (125) hide show
  1. package/CHANGELOG.md +260 -0
  2. package/CONTRIBUTING.md +85 -0
  3. package/LICENSE +28 -0
  4. package/README.md +168 -0
  5. package/dist/SpineSymbol-CfVrc5Pk.js +88 -0
  6. package/dist/SpineSymbol-CfVrc5Pk.js.map +1 -0
  7. package/dist/SpineSymbol-JA5PdEbT.cjs +2 -0
  8. package/dist/SpineSymbol-JA5PdEbT.cjs.map +1 -0
  9. package/dist/cascade/CascadeAnticipationPhase.d.ts +23 -0
  10. package/dist/cascade/CascadeAnticipationPhase.d.ts.map +1 -0
  11. package/dist/cascade/DropRecipes.d.ts +40 -0
  12. package/dist/cascade/DropRecipes.d.ts.map +1 -0
  13. package/dist/config/SpeedPresets.d.ts +49 -0
  14. package/dist/config/SpeedPresets.d.ts.map +1 -0
  15. package/dist/config/defaults.d.ts +12 -0
  16. package/dist/config/defaults.d.ts.map +1 -0
  17. package/dist/config/types.d.ts +296 -0
  18. package/dist/config/types.d.ts.map +1 -0
  19. package/dist/core/Reel.d.ts +339 -0
  20. package/dist/core/Reel.d.ts.map +1 -0
  21. package/dist/core/ReelMotion.d.ts +51 -0
  22. package/dist/core/ReelMotion.d.ts.map +1 -0
  23. package/dist/core/ReelSet.d.ts +509 -0
  24. package/dist/core/ReelSet.d.ts.map +1 -0
  25. package/dist/core/ReelSetBuilder.d.ts +282 -0
  26. package/dist/core/ReelSetBuilder.d.ts.map +1 -0
  27. package/dist/core/ReelViewport.d.ts +129 -0
  28. package/dist/core/ReelViewport.d.ts.map +1 -0
  29. package/dist/core/StopSequencer.d.ts +26 -0
  30. package/dist/core/StopSequencer.d.ts.map +1 -0
  31. package/dist/debug/debug.d.ts +129 -0
  32. package/dist/debug/debug.d.ts.map +1 -0
  33. package/dist/events/EventEmitter.d.ts +25 -0
  34. package/dist/events/EventEmitter.d.ts.map +1 -0
  35. package/dist/events/ReelEvents.d.ts +125 -0
  36. package/dist/events/ReelEvents.d.ts.map +1 -0
  37. package/dist/frame/ColumnTarget.d.ts +77 -0
  38. package/dist/frame/ColumnTarget.d.ts.map +1 -0
  39. package/dist/frame/FrameBuilder.d.ts +51 -0
  40. package/dist/frame/FrameBuilder.d.ts.map +1 -0
  41. package/dist/frame/OffsetCalculator.d.ts +19 -0
  42. package/dist/frame/OffsetCalculator.d.ts.map +1 -0
  43. package/dist/frame/RandomSymbolProvider.d.ts +27 -0
  44. package/dist/frame/RandomSymbolProvider.d.ts.map +1 -0
  45. package/dist/index.cjs +5 -0
  46. package/dist/index.cjs.map +1 -0
  47. package/dist/index.d.ts +70 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +2571 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/pins/CellPin.d.ts +140 -0
  52. package/dist/pins/CellPin.d.ts.map +1 -0
  53. package/dist/pool/ObjectPool.d.ts +36 -0
  54. package/dist/pool/ObjectPool.d.ts.map +1 -0
  55. package/dist/speed/SpeedManager.d.ts +38 -0
  56. package/dist/speed/SpeedManager.d.ts.map +1 -0
  57. package/dist/spin/SpinController.d.ts +183 -0
  58. package/dist/spin/SpinController.d.ts.map +1 -0
  59. package/dist/spin/modes/CascadeMode.d.ts +16 -0
  60. package/dist/spin/modes/CascadeMode.d.ts.map +1 -0
  61. package/dist/spin/modes/ImmediateMode.d.ts +10 -0
  62. package/dist/spin/modes/ImmediateMode.d.ts.map +1 -0
  63. package/dist/spin/modes/SpinningMode.d.ts +18 -0
  64. package/dist/spin/modes/SpinningMode.d.ts.map +1 -0
  65. package/dist/spin/modes/StandardMode.d.ts +10 -0
  66. package/dist/spin/modes/StandardMode.d.ts.map +1 -0
  67. package/dist/spin/phases/AdjustPhase.d.ts +73 -0
  68. package/dist/spin/phases/AdjustPhase.d.ts.map +1 -0
  69. package/dist/spin/phases/AnticipationPhase.d.ts +24 -0
  70. package/dist/spin/phases/AnticipationPhase.d.ts.map +1 -0
  71. package/dist/spin/phases/DropStartPhase.d.ts +21 -0
  72. package/dist/spin/phases/DropStartPhase.d.ts.map +1 -0
  73. package/dist/spin/phases/DropStopPhase.d.ts +44 -0
  74. package/dist/spin/phases/DropStopPhase.d.ts.map +1 -0
  75. package/dist/spin/phases/PhaseFactory.d.ts +32 -0
  76. package/dist/spin/phases/PhaseFactory.d.ts.map +1 -0
  77. package/dist/spin/phases/ReelPhase.d.ts +39 -0
  78. package/dist/spin/phases/ReelPhase.d.ts.map +1 -0
  79. package/dist/spin/phases/SpinPhase.d.ts +25 -0
  80. package/dist/spin/phases/SpinPhase.d.ts.map +1 -0
  81. package/dist/spin/phases/StartPhase.d.ts +26 -0
  82. package/dist/spin/phases/StartPhase.d.ts.map +1 -0
  83. package/dist/spin/phases/StopPhase.d.ts +37 -0
  84. package/dist/spin/phases/StopPhase.d.ts.map +1 -0
  85. package/dist/spine/SpineReelSymbol.d.ts +130 -0
  86. package/dist/spine/SpineReelSymbol.d.ts.map +1 -0
  87. package/dist/spine/index.d.ts +5 -0
  88. package/dist/spine/index.d.ts.map +1 -0
  89. package/dist/spine.cjs +2 -0
  90. package/dist/spine.cjs.map +1 -0
  91. package/dist/spine.js +123 -0
  92. package/dist/spine.js.map +1 -0
  93. package/dist/spotlight/SymbolSpotlight.d.ts +70 -0
  94. package/dist/spotlight/SymbolSpotlight.d.ts.map +1 -0
  95. package/dist/symbols/AnimatedSpriteSymbol.d.ts +30 -0
  96. package/dist/symbols/AnimatedSpriteSymbol.d.ts.map +1 -0
  97. package/dist/symbols/ReelSymbol.d.ts +86 -0
  98. package/dist/symbols/ReelSymbol.d.ts.map +1 -0
  99. package/dist/symbols/SpineSymbol.d.ts +34 -0
  100. package/dist/symbols/SpineSymbol.d.ts.map +1 -0
  101. package/dist/symbols/SpriteSymbol.d.ts +29 -0
  102. package/dist/symbols/SpriteSymbol.d.ts.map +1 -0
  103. package/dist/symbols/SymbolFactory.d.ts +20 -0
  104. package/dist/symbols/SymbolFactory.d.ts.map +1 -0
  105. package/dist/symbols/SymbolRegistry.d.ts +25 -0
  106. package/dist/symbols/SymbolRegistry.d.ts.map +1 -0
  107. package/dist/testing/FakeTicker.d.ts +45 -0
  108. package/dist/testing/FakeTicker.d.ts.map +1 -0
  109. package/dist/testing/HeadlessSymbol.d.ts +28 -0
  110. package/dist/testing/HeadlessSymbol.d.ts.map +1 -0
  111. package/dist/testing/index.d.ts +5 -0
  112. package/dist/testing/index.d.ts.map +1 -0
  113. package/dist/testing/testHarness.d.ts +97 -0
  114. package/dist/testing/testHarness.d.ts.map +1 -0
  115. package/dist/utils/Disposable.d.ts +10 -0
  116. package/dist/utils/Disposable.d.ts.map +1 -0
  117. package/dist/utils/TickerRef.d.ts +30 -0
  118. package/dist/utils/TickerRef.d.ts.map +1 -0
  119. package/dist/utils/gsapRef.d.ts +14 -0
  120. package/dist/utils/gsapRef.d.ts.map +1 -0
  121. package/dist/wins/Win.d.ts +7 -0
  122. package/dist/wins/Win.d.ts.map +1 -0
  123. package/dist/wins/WinPresenter.d.ts +100 -0
  124. package/dist/wins/WinPresenter.d.ts.map +1 -0
  125. package/package.json +87 -0
@@ -0,0 +1,509 @@
1
+ import { Container } from 'pixi.js';
2
+ import { Disposable } from '../utils/Disposable.js';
3
+ import { ReelSetInternalConfig, CellBounds, SpinOptions } from '../config/types.js';
4
+ import { EventEmitter } from '../events/EventEmitter.js';
5
+ import { ReelSetEvents, SpinResult } from '../events/ReelEvents.js';
6
+ import { Reel } from './Reel.js';
7
+ import { ReelViewport } from './ReelViewport.js';
8
+ import { SpeedManager } from '../speed/SpeedManager.js';
9
+ import { SymbolSpotlight } from '../spotlight/SymbolSpotlight.js';
10
+ import { SymbolFactory } from '../symbols/SymbolFactory.js';
11
+ import { FrameBuilder, FrameMiddleware } from '../frame/FrameBuilder.js';
12
+ import { PhaseFactory } from '../spin/phases/PhaseFactory.js';
13
+ import { SpinningMode } from '../spin/modes/SpinningMode.js';
14
+ import { CellPin, CellPinOptions, MovePinOptions, CellCoord } from '../pins/CellPin.js';
15
+ import { ColumnTarget } from '../frame/ColumnTarget.js';
16
+ export interface ReelSetParams {
17
+ config: ReelSetInternalConfig;
18
+ reels: Reel[];
19
+ viewport: ReelViewport;
20
+ symbolFactory: SymbolFactory;
21
+ frameBuilder: FrameBuilder;
22
+ phaseFactory: PhaseFactory;
23
+ spinningMode: SpinningMode;
24
+ defaultSpinMode: 'standard' | 'cascade';
25
+ }
26
+ /**
27
+ * The runtime-mutable frame-builder pipeline exposed on `reelSet.frame`.
28
+ * Matches `FrameBuilder.use/remove` — the internal machinery that already
29
+ * exists; this is the ergonomic surface.
30
+ */
31
+ export interface FrameAPI {
32
+ /** Add a middleware. Sorted by `priority` on next frame build. */
33
+ use(middleware: FrameMiddleware): void;
34
+ /** Remove a middleware by `name`. No-op if absent. */
35
+ remove(name: string): void;
36
+ /** Current middleware list in registration order. */
37
+ readonly middleware: ReadonlyArray<FrameMiddleware>;
38
+ }
39
+ /**
40
+ * The whole slot board as one object.
41
+ *
42
+ * A `ReelSet` is a PixiJS `Container` that owns every reel, the spin
43
+ * controller, the speed manager, and the win spotlight. You `addChild` it
44
+ * to your stage and then drive it from the four public verbs below:
45
+ *
46
+ * - `spin()` — start the reels moving, returns a promise that resolves
47
+ * when every reel has landed (or been slam-stopped)
48
+ * - `setResult(grid)` — tell the reels what to land on; the spin
49
+ * controller consumes this and each reel queues its target symbols
50
+ * - `setAnticipation(reelIndices)` — slow the given reels before they
51
+ * stop, for "will the third scatter land?" tension
52
+ * - `skip()` — land immediately; useful for slam-stop UX
53
+ *
54
+ * Everything else is subsystems: `speed`, `spotlight`, `events`, `viewport`.
55
+ * Construction goes through {@link ReelSetBuilder}, never `new ReelSet()`
56
+ * directly — the builder enforces that every required piece is wired.
57
+ *
58
+ * ```ts
59
+ * const reelSet = new ReelSetBuilder()
60
+ * .reels(5).visibleSymbols(3).symbolSize(140, 140)
61
+ * .symbols((r) => r.register('cherry', SpriteSymbol, { textures }))
62
+ * .ticker(app.ticker)
63
+ * .build();
64
+ * app.stage.addChild(reelSet);
65
+ *
66
+ * const spin = reelSet.spin();
67
+ * reelSet.setResult(await server.spin());
68
+ * await spin;
69
+ * ```
70
+ *
71
+ * Teardown cascades: one `reelSet.destroy()` disposes every child.
72
+ */
73
+ export declare class ReelSet extends Container implements Disposable {
74
+ /**
75
+ * zIndex applied to pin overlays so they render above the reel strip.
76
+ *
77
+ * **The library's z-index budget**, for reference if you author symbols
78
+ * that need to layer above defaults:
79
+ *
80
+ * | Layer | zIndex | Source |
81
+ * |---|---|---|
82
+ * | 1×1 symbol, default | `0 * 100 + arrayIndex` (~0–10) | `symbolData.zIndex ?? 0` |
83
+ * | 1×1 symbol, elevated (`zIndex: 1` on `symbolData`) | `1 * 100 + arrayIndex` (~100) | `symbolData.zIndex` |
84
+ * | Big-symbol anchor, default registration | `5 * 100 + arrayIndex` (~500) | recipe convention |
85
+ * | Pin overlay (sticky/expanding wild during spin) | `10000` | `PIN_OVERLAY_Z_INDEX` |
86
+ *
87
+ * The 100× multiplier on `symbolData.zIndex` leaves room for per-row
88
+ * stacking inside a layer (bottom rows render in front of top rows on
89
+ * the same layer). The 10000 ceiling on pin overlays is set very high
90
+ * so a consumer who sets `symbolData.zIndex: 50` (= 5000) still sits
91
+ * below pins. If you need to stack ABOVE pin overlays — e.g. a win-
92
+ * presenter symbol promotion — re-parent the symbol to
93
+ * `viewport.spotlightContainer`, which is its own DisplayObject layer
94
+ * above pin overlays.
95
+ */
96
+ private static readonly PIN_OVERLAY_Z_INDEX;
97
+ private _events;
98
+ private _reels;
99
+ private _viewport;
100
+ private _spinController;
101
+ private _speedManager;
102
+ private _spotlight;
103
+ private _symbolFactory;
104
+ private _frameBuilder;
105
+ private _frameAPI;
106
+ private _isDestroyed;
107
+ private _pins;
108
+ /**
109
+ * Visual overlays rendered above the reel viewport while a spin is in
110
+ * motion. Each overlay is a pooled ReelSymbol sitting in the viewport's
111
+ * unmaskedContainer at the pin's cell position — it keeps the pinned
112
+ * symbol visible while the underlying reel scrolls. Created on
113
+ * spin:start, destroyed on spin:allLanded. The pin is co-stored so
114
+ * _destroyPinOverlay always has it available even after the pin is
115
+ * removed from `_pins` (e.g. during unpin()).
116
+ */
117
+ private _pinOverlays;
118
+ /**
119
+ * MultiWays: target row counts for the next AdjustPhase. Recorded by
120
+ * `setShape()`, consumed by `SpinController` when it builds AdjustPhase
121
+ * configs. `null` means "no shape change pending".
122
+ */
123
+ private _targetShape;
124
+ /**
125
+ * True once `setResult()` has been called for the current spin. Reset on
126
+ * every `spin:start`. Used to enforce the contract that `setShape()`
127
+ * must be called BEFORE `setResult()` — calling it after corrupts the
128
+ * cached frames (pins were applied at their pre-migration rows; a later
129
+ * setShape would migrate them but the frames are already built).
130
+ */
131
+ private _resultSetForCurrentSpin;
132
+ /** Set at construction by the builder when `.multiways(...)` was called. */
133
+ private _isMultiWaysSlot;
134
+ private _multiwaysMinRows;
135
+ private _multiwaysMaxRows;
136
+ private _multiwaysReelPixelHeight;
137
+ /** Resolved per-symbol metadata (size, zIndex, etc). */
138
+ private _symbolsData;
139
+ /** Horizontal symbol gap (px). Used by `getBlockBounds` for big symbols. */
140
+ private _configGapX;
141
+ constructor(params: ReelSetParams);
142
+ /** The event emitter for reel-specific events. */
143
+ get events(): EventEmitter<ReelSetEvents>;
144
+ /**
145
+ * Start spinning. Returns a promise that resolves when all (non-held)
146
+ * reels land.
147
+ *
148
+ * Pass `{ holdReels: [i, ...] }` to keep specific columns frozen for
149
+ * this spin — they skip START / SPIN / STOP entirely and stay on
150
+ * whatever symbols they're currently showing. The use cases are
151
+ * Hold & Win respins, sticky / expanding wilds, and "the trigger
152
+ * column stays in place" bonus rounds.
153
+ *
154
+ * Pass `{ mode: 'standard' | 'cascade' }` to override the builder-time
155
+ * default for a single spin (e.g. classic strip-spin on the first round,
156
+ * drop-in on the cascade waves). `'cascade'` requires `.cascade(...)`
157
+ * on the builder.
158
+ *
159
+ * @example
160
+ * // Plain spin — every reel animates.
161
+ * await reelSet.spin();
162
+ *
163
+ * @example
164
+ * // Hold reels 0 and 4; only the middle three reroll.
165
+ * const spin = reelSet.spin({ holdReels: [0, 4] });
166
+ * reelSet.setResult(serverGrid); // entries at 0/4 are ignored
167
+ * await spin;
168
+ *
169
+ * @example
170
+ * // Per-spin cascade override.
171
+ * await reelSet.spin({ mode: 'cascade' });
172
+ *
173
+ * See {@link SpinOptions} for the full contract (event behaviour,
174
+ * setResult interaction, setAnticipation filtering).
175
+ */
176
+ spin(options?: SpinOptions): Promise<SpinResult>;
177
+ /**
178
+ * Set the target result symbols. Triggers the stop sequence.
179
+ *
180
+ * Two input shapes are accepted:
181
+ *
182
+ * 1. **Legacy `string[][]`** — one column per reel, row-indexed. Set
183
+ * `frame[col][-1]` (or `[-2]`, etc.) to target a buffer-above slot,
184
+ * `frame[col][visibleRows]` for buffer-below.
185
+ * 2. **Explicit `ColumnTarget[]`** — `{ visible, bufferAbove?, bufferBelow? }`
186
+ * per column. Preferred for code that crosses worker/network boundaries,
187
+ * structuredClones, or JSON-serializes (the legacy form's negative-index
188
+ * slots don't survive standard cloning; the explicit form does).
189
+ *
190
+ * If any pins are active (`reelSet.pin(...)`), their symbols are overlaid
191
+ * onto the result before it reaches the stop sequencer — so pinned cells
192
+ * always land on the pin's `symbolId` regardless of what the server sent.
193
+ */
194
+ setResult(symbols: string[][] | ColumnTarget[]): void;
195
+ /** Set which reels should show anticipation before stopping. */
196
+ setAnticipation(reelIndices: number[]): void;
197
+ /**
198
+ * Override the per-reel stop delay for the current spin (in ms).
199
+ * Pass one value per reel. Cleared at the start of each new spin.
200
+ *
201
+ * @example
202
+ * // Stagger the last two reels more than the default for dramatic effect:
203
+ * reelSet.setStopDelays([0, 140, 280, 600, 1100]);
204
+ */
205
+ setStopDelays(delays: number[]): void;
206
+ /** Skip/slam-stop: immediately land all reels on target. */
207
+ skip(): void;
208
+ /** Slam-stop safe before `setResult()` arrives — queues until then. */
209
+ requestSkip(): void;
210
+ /**
211
+ * Swap the symbol at a single grid cell in-place, at rest.
212
+ *
213
+ * Caller-facing wrapper over `Reel.setSymbolAt` that ALSO refuses
214
+ * pinned cells (since `Reel` itself can't see the pin map). Use this
215
+ * for live presentation effects — sticky-after-win, mid-feature
216
+ * rewrites — without going through `setResult()`.
217
+ *
218
+ * Throws (in addition to the per-reel guards documented on
219
+ * `Reel.setSymbolAt`) if `(col, row)` currently has an active pin.
220
+ * Use `unpin(col, row)` first if you intentionally want to overwrite it.
221
+ *
222
+ * @example
223
+ * await reelSet.spin(); // landed
224
+ * reelSet.setSymbolAt(2, 1, 'wild'); // swap centre cell to wild
225
+ */
226
+ setSymbolAt(col: number, row: number, symbolId: string): void;
227
+ /**
228
+ * Set the drop order for cascade drop-in mechanics.
229
+ *
230
+ * A convenience wrapper over setStopDelays() for common patterns.
231
+ * The stagger step defaults to the active speed profile's stopDelay
232
+ * (or 150 ms if stopDelay is 0).
233
+ *
234
+ * Call this before or after setResult() — both work.
235
+ *
236
+ * @example
237
+ * reelSet.setDropOrder('ltr'); // left-to-right
238
+ * reelSet.setDropOrder('rtl'); // right-to-left
239
+ * reelSet.setDropOrder('all'); // all columns simultaneously
240
+ * reelSet.setDropOrder([0, 0, 200, 200, 400]); // custom per-reel delays
241
+ */
242
+ setDropOrder(order: 'ltr' | 'rtl' | 'all' | number[], stepMs?: number): void;
243
+ get isSpinning(): boolean;
244
+ /** Whether this slot was built with `.multiways(...)`. */
245
+ get isMultiWaysSlot(): boolean;
246
+ /**
247
+ * MultiWays: record the row count each reel should land on this spin. The
248
+ * AdjustPhase between SPIN and STOP will reshape reels (resize symbols,
249
+ * reshape motion) before the stop sequence runs.
250
+ *
251
+ * Must be called between `spin()` and `setResult()`. The shape stays in
252
+ * effect for the current spin only — call again on every spin.
253
+ *
254
+ * Throws if:
255
+ * - this slot was not built with `.multiways(...)`
256
+ * - `rowsPerReel.length !== reelCount`
257
+ * - any entry falls outside `[multiways.minRows, multiways.maxRows]`
258
+ */
259
+ setShape(rowsPerReel: number[]): void;
260
+ /**
261
+ * Internal: read the pending MultiWays target shape (does not clear).
262
+ * Used by `SpinController` via the hooks interface. Not part of the
263
+ * public API — call `setShape()` to change shape.
264
+ *
265
+ * @internal
266
+ */
267
+ private _peekTargetShape;
268
+ /**
269
+ * Internal: clear the pending MultiWays target shape after the spin lands.
270
+ *
271
+ * @internal
272
+ */
273
+ private _clearTargetShape;
274
+ /**
275
+ * Resolved grid, with all OCCUPIED cells (same-reel and cross-reel)
276
+ * replaced by their anchor's symbol id. A 2×2 bonus reads as four
277
+ * `'bonus'` cells.
278
+ *
279
+ * Equivalent to `reelSet.reels.map(r => r.getVisibleSymbols())` because
280
+ * each reel has a cross-reel resolver wired in by ReelSet's constructor —
281
+ * the per-reel surface and the grid surface are the same.
282
+ */
283
+ getVisibleGrid(): string[][];
284
+ /**
285
+ * Footprint of the symbol at `(col, row)`.
286
+ *
287
+ * - 1×1 symbols: `{ anchor: { col, row }, size: { w: 1, h: 1 } }`.
288
+ * - Big symbols: returns the anchor cell and block size.
289
+ * - OCCUPIED cells: resolves transparently to the anchor.
290
+ *
291
+ * Useful for win presenters that need to highlight a whole NxM block.
292
+ */
293
+ getSymbolFootprint(col: number, row: number): {
294
+ anchor: {
295
+ col: number;
296
+ row: number;
297
+ };
298
+ size: {
299
+ w: number;
300
+ h: number;
301
+ };
302
+ };
303
+ /**
304
+ * Pixel rectangle covering a big symbol's whole `N×M` block, in
305
+ * ReelSet-local coordinates. Returns the anchor cell's bounds for 1×1
306
+ * symbols. Pass any cell of a block — anchor or non-anchor — and you
307
+ * get the same rect.
308
+ *
309
+ * Useful for win presenters drawing an outline around a whole bonus, or
310
+ * any overlay aligned to the visible footprint of a big symbol:
311
+ *
312
+ * ```ts
313
+ * const rect = reelSet.getBlockBounds(2, 1);
314
+ * gfx.rect(rect.x, rect.y, rect.width, rect.height)
315
+ * .stroke({ color: 0xff6b35, width: 4 });
316
+ * reelSet.addChild(gfx);
317
+ * ```
318
+ *
319
+ * For 1×1 cells this is equivalent to `getCellBounds(col, row)`. For
320
+ * big-symbol cells it multiplies width/height by the block size and
321
+ * starts from the anchor cell's bounds.
322
+ */
323
+ getBlockBounds(col: number, row: number): CellBounds;
324
+ /** Speed profile manager. */
325
+ get speed(): SpeedManager;
326
+ /** Change speed and emit event. */
327
+ setSpeed(name: string): void;
328
+ get spotlight(): SymbolSpotlight;
329
+ /** Get all reels. */
330
+ get reels(): readonly Reel[];
331
+ /** Get a reel by index. */
332
+ getReel(index: number): Reel;
333
+ /**
334
+ * Returns the bounding box of a visible grid cell in ReelSet-local
335
+ * coordinates (i.e. relative to this Container, before any parent
336
+ * transforms). Row 0 is the top visible row.
337
+ *
338
+ * Use this to place payline graphics, hit areas, or debug overlays
339
+ * that must align with a specific symbol cell:
340
+ *
341
+ * ```ts
342
+ * const b = reelSet.getCellBounds(2, 1);
343
+ * gfx.rect(b.x, b.y, b.width, b.height).stroke({ color: 0xff6b35 });
344
+ * reelSet.addChild(gfx);
345
+ * ```
346
+ *
347
+ * To convert to stage / global coordinates use PixiJS:
348
+ * ```ts
349
+ * const global = reelSet.toGlobal({ x: b.x, y: b.y });
350
+ * ```
351
+ */
352
+ getCellBounds(col: number, row: number): CellBounds;
353
+ /** Get the viewport. */
354
+ get viewport(): ReelViewport;
355
+ /**
356
+ * Pin a symbol to a grid cell. Applied immediately if the reel is idle;
357
+ * applied at the next `setResult()` otherwise. Fires `pin:placed`.
358
+ *
359
+ * Passing the same `(col, row)` replaces the previous pin — the old one
360
+ * is replaced silently (no `pin:expired` fires for replacement).
361
+ *
362
+ * @example
363
+ * // Sticky wild for 3 spins
364
+ * reelSet.pin(2, 1, 'wild', { turns: 3 })
365
+ *
366
+ * // Hold & Win coin with a payout value
367
+ * reelSet.pin(col, row, 'coin', { turns: 'permanent', payload: { value: 50 } })
368
+ *
369
+ * // Expanding wild — fill column for the current spin's evaluation only
370
+ * for (let r = 0; r < 3; r++) reelSet.pin(2, r, 'wild', { turns: 'eval' })
371
+ */
372
+ pin(col: number, row: number, symbolId: string, options?: CellPinOptions): CellPin;
373
+ /**
374
+ * Remove a pin at `(col, row)`. If no pin exists at that cell, this is a
375
+ * no-op. Fires `pin:expired` with reason `'explicit'`.
376
+ */
377
+ unpin(col: number, row: number): void;
378
+ /**
379
+ * All active pins, keyed by `"col:row"`.
380
+ *
381
+ * Reads are safe at any time — during a spin the map reflects pins that
382
+ * will apply to the NEXT `setResult()`, not the one already in flight.
383
+ */
384
+ get pins(): ReadonlyMap<string, CellPin>;
385
+ /** Convenience: get the pin at `(col, row)` or `undefined`. */
386
+ getPin(col: number, row: number): CellPin | undefined;
387
+ /**
388
+ * Move an existing pin from one cell to another. Animates a flight symbol
389
+ * between the two cells, updates pin state atomically, and resolves when
390
+ * the animation completes.
391
+ *
392
+ * This is the engine-native replacement for ghost sprites in walking-wild
393
+ * recipes. The flight symbol is a pooled `ReelSymbol` acquired from the
394
+ * factory, parented briefly to the viewport's `unmaskedContainer` so it
395
+ * can travel across reel boundaries without being clipped.
396
+ *
397
+ * Constraints:
398
+ * - Only callable at rest (throws if `isSpinning === true`).
399
+ * - `to` must be within the grid; no pin may already exist there.
400
+ * - Calling with `from === to` is a no-op that still fires `pin:moved`.
401
+ *
402
+ * @example
403
+ * // Walking wild — move the pinned wild one column left each spin
404
+ * reelSet.events.on('spin:complete', async () => {
405
+ * for (const pin of [...reelSet.pins.values()]) {
406
+ * if (pin.col > 0) {
407
+ * await reelSet.movePin(
408
+ * { col: pin.col, row: pin.row },
409
+ * { col: pin.col - 1, row: pin.row },
410
+ * );
411
+ * } else {
412
+ * reelSet.unpin(pin.col, pin.row);
413
+ * }
414
+ * }
415
+ * });
416
+ */
417
+ movePin(from: CellCoord, to: CellCoord, opts?: MovePinOptions): Promise<void>;
418
+ /**
419
+ * Runtime-mutable middleware pipeline for symbol-frame generation.
420
+ *
421
+ * @example
422
+ * // Feature entry — swap to a middleware that injects more wilds
423
+ * reelSet.frame.use(moreWildsMiddleware);
424
+ *
425
+ * // Feature exit
426
+ * reelSet.frame.remove('more-wilds');
427
+ */
428
+ get frame(): FrameAPI;
429
+ get isDestroyed(): boolean;
430
+ destroy(): void;
431
+ /**
432
+ * Return a deep copy of `symbols` with active pins overlaid. Pure — does
433
+ * not mutate the input. When there are no pins, returns the input as-is
434
+ * (fast path; identical behaviour to pre-pin code).
435
+ *
436
+ * IMPORTANT: clones via `cloneTargetGrid`, not `symbols.map(col => [...col])`.
437
+ * Spread drops the negative-index string properties that carry buffer-above
438
+ * targets (`col[-1] = 'COIN'`). If you refactor this method, keep the
439
+ * helper. See `cloneTargetGrid`'s TSDoc for the full contract.
440
+ */
441
+ private _applyPinsToGrid;
442
+ /** Pins on a given reel, in row order. Used by AdjustPhase migration. */
443
+ private _pinsOnReel;
444
+ /**
445
+ * MultiWays: relocate pins on a reel for a new visible-row count. The new
446
+ * row is computed as `min(originRow, newRows - 1)` — clamped only when
447
+ * the origin no longer fits. Returns the migrated pins so AdjustPhase
448
+ * can build tween descriptors. Mutates the pins map in place.
449
+ */
450
+ private _migratePinsForReel;
451
+ /**
452
+ * Apply a pin to the idle reel's visible display immediately. Used when
453
+ * `pin()` is called while no spin is in flight — the grid updates right
454
+ * away so `getVisibleSymbols()` reflects the pin.
455
+ */
456
+ private _applyPinVisually;
457
+ /**
458
+ * Fires on `spin:allLanded`. Destroys visual pin overlays (the actual reel
459
+ * cells now show the pinned symbols via setResult overlay), then
460
+ * decrements numeric-turns pins and expires pins that hit zero.
461
+ */
462
+ private _onSpinLanded;
463
+ /**
464
+ * Fires on `spin:start`. Clears every `'eval'` pin from the previous spin,
465
+ * then creates a visual overlay for every remaining pin so its symbol
466
+ * stays visible while the reel scrolls underneath.
467
+ */
468
+ private _onSpinStart;
469
+ /**
470
+ * Create an overlay ReelSymbol for a pin in the viewport's unmasked
471
+ * container. No-op if one already exists at that cell. Fires
472
+ * `pin:overlayCreated` after the overlay is positioned and added to the
473
+ * display list — that's the hook consumers use to drive animation state
474
+ * (e.g. setting a Spine track).
475
+ */
476
+ private _ensurePinOverlay;
477
+ /**
478
+ * Reposition + resize every pin overlay on the given reel.
479
+ *
480
+ * The engine calls this automatically after every MultiWays AdjustPhase
481
+ * reshape (and from the skip path), so applications that just use
482
+ * `setShape()` / `setResult()` never need to invoke it. **Call it
483
+ * yourself only if** you mutate `Reel.symbolWidth`, `Reel.symbolHeight`,
484
+ * or a pin's row outside the normal MultiWays flow — e.g. a custom
485
+ * mid-spin layout swap that bypasses `AdjustPhase`.
486
+ *
487
+ * No-op for reels with no active pin overlays.
488
+ */
489
+ refreshPinOverlaysForReel(reelIndex: number): void;
490
+ /**
491
+ * Internal: build AdjustPhase pin-overlay tween descriptors for a reel.
492
+ * Captures the overlays' CURRENT on-screen Y + size as the tween's
493
+ * `from` state, then computes the post-reshape `to` state from the
494
+ * pin's already-migrated row + the upcoming cell height. Called BEFORE
495
+ * AdjustPhase commits the reshape, so the snapshot reflects what the
496
+ * player actually sees.
497
+ */
498
+ private _buildPinOverlayTweens;
499
+ /**
500
+ * Destroy a single pin's overlay, if present. Fires
501
+ * `pin:overlayDestroyed` BEFORE the overlay is released to the pool, so
502
+ * consumers can stop animations / remove listeners on a still-valid
503
+ * instance.
504
+ */
505
+ private _destroyPinOverlay;
506
+ /** Destroy every active pin overlay. Called on spin land and on destroy. */
507
+ private _destroyAllPinOverlays;
508
+ }
509
+ //# sourceMappingURL=ReelSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReelSet.d.ts","sourceRoot":"","sources":["../../src/core/ReelSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAc,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAA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