@dcl/react-ecs 7.0.6-4057700455.commit-453395e → 7.0.6-4076330908.commit-cd40e5f
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.d.ts +10 -2
- package/dist/components/Button/index.js +11 -2
- package/dist/components/Button/types.d.ts +8 -3
- package/dist/components/Dropdown/index.d.ts +16 -2
- package/dist/components/Dropdown/index.js +15 -0
- package/dist/components/Dropdown/types.d.ts +4 -2
- package/dist/components/Input/index.d.ts +16 -2
- package/dist/components/Input/index.js +16 -2
- package/dist/components/Input/types.d.ts +3 -2
- package/dist/components/Label/index.d.ts +9 -0
- package/dist/components/Label/index.js +9 -0
- package/dist/components/Label/types.d.ts +12 -5
- package/dist/components/index.d.ts +3 -4
- package/dist/components/index.js +1 -2
- package/dist/components/listeners/types.d.ts +10 -1
- package/dist/components/listeners/types.js +3 -0
- package/dist/components/types.d.ts +12 -6
- package/dist/components/uiBackground/types.d.ts +21 -18
- package/dist/components/uiBackground/utils.js +2 -8
- package/dist/components/uiTransform/index.d.ts +0 -1
- package/dist/components/uiTransform/index.js +3 -0
- package/dist/components/uiTransform/types.d.ts +33 -2
- package/dist/index.d.ts +9 -1
- package/dist/index.js +7 -0
- package/dist/react-ecs.d.ts +30 -5
- package/dist/react-ecs.js +3 -1
- package/dist/reconciler/index.d.ts +2 -2
- package/dist/reconciler/types.d.ts +5 -2
- package/dist/system.d.ts +10 -6
- package/dist/system.js +3 -0
- package/package.json +2 -2
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { ReactEcs } from '../../react-ecs';
|
|
2
|
-
import { EntityPropTypes } from '../types';
|
|
3
2
|
import { UiButtonProps } from './types';
|
|
4
3
|
/**
|
|
4
|
+
*
|
|
5
5
|
* @public
|
|
6
|
+
* Button component
|
|
7
|
+
*
|
|
8
|
+
* A Button indicates a possible user action.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <Button variant="primary" value="Click me!" />
|
|
12
|
+
*
|
|
13
|
+
* @category Component
|
|
6
14
|
*/
|
|
7
|
-
export declare function Button(props:
|
|
15
|
+
export declare function Button(props: UiButtonProps): ReactEcs.JSX.Element;
|
|
@@ -3,13 +3,13 @@ import { getFont, getTextAlign } from '../Label/utils';
|
|
|
3
3
|
import { parseUiBackground } from '../uiBackground';
|
|
4
4
|
import { parseUiTransform } from '../uiTransform';
|
|
5
5
|
function getButtonProps(props) {
|
|
6
|
-
if (props.
|
|
6
|
+
if (props.variant === 'primary') {
|
|
7
7
|
return {
|
|
8
8
|
uiBackground: { color: { r: 0.98, g: 0.17, b: 0.33, a: 1 } },
|
|
9
9
|
uiText: { color: { r: 1, g: 1, b: 1, a: 1 } }
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
if (props.
|
|
12
|
+
if (props.variant === 'secondary') {
|
|
13
13
|
return {
|
|
14
14
|
uiBackground: { color: { r: 1, g: 1, b: 1, a: 1 } },
|
|
15
15
|
uiText: { color: { r: 0.98, g: 0.17, b: 0.33, a: 1 } }
|
|
@@ -18,7 +18,16 @@ function getButtonProps(props) {
|
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
+
*
|
|
21
22
|
* @public
|
|
23
|
+
* Button component
|
|
24
|
+
*
|
|
25
|
+
* A Button indicates a possible user action.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <Button variant="primary" value="Click me!" />
|
|
29
|
+
*
|
|
30
|
+
* @category Component
|
|
22
31
|
*/
|
|
23
32
|
/*#__PURE__*/
|
|
24
33
|
export function Button(props) {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { UiLabelProps } from '../Label/types';
|
|
2
|
+
import { EntityPropTypes } from '../types';
|
|
2
3
|
/**
|
|
4
|
+
* Button Component Props
|
|
3
5
|
* @public
|
|
4
6
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export interface UiButtonProps extends UiLabelProps, EntityPropTypes {
|
|
8
|
+
/**
|
|
9
|
+
* Use any of the available button style types to create a styled button.
|
|
10
|
+
*/
|
|
11
|
+
variant?: 'primary' | 'secondary';
|
|
12
|
+
}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { ReactEcs } from '../../react-ecs';
|
|
2
|
-
import { EntityPropTypes } from '../types';
|
|
3
2
|
import { UiDropdownProps } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* @public
|
|
5
|
+
* Dropdown component
|
|
6
|
+
*
|
|
7
|
+
* A dropdown allows a user to select a value from a series of options.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <Dropdown
|
|
11
|
+
options={['Red', 'Blue']}
|
|
12
|
+
color={Color4.Red()}
|
|
13
|
+
font="sans-serif"
|
|
14
|
+
fontSize={14}
|
|
15
|
+
selectedIndex={value}
|
|
16
|
+
onChange={(index) => value = index}
|
|
17
|
+
/>
|
|
18
|
+
*
|
|
19
|
+
* @category Component
|
|
6
20
|
*/
|
|
7
|
-
export declare function Dropdown(props:
|
|
21
|
+
export declare function Dropdown(props: UiDropdownProps): ReactEcs.JSX.Element;
|
|
@@ -15,6 +15,21 @@ function parseUiDropdown(props) {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* @public
|
|
18
|
+
* Dropdown component
|
|
19
|
+
*
|
|
20
|
+
* A dropdown allows a user to select a value from a series of options.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <Dropdown
|
|
24
|
+
options={['Red', 'Blue']}
|
|
25
|
+
color={Color4.Red()}
|
|
26
|
+
font="sans-serif"
|
|
27
|
+
fontSize={14}
|
|
28
|
+
selectedIndex={value}
|
|
29
|
+
onChange={(index) => value = index}
|
|
30
|
+
/>
|
|
31
|
+
*
|
|
32
|
+
* @category Component
|
|
18
33
|
*/
|
|
19
34
|
/*#__PURE__*/
|
|
20
35
|
export function Dropdown(props) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { PBUiDropdown } from '@dcl/ecs';
|
|
2
2
|
import { TextAlignType, UiFontType } from '../Label/types';
|
|
3
|
+
import { EntityPropTypes } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* @public
|
|
6
|
+
* Dropdown Props
|
|
5
7
|
*/
|
|
6
|
-
export
|
|
8
|
+
export interface UiDropdownProps extends EntityPropTypes, Omit<Partial<PBUiDropdown>, 'textAlign' | 'font'> {
|
|
7
9
|
onChange?(value: number): void;
|
|
8
10
|
font?: UiFontType;
|
|
9
11
|
textAlign?: TextAlignType;
|
|
10
|
-
}
|
|
12
|
+
}
|
|
@@ -3,5 +3,19 @@ import { EntityPropTypes } from '../types';
|
|
|
3
3
|
import { UiInputProps } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Input component
|
|
7
|
+
*
|
|
8
|
+
* An Input is a field used to obtain a response from a user.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
<Input
|
|
12
|
+
placeholder="Please enter your email"
|
|
13
|
+
onChange={(value) => {
|
|
14
|
+
email = value
|
|
15
|
+
}}
|
|
16
|
+
uiBackground={{ color: Color4.Red() }}
|
|
17
|
+
uiTransform={{ width: 200, height: 36 }}
|
|
18
|
+
/>
|
|
19
|
+
*
|
|
20
|
+
* @category Component
|
|
21
|
+
*/ export declare function Input(props: EntityPropTypes & Partial<UiInputProps>): ReactEcs.JSX.Element;
|
|
@@ -13,8 +13,22 @@ function parseUiInput(props) {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* @public
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* Input component
|
|
17
|
+
*
|
|
18
|
+
* An Input is a field used to obtain a response from a user.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
<Input
|
|
22
|
+
placeholder="Please enter your email"
|
|
23
|
+
onChange={(value) => {
|
|
24
|
+
email = value
|
|
25
|
+
}}
|
|
26
|
+
uiBackground={{ color: Color4.Red() }}
|
|
27
|
+
uiTransform={{ width: 200, height: 36 }}
|
|
28
|
+
/>
|
|
29
|
+
*
|
|
30
|
+
* @category Component
|
|
31
|
+
*/ /*#__PURE__*/
|
|
18
32
|
export function Input(props) {
|
|
19
33
|
const { uiTransform, uiBackground, onMouseDown, onMouseUp, ...otherProps } = props;
|
|
20
34
|
const inputProps = parseUiInput(otherProps);
|
|
@@ -3,8 +3,9 @@ import { TextAlignType, UiFontType } from '../Label/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export interface UiInputProps extends Omit<PBUiInput, 'font' | 'textAlign'> {
|
|
7
|
+
/** function to be called on value change */
|
|
7
8
|
onChange?(value: string): void;
|
|
8
9
|
font?: UiFontType;
|
|
9
10
|
textAlign?: TextAlignType;
|
|
10
|
-
}
|
|
11
|
+
}
|
|
@@ -2,6 +2,15 @@ import { ReactEcs } from '../../react-ecs';
|
|
|
2
2
|
import { EntityPropTypes } from '../types';
|
|
3
3
|
import { UiLabelProps } from './types';
|
|
4
4
|
/**
|
|
5
|
+
*
|
|
5
6
|
* @public
|
|
7
|
+
* Label component
|
|
8
|
+
*
|
|
9
|
+
* A label displays text content
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <Label value="SDK 7" uiTransform={{ margin: { left: 10 } }} />
|
|
13
|
+
*
|
|
14
|
+
* @category Component
|
|
6
15
|
*/
|
|
7
16
|
export declare function Label(props: EntityPropTypes & UiLabelProps): ReactEcs.JSX.Element;
|
|
@@ -2,7 +2,16 @@ import { parseProps } from '../utils';
|
|
|
2
2
|
import { ReactEcs } from '../../react-ecs';
|
|
3
3
|
import { getFont, getTextAlign } from './utils';
|
|
4
4
|
/**
|
|
5
|
+
*
|
|
5
6
|
* @public
|
|
7
|
+
* Label component
|
|
8
|
+
*
|
|
9
|
+
* A label displays text content
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <Label value="SDK 7" uiTransform={{ margin: { left: 10 } }} />
|
|
13
|
+
*
|
|
14
|
+
* @category Component
|
|
6
15
|
*/
|
|
7
16
|
/*#__PURE__*/
|
|
8
17
|
export function Label(props) {
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Color4 } from '@dcl/ecs/dist/components/generated/pb/decentraland/common/colors.gen';
|
|
2
2
|
/**
|
|
3
|
+
* Label component props
|
|
3
4
|
* @public
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
-
/**
|
|
6
|
+
export interface UiLabelProps {
|
|
7
|
+
/** Primary content. */
|
|
8
|
+
value: string;
|
|
9
|
+
/** Color of the label. @defaultValue `{ r: 1, g: 1, b: 1, a: 1 }` */
|
|
10
|
+
color?: Color4 | undefined;
|
|
11
|
+
/** Label font size. @defaultValue 10 */
|
|
12
|
+
fontSize?: number | undefined;
|
|
13
|
+
/** Label align position. @defaultValue 'middle-center' */
|
|
7
14
|
textAlign?: TextAlignType | undefined;
|
|
8
|
-
/**
|
|
15
|
+
/** Label font type. @defaultValue 'sans-serif' */
|
|
9
16
|
font?: UiFontType | undefined;
|
|
10
|
-
}
|
|
17
|
+
}
|
|
11
18
|
/**
|
|
12
19
|
* @public
|
|
13
20
|
*/
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ReactEcs } from '../react-ecs';
|
|
2
|
-
import {
|
|
3
|
-
import { CANVAS_ROOT_ENTITY } from './uiTransform';
|
|
2
|
+
import { EntityPropTypes } from './types';
|
|
4
3
|
export * from './types';
|
|
5
|
-
export { CANVAS_ROOT_ENTITY };
|
|
6
4
|
export * from './uiTransform/types';
|
|
7
5
|
export * from './listeners/types';
|
|
8
6
|
export * from './Input/types';
|
|
@@ -16,5 +14,6 @@ export { Label } from './Label';
|
|
|
16
14
|
export { Button } from './Button';
|
|
17
15
|
/**
|
|
18
16
|
* @public
|
|
17
|
+
* @category Component
|
|
19
18
|
*/
|
|
20
|
-
export declare function UiEntity(props: EntityPropTypes
|
|
19
|
+
export declare function UiEntity(props: EntityPropTypes): ReactEcs.JSX.Element;
|
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ReactEcs } from '../react-ecs';
|
|
2
|
-
import { CANVAS_ROOT_ENTITY } from './uiTransform';
|
|
3
2
|
import { parseProps } from './utils';
|
|
4
3
|
export * from './types';
|
|
5
|
-
export { CANVAS_ROOT_ENTITY };
|
|
6
4
|
export * from './uiTransform/types';
|
|
7
5
|
export * from './listeners/types';
|
|
8
6
|
export * from './Input/types';
|
|
@@ -16,6 +14,7 @@ export { Label } from './Label';
|
|
|
16
14
|
export { Button } from './Button';
|
|
17
15
|
/**
|
|
18
16
|
* @public
|
|
17
|
+
* @category Component
|
|
19
18
|
*/
|
|
20
19
|
/*#__PURE__*/
|
|
21
20
|
export function UiEntity(props) {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Callback function to be triggered on a specified event
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
1
5
|
export type Callback = () => void;
|
|
6
|
+
/**
|
|
7
|
+
* User key event Listeners
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
2
10
|
export type Listeners = {
|
|
11
|
+
/** triggered on mouse down event */
|
|
3
12
|
onMouseDown?: Callback;
|
|
13
|
+
/** triggered on mouse up event */
|
|
4
14
|
onMouseUp?: Callback;
|
|
5
15
|
};
|
|
6
|
-
export declare const isListener: (key: string) => key is keyof Listeners;
|
|
@@ -3,14 +3,20 @@ import { UiBackgroundProps } from './uiBackground/types';
|
|
|
3
3
|
import { UiTransformProps } from './uiTransform/types';
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
|
+
* Common props to all components
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
+
export interface EntityPropTypes extends Listeners {
|
|
9
|
+
/** Layout component, to position things in the canvas */
|
|
8
10
|
uiTransform?: UiTransformProps;
|
|
11
|
+
/** To define a background color or image */
|
|
9
12
|
uiBackground?: UiBackgroundProps;
|
|
10
|
-
|
|
13
|
+
/** Uinique key to identiy elments when iterating arrays */
|
|
14
|
+
key?: Key;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Keys help React identify which items have changed, are added, or are removed.
|
|
18
|
+
* Keys should be given to the elements inside the array to give the elements a stable identity:
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
11
21
|
export type Key = number | string;
|
|
12
22
|
export type Children = unknown;
|
|
13
|
-
export type CommonProps = {
|
|
14
|
-
key?: Key;
|
|
15
|
-
children?: Children;
|
|
16
|
-
};
|
|
@@ -2,36 +2,39 @@ import { BorderRect } from '@dcl/ecs';
|
|
|
2
2
|
import { Color4 } from '@dcl/ecs/dist/components/generated/pb/decentraland/common/colors.gen';
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
|
+
* Background Component props
|
|
6
|
+
* .i.e to define a background color or image
|
|
5
7
|
*/
|
|
6
|
-
export
|
|
8
|
+
export interface UiBackgroundProps {
|
|
9
|
+
/** Background color. @defaultValue `{ r: 1, g: 1, b: 1, a: 1 }` */
|
|
7
10
|
color?: Color4 | undefined;
|
|
8
11
|
textureMode?: TextureMode;
|
|
12
|
+
/** Texture slices represents the top | right | bottom | left sizes of the slices for the borders. Values are percentages of the texture. */
|
|
9
13
|
textureSlices?: BorderRect | undefined;
|
|
14
|
+
/** when STRETCH is selected, the uvs are configurable */
|
|
10
15
|
uvs?: number[];
|
|
11
|
-
|
|
16
|
+
/** AvatarTexture for the background */
|
|
17
|
+
avatarTexture?: UiAvatarTexture;
|
|
18
|
+
/** Texture for the background */
|
|
19
|
+
texture?: UiTexture;
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
22
|
+
* Avatar Texture
|
|
13
23
|
* @public
|
|
14
24
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
avatarTexture?: {
|
|
21
|
-
userId: string;
|
|
22
|
-
wrapMode?: TextureWrapType;
|
|
23
|
-
filterMode?: TextureFilterType;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
25
|
+
export interface UiAvatarTexture {
|
|
26
|
+
userId: string;
|
|
27
|
+
wrapMode?: TextureWrapType;
|
|
28
|
+
filterMode?: TextureFilterType;
|
|
29
|
+
}
|
|
26
30
|
/**
|
|
31
|
+
* Texture
|
|
27
32
|
* @public
|
|
28
33
|
*/
|
|
29
34
|
export type UiTexture = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
filterMode?: TextureFilterType;
|
|
34
|
-
};
|
|
35
|
+
src: string;
|
|
36
|
+
wrapMode?: TextureWrapType;
|
|
37
|
+
filterMode?: TextureFilterType;
|
|
35
38
|
};
|
|
36
39
|
/**
|
|
37
40
|
* @public
|
|
@@ -10,17 +10,11 @@ export function getTextureMode(mode) {
|
|
|
10
10
|
const value = mode ? parseTextureMode[mode] : 1 /* BackgroundTextureMode.CENTER */;
|
|
11
11
|
return { textureMode: value };
|
|
12
12
|
}
|
|
13
|
-
function isAvatarTexture(props) {
|
|
14
|
-
return !!props.avatarTexture;
|
|
15
|
-
}
|
|
16
|
-
function isTexture(props) {
|
|
17
|
-
return !!props.texture;
|
|
18
|
-
}
|
|
19
13
|
/**
|
|
20
14
|
* @internal
|
|
21
15
|
*/
|
|
22
16
|
export function getTexture(props) {
|
|
23
|
-
if (
|
|
17
|
+
if (props.texture) {
|
|
24
18
|
return {
|
|
25
19
|
tex: {
|
|
26
20
|
$case: 'texture',
|
|
@@ -28,7 +22,7 @@ export function getTexture(props) {
|
|
|
28
22
|
}
|
|
29
23
|
};
|
|
30
24
|
}
|
|
31
|
-
if (
|
|
25
|
+
if (props.avatarTexture) {
|
|
32
26
|
return {
|
|
33
27
|
tex: {
|
|
34
28
|
$case: 'avatarTexture',
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { getAlign, getFlexDirection, getDisplay, getFlexWrap, getJustify, getOverflow, getPoistionType, parsePosition, parseSize } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
2
5
|
export const CANVAS_ROOT_ENTITY = 0;
|
|
3
6
|
const defaultUiTransform = {
|
|
4
7
|
parent: CANVAS_ROOT_ENTITY,
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position unit for the user.
|
|
3
|
+
* i.e. width="100", width="100%", width="100px"
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
1
6
|
export type PositionUnit = `${number}px` | `${number}%` | number;
|
|
2
7
|
/**
|
|
8
|
+
* Type used for defining the position of the element. i.e. margin, padding
|
|
3
9
|
* @public
|
|
4
10
|
*/
|
|
5
|
-
export
|
|
11
|
+
export interface Position {
|
|
6
12
|
top: PositionUnit;
|
|
7
13
|
right: PositionUnit;
|
|
8
14
|
bottom: PositionUnit;
|
|
9
15
|
left: PositionUnit;
|
|
10
|
-
}
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* @public
|
|
13
19
|
*/
|
|
@@ -30,36 +36,61 @@ export type FlexDirectionType = 'row' | 'column' | 'column-reverse' | 'row-rever
|
|
|
30
36
|
export type FlexWrapType = 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
31
37
|
/**
|
|
32
38
|
* @public
|
|
39
|
+
* The overflow property controls what happens to content that is too big to fit into an area.
|
|
33
40
|
*/
|
|
34
41
|
export type OverflowType = 'hidden' | 'scroll' | 'visible';
|
|
35
42
|
/**
|
|
36
43
|
* @public
|
|
44
|
+
* The position property specifies the type of positioning method used for an element
|
|
37
45
|
*/
|
|
38
46
|
export type PositionType = 'absolute' | 'relative';
|
|
39
47
|
/**
|
|
48
|
+
* Layout props to position things in the canvas
|
|
40
49
|
* @public
|
|
41
50
|
*/
|
|
42
51
|
export interface UiTransformProps {
|
|
52
|
+
/** The display property controls if a item is going to be displayed or not. */
|
|
43
53
|
display?: DisplayType;
|
|
54
|
+
/** The flex shorthand property sets how a flex item will grow or shrink to fit the space available in its flex container. */
|
|
44
55
|
flex?: number;
|
|
56
|
+
/** Justify content describes how to align children within the main axis of their container. */
|
|
45
57
|
justifyContent?: JustifyType;
|
|
58
|
+
/** The position type of an element defines how it is positioned within its parent. */
|
|
46
59
|
positionType?: PositionType;
|
|
60
|
+
/** The align-items property controls the alignment of items on the Cross Axis. */
|
|
47
61
|
alignItems?: AlignType;
|
|
62
|
+
/** The align-self property has the same options and effect as align items but instead of affecting the children within a container, you can apply this property to a single child to change its alignment within its parent */
|
|
48
63
|
alignSelf?: AlignType;
|
|
64
|
+
/** The align-content property sets the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis. */
|
|
49
65
|
alignContent?: AlignType;
|
|
66
|
+
/** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
|
|
50
67
|
flexDirection?: FlexDirectionType;
|
|
68
|
+
/** The position property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements. */
|
|
51
69
|
position?: Partial<Position>;
|
|
70
|
+
/** The padding shorthand property sets the padding area on all four sides of an element at once. */
|
|
52
71
|
padding?: Partial<Position>;
|
|
72
|
+
/** The margin shorthand property sets the margin area on all four sides of an element. */
|
|
53
73
|
margin?: Partial<Position>;
|
|
74
|
+
/** The width property specifies the width of an element. */
|
|
54
75
|
width?: PositionUnit;
|
|
76
|
+
/** The height property specifies the height of an element. */
|
|
55
77
|
height?: PositionUnit;
|
|
78
|
+
/** The min-width property sets the minimum width of an element. */
|
|
56
79
|
minWidth?: PositionUnit;
|
|
80
|
+
/** The max-width property sets the maximum width of an element. */
|
|
57
81
|
maxWidth?: PositionUnit;
|
|
82
|
+
/** The min-height CSS property sets the minimum height of an element. */
|
|
58
83
|
minHeight?: PositionUnit;
|
|
84
|
+
/** The max-height property sets the maximum height of an element */
|
|
59
85
|
maxHeight?: PositionUnit;
|
|
86
|
+
/** The flex-wrap property sets whether flex items are forced onto one line or can wrap onto multiple lines. If wrapping is allowed, it sets the direction that lines are stacked*/
|
|
60
87
|
flexWrap?: FlexWrapType;
|
|
88
|
+
/** The flex-basis property sets the initial main size of a flex item. It sets the size of the content box.*/
|
|
61
89
|
flexBasis?: number;
|
|
90
|
+
/** The flex-grow property sets the flex grow factor of a flex item's main size. */
|
|
62
91
|
flexGrow?: number;
|
|
92
|
+
/** The flex-shrink property sets the flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items shrink to fit according to flex-shrink. */
|
|
63
93
|
flexShrink?: number;
|
|
94
|
+
/** The overflow property controls what happens to content that is too big to fit into an area */
|
|
64
95
|
overflow?: OverflowType;
|
|
65
96
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ReactEcs } from './react-ecs';
|
|
2
|
+
import { ReactBasedUiSystem } from './system';
|
|
2
3
|
export * from './components';
|
|
3
4
|
export * from './system';
|
|
4
5
|
export * from './react-ecs';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* ReactEcs variable provides the function to render & destroy the specified UI
|
|
8
|
+
* @public
|
|
9
|
+
* @example
|
|
10
|
+
* import { ReactEcsRenderer } from '@dcl/sdk/react-ecs'
|
|
11
|
+
* ReactEcsRenderer.setUiRenderer(uiComponent)
|
|
12
|
+
*/
|
|
13
|
+
export declare const ReactEcsRenderer: ReactBasedUiSystem;
|
|
6
14
|
export default ReactEcs;
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,13 @@ import { createReactBasedUiSystem } from './system';
|
|
|
4
4
|
export * from './components';
|
|
5
5
|
export * from './system';
|
|
6
6
|
export * from './react-ecs';
|
|
7
|
+
/**
|
|
8
|
+
* ReactEcs variable provides the function to render & destroy the specified UI
|
|
9
|
+
* @public
|
|
10
|
+
* @example
|
|
11
|
+
* import { ReactEcsRenderer } from '@dcl/sdk/react-ecs'
|
|
12
|
+
* ReactEcsRenderer.setUiRenderer(uiComponent)
|
|
13
|
+
*/
|
|
7
14
|
/*#__PURE__*/
|
|
8
15
|
export const ReactEcsRenderer = createReactBasedUiSystem(engine, pointerEventsSystem);
|
|
9
16
|
export default ReactEcs;
|
package/dist/react-ecs.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { PBUiBackground, PBUiText, PBUiTransform, PBUiInput, PBUiDropdown } from '@dcl/ecs';
|
|
2
|
-
import { Callback } from './components';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Callback, Children, Key } from './components';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface EcsElements {
|
|
7
|
+
entity: Partial<EntityComponents> & {
|
|
8
|
+
children?: Children;
|
|
9
|
+
key?: Key;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
7
15
|
export type EntityComponents = {
|
|
8
16
|
uiTransform: PBUiTransform;
|
|
9
17
|
uiText: PBUiText;
|
|
@@ -13,16 +21,33 @@ export type EntityComponents = {
|
|
|
13
21
|
onMouseDown: Callback;
|
|
14
22
|
onMouseUp: Callback;
|
|
15
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
16
27
|
export declare namespace JSX {
|
|
17
28
|
type Element = {} | null;
|
|
18
29
|
type IntrinsicElements = EcsElements;
|
|
19
30
|
interface Component {
|
|
20
31
|
}
|
|
21
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
22
36
|
export declare namespace ReactEcs {
|
|
23
37
|
namespace JSX {
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
24
41
|
type Element = {} | null;
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
* HTML tag elements
|
|
45
|
+
*/
|
|
25
46
|
type IntrinsicElements = EcsElements;
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
* Component empty interface
|
|
50
|
+
*/
|
|
26
51
|
interface Component {
|
|
27
52
|
}
|
|
28
53
|
}
|
package/dist/react-ecs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entity, IEngine, PointerEventsSystem } from '@dcl/ecs';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactEcs } from '../react-ecs';
|
|
3
3
|
export declare function createReconciler(engine: Pick<IEngine, 'getComponent' | 'addEntity' | 'removeEntity' | 'defineComponentFromSchema' | 'getEntitiesWith'>, pointerEvents: PointerEventsSystem): {
|
|
4
|
-
update: (component: JSX.Element) => number;
|
|
4
|
+
update: (component: ReactEcs.JSX.Element) => number;
|
|
5
5
|
getEntities: () => Entity[];
|
|
6
6
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Entity } from '@dcl/ecs';
|
|
2
|
-
import {
|
|
2
|
+
import { Children, Key, Listeners } from '../components';
|
|
3
3
|
import type { EntityComponents } from '../react-ecs';
|
|
4
4
|
export type EngineComponents = Omit<EntityComponents, keyof Listeners>;
|
|
5
5
|
export type OpaqueHandle = any;
|
|
6
6
|
export type Type = 'entity';
|
|
7
|
-
export type Props = EntityComponents &
|
|
7
|
+
export type Props = EntityComponents & {
|
|
8
|
+
children?: Children;
|
|
9
|
+
key?: Key;
|
|
10
|
+
};
|
|
8
11
|
export type Container = Document | Instance | any;
|
|
9
12
|
export type Instance = {
|
|
10
13
|
entity: Entity;
|
package/dist/system.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { ReactEcs } from './react-ecs';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export type UiComponent = () => ReactEcs.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface ReactBasedUiSystem {
|
|
5
10
|
destroy(): void;
|
|
6
11
|
setUiRenderer(ui: UiComponent): void;
|
|
7
|
-
}
|
|
8
|
-
export declare function createReactBasedUiSystem(engine: IEngine, pointerSystem: PointerEventsSystem): ReactBasedUiSystem;
|
|
12
|
+
}
|
package/dist/system.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/react-ecs",
|
|
3
|
-
"version": "7.0.6-
|
|
3
|
+
"version": "7.0.6-4076330908.commit-cd40e5f",
|
|
4
4
|
"description": "Decentraland ECS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"displayName": "React ECS",
|
|
43
43
|
"tsconfig": "./tsconfig.json"
|
|
44
44
|
},
|
|
45
|
-
"commit": "
|
|
45
|
+
"commit": "cd40e5fe70cbeabc3231fc374729bfd52b1127e2"
|
|
46
46
|
}
|