@rpgjs/client 4.1.3 → 4.2.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.
- package/CHANGELOG.md +23 -0
- package/browser/{React-da18564b.js → React-f6f9b1de.js} +25 -0
- package/browser/index-e74a289f.js +44225 -0
- package/browser/manifest.json +10 -1
- package/browser/rpg.client.js +33 -44122
- package/browser/rpg.client.umd.cjs +470 -341
- package/lib/Effects/TransitionScene.d.ts +4 -3
- package/lib/Effects/TransitionScene.js +4 -2
- package/lib/Effects/TransitionScene.js.map +1 -1
- package/lib/GameEngine.d.ts +1 -1
- package/lib/GameEngine.js +4 -1
- package/lib/GameEngine.js.map +1 -1
- package/lib/Gui/Gui.d.ts +2 -1
- package/lib/Gui/Gui.js +7 -5
- package/lib/Gui/Gui.js.map +1 -1
- package/lib/Gui/React.d.ts +1 -0
- package/lib/Gui/React.js +23 -0
- package/lib/Gui/React.js.map +1 -1
- package/lib/Gui/Vue.js +21 -2
- package/lib/Gui/Vue.js.map +1 -1
- package/lib/KeyboardControls.d.ts +40 -14
- package/lib/KeyboardControls.js +42 -15
- package/lib/KeyboardControls.js.map +1 -1
- package/lib/Presets/AnimationSpritesheet.d.ts +3 -3
- package/lib/Presets/AnimationSpritesheet.js +7 -3
- package/lib/Presets/AnimationSpritesheet.js.map +1 -1
- package/lib/Renderer.d.ts +13 -5
- package/lib/Renderer.js +40 -16
- package/lib/Renderer.js.map +1 -1
- package/lib/Resources.js.map +1 -1
- package/lib/RpgClientEngine.d.ts +10 -4
- package/lib/RpgClientEngine.js +26 -17
- package/lib/RpgClientEngine.js.map +1 -1
- package/lib/Scene/Map.d.ts +4 -5
- package/lib/Scene/Map.js +6 -4
- package/lib/Scene/Map.js.map +1 -1
- package/lib/Scene/Scene.d.ts +7 -2
- package/lib/Scene/Scene.js +9 -3
- package/lib/Scene/Scene.js.map +1 -1
- package/lib/Tilemap/index.d.ts +4 -3
- package/lib/Tilemap/index.js +7 -3
- package/lib/Tilemap/index.js.map +1 -1
- package/lib/clientEntryPoint.js +5 -5
- package/lib/clientEntryPoint.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/inject.d.ts +23 -0
- package/lib/inject.js +30 -0
- package/lib/inject.js.map +1 -0
- package/package.json +6 -6
- package/src/Effects/TransitionScene.ts +3 -1
- package/src/GameEngine.ts +2 -2
- package/src/Gui/Gui.ts +5 -5
- package/src/Gui/React.ts +26 -1
- package/src/Gui/Vue.ts +24 -6
- package/src/KeyboardControls.ts +43 -15
- package/src/Presets/AnimationSpritesheet.ts +9 -4
- package/src/Renderer.ts +44 -19
- package/src/Resources.ts +0 -1
- package/src/RpgClientEngine.ts +29 -18
- package/src/Scene/Map.ts +8 -7
- package/src/Scene/Scene.ts +8 -4
- package/src/Tilemap/index.ts +6 -4
- package/src/clientEntryPoint.ts +6 -4
- package/src/index.ts +4 -1
- package/src/inject.ts +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.2.1](https://github.com/RSamaium/RPG-JS/compare/v4.2.0...v4.2.1) (2024-01-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* #community-261 ([8221085](https://github.com/RSamaium/RPG-JS/commit/8221085a962b1555aa20ba154b6790d4522da971)), closes [#community-261](https://github.com/RSamaium/RPG-JS/issues/community-261)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.2.0](https://github.com/RSamaium/RPG-JS/compare/v4.1.3...v4.2.0) (2023-12-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* inject function ([902e62f](https://github.com/RSamaium/RPG-JS/commit/902e62ff4fdd9b5bd26ee7d5be9ccae2b051f248))
|
|
23
|
+
* propagate event directive ([edbab50](https://github.com/RSamaium/RPG-JS/commit/edbab506a2552ff64d2f638d1e088748cbc8cc86))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [4.1.3](https://github.com/RSamaium/RPG-JS/compare/v4.1.2...v4.1.3) (2023-11-17)
|
|
7
30
|
|
|
8
31
|
**Note:** Version bump only for package @rpgjs/client
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import require$$0 from "react-dom";
|
|
2
2
|
import { useCallback, useSyncExternalStore, createContext, useState, useContext, useEffect, useRef, createElement } from "react";
|
|
3
|
+
import { i as inject, R as RpgRenderer, E as EVENTS_MAP } from "./index-e74a289f.js";
|
|
3
4
|
import { map, tap, BehaviorSubject } from "rxjs";
|
|
5
|
+
import "@rpgjs/common";
|
|
6
|
+
import "vue";
|
|
4
7
|
var createRoot;
|
|
5
8
|
var m = require$$0;
|
|
6
9
|
if ({}.NODE_ENV === "production") {
|
|
@@ -65,6 +68,27 @@ const useCurrentPlayer = () => {
|
|
|
65
68
|
}, []);
|
|
66
69
|
return useSyncExternalStore(subscribe, () => currentPlayerRef.current);
|
|
67
70
|
};
|
|
71
|
+
const useEventPropagator = () => {
|
|
72
|
+
const ref = useRef(null);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (ref.current) {
|
|
75
|
+
const element = ref.current;
|
|
76
|
+
const eventListeners = {};
|
|
77
|
+
const renderer = inject(RpgRenderer);
|
|
78
|
+
EVENTS_MAP.MouseEvent.forEach((eventType) => {
|
|
79
|
+
const listener = (event) => renderer.propagateEvent(event);
|
|
80
|
+
element.addEventListener(eventType, listener);
|
|
81
|
+
eventListeners[eventType] = listener;
|
|
82
|
+
});
|
|
83
|
+
return () => {
|
|
84
|
+
EVENTS_MAP.MouseEvent.forEach((eventType) => {
|
|
85
|
+
element.removeEventListener(eventType, eventListeners[eventType]);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, [ref]);
|
|
90
|
+
return ref;
|
|
91
|
+
};
|
|
68
92
|
class ReactGui {
|
|
69
93
|
//private _tooltips: BehaviorSubject<any[]> = new BehaviorSubject([] as any)
|
|
70
94
|
constructor(rootEl, parentGui) {
|
|
@@ -127,6 +151,7 @@ export {
|
|
|
127
151
|
ReactGui,
|
|
128
152
|
RpgReactContext,
|
|
129
153
|
useCurrentPlayer,
|
|
154
|
+
useEventPropagator,
|
|
130
155
|
useObjects,
|
|
131
156
|
useStore
|
|
132
157
|
};
|