@energy8platform/game-engine 0.10.11 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -74
- package/dist/index.cjs.js +1280 -296
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +362 -46
- package/dist/index.esm.js +1281 -298
- package/dist/index.esm.js.map +1 -1
- package/dist/lua.cjs.js +8 -18
- package/dist/lua.cjs.js.map +1 -1
- package/dist/lua.d.ts +0 -2
- package/dist/lua.esm.js +8 -18
- package/dist/lua.esm.js.map +1 -1
- package/dist/react.cjs.js +2372 -11
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.d.ts +17 -6
- package/dist/react.esm.js +2372 -12
- package/dist/react.esm.js.map +1 -1
- package/dist/ui.cjs.js +1553 -632
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.d.ts +374 -46
- package/dist/ui.esm.js +1553 -634
- package/dist/ui.esm.js.map +1 -1
- package/dist/vite.cjs.js +1 -11
- package/dist/vite.cjs.js.map +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.esm.js +1 -11
- package/dist/vite.esm.js.map +1 -1
- package/package.json +3 -18
- package/src/index.ts +3 -3
- package/src/lua/LuaEngine.ts +8 -18
- package/src/react/applyProps.ts +86 -0
- package/src/react/extendAll.ts +27 -6
- package/src/react/index.ts +1 -1
- package/src/react/jsx.d.ts +222 -0
- package/src/react/reconciler.ts +22 -5
- package/src/ui/BalanceDisplay.ts +31 -38
- package/src/ui/Button.ts +217 -53
- package/src/ui/FlexContainer.ts +479 -0
- package/src/ui/Label.ts +13 -0
- package/src/ui/Layout.ts +86 -87
- package/src/ui/Modal.ts +11 -1
- package/src/ui/Panel.ts +108 -36
- package/src/ui/ProgressBar.ts +85 -31
- package/src/ui/ScrollContainer.ts +397 -45
- package/src/ui/Toast.ts +47 -17
- package/src/ui/WinDisplay.ts +51 -39
- package/src/ui/index.ts +5 -11
- package/src/ui/view.ts +28 -0
- package/src/vite/index.ts +1 -11
package/dist/ui.d.ts
CHANGED
|
@@ -1,12 +1,148 @@
|
|
|
1
1
|
import { Texture, Container, TextStyle, ColorSource } from 'pixi.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Universal view input type for UI component visual slots.
|
|
5
|
+
*
|
|
6
|
+
* - `string` — texture name, resolved via `Sprite.from()`
|
|
7
|
+
* - `Texture` — wrapped in a `Sprite`
|
|
8
|
+
* - `Container` — used as-is (Sprite, Graphics, NineSliceSprite, AnimatedSprite, custom...)
|
|
9
|
+
*/
|
|
10
|
+
type ViewInput = string | Texture | Container;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a ViewInput to a Container instance.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* resolveView('btn-idle') // → Sprite.from('btn-idle')
|
|
17
|
+
* resolveView(someTexture) // → new Sprite(someTexture)
|
|
18
|
+
* resolveView(myCustomContainer) // → myCustomContainer (as-is)
|
|
19
|
+
* resolveView(undefined) // → null
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare function resolveView(input: ViewInput | undefined | null): Container | null;
|
|
23
|
+
|
|
24
|
+
type FlexDirection = 'row' | 'column';
|
|
25
|
+
type JustifyContent = 'start' | 'center' | 'end' | 'space-between' | 'space-around';
|
|
26
|
+
type AlignItems = 'start' | 'center' | 'end' | 'stretch';
|
|
27
|
+
interface FlexItemConfig {
|
|
28
|
+
/** Flex grow factor (0 = fixed size) */
|
|
29
|
+
flexGrow?: number;
|
|
30
|
+
/** Explicit width override for layout calculations */
|
|
31
|
+
layoutWidth?: number;
|
|
32
|
+
/** Explicit height override for layout calculations */
|
|
33
|
+
layoutHeight?: number;
|
|
34
|
+
}
|
|
35
|
+
interface FlexContainerConfig {
|
|
36
|
+
/** Layout direction (default: 'row') */
|
|
37
|
+
direction?: FlexDirection;
|
|
38
|
+
/** Main-axis distribution (default: 'start') */
|
|
39
|
+
justifyContent?: JustifyContent;
|
|
40
|
+
/** Cross-axis alignment (default: 'start') */
|
|
41
|
+
alignItems?: AlignItems;
|
|
42
|
+
/** Gap between children in pixels (default: 0) */
|
|
43
|
+
gap?: number;
|
|
44
|
+
/** Padding [top, right, bottom, left] or single number (default: 0) */
|
|
45
|
+
padding?: number | [number, number, number, number];
|
|
46
|
+
/** Enable wrapping to next line (default: false) */
|
|
47
|
+
flexWrap?: boolean;
|
|
48
|
+
/** Maximum width before wrapping (only with flexWrap) */
|
|
49
|
+
maxWidth?: number;
|
|
50
|
+
/** Maximum height before wrapping (only with flexWrap + column) */
|
|
51
|
+
maxHeight?: number;
|
|
52
|
+
/** Explicit container width (used for cross-axis alignment/stretch) */
|
|
53
|
+
width?: number;
|
|
54
|
+
/** Explicit container height (used for cross-axis alignment/stretch) */
|
|
55
|
+
height?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Lightweight flexbox-like layout container for PixiJS.
|
|
59
|
+
*
|
|
60
|
+
* Supports row/column direction, justify/align, gap, padding, wrapping,
|
|
61
|
+
* and flex-grow distribution. Zero external dependencies.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const toolbar = new FlexContainer({
|
|
66
|
+
* direction: 'row',
|
|
67
|
+
* justifyContent: 'space-between',
|
|
68
|
+
* alignItems: 'center',
|
|
69
|
+
* gap: 16,
|
|
70
|
+
* padding: 12,
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* toolbar.addFlexChild(button1);
|
|
74
|
+
* toolbar.addFlexChild(button2);
|
|
75
|
+
* toolbar.resize(800, 60);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare class FlexContainer extends Container {
|
|
79
|
+
readonly __uiComponent: true;
|
|
80
|
+
private _config;
|
|
81
|
+
private _padding;
|
|
82
|
+
private _maxWidth;
|
|
83
|
+
private _maxHeight;
|
|
84
|
+
/** @internal */ _explicitWidth: number;
|
|
85
|
+
/** @internal */ _explicitHeight: number;
|
|
86
|
+
private _layoutChildren;
|
|
87
|
+
private _layoutDirty;
|
|
88
|
+
constructor(config?: FlexContainerConfig);
|
|
89
|
+
/** Add a child with optional flex config. Also registers in flex layout. */
|
|
90
|
+
addFlexChild(child: Container, flexConfig?: FlexItemConfig): this;
|
|
91
|
+
/** Remove a child from flex layout and display list */
|
|
92
|
+
removeFlexChild(child: Container): this;
|
|
93
|
+
/** Remove all flex children */
|
|
94
|
+
clearFlexChildren(): this;
|
|
95
|
+
/**
|
|
96
|
+
* Override addChild so children automatically participate in flex layout.
|
|
97
|
+
* This enables declarative usage from React JSX.
|
|
98
|
+
*/
|
|
99
|
+
addChild<T extends Container>(...children: T[]): T;
|
|
100
|
+
removeChild<T extends Container>(...children: T[]): T;
|
|
101
|
+
/** Get all flex layout children (read-only) */
|
|
102
|
+
get flexChildren(): readonly Container[];
|
|
103
|
+
/** Update the container size and recalculate layout */
|
|
104
|
+
resize(width: number, height: number): void;
|
|
105
|
+
/** Update layout direction */
|
|
106
|
+
setDirection(direction: FlexDirection): void;
|
|
107
|
+
/** Update justifyContent */
|
|
108
|
+
setJustifyContent(justify: JustifyContent): void;
|
|
109
|
+
/** Update alignItems */
|
|
110
|
+
setAlignItems(align: AlignItems): void;
|
|
111
|
+
/** Update gap */
|
|
112
|
+
setGap(gap: number): void;
|
|
113
|
+
/** Update padding */
|
|
114
|
+
setPadding(padding: number | [number, number, number, number]): void;
|
|
115
|
+
/**
|
|
116
|
+
* Recalculate and apply layout positions for all children.
|
|
117
|
+
* Called automatically by `resize()`. Call manually after
|
|
118
|
+
* adding/removing children without resize.
|
|
119
|
+
*/
|
|
120
|
+
updateLayout(): void;
|
|
121
|
+
/** Computed content size (after layout) */
|
|
122
|
+
getContentSize(): {
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
};
|
|
126
|
+
/** React reconciler update hook — applies changed config props */
|
|
127
|
+
updateConfig(changed: Record<string, any>): void;
|
|
128
|
+
destroy(options?: boolean | {
|
|
129
|
+
children?: boolean;
|
|
130
|
+
texture?: boolean;
|
|
131
|
+
textureSource?: boolean;
|
|
132
|
+
}): void;
|
|
133
|
+
}
|
|
4
134
|
|
|
5
135
|
type ButtonState = 'default' | 'hover' | 'pressed' | 'disabled';
|
|
6
136
|
interface ButtonConfig {
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
/**
|
|
137
|
+
/** Custom view for default state (string texture name, Texture, or Container) */
|
|
138
|
+
defaultView?: ViewInput;
|
|
139
|
+
/** Custom view for hover state */
|
|
140
|
+
hoverView?: ViewInput;
|
|
141
|
+
/** Custom view for pressed state */
|
|
142
|
+
pressedView?: ViewInput;
|
|
143
|
+
/** Custom view for disabled state */
|
|
144
|
+
disabledView?: ViewInput;
|
|
145
|
+
/** Width (for Graphics-based button, ignored when custom views provided) */
|
|
10
146
|
width?: number;
|
|
11
147
|
/** Height (for Graphics-based button) */
|
|
12
148
|
height?: number;
|
|
@@ -20,67 +156,138 @@ interface ButtonConfig {
|
|
|
20
156
|
animationDuration?: number;
|
|
21
157
|
/** Start disabled */
|
|
22
158
|
disabled?: boolean;
|
|
23
|
-
/** Button text */
|
|
159
|
+
/** Button text (rendered on top of the view) */
|
|
24
160
|
text?: string;
|
|
25
161
|
/** Button text style */
|
|
26
162
|
textStyle?: Record<string, unknown>;
|
|
163
|
+
/** Press callback */
|
|
164
|
+
onPress?: () => void;
|
|
27
165
|
}
|
|
28
166
|
/**
|
|
29
|
-
* Interactive button
|
|
167
|
+
* Interactive button with per-state custom views and animations.
|
|
30
168
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
169
|
+
* Each visual state accepts a `ViewInput`: texture name, Texture, or any Container
|
|
170
|
+
* (Sprite, NineSliceSprite, AnimatedSprite, custom artwork, etc).
|
|
171
|
+
* Falls back to colored Graphics when no custom view is provided.
|
|
33
172
|
*
|
|
34
173
|
* @example
|
|
35
174
|
* ```ts
|
|
175
|
+
* // Graphics-based (quick prototyping)
|
|
36
176
|
* const btn = new Button({
|
|
37
177
|
* width: 200, height: 60, borderRadius: 12,
|
|
38
178
|
* colors: { default: 0x22aa22, hover: 0x33cc33 },
|
|
39
179
|
* text: 'SPIN',
|
|
180
|
+
* onPress: () => spin(),
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* // Asset-based (production art)
|
|
184
|
+
* const btn = new Button({
|
|
185
|
+
* defaultView: 'btn-idle',
|
|
186
|
+
* hoverView: 'btn-hover',
|
|
187
|
+
* pressedView: 'btn-pressed',
|
|
188
|
+
* disabledView: 'btn-disabled',
|
|
189
|
+
* text: 'SPIN',
|
|
190
|
+
* onPress: () => spin(),
|
|
40
191
|
* });
|
|
41
192
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
193
|
+
* // Custom Container view
|
|
194
|
+
* const btn = new Button({
|
|
195
|
+
* defaultView: myAnimatedSprite,
|
|
196
|
+
* text: 'SPIN',
|
|
197
|
+
* });
|
|
44
198
|
* ```
|
|
45
199
|
*/
|
|
46
|
-
declare class Button extends
|
|
47
|
-
|
|
200
|
+
declare class Button extends Container {
|
|
201
|
+
readonly __uiComponent: true;
|
|
202
|
+
private _views;
|
|
203
|
+
private _state;
|
|
204
|
+
private _enabled;
|
|
205
|
+
private _config;
|
|
206
|
+
private _textObj;
|
|
207
|
+
/** Press callback */
|
|
208
|
+
onPress?: () => void;
|
|
48
209
|
constructor(config?: ButtonConfig);
|
|
210
|
+
/** Current button state */
|
|
211
|
+
get state(): ButtonState;
|
|
49
212
|
/** Enable the button */
|
|
50
213
|
enable(): void;
|
|
51
214
|
/** Disable the button */
|
|
52
215
|
disable(): void;
|
|
216
|
+
/** Whether the button is enabled */
|
|
217
|
+
get enabled(): boolean;
|
|
218
|
+
set enabled(value: boolean);
|
|
53
219
|
/** Whether the button is disabled */
|
|
54
220
|
get disabled(): boolean;
|
|
221
|
+
/** Update button text */
|
|
222
|
+
set text(value: string);
|
|
223
|
+
private _buildViews;
|
|
224
|
+
private _rebuildViews;
|
|
225
|
+
private _setState;
|
|
226
|
+
private _onPointerOver;
|
|
227
|
+
private _onPointerOut;
|
|
228
|
+
private _onPointerDown;
|
|
229
|
+
private _onPointerUp;
|
|
230
|
+
private _onPointerUpOutside;
|
|
231
|
+
/** React reconciler update hook */
|
|
232
|
+
updateConfig(changed: Record<string, any>): void;
|
|
233
|
+
destroy(options?: boolean | {
|
|
234
|
+
children?: boolean;
|
|
235
|
+
texture?: boolean;
|
|
236
|
+
textureSource?: boolean;
|
|
237
|
+
}): void;
|
|
55
238
|
}
|
|
56
239
|
|
|
57
240
|
interface ProgressBarConfig {
|
|
241
|
+
/** Width of the bar */
|
|
58
242
|
width?: number;
|
|
243
|
+
/** Height of the bar */
|
|
59
244
|
height?: number;
|
|
245
|
+
/** Corner radius (for Graphics-based bar) */
|
|
60
246
|
borderRadius?: number;
|
|
247
|
+
/** Fill color (for Graphics-based bar, ignored when fillView provided) */
|
|
61
248
|
fillColor?: number;
|
|
249
|
+
/** Track background color (for Graphics-based bar, ignored when trackView provided) */
|
|
62
250
|
trackColor?: number;
|
|
251
|
+
/** Border color */
|
|
63
252
|
borderColor?: number;
|
|
253
|
+
/** Border width */
|
|
64
254
|
borderWidth?: number;
|
|
65
255
|
/** Animated fill (smoothly interpolate) */
|
|
66
256
|
animated?: boolean;
|
|
67
257
|
/** Animation speed (0..1 per frame, default: 0.1) */
|
|
68
258
|
animationSpeed?: number;
|
|
259
|
+
/** Custom track background (string texture name, Texture, or Container) */
|
|
260
|
+
trackView?: ViewInput;
|
|
261
|
+
/** Custom fill bar (string texture name, Texture, or Container) */
|
|
262
|
+
fillView?: ViewInput;
|
|
69
263
|
}
|
|
70
264
|
/**
|
|
71
|
-
* Horizontal progress bar
|
|
265
|
+
* Horizontal progress bar with optional custom track/fill views.
|
|
72
266
|
*
|
|
73
|
-
*
|
|
267
|
+
* Supports asset-based skinning: provide `trackView` and/or `fillView`
|
|
268
|
+
* as texture names, Textures, or any Container (NineSliceSprite, custom artwork, etc).
|
|
269
|
+
* Falls back to colored Graphics when no custom views are provided.
|
|
74
270
|
*
|
|
75
271
|
* @example
|
|
76
272
|
* ```ts
|
|
273
|
+
* // Graphics-based (quick prototyping)
|
|
77
274
|
* const bar = new ProgressBar({ width: 300, height: 20, fillColor: 0x22cc22 });
|
|
78
|
-
*
|
|
79
|
-
*
|
|
275
|
+
* bar.progress = 0.5;
|
|
276
|
+
*
|
|
277
|
+
* // Asset-based (production art)
|
|
278
|
+
* const bar = new ProgressBar({
|
|
279
|
+
* width: 300, height: 20,
|
|
280
|
+
* trackView: 'bar-track',
|
|
281
|
+
* fillView: new NineSliceSprite({ texture: 'bar-fill', ... }),
|
|
282
|
+
* });
|
|
283
|
+
* bar.progress = 0.75;
|
|
80
284
|
* ```
|
|
81
285
|
*/
|
|
82
286
|
declare class ProgressBar extends Container {
|
|
83
|
-
|
|
287
|
+
readonly __uiComponent: true;
|
|
288
|
+
private _track;
|
|
289
|
+
private _fill;
|
|
290
|
+
private _fillMask;
|
|
84
291
|
private _borderGfx;
|
|
85
292
|
private _config;
|
|
86
293
|
private _progress;
|
|
@@ -93,6 +300,9 @@ declare class ProgressBar extends Container {
|
|
|
93
300
|
* Call each frame if animated is true.
|
|
94
301
|
*/
|
|
95
302
|
update(_dt: number): void;
|
|
303
|
+
/** React reconciler update hook */
|
|
304
|
+
updateConfig(changed: Record<string, any>): void;
|
|
305
|
+
private updateMask;
|
|
96
306
|
}
|
|
97
307
|
|
|
98
308
|
interface LabelConfig {
|
|
@@ -117,6 +327,7 @@ interface LabelConfig {
|
|
|
117
327
|
* ```
|
|
118
328
|
*/
|
|
119
329
|
declare class Label extends Container {
|
|
330
|
+
readonly __uiComponent: true;
|
|
120
331
|
private _text;
|
|
121
332
|
private _maxWidth;
|
|
122
333
|
private _autoFit;
|
|
@@ -140,6 +351,8 @@ declare class Label extends Container {
|
|
|
140
351
|
* Format a number with thousands separators.
|
|
141
352
|
*/
|
|
142
353
|
setNumber(value: number, decimals?: number, locale?: string): void;
|
|
354
|
+
/** React reconciler update hook */
|
|
355
|
+
updateConfig(changed: Record<string, any>): void;
|
|
143
356
|
private fitText;
|
|
144
357
|
}
|
|
145
358
|
|
|
@@ -164,12 +377,14 @@ interface PanelConfig {
|
|
|
164
377
|
nineSliceBorders?: [number, number, number, number];
|
|
165
378
|
/** Padding inside the panel */
|
|
166
379
|
padding?: number;
|
|
380
|
+
/** Flex layout config for content */
|
|
381
|
+
layout?: Partial<FlexContainerConfig>;
|
|
167
382
|
}
|
|
168
383
|
/**
|
|
169
|
-
* Background panel
|
|
384
|
+
* Background panel with optional flexbox content layout.
|
|
170
385
|
*
|
|
171
386
|
* Supports both Graphics-based (color + border) and 9-slice sprite backgrounds.
|
|
172
|
-
* Children added
|
|
387
|
+
* Children added via `addContent()` participate in flex layout automatically.
|
|
173
388
|
*
|
|
174
389
|
* @example
|
|
175
390
|
* ```ts
|
|
@@ -184,13 +399,32 @@ interface PanelConfig {
|
|
|
184
399
|
* });
|
|
185
400
|
* ```
|
|
186
401
|
*/
|
|
187
|
-
declare class Panel extends
|
|
402
|
+
declare class Panel extends Container {
|
|
403
|
+
readonly __uiComponent: true;
|
|
404
|
+
private _bg;
|
|
405
|
+
private _content;
|
|
406
|
+
private _internalSetup;
|
|
188
407
|
private _panelConfig;
|
|
189
408
|
constructor(config?: PanelConfig);
|
|
190
|
-
/** Access the content container
|
|
191
|
-
get content():
|
|
409
|
+
/** Access the content flex container — add children here for layout */
|
|
410
|
+
get content(): FlexContainer;
|
|
411
|
+
/** Convenience: add a child to the content layout */
|
|
412
|
+
addContent(child: Container): this;
|
|
192
413
|
/** Resize the panel */
|
|
193
414
|
setSize(width: number, height: number): void;
|
|
415
|
+
/**
|
|
416
|
+
* Override addChild so external children are routed to content FlexContainer.
|
|
417
|
+
* Enables `<panel><label /><button /></panel>` in React JSX.
|
|
418
|
+
*/
|
|
419
|
+
addChild<T extends Container>(...children: T[]): T;
|
|
420
|
+
removeChild<T extends Container>(...children: T[]): T;
|
|
421
|
+
/** React reconciler update hook */
|
|
422
|
+
updateConfig(changed: Record<string, any>): void;
|
|
423
|
+
destroy(options?: boolean | {
|
|
424
|
+
children?: boolean;
|
|
425
|
+
texture?: boolean;
|
|
426
|
+
textureSource?: boolean;
|
|
427
|
+
}): void;
|
|
194
428
|
}
|
|
195
429
|
|
|
196
430
|
interface BalanceDisplayConfig {
|
|
@@ -213,7 +447,7 @@ interface BalanceDisplayConfig {
|
|
|
213
447
|
* Reactive balance display component.
|
|
214
448
|
*
|
|
215
449
|
* Automatically formats currency and can animate value changes
|
|
216
|
-
* with a smooth countup/countdown effect.
|
|
450
|
+
* with a smooth countup/countdown effect using engine Tween.
|
|
217
451
|
*
|
|
218
452
|
* @example
|
|
219
453
|
* ```ts
|
|
@@ -225,13 +459,14 @@ interface BalanceDisplayConfig {
|
|
|
225
459
|
* ```
|
|
226
460
|
*/
|
|
227
461
|
declare class BalanceDisplay extends Container {
|
|
462
|
+
readonly __uiComponent: true;
|
|
228
463
|
private _prefixLabel;
|
|
229
464
|
private _valueLabel;
|
|
230
465
|
private _config;
|
|
231
466
|
private _currentValue;
|
|
232
467
|
private _displayedValue;
|
|
233
|
-
|
|
234
|
-
private
|
|
468
|
+
/** Internal target for Tween animation */
|
|
469
|
+
private _tweenTarget;
|
|
235
470
|
constructor(config?: BalanceDisplayConfig);
|
|
236
471
|
/** Current displayed value */
|
|
237
472
|
get value(): number;
|
|
@@ -246,6 +481,13 @@ declare class BalanceDisplay extends Container {
|
|
|
246
481
|
private animateValue;
|
|
247
482
|
private updateDisplay;
|
|
248
483
|
private layoutLabels;
|
|
484
|
+
/** React reconciler update hook */
|
|
485
|
+
updateConfig(changed: Record<string, any>): void;
|
|
486
|
+
destroy(options?: boolean | {
|
|
487
|
+
children?: boolean;
|
|
488
|
+
texture?: boolean;
|
|
489
|
+
textureSource?: boolean;
|
|
490
|
+
}): void;
|
|
249
491
|
}
|
|
250
492
|
|
|
251
493
|
interface WinDisplayConfig {
|
|
@@ -264,7 +506,7 @@ interface WinDisplayConfig {
|
|
|
264
506
|
* Win amount display with countup animation.
|
|
265
507
|
*
|
|
266
508
|
* Shows a dramatic countup from 0 to the win amount, with optional
|
|
267
|
-
* scale pop effect — typical of slot games.
|
|
509
|
+
* scale pop effect — typical of slot games. Uses engine Tween system.
|
|
268
510
|
*
|
|
269
511
|
* @example
|
|
270
512
|
* ```ts
|
|
@@ -275,9 +517,11 @@ interface WinDisplayConfig {
|
|
|
275
517
|
* ```
|
|
276
518
|
*/
|
|
277
519
|
declare class WinDisplay extends Container {
|
|
520
|
+
readonly __uiComponent: true;
|
|
278
521
|
private _label;
|
|
279
522
|
private _config;
|
|
280
|
-
|
|
523
|
+
/** Internal target for Tween countup */
|
|
524
|
+
private _tweenTarget;
|
|
281
525
|
constructor(config?: WinDisplayConfig);
|
|
282
526
|
/**
|
|
283
527
|
* Show a win with countup animation.
|
|
@@ -295,6 +539,13 @@ declare class WinDisplay extends Container {
|
|
|
295
539
|
*/
|
|
296
540
|
hide(): void;
|
|
297
541
|
private displayAmount;
|
|
542
|
+
/** React reconciler update hook */
|
|
543
|
+
updateConfig(changed: Record<string, any>): void;
|
|
544
|
+
destroy(options?: boolean | {
|
|
545
|
+
children?: boolean;
|
|
546
|
+
texture?: boolean;
|
|
547
|
+
textureSource?: boolean;
|
|
548
|
+
}): void;
|
|
298
549
|
}
|
|
299
550
|
|
|
300
551
|
interface ModalConfig {
|
|
@@ -311,7 +562,7 @@ interface ModalConfig {
|
|
|
311
562
|
* Modal overlay component.
|
|
312
563
|
* Shows content on top of a dark overlay with enter/exit animations.
|
|
313
564
|
*
|
|
314
|
-
*
|
|
565
|
+
* Content is automatically centered via position calculations.
|
|
315
566
|
*
|
|
316
567
|
* @example
|
|
317
568
|
* ```ts
|
|
@@ -322,6 +573,7 @@ interface ModalConfig {
|
|
|
322
573
|
* ```
|
|
323
574
|
*/
|
|
324
575
|
declare class Modal extends Container {
|
|
576
|
+
readonly __uiComponent: true;
|
|
325
577
|
private _overlay;
|
|
326
578
|
private _contentContainer;
|
|
327
579
|
private _config;
|
|
@@ -341,6 +593,8 @@ declare class Modal extends Container {
|
|
|
341
593
|
* Hide the modal with animation.
|
|
342
594
|
*/
|
|
343
595
|
hide(): Promise<void>;
|
|
596
|
+
/** React reconciler update hook */
|
|
597
|
+
updateConfig(changed: Record<string, any>): void;
|
|
344
598
|
}
|
|
345
599
|
|
|
346
600
|
type ToastType = 'info' | 'success' | 'warning' | 'error';
|
|
@@ -349,6 +603,8 @@ interface ToastConfig {
|
|
|
349
603
|
duration?: number;
|
|
350
604
|
/** Toast position from bottom */
|
|
351
605
|
bottomOffset?: number;
|
|
606
|
+
/** Custom background view (string texture name, Texture, or Container). Sized to fit text. */
|
|
607
|
+
backgroundView?: ViewInput;
|
|
352
608
|
}
|
|
353
609
|
/**
|
|
354
610
|
* Toast notification component for displaying transient messages.
|
|
@@ -361,10 +617,12 @@ interface ToastConfig {
|
|
|
361
617
|
* ```
|
|
362
618
|
*/
|
|
363
619
|
declare class Toast extends Container {
|
|
620
|
+
readonly __uiComponent: true;
|
|
364
621
|
private _bg;
|
|
622
|
+
private _customBg;
|
|
365
623
|
private _text;
|
|
366
624
|
private _config;
|
|
367
|
-
private
|
|
625
|
+
private _dismissPending;
|
|
368
626
|
constructor(config?: ToastConfig);
|
|
369
627
|
/**
|
|
370
628
|
* Show a toast message.
|
|
@@ -374,6 +632,13 @@ declare class Toast extends Container {
|
|
|
374
632
|
* Dismiss the toast.
|
|
375
633
|
*/
|
|
376
634
|
dismiss(): Promise<void>;
|
|
635
|
+
/** React reconciler update hook */
|
|
636
|
+
updateConfig(changed: Record<string, any>): void;
|
|
637
|
+
destroy(options?: boolean | {
|
|
638
|
+
children?: boolean;
|
|
639
|
+
texture?: boolean;
|
|
640
|
+
textureSource?: boolean;
|
|
641
|
+
}): void;
|
|
377
642
|
}
|
|
378
643
|
|
|
379
644
|
type LayoutDirection = 'horizontal' | 'vertical' | 'grid' | 'wrap';
|
|
@@ -400,7 +665,7 @@ interface LayoutConfig {
|
|
|
400
665
|
breakpoints?: Record<number, Partial<LayoutConfig>>;
|
|
401
666
|
}
|
|
402
667
|
/**
|
|
403
|
-
* Responsive layout container powered by
|
|
668
|
+
* Responsive layout container powered by a lightweight built-in flex layout solver.
|
|
404
669
|
*
|
|
405
670
|
* Supports horizontal, vertical, grid, and wrap layout modes with
|
|
406
671
|
* alignment, padding, gap, and viewport-anchor positioning.
|
|
@@ -427,6 +692,7 @@ interface LayoutConfig {
|
|
|
427
692
|
* ```
|
|
428
693
|
*/
|
|
429
694
|
declare class Layout extends Container {
|
|
695
|
+
readonly __uiComponent: true;
|
|
430
696
|
private _layoutConfig;
|
|
431
697
|
private _padding;
|
|
432
698
|
private _anchor;
|
|
@@ -435,6 +701,7 @@ declare class Layout extends Container {
|
|
|
435
701
|
private _items;
|
|
436
702
|
private _viewportWidth;
|
|
437
703
|
private _viewportHeight;
|
|
704
|
+
private _flex;
|
|
438
705
|
constructor(config?: LayoutConfig);
|
|
439
706
|
/** Add an item to the layout */
|
|
440
707
|
addItem(child: Container): this;
|
|
@@ -450,9 +717,16 @@ declare class Layout extends Container {
|
|
|
450
717
|
*/
|
|
451
718
|
updateViewport(width: number, height: number): void;
|
|
452
719
|
private applyLayoutStyles;
|
|
453
|
-
private
|
|
720
|
+
private buildFlexItemConfig;
|
|
454
721
|
private applyAnchor;
|
|
455
722
|
private resolveConfig;
|
|
723
|
+
/** React reconciler update hook */
|
|
724
|
+
updateConfig(changed: Record<string, any>): void;
|
|
725
|
+
destroy(options?: boolean | {
|
|
726
|
+
children?: boolean;
|
|
727
|
+
texture?: boolean;
|
|
728
|
+
textureSource?: boolean;
|
|
729
|
+
}): void;
|
|
456
730
|
}
|
|
457
731
|
|
|
458
732
|
type ScrollDirection = 'vertical' | 'horizontal' | 'both';
|
|
@@ -471,18 +745,23 @@ interface ScrollContainerConfig {
|
|
|
471
745
|
elementsMargin?: number;
|
|
472
746
|
/** Padding */
|
|
473
747
|
padding?: number;
|
|
474
|
-
/** Disable dynamic rendering (render all items even when offscreen) */
|
|
475
|
-
disableDynamicRendering?: boolean;
|
|
476
748
|
/** Disable easing/inertia */
|
|
477
749
|
disableEasing?: boolean;
|
|
478
|
-
/**
|
|
479
|
-
|
|
750
|
+
/** Show scrollbar indicator (default: false) */
|
|
751
|
+
scrollbar?: boolean;
|
|
752
|
+
/** Custom scrollbar thumb view (string texture name, Texture, or Container) */
|
|
753
|
+
thumbView?: ViewInput;
|
|
754
|
+
/** Scrollbar width in px (default: 6) */
|
|
755
|
+
scrollbarWidth?: number;
|
|
756
|
+
/** Scrollbar padding from edge (default: 4) */
|
|
757
|
+
scrollbarPadding?: number;
|
|
758
|
+
/** Scrollbar color (when no thumbView, default: 0xaaaaaa) */
|
|
759
|
+
scrollbarColor?: number;
|
|
760
|
+
/** Scrollbar alpha (default: 0.5) */
|
|
761
|
+
scrollbarAlpha?: number;
|
|
480
762
|
}
|
|
481
763
|
/**
|
|
482
|
-
* Scrollable container
|
|
483
|
-
*
|
|
484
|
-
* Provides touch/drag scrolling, mouse wheel support, inertia, and
|
|
485
|
-
* dynamic rendering optimization for off-screen items.
|
|
764
|
+
* Scrollable container with touch/drag, mouse wheel, and inertia.
|
|
486
765
|
*
|
|
487
766
|
* @example
|
|
488
767
|
* ```ts
|
|
@@ -500,21 +779,70 @@ interface ScrollContainerConfig {
|
|
|
500
779
|
* scene.container.addChild(scroll);
|
|
501
780
|
* ```
|
|
502
781
|
*/
|
|
503
|
-
declare class ScrollContainer extends
|
|
782
|
+
declare class ScrollContainer extends Container {
|
|
783
|
+
readonly __uiComponent: true;
|
|
784
|
+
private _viewport;
|
|
785
|
+
private _internalSetup;
|
|
786
|
+
private _content;
|
|
787
|
+
private _maskGfx;
|
|
788
|
+
private _bg;
|
|
504
789
|
private _scrollConfig;
|
|
790
|
+
private _items;
|
|
791
|
+
private _scrollbar;
|
|
792
|
+
private _scrollbarConfig;
|
|
793
|
+
private _dragging;
|
|
794
|
+
private _dragStart;
|
|
795
|
+
private _contentStart;
|
|
796
|
+
private _velocity;
|
|
797
|
+
private _lastDragPos;
|
|
798
|
+
private _lastDragTime;
|
|
799
|
+
private _inertiaActive;
|
|
800
|
+
private _onTickBound;
|
|
801
|
+
private _onWheelBound;
|
|
505
802
|
constructor(config: ScrollContainerConfig);
|
|
506
|
-
/**
|
|
803
|
+
/**
|
|
804
|
+
* Override addChild so external children are routed to scroll content.
|
|
805
|
+
* Enables `<scrollContainer><label /><panel /></scrollContainer>` in React JSX.
|
|
806
|
+
*/
|
|
807
|
+
addChild<T extends Container>(...children: T[]): T;
|
|
808
|
+
removeChild<T extends Container>(...children: T[]): T;
|
|
809
|
+
/** React reconciler update hook */
|
|
810
|
+
updateConfig(changed: Record<string, any>): void;
|
|
811
|
+
/** Enable mouse wheel scrolling (call after adding to stage) */
|
|
812
|
+
enableWheel(canvas: HTMLCanvasElement): void;
|
|
813
|
+
/** Set scrollable content. Replaces any existing items. */
|
|
507
814
|
setContent(content: Container): void;
|
|
508
815
|
/** Add a single item */
|
|
509
|
-
addItem(
|
|
510
|
-
/**
|
|
816
|
+
addItem(child: Container): this;
|
|
817
|
+
/** Remove all items */
|
|
818
|
+
clearItems(): void;
|
|
819
|
+
/** Get items */
|
|
820
|
+
get items(): readonly Container[];
|
|
821
|
+
/** Scroll to make a specific item index visible */
|
|
511
822
|
scrollToItem(index: number): void;
|
|
512
823
|
/** Current scroll position */
|
|
513
824
|
get scrollPosition(): {
|
|
514
825
|
x: number;
|
|
515
826
|
y: number;
|
|
516
827
|
};
|
|
828
|
+
/** Resize the scroll viewport */
|
|
829
|
+
setViewportSize(width: number, height: number): void;
|
|
830
|
+
private layoutItems;
|
|
831
|
+
private _onPointerDown;
|
|
832
|
+
private _onPointerMove;
|
|
833
|
+
private _onPointerUp;
|
|
834
|
+
private startInertia;
|
|
835
|
+
private stopInertia;
|
|
836
|
+
private _inertiaTick;
|
|
837
|
+
private _onWheel;
|
|
838
|
+
private clampScroll;
|
|
839
|
+
private updateScrollbar;
|
|
840
|
+
destroy(options?: boolean | {
|
|
841
|
+
children?: boolean;
|
|
842
|
+
texture?: boolean;
|
|
843
|
+
textureSource?: boolean;
|
|
844
|
+
}): void;
|
|
517
845
|
}
|
|
518
846
|
|
|
519
|
-
export { BalanceDisplay, Button, Label, Layout, Modal, Panel, ProgressBar, ScrollContainer, Toast, WinDisplay };
|
|
520
|
-
export type { BalanceDisplayConfig, ButtonConfig, ButtonState, LabelConfig, LayoutAlignment, LayoutAnchor, LayoutConfig, LayoutDirection, ModalConfig, PanelConfig, ProgressBarConfig, ScrollContainerConfig, ScrollDirection, ToastConfig, ToastType, WinDisplayConfig };
|
|
847
|
+
export { BalanceDisplay, Button, FlexContainer, Label, Layout, Modal, Panel, ProgressBar, ScrollContainer, Toast, WinDisplay, resolveView };
|
|
848
|
+
export type { AlignItems, BalanceDisplayConfig, ButtonConfig, ButtonState, FlexContainerConfig, FlexDirection, FlexItemConfig, JustifyContent, LabelConfig, LayoutAlignment, LayoutAnchor, LayoutConfig, LayoutDirection, ModalConfig, PanelConfig, ProgressBarConfig, ScrollContainerConfig, ScrollDirection, ToastConfig, ToastType, ViewInput, WinDisplayConfig };
|