@kbve/laser 0.0.8 → 0.1.2

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 (69) hide show
  1. package/README.md +40 -10
  2. package/laser.es.js +872 -0
  3. package/package.json +54 -24
  4. package/src/index.d.ts +0 -19
  5. package/src/index.js +0 -37
  6. package/src/index.js.map +0 -1
  7. package/src/lib/animations/TypewriterComponent.d.ts +0 -8
  8. package/src/lib/animations/TypewriterComponent.js +0 -53
  9. package/src/lib/animations/TypewriterComponent.js.map +0 -1
  10. package/src/lib/constants.d.ts +0 -2
  11. package/src/lib/constants.js +0 -6
  12. package/src/lib/constants.js.map +0 -1
  13. package/src/lib/eventhandler.d.ts +0 -31
  14. package/src/lib/eventhandler.js +0 -45
  15. package/src/lib/eventhandler.js.map +0 -1
  16. package/src/lib/icon/CollapseIcon.d.ts +0 -4
  17. package/src/lib/icon/CollapseIcon.js +0 -10
  18. package/src/lib/icon/CollapseIcon.js.map +0 -1
  19. package/src/lib/icon/ExpandIcon.d.ts +0 -4
  20. package/src/lib/icon/ExpandIcon.js +0 -10
  21. package/src/lib/icon/ExpandIcon.js.map +0 -1
  22. package/src/lib/laser.d.ts +0 -1
  23. package/src/lib/laser.js +0 -8
  24. package/src/lib/laser.js.map +0 -1
  25. package/src/lib/localdb.d.ts +0 -55
  26. package/src/lib/localdb.js +0 -592
  27. package/src/lib/localdb.js.map +0 -1
  28. package/src/lib/minigame/dice/MinigameDice.d.ts +0 -4
  29. package/src/lib/minigame/dice/MinigameDice.js +0 -85
  30. package/src/lib/minigame/dice/MinigameDice.js.map +0 -1
  31. package/src/lib/phaser/map/mapdatabase.d.ts +0 -1
  32. package/src/lib/phaser/map/mapdatabase.js +0 -175
  33. package/src/lib/phaser/map/mapdatabase.js.map +0 -1
  34. package/src/lib/phaser/monster/bird.d.ts +0 -7
  35. package/src/lib/phaser/monster/bird.js +0 -44
  36. package/src/lib/phaser/monster/bird.js.map +0 -1
  37. package/src/lib/phaser/npc/chatbubble.d.ts +0 -10
  38. package/src/lib/phaser/npc/chatbubble.js +0 -78
  39. package/src/lib/phaser/npc/chatbubble.js.map +0 -1
  40. package/src/lib/phaser/npc/npcdatabase.d.ts +0 -59
  41. package/src/lib/phaser/npc/npcdatabase.js +0 -550
  42. package/src/lib/phaser/npc/npcdatabase.js.map +0 -1
  43. package/src/lib/phaser/npc/npchandler.d.ts +0 -21
  44. package/src/lib/phaser/npc/npchandler.js +0 -123
  45. package/src/lib/phaser/npc/npchandler.js.map +0 -1
  46. package/src/lib/phaser/npc/tooltipmenu.d.ts +0 -17
  47. package/src/lib/phaser/npc/tooltipmenu.js +0 -68
  48. package/src/lib/phaser/npc/tooltipmenu.js.map +0 -1
  49. package/src/lib/phaser/player/playercontroller.d.ts +0 -24
  50. package/src/lib/phaser/player/playercontroller.js +0 -219
  51. package/src/lib/phaser/player/playercontroller.js.map +0 -1
  52. package/src/lib/quadtree.d.ts +0 -23
  53. package/src/lib/quadtree.js +0 -123
  54. package/src/lib/quadtree.js.map +0 -1
  55. package/src/lib/regex.d.ts +0 -1
  56. package/src/lib/regex.js +0 -6
  57. package/src/lib/regex.js.map +0 -1
  58. package/src/lib/utils/debug.d.ts +0 -8
  59. package/src/lib/utils/debug.js +0 -46
  60. package/src/lib/utils/debug.js.map +0 -1
  61. package/src/lib/utils/loader.d.ts +0 -3
  62. package/src/lib/utils/loader.js +0 -87
  63. package/src/lib/utils/loader.js.map +0 -1
  64. package/src/lib/utils/ulid.d.ts +0 -1
  65. package/src/lib/utils/ulid.js +0 -38
  66. package/src/lib/utils/ulid.js.map +0 -1
  67. package/src/types.d.ts +0 -423
  68. package/src/types.js +0 -14
  69. package/src/types.js.map +0 -1
package/README.md CHANGED
@@ -1,22 +1,52 @@
1
1
  # Laser
2
2
 
3
- Laser is an npm library that provides seamless integration between React and Phaser, allowing you to create rich, interactive web applications with ease.
3
+ <a href="https://kbve.com" style="float: right;"><img width="150" height="50" title="KBVE logo" src="https://kbve.com/assets/images/brand/letter_logo.svg" /></a>
4
4
 
5
- ## Features
5
+ Laser is a lightweight integration layer for Phaser and React Three Fiber in React 19 applications.
6
+ It provides React hooks and components for embedding Phaser games and R3F scenes with a shared event bus, making it easy to build hybrid 2D/3D game UIs.
6
7
 
7
- - **React and Phaser Integration**: Leverage the power of both React and Phaser in your projects.
8
- - **Component-Based Architecture**: Utilize React's component-based architecture for structuring your game elements.
9
- - **Easy Setup**: Quickly set up and start building your projects with minimal configuration.
10
- - **Optimized Performance**: Efficiently manage and update your game state with React's rendering optimizations.
8
+ ## Features
11
9
 
12
- ## Installation
10
+ - **Phaser integration** — `<PhaserGame>` component with ref-based access, `usePhaserGame` context hook, and `usePhaserEvent` for subscribing to Phaser events
11
+ - **React Three Fiber integration** — `<Stage>` component and `useGameLoop` hook for frame-synced game logic
12
+ - **Shared event bus** — `LaserEventBus` for decoupled communication between Phaser and R3F layers
13
+ - **TypeScript-first** — Full type definitions with exported types for configs, events, and geometry primitives
13
14
 
14
- To install Laser, use npm or pnpm:
15
+ ## Install
15
16
 
16
17
  ```bash
17
- pnpm install @kbve/laser
18
+ npm install @kbve/laser
18
19
  ```
19
20
 
21
+ ### Peer Dependencies
22
+
23
+ Laser requires the following peer dependencies (install the ones you need):
24
+
25
+ - `react` >= 18.0.0
26
+ - `react-dom` >= 18.0.0
27
+ - `phaser` >= 3.80.0 _(optional — only needed for Phaser features)_
28
+ - `three` >= 0.160.0 _(optional — only needed for R3F features)_
29
+ - `@react-three/fiber` >= 9.0.0 _(optional)_
30
+ - `@react-three/drei` >= 10.0.0 _(optional)_
31
+
20
32
  ## Usage
21
33
 
22
- We recommend that you import all of it as `import * as Laser from '@kbve/laser';`
34
+ ```tsx
35
+ import {
36
+ PhaserGame,
37
+ usePhaserEvent,
38
+ Stage,
39
+ useGameLoop,
40
+ laserEvents,
41
+ } from '@kbve/laser';
42
+ ```
43
+
44
+ ### Support
45
+
46
+ For questions or help, reach out via our [Discord server](https://kbve.com/discord/).
47
+
48
+ [![Discord](https://img.shields.io/discord/342732838598082562?logo=discord)](https://kbve.com/discord/)
49
+
50
+ ## License
51
+
52
+ MIT