fraxel 0.1.0-alpha.1

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 (501) hide show
  1. package/dist/animation/easing.d.ts +29 -0
  2. package/dist/animation/easing.d.ts.map +1 -0
  3. package/dist/animation/easing.js +50 -0
  4. package/dist/animation/easing.js.map +1 -0
  5. package/dist/animation/index.d.ts +7 -0
  6. package/dist/animation/index.d.ts.map +1 -0
  7. package/dist/animation/index.js +7 -0
  8. package/dist/animation/index.js.map +1 -0
  9. package/dist/animation/multiple.d.ts +26 -0
  10. package/dist/animation/multiple.d.ts.map +1 -0
  11. package/dist/animation/multiple.js +27 -0
  12. package/dist/animation/multiple.js.map +1 -0
  13. package/dist/animation/properties.d.ts +30 -0
  14. package/dist/animation/properties.d.ts.map +1 -0
  15. package/dist/animation/properties.js +32 -0
  16. package/dist/animation/properties.js.map +1 -0
  17. package/dist/animation/sequences.d.ts +30 -0
  18. package/dist/animation/sequences.d.ts.map +1 -0
  19. package/dist/animation/sequences.js +50 -0
  20. package/dist/animation/sequences.js.map +1 -0
  21. package/dist/animation/sprite-sheet.d.ts +81 -0
  22. package/dist/animation/sprite-sheet.d.ts.map +1 -0
  23. package/dist/animation/sprite-sheet.js +103 -0
  24. package/dist/animation/sprite-sheet.js.map +1 -0
  25. package/dist/animation/tween.d.ts +78 -0
  26. package/dist/animation/tween.d.ts.map +1 -0
  27. package/dist/animation/tween.js +103 -0
  28. package/dist/animation/tween.js.map +1 -0
  29. package/dist/assets/index.d.ts +6 -0
  30. package/dist/assets/index.d.ts.map +1 -0
  31. package/dist/assets/index.js +5 -0
  32. package/dist/assets/index.js.map +1 -0
  33. package/dist/assets/load-sound.d.ts +17 -0
  34. package/dist/assets/load-sound.d.ts.map +1 -0
  35. package/dist/assets/load-sound.js +35 -0
  36. package/dist/assets/load-sound.js.map +1 -0
  37. package/dist/assets/load-texture.d.ts +12 -0
  38. package/dist/assets/load-texture.d.ts.map +1 -0
  39. package/dist/assets/load-texture.js +40 -0
  40. package/dist/assets/load-texture.js.map +1 -0
  41. package/dist/assets/loader.d.ts +59 -0
  42. package/dist/assets/loader.d.ts.map +1 -0
  43. package/dist/assets/loader.js +65 -0
  44. package/dist/assets/loader.js.map +1 -0
  45. package/dist/assets/texture.d.ts +36 -0
  46. package/dist/assets/texture.d.ts.map +1 -0
  47. package/dist/assets/texture.js +49 -0
  48. package/dist/assets/texture.js.map +1 -0
  49. package/dist/audio/audio-context.d.ts +14 -0
  50. package/dist/audio/audio-context.d.ts.map +1 -0
  51. package/dist/audio/audio-context.js +20 -0
  52. package/dist/audio/audio-context.js.map +1 -0
  53. package/dist/audio/index.d.ts +2 -0
  54. package/dist/audio/index.d.ts.map +1 -0
  55. package/dist/audio/index.js +2 -0
  56. package/dist/audio/index.js.map +1 -0
  57. package/dist/collision/broadphase/spatial-hash.d.ts +32 -0
  58. package/dist/collision/broadphase/spatial-hash.d.ts.map +1 -0
  59. package/dist/collision/broadphase/spatial-hash.js +87 -0
  60. package/dist/collision/broadphase/spatial-hash.js.map +1 -0
  61. package/dist/collision/collision-system.d.ts +52 -0
  62. package/dist/collision/collision-system.d.ts.map +1 -0
  63. package/dist/collision/collision-system.js +278 -0
  64. package/dist/collision/collision-system.js.map +1 -0
  65. package/dist/collision/events/collision-emitter.d.ts +38 -0
  66. package/dist/collision/events/collision-emitter.d.ts.map +1 -0
  67. package/dist/collision/events/collision-emitter.js +47 -0
  68. package/dist/collision/events/collision-emitter.js.map +1 -0
  69. package/dist/collision/index.d.ts +13 -0
  70. package/dist/collision/index.d.ts.map +1 -0
  71. package/dist/collision/index.js +11 -0
  72. package/dist/collision/index.js.map +1 -0
  73. package/dist/collision/narrowphase/detector.d.ts +26 -0
  74. package/dist/collision/narrowphase/detector.d.ts.map +1 -0
  75. package/dist/collision/narrowphase/detector.js +70 -0
  76. package/dist/collision/narrowphase/detector.js.map +1 -0
  77. package/dist/collision/narrowphase/shapes.d.ts +91 -0
  78. package/dist/collision/narrowphase/shapes.d.ts.map +1 -0
  79. package/dist/collision/narrowphase/shapes.js +52 -0
  80. package/dist/collision/narrowphase/shapes.js.map +1 -0
  81. package/dist/collision/physics/physics-body.d.ts +38 -0
  82. package/dist/collision/physics/physics-body.d.ts.map +1 -0
  83. package/dist/collision/physics/physics-body.js +53 -0
  84. package/dist/collision/physics/physics-body.js.map +1 -0
  85. package/dist/collision/physics/physics-system.d.ts +23 -0
  86. package/dist/collision/physics/physics-system.d.ts.map +1 -0
  87. package/dist/collision/physics/physics-system.js +86 -0
  88. package/dist/collision/physics/physics-system.js.map +1 -0
  89. package/dist/collision/physics/resolver.d.ts +16 -0
  90. package/dist/collision/physics/resolver.d.ts.map +1 -0
  91. package/dist/collision/physics/resolver.js +91 -0
  92. package/dist/collision/physics/resolver.js.map +1 -0
  93. package/dist/collision/types.d.ts +22 -0
  94. package/dist/collision/types.d.ts.map +1 -0
  95. package/dist/collision/types.js +2 -0
  96. package/dist/collision/types.js.map +1 -0
  97. package/dist/core/game-config.d.ts +34 -0
  98. package/dist/core/game-config.d.ts.map +1 -0
  99. package/dist/core/game-config.js +31 -0
  100. package/dist/core/game-config.js.map +1 -0
  101. package/dist/core/game.d.ts +86 -0
  102. package/dist/core/game.d.ts.map +1 -0
  103. package/dist/core/game.js +166 -0
  104. package/dist/core/game.js.map +1 -0
  105. package/dist/core/index.d.ts +6 -0
  106. package/dist/core/index.d.ts.map +1 -0
  107. package/dist/core/index.js +6 -0
  108. package/dist/core/index.js.map +1 -0
  109. package/dist/core/scene-manager.d.ts +28 -0
  110. package/dist/core/scene-manager.d.ts.map +1 -0
  111. package/dist/core/scene-manager.js +65 -0
  112. package/dist/core/scene-manager.js.map +1 -0
  113. package/dist/core/scene.d.ts +43 -0
  114. package/dist/core/scene.d.ts.map +1 -0
  115. package/dist/core/scene.js +48 -0
  116. package/dist/core/scene.js.map +1 -0
  117. package/dist/core/theme.d.ts +63 -0
  118. package/dist/core/theme.d.ts.map +1 -0
  119. package/dist/core/theme.js +59 -0
  120. package/dist/core/theme.js.map +1 -0
  121. package/dist/errors/animation.d.ts +24 -0
  122. package/dist/errors/animation.d.ts.map +1 -0
  123. package/dist/errors/animation.js +29 -0
  124. package/dist/errors/animation.js.map +1 -0
  125. package/dist/errors/assets.d.ts +34 -0
  126. package/dist/errors/assets.d.ts.map +1 -0
  127. package/dist/errors/assets.js +41 -0
  128. package/dist/errors/assets.js.map +1 -0
  129. package/dist/errors/base.d.ts +12 -0
  130. package/dist/errors/base.d.ts.map +1 -0
  131. package/dist/errors/base.js +15 -0
  132. package/dist/errors/base.js.map +1 -0
  133. package/dist/errors/env.d.ts +24 -0
  134. package/dist/errors/env.d.ts.map +1 -0
  135. package/dist/errors/env.js +29 -0
  136. package/dist/errors/env.js.map +1 -0
  137. package/dist/errors/hook.d.ts +46 -0
  138. package/dist/errors/hook.d.ts.map +1 -0
  139. package/dist/errors/hook.js +55 -0
  140. package/dist/errors/hook.js.map +1 -0
  141. package/dist/errors/index.d.ts +11 -0
  142. package/dist/errors/index.d.ts.map +1 -0
  143. package/dist/errors/index.js +11 -0
  144. package/dist/errors/index.js.map +1 -0
  145. package/dist/errors/jsx.d.ts +26 -0
  146. package/dist/errors/jsx.d.ts.map +1 -0
  147. package/dist/errors/jsx.js +45 -0
  148. package/dist/errors/jsx.js.map +1 -0
  149. package/dist/errors/lifecycle.d.ts +35 -0
  150. package/dist/errors/lifecycle.d.ts.map +1 -0
  151. package/dist/errors/lifecycle.js +42 -0
  152. package/dist/errors/lifecycle.js.map +1 -0
  153. package/dist/errors/math.d.ts +24 -0
  154. package/dist/errors/math.d.ts.map +1 -0
  155. package/dist/errors/math.js +34 -0
  156. package/dist/errors/math.js.map +1 -0
  157. package/dist/errors/node.d.ts +68 -0
  158. package/dist/errors/node.d.ts.map +1 -0
  159. package/dist/errors/node.js +87 -0
  160. package/dist/errors/node.js.map +1 -0
  161. package/dist/errors/scene.d.ts +35 -0
  162. package/dist/errors/scene.d.ts.map +1 -0
  163. package/dist/errors/scene.js +42 -0
  164. package/dist/errors/scene.js.map +1 -0
  165. package/dist/events/event.d.ts +106 -0
  166. package/dist/events/event.d.ts.map +1 -0
  167. package/dist/events/event.js +125 -0
  168. package/dist/events/event.js.map +1 -0
  169. package/dist/events/index.d.ts +2 -0
  170. package/dist/events/index.d.ts.map +1 -0
  171. package/dist/events/index.js +2 -0
  172. package/dist/events/index.js.map +1 -0
  173. package/dist/events/types.d.ts +20 -0
  174. package/dist/events/types.d.ts.map +1 -0
  175. package/dist/events/types.js +2 -0
  176. package/dist/events/types.js.map +1 -0
  177. package/dist/hooks/context.d.ts +15 -0
  178. package/dist/hooks/context.d.ts.map +1 -0
  179. package/dist/hooks/context.js +26 -0
  180. package/dist/hooks/context.js.map +1 -0
  181. package/dist/hooks/deriveds/by-nodes/index.d.ts +7 -0
  182. package/dist/hooks/deriveds/by-nodes/index.d.ts.map +1 -0
  183. package/dist/hooks/deriveds/by-nodes/index.js +7 -0
  184. package/dist/hooks/deriveds/by-nodes/index.js.map +1 -0
  185. package/dist/hooks/deriveds/by-nodes/use-animation.d.ts +44 -0
  186. package/dist/hooks/deriveds/by-nodes/use-animation.d.ts.map +1 -0
  187. package/dist/hooks/deriveds/by-nodes/use-animation.js +61 -0
  188. package/dist/hooks/deriveds/by-nodes/use-animation.js.map +1 -0
  189. package/dist/hooks/deriveds/by-nodes/use-audio.d.ts +33 -0
  190. package/dist/hooks/deriveds/by-nodes/use-audio.d.ts.map +1 -0
  191. package/dist/hooks/deriveds/by-nodes/use-audio.js +43 -0
  192. package/dist/hooks/deriveds/by-nodes/use-audio.js.map +1 -0
  193. package/dist/hooks/deriveds/by-nodes/use-clickable.d.ts +32 -0
  194. package/dist/hooks/deriveds/by-nodes/use-clickable.d.ts.map +1 -0
  195. package/dist/hooks/deriveds/by-nodes/use-clickable.js +43 -0
  196. package/dist/hooks/deriveds/by-nodes/use-clickable.js.map +1 -0
  197. package/dist/hooks/deriveds/by-nodes/use-collider.d.ts +35 -0
  198. package/dist/hooks/deriveds/by-nodes/use-collider.d.ts.map +1 -0
  199. package/dist/hooks/deriveds/by-nodes/use-collider.js +55 -0
  200. package/dist/hooks/deriveds/by-nodes/use-collider.js.map +1 -0
  201. package/dist/hooks/deriveds/by-nodes/use-ray-cast.d.ts +35 -0
  202. package/dist/hooks/deriveds/by-nodes/use-ray-cast.d.ts.map +1 -0
  203. package/dist/hooks/deriveds/by-nodes/use-ray-cast.js +47 -0
  204. package/dist/hooks/deriveds/by-nodes/use-ray-cast.js.map +1 -0
  205. package/dist/hooks/deriveds/by-nodes/use-timer.d.ts +34 -0
  206. package/dist/hooks/deriveds/by-nodes/use-timer.d.ts.map +1 -0
  207. package/dist/hooks/deriveds/by-nodes/use-timer.js +48 -0
  208. package/dist/hooks/deriveds/by-nodes/use-timer.js.map +1 -0
  209. package/dist/hooks/deriveds/index.d.ts +5 -0
  210. package/dist/hooks/deriveds/index.d.ts.map +1 -0
  211. package/dist/hooks/deriveds/index.js +5 -0
  212. package/dist/hooks/deriveds/index.js.map +1 -0
  213. package/dist/hooks/deriveds/use-condition.d.ts +37 -0
  214. package/dist/hooks/deriveds/use-condition.d.ts.map +1 -0
  215. package/dist/hooks/deriveds/use-condition.js +47 -0
  216. package/dist/hooks/deriveds/use-condition.js.map +1 -0
  217. package/dist/hooks/deriveds/use-match.d.ts +26 -0
  218. package/dist/hooks/deriveds/use-match.d.ts.map +1 -0
  219. package/dist/hooks/deriveds/use-match.js +38 -0
  220. package/dist/hooks/deriveds/use-match.js.map +1 -0
  221. package/dist/hooks/deriveds/use-partial-node.d.ts +22 -0
  222. package/dist/hooks/deriveds/use-partial-node.d.ts.map +1 -0
  223. package/dist/hooks/deriveds/use-partial-node.js +25 -0
  224. package/dist/hooks/deriveds/use-partial-node.js.map +1 -0
  225. package/dist/hooks/deriveds/use-when.d.ts +28 -0
  226. package/dist/hooks/deriveds/use-when.d.ts.map +1 -0
  227. package/dist/hooks/deriveds/use-when.js +35 -0
  228. package/dist/hooks/deriveds/use-when.js.map +1 -0
  229. package/dist/hooks/index.d.ts +16 -0
  230. package/dist/hooks/index.d.ts.map +1 -0
  231. package/dist/hooks/index.js +16 -0
  232. package/dist/hooks/index.js.map +1 -0
  233. package/dist/hooks/use-child.d.ts +24 -0
  234. package/dist/hooks/use-child.d.ts.map +1 -0
  235. package/dist/hooks/use-child.js +37 -0
  236. package/dist/hooks/use-child.js.map +1 -0
  237. package/dist/hooks/use-computed.d.ts +28 -0
  238. package/dist/hooks/use-computed.d.ts.map +1 -0
  239. package/dist/hooks/use-computed.js +41 -0
  240. package/dist/hooks/use-computed.js.map +1 -0
  241. package/dist/hooks/use-context.d.ts +58 -0
  242. package/dist/hooks/use-context.d.ts.map +1 -0
  243. package/dist/hooks/use-context.js +77 -0
  244. package/dist/hooks/use-context.js.map +1 -0
  245. package/dist/hooks/use-effect.d.ts +24 -0
  246. package/dist/hooks/use-effect.d.ts.map +1 -0
  247. package/dist/hooks/use-effect.js +63 -0
  248. package/dist/hooks/use-effect.js.map +1 -0
  249. package/dist/hooks/use-event.d.ts +29 -0
  250. package/dist/hooks/use-event.d.ts.map +1 -0
  251. package/dist/hooks/use-event.js +30 -0
  252. package/dist/hooks/use-event.js.map +1 -0
  253. package/dist/hooks/use-game.d.ts +17 -0
  254. package/dist/hooks/use-game.d.ts.map +1 -0
  255. package/dist/hooks/use-game.js +35 -0
  256. package/dist/hooks/use-game.js.map +1 -0
  257. package/dist/hooks/use-mount.d.ts +21 -0
  258. package/dist/hooks/use-mount.d.ts.map +1 -0
  259. package/dist/hooks/use-mount.js +33 -0
  260. package/dist/hooks/use-mount.js.map +1 -0
  261. package/dist/hooks/use-node.d.ts +42 -0
  262. package/dist/hooks/use-node.d.ts.map +1 -0
  263. package/dist/hooks/use-node.js +63 -0
  264. package/dist/hooks/use-node.js.map +1 -0
  265. package/dist/hooks/use-ref.d.ts +27 -0
  266. package/dist/hooks/use-ref.d.ts.map +1 -0
  267. package/dist/hooks/use-ref.js +33 -0
  268. package/dist/hooks/use-ref.js.map +1 -0
  269. package/dist/hooks/use-script.d.ts +33 -0
  270. package/dist/hooks/use-script.d.ts.map +1 -0
  271. package/dist/hooks/use-script.js +40 -0
  272. package/dist/hooks/use-script.js.map +1 -0
  273. package/dist/hooks/use-signal.d.ts +25 -0
  274. package/dist/hooks/use-signal.d.ts.map +1 -0
  275. package/dist/hooks/use-signal.js +36 -0
  276. package/dist/hooks/use-signal.js.map +1 -0
  277. package/dist/hooks/use-spawn.d.ts +27 -0
  278. package/dist/hooks/use-spawn.d.ts.map +1 -0
  279. package/dist/hooks/use-spawn.js +39 -0
  280. package/dist/hooks/use-spawn.js.map +1 -0
  281. package/dist/hooks/use-trigger.d.ts +51 -0
  282. package/dist/hooks/use-trigger.d.ts.map +1 -0
  283. package/dist/hooks/use-trigger.js +68 -0
  284. package/dist/hooks/use-trigger.js.map +1 -0
  285. package/dist/index.d.ts +11 -0
  286. package/dist/index.d.ts.map +1 -0
  287. package/dist/index.js +11 -0
  288. package/dist/index.js.map +1 -0
  289. package/dist/input/input.d.ts +46 -0
  290. package/dist/input/input.d.ts.map +1 -0
  291. package/dist/input/input.js +159 -0
  292. package/dist/input/input.js.map +1 -0
  293. package/dist/jsx/components/fragment.d.ts +3 -0
  294. package/dist/jsx/components/fragment.d.ts.map +1 -0
  295. package/dist/jsx/components/fragment.js +7 -0
  296. package/dist/jsx/components/fragment.js.map +1 -0
  297. package/dist/jsx/components/game.d.ts +21 -0
  298. package/dist/jsx/components/game.d.ts.map +1 -0
  299. package/dist/jsx/components/game.js +17 -0
  300. package/dist/jsx/components/game.js.map +1 -0
  301. package/dist/jsx/components/index.d.ts +5 -0
  302. package/dist/jsx/components/index.d.ts.map +1 -0
  303. package/dist/jsx/components/index.js +5 -0
  304. package/dist/jsx/components/index.js.map +1 -0
  305. package/dist/jsx/components/list.d.ts +88 -0
  306. package/dist/jsx/components/list.d.ts.map +1 -0
  307. package/dist/jsx/components/list.js +93 -0
  308. package/dist/jsx/components/list.js.map +1 -0
  309. package/dist/jsx/components/scene.d.ts +40 -0
  310. package/dist/jsx/components/scene.d.ts.map +1 -0
  311. package/dist/jsx/components/scene.js +20 -0
  312. package/dist/jsx/components/scene.js.map +1 -0
  313. package/dist/jsx/index.d.ts +5 -0
  314. package/dist/jsx/index.d.ts.map +1 -0
  315. package/dist/jsx/index.js +5 -0
  316. package/dist/jsx/index.js.map +1 -0
  317. package/dist/jsx/jsx.d.ts +3 -0
  318. package/dist/jsx/jsx.d.ts.map +1 -0
  319. package/dist/jsx/jsx.js +4 -0
  320. package/dist/jsx/jsx.js.map +1 -0
  321. package/dist/jsx/render/game.d.ts +41 -0
  322. package/dist/jsx/render/game.d.ts.map +1 -0
  323. package/dist/jsx/render/game.js +86 -0
  324. package/dist/jsx/render/game.js.map +1 -0
  325. package/dist/jsx/render/index.d.ts +3 -0
  326. package/dist/jsx/render/index.d.ts.map +1 -0
  327. package/dist/jsx/render/index.js +3 -0
  328. package/dist/jsx/render/index.js.map +1 -0
  329. package/dist/jsx/render/to-nodes.d.ts +10 -0
  330. package/dist/jsx/render/to-nodes.d.ts.map +1 -0
  331. package/dist/jsx/render/to-nodes.js +52 -0
  332. package/dist/jsx/render/to-nodes.js.map +1 -0
  333. package/dist/jsx/render/types/class-component.d.ts +4 -0
  334. package/dist/jsx/render/types/class-component.d.ts.map +1 -0
  335. package/dist/jsx/render/types/class-component.js +8 -0
  336. package/dist/jsx/render/types/class-component.js.map +1 -0
  337. package/dist/jsx/render/types/func-components.d.ts +4 -0
  338. package/dist/jsx/render/types/func-components.d.ts.map +1 -0
  339. package/dist/jsx/render/types/func-components.js +8 -0
  340. package/dist/jsx/render/types/func-components.js.map +1 -0
  341. package/dist/jsx/render/types/instrinsic-elements.d.ts +6 -0
  342. package/dist/jsx/render/types/instrinsic-elements.d.ts.map +1 -0
  343. package/dist/jsx/render/types/instrinsic-elements.js +41 -0
  344. package/dist/jsx/render/types/instrinsic-elements.js.map +1 -0
  345. package/dist/jsx/types.d.ts +41 -0
  346. package/dist/jsx/types.d.ts.map +1 -0
  347. package/dist/jsx/types.js +2 -0
  348. package/dist/jsx/types.js.map +1 -0
  349. package/dist/jsx/utils.d.ts +4 -0
  350. package/dist/jsx/utils.d.ts.map +1 -0
  351. package/dist/jsx/utils.js +15 -0
  352. package/dist/jsx/utils.js.map +1 -0
  353. package/dist/jsx-runtime.d.ts +6 -0
  354. package/dist/jsx-runtime.d.ts.map +1 -0
  355. package/dist/jsx-runtime.js +6 -0
  356. package/dist/jsx-runtime.js.map +1 -0
  357. package/dist/math/index.d.ts +3 -0
  358. package/dist/math/index.d.ts.map +1 -0
  359. package/dist/math/index.js +2 -0
  360. package/dist/math/index.js.map +1 -0
  361. package/dist/math/types.d.ts +13 -0
  362. package/dist/math/types.d.ts.map +1 -0
  363. package/dist/math/types.js +2 -0
  364. package/dist/math/types.js.map +1 -0
  365. package/dist/math/vector2.d.ts +145 -0
  366. package/dist/math/vector2.d.ts.map +1 -0
  367. package/dist/math/vector2.js +164 -0
  368. package/dist/math/vector2.js.map +1 -0
  369. package/dist/nodes/_node.d.ts +283 -0
  370. package/dist/nodes/_node.d.ts.map +1 -0
  371. package/dist/nodes/_node.js +371 -0
  372. package/dist/nodes/_node.js.map +1 -0
  373. package/dist/nodes/animation-player.d.ts +208 -0
  374. package/dist/nodes/animation-player.d.ts.map +1 -0
  375. package/dist/nodes/animation-player.js +249 -0
  376. package/dist/nodes/animation-player.js.map +1 -0
  377. package/dist/nodes/audio-player.d.ts +128 -0
  378. package/dist/nodes/audio-player.d.ts.map +1 -0
  379. package/dist/nodes/audio-player.js +173 -0
  380. package/dist/nodes/audio-player.js.map +1 -0
  381. package/dist/nodes/group.d.ts +55 -0
  382. package/dist/nodes/group.d.ts.map +1 -0
  383. package/dist/nodes/group.js +54 -0
  384. package/dist/nodes/group.js.map +1 -0
  385. package/dist/nodes/index.d.ts +8 -0
  386. package/dist/nodes/index.d.ts.map +1 -0
  387. package/dist/nodes/index.js +7 -0
  388. package/dist/nodes/index.js.map +1 -0
  389. package/dist/nodes/lib/enum.d.ts +42 -0
  390. package/dist/nodes/lib/enum.d.ts.map +1 -0
  391. package/dist/nodes/lib/enum.js +43 -0
  392. package/dist/nodes/lib/enum.js.map +1 -0
  393. package/dist/nodes/lib/index.d.ts +5 -0
  394. package/dist/nodes/lib/index.d.ts.map +1 -0
  395. package/dist/nodes/lib/index.js +5 -0
  396. package/dist/nodes/lib/index.js.map +1 -0
  397. package/dist/nodes/lib/registry.d.ts +43 -0
  398. package/dist/nodes/lib/registry.d.ts.map +1 -0
  399. package/dist/nodes/lib/registry.js +46 -0
  400. package/dist/nodes/lib/registry.js.map +1 -0
  401. package/dist/nodes/lib/types.d.ts +89 -0
  402. package/dist/nodes/lib/types.d.ts.map +1 -0
  403. package/dist/nodes/lib/types.js +2 -0
  404. package/dist/nodes/lib/types.js.map +1 -0
  405. package/dist/nodes/lib/utils.d.ts +35 -0
  406. package/dist/nodes/lib/utils.d.ts.map +1 -0
  407. package/dist/nodes/lib/utils.js +58 -0
  408. package/dist/nodes/lib/utils.js.map +1 -0
  409. package/dist/nodes/node2d/_node2d.d.ts +59 -0
  410. package/dist/nodes/node2d/_node2d.d.ts.map +1 -0
  411. package/dist/nodes/node2d/_node2d.js +57 -0
  412. package/dist/nodes/node2d/_node2d.js.map +1 -0
  413. package/dist/nodes/node2d/camera.d.ts +64 -0
  414. package/dist/nodes/node2d/camera.d.ts.map +1 -0
  415. package/dist/nodes/node2d/camera.js +72 -0
  416. package/dist/nodes/node2d/camera.js.map +1 -0
  417. package/dist/nodes/node2d/clickable.d.ts +96 -0
  418. package/dist/nodes/node2d/clickable.d.ts.map +1 -0
  419. package/dist/nodes/node2d/clickable.js +117 -0
  420. package/dist/nodes/node2d/clickable.js.map +1 -0
  421. package/dist/nodes/node2d/collider.d.ts +96 -0
  422. package/dist/nodes/node2d/collider.d.ts.map +1 -0
  423. package/dist/nodes/node2d/collider.js +116 -0
  424. package/dist/nodes/node2d/collider.js.map +1 -0
  425. package/dist/nodes/node2d/index.d.ts +12 -0
  426. package/dist/nodes/node2d/index.d.ts.map +1 -0
  427. package/dist/nodes/node2d/index.js +11 -0
  428. package/dist/nodes/node2d/index.js.map +1 -0
  429. package/dist/nodes/node2d/lib/index.d.ts +2 -0
  430. package/dist/nodes/node2d/lib/index.d.ts.map +1 -0
  431. package/dist/nodes/node2d/lib/index.js +2 -0
  432. package/dist/nodes/node2d/lib/index.js.map +1 -0
  433. package/dist/nodes/node2d/lib/utils.d.ts +4 -0
  434. package/dist/nodes/node2d/lib/utils.d.ts.map +1 -0
  435. package/dist/nodes/node2d/lib/utils.js +14 -0
  436. package/dist/nodes/node2d/lib/utils.js.map +1 -0
  437. package/dist/nodes/node2d/ray-cast.d.ts +115 -0
  438. package/dist/nodes/node2d/ray-cast.d.ts.map +1 -0
  439. package/dist/nodes/node2d/ray-cast.js +129 -0
  440. package/dist/nodes/node2d/ray-cast.js.map +1 -0
  441. package/dist/nodes/node2d/rectangle.d.ts +87 -0
  442. package/dist/nodes/node2d/rectangle.d.ts.map +1 -0
  443. package/dist/nodes/node2d/rectangle.js +60 -0
  444. package/dist/nodes/node2d/rectangle.js.map +1 -0
  445. package/dist/nodes/node2d/rigid-body.d.ts +65 -0
  446. package/dist/nodes/node2d/rigid-body.d.ts.map +1 -0
  447. package/dist/nodes/node2d/rigid-body.js +56 -0
  448. package/dist/nodes/node2d/rigid-body.js.map +1 -0
  449. package/dist/nodes/node2d/sprite.d.ts +285 -0
  450. package/dist/nodes/node2d/sprite.d.ts.map +1 -0
  451. package/dist/nodes/node2d/sprite.js +226 -0
  452. package/dist/nodes/node2d/sprite.js.map +1 -0
  453. package/dist/nodes/node2d/text.d.ts +62 -0
  454. package/dist/nodes/node2d/text.d.ts.map +1 -0
  455. package/dist/nodes/node2d/text.js +52 -0
  456. package/dist/nodes/node2d/text.js.map +1 -0
  457. package/dist/nodes/node2d/transform.d.ts +32 -0
  458. package/dist/nodes/node2d/transform.d.ts.map +1 -0
  459. package/dist/nodes/node2d/transform.js +30 -0
  460. package/dist/nodes/node2d/transform.js.map +1 -0
  461. package/dist/nodes/timer.d.ts +107 -0
  462. package/dist/nodes/timer.d.ts.map +1 -0
  463. package/dist/nodes/timer.js +108 -0
  464. package/dist/nodes/timer.js.map +1 -0
  465. package/dist/reactivity/index.d.ts +5 -0
  466. package/dist/reactivity/index.d.ts.map +1 -0
  467. package/dist/reactivity/index.js +5 -0
  468. package/dist/reactivity/index.js.map +1 -0
  469. package/dist/reactivity/reactive.d.ts +4 -0
  470. package/dist/reactivity/reactive.d.ts.map +1 -0
  471. package/dist/reactivity/reactive.js +50 -0
  472. package/dist/reactivity/reactive.js.map +1 -0
  473. package/dist/reactivity/register.d.ts +7 -0
  474. package/dist/reactivity/register.d.ts.map +1 -0
  475. package/dist/reactivity/register.js +18 -0
  476. package/dist/reactivity/register.js.map +1 -0
  477. package/dist/reactivity/signal.d.ts +126 -0
  478. package/dist/reactivity/signal.d.ts.map +1 -0
  479. package/dist/reactivity/signal.js +152 -0
  480. package/dist/reactivity/signal.js.map +1 -0
  481. package/dist/reactivity/types.d.ts +31 -0
  482. package/dist/reactivity/types.d.ts.map +1 -0
  483. package/dist/reactivity/types.js +2 -0
  484. package/dist/reactivity/types.js.map +1 -0
  485. package/dist/scripts/index.d.ts +2 -0
  486. package/dist/scripts/index.d.ts.map +1 -0
  487. package/dist/scripts/index.js +2 -0
  488. package/dist/scripts/index.js.map +1 -0
  489. package/dist/scripts/script.d.ts +80 -0
  490. package/dist/scripts/script.d.ts.map +1 -0
  491. package/dist/scripts/script.js +75 -0
  492. package/dist/scripts/script.js.map +1 -0
  493. package/dist/utils/dpr.d.ts +2 -0
  494. package/dist/utils/dpr.d.ts.map +1 -0
  495. package/dist/utils/dpr.js +14 -0
  496. package/dist/utils/dpr.js.map +1 -0
  497. package/dist/utils/ternaries.d.ts +6 -0
  498. package/dist/utils/ternaries.d.ts.map +1 -0
  499. package/dist/utils/ternaries.js +17 -0
  500. package/dist/utils/ternaries.js.map +1 -0
  501. package/package.json +56 -0
@@ -0,0 +1,31 @@
1
+ import { Vector2 } from '../math/vector2.js';
2
+ export class GameConfig {
3
+ /** The `canvas` of the `Game` */
4
+ static canvas;
5
+ /** The `context` of the `canvas` */
6
+ static ctx;
7
+ /** The `width` of the `canvas` */
8
+ static width;
9
+ /** The `height` of the `canvas` */
10
+ static height;
11
+ /** The `theme` of the `Game` */
12
+ static theme;
13
+ /** The `testOptions` of the `Game` */
14
+ static testOptions;
15
+ /** The `translate` represents the global translation of the `Game` */
16
+ static translate = Vector2.ZERO;
17
+ }
18
+ const defaultTestOptions = {
19
+ showColliders: false,
20
+ showRayCasts: false,
21
+ showClickables: false,
22
+ };
23
+ export function _set_gc({ canvas, ctx, width, height, theme, testOptions = {} }) {
24
+ GameConfig.canvas = canvas;
25
+ GameConfig.ctx = ctx;
26
+ GameConfig.width = width;
27
+ GameConfig.height = height;
28
+ GameConfig.testOptions = { ...defaultTestOptions, ...testOptions };
29
+ GameConfig.theme = theme;
30
+ }
31
+ //# sourceMappingURL=game-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-config.js","sourceRoot":"","sources":["../../src/core/game-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,MAAM,OAAO,UAAU;IACrB,iCAAiC;IACjC,MAAM,CAAC,MAAM,CAAmB;IAChC,oCAAoC;IACpC,MAAM,CAAC,GAAG,CAA0B;IACpC,kCAAkC;IAClC,MAAM,CAAC,KAAK,CAAQ;IACpB,mCAAmC;IACnC,MAAM,CAAC,MAAM,CAAQ;IAErB,gCAAgC;IAChC,MAAM,CAAC,KAAK,CAAO;IAEnB,sCAAsC;IACtC,MAAM,CAAC,WAAW,CAAa;IAE/B,sEAAsE;IACtE,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAA;;AAQjC,MAAM,kBAAkB,GAAgB;IACtC,aAAa,EAAE,KAAK;IACpB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,KAAK;CACtB,CAAA;AAWD,MAAM,UAAU,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,EAAE,EAAO;IAClF,UAAU,CAAC,MAAM,GAAG,MAAM,CAAA;IAC1B,UAAU,CAAC,GAAG,GAAG,GAAG,CAAA;IACpB,UAAU,CAAC,KAAK,GAAG,KAAK,CAAA;IACxB,UAAU,CAAC,MAAM,GAAG,MAAM,CAAA;IAC1B,UAAU,CAAC,WAAW,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,WAAW,EAAE,CAAA;IAClE,UAAU,CAAC,KAAK,GAAG,KAAK,CAAA;AAC1B,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { SceneManager } from './scene-manager.js';
2
+ import { Theme } from './theme.js';
3
+ import { type TestOptions } from './game-config.js';
4
+ import { Event } from '../events/event.js';
5
+ import { Input, type InputOptions } from '../input/input.js';
6
+ interface SetupOptions {
7
+ /** The **`width`** of the canvas. */
8
+ width: number;
9
+ /** The **`height`** of the canvas. */
10
+ height: number;
11
+ /** The **`root element`**. It will be the parent of the canvas. */
12
+ root: HTMLElement;
13
+ /** The **`testOptions`** of the game. */
14
+ testOptions?: Partial<TestOptions>;
15
+ /** The defualt **`Theme`**. */
16
+ theme?: Theme;
17
+ /** The **`inputOptions`** of the game. */
18
+ inputOptions?: InputOptions;
19
+ }
20
+ export declare class Game {
21
+ #private;
22
+ /** The read-only **`sceneManager`** property represents the manager of all the scenes. */
23
+ static readonly sceneManager: SceneManager;
24
+ /**
25
+ * The **`setup`** method setups the `Game`.
26
+ * @param options Setup options
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const root = document.querySelector<HTMLElement>('#root')
31
+ *
32
+ * Game.setup({
33
+ * width: 160,
34
+ * height: 90,
35
+ * root,
36
+ * })
37
+ *
38
+ * // ...
39
+ * ```
40
+ */
41
+ static setup(options: SetupOptions): void;
42
+ /**
43
+ * The **`play`** method plays the `Game`.
44
+ * This method only can called after **`setup`** method.
45
+ * The scenes can be created before or after this method called.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * Game.setup({
50
+ * // ...
51
+ * })
52
+ *
53
+ * await Game.sceneManager.addScene(
54
+ * 'main',
55
+ * new Scene(
56
+ * async () => (await import('../scenes/main.js')).default,
57
+ * ),
58
+ * true
59
+ * )
60
+ *
61
+ * Game.play() // The Game start
62
+ * ```
63
+ */
64
+ static play(): void;
65
+ /**
66
+ * The **`pause`** method pauses the `Game`. To `resume` use **`play`** method.
67
+ */
68
+ static pause(): void;
69
+ /**
70
+ * The **`destroy`** method stops the game loop and cleans up all resources.
71
+ */
72
+ static destroy(): void;
73
+ /**
74
+ * The **`loop`** method manage the game loop.
75
+ * **This method can not be used outside the `Game`.**
76
+ * @param delta Time between this frame and the last frame
77
+ */
78
+ static loop(delta: number): void;
79
+ static input: Input;
80
+ /**
81
+ * Detects whether the `Game` is **blured**
82
+ */
83
+ static blured: Event<[], "blur">;
84
+ }
85
+ export {};
86
+ //# sourceMappingURL=game.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../src/core/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAExE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAG1C,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAK5D,UAAU,YAAY;IACpB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,IAAI,EAAE,WAAW,CAAA;IACjB,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAClC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,0CAA0C;IAC1C,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAgBD,qBAAa,IAAI;;IACf,0FAA0F;IAC1F,MAAM,CAAC,QAAQ,CAAC,YAAY,eAAqB;IAEjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY;IA8ClC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAI;IAKX;;OAEG;IACH,MAAM,CAAC,KAAK;IAKZ;;OAEG;IACH,MAAM,CAAC,OAAO;IAkCd;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;IAmBzB,MAAM,CAAC,KAAK,EAAE,KAAK,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,MAAM,oBAA8B;CAC5C"}
@@ -0,0 +1,166 @@
1
+ import { SceneManager } from './scene-manager.js';
2
+ import { Theme } from './theme.js';
3
+ import { _set_gc, GameConfig } from './game-config.js';
4
+ import { getDPRFromCtx } from '../utils/dpr.js';
5
+ import { Event } from '../events/event.js';
6
+ import { Context2DNotSupportedError } from '../errors/env.js';
7
+ import { EngineNotSetupError } from '../errors/lifecycle.js';
8
+ import { Input } from '../input/input.js';
9
+ import { Vector2 } from '../math/vector2.js';
10
+ import { CollisionSystem } from '../collision/collision-system.js';
11
+ import { PhysicsSystem } from '../collision/physics/physics-system.js';
12
+ let isPaused = false;
13
+ let lastTime = 0;
14
+ let wakeLock;
15
+ let handle = 0;
16
+ let setuped = false;
17
+ const onBlur = () => {
18
+ if (isPaused)
19
+ return;
20
+ Game.pause();
21
+ Game.blured.emit();
22
+ window.cancelAnimationFrame(handle);
23
+ };
24
+ export class Game {
25
+ /** The read-only **`sceneManager`** property represents the manager of all the scenes. */
26
+ static sceneManager = new SceneManager();
27
+ /**
28
+ * The **`setup`** method setups the `Game`.
29
+ * @param options Setup options
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const root = document.querySelector<HTMLElement>('#root')
34
+ *
35
+ * Game.setup({
36
+ * width: 160,
37
+ * height: 90,
38
+ * root,
39
+ * })
40
+ *
41
+ * // ...
42
+ * ```
43
+ */
44
+ static setup(options) {
45
+ if (setuped)
46
+ return;
47
+ const canvas = document.createElement('canvas');
48
+ options.root.append(canvas);
49
+ const ctx = canvas.getContext('2d');
50
+ if (ctx == null)
51
+ throw new Context2DNotSupportedError();
52
+ setuped = true;
53
+ _set_gc({
54
+ canvas: canvas,
55
+ ctx: ctx,
56
+ width: options.width,
57
+ height: options.height,
58
+ testOptions: options.testOptions,
59
+ theme: options.theme ?? new Theme(),
60
+ });
61
+ const width = options.width;
62
+ const height = options.height;
63
+ canvas.width = width;
64
+ canvas.height = height;
65
+ options.root.style.setProperty('--width', width.toString());
66
+ options.root.style.setProperty('--height', height.toString());
67
+ let ratio = 1;
68
+ const handleResize = () => {
69
+ ratio = getDPRFromCtx(ctx, width, height, ratio);
70
+ ctx.imageSmoothingEnabled = false;
71
+ };
72
+ window.addEventListener('resize', handleResize);
73
+ handleResize();
74
+ ctx.imageSmoothingEnabled = false;
75
+ this.sceneManager.setScene(null);
76
+ Game.input = new Input(canvas, new Vector2(width, height), options.inputOptions);
77
+ }
78
+ /**
79
+ * The **`play`** method plays the `Game`.
80
+ * This method only can called after **`setup`** method.
81
+ * The scenes can be created before or after this method called.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * Game.setup({
86
+ * // ...
87
+ * })
88
+ *
89
+ * await Game.sceneManager.addScene(
90
+ * 'main',
91
+ * new Scene(
92
+ * async () => (await import('../scenes/main.js')).default,
93
+ * ),
94
+ * true
95
+ * )
96
+ *
97
+ * Game.play() // The Game start
98
+ * ```
99
+ */
100
+ static play() {
101
+ if (!setuped)
102
+ throw new EngineNotSetupError();
103
+ window.requestAnimationFrame(this.#transition);
104
+ }
105
+ /**
106
+ * The **`pause`** method pauses the `Game`. To `resume` use **`play`** method.
107
+ */
108
+ static pause() {
109
+ isPaused = true;
110
+ wakeLock?.release();
111
+ }
112
+ /**
113
+ * The **`destroy`** method stops the game loop and cleans up all resources.
114
+ */
115
+ static destroy() {
116
+ if (!setuped)
117
+ return;
118
+ window.cancelAnimationFrame(handle);
119
+ window.removeEventListener('blur', onBlur);
120
+ Game.input.destroy();
121
+ this.sceneManager.setScene(null);
122
+ wakeLock?.release();
123
+ setuped = false;
124
+ isPaused = false;
125
+ }
126
+ static #transition = (time) => {
127
+ isPaused = false;
128
+ lastTime = time;
129
+ window.navigator.wakeLock.request('screen').then((w) => (wakeLock = w));
130
+ window.addEventListener('blur', onBlur);
131
+ handle = window.requestAnimationFrame(this.#update);
132
+ };
133
+ static #update = (time) => {
134
+ const delta = (time - lastTime) / 1000;
135
+ lastTime = time;
136
+ Game.loop(delta);
137
+ if (isPaused)
138
+ return;
139
+ handle = window.requestAnimationFrame(this.#update);
140
+ };
141
+ /**
142
+ * The **`loop`** method manage the game loop.
143
+ * **This method can not be used outside the `Game`.**
144
+ * @param delta Time between this frame and the last frame
145
+ */
146
+ static loop(delta) {
147
+ const node = this.sceneManager.currentNode;
148
+ if (node) {
149
+ GameConfig.ctx.clearRect(0, 0, GameConfig.width, GameConfig.height);
150
+ if (!node.isStarted) {
151
+ node.start();
152
+ }
153
+ node.update(delta);
154
+ CollisionSystem.update(delta);
155
+ PhysicsSystem.update(delta);
156
+ node.draw(delta);
157
+ }
158
+ Game.input.update();
159
+ }
160
+ static input;
161
+ /**
162
+ * Detects whether the `Game` is **blured**
163
+ */
164
+ static blured = new Event('blur', () => { });
165
+ }
166
+ //# sourceMappingURL=game.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game.js","sourceRoot":"","sources":["../../src/core/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,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,CAAC,OAAO,CAAC,CAAA;IACrD,CAAC,CAAA;IAED,MAAM,CAAC,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAA;QACtC,QAAQ,GAAG,IAAI,CAAA;QAEf,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEhB,IAAI,QAAQ;YAAE,OAAM;QACpB,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACrD,CAAC,CAAA;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,KAAa;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAA;QAE1C,IAAI,IAAI,EAAE,CAAC;YACT,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;YAEnE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,IAAI,CAAC,KAAK,EAAE,CAAA;YACd,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAClB,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAC7B,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAC3B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClB,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAO;IAEnB;;OAEG;IACH,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './game.js';
2
+ export { GameConfig } from './game-config.js';
3
+ export * from './scene-manager.js';
4
+ export * from './scene.js';
5
+ export * from './theme.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAE1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './game.js';
2
+ export { GameConfig } from './game-config.js';
3
+ export * from './scene-manager.js';
4
+ export * from './scene.js';
5
+ export * from './theme.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAE1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { Node } from '../nodes/_node.js';
2
+ import type { Scene } from './scene.js';
3
+ export declare class SceneManager {
4
+ #private;
5
+ /**
6
+ * The **`addScene`** method adds the `scene` with the `name`.
7
+ * @param name Name of the Scene
8
+ * @param scene Scene instance
9
+ * @param setit If you want set this scene after create it.
10
+ */
11
+ addScene(name: string, scene: Scene, setit?: boolean): Promise<void>;
12
+ /**
13
+ * The **`preloadScene`** method preloads the scene while the Game is running.
14
+ * @param scene Scene name
15
+ * @returns Returns a function to set the preloaded scene.
16
+ */
17
+ preloadScene(scene: string): Promise<() => void>;
18
+ /**
19
+ * The **`setScene`** method sets and loads the `scene` with the Game paused.
20
+ * @param scene Scene name or `null`
21
+ */
22
+ setScene(scene: string | null): Promise<void>;
23
+ /** The read-only **`currentScene`** property returns the current scene name. */
24
+ get currentScene(): string | null;
25
+ /** The read-only **`currentNode`** property returns the current scene node. */
26
+ get currentNode(): Node<import("../index.js").PrimaryNode> | null;
27
+ }
28
+ //# sourceMappingURL=scene-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-manager.d.ts","sourceRoot":"","sources":["../../src/core/scene-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,qBAAa,YAAY;;IAOvB;;;;;OAKG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,UAAQ;IAKxD;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM;IAkBhC;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAoBnC,gFAAgF;IAChF,IAAI,YAAY,kBAEf;IAED,+EAA+E;IAC/E,IAAI,WAAW,mDAEd;CACF"}
@@ -0,0 +1,65 @@
1
+ import { InvalidSceneRootError, SceneNotFoundError } from '../errors/scene.js';
2
+ import { Node } from '../nodes/_node.js';
3
+ export class SceneManager {
4
+ #scenes = new Map();
5
+ #currentScene = null;
6
+ #currentNode = null;
7
+ /**
8
+ * The **`addScene`** method adds the `scene` with the `name`.
9
+ * @param name Name of the Scene
10
+ * @param scene Scene instance
11
+ * @param setit If you want set this scene after create it.
12
+ */
13
+ async addScene(name, scene, setit = false) {
14
+ this.#scenes.set(name, scene);
15
+ if (setit)
16
+ await this.setScene(name);
17
+ }
18
+ /**
19
+ * The **`preloadScene`** method preloads the scene while the Game is running.
20
+ * @param scene Scene name
21
+ * @returns Returns a function to set the preloaded scene.
22
+ */
23
+ async preloadScene(scene) {
24
+ if (!this.#scenes.has(scene)) {
25
+ throw new SceneNotFoundError(scene);
26
+ }
27
+ const node = await this.#scenes.get(scene).load();
28
+ const setScene = () => {
29
+ if (!(node instanceof Node)) {
30
+ throw new InvalidSceneRootError();
31
+ }
32
+ this.#currentScene = scene;
33
+ this.#currentNode = node;
34
+ };
35
+ return setScene;
36
+ }
37
+ /**
38
+ * The **`setScene`** method sets and loads the `scene` with the Game paused.
39
+ * @param scene Scene name or `null`
40
+ */
41
+ async setScene(scene) {
42
+ this.#currentNode?.destroy();
43
+ this.#currentScene = null;
44
+ this.#currentNode = null;
45
+ if (scene == null)
46
+ return;
47
+ if (!this.#scenes.has(scene))
48
+ throw new SceneNotFoundError(scene);
49
+ const node = await this.#scenes.get(scene).load();
50
+ if (!(node instanceof Node)) {
51
+ throw new InvalidSceneRootError();
52
+ }
53
+ this.#currentScene = scene;
54
+ this.#currentNode = node;
55
+ }
56
+ /** The read-only **`currentScene`** property returns the current scene name. */
57
+ get currentScene() {
58
+ return this.#currentScene;
59
+ }
60
+ /** The read-only **`currentNode`** property returns the current scene node. */
61
+ get currentNode() {
62
+ return this.#currentNode;
63
+ }
64
+ }
65
+ //# sourceMappingURL=scene-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-manager.js","sourceRoot":"","sources":["../../src/core/scene-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAGxC,MAAM,OAAO,YAAY;IACvB,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAA;IAElC,aAAa,GAAkB,IAAI,CAAA;IAEnC,YAAY,GAAgB,IAAI,CAAA;IAEhC;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,KAAY,EAAE,KAAK,GAAG,KAAK;QACtD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAC7B,IAAI,KAAK;YAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACtC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,KAA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AO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED,+EAA+E;IAC/E,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ import { Node } from '../nodes/_node.js';
2
+ type NodeSceneComponent = Node | Promise<Node>;
3
+ /**
4
+ * The **`Scene`** class creates scenes for the game.
5
+ *
6
+ *
7
+ * @example
8
+ * **Scene without lazy loading**
9
+ * ```ts
10
+ * new Scene(
11
+ * new Node({
12
+ * children: [...]
13
+ * }),
14
+ * )
15
+ * ```
16
+ *
17
+ *
18
+ * **Scene with lazy loading**
19
+ * ```ts
20
+ * new Scene(
21
+ * async () => (await import('./scenes/main.js')).default,
22
+ * )
23
+ *
24
+ * // scenes/main.js
25
+ *
26
+ * const main = new Node({
27
+ * children: [...]
28
+ * })
29
+ *
30
+ * export default main
31
+ * ```
32
+ */
33
+ export declare class Scene {
34
+ /** The **`render`** property is a function that returns a component. */
35
+ render: () => NodeSceneComponent;
36
+ constructor(
37
+ /** The **`render`** property is a function that returns a component. */
38
+ render: () => NodeSceneComponent);
39
+ /** The **`load`** method loads the component and assets. */
40
+ load(): Promise<Node<import("../index.js").PrimaryNode> | Node<import("../index.js").PrimaryNode>>;
41
+ }
42
+ export {};
43
+ //# sourceMappingURL=scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../src/core/scene.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,KAAK,kBAAkB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,KAAK;IAEd,wEAAwE;IACjE,MAAM,EAAE,MAAM,kBAAkB;;IADvC,wEAAwE;IACjE,MAAM,EAAE,MAAM,kBAAkB;IAGzC,4DAA4D;IACtD,IAAI;CAMX"}
@@ -0,0 +1,48 @@
1
+ import { InvalidSceneRootError } from '../errors/scene.js';
2
+ import { Node } from '../nodes/_node.js';
3
+ /**
4
+ * The **`Scene`** class creates scenes for the game.
5
+ *
6
+ *
7
+ * @example
8
+ * **Scene without lazy loading**
9
+ * ```ts
10
+ * new Scene(
11
+ * new Node({
12
+ * children: [...]
13
+ * }),
14
+ * )
15
+ * ```
16
+ *
17
+ *
18
+ * **Scene with lazy loading**
19
+ * ```ts
20
+ * new Scene(
21
+ * async () => (await import('./scenes/main.js')).default,
22
+ * )
23
+ *
24
+ * // scenes/main.js
25
+ *
26
+ * const main = new Node({
27
+ * children: [...]
28
+ * })
29
+ *
30
+ * export default main
31
+ * ```
32
+ */
33
+ export class Scene {
34
+ render;
35
+ constructor(
36
+ /** The **`render`** property is a function that returns a component. */
37
+ render) {
38
+ this.render = render;
39
+ }
40
+ /** The **`load`** method loads the component and assets. */
41
+ async load() {
42
+ const node = await this.render();
43
+ if (node instanceof Node)
44
+ return node;
45
+ throw new InvalidSceneRootError();
46
+ }
47
+ }
48
+ //# sourceMappingURL=scene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene.js","sourceRoot":"","sources":["../../src/core/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,KAAK;IAGP;IAFT;IACE,wEAAwE;IACjE,MAAgC;QAAhC,WAAM,GAAN,MAAM,CAA0B;IACtC,CAAC;IAEJ,4DAA4D;IAC5D,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;QAEhC,IAAI,IAAI,YAAY,IAAI;YAAE,OAAO,IAAI,CAAA;QACrC,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;CACF"}
@@ -0,0 +1,63 @@
1
+ /** The **`Theme`** class add a Theme to the Game. */
2
+ export declare class Theme {
3
+ /** Default text style */
4
+ textStyle: TextStyle;
5
+ constructor(
6
+ /** Default text style */
7
+ textStyle?: TextStyle);
8
+ }
9
+ export declare class TextStyle {
10
+ /** The **`foregroundColor`** property sets the text color.
11
+ * @default '#000000'
12
+ */
13
+ foregroundColor: string;
14
+ /** The **`fontSize`** property sets the font size.
15
+ * @default 16
16
+ */
17
+ fontSize: number;
18
+ /** The **`fontFamily`** property sets the font family.
19
+ * @default 'sans-serif'
20
+ */
21
+ fontFamily: string;
22
+ /** The **`fontWeight`** property sets the font weight.
23
+ * @default FontWeight.Normal
24
+ */
25
+ fontWeight: FontWeight;
26
+ /** The **`text align`** property sets the text align.
27
+ * @default TextAlign.Start
28
+ */
29
+ textAlign: TextAlign;
30
+ /** Get default value of `TextStyle` */
31
+ static get DEFAULT(): TextStyle;
32
+ constructor(
33
+ /** The **`foregroundColor`** property sets the text color.
34
+ * @default '#000000'
35
+ */
36
+ foregroundColor?: string,
37
+ /** The **`fontSize`** property sets the font size.
38
+ * @default 16
39
+ */
40
+ fontSize?: number,
41
+ /** The **`fontFamily`** property sets the font family.
42
+ * @default 'sans-serif'
43
+ */
44
+ fontFamily?: string,
45
+ /** The **`fontWeight`** property sets the font weight.
46
+ * @default FontWeight.Normal
47
+ */
48
+ fontWeight?: FontWeight,
49
+ /** The **`text align`** property sets the text align.
50
+ * @default TextAlign.Start
51
+ */
52
+ textAlign?: TextAlign);
53
+ }
54
+ export declare enum TextAlign {
55
+ Start = "start",
56
+ Center = "center",
57
+ End = "end"
58
+ }
59
+ export declare enum FontWeight {
60
+ Normal = "normal",
61
+ Bold = "bold"
62
+ }
63
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/core/theme.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,qBAAa,KAAK;IAEd,yBAAyB;IAClB,SAAS,EAAE,SAAS;;IAD3B,yBAAyB;IAClB,SAAS,GAAE,SAA6B;CAElD;AAED,qBAAa,SAAS;IAOlB;;OAEG;IACI,eAAe,EAAE,MAAM;IAC9B;;OAEG;IACI,QAAQ,EAAE,MAAM;IACvB;;OAEG;IACI,UAAU,EAAE,MAAM;IACzB;;OAEG;IACI,UAAU,EAAE,UAAU;IAC7B;;OAEG;IACI,SAAS,EAAE,SAAS;IAzB7B,uCAAuC;IACvC,MAAM,KAAK,OAAO,cAEjB;;IAGC;;OAEG;IACI,eAAe,GAAE,MAAkB;IAC1C;;OAEG;IACI,QAAQ,GAAE,MAAW;IAC5B;;OAEG;IACI,UAAU,GAAE,MAAqB;IACxC;;OAEG;IACI,UAAU,GAAE,UAA8B;IACjD;;OAEG;IACI,SAAS,GAAE,SAA2B;CAEhD;AAED,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
@@ -0,0 +1,59 @@
1
+ /** The **`Theme`** class add a Theme to the Game. */
2
+ export class Theme {
3
+ textStyle;
4
+ constructor(
5
+ /** Default text style */
6
+ textStyle = TextStyle.DEFAULT) {
7
+ this.textStyle = textStyle;
8
+ }
9
+ }
10
+ export class TextStyle {
11
+ foregroundColor;
12
+ fontSize;
13
+ fontFamily;
14
+ fontWeight;
15
+ textAlign;
16
+ /** Get default value of `TextStyle` */
17
+ static get DEFAULT() {
18
+ return new TextStyle();
19
+ }
20
+ constructor(
21
+ /** The **`foregroundColor`** property sets the text color.
22
+ * @default '#000000'
23
+ */
24
+ foregroundColor = '#000000',
25
+ /** The **`fontSize`** property sets the font size.
26
+ * @default 16
27
+ */
28
+ fontSize = 16,
29
+ /** The **`fontFamily`** property sets the font family.
30
+ * @default 'sans-serif'
31
+ */
32
+ fontFamily = 'sans-serif',
33
+ /** The **`fontWeight`** property sets the font weight.
34
+ * @default FontWeight.Normal
35
+ */
36
+ fontWeight = FontWeight.Normal,
37
+ /** The **`text align`** property sets the text align.
38
+ * @default TextAlign.Start
39
+ */
40
+ textAlign = TextAlign.Start) {
41
+ this.foregroundColor = foregroundColor;
42
+ this.fontSize = fontSize;
43
+ this.fontFamily = fontFamily;
44
+ this.fontWeight = fontWeight;
45
+ this.textAlign = textAlign;
46
+ }
47
+ }
48
+ export var TextAlign;
49
+ (function (TextAlign) {
50
+ TextAlign["Start"] = "start";
51
+ TextAlign["Center"] = "center";
52
+ TextAlign["End"] = "end";
53
+ })(TextAlign || (TextAlign = {}));
54
+ export var FontWeight;
55
+ (function (FontWeight) {
56
+ FontWeight["Normal"] = "normal";
57
+ FontWeight["Bold"] = "bold";
58
+ })(FontWeight || (FontWeight = {}));
59
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/core/theme.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,OAAO,KAAK;IAGP;IAFT;IACE,yBAAyB;IAClB,YAAuB,SAAS,CAAC,OAAO;QAAxC,cAAS,GAAT,SAAS,CAA+B;IAC9C,CAAC;CACL;AAED,MAAM,OAAO,SAAS;IAUX;IAIA;IAIA;IAIA;IAIA;IAzBT,uCAAuC;IACvC,MAAM,KAAK,OAAO;QAChB,OAAO,IAAI,SAAS,EAAE,CAAA;IACxB,CAAC;IAED;IACE;;OAEG;IACI,kBAA0B,SAAS;IAC1C;;OAEG;IACI,WAAmB,EAAE;IAC5B;;OAEG;IACI,aAAqB,YAAY;IACxC;;OAEG;IACI,aAAyB,UAAU,CAAC,MAAM;IACjD;;OAEG;IACI,YAAuB,SAAS,CAAC,KAAK;QAhBtC,oBAAe,GAAf,eAAe,CAAoB;QAInC,aAAQ,GAAR,QAAQ,CAAa;QAIrB,eAAU,GAAV,UAAU,CAAuB;QAIjC,eAAU,GAAV,UAAU,CAAgC;QAI1C,cAAS,GAAT,SAAS,CAA6B;IAC5C,CAAC;CACL;AAED,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,8BAAiB,CAAA;IACjB,wBAAW,CAAA;AACb,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACf,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB"}