@rpgjs/client 5.0.0-beta.2 → 5.0.0-beta.22

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 (325) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/dist/Game/AnimationManager.d.ts +2 -1
  3. package/dist/Game/AnimationManager.js +21 -9
  4. package/dist/Game/AnimationManager.js.map +1 -1
  5. package/dist/Game/AnimationManager.spec.d.ts +1 -0
  6. package/dist/Game/ClientVisuals.d.ts +61 -0
  7. package/dist/Game/ClientVisuals.js +96 -0
  8. package/dist/Game/ClientVisuals.js.map +1 -0
  9. package/dist/Game/ClientVisuals.spec.d.ts +1 -0
  10. package/dist/Game/Event.js.map +1 -1
  11. package/dist/Game/EventComponentResolver.d.ts +16 -0
  12. package/dist/Game/EventComponentResolver.js +52 -0
  13. package/dist/Game/EventComponentResolver.js.map +1 -0
  14. package/dist/Game/EventComponentResolver.spec.d.ts +1 -0
  15. package/dist/Game/Map.d.ts +9 -1
  16. package/dist/Game/Map.js +83 -5
  17. package/dist/Game/Map.js.map +1 -1
  18. package/dist/Game/Object.d.ts +49 -15
  19. package/dist/Game/Object.js +101 -42
  20. package/dist/Game/Object.js.map +1 -1
  21. package/dist/Game/Object.spec.d.ts +1 -0
  22. package/dist/Game/Player.js.map +1 -1
  23. package/dist/Game/ProjectileManager.d.ts +98 -0
  24. package/dist/Game/ProjectileManager.js +196 -0
  25. package/dist/Game/ProjectileManager.js.map +1 -0
  26. package/dist/Game/ProjectileManager.spec.d.ts +1 -0
  27. package/dist/Gui/Gui.d.ts +20 -6
  28. package/dist/Gui/Gui.js +132 -57
  29. package/dist/Gui/Gui.js.map +1 -1
  30. package/dist/Gui/Gui.spec.d.ts +1 -0
  31. package/dist/Gui/NotificationManager.js.map +1 -1
  32. package/dist/Resource.js +1 -1
  33. package/dist/Resource.js.map +1 -1
  34. package/dist/RpgClient.d.ts +194 -15
  35. package/dist/RpgClientEngine.d.ts +191 -19
  36. package/dist/RpgClientEngine.js +693 -74
  37. package/dist/RpgClientEngine.js.map +1 -1
  38. package/dist/Sound.js.map +1 -1
  39. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
  40. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorateMetadata.js +1 -1
  41. package/dist/_virtual/_rolldown/runtime.js +13 -0
  42. package/dist/components/animations/animation.ce.js +6 -5
  43. package/dist/components/animations/animation.ce.js.map +1 -1
  44. package/dist/components/animations/fx.ce.js +60 -0
  45. package/dist/components/animations/fx.ce.js.map +1 -0
  46. package/dist/components/animations/hit.ce.js +24 -28
  47. package/dist/components/animations/hit.ce.js.map +1 -1
  48. package/dist/components/animations/index.d.ts +1 -0
  49. package/dist/components/animations/index.js +6 -4
  50. package/dist/components/animations/index.js.map +1 -1
  51. package/dist/components/character.ce.js +748 -249
  52. package/dist/components/character.ce.js.map +1 -1
  53. package/dist/components/dynamics/bar.ce.js +99 -0
  54. package/dist/components/dynamics/bar.ce.js.map +1 -0
  55. package/dist/components/dynamics/image.ce.js +26 -0
  56. package/dist/components/dynamics/image.ce.js.map +1 -0
  57. package/dist/components/dynamics/parse-value.d.ts +3 -0
  58. package/dist/components/dynamics/parse-value.js +54 -35
  59. package/dist/components/dynamics/parse-value.js.map +1 -1
  60. package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
  61. package/dist/components/dynamics/shape-utils.d.ts +16 -0
  62. package/dist/components/dynamics/shape-utils.js +73 -0
  63. package/dist/components/dynamics/shape-utils.js.map +1 -0
  64. package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
  65. package/dist/components/dynamics/shape.ce.js +86 -0
  66. package/dist/components/dynamics/shape.ce.js.map +1 -0
  67. package/dist/components/dynamics/text.ce.js +36 -56
  68. package/dist/components/dynamics/text.ce.js.map +1 -1
  69. package/dist/components/gui/box.ce.js +9 -9
  70. package/dist/components/gui/box.ce.js.map +1 -1
  71. package/dist/components/gui/dialogbox/index.ce.js +75 -65
  72. package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
  73. package/dist/components/gui/gameover.ce.js +47 -68
  74. package/dist/components/gui/gameover.ce.js.map +1 -1
  75. package/dist/components/gui/hud/hud.ce.js +23 -31
  76. package/dist/components/gui/hud/hud.ce.js.map +1 -1
  77. package/dist/components/gui/menu/equip-menu.ce.js +121 -172
  78. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
  79. package/dist/components/gui/menu/exit-menu.ce.js +15 -10
  80. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
  81. package/dist/components/gui/menu/items-menu.ce.js +62 -77
  82. package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
  83. package/dist/components/gui/menu/main-menu.ce.js +89 -104
  84. package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
  85. package/dist/components/gui/menu/options-menu.ce.js +12 -8
  86. package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
  87. package/dist/components/gui/menu/skills-menu.ce.js +17 -19
  88. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
  89. package/dist/components/gui/mobile/index.d.ts +51 -2
  90. package/dist/components/gui/mobile/index.js +14 -6
  91. package/dist/components/gui/mobile/index.js.map +1 -1
  92. package/dist/components/gui/mobile/index.spec.d.ts +1 -0
  93. package/dist/components/gui/mobile/mobile.ce.js +309 -59
  94. package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
  95. package/dist/components/gui/notification/notification.ce.js +28 -26
  96. package/dist/components/gui/notification/notification.ce.js.map +1 -1
  97. package/dist/components/gui/save-load.ce.js +81 -256
  98. package/dist/components/gui/save-load.ce.js.map +1 -1
  99. package/dist/components/gui/shop/shop.ce.js +107 -142
  100. package/dist/components/gui/shop/shop.ce.js.map +1 -1
  101. package/dist/components/gui/title-screen.ce.js +50 -73
  102. package/dist/components/gui/title-screen.ce.js.map +1 -1
  103. package/dist/components/index.d.ts +2 -1
  104. package/dist/components/index.js +1 -0
  105. package/dist/components/interaction-components.ce.js +22 -0
  106. package/dist/components/interaction-components.ce.js.map +1 -0
  107. package/dist/components/player-components-utils.d.ts +67 -0
  108. package/dist/components/player-components-utils.js +162 -0
  109. package/dist/components/player-components-utils.js.map +1 -0
  110. package/dist/components/player-components-utils.spec.d.ts +1 -0
  111. package/dist/components/player-components.ce.js +191 -0
  112. package/dist/components/player-components.ce.js.map +1 -0
  113. package/dist/components/prebuilt/hp-bar.ce.js +45 -45
  114. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
  115. package/dist/components/prebuilt/light-halo.ce.js +39 -60
  116. package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
  117. package/dist/components/scenes/canvas.ce.js +205 -27
  118. package/dist/components/scenes/canvas.ce.js.map +1 -1
  119. package/dist/components/scenes/draw-map.ce.js +39 -39
  120. package/dist/components/scenes/draw-map.ce.js.map +1 -1
  121. package/dist/components/scenes/event-layer.ce.js +51 -10
  122. package/dist/components/scenes/event-layer.ce.js.map +1 -1
  123. package/dist/core/inject.js +1 -1
  124. package/dist/core/inject.js.map +1 -1
  125. package/dist/core/setup.js +1 -1
  126. package/dist/core/setup.js.map +1 -1
  127. package/dist/decorators/spritesheet.d.ts +1 -0
  128. package/dist/decorators/spritesheet.js +11 -0
  129. package/dist/decorators/spritesheet.js.map +1 -0
  130. package/dist/i18n.d.ts +55 -0
  131. package/dist/i18n.js +60 -0
  132. package/dist/i18n.js.map +1 -0
  133. package/dist/i18n.spec.d.ts +1 -0
  134. package/dist/index.d.ts +8 -0
  135. package/dist/index.js +29 -21
  136. package/dist/module.js +45 -4
  137. package/dist/module.js.map +1 -1
  138. package/dist/node_modules/.pnpm/{@signe_di@2.9.0 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js +7 -117
  139. package/dist/node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js.map +1 -0
  140. package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js +239 -0
  141. package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map +1 -0
  142. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
  143. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
  144. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js +698 -0
  145. package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js.map +1 -0
  146. package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js +43 -0
  147. package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js.map +1 -0
  148. package/dist/node_modules/.pnpm/{@signe_sync@2.9.0 → @signe_sync@3.1.0_react@19.2.7}/node_modules/@signe/sync/dist/index.js +57 -141
  149. package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js.map +1 -0
  150. package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js} +30 -17
  151. package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js.map +1 -0
  152. package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js} +65 -34
  153. package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js.map +1 -0
  154. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +13 -0
  155. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js.map +1 -0
  156. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +106 -0
  157. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
  158. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +13 -0
  159. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
  160. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +121 -0
  161. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js.map +1 -0
  162. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
  163. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
  164. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
  165. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
  166. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
  167. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
  168. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +82 -0
  169. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
  170. package/dist/node_modules/.pnpm/{zod@3.24.2/node_modules/zod/lib/index.js → zod@3.25.76/node_modules/zod/v3/types.js} +74 -611
  171. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
  172. package/dist/presets/animation.js.map +1 -1
  173. package/dist/presets/faceset.js.map +1 -1
  174. package/dist/presets/icon.js.map +1 -1
  175. package/dist/presets/index.js.map +1 -1
  176. package/dist/presets/lpc.js.map +1 -1
  177. package/dist/presets/rmspritesheet.js.map +1 -1
  178. package/dist/services/AbstractSocket.d.ts +2 -0
  179. package/dist/services/AbstractSocket.js.map +1 -1
  180. package/dist/services/actionInput.d.ts +14 -0
  181. package/dist/services/actionInput.js +59 -0
  182. package/dist/services/actionInput.js.map +1 -0
  183. package/dist/services/actionInput.spec.d.ts +1 -0
  184. package/dist/services/cameraFollow.d.ts +51 -0
  185. package/dist/services/cameraFollow.js +134 -0
  186. package/dist/services/cameraFollow.js.map +1 -0
  187. package/dist/services/cameraFollow.spec.d.ts +1 -0
  188. package/dist/services/interactions.d.ts +159 -0
  189. package/dist/services/interactions.js +460 -0
  190. package/dist/services/interactions.js.map +1 -0
  191. package/dist/services/interactions.spec.d.ts +1 -0
  192. package/dist/services/keyboardControls.d.ts +1 -0
  193. package/dist/services/keyboardControls.js +1 -0
  194. package/dist/services/keyboardControls.js.map +1 -1
  195. package/dist/services/loadMap.d.ts +9 -0
  196. package/dist/services/loadMap.js +1 -1
  197. package/dist/services/loadMap.js.map +1 -1
  198. package/dist/services/mmorpg-connection.d.ts +5 -0
  199. package/dist/services/mmorpg-connection.js +50 -0
  200. package/dist/services/mmorpg-connection.js.map +1 -0
  201. package/dist/services/mmorpg-connection.spec.d.ts +1 -0
  202. package/dist/services/mmorpg.d.ts +11 -4
  203. package/dist/services/mmorpg.js +57 -33
  204. package/dist/services/mmorpg.js.map +1 -1
  205. package/dist/services/pointerContext.d.ts +11 -0
  206. package/dist/services/pointerContext.js +48 -0
  207. package/dist/services/pointerContext.js.map +1 -0
  208. package/dist/services/pointerContext.spec.d.ts +1 -0
  209. package/dist/services/save.js.map +1 -1
  210. package/dist/services/save.spec.d.ts +1 -0
  211. package/dist/services/standalone-message.d.ts +1 -0
  212. package/dist/services/standalone-message.js +9 -0
  213. package/dist/services/standalone-message.js.map +1 -0
  214. package/dist/services/standalone.d.ts +4 -1
  215. package/dist/services/standalone.js +36 -16
  216. package/dist/services/standalone.js.map +1 -1
  217. package/dist/services/standalone.spec.d.ts +1 -0
  218. package/dist/utils/getEntityProp.js +4 -3
  219. package/dist/utils/getEntityProp.js.map +1 -1
  220. package/dist/utils/getEntityProp.spec.d.ts +1 -0
  221. package/dist/utils/mapId.d.ts +1 -0
  222. package/dist/utils/mapId.js +6 -0
  223. package/dist/utils/mapId.js.map +1 -0
  224. package/dist/utils/readPropValue.d.ts +2 -0
  225. package/dist/utils/readPropValue.js +13 -0
  226. package/dist/utils/readPropValue.js.map +1 -0
  227. package/package.json +13 -13
  228. package/src/Game/AnimationManager.spec.ts +30 -0
  229. package/src/Game/AnimationManager.ts +26 -10
  230. package/src/Game/ClientVisuals.spec.ts +56 -0
  231. package/src/Game/ClientVisuals.ts +184 -0
  232. package/src/Game/EventComponentResolver.spec.ts +84 -0
  233. package/src/Game/EventComponentResolver.ts +74 -0
  234. package/src/Game/Map.ts +134 -2
  235. package/src/Game/Object.spec.ts +59 -0
  236. package/src/Game/Object.ts +181 -77
  237. package/src/Game/ProjectileManager.spec.ts +449 -0
  238. package/src/Game/ProjectileManager.ts +346 -0
  239. package/src/Gui/Gui.spec.ts +359 -0
  240. package/src/Gui/Gui.ts +178 -67
  241. package/src/Resource.ts +1 -2
  242. package/src/RpgClient.ts +220 -17
  243. package/src/RpgClientEngine.ts +995 -133
  244. package/src/components/animations/fx.ce +101 -0
  245. package/src/components/animations/index.ts +4 -2
  246. package/src/components/character.ce +839 -45
  247. package/src/components/dynamics/bar.ce +88 -0
  248. package/src/components/dynamics/image.ce +21 -0
  249. package/src/components/dynamics/parse-value.spec.ts +83 -0
  250. package/src/components/dynamics/parse-value.ts +111 -37
  251. package/src/components/dynamics/shape-utils.spec.ts +46 -0
  252. package/src/components/dynamics/shape-utils.ts +61 -0
  253. package/src/components/dynamics/shape.ce +90 -0
  254. package/src/components/dynamics/text.ce +35 -149
  255. package/src/components/gui/dialogbox/index.ce +52 -21
  256. package/src/components/gui/gameover.ce +6 -4
  257. package/src/components/gui/menu/equip-menu.ce +11 -9
  258. package/src/components/gui/menu/exit-menu.ce +6 -4
  259. package/src/components/gui/menu/items-menu.ce +11 -9
  260. package/src/components/gui/menu/main-menu.ce +14 -12
  261. package/src/components/gui/menu/options-menu.ce +4 -3
  262. package/src/components/gui/menu/skills-menu.ce +2 -1
  263. package/src/components/gui/mobile/index.spec.ts +94 -0
  264. package/src/components/gui/mobile/index.ts +74 -6
  265. package/src/components/gui/mobile/mobile.ce +347 -65
  266. package/src/components/gui/notification/notification.ce +7 -1
  267. package/src/components/gui/save-load.ce +13 -11
  268. package/src/components/gui/shop/shop.ce +20 -18
  269. package/src/components/gui/title-screen.ce +6 -4
  270. package/src/components/index.ts +2 -1
  271. package/src/components/interaction-components.ce +23 -0
  272. package/src/components/player-components-utils.spec.ts +109 -0
  273. package/src/components/player-components-utils.ts +205 -0
  274. package/src/components/player-components.ce +222 -0
  275. package/src/components/prebuilt/hp-bar.ce +4 -3
  276. package/src/components/prebuilt/light-halo.ce +2 -2
  277. package/src/components/scenes/canvas.ce +219 -15
  278. package/src/components/scenes/draw-map.ce +34 -22
  279. package/src/components/scenes/event-layer.ce +55 -4
  280. package/src/core/setup.ts +2 -2
  281. package/src/decorators/spritesheet.ts +8 -0
  282. package/src/i18n.spec.ts +39 -0
  283. package/src/i18n.ts +59 -0
  284. package/src/index.ts +19 -0
  285. package/src/module.ts +61 -11
  286. package/src/services/AbstractSocket.ts +3 -0
  287. package/src/services/actionInput.spec.ts +155 -0
  288. package/src/services/actionInput.ts +120 -0
  289. package/src/services/cameraFollow.spec.ts +220 -0
  290. package/src/services/cameraFollow.ts +222 -0
  291. package/src/services/interactions.spec.ts +175 -0
  292. package/src/services/interactions.ts +722 -0
  293. package/src/services/keyboardControls.ts +2 -1
  294. package/src/services/loadMap.ts +5 -1
  295. package/src/services/mmorpg-connection.spec.ts +99 -0
  296. package/src/services/mmorpg-connection.ts +69 -0
  297. package/src/services/mmorpg.ts +70 -36
  298. package/src/services/pointerContext.spec.ts +36 -0
  299. package/src/services/pointerContext.ts +84 -0
  300. package/src/services/save.spec.ts +127 -0
  301. package/src/services/standalone-message.ts +7 -0
  302. package/src/services/standalone.spec.ts +54 -0
  303. package/src/services/standalone.ts +44 -12
  304. package/src/utils/getEntityProp.spec.ts +96 -0
  305. package/src/utils/getEntityProp.ts +4 -3
  306. package/src/utils/mapId.ts +2 -0
  307. package/src/utils/readPropValue.ts +16 -0
  308. package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +0 -1
  309. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +0 -457
  310. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +0 -1
  311. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +0 -463
  312. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +0 -1
  313. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +0 -2191
  314. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +0 -1
  315. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +0 -10
  316. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +0 -1
  317. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js +0 -91
  318. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +0 -1
  319. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +0 -1
  320. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +0 -14
  321. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +0 -1
  322. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +0 -1
  323. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +0 -1
  324. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +0 -2
  325. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +0 -1
@@ -0,0 +1,222 @@
1
+ export const DEFAULT_CAMERA_FOLLOW_TIME = 1000;
2
+ export const DEFAULT_CAMERA_FOLLOW_EASE = "easeInOutSine";
3
+
4
+ export const CAMERA_FOLLOW_EASES = [
5
+ "linear",
6
+ "easeInQuad",
7
+ "easeOutQuad",
8
+ "easeInOutQuad",
9
+ "easeInCubic",
10
+ "easeOutCubic",
11
+ "easeInOutCubic",
12
+ "easeInQuart",
13
+ "easeOutQuart",
14
+ "easeInOutQuart",
15
+ "easeInQuint",
16
+ "easeOutQuint",
17
+ "easeInOutQuint",
18
+ "easeInSine",
19
+ "easeOutSine",
20
+ "easeInOutSine",
21
+ "easeInExpo",
22
+ "easeOutExpo",
23
+ "easeInOutExpo",
24
+ "easeInCirc",
25
+ "easeOutCirc",
26
+ "easeInOutCirc",
27
+ "easeInElastic",
28
+ "easeOutElastic",
29
+ "easeInOutElastic",
30
+ "easeInBack",
31
+ "easeOutBack",
32
+ "easeInOutBack",
33
+ "easeInBounce",
34
+ "easeOutBounce",
35
+ "easeInOutBounce",
36
+ ] as const;
37
+
38
+ export type CameraFollowEase = typeof CAMERA_FOLLOW_EASES[number];
39
+
40
+ export type CameraFollowSmoothMoveOptions = {
41
+ /** Enable or disable the smooth transition when options are sent as an object. */
42
+ enabled?: boolean;
43
+ /** Duration of the transition to the new camera target, in milliseconds. */
44
+ time?: number;
45
+ /** pixi-viewport easing name, for example "easeInOutQuad". */
46
+ ease?: CameraFollowEase;
47
+ /** Continuous follow speed after the transition. 0 keeps the target centered instantly. */
48
+ speed?: number;
49
+ /** Continuous follow acceleration after the transition. */
50
+ acceleration?: number | null;
51
+ /** Center radius where the followed target can move without moving the viewport. */
52
+ radius?: number | null;
53
+ };
54
+
55
+ export type CameraFollowSmoothMove = boolean | CameraFollowSmoothMoveOptions;
56
+
57
+ export type CameraFollowTarget = {
58
+ x: number;
59
+ y: number;
60
+ destroyed?: boolean;
61
+ } | null | undefined;
62
+
63
+ export type CameraFollowPosition = {
64
+ x: number;
65
+ y: number;
66
+ };
67
+
68
+ export interface CameraFollowApplyContext {
69
+ viewport: any;
70
+ target: CameraFollowTarget;
71
+ smoothMove: CameraFollowSmoothMove;
72
+ followRevision: number;
73
+ isCurrentRevision: (revision: number) => boolean;
74
+ shouldFollowCamera: () => boolean;
75
+ }
76
+
77
+ const finiteNumber = (value: unknown, fallback: number) => {
78
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
79
+ };
80
+
81
+ const isCameraFollowEase = (value: unknown): value is CameraFollowEase => {
82
+ return typeof value === "string" && (CAMERA_FOLLOW_EASES as readonly string[]).includes(value);
83
+ };
84
+
85
+ export const smoothMoveEnabled = (smoothMove: CameraFollowSmoothMove) => {
86
+ if (smoothMove === false) return false;
87
+ if (typeof smoothMove === "object" && smoothMove !== null && smoothMove.enabled === false) {
88
+ return false;
89
+ }
90
+ return true;
91
+ };
92
+
93
+ export const cameraFollowAnimationOptions = (
94
+ smoothMove: CameraFollowSmoothMove
95
+ ) => {
96
+ if (!smoothMoveEnabled(smoothMove)) return null;
97
+ const options = typeof smoothMove === "object" && smoothMove !== null ? smoothMove : {};
98
+ return {
99
+ time: Math.max(0, finiteNumber(options.time, DEFAULT_CAMERA_FOLLOW_TIME)),
100
+ ease: isCameraFollowEase(options.ease) ? options.ease : DEFAULT_CAMERA_FOLLOW_EASE,
101
+ };
102
+ };
103
+
104
+ export const cameraFollowOptions = (smoothMove: CameraFollowSmoothMove) => {
105
+ if (typeof smoothMove !== "object" || smoothMove === null) return undefined;
106
+ const options: { speed?: number; acceleration?: number | null; radius?: number | null } = {};
107
+ if (typeof smoothMove.speed === "number" && Number.isFinite(smoothMove.speed)) {
108
+ options.speed = Math.max(0, smoothMove.speed);
109
+ }
110
+ if (typeof smoothMove.acceleration === "number" && Number.isFinite(smoothMove.acceleration)) {
111
+ options.acceleration = Math.max(0, smoothMove.acceleration);
112
+ } else if (smoothMove.acceleration === null) {
113
+ options.acceleration = null;
114
+ }
115
+ if (typeof smoothMove.radius === "number" && Number.isFinite(smoothMove.radius)) {
116
+ options.radius = Math.max(0, smoothMove.radius);
117
+ } else if (smoothMove.radius === null) {
118
+ options.radius = null;
119
+ }
120
+ return Object.keys(options).length > 0 ? options : undefined;
121
+ };
122
+
123
+ export const clearCameraFollowPlugins = (viewport: any) => {
124
+ viewport?.plugins?.remove?.("animate");
125
+ viewport?.plugins?.remove?.("follow");
126
+ };
127
+
128
+ export const ownsCameraFollowRevision = (
129
+ appliedRevision: number | null,
130
+ currentRevision: number
131
+ ) => {
132
+ return appliedRevision !== null && appliedRevision === currentRevision;
133
+ };
134
+
135
+ export const readCameraFollowPosition = (
136
+ target: CameraFollowTarget
137
+ ): CameraFollowPosition | null => {
138
+ if (!target) return null;
139
+
140
+ try {
141
+ if (target.destroyed) return null;
142
+ const x = target.x;
143
+ const y = target.y;
144
+ if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
145
+ return { x, y };
146
+ } catch {
147
+ return null;
148
+ }
149
+ };
150
+
151
+ const createCameraFollowTarget = (
152
+ target: CameraFollowTarget,
153
+ initialPosition: CameraFollowPosition
154
+ ) => {
155
+ let lastPosition = initialPosition;
156
+
157
+ const readPosition = () => {
158
+ const nextPosition = readCameraFollowPosition(target);
159
+ if (nextPosition) {
160
+ lastPosition = nextPosition;
161
+ }
162
+ return lastPosition;
163
+ };
164
+
165
+ return {
166
+ get x() {
167
+ return readPosition().x;
168
+ },
169
+ get y() {
170
+ return readPosition().y;
171
+ },
172
+ };
173
+ };
174
+
175
+ export const followCameraInstantly = (
176
+ viewport: any,
177
+ target: CameraFollowTarget,
178
+ smoothMove: CameraFollowSmoothMove
179
+ ) => {
180
+ const position = readCameraFollowPosition(target);
181
+ if (!position) return false;
182
+
183
+ const followTarget = createCameraFollowTarget(target, position);
184
+ const followOptions = cameraFollowOptions(smoothMove);
185
+ if (followOptions) {
186
+ viewport.follow(followTarget, followOptions);
187
+ } else {
188
+ viewport.follow(followTarget);
189
+ }
190
+ return true;
191
+ };
192
+
193
+ export const applyCameraFollow = ({
194
+ viewport,
195
+ target,
196
+ smoothMove,
197
+ followRevision,
198
+ isCurrentRevision,
199
+ shouldFollowCamera,
200
+ }: CameraFollowApplyContext) => {
201
+ clearCameraFollowPlugins(viewport);
202
+
203
+ const position = readCameraFollowPosition(target);
204
+ if (!position) return false;
205
+
206
+ const animationOptions = cameraFollowAnimationOptions(smoothMove);
207
+ if (!animationOptions || animationOptions.time <= 0) {
208
+ return followCameraInstantly(viewport, target, smoothMove);
209
+ }
210
+
211
+ viewport.animate({
212
+ position,
213
+ time: animationOptions.time,
214
+ ease: animationOptions.ease,
215
+ callbackOnComplete: () => {
216
+ if (!isCurrentRevision(followRevision) || !shouldFollowCamera()) return;
217
+ if (!readCameraFollowPosition(target)) return;
218
+ followCameraInstantly(viewport, target, smoothMove);
219
+ },
220
+ });
221
+ return true;
222
+ };
@@ -0,0 +1,175 @@
1
+ import { describe, expect, test, vi } from "vitest";
2
+ import {
3
+ dragToTile,
4
+ hoverPopover,
5
+ RpgClientInteractions,
6
+ selectable,
7
+ } from "./interactions";
8
+ import { createClientPointerContext } from "./pointerContext";
9
+
10
+ function createClient() {
11
+ const client = {
12
+ pointer: createClientPointerContext(),
13
+ processAction: vi.fn(),
14
+ sceneMap: {
15
+ tileWidth: 16,
16
+ tileHeight: 16,
17
+ },
18
+ } as any;
19
+ client.interactions = new RpgClientInteractions(client);
20
+ return client;
21
+ }
22
+
23
+ describe("RpgClientInteractions", () => {
24
+ test("renders registered components with sprite state and bounds", () => {
25
+ const client = createClient();
26
+ const Popover = () => null;
27
+ const sprite = { id: "event-1", name: "Guard" };
28
+
29
+ client.interactions.use("Guard", hoverPopover(Popover, { label: "Talk" }));
30
+ client.interactions.handle(sprite, "pointerover", {
31
+ bounds: {
32
+ graphic: { left: 1, top: 2, right: 11, bottom: 22, width: 10, height: 20, centerX: 6, centerY: 12 } as any,
33
+ },
34
+ });
35
+
36
+ const entries = client.interactions.getRenderedComponents(sprite, {
37
+ graphic: { left: 1, top: 2, right: 11, bottom: 22, width: 10, height: 20, centerX: 6, centerY: 12 } as any,
38
+ });
39
+
40
+ expect(entries).toHaveLength(1);
41
+ expect(entries[0].component).toBe(Popover);
42
+ expect(entries[0].props.label).toBe("Talk");
43
+ expect(entries[0].props.state.hovered).toBe(true);
44
+ expect(entries[0].props.bounds.centerX).toBe(6);
45
+ });
46
+
47
+ test("keeps clicks client-only unless a behavior sends an action", () => {
48
+ const client = createClient();
49
+ const sprite = { id: "event-1", name: "Guard" };
50
+
51
+ client.interactions.use("Guard", selectable());
52
+ client.interactions.handle(sprite, "click");
53
+
54
+ expect(client.interactions.getState(sprite).selected).toBe(true);
55
+ expect(client.processAction).not.toHaveBeenCalled();
56
+
57
+ client.interactions.use("Guard", {
58
+ click(ctx) {
59
+ ctx.action("guard:talk", { eventId: ctx.target.id });
60
+ },
61
+ });
62
+ client.interactions.handle(sprite, "click");
63
+
64
+ expect(client.processAction).toHaveBeenCalledWith("guard:talk", { eventId: "event-1" });
65
+ });
66
+
67
+ test("uses behavior hit tests before changing hover state", () => {
68
+ const client = createClient();
69
+ const sprite = { id: "event-1", name: "Tree" };
70
+
71
+ client.pointer.update({ x: 0, y: 0 }, { x: 40, y: 40 });
72
+ client.interactions.use("Tree", {
73
+ cursor: "pointer",
74
+ hitTest(ctx) {
75
+ return ctx.bounds("hitbox").contains(ctx.pointer.world());
76
+ },
77
+ });
78
+
79
+ client.interactions.handle(sprite, "pointerover", {
80
+ bounds: {
81
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
82
+ },
83
+ });
84
+
85
+ expect(client.interactions.getState(sprite).hovered).toBe(false);
86
+ expect(client.interactions.cursorFor(sprite, {
87
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
88
+ })).toBeUndefined();
89
+ });
90
+
91
+ test("exposes handler bounds in world coordinates", () => {
92
+ const client = createClient();
93
+ const sprite = { id: "crate-1", name: "Crate", x: () => 100, y: () => 80 };
94
+
95
+ client.pointer.update({ x: 0, y: 0 }, { x: 112, y: 92 });
96
+ client.interactions.use("Crate", {
97
+ component: () => null,
98
+ cursor: "grab",
99
+ hitTest(ctx) {
100
+ return ctx.bounds("hitbox").contains(ctx.pointer.world());
101
+ },
102
+ });
103
+
104
+ client.interactions.handle(sprite, "pointerover", {
105
+ bounds: {
106
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
107
+ },
108
+ });
109
+
110
+ expect(client.interactions.getState(sprite).hovered).toBe(true);
111
+ expect(client.interactions.cursorFor(sprite, {
112
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
113
+ })).toBe("grab");
114
+
115
+ const [entry] = client.interactions.getRenderedComponents(sprite, {
116
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
117
+ });
118
+ expect(entry?.props.bounds.centerX).toBe(8);
119
+ });
120
+
121
+ test("updates hit-tested hover while moving inside an already hovered sprite", () => {
122
+ const client = createClient();
123
+ const sprite = { id: "crate-1", name: "Crate", x: () => 100, y: () => 80 };
124
+
125
+ client.interactions.use("Crate", {
126
+ hitTest(ctx) {
127
+ return ctx.bounds("hitbox").contains(ctx.pointer.world());
128
+ },
129
+ });
130
+
131
+ client.pointer.update({ x: 0, y: 0 }, { x: 140, y: 120 });
132
+ client.interactions.handle(sprite, "pointerover", {
133
+ bounds: {
134
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
135
+ },
136
+ });
137
+ expect(client.interactions.getState(sprite).hovered).toBe(false);
138
+
139
+ client.pointer.update({ x: 0, y: 0 }, { x: 112, y: 92 });
140
+ client.interactions.handle(sprite, "pointermove", {
141
+ bounds: {
142
+ hitbox: { left: 0, top: 0, right: 16, bottom: 16, width: 16, height: 16, centerX: 8, centerY: 8 } as any,
143
+ },
144
+ });
145
+
146
+ expect(client.interactions.getState(sprite).hovered).toBe(true);
147
+ });
148
+
149
+ test("runs drag lifecycle and resolves pointer tile on drop", () => {
150
+ const client = createClient();
151
+ const sprite = { id: "crate-1", name: "Crate" };
152
+
153
+ client.interactions.use("Crate", dragToTile({ action: "crate:move" }));
154
+ client.pointer.update({ x: 0, y: 0 }, { x: 18, y: 35 });
155
+ client.interactions.handle(sprite, "pointerdown");
156
+
157
+ expect(client.interactions.getState(sprite).dragging).toBe(true);
158
+
159
+ client.pointer.update({ x: 0, y: 0 }, { x: 33, y: 47 });
160
+ client.interactions.handlePointerUp();
161
+
162
+ expect(client.interactions.getState(sprite).dragging).toBe(false);
163
+ expect(client.processAction).toHaveBeenCalledWith("crate:move", {
164
+ eventId: "crate-1",
165
+ position: {
166
+ x: 2,
167
+ y: 2,
168
+ worldX: 32,
169
+ worldY: 32,
170
+ width: 16,
171
+ height: 16,
172
+ },
173
+ });
174
+ });
175
+ });