@zylem/game-lib 0.6.4 → 0.7.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 (122) hide show
  1. package/README.md +3 -1
  2. package/dist/actions.d.ts +255 -8
  3. package/dist/actions.js +1 -936
  4. package/dist/audio.d.ts +13 -0
  5. package/dist/audio.js +1 -0
  6. package/dist/base-node-life-cycle-CnJ-7zX-.d.ts +143 -0
  7. package/dist/behavior.d.ts +3 -0
  8. package/dist/behavior.js +1 -0
  9. package/dist/chunk-4QLJUQSJ.js +1 -0
  10. package/dist/chunk-73VZQZUL.js +1 -0
  11. package/dist/chunk-A34ZG3L4.js +1 -0
  12. package/dist/chunk-CDPY4VOQ.js +1 -0
  13. package/dist/chunk-DR6XXZE7.js +19 -0
  14. package/dist/chunk-FM5TBEPO.js +1 -0
  15. package/dist/chunk-G2IIMSUH.js +1 -0
  16. package/dist/chunk-MSC2BEO5.js +1 -0
  17. package/dist/chunk-NIH5CONO.js +1 -0
  18. package/dist/chunk-ONWXGBWB.js +1 -0
  19. package/dist/chunk-QEDQDR27.js +1 -0
  20. package/dist/chunk-QXVH6POE.js +1 -0
  21. package/dist/chunk-RXDTAWI2.js +29 -0
  22. package/dist/chunk-WKHW2QO2.js +1 -0
  23. package/dist/chunk-XRP4JJXL.js +1 -0
  24. package/dist/chunk-YHEWKN7N.js +1 -0
  25. package/dist/chunk-YHKXQ2ZN.js +1 -0
  26. package/dist/core.d.ts +206 -14
  27. package/dist/core.js +24 -12424
  28. package/dist/debug.d.ts +24 -0
  29. package/dist/debug.js +1 -0
  30. package/dist/default-controls-BGc61yYl.d.ts +111 -0
  31. package/dist/{entity-vj-HTjzU.d.ts → entity-DNkYKfdp.d.ts} +452 -578
  32. package/dist/entity-type-map-C94h2TDW.d.ts +781 -0
  33. package/dist/entity.d.ts +265 -0
  34. package/dist/entity.js +1 -0
  35. package/dist/events.d.ts +172 -0
  36. package/dist/events.js +1 -0
  37. package/dist/game-Cuj5gy7U.d.ts +1590 -0
  38. package/dist/game-default-PZLLHYL7.js +1 -0
  39. package/dist/game-interfaces-tfpM5NBk.d.ts +90 -0
  40. package/dist/globals.d.ts +104 -0
  41. package/dist/globals.js +1 -0
  42. package/dist/graphics.d.ts +83 -0
  43. package/dist/graphics.js +1 -0
  44. package/dist/input-ui.d.ts +34 -0
  45. package/dist/input-ui.js +1 -0
  46. package/dist/input.d.ts +72 -0
  47. package/dist/input.js +1 -0
  48. package/dist/material-Wz83vTTp.d.ts +151 -0
  49. package/dist/runtime.d.ts +433 -0
  50. package/dist/runtime.js +1 -0
  51. package/dist/web-components.d.ts +67 -0
  52. package/dist/web-components.js +9 -0
  53. package/dist/world-C9zdyl5d.d.ts +103 -0
  54. package/dist/{camera-4XO5gbQH.d.ts → zylem-stage-runtime-Cs-UDEVU.d.ts} +201 -329
  55. package/package.json +52 -63
  56. package/dist/actions.js.map +0 -1
  57. package/dist/behavior/jumper-2d.d.ts +0 -114
  58. package/dist/behavior/jumper-2d.js +0 -711
  59. package/dist/behavior/jumper-2d.js.map +0 -1
  60. package/dist/behavior/platformer-3d.d.ts +0 -296
  61. package/dist/behavior/platformer-3d.js +0 -761
  62. package/dist/behavior/platformer-3d.js.map +0 -1
  63. package/dist/behavior/ricochet-2d.d.ts +0 -275
  64. package/dist/behavior/ricochet-2d.js +0 -425
  65. package/dist/behavior/ricochet-2d.js.map +0 -1
  66. package/dist/behavior/ricochet-3d.d.ts +0 -117
  67. package/dist/behavior/ricochet-3d.js +0 -443
  68. package/dist/behavior/ricochet-3d.js.map +0 -1
  69. package/dist/behavior/screen-visibility.d.ts +0 -79
  70. package/dist/behavior/screen-visibility.js +0 -358
  71. package/dist/behavior/screen-visibility.js.map +0 -1
  72. package/dist/behavior/screen-wrap.d.ts +0 -87
  73. package/dist/behavior/screen-wrap.js +0 -246
  74. package/dist/behavior/screen-wrap.js.map +0 -1
  75. package/dist/behavior/shooter-2d.d.ts +0 -79
  76. package/dist/behavior/shooter-2d.js +0 -180
  77. package/dist/behavior/shooter-2d.js.map +0 -1
  78. package/dist/behavior/thruster.d.ts +0 -11
  79. package/dist/behavior/thruster.js +0 -292
  80. package/dist/behavior/thruster.js.map +0 -1
  81. package/dist/behavior/top-down-movement.d.ts +0 -56
  82. package/dist/behavior/top-down-movement.js +0 -125
  83. package/dist/behavior/top-down-movement.js.map +0 -1
  84. package/dist/behavior/world-boundary-2d.d.ts +0 -142
  85. package/dist/behavior/world-boundary-2d.js +0 -235
  86. package/dist/behavior/world-boundary-2d.js.map +0 -1
  87. package/dist/behavior/world-boundary-3d.d.ts +0 -76
  88. package/dist/behavior/world-boundary-3d.js +0 -274
  89. package/dist/behavior/world-boundary-3d.js.map +0 -1
  90. package/dist/behavior-descriptor-BXnVR8Ki.d.ts +0 -159
  91. package/dist/blueprints-DmbK2dki.d.ts +0 -26
  92. package/dist/camera.d.ts +0 -6
  93. package/dist/camera.js +0 -1993
  94. package/dist/camera.js.map +0 -1
  95. package/dist/composition-BASvMKrW.d.ts +0 -218
  96. package/dist/core-CARRaS55.d.ts +0 -541
  97. package/dist/core.js.map +0 -1
  98. package/dist/entities-ChFirVL9.d.ts +0 -410
  99. package/dist/entities.d.ts +0 -9
  100. package/dist/entities.js +0 -4986
  101. package/dist/entities.js.map +0 -1
  102. package/dist/entity-Bq_eNEDI.d.ts +0 -28
  103. package/dist/entity-types-DAu8sGJH.d.ts +0 -26
  104. package/dist/global-change-2JvMaz44.d.ts +0 -25
  105. package/dist/main.d.ts +0 -1353
  106. package/dist/main.js +0 -19525
  107. package/dist/main.js.map +0 -1
  108. package/dist/physics-pose-DCc4oE44.d.ts +0 -25
  109. package/dist/physics-protocol-BDD3P5W2.d.ts +0 -200
  110. package/dist/physics-worker.d.ts +0 -21
  111. package/dist/physics-worker.js +0 -306
  112. package/dist/physics-worker.js.map +0 -1
  113. package/dist/physics.d.ts +0 -205
  114. package/dist/physics.js +0 -577
  115. package/dist/physics.js.map +0 -1
  116. package/dist/stage-types-C19IhuzA.d.ts +0 -731
  117. package/dist/stage.d.ts +0 -52
  118. package/dist/stage.js +0 -8479
  119. package/dist/stage.js.map +0 -1
  120. package/dist/sync-state-machine-CZyspBpj.d.ts +0 -16
  121. package/dist/thruster-23lzoPZd.d.ts +0 -180
  122. package/dist/world-DfgxoNMt.d.ts +0 -105
@@ -0,0 +1,24 @@
1
+ import { G as GameEntity } from './entity-DNkYKfdp.js';
2
+ import 'three';
3
+ import '@dimforge/rapier3d-compat';
4
+ import './material-Wz83vTTp.js';
5
+ import 'three/webgpu';
6
+ import './base-node-life-cycle-CnJ-7zX-.js';
7
+ import './events.js';
8
+ import 'mitt';
9
+ import '@zylem/behaviors/core';
10
+
11
+ type DebugTools = 'select' | 'translate' | 'rotate' | 'scale' | 'delete' | 'none';
12
+ interface DebugState {
13
+ enabled: boolean;
14
+ paused: boolean;
15
+ tool: DebugTools;
16
+ selectedEntity: GameEntity<any> | null;
17
+ hoveredEntity: GameEntity<any> | null;
18
+ flags: Set<string>;
19
+ }
20
+ declare const debugState: DebugState;
21
+ declare function setPaused(paused: boolean): void;
22
+ declare function setDebugTool(tool: DebugTools): void;
23
+
24
+ export { type DebugTools, debugState, setDebugTool, setPaused };
package/dist/debug.js ADDED
@@ -0,0 +1 @@
1
+ import{a as e,c as o,e as t}from"./chunk-CDPY4VOQ.js";export{e as debugState,t as setDebugTool,o as setPaused};
@@ -0,0 +1,111 @@
1
+ import { I as InputPlayer } from './base-node-life-cycle-CnJ-7zX-.js';
2
+ import { a as VirtualTouchButtonSlot, V as VirtualTouchConfig, G as GameInputConfig } from './game-interfaces-tfpM5NBk.js';
3
+
4
+ /**
5
+ * Color tokens consumed by the SVG factories in `svg-assets.ts` and the
6
+ * `defaultTouchControls(...)` preset. All fields are CSS color strings; the
7
+ * factories compose them into static SVG markup.
8
+ */
9
+ interface TouchTheme {
10
+ /** Inner fill of joystick base & button bodies (usually translucent dark). */
11
+ baseFill: string;
12
+ /** Outer ring stroke on joystick base. */
13
+ joystickStroke: string;
14
+ /** Inner ring stroke on joystick base (subtle highlight). */
15
+ joystickInnerStroke: string;
16
+ /** Inner ring fill on joystick base (translucent accent). */
17
+ joystickAccentFill: string;
18
+ /** Direction tab fill on the joystick base (the four arrows). */
19
+ joystickTabFill: string;
20
+ /** Filled joystick thumb color. */
21
+ thumbFill: string;
22
+ /** Joystick thumb border. */
23
+ thumbStroke: string;
24
+ /** Inner highlight ring on the thumb. */
25
+ thumbInnerFill: string;
26
+ /** Stroke/text accent for buttons when no per-slot accent is provided. */
27
+ defaultButtonAccent: string;
28
+ /** Optional per-button accent overrides. */
29
+ buttonAccents?: Partial<Record<VirtualTouchButtonSlot, string>>;
30
+ }
31
+ /**
32
+ * Built-in named themes. Pass a key (e.g. `'lagoon'`) anywhere a `TouchTheme`
33
+ * is accepted. Use {@link resolveTouchTheme} to turn a key or partial input
34
+ * into a fully-populated theme.
35
+ */
36
+ declare const touchThemes: {
37
+ readonly default: TouchTheme;
38
+ readonly lagoon: TouchTheme;
39
+ };
40
+ type TouchThemeName = keyof typeof touchThemes;
41
+ /**
42
+ * Normalize a theme input to a fully populated {@link TouchTheme}.
43
+ *
44
+ * @param input Either a built-in theme name (e.g. `'lagoon'`) or a
45
+ * full `TouchTheme` object. When omitted, returns the
46
+ * `'default'` theme.
47
+ */
48
+ declare function resolveTouchTheme(input?: TouchTheme | TouchThemeName): TouchTheme;
49
+ /**
50
+ * Returns the theme accent for a given button slot. Per-slot overrides win
51
+ * over `theme.defaultButtonAccent`; a caller-provided `accentOverride`
52
+ * trumps everything.
53
+ */
54
+ declare function resolveButtonAccent(theme: TouchTheme, slot: VirtualTouchButtonSlot, accentOverride?: string): string;
55
+
56
+ type JoystickSelection = 'left' | 'right' | 'both' | 'none';
57
+ interface DefaultTouchControlsOptions {
58
+ /**
59
+ * Controls whether the touch UI mounts. `'auto'` (default) lets the
60
+ * provider show controls only on touch/mobile devices. `true` forces it
61
+ * on (useful for testing on desktop), `false` disables the UI entirely.
62
+ */
63
+ enabled?: boolean | 'auto';
64
+ /** Theme name (`'default'` / `'lagoon'`) or a custom {@link TouchTheme}. */
65
+ theme?: TouchTheme | TouchThemeName;
66
+ /**
67
+ * Buttons to render. Default `['A', 'B']`. Buttons not listed here are
68
+ * disabled. Pass `[]` to render no buttons.
69
+ */
70
+ buttons?: VirtualTouchButtonSlot[];
71
+ /** Per-button accent color overrides (override theme `buttonAccents`). */
72
+ buttonAccents?: Partial<Record<VirtualTouchButtonSlot, string>>;
73
+ /** Custom labels for buttons (default uses the slot name, e.g. `'A'`). */
74
+ buttonLabels?: Partial<Record<VirtualTouchButtonSlot, string>>;
75
+ /**
76
+ * Which joysticks to render. Default `'left'`.
77
+ * - `'left'` : analog left only
78
+ * - `'right'` : analog right only
79
+ * - `'both'` : both sticks
80
+ * - `'none'` : disable all joysticks
81
+ */
82
+ joysticks?: JoystickSelection;
83
+ /**
84
+ * Escape hatch — a raw {@link VirtualTouchConfig} merged on top of the
85
+ * generated config. Use this when you need fine-grained tweaks
86
+ * (custom positions, sizes, raw SVG) without reaching for the lower-level
87
+ * `useVirtualControls(...)` preset.
88
+ */
89
+ override?: VirtualTouchConfig;
90
+ }
91
+ /**
92
+ * Builds a ready-to-use {@link GameInputConfig} that wires up themed
93
+ * virtual touch controls for a player. Internally composes
94
+ * {@link useVirtualControls} with theme-aware SVGs from `svg-assets.ts`.
95
+ *
96
+ * On desktop runtimes the provider stays dormant (with the default
97
+ * `enabled: 'auto'`), so it's safe to add this to any game's input
98
+ * configuration unconditionally.
99
+ *
100
+ * @example
101
+ * stage.setInputConfiguration(
102
+ * defaultTouchControls('p1', {
103
+ * theme: 'lagoon',
104
+ * joysticks: 'left',
105
+ * buttons: ['A', 'B'],
106
+ * }),
107
+ * );
108
+ */
109
+ declare function defaultTouchControls(player?: InputPlayer, options?: DefaultTouchControlsOptions): GameInputConfig;
110
+
111
+ export { type DefaultTouchControlsOptions as D, type JoystickSelection as J, type TouchTheme as T, type TouchThemeName as a, resolveButtonAccent as b, defaultTouchControls as d, resolveTouchTheme as r, touchThemes as t };