@energy8platform/game-engine 0.10.11 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +272 -74
  2. package/dist/index.cjs.js +1322 -296
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +369 -46
  5. package/dist/index.esm.js +1323 -298
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/lua.cjs.js +8 -18
  8. package/dist/lua.cjs.js.map +1 -1
  9. package/dist/lua.d.ts +0 -2
  10. package/dist/lua.esm.js +8 -18
  11. package/dist/lua.esm.js.map +1 -1
  12. package/dist/react.cjs.js +2848 -35
  13. package/dist/react.cjs.js.map +1 -1
  14. package/dist/react.d.ts +17 -6
  15. package/dist/react.esm.js +2848 -36
  16. package/dist/react.esm.js.map +1 -1
  17. package/dist/ui.cjs.js +1913 -592
  18. package/dist/ui.cjs.js.map +1 -1
  19. package/dist/ui.d.ts +528 -46
  20. package/dist/ui.esm.js +1911 -594
  21. package/dist/ui.esm.js.map +1 -1
  22. package/dist/vite.cjs.js +1 -11
  23. package/dist/vite.cjs.js.map +1 -1
  24. package/dist/vite.d.ts +1 -1
  25. package/dist/vite.esm.js +1 -11
  26. package/dist/vite.esm.js.map +1 -1
  27. package/package.json +3 -18
  28. package/src/index.ts +3 -3
  29. package/src/lua/LuaEngine.ts +8 -18
  30. package/src/react/applyProps.ts +90 -2
  31. package/src/react/extendAll.ts +29 -6
  32. package/src/react/index.ts +1 -1
  33. package/src/react/jsx.d.ts +249 -0
  34. package/src/react/reconciler.ts +80 -7
  35. package/src/ui/BalanceDisplay.ts +31 -38
  36. package/src/ui/Button.ts +217 -53
  37. package/src/ui/FlexContainer.ts +529 -0
  38. package/src/ui/Label.ts +13 -0
  39. package/src/ui/Layout.ts +86 -87
  40. package/src/ui/Modal.ts +11 -1
  41. package/src/ui/Panel.ts +108 -36
  42. package/src/ui/ProgressBar.ts +85 -31
  43. package/src/ui/ScrollContainer.ts +397 -45
  44. package/src/ui/Slider.ts +241 -0
  45. package/src/ui/Toast.ts +47 -17
  46. package/src/ui/Toggle.ts +201 -0
  47. package/src/ui/WinDisplay.ts +51 -39
  48. package/src/ui/index.ts +9 -11
  49. package/src/ui/view.ts +28 -0
  50. package/src/vite/index.ts +1 -11
package/src/ui/index.ts CHANGED
@@ -1,7 +1,10 @@
1
- // ─── @pixi/layout setup (must be imported before creating containers) ────
2
- import '@pixi/layout';
1
+ // ─── View helpers ─────────────────────────────────────────
2
+ export { resolveView } from './view';
3
+ export type { ViewInput } from './view';
3
4
 
4
5
  // ─── Engine UI Components ─────────────────────────────────
6
+ export { FlexContainer } from './FlexContainer';
7
+ export type { FlexContainerConfig, FlexDirection, JustifyContent, AlignItems, AlignSelf, FlexItemConfig } from './FlexContainer';
5
8
  export { Button } from './Button';
6
9
  export type { ButtonConfig, ButtonState } from './Button';
7
10
  export { ProgressBar } from './ProgressBar';
@@ -22,12 +25,7 @@ export { Layout } from './Layout';
22
25
  export type { LayoutConfig, LayoutDirection, LayoutAlignment, LayoutAnchor } from './Layout';
23
26
  export { ScrollContainer } from './ScrollContainer';
24
27
  export type { ScrollContainerConfig, ScrollDirection } from './ScrollContainer';
25
-
26
- // ─── Direct access to @pixi/ui and @pixi/layout ──────────
27
- // These packages are optional peer dependencies.
28
- // For any classes or types not wrapped by the engine (e.g. Slider, CheckBox,
29
- // Input, Select, RadioGroup, List, etc.), import directly:
30
- //
31
- // import { Slider, CheckBox } from '@pixi/ui';
32
- // import { LayoutContainer } from '@pixi/layout/components';
33
- //
28
+ export { Slider } from './Slider';
29
+ export type { SliderConfig } from './Slider';
30
+ export { Toggle } from './Toggle';
31
+ export type { ToggleConfig } from './Toggle';
package/src/ui/view.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { Container, Sprite, Texture } from 'pixi.js';
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
+ export type ViewInput = string | Texture | Container;
11
+
12
+ /**
13
+ * Resolve a ViewInput to a Container instance.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * resolveView('btn-idle') // → Sprite.from('btn-idle')
18
+ * resolveView(someTexture) // → new Sprite(someTexture)
19
+ * resolveView(myCustomContainer) // → myCustomContainer (as-is)
20
+ * resolveView(undefined) // → null
21
+ * ```
22
+ */
23
+ export function resolveView(input: ViewInput | undefined | null): Container | null {
24
+ if (input == null) return null;
25
+ if (typeof input === 'string') return Sprite.from(input);
26
+ if (input instanceof Texture) return new Sprite(input);
27
+ return input;
28
+ }
package/src/vite/index.ts CHANGED
@@ -214,7 +214,7 @@ function luaPlugin(configPath: string): Plugin {
214
214
  * Define a Vite configuration tailored for Energy8 casino games.
215
215
  *
216
216
  * Merges sensible defaults for iGaming projects:
217
- * - Build target: ESNext (required for yoga-layout WASM top-level await)
217
+ * - Build target: ESNext
218
218
  * - Asset inlining threshold: 8KB
219
219
  * - Source maps for dev, none for prod
220
220
  * - Optional DevBridge auto-injection in dev mode
@@ -272,11 +272,6 @@ export function defineGameConfig(config: GameConfig = {}): UserConfig {
272
272
  resolve: {
273
273
  dedupe: [
274
274
  'pixi.js',
275
- '@pixi/layout',
276
- '@pixi/layout/components',
277
- '@pixi/ui',
278
- 'yoga-layout',
279
- 'yoga-layout/load',
280
275
  'react',
281
276
  'react-dom',
282
277
  'react-reconciler',
@@ -287,15 +282,10 @@ export function defineGameConfig(config: GameConfig = {}): UserConfig {
287
282
  optimizeDeps: {
288
283
  include: [
289
284
  'pixi.js',
290
- '@pixi/layout',
291
- '@pixi/layout/components',
292
- '@pixi/ui',
293
- 'yoga-layout/load',
294
285
  'react',
295
286
  'react-dom',
296
287
  ],
297
288
  exclude: [
298
- 'yoga-layout',
299
289
  'fengari',
300
290
  ],
301
291
  esbuildOptions: {