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.
- package/CHANGELOG.md +260 -0
- package/CONTRIBUTING.md +85 -0
- package/LICENSE +28 -0
- package/README.md +168 -0
- package/dist/SpineSymbol-CfVrc5Pk.js +88 -0
- package/dist/SpineSymbol-CfVrc5Pk.js.map +1 -0
- package/dist/SpineSymbol-JA5PdEbT.cjs +2 -0
- package/dist/SpineSymbol-JA5PdEbT.cjs.map +1 -0
- package/dist/cascade/CascadeAnticipationPhase.d.ts +23 -0
- package/dist/cascade/CascadeAnticipationPhase.d.ts.map +1 -0
- package/dist/cascade/DropRecipes.d.ts +40 -0
- package/dist/cascade/DropRecipes.d.ts.map +1 -0
- package/dist/config/SpeedPresets.d.ts +49 -0
- package/dist/config/SpeedPresets.d.ts.map +1 -0
- package/dist/config/defaults.d.ts +12 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/types.d.ts +296 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/Reel.d.ts +339 -0
- package/dist/core/Reel.d.ts.map +1 -0
- package/dist/core/ReelMotion.d.ts +51 -0
- package/dist/core/ReelMotion.d.ts.map +1 -0
- package/dist/core/ReelSet.d.ts +509 -0
- package/dist/core/ReelSet.d.ts.map +1 -0
- package/dist/core/ReelSetBuilder.d.ts +282 -0
- package/dist/core/ReelSetBuilder.d.ts.map +1 -0
- package/dist/core/ReelViewport.d.ts +129 -0
- package/dist/core/ReelViewport.d.ts.map +1 -0
- package/dist/core/StopSequencer.d.ts +26 -0
- package/dist/core/StopSequencer.d.ts.map +1 -0
- package/dist/debug/debug.d.ts +129 -0
- package/dist/debug/debug.d.ts.map +1 -0
- package/dist/events/EventEmitter.d.ts +25 -0
- package/dist/events/EventEmitter.d.ts.map +1 -0
- package/dist/events/ReelEvents.d.ts +125 -0
- package/dist/events/ReelEvents.d.ts.map +1 -0
- package/dist/frame/ColumnTarget.d.ts +77 -0
- package/dist/frame/ColumnTarget.d.ts.map +1 -0
- package/dist/frame/FrameBuilder.d.ts +51 -0
- package/dist/frame/FrameBuilder.d.ts.map +1 -0
- package/dist/frame/OffsetCalculator.d.ts +19 -0
- package/dist/frame/OffsetCalculator.d.ts.map +1 -0
- package/dist/frame/RandomSymbolProvider.d.ts +27 -0
- package/dist/frame/RandomSymbolProvider.d.ts.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2571 -0
- package/dist/index.js.map +1 -0
- package/dist/pins/CellPin.d.ts +140 -0
- package/dist/pins/CellPin.d.ts.map +1 -0
- package/dist/pool/ObjectPool.d.ts +36 -0
- package/dist/pool/ObjectPool.d.ts.map +1 -0
- package/dist/speed/SpeedManager.d.ts +38 -0
- package/dist/speed/SpeedManager.d.ts.map +1 -0
- package/dist/spin/SpinController.d.ts +183 -0
- package/dist/spin/SpinController.d.ts.map +1 -0
- package/dist/spin/modes/CascadeMode.d.ts +16 -0
- package/dist/spin/modes/CascadeMode.d.ts.map +1 -0
- package/dist/spin/modes/ImmediateMode.d.ts +10 -0
- package/dist/spin/modes/ImmediateMode.d.ts.map +1 -0
- package/dist/spin/modes/SpinningMode.d.ts +18 -0
- package/dist/spin/modes/SpinningMode.d.ts.map +1 -0
- package/dist/spin/modes/StandardMode.d.ts +10 -0
- package/dist/spin/modes/StandardMode.d.ts.map +1 -0
- package/dist/spin/phases/AdjustPhase.d.ts +73 -0
- package/dist/spin/phases/AdjustPhase.d.ts.map +1 -0
- package/dist/spin/phases/AnticipationPhase.d.ts +24 -0
- package/dist/spin/phases/AnticipationPhase.d.ts.map +1 -0
- package/dist/spin/phases/DropStartPhase.d.ts +21 -0
- package/dist/spin/phases/DropStartPhase.d.ts.map +1 -0
- package/dist/spin/phases/DropStopPhase.d.ts +44 -0
- package/dist/spin/phases/DropStopPhase.d.ts.map +1 -0
- package/dist/spin/phases/PhaseFactory.d.ts +32 -0
- package/dist/spin/phases/PhaseFactory.d.ts.map +1 -0
- package/dist/spin/phases/ReelPhase.d.ts +39 -0
- package/dist/spin/phases/ReelPhase.d.ts.map +1 -0
- package/dist/spin/phases/SpinPhase.d.ts +25 -0
- package/dist/spin/phases/SpinPhase.d.ts.map +1 -0
- package/dist/spin/phases/StartPhase.d.ts +26 -0
- package/dist/spin/phases/StartPhase.d.ts.map +1 -0
- package/dist/spin/phases/StopPhase.d.ts +37 -0
- package/dist/spin/phases/StopPhase.d.ts.map +1 -0
- package/dist/spine/SpineReelSymbol.d.ts +130 -0
- package/dist/spine/SpineReelSymbol.d.ts.map +1 -0
- package/dist/spine/index.d.ts +5 -0
- package/dist/spine/index.d.ts.map +1 -0
- package/dist/spine.cjs +2 -0
- package/dist/spine.cjs.map +1 -0
- package/dist/spine.js +123 -0
- package/dist/spine.js.map +1 -0
- package/dist/spotlight/SymbolSpotlight.d.ts +70 -0
- package/dist/spotlight/SymbolSpotlight.d.ts.map +1 -0
- package/dist/symbols/AnimatedSpriteSymbol.d.ts +30 -0
- package/dist/symbols/AnimatedSpriteSymbol.d.ts.map +1 -0
- package/dist/symbols/ReelSymbol.d.ts +86 -0
- package/dist/symbols/ReelSymbol.d.ts.map +1 -0
- package/dist/symbols/SpineSymbol.d.ts +34 -0
- package/dist/symbols/SpineSymbol.d.ts.map +1 -0
- package/dist/symbols/SpriteSymbol.d.ts +29 -0
- package/dist/symbols/SpriteSymbol.d.ts.map +1 -0
- package/dist/symbols/SymbolFactory.d.ts +20 -0
- package/dist/symbols/SymbolFactory.d.ts.map +1 -0
- package/dist/symbols/SymbolRegistry.d.ts +25 -0
- package/dist/symbols/SymbolRegistry.d.ts.map +1 -0
- package/dist/testing/FakeTicker.d.ts +45 -0
- package/dist/testing/FakeTicker.d.ts.map +1 -0
- package/dist/testing/HeadlessSymbol.d.ts +28 -0
- package/dist/testing/HeadlessSymbol.d.ts.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/testHarness.d.ts +97 -0
- package/dist/testing/testHarness.d.ts.map +1 -0
- package/dist/utils/Disposable.d.ts +10 -0
- package/dist/utils/Disposable.d.ts.map +1 -0
- package/dist/utils/TickerRef.d.ts +30 -0
- package/dist/utils/TickerRef.d.ts.map +1 -0
- package/dist/utils/gsapRef.d.ts +14 -0
- package/dist/utils/gsapRef.d.ts.map +1 -0
- package/dist/wins/Win.d.ts +7 -0
- package/dist/wins/Win.d.ts.map +1 -0
- package/dist/wins/WinPresenter.d.ts +100 -0
- package/dist/wins/WinPresenter.d.ts.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { Ticker } from 'pixi.js';
|
|
2
|
+
import { gsap } from 'gsap';
|
|
3
|
+
import { SpeedProfile, SymbolData, OffsetConfig, MultiWaysConfig, ReelAnchor } from '../config/types.js';
|
|
4
|
+
import { MaskStrategy } from './ReelViewport.js';
|
|
5
|
+
import { ReelSet } from './ReelSet.js';
|
|
6
|
+
import { SymbolRegistry } from '../symbols/SymbolRegistry.js';
|
|
7
|
+
import { PhaseFactory } from '../spin/phases/PhaseFactory.js';
|
|
8
|
+
import { SpinningMode } from '../spin/modes/SpinningMode.js';
|
|
9
|
+
import { FrameMiddleware } from '../frame/FrameBuilder.js';
|
|
10
|
+
import { ColumnTarget } from '../frame/ColumnTarget.js';
|
|
11
|
+
import { CascadeDropConfig } from '../cascade/DropRecipes.js';
|
|
12
|
+
/**
|
|
13
|
+
* The configurator you call before every reel set.
|
|
14
|
+
*
|
|
15
|
+
* `ReelSetBuilder` is a fluent, chainable builder: every call returns the
|
|
16
|
+
* builder so you can string setup onto one expression. It exists for two
|
|
17
|
+
* reasons — it hides the twenty-odd subsystems you'd otherwise have to
|
|
18
|
+
* wire by hand, and its `.build()` step validates that every required
|
|
19
|
+
* piece is present (throws at construction, not at first spin).
|
|
20
|
+
*
|
|
21
|
+
* Required calls (in any order): `.reels(n)`, `.visibleSymbols(n)`,
|
|
22
|
+
* `.symbolSize(w, h)`, `.symbols((registry) => ...)`, `.ticker(app.ticker)`.
|
|
23
|
+
* Optional: `.symbolGap()`, `.weights()`, `.symbolData()`, `.speed()`,
|
|
24
|
+
* `.bufferSymbols()`, `.offset()`, `.frameMiddleware()`, `.phases()`,
|
|
25
|
+
* `.spinningMode()`.
|
|
26
|
+
*
|
|
27
|
+
* Reduces ~100 lines of manual wiring to ~10 lines of configuration.
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* const reelSet = new ReelSetBuilder()
|
|
31
|
+
* .reels(5)
|
|
32
|
+
* .visibleSymbols(3)
|
|
33
|
+
* .symbolSize(200, 200)
|
|
34
|
+
* .symbols((r) => {
|
|
35
|
+
* r.register('cherry', SpriteSymbol, { textures: { cherry: tex } });
|
|
36
|
+
* })
|
|
37
|
+
* .weights({ cherry: 20 })
|
|
38
|
+
* .ticker(app.ticker)
|
|
39
|
+
* .build();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class ReelSetBuilder {
|
|
43
|
+
private _reelCount?;
|
|
44
|
+
private _visibleRows?;
|
|
45
|
+
private _symbolWidth?;
|
|
46
|
+
private _symbolHeight?;
|
|
47
|
+
private _symbolGap;
|
|
48
|
+
private _bufferSymbols;
|
|
49
|
+
private _symbolRegistry;
|
|
50
|
+
private _weights;
|
|
51
|
+
private _speeds;
|
|
52
|
+
private _initialSpeed;
|
|
53
|
+
private _offset;
|
|
54
|
+
private _ticker?;
|
|
55
|
+
private _spinningMode;
|
|
56
|
+
private _phaseFactory;
|
|
57
|
+
private _middlewares;
|
|
58
|
+
private _initialFrame?;
|
|
59
|
+
private _symbolDataOverrides;
|
|
60
|
+
private _cascadeDropConfig?;
|
|
61
|
+
private _defaultSpinMode;
|
|
62
|
+
/** Per-reel static row counts (jagged shapes like 3-5-5-5-3). */
|
|
63
|
+
private _visibleRowsPerReel?;
|
|
64
|
+
/** Per-reel pixel-box heights — used for both pyramids and MultiWays. */
|
|
65
|
+
private _reelPixelHeights?;
|
|
66
|
+
/** Vertical alignment of short reels inside the tallest reel's box. */
|
|
67
|
+
private _reelAnchor;
|
|
68
|
+
/** MultiWays configuration. Set by `.multiways(...)`. */
|
|
69
|
+
private _multiways?;
|
|
70
|
+
/** Per-reel AdjustPhase tween duration in ms (MultiWays only). */
|
|
71
|
+
private _pinMigrationDuration;
|
|
72
|
+
/** GSAP easing string used by AdjustPhase. Default: 'power2.out'. */
|
|
73
|
+
private _pinMigrationEase;
|
|
74
|
+
/** Mask strategy. Default: per-reel `RectMaskStrategy`. */
|
|
75
|
+
private _maskStrategy;
|
|
76
|
+
/** True if the user explicitly set a mask strategy (no auto-pick override). */
|
|
77
|
+
private _maskStrategyExplicit;
|
|
78
|
+
/** Set number of reel columns. */
|
|
79
|
+
reels(count: number): this;
|
|
80
|
+
/**
|
|
81
|
+
* Number of visible rows per reel (uniform across all reels).
|
|
82
|
+
* Mutually exclusive with `visibleRowsPerReel()` — calling both throws
|
|
83
|
+
* at `build()`.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* builder.reels(5).visibleRows(3) // classic 5x3
|
|
87
|
+
*/
|
|
88
|
+
visibleRows(count: number): this;
|
|
89
|
+
/**
|
|
90
|
+
* Alias of {@link visibleRows} — kept for backwards compatibility with
|
|
91
|
+
* the original API. New code should prefer `visibleRows(n)` so the
|
|
92
|
+
* naming aligns with `visibleRowsPerReel([...])` (both are about rows;
|
|
93
|
+
* the original name pre-dated jagged shapes).
|
|
94
|
+
*
|
|
95
|
+
* @deprecated Use `visibleRows(n)` instead.
|
|
96
|
+
*/
|
|
97
|
+
visibleSymbols(count: number): this;
|
|
98
|
+
/**
|
|
99
|
+
* Per-reel static row counts. Length MUST equal `reels()`. Mutually
|
|
100
|
+
* exclusive with `visibleRows()` / `visibleSymbols()` — calling both
|
|
101
|
+
* throws at `build()`.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* builder.reels(5).visibleRowsPerReel([3, 5, 5, 5, 3]) // pyramid
|
|
105
|
+
*/
|
|
106
|
+
visibleRowsPerReel(rows: number[]): this;
|
|
107
|
+
/**
|
|
108
|
+
* Per-reel pixel-box heights. Length MUST equal `reels()`.
|
|
109
|
+
*
|
|
110
|
+
* - Pyramid: defaults to `visibleRowsPerReel[i] * symbolHeight`. Override
|
|
111
|
+
* to make all reels the same height with different cell heights per
|
|
112
|
+
* reel.
|
|
113
|
+
* - MultiWays: every entry equals the same fixed reel height. Cell
|
|
114
|
+
* height per reel is derived as `reelPixelHeight / visibleRows[i]`.
|
|
115
|
+
*
|
|
116
|
+
* Precedence: when both `reelPixelHeights` and `reelAnchor` are set,
|
|
117
|
+
* `reelPixelHeights` wins — anchor is derived from the explicit boxes.
|
|
118
|
+
*/
|
|
119
|
+
reelPixelHeights(heights: number[]): this;
|
|
120
|
+
/** Vertical alignment of short reels inside the tallest reel's box. Default 'center'. */
|
|
121
|
+
reelAnchor(anchor: ReelAnchor): this;
|
|
122
|
+
/**
|
|
123
|
+
* Custom mask strategy for the viewport. Defaults to {@link RectMaskStrategy}
|
|
124
|
+
* (one clip rect per reel — clean for pyramid + uniform layouts).
|
|
125
|
+
*
|
|
126
|
+
* Use {@link SharedRectMaskStrategy} when reels have horizontal gaps
|
|
127
|
+
* AND symbols (typically big symbols) need to overlap across reel
|
|
128
|
+
* boundaries — the per-reel default would clip them at the gaps.
|
|
129
|
+
*
|
|
130
|
+
* Or pass any custom `MaskStrategy` for non-rectangular masks (rounded
|
|
131
|
+
* frames, hexagonal grids, etc.).
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* import { SharedRectMaskStrategy } from 'pixi-reels';
|
|
135
|
+
* builder.maskStrategy(new SharedRectMaskStrategy())
|
|
136
|
+
*/
|
|
137
|
+
maskStrategy(strategy: MaskStrategy): this;
|
|
138
|
+
/**
|
|
139
|
+
* Configure this slot as MultiWays: per-spin row variation. Pass minRows,
|
|
140
|
+
* maxRows, and the fixed reel pixel height. After build, call
|
|
141
|
+
* `reelSet.setShape(rowsPerReel)` mid-spin to set the next stop's shape.
|
|
142
|
+
*
|
|
143
|
+
* Mutually exclusive with big-symbol registration (`SymbolData.size`).
|
|
144
|
+
* Mutually exclusive with cascade mode in v1.
|
|
145
|
+
*/
|
|
146
|
+
multiways(config: MultiWaysConfig): this;
|
|
147
|
+
/**
|
|
148
|
+
* AdjustPhase tween duration in ms (MultiWays only). Pass a number for a
|
|
149
|
+
* uniform duration across reels, or a function `(reelIndex) => number`
|
|
150
|
+
* for per-reel control. Default: 200. Pass `0` for an instant snap (no
|
|
151
|
+
* tween).
|
|
152
|
+
*
|
|
153
|
+
* AdjustPhase plays on top of whatever stop staggering you've configured
|
|
154
|
+
* — its duration is independent of `stopDelay`.
|
|
155
|
+
*/
|
|
156
|
+
pinMigrationDuration(value: number | ((reelIndex: number) => number)): this;
|
|
157
|
+
/**
|
|
158
|
+
* GSAP easing string used by AdjustPhase tweens (MultiWays only).
|
|
159
|
+
* Applied to both the cell-resize tween and any pin-overlay migration
|
|
160
|
+
* tween. Defaults to `'power2.out'`. See gsap.com/docs/v3/Eases for
|
|
161
|
+
* the full vocabulary.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* builder.pinMigrationEase('back.out(1.4)') // pop-in feel
|
|
165
|
+
* builder.pinMigrationEase('expo.inOut') // slow start + slow end
|
|
166
|
+
*/
|
|
167
|
+
pinMigrationEase(ease: string): this;
|
|
168
|
+
/** Set symbol dimensions in pixels. */
|
|
169
|
+
symbolSize(width: number, height: number): this;
|
|
170
|
+
/** Set gap between symbols. Default: { x: 0, y: 0 }. */
|
|
171
|
+
symbolGap(x: number, y: number): this;
|
|
172
|
+
/**
|
|
173
|
+
* Set number of buffer symbols above/below the visible area. Default: 1.
|
|
174
|
+
*
|
|
175
|
+
* Buffer rows are off-screen cells the reel keeps around the visible
|
|
176
|
+
* window so symbols can fade/slide in cleanly. The motion layer's wrap
|
|
177
|
+
* detection assumes at least one buffer row above and one below — the
|
|
178
|
+
* minimum supported value is **1**. Passing `0` (or a negative number)
|
|
179
|
+
* is clamped to `1` and a single console warning is printed; the
|
|
180
|
+
* builder does not throw, so existing user code keeps running.
|
|
181
|
+
*/
|
|
182
|
+
bufferSymbols(count: number): this;
|
|
183
|
+
/** One-shot guard so we don't spam consoles when builders are constructed in a loop. */
|
|
184
|
+
private static _bufferWarnedThisProcess;
|
|
185
|
+
/** Configure symbols via a registry callback. */
|
|
186
|
+
symbols(configurator: (registry: SymbolRegistry) => void): this;
|
|
187
|
+
/** Set weights for random symbol generation. */
|
|
188
|
+
weights(weights: Record<string, number>): this;
|
|
189
|
+
/**
|
|
190
|
+
* Per-symbol metadata overrides (zIndex, unmask, or a custom weight that
|
|
191
|
+
* replaces the one from `weights()`). Merged into the final symbolsData map
|
|
192
|
+
* — any field you don't specify falls back to the default.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* .symbolData({
|
|
196
|
+
* wild: { zIndex: 5 }, // render above neighbours
|
|
197
|
+
* bonus: { zIndex: 10, unmask: true }, // render outside the reel mask
|
|
198
|
+
* })
|
|
199
|
+
*/
|
|
200
|
+
symbolData(overrides: Record<string, Partial<SymbolData>>): this;
|
|
201
|
+
/** Add a named speed profile. */
|
|
202
|
+
speed(name: string, profile: SpeedProfile): this;
|
|
203
|
+
/** Set which speed profile to use initially. Default: 'normal'. */
|
|
204
|
+
initialSpeed(name: string): this;
|
|
205
|
+
/** Set X-axis offset config (e.g., trapezoid perspective). Default: 'none'. */
|
|
206
|
+
offsetConfig(config: OffsetConfig): this;
|
|
207
|
+
/** Set the PixiJS ticker for frame updates. */
|
|
208
|
+
ticker(ticker: Ticker): this;
|
|
209
|
+
/**
|
|
210
|
+
* Inject the GSAP instance the engine should use for tweens.
|
|
211
|
+
*
|
|
212
|
+
* **When you need this:** if your app already imports `gsap` and your
|
|
213
|
+
* bundler resolves `gsap` to a different module instance than the one
|
|
214
|
+
* `pixi-reels` resolved (common with symlinked workspaces, npm-link, or
|
|
215
|
+
* misconfigured `dedupe`), every tween you start on a target the engine
|
|
216
|
+
* also tweens will fight a separate timeline. Symptoms: spotlights that
|
|
217
|
+
* render but never finish, animations that double-fire, tweens that
|
|
218
|
+
* silently drop on hidden tabs in only one of the two instances.
|
|
219
|
+
*
|
|
220
|
+
* Calling `.gsap(myGsap)` rebinds every internal phase, motion tween,
|
|
221
|
+
* pin-flight tween, and SpriteSymbol win pulse to the GSAP you pass —
|
|
222
|
+
* guaranteed to be the same instance that drives your own animations.
|
|
223
|
+
*
|
|
224
|
+
* Default: the `gsap` import resolved at the engine's own
|
|
225
|
+
* `node_modules/gsap` path. If your app and the engine resolve to the
|
|
226
|
+
* same instance (the common case in production bundles with proper
|
|
227
|
+
* `dedupe`), you do NOT need to call this.
|
|
228
|
+
*
|
|
229
|
+
* Idempotent — calling again with the same instance is a no-op. Calling
|
|
230
|
+
* with a different instance after `.build()` only affects tweens
|
|
231
|
+
* started after the swap.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* import { gsap } from 'gsap';
|
|
235
|
+
* const reelSet = new ReelSetBuilder()
|
|
236
|
+
* .reels(5).visibleRows(3).symbolSize(200, 200)
|
|
237
|
+
* .symbols(...)
|
|
238
|
+
* .ticker(app.ticker)
|
|
239
|
+
* .gsap(gsap) // ensure engine and app share one instance
|
|
240
|
+
* .build();
|
|
241
|
+
*/
|
|
242
|
+
gsap(instance: typeof gsap): this;
|
|
243
|
+
/** Set the spinning mode. Default: StandardMode. */
|
|
244
|
+
spinningMode(mode: SpinningMode): this;
|
|
245
|
+
/** Add custom frame middleware. */
|
|
246
|
+
frameMiddleware(middleware: FrameMiddleware): this;
|
|
247
|
+
/** Override default phases. */
|
|
248
|
+
phases(configurator: (factory: PhaseFactory) => void): this;
|
|
249
|
+
/**
|
|
250
|
+
* Enable cascade drop-in mechanics.
|
|
251
|
+
*
|
|
252
|
+
* Replaces the strip-spin + bounce stop cycle with a stationary wait
|
|
253
|
+
* followed by symbols dropping in from above the viewport.
|
|
254
|
+
*
|
|
255
|
+
* Usage is identical to standard spin — `spin()` / `setResult()` / `await`.
|
|
256
|
+
* Use `reelSet.setDropOrder()` to control which columns drop first.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* import { DropRecipes } from 'pixi-reels';
|
|
260
|
+
* builder.cascade(DropRecipes.cascadeDrop)
|
|
261
|
+
*/
|
|
262
|
+
cascade(config: CascadeDropConfig): this;
|
|
263
|
+
/**
|
|
264
|
+
* Set the initial symbol grid the reels show before the first spin.
|
|
265
|
+
*
|
|
266
|
+
* Two input shapes are accepted, mirroring `ReelSet.setResult`:
|
|
267
|
+
*
|
|
268
|
+
* 1. **Legacy `string[][]`** — one column per reel, row-indexed. Use
|
|
269
|
+
* `frame[col][-1]` (or `[-2]`, etc.) to target buffer-above slots,
|
|
270
|
+
* `frame[col][visibleRows]` for buffer-below.
|
|
271
|
+
* 2. **Explicit `ColumnTarget[]`** — `{ visible, bufferAbove?, bufferBelow? }`
|
|
272
|
+
* per column. Preferred when the seed comes from outside this process
|
|
273
|
+
* (JSON config, worker message, server-rendered state) — the legacy
|
|
274
|
+
* form's negative-index slots don't survive standard cloning, the
|
|
275
|
+
* explicit form does.
|
|
276
|
+
*/
|
|
277
|
+
initialFrame(frame: string[][] | ColumnTarget[]): this;
|
|
278
|
+
/** Build the ReelSet. Validates configuration and assembles all internal objects. */
|
|
279
|
+
build(): ReelSet;
|
|
280
|
+
private _validate;
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=ReelSetBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReelSetBuilder.d.ts","sourceRoot":"","sources":["../../src/core/ReelSetBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,I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AYG;IACH,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAMxC;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,IAAI;IAKtD,qFAAqF;IACrF,KAAK,IAAI,OAAO;IAwPhB,OAAO,CAAC,SAAS;CAkHlB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Container, Graphics } from 'pixi.js';
|
|
2
|
+
import { Disposable } from '../utils/Disposable.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bounding rectangle for one reel — what `MaskStrategy` builds the clip
|
|
5
|
+
* geometry from. Local to ReelViewport (origin = viewport top-left).
|
|
6
|
+
*/
|
|
7
|
+
export interface ReelMaskRect {
|
|
8
|
+
/** Left edge of the reel column (= reel.container.x). */
|
|
9
|
+
x: number;
|
|
10
|
+
/** Top edge of the reel box (= reel.offsetY). */
|
|
11
|
+
y: number;
|
|
12
|
+
/** Width of the reel column — equals one symbol cell wide. */
|
|
13
|
+
width: number;
|
|
14
|
+
/** Height of the reel box — equals reel.reelHeight. */
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Strategy for building the viewport's clip mask. Public — pass a custom
|
|
19
|
+
* implementation to `ReelSetBuilder.maskStrategy(...)` to clip the reels
|
|
20
|
+
* with any shape PixiJS Graphics can express (rounded frames, hex grids,
|
|
21
|
+
* etc.). v1 ships two strategies:
|
|
22
|
+
*
|
|
23
|
+
* - {@link RectMaskStrategy} — one rect per reel (default). Good for
|
|
24
|
+
* pyramid layouts; symbols never leak buffer rows above/below.
|
|
25
|
+
* - {@link SharedRectMaskStrategy} — single bounding-box rect spanning
|
|
26
|
+
* every reel's tallest extent. Big symbols spanning multiple reels
|
|
27
|
+
* render correctly even when reels have horizontal gaps; cross-reel
|
|
28
|
+
* overlap (e.g. a 2×2 bonus straddling reel 2 and 3 with `symbolGap.x>0`)
|
|
29
|
+
* needs this strategy.
|
|
30
|
+
*/
|
|
31
|
+
export interface MaskStrategy {
|
|
32
|
+
/** Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask. */
|
|
33
|
+
build(rects: ReelMaskRect[], totalWidth: number, totalHeight: number): Graphics;
|
|
34
|
+
/** Update the mask when reel boxes resize (e.g. MultiWays reshape). */
|
|
35
|
+
update(graphics: Graphics, rects: ReelMaskRect[], totalWidth: number, totalHeight: number): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* v1 default: a per-reel rectangular mask. Each reel is clipped to its own
|
|
39
|
+
* `(offsetY, reelHeight)` box so pyramid shapes clip cleanly without
|
|
40
|
+
* buffer-row peek above or below short reels.
|
|
41
|
+
*
|
|
42
|
+
* PixiJS masks support multiple shapes inside a single Graphics — the union
|
|
43
|
+
* of every filled shape is the visible region. So drawing one rect per reel
|
|
44
|
+
* gives the engine a jagged-but-rectangular mask without a custom shader.
|
|
45
|
+
*
|
|
46
|
+
* **Caveat:** if reels have a horizontal `symbolGap.x > 0`, a symbol that
|
|
47
|
+
* extends across the gap (e.g. a 2×2 bonus on a non-zero-gap layout) will
|
|
48
|
+
* be clipped between the columns. Use {@link SharedRectMaskStrategy} in
|
|
49
|
+
* that case, or set `symbolGap: { x: 0, y: ... }`.
|
|
50
|
+
*
|
|
51
|
+
* If `rects` is empty (the builder hasn't supplied per-reel rects yet),
|
|
52
|
+
* this falls back to a single bounding-box rect.
|
|
53
|
+
*/
|
|
54
|
+
export declare class RectMaskStrategy implements MaskStrategy {
|
|
55
|
+
build(rects: ReelMaskRect[], totalWidth: number, totalHeight: number): Graphics;
|
|
56
|
+
update(g: Graphics, rects: ReelMaskRect[], totalWidth: number, totalHeight: number): void;
|
|
57
|
+
private _draw;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Single bounding-box mask covering every reel's tallest extent. Use this
|
|
61
|
+
* when symbols need to overlap across reel boundaries — typical for slots
|
|
62
|
+
* with big symbols that span multiple columns (a 2×2 bonus, a 3×3 giant)
|
|
63
|
+
* AND a non-zero `symbolGap.x`. Per-reel rects would clip those symbols at
|
|
64
|
+
* the column gaps; a single shared rect keeps them visible.
|
|
65
|
+
*
|
|
66
|
+
* Pyramid layouts using this strategy will show buffer rows above/below
|
|
67
|
+
* short reels (the "pyramid peek" — covered by frame art in production).
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* builder.maskStrategy(new SharedRectMaskStrategy())
|
|
71
|
+
*/
|
|
72
|
+
export declare class SharedRectMaskStrategy implements MaskStrategy {
|
|
73
|
+
build(rects: ReelMaskRect[], totalWidth: number, totalHeight: number): Graphics;
|
|
74
|
+
update(g: Graphics, rects: ReelMaskRect[], totalWidth: number, totalHeight: number): void;
|
|
75
|
+
private _draw;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The clipping window + layering tricks for a reel set.
|
|
79
|
+
*
|
|
80
|
+
* The viewport is the "looking-glass" of the slot: a rectangle the size
|
|
81
|
+
* of the visible grid with a PixiJS mask so symbols scrolling above or
|
|
82
|
+
* below the visible rows are hidden. It also provides three stacking
|
|
83
|
+
* layers so win animations can break out of the mask:
|
|
84
|
+
*
|
|
85
|
+
* - `maskedContainer` — the normal place for reels. Clipped to the
|
|
86
|
+
* visible area so buffer rows never leak.
|
|
87
|
+
* - `unmaskedContainer` — rendered on top of the mask. Use for a symbol
|
|
88
|
+
* whose celebration animation expands beyond its cell (a big expanding
|
|
89
|
+
* wild, a splash frame).
|
|
90
|
+
* - `spotlightContainer` — above everything else. Win spotlight lifts
|
|
91
|
+
* winning symbols here temporarily so dim overlay + bounce don't clip.
|
|
92
|
+
*
|
|
93
|
+
* `dimOverlay` is a semi-transparent rectangle the spotlight fades in
|
|
94
|
+
* behind the promoted winners to visually push the losers into the
|
|
95
|
+
* background.
|
|
96
|
+
*/
|
|
97
|
+
export declare class ReelViewport extends Container implements Disposable {
|
|
98
|
+
readonly maskedContainer: Container;
|
|
99
|
+
readonly unmaskedContainer: Container;
|
|
100
|
+
readonly spotlightContainer: Container;
|
|
101
|
+
readonly dimOverlay: Graphics;
|
|
102
|
+
private _mask;
|
|
103
|
+
private _maskStrategy;
|
|
104
|
+
private _maskWidth;
|
|
105
|
+
private _maskHeight;
|
|
106
|
+
private _maskRects;
|
|
107
|
+
private _isDestroyed;
|
|
108
|
+
constructor(width: number, height: number, position?: {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
}, maskStrategy?: MaskStrategy);
|
|
112
|
+
/** The viewport mask bounding box width (independent of children bounds). */
|
|
113
|
+
get maskWidth(): number;
|
|
114
|
+
/** The viewport mask bounding box height. */
|
|
115
|
+
get maskHeight(): number;
|
|
116
|
+
/** Per-reel mask rects last passed to the strategy. Used by debug overlays. */
|
|
117
|
+
get maskRects(): readonly ReelMaskRect[];
|
|
118
|
+
/** Internal mask Graphics. Exposed so debug helpers can recolor it. */
|
|
119
|
+
get maskGraphics(): Graphics;
|
|
120
|
+
get isDestroyed(): boolean;
|
|
121
|
+
/** Show the dim overlay with given opacity. */
|
|
122
|
+
showDim(alpha?: number): void;
|
|
123
|
+
/** Hide the dim overlay. */
|
|
124
|
+
hideDim(): void;
|
|
125
|
+
/** Update mask size and per-reel rects. Used after pyramid/MultiWays shape changes. */
|
|
126
|
+
updateMaskSize(width: number, height: number, rects?: ReelMaskRect[]): void;
|
|
127
|
+
destroy(): void;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=ReelViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReelViewport.d.ts","sourceRoot":"","sources":["../../src/core/ReelViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,CAAC,EAAE,MAAM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;IAC3C,SAAgB,iBAAiB,EAAE,SAAS,CAAC;IAC7C,SAAgB,kBAAkB,EAAE,SAAS,CAAC;IAC9C,SAAgB,UAAU,EAAE,QAAQ,CAAC;IAErC,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,YAAY,CAAS;gBAG3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAmB,EACnD,YAAY,GAAE,YAAqC;IAoCrD,6EAA6E;IAC7E,IAAI,SAAS,IAAI,MAAM,CAA4B;IACnD,6CAA6C;IAC7C,IAAI,UAAU,IAAI,MAAM,CAA6B;IACrD,+EAA+E;IAC/E,IAAI,SAAS,IAAI,SAAS,YAAY,EAAE,CAA4B;IACpE,uEAAuE;IACvE,IAAI,YAAY,IAAI,QAAQ,CAAuB;IAEnD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,+CAA+C;IAC/C,OAAO,CAAC,KAAK,GAAE,MAAY,GAAG,IAAI;IAKlC,4BAA4B;IAC5B,OAAO,IAAI,IAAI;IAIf,uFAAuF;IACvF,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,YAAY,EAAO,GAAG,IAAI;IAO/E,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "what do I land on" queue for one reel.
|
|
3
|
+
*
|
|
4
|
+
* When a reel enters its stop phase, the `SpinController` loads the
|
|
5
|
+
* target frame (the exact list of symbol ids that should appear on
|
|
6
|
+
* screen, top-to-bottom, including the off-screen buffers). As the reel
|
|
7
|
+
* keeps scrolling downward during deceleration, every `ReelMotion` wrap
|
|
8
|
+
* event asks this sequencer for the next symbol — and it hands them back
|
|
9
|
+
* from the END of the frame first, because new symbols arrive at the
|
|
10
|
+
* top of a reel scrolling downward.
|
|
11
|
+
*
|
|
12
|
+
* After the last symbol is consumed the reel lands, and what you see on
|
|
13
|
+
* screen matches the loaded frame exactly.
|
|
14
|
+
*/
|
|
15
|
+
export declare class StopSequencer {
|
|
16
|
+
private _frame;
|
|
17
|
+
private _remaining;
|
|
18
|
+
/** Load a target frame in top-to-bottom order. */
|
|
19
|
+
setFrame(frame: string[]): void;
|
|
20
|
+
/** Deliver the next symbol (consumed from the end of the frame). */
|
|
21
|
+
next(): string;
|
|
22
|
+
get hasRemaining(): boolean;
|
|
23
|
+
get remaining(): number;
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=StopSequencer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StopSequencer.d.ts","sourceRoot":"","sources":["../../src/core/StopSequencer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,UAAU,CAAa;IAE/B,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAK/B,oEAAoE;IACpE,IAAI,IAAI,MAAM;IAQd,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ReelSet } from '../core/ReelSet.js';
|
|
2
|
+
/**
|
|
3
|
+
* Debug snapshot — plain JSON representation of the entire reel state.
|
|
4
|
+
*
|
|
5
|
+
* Designed for AI agents that cannot see the canvas.
|
|
6
|
+
* Returns no PixiJS display objects, only serializable data.
|
|
7
|
+
*
|
|
8
|
+
* **Breaking note (since v0.3):** `visibleRows` is now `number[]` (one entry
|
|
9
|
+
* per reel) so jagged shapes (pyramids, MultiWays) are representable. For
|
|
10
|
+
* uniform slots every entry is the same value. Adapt downstream code that
|
|
11
|
+
* deep-reads the snapshot.
|
|
12
|
+
*/
|
|
13
|
+
export interface DebugSnapshot {
|
|
14
|
+
timestamp: number;
|
|
15
|
+
isSpinning: boolean;
|
|
16
|
+
currentSpeed: string;
|
|
17
|
+
availableSpeeds: string[];
|
|
18
|
+
spotlightActive: boolean;
|
|
19
|
+
reelCount: number;
|
|
20
|
+
visibleRows: number[];
|
|
21
|
+
reels: DebugReelSnapshot[];
|
|
22
|
+
grid: string[][];
|
|
23
|
+
}
|
|
24
|
+
export interface DebugReelSnapshot {
|
|
25
|
+
index: number;
|
|
26
|
+
speed: number;
|
|
27
|
+
isStopping: boolean;
|
|
28
|
+
allSymbols: {
|
|
29
|
+
row: number;
|
|
30
|
+
symbolId: string;
|
|
31
|
+
y: number;
|
|
32
|
+
}[];
|
|
33
|
+
visibleSymbols: string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Take a plain-JSON snapshot of the entire reel set state.
|
|
37
|
+
*
|
|
38
|
+
* This is the primary debugging tool for AI agents. The output is
|
|
39
|
+
* a serializable object with no circular references, no PixiJS types.
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* const state = debugSnapshot(reelSet);
|
|
43
|
+
* console.log(JSON.stringify(state, null, 2));
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function debugSnapshot(reelSet: ReelSet): DebugSnapshot;
|
|
47
|
+
/**
|
|
48
|
+
* Pretty-print the grid as an ASCII table.
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
* ┌────────┬────────┬────────┬────────┬────────┐
|
|
52
|
+
* │ cherry │ lemon │ bar │ seven │ cherry │
|
|
53
|
+
* │ plum │ cherry │ wild │ lemon │ orange │
|
|
54
|
+
* │ orange │ bell │ cherry │ plum │ bell │
|
|
55
|
+
* └────────┴────────┴────────┴────────┴────────┘
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function debugGrid(reelSet: ReelSet): string;
|
|
59
|
+
/**
|
|
60
|
+
* One captured frame from `startRecording()` — a `DebugSnapshot` plus the
|
|
61
|
+
* tag the recording was started with and the spin event that triggered
|
|
62
|
+
* the capture.
|
|
63
|
+
*/
|
|
64
|
+
export interface RecordedFrame {
|
|
65
|
+
/** Recording tag at the time of capture. Useful for grouping multiple sessions. */
|
|
66
|
+
tag: string;
|
|
67
|
+
/** Reel-set event that triggered the capture (`spin:start`, `spin:allLanded`, etc). */
|
|
68
|
+
trigger: string;
|
|
69
|
+
/** Snapshot of `debugSnapshot(reelSet)` at the moment of capture. */
|
|
70
|
+
snapshot: DebugSnapshot;
|
|
71
|
+
}
|
|
72
|
+
/** Options for {@link startRecording}. */
|
|
73
|
+
export interface StartRecordingOptions {
|
|
74
|
+
/**
|
|
75
|
+
* Maximum number of frames retained across the whole process. When the
|
|
76
|
+
* buffer is full the oldest frames are dropped. Default 1000.
|
|
77
|
+
*/
|
|
78
|
+
maxFrames?: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Start recording the reel-set's frame state at every key spin event
|
|
82
|
+
* (`spin:start`, `spin:reelLanded`, `spin:allLanded`, `spin:complete`).
|
|
83
|
+
* Each event captures a `DebugSnapshot` and pushes it onto a process-
|
|
84
|
+
* wide rolling log readable via {@link getFrames}.
|
|
85
|
+
*
|
|
86
|
+
* The `tag` is freeform — use it to label multiple recording sessions
|
|
87
|
+
* so you can filter `getFrames(tag)` later. Call {@link stopRecording}
|
|
88
|
+
* to detach the listeners (also fires automatically when the reel set
|
|
89
|
+
* emits `'destroyed'`).
|
|
90
|
+
*
|
|
91
|
+
* Designed for AI agents and debug harnesses. Calling `startRecording`
|
|
92
|
+
* twice on the same `reelSet` replaces the prior recording (the previous
|
|
93
|
+
* tag's listeners are removed before the new ones attach).
|
|
94
|
+
*
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { startRecording, stopRecording, getFrames } from 'pixi-reels';
|
|
97
|
+
*
|
|
98
|
+
* startRecording(reelSet, 'spin-1');
|
|
99
|
+
* await reelSet.spin();
|
|
100
|
+
* stopRecording(reelSet);
|
|
101
|
+
* const frames = getFrames('spin-1'); // every snapshot tagged 'spin-1'
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function startRecording(reelSet: ReelSet, tag?: string, options?: StartRecordingOptions): void;
|
|
105
|
+
/** Detach the recorder previously installed by {@link startRecording}. No-op if none. */
|
|
106
|
+
export declare function stopRecording(reelSet: ReelSet): void;
|
|
107
|
+
/**
|
|
108
|
+
* All recorded frames in capture order. When `tag` is provided, only
|
|
109
|
+
* frames tagged with it are returned. Frames are not cleared between
|
|
110
|
+
* recording sessions — call {@link clearFrames} to reset.
|
|
111
|
+
*/
|
|
112
|
+
export declare function getFrames(tag?: string): readonly RecordedFrame[];
|
|
113
|
+
/** Empty the global recording log. */
|
|
114
|
+
export declare function clearFrames(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Enable debug mode: attaches debug utilities to `window.__PIXI_REELS_DEBUG`.
|
|
117
|
+
*
|
|
118
|
+
* After calling this, an AI agent can run in the browser console:
|
|
119
|
+
* ```js
|
|
120
|
+
* __PIXI_REELS_DEBUG.snapshot() // full state JSON
|
|
121
|
+
* __PIXI_REELS_DEBUG.grid() // ASCII grid
|
|
122
|
+
* __PIXI_REELS_DEBUG.log() // console.log the grid
|
|
123
|
+
* __PIXI_REELS_DEBUG.startRecording('myTag')
|
|
124
|
+
* __PIXI_REELS_DEBUG.stopRecording()
|
|
125
|
+
* __PIXI_REELS_DEBUG.getFrames('myTag')
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare function enableDebug(reelSet: ReelSet): void;
|
|
129
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.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GAuBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,SAAY,EACf,OAAO,GAAE,qBAA0B,GAClC,IAAI,CAqCN;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAMpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,aAAa,EAAE,CAGhE;AAED,sCAAsC;AACtC,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqElD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight typed event emitter with zero dependencies.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* ```ts
|
|
6
|
+
* interface MyEvents {
|
|
7
|
+
* 'foo': [x: number, y: string];
|
|
8
|
+
* 'bar': [];
|
|
9
|
+
* }
|
|
10
|
+
* const emitter = new EventEmitter<MyEvents>();
|
|
11
|
+
* emitter.on('foo', (x, y) => console.log(x, y));
|
|
12
|
+
* emitter.emit('foo', 42, 'hello');
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class EventEmitter<TEvents extends Record<string, unknown[]>> {
|
|
16
|
+
private _listeners;
|
|
17
|
+
on<K extends keyof TEvents>(event: K, fn: (...args: TEvents[K]) => void, context?: unknown): this;
|
|
18
|
+
once<K extends keyof TEvents>(event: K, fn: (...args: TEvents[K]) => void, context?: unknown): this;
|
|
19
|
+
off<K extends keyof TEvents>(event: K, fn?: (...args: TEvents[K]) => void, context?: unknown): this;
|
|
20
|
+
emit<K extends keyof TEvents>(event: K, ...args: TEvents[K]): boolean;
|
|
21
|
+
removeAllListeners(event?: keyof TEvents): this;
|
|
22
|
+
listenerCount(event: keyof TEvents): number;
|
|
23
|
+
private _add;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=EventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../src/events/EventEmitter.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACjE,OAAO,CAAC,UAAU,CAA6C;IAE/D,EAAE,CAAC,CAAC,SAAS,MAAM,OAAO,EACxB,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EACjC,OAAO,CAAC,EAAE,OAAO,GAChB,IAAI;IAIP,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAC1B,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EACjC,OAAO,CAAC,EAAE,OAAO,GAChB,IAAI;IAIP,GAAG,CAAC,CAAC,SAAS,MAAM,OAAO,EACzB,KAAK,EAAE,CAAC,EACR,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAClC,OAAO,CAAC,EAAE,OAAO,GAChB,IAAI;IAoBP,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO;IAerE,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI;IAS/C,aAAa,CAAC,KAAK,EAAE,MAAM,OAAO,GAAG,MAAM;IAI3C,OAAO,CAAC,IAAI;CAcb"}
|