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,339 @@
1
+ import { Container } from 'pixi.js';
2
+ import { Disposable } from '../utils/Disposable.js';
3
+ import { ReelSymbol } from '../symbols/ReelSymbol.js';
4
+ import { SymbolFactory } from '../symbols/SymbolFactory.js';
5
+ import { SymbolData } from '../config/types.js';
6
+ import { ReelMotion } from './ReelMotion.js';
7
+ import { StopSequencer } from './StopSequencer.js';
8
+ import { EventEmitter } from '../events/EventEmitter.js';
9
+ import { ReelEvents } from '../events/ReelEvents.js';
10
+ import { RandomSymbolProvider } from '../frame/RandomSymbolProvider.js';
11
+ import { ReelViewport } from './ReelViewport.js';
12
+ import { SpinningMode } from '../spin/modes/SpinningMode.js';
13
+ export interface ReelConfig {
14
+ reelIndex: number;
15
+ visibleRows: number;
16
+ bufferAbove: number;
17
+ bufferBelow: number;
18
+ symbolWidth: number;
19
+ symbolHeight: number;
20
+ symbolGapX: number;
21
+ symbolGapY: number;
22
+ symbolsData: Record<string, SymbolData>;
23
+ initialSymbols: string[];
24
+ /**
25
+ * Y offset of this reel relative to the viewport's top edge. Set by the
26
+ * builder so jagged shapes (pyramids) align according to `reelAnchor`.
27
+ * Default 0.
28
+ */
29
+ offsetY?: number;
30
+ /**
31
+ * Pixel height of this reel's box. Used for MultiWays cell-height
32
+ * derivation (`reelHeight / visibleRows`). Defaults to
33
+ * `visibleRows * symbolHeight`.
34
+ */
35
+ reelHeight?: number;
36
+ /**
37
+ * SPIN-time uniform cell height. During SPIN every reel uses this same
38
+ * height. AdjustPhase later swaps to per-reel `reelHeight / visibleRows`.
39
+ * Defaults to `symbolHeight`.
40
+ */
41
+ spinSymbolHeight?: number;
42
+ }
43
+ /**
44
+ * Internal sentinel marking non-anchor cells of a big symbol's block.
45
+ * Never crosses the public API — `getVisibleSymbols()` resolves it to the
46
+ * anchor's id.
47
+ */
48
+ export declare const OCCUPIED_SENTINEL = "__pixi_reels_occupied__";
49
+ /**
50
+ * One vertical column of a slot board.
51
+ *
52
+ * A `Reel` owns:
53
+ * - the `ReelSymbol[]` currently on screen (a small buffer above the
54
+ * visible rows + the visible rows + a small buffer below — so symbols
55
+ * can fade in from off-screen cleanly)
56
+ * - the `ReelMotion` that adds a Y delta each tick and wraps symbols
57
+ * that scroll off the ends
58
+ * - a `StopSequencer` — the queue of target symbols the reel still has
59
+ * to land on before it can stop
60
+ *
61
+ * You generally do not touch a `Reel` directly. Drive the `ReelSet` and
62
+ * let it fan out. Reels are exposed on `reelSet.reels` so you can read
63
+ * the current grid (`reel.getSymbolAt(row)`) or listen to per-reel
64
+ * events (`phase:enter`, `landed`, `symbol:created`, ...).
65
+ */
66
+ export declare class Reel implements Disposable {
67
+ readonly container: Container;
68
+ readonly events: EventEmitter<ReelEvents>;
69
+ readonly reelIndex: number;
70
+ /** Current symbols in order (top buffer → visible → bottom buffer). */
71
+ symbols: ReelSymbol[];
72
+ /** Current spin speed (pixels per frame). Set by phases. */
73
+ speed: number;
74
+ /** Current spinning mode. */
75
+ spinningMode: SpinningMode;
76
+ readonly motion: ReelMotion;
77
+ readonly stopSequencer: StopSequencer;
78
+ private _symbolFactory;
79
+ private _randomProvider;
80
+ private _viewport;
81
+ private _symbolsData;
82
+ private _visibleRows;
83
+ private _bufferAbove;
84
+ private _symbolWidth;
85
+ private _symbolHeight;
86
+ private _offsetY;
87
+ private _reelHeight;
88
+ private _spinSymbolHeight;
89
+ private _symbolGapY;
90
+ private _symbolGapX;
91
+ private _isDestroyed;
92
+ private _isStopping;
93
+ /**
94
+ * Internal stub instances reused for OCCUPIED cells inside a big-symbol
95
+ * block. Allocated on demand (one per concurrent OCCUPIED cell on this
96
+ * reel), never pooled through `SymbolFactory`. The views are invisible —
97
+ * the anchor symbol is sized up to cover the whole block.
98
+ */
99
+ private _occupiedStubs;
100
+ /**
101
+ * Per-row marker recording which rows are non-anchor cells of a big
102
+ * symbol. Populated when frames are placed; consulted by `getVisibleSymbols`
103
+ * and `getSymbolAt` so anchor identity propagates through the block.
104
+ *
105
+ * Indexed by visible-row 0..visibleRows-1. Each entry is `null` for a
106
+ * normal cell, or `{ anchorRow }` for a cell occupied by another row's
107
+ * anchor.
108
+ */
109
+ private _occupancy;
110
+ /**
111
+ * Optional resolver for cross-reel OCCUPIED cells. Set by `ReelSet` so
112
+ * `getVisibleSymbols()` returns the anchor's id even when the anchor
113
+ * lives on a different reel (a 2×2 bonus straddles cols c, c+1).
114
+ * Without it, cross-reel OCCUPIED cells return the OCCUPIED sentinel.
115
+ */
116
+ private _crossReelResolver;
117
+ constructor(config: ReelConfig, symbolFactory: SymbolFactory, randomProvider: RandomSymbolProvider, viewport: ReelViewport);
118
+ get isDestroyed(): boolean;
119
+ get isStopping(): boolean;
120
+ set isStopping(value: boolean);
121
+ get bufferAbove(): number;
122
+ get bufferBelow(): number;
123
+ get visibleRows(): number;
124
+ /** The symbol cell width (in pixels). Constant for the reel's lifetime. */
125
+ get symbolWidth(): number;
126
+ /**
127
+ * The symbol cell height (in pixels). Mutates on MultiWays reshape via
128
+ * `reshape()`. During SPIN this still equals `spinSymbolHeight`; the
129
+ * per-reel target value comes into effect when AdjustPhase commits the
130
+ * reshape. For non-MultiWays slots this is constant for the reel's lifetime.
131
+ */
132
+ get symbolHeight(): number;
133
+ /** Pixel height of this reel's box. Set by builder, immutable. */
134
+ get reelHeight(): number;
135
+ /** Y offset of this reel relative to the viewport top. Set by builder, immutable. */
136
+ get offsetY(): number;
137
+ /**
138
+ * SPIN-time uniform cell height. All reels in a slot use this value during
139
+ * the SPIN phase regardless of their per-reel `symbolHeight`. Frozen at
140
+ * construction.
141
+ */
142
+ get spinSymbolHeight(): number;
143
+ /** Update reel for one frame. Called by SpinController via ticker. */
144
+ update(deltaMs: number): void;
145
+ /** Set the target frame for stopping. */
146
+ setStopFrame(frame: string[]): void;
147
+ /**
148
+ * Get visible symbol IDs (top to bottom, excluding buffers).
149
+ *
150
+ * Big-symbol cells resolve to the anchor's id — both **same-reel**
151
+ * (the anchor lives on this reel) and **cross-reel** (the anchor is on
152
+ * a leftward reel of a wider block). The cross-reel resolver is
153
+ * injected by `ReelSet`; without it, cross-reel OCCUPIED cells would
154
+ * return the OCCUPIED sentinel, which is the only difference vs.
155
+ * `ReelSet.getVisibleGrid()`. With the resolver wired, the two are
156
+ * equivalent for any reel — `reels.map(r => r.getVisibleSymbols())`
157
+ * matches `reelSet.getVisibleGrid()`.
158
+ */
159
+ getVisibleSymbols(): string[];
160
+ /**
161
+ * Internal: register a callback used to resolve cross-reel OCCUPIED
162
+ * cells to the originating big-symbol's id. Wired by `ReelSet` so this
163
+ * reel can answer "what id is at (myCol, row)?" even when the anchor is
164
+ * on a different reel.
165
+ *
166
+ * @internal
167
+ */
168
+ setCrossReelResolver(resolver: ((col: number, row: number) => string) | null): void;
169
+ /**
170
+ * Get symbol at a visible row (0-indexed from top visible).
171
+ * For non-anchor cells of a big symbol, walks up to the anchor row and
172
+ * returns the anchor symbol so animations target the actual visual.
173
+ */
174
+ getSymbolAt(visibleRow: number): ReelSymbol;
175
+ /**
176
+ * Anchor row for a visible row. Equals `visibleRow` for normal cells;
177
+ * for non-anchor cells inside a big-symbol block, returns the row where
178
+ * the anchor lives.
179
+ *
180
+ * @internal — used by `ReelSet.getSymbolFootprint` and the cross-reel
181
+ * resolver wired in `ReelSet`'s constructor. Not intended for consumer
182
+ * use; prefer `ReelSet.getSymbolFootprint(col, row)` which returns full
183
+ * anchor + size info.
184
+ */
185
+ _getAnchorRow(visibleRow: number): number;
186
+ /**
187
+ * Record that the given visible row is the non-anchor cell of a big
188
+ * symbol whose anchor lives at `anchorRow`. Pass `null` to clear the
189
+ * occupancy mark.
190
+ *
191
+ * @internal — called by `_finalizeFrame` and the big-symbol coordinator.
192
+ */
193
+ _setOccupancy(visibleRow: number, anchorRow: number | null): void;
194
+ /** Notify all visible symbols that the reel has started spinning. */
195
+ notifySpinStart(): void;
196
+ /** Notify all visible symbols that the reel is about to stop (just before bounce). */
197
+ notifySpinEnd(): void;
198
+ /** Notify all visible symbols that the reel has landed on its target. */
199
+ notifyLanded(): void;
200
+ /**
201
+ * Snap all symbols to grid and finalize big-symbol layout. Called at the
202
+ * end of every stop sequence.
203
+ */
204
+ snapToGrid(): void;
205
+ /**
206
+ * Swap the symbol at a single visible row in-place, without restarting
207
+ * the spin or rebuilding the rest of the strip.
208
+ *
209
+ * Useful for live presentation effects at rest — converting a wild
210
+ * after a cascade pop, swapping to a sticky variant after a win —
211
+ * without going through the full `placeSymbols` / `setResult` paths.
212
+ *
213
+ * The symbol's `zIndex`, parent (masked vs unmasked), and visual state
214
+ * are reset by `_replaceSymbol` so callers don't need to follow up
215
+ * with `refreshZIndex`. The motion layer is **not** snapped — call
216
+ * `snapToGrid()` separately if you need to re-grid.
217
+ *
218
+ * Throws if:
219
+ * - the reel is currently moving (`speed !== 0` or `isStopping`).
220
+ * A mid-spin swap would be overwritten by the next wrap/stop frame
221
+ * anyway; the fail-loud throw spares the caller the silent loss.
222
+ * - `visibleRow` is out of `[0, visibleRows)`.
223
+ * - `symbolId` is not registered.
224
+ * - the row is a non-anchor cell of an existing big-symbol block.
225
+ * - the row currently holds the anchor of a big-symbol block — big
226
+ * blocks span multiple cells (and possibly reels) and require
227
+ * `placeSymbols` + the cross-reel OCCUPIED coordinator.
228
+ * - `symbolId` itself is a big symbol — same reason.
229
+ *
230
+ * Pin overlap is **not** detected at this layer (Reel doesn't see the
231
+ * pin map). Use `ReelSet.setSymbolAt(col, row, id)` for the safe
232
+ * caller-facing surface that also throws on pinned cells.
233
+ */
234
+ setSymbolAt(visibleRow: number, symbolId: string): void;
235
+ /**
236
+ * Place symbols immediately at target positions (for skip/turbo).
237
+ *
238
+ * `symbolIds[0..n-1]` is the visible area. `symbolIds[n..]` (if present)
239
+ * targets buffer-below slots. Buffer-above slots are addressed via
240
+ * negative-index string properties: `symbolIds[-1]` is the slot closest to
241
+ * the visible top row, `symbolIds[-bufferAbove]` the furthest above.
242
+ * Unset slots are filled with random symbols, matching the previous
243
+ * behaviour when only visible-area entries were provided.
244
+ */
245
+ placeSymbols(symbolIds: string[]): void;
246
+ /**
247
+ * @internal — MultiWays orchestration only.
248
+ *
249
+ * Commit a new visible-row count and per-reel cell height. Resizes every
250
+ * existing symbol on the strip to the new cell height, rebuilds the
251
+ * symbol array (extending or truncating buffers as needed), reshapes the
252
+ * motion layer, and recomputes `_reelHeight` from the new geometry so
253
+ * `reelHeight` stays consistent. Idempotent if the shape doesn't change.
254
+ *
255
+ * Only the engine should call this — `SpinController._applyReshape` is
256
+ * the single source of truth for reshape orchestration. Direct external
257
+ * calls are unsupported and may leave pin overlays, the cross-reel
258
+ * resolver, and the parent `ReelSet`'s shape state out of sync. Use
259
+ * `ReelSet.setShape()` instead, which gates this method on a MultiWays
260
+ * slot and migrates pins atomically.
261
+ */
262
+ reshape(newVisibleRows: number, newSymbolHeight: number, bufferAbove: number, bufferBelow: number): void;
263
+ /**
264
+ * Compute the canonical zIndex for a single symbol view at a given
265
+ * array index. Centralizes the formula used by both `refreshZIndex`
266
+ * (full rescan) and the per-swap activate path (so newly placed
267
+ * symbols land with their correct zIndex without the caller needing
268
+ * to remember to call `refreshZIndex` afterwards).
269
+ */
270
+ private _computeSymbolZIndex;
271
+ /**
272
+ * Recompute `zIndex` for every symbol in the reel.
273
+ *
274
+ * Formula: `symbolData.zIndex ?? 0` (scaled by 100 to leave room for row
275
+ * ordering), plus the symbol's current array index — so bottom-row symbols
276
+ * render in front of top-row symbols and any symbol with a higher
277
+ * configured base zIndex (e.g. wild, bonus) renders above its neighbors.
278
+ *
279
+ * Called automatically after wraps, snaps, and direct placement. Also
280
+ * called inline by `_replaceSymbol` for the single newly-placed symbol —
281
+ * so consumers who swap one symbol at a time (via the public APIs that
282
+ * funnel into `_replaceSymbol`) get correct layering for free, no
283
+ * manual `refreshZIndex` required. Call it manually after mutating
284
+ * `symbolsData.zIndex` at runtime.
285
+ */
286
+ refreshZIndex(): void;
287
+ destroy(): void;
288
+ /**
289
+ * Whether the symbol with this id has `unmask: true` in its data — i.e.
290
+ * its view should be parented to `viewport.unmaskedContainer` to render
291
+ * above the reel mask.
292
+ */
293
+ private _isUnmasked;
294
+ /**
295
+ * Pick the right parent container for a symbol view based on its
296
+ * `unmask` flag. Unmasked symbols sit in `viewport.unmaskedContainer`
297
+ * (above the reel mask); everything else lives in this reel's own
298
+ * container (which is itself inside `viewport.maskedContainer`).
299
+ */
300
+ private _parentForSymbolId;
301
+ /**
302
+ * Position a symbol view at a given reel-local Y, choosing X and any
303
+ * parent-translation offset based on whether the symbol is unmasked.
304
+ *
305
+ * Unmasked views live in `viewport.unmaskedContainer` (at viewport
306
+ * (0,0)), so we add `reel.container.x` and `reel.container.y` to keep
307
+ * the at-rest cell position aligned with the reel column. Masked views
308
+ * live in `this.container`, so reel-local coords map directly.
309
+ */
310
+ private _placeSymbolView;
311
+ /**
312
+ * Convert a view's current y back to reel-local coords. The view may
313
+ * be parented to either `this.container` (already reel-local) or
314
+ * `viewport.unmaskedContainer` (viewport-local — needs the reel offset
315
+ * subtracted).
316
+ */
317
+ private _toReelLocalY;
318
+ private _setupSymbolPositions;
319
+ private _onSymbolWrapped;
320
+ private _replaceSymbol;
321
+ /**
322
+ * Acquire an OCCUPIED stub. Reuses any free stub stored locally; allocates
323
+ * a new one if none are available. Stubs are never returned to
324
+ * `SymbolFactory`.
325
+ */
326
+ private _acquireOccupiedStub;
327
+ private _releaseOccupiedStub;
328
+ /**
329
+ * After the visible target frame has been placed, scan visible rows to
330
+ * size big-symbol anchors and populate the OCCUPIED occupancy map.
331
+ *
332
+ * Called from `snapToGrid` and `placeSymbols` so it runs both for normal
333
+ * stop landing AND for skip/turbo. For non-anchor rows of a block, the
334
+ * anchor symbol is sized to span the block; the OCCUPIED stub at that
335
+ * row stays invisible underneath.
336
+ */
337
+ private _finalizeFrame;
338
+ }
339
+ //# sourceMappingURL=Reel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Reel.d.ts","sourceRoot":"","sources":["../../src/core/Reel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAA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IACH,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,qBAAqB;IAgB7B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,cAAc;IAwFtB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,oBAAoB;IAI5B;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;CA2BvB"}
@@ -0,0 +1,51 @@
1
+ import { ReelSymbol } from '../symbols/ReelSymbol.js';
2
+ /**
3
+ * The physics of one reel — move symbols down, wrap them around.
4
+ *
5
+ * Every frame, `ReelMotion.update(delta)` adds `delta` to each symbol's
6
+ * Y coordinate. A symbol whose position falls off the bottom wraps back
7
+ * to the top (and vice versa — reels can run upward). Each wrap fires
8
+ * the `_onSymbolWrapped` callback so the owning `Reel` can ask the
9
+ * `FrameBuilder` for the next identity to paint on it.
10
+ *
11
+ * Maintains the invariant that `_symbols[0]` is always the visually
12
+ * topmost symbol and `_symbols[N-1]` is always the bottommost. On each
13
+ * wrap, the wrapping symbol is moved to the front (or back) of the array
14
+ * so the ordering stays consistent with the grid. `snapToGrid` and the
15
+ * visible window selection rely on this.
16
+ */
17
+ export declare class ReelMotion {
18
+ private _symbols;
19
+ private _bufferAbove;
20
+ private _onSymbolWrapped;
21
+ private _symbolHeight;
22
+ private _symbolGapY;
23
+ private _slotHeight;
24
+ private _minY;
25
+ private _maxY;
26
+ constructor(_symbols: ReelSymbol[], symbolHeight: number, symbolGapY: number, _bufferAbove: number, visibleRows: number, _onSymbolWrapped: (symbol: ReelSymbol, arrayIndex: number, direction: 'up' | 'down') => void);
27
+ /**
28
+ * Move all symbols by deltaY pixels (positive = downward).
29
+ * At most one wrap per call (deltaY is capped at half a symbol by the
30
+ * spinning mode, so a single symbol can cross the boundary per tick).
31
+ */
32
+ displace(deltaY: number): void;
33
+ /** Snap all symbols to their correct grid positions (array index = visual row). */
34
+ snapToGrid(): void;
35
+ /** Position all symbols above the visible area (for cascade mode start). */
36
+ setToTopPosition(): void;
37
+ /** Get the correct Y position for a symbol at a given row. */
38
+ getRowY(row: number): number;
39
+ get slotHeight(): number;
40
+ /**
41
+ * Reshape the motion layer for a new visible-row count and cell height.
42
+ * Recomputes wrap bounds and the slot height. Called by `Reel.reshape()`
43
+ * during AdjustPhase on MultiWays slots. The symbol array is re-bound by
44
+ * `Reel.reshape()` directly via the same array reference, so this method
45
+ * doesn't take a new array.
46
+ */
47
+ reshape(symbolHeight: number, symbolGapY: number, bufferAbove: number, visibleRows: number): void;
48
+ private _wrapBottomToTop;
49
+ private _wrapTopToBottom;
50
+ }
51
+ //# sourceMappingURL=ReelMotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReelMotion.d.ts","sourceRoot":"","sources":["../../src/core/ReelMotion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,UAAU;IAQnB,OAAO,CAAC,QAAQ;IAGhB,OAAO,CAAC,YAAY;IAEpB,OAAO,CAAC,gBAAgB;IAZ1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;gBAGZ,QAAQ,EAAE,UAAU,EAAE,EAC9B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,EAC5B,WAAW,EAAE,MAAM,EACX,gBAAgB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,MAAM,KAAK,IAAI;IAStG;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAY9B,mFAAmF;IACnF,UAAU,IAAI,IAAI;IAOlB,4EAA4E;IAC5E,gBAAgB,IAAI,IAAI;IAMxB,8DAA8D;IAC9D,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI5B,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;;;;OAMG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IASjG,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,gBAAgB;CAUzB"}