@dcl/react-ecs 7.6.7 → 7.6.8-12354882097.commit-0c727b8
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/dist/components/Button/index.js +2 -2
- package/dist/components/Dropdown/index.js +4 -2
- package/dist/components/Input/index.js +4 -2
- package/dist/components/Label/index.js +4 -2
- package/dist/components/listeners/types.d.ts +4 -0
- package/dist/components/listeners/types.js +3 -1
- package/dist/react-ecs.d.ts +2 -0
- package/dist/reconciler/index.js +27 -8
- package/dist/reconciler/utils.js +2 -0
- package/package.json +3 -3
|
@@ -29,7 +29,7 @@ function getButtonProps(props) {
|
|
|
29
29
|
*/
|
|
30
30
|
/* @__PURE__ */
|
|
31
31
|
export function Button(props) {
|
|
32
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...otherProps } = props;
|
|
32
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...otherProps } = props;
|
|
33
33
|
const buttonProps = getButtonProps(props);
|
|
34
34
|
const uiBackgroundProps = parseUiBackground({
|
|
35
35
|
...buttonProps.uiBackground,
|
|
@@ -54,5 +54,5 @@ export function Button(props) {
|
|
|
54
54
|
if (uiBackgroundProps && uiBackgroundProps.color)
|
|
55
55
|
uiBackgroundProps.color.a /= 2;
|
|
56
56
|
}
|
|
57
|
-
return (ReactEcs.createElement("entity", { onMouseDown: !!props.disabled ? undefined : onMouseDown, onMouseUp: !!props.disabled ? undefined : onMouseUp, uiTransform: uiTransformProps, uiText: textProps, uiBackground: uiBackgroundProps }));
|
|
57
|
+
return (ReactEcs.createElement("entity", { onMouseDown: !!props.disabled ? undefined : onMouseDown, onMouseUp: !!props.disabled ? undefined : onMouseUp, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, uiTransform: uiTransformProps, uiText: textProps, uiBackground: uiBackgroundProps }));
|
|
58
58
|
}
|
|
@@ -34,13 +34,15 @@ function parseUiDropdown(props) {
|
|
|
34
34
|
*/
|
|
35
35
|
/* @__PURE__ */
|
|
36
36
|
export function Dropdown(props) {
|
|
37
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...otherProps } = props;
|
|
37
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...otherProps } = props;
|
|
38
38
|
const dropdownProps = parseUiDropdown(otherProps);
|
|
39
39
|
const commonProps = parseProps({
|
|
40
40
|
uiTransform,
|
|
41
41
|
uiBackground,
|
|
42
42
|
onMouseDown,
|
|
43
|
-
onMouseUp
|
|
43
|
+
onMouseUp,
|
|
44
|
+
onMouseEnter,
|
|
45
|
+
onMouseLeave
|
|
44
46
|
});
|
|
45
47
|
return ReactEcs.createElement("entity", { ...commonProps, uiDropdown: dropdownProps });
|
|
46
48
|
}
|
|
@@ -35,13 +35,15 @@ function parseUiInput(props) {
|
|
|
35
35
|
* @category Component
|
|
36
36
|
*/ /* @__PURE__ */
|
|
37
37
|
export function Input(props) {
|
|
38
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...otherProps } = props;
|
|
38
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...otherProps } = props;
|
|
39
39
|
const inputProps = parseUiInput(otherProps);
|
|
40
40
|
const commonProps = parseProps({
|
|
41
41
|
uiTransform,
|
|
42
42
|
uiBackground,
|
|
43
43
|
onMouseDown,
|
|
44
|
-
onMouseUp
|
|
44
|
+
onMouseUp,
|
|
45
|
+
onMouseEnter,
|
|
46
|
+
onMouseLeave
|
|
45
47
|
});
|
|
46
48
|
return ReactEcs.createElement("entity", { ...commonProps, uiInput: inputProps });
|
|
47
49
|
}
|
|
@@ -16,12 +16,14 @@ export { scaleFontSize } from './utils';
|
|
|
16
16
|
*/
|
|
17
17
|
/* @__PURE__ */
|
|
18
18
|
export function Label(props) {
|
|
19
|
-
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...uiTextProps } = props;
|
|
19
|
+
const { uiTransform, uiBackground, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, ...uiTextProps } = props;
|
|
20
20
|
const commonProps = parseProps({
|
|
21
21
|
uiTransform,
|
|
22
22
|
uiBackground,
|
|
23
23
|
onMouseDown,
|
|
24
|
-
onMouseUp
|
|
24
|
+
onMouseUp,
|
|
25
|
+
onMouseEnter,
|
|
26
|
+
onMouseLeave
|
|
25
27
|
});
|
|
26
28
|
const { font, textAlign, fontSize, textWrap, ...textProps } = uiTextProps;
|
|
27
29
|
const uiText = {
|
package/dist/react-ecs.d.ts
CHANGED
package/dist/reconciler/index.js
CHANGED
|
@@ -6,7 +6,9 @@ import { componentKeys, isNotUndefined, noopConfig, propsChanged } from './utils
|
|
|
6
6
|
function getPointerEnum(pointerKey) {
|
|
7
7
|
const pointers = {
|
|
8
8
|
onMouseDown: 1 /* PointerEventType.PET_DOWN */,
|
|
9
|
-
onMouseUp: 0 /* PointerEventType.PET_UP
|
|
9
|
+
onMouseUp: 0 /* PointerEventType.PET_UP */,
|
|
10
|
+
onMouseEnter: 2 /* PointerEventType.PET_HOVER_ENTER */,
|
|
11
|
+
onMouseLeave: 3 /* PointerEventType.PET_HOVER_LEAVE */
|
|
10
12
|
};
|
|
11
13
|
return pointers[pointerKey];
|
|
12
14
|
}
|
|
@@ -50,6 +52,12 @@ export function createReconciler(engine, pointerEvents) {
|
|
|
50
52
|
else if (update.component === 'onMouseUp') {
|
|
51
53
|
pointerEvents.removeOnPointerUp(instance.entity);
|
|
52
54
|
}
|
|
55
|
+
else if (update.component === 'onMouseEnter') {
|
|
56
|
+
pointerEvents.removeOnPointerHoverEnter(instance.entity);
|
|
57
|
+
}
|
|
58
|
+
else if (update.component === 'onMouseLeave') {
|
|
59
|
+
pointerEvents.removeOnPointerHoverLeave(instance.entity);
|
|
60
|
+
}
|
|
53
61
|
return;
|
|
54
62
|
}
|
|
55
63
|
if (update.props) {
|
|
@@ -59,13 +67,24 @@ export function createReconciler(engine, pointerEvents) {
|
|
|
59
67
|
entityEvent.set(pointerEvent, update.props);
|
|
60
68
|
if (alreadyHasPointerEvent)
|
|
61
69
|
return;
|
|
62
|
-
const pointerEventSystem = update.component === 'onMouseDown'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
const pointerEventSystem = update.component === 'onMouseDown'
|
|
71
|
+
? pointerEvents.onPointerDown
|
|
72
|
+
: update.component === 'onMouseUp'
|
|
73
|
+
? pointerEvents.onPointerUp
|
|
74
|
+
: update.component === 'onMouseEnter'
|
|
75
|
+
? pointerEvents.onPointerHoverEnter
|
|
76
|
+
: update.component === 'onMouseLeave' && pointerEvents.onPointerHoverLeave;
|
|
77
|
+
if (pointerEventSystem) {
|
|
78
|
+
pointerEventSystem({
|
|
79
|
+
entity: instance.entity,
|
|
80
|
+
opts: {
|
|
81
|
+
button: 0 /* InputAction.IA_POINTER */,
|
|
82
|
+
// We add this showFeedBack so the pointerEventSystem creates a PointerEvent component with our entity
|
|
83
|
+
// This is needed for the renderer to know which entities are clickeables
|
|
84
|
+
showFeedback: true
|
|
85
|
+
}
|
|
86
|
+
}, () => pointerEventCallback(instance.entity, pointerEvent));
|
|
87
|
+
}
|
|
69
88
|
}
|
|
70
89
|
}
|
|
71
90
|
function removeComponent(instance, component) {
|
package/dist/reconciler/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/react-ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.6.
|
|
4
|
+
"version": "7.6.8-12354882097.commit-0c727b8",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/js-sdk-toolchain/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@dcl/ecs": "7.6.
|
|
8
|
+
"@dcl/ecs": "7.6.8-12354882097.commit-0c727b8",
|
|
9
9
|
"react": "^18.2.0",
|
|
10
10
|
"react-reconciler": "^0.29.0"
|
|
11
11
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"tsconfig": "./tsconfig.json"
|
|
41
41
|
},
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
|
-
"commit": "
|
|
43
|
+
"commit": "0c727b82d18c849bc14e34108ef9ce7e3531ca64"
|
|
44
44
|
}
|