@dcl/react-ecs 0.0.1-3548419522.commit-ddcf4b7 → 7.0.0
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/index.d.ts +13 -0
- package/dist/components/index.js +17 -0
- package/dist/components/listeners/types.d.ts +5 -0
- package/dist/components/listeners/types.js +5 -0
- package/dist/components/types.d.ts +16 -0
- package/dist/components/types.js +1 -0
- package/dist/components/uiTransform/index.d.ts +7 -0
- package/dist/components/uiTransform/index.js +70 -0
- package/dist/components/uiTransform/types.d.ts +38 -0
- package/dist/components/uiTransform/types.js +1 -0
- package/dist/components/uiTransform/utils.d.ts +21 -0
- package/dist/components/uiTransform/utils.js +52 -0
- package/dist/index.d.ts +6 -417
- package/dist/index.js +9 -965
- package/dist/react-ecs.d.ts +29 -0
- package/dist/react-ecs.js +5 -0
- package/dist/reconciler/index.d.ts +6 -0
- package/dist/reconciler/index.js +198 -0
- package/dist/reconciler/types.d.ts +28 -0
- package/dist/reconciler/types.js +1 -0
- package/dist/reconciler/utils.d.ts +40 -0
- package/dist/reconciler/utils.js +127 -0
- package/dist/system.d.ts +8 -0
- package/dist/system.js +21 -0
- package/package.json +9 -12
- package/tsconfig.json +26 -0
- package/dist/index.min.js +0 -1
- package/dist/index.min.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactEcs } from '../react-ecs';
|
|
2
|
+
import { CommonProps, EntityPropTypes } from './types';
|
|
3
|
+
import { CANVAS_ROOT_ENTITY } from './uiTransform';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { CANVAS_ROOT_ENTITY };
|
|
6
|
+
export * from './uiTransform/types';
|
|
7
|
+
export * from './listeners/types';
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare function UiEntity(props: EntityPropTypes & Partial<CommonProps>): ReactEcs.JSX.Element;
|
|
12
|
+
export declare type ContainerPropTypes = Partial<CommonProps> & EntityPropTypes['uiTransform'];
|
|
13
|
+
export declare function Container({ width, height, children }: ContainerPropTypes): ReactEcs.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactEcs } from '../react-ecs';
|
|
2
|
+
import { parseUiTransform, CANVAS_ROOT_ENTITY } from './uiTransform';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export { CANVAS_ROOT_ENTITY };
|
|
5
|
+
export * from './uiTransform/types';
|
|
6
|
+
export * from './listeners/types';
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function UiEntity(props) {
|
|
11
|
+
const { uiTransform, ...otherProps } = props;
|
|
12
|
+
const uiTransformProps = parseUiTransform(uiTransform);
|
|
13
|
+
return ReactEcs.createElement("entity", { uiTransform: uiTransformProps, ...otherProps });
|
|
14
|
+
}
|
|
15
|
+
export function Container({ width, height, children }) {
|
|
16
|
+
return (ReactEcs.createElement(UiEntity, { uiTransform: { width, height, display: 0 /* YGDisplay.YGD_FLEX */ } }, children));
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PBUiBackground, PBUiText } from '@dcl/ecs/dist/components';
|
|
2
|
+
import { UiTransformProps } from './uiTransform/types';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare type EntityPropTypes = {
|
|
7
|
+
uiTransform?: UiTransformProps;
|
|
8
|
+
uiText?: PBUiText;
|
|
9
|
+
uiBackground?: PBUiBackground;
|
|
10
|
+
};
|
|
11
|
+
export declare type Key = number | string;
|
|
12
|
+
export declare type Children = any;
|
|
13
|
+
export declare type CommonProps = {
|
|
14
|
+
key: Key;
|
|
15
|
+
children: Children;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { parsePosition, parseSize } from './utils';
|
|
2
|
+
export const CANVAS_ROOT_ENTITY = 0;
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export function parseUiTransform(props = {}) {
|
|
7
|
+
const { position, padding, margin, height, minHeight, maxHeight, width, maxWidth, minWidth, ...otherProps } = props;
|
|
8
|
+
return {
|
|
9
|
+
...defaultUiTransform,
|
|
10
|
+
...otherProps,
|
|
11
|
+
...parsePosition(position, 'position'),
|
|
12
|
+
...parsePosition(margin, 'margin'),
|
|
13
|
+
...parsePosition(padding, 'padding'),
|
|
14
|
+
...parseSize(height, 'height'),
|
|
15
|
+
...parseSize(minHeight, 'minHeight'),
|
|
16
|
+
...parseSize(maxHeight, 'maxHeight'),
|
|
17
|
+
...parseSize(width, 'width'),
|
|
18
|
+
...parseSize(minWidth, 'minWidth'),
|
|
19
|
+
...parseSize(maxWidth, 'maxWidth')
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const defaultUiTransform = {
|
|
23
|
+
parent: CANVAS_ROOT_ENTITY,
|
|
24
|
+
rightOf: 0,
|
|
25
|
+
display: 0 /* YGDisplay.YGD_FLEX */,
|
|
26
|
+
flexBasis: 0,
|
|
27
|
+
width: 0,
|
|
28
|
+
height: 0,
|
|
29
|
+
minWidth: 0,
|
|
30
|
+
minHeight: 0,
|
|
31
|
+
maxWidth: 0,
|
|
32
|
+
maxHeight: 0,
|
|
33
|
+
justifyContent: 0 /* YGJustify.YGJ_FLEX_START */,
|
|
34
|
+
alignSelf: 0 /* YGAlign.YGA_AUTO */,
|
|
35
|
+
flexDirection: 0 /* YGFlexDirection.YGFD_ROW */,
|
|
36
|
+
positionType: 0 /* YGPositionType.YGPT_RELATIVE */,
|
|
37
|
+
flexGrow: 0,
|
|
38
|
+
marginBottom: 0,
|
|
39
|
+
marginBottomUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
40
|
+
marginLeft: 0,
|
|
41
|
+
marginLeftUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
42
|
+
marginRight: 0,
|
|
43
|
+
marginRightUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
44
|
+
marginTop: 0,
|
|
45
|
+
marginTopUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
46
|
+
maxHeightUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
47
|
+
maxWidthUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
48
|
+
minHeightUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
49
|
+
minWidthUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
50
|
+
overflow: 0 /* YGOverflow.YGO_VISIBLE */,
|
|
51
|
+
paddingBottom: 0,
|
|
52
|
+
paddingBottomUnit: 2 /* YGUnit.YGU_PERCENT */,
|
|
53
|
+
paddingLeft: 0,
|
|
54
|
+
paddingLeftUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
55
|
+
paddingTopUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
56
|
+
paddingRight: 0,
|
|
57
|
+
paddingRightUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
58
|
+
paddingTop: 0,
|
|
59
|
+
positionBottom: 0,
|
|
60
|
+
positionBottomUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
61
|
+
positionLeft: 0,
|
|
62
|
+
positionLeftUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
63
|
+
positionRight: 0,
|
|
64
|
+
positionRightUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
65
|
+
positionTop: 0,
|
|
66
|
+
positionTopUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
67
|
+
flexBasisUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
68
|
+
widthUnit: 0 /* YGUnit.YGU_UNDEFINED */,
|
|
69
|
+
heightUnit: 0 /* YGUnit.YGU_UNDEFINED */
|
|
70
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { YGAlign, YGDisplay, YGFlexDirection, YGJustify, YGOverflow, YGPositionType, YGWrap } from '@dcl/ecs/dist/runtime/types';
|
|
2
|
+
export declare type PositionUnit = `${number}px` | `${number}%` | number;
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare type Position = {
|
|
7
|
+
top: PositionUnit;
|
|
8
|
+
right: PositionUnit;
|
|
9
|
+
bottom: PositionUnit;
|
|
10
|
+
left: PositionUnit;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface UiTransformProps {
|
|
16
|
+
display?: YGDisplay;
|
|
17
|
+
flex?: number;
|
|
18
|
+
justifyContent?: YGJustify;
|
|
19
|
+
positionType?: YGPositionType;
|
|
20
|
+
alignItems?: YGAlign;
|
|
21
|
+
alignSelf?: YGAlign;
|
|
22
|
+
alignContent?: YGAlign;
|
|
23
|
+
flexDirection?: YGFlexDirection;
|
|
24
|
+
position?: Partial<Position>;
|
|
25
|
+
padding?: Partial<Position>;
|
|
26
|
+
margin?: Partial<Position>;
|
|
27
|
+
width?: PositionUnit;
|
|
28
|
+
height?: PositionUnit;
|
|
29
|
+
minWidth?: PositionUnit;
|
|
30
|
+
maxWidth?: PositionUnit;
|
|
31
|
+
minHeight?: PositionUnit;
|
|
32
|
+
maxHeight?: PositionUnit;
|
|
33
|
+
flexWrap?: YGWrap;
|
|
34
|
+
flexBasis?: number;
|
|
35
|
+
flexGrow?: number;
|
|
36
|
+
flexShrink?: number;
|
|
37
|
+
overflow?: YGOverflow;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { YGUnit } from '@dcl/ecs';
|
|
2
|
+
import { Position, PositionUnit } from './types';
|
|
3
|
+
declare type PropName = 'position' | 'margin' | 'padding';
|
|
4
|
+
declare type PropKey = `${PropName}${Capitalize<keyof Position>}`;
|
|
5
|
+
declare type PropKeyUnit = `${PropName}${Capitalize<keyof Position>}Unit`;
|
|
6
|
+
declare type PositionParsed = {
|
|
7
|
+
[key in PropKey]?: number;
|
|
8
|
+
} & {
|
|
9
|
+
[key in PropKeyUnit]?: YGUnit;
|
|
10
|
+
};
|
|
11
|
+
export declare function parsePosition<T extends PropName>(position: Partial<Position> | undefined, prop: T): Partial<PositionParsed>;
|
|
12
|
+
declare type HeightWidth = 'height' | 'width';
|
|
13
|
+
declare type SizePropName = HeightWidth | `max${Capitalize<HeightWidth>}` | `min${Capitalize<HeightWidth>}`;
|
|
14
|
+
declare type SizePropKeyUnit = `${SizePropName}Unit`;
|
|
15
|
+
declare type SizeReturnType = {
|
|
16
|
+
[key in SizePropName]: number;
|
|
17
|
+
} & {
|
|
18
|
+
[key in SizePropKeyUnit]: YGUnit;
|
|
19
|
+
};
|
|
20
|
+
export declare function parseSize(val: PositionUnit | undefined, key: SizePropName): Partial<SizeReturnType>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function capitalize(value) {
|
|
2
|
+
return `${value[0].toUpperCase()}${value.slice(1, value.length)}`;
|
|
3
|
+
}
|
|
4
|
+
function isPercent(val) {
|
|
5
|
+
return typeof val === 'string' && val.endsWith('%');
|
|
6
|
+
}
|
|
7
|
+
function isPoint(val) {
|
|
8
|
+
return typeof val === 'string' && val.endsWith('px');
|
|
9
|
+
}
|
|
10
|
+
function parsePositionUnit(val) {
|
|
11
|
+
function getValue(key, value) {
|
|
12
|
+
return Number(value.slice(0, value.indexOf(key)));
|
|
13
|
+
}
|
|
14
|
+
if (val === undefined || val === null) {
|
|
15
|
+
return [undefined, 0 /* YGUnit.YGU_UNDEFINED */];
|
|
16
|
+
}
|
|
17
|
+
if (typeof val === 'number') {
|
|
18
|
+
return [Number(val), 1 /* YGUnit.YGU_POINT */];
|
|
19
|
+
}
|
|
20
|
+
if (isPercent(val)) {
|
|
21
|
+
return [getValue('%', val), 2 /* YGUnit.YGU_PERCENT */];
|
|
22
|
+
}
|
|
23
|
+
if (isPoint(val)) {
|
|
24
|
+
return [getValue('px', val), 1 /* YGUnit.YGU_POINT */];
|
|
25
|
+
}
|
|
26
|
+
return [undefined, 0 /* YGUnit.YGU_UNDEFINED */];
|
|
27
|
+
}
|
|
28
|
+
// position: { top: '1px' } => { positionTop: 1, positionTopUnit: YGUnit.YGU_Point }
|
|
29
|
+
export function parsePosition(position = {}, prop) {
|
|
30
|
+
const obj = {};
|
|
31
|
+
for (const key in position) {
|
|
32
|
+
const typedKey = key;
|
|
33
|
+
const propKey = `${prop}${capitalize(typedKey)}`;
|
|
34
|
+
const propKeyUnit = `${prop}${capitalize(typedKey)}Unit`;
|
|
35
|
+
const [value, unit] = parsePositionUnit(position[typedKey]);
|
|
36
|
+
if (value === undefined)
|
|
37
|
+
continue;
|
|
38
|
+
obj[propKeyUnit] = unit;
|
|
39
|
+
obj[propKey] = value;
|
|
40
|
+
}
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
export function parseSize(val, key) {
|
|
44
|
+
const unitKey = `${key}Unit`;
|
|
45
|
+
const [value, unit] = parsePositionUnit(val);
|
|
46
|
+
if (value === undefined)
|
|
47
|
+
return {};
|
|
48
|
+
return {
|
|
49
|
+
[key]: value,
|
|
50
|
+
[unitKey]: unit
|
|
51
|
+
};
|
|
52
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,417 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
g: number;
|
|
8
|
-
b: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export declare interface Color4 {
|
|
12
|
-
r: number;
|
|
13
|
-
g: number;
|
|
14
|
-
b: number;
|
|
15
|
-
a: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export declare type CommonProps = {
|
|
19
|
-
key: Key;
|
|
20
|
-
children: Children;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export declare function Container({ width, height, children }: ContainerPropTypes): ReactEcs.JSX.Element;
|
|
24
|
-
|
|
25
|
-
export declare type ContainerPropTypes = Partial<CommonProps> & EntityPropTypes['uiTransform'];
|
|
26
|
-
|
|
27
|
-
export declare type EcsElements = {
|
|
28
|
-
entity: Partial<Omit<EntityComponents, 'onClick'> & CommonProps>;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
declare type Entity = number & {
|
|
35
|
-
[entitySymbol]: true;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export declare type EntityComponents = {
|
|
39
|
-
uiTransform: PBUiTransform;
|
|
40
|
-
uiText: UiTextProps;
|
|
41
|
-
uiBackground: UiBackgroundProps;
|
|
42
|
-
onClick: OnClick;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
export declare type EntityPropTypes = {
|
|
49
|
-
uiTransform?: UiTransformProps;
|
|
50
|
-
uiText?: UiTextProps;
|
|
51
|
-
uiBackground?: UiBackgroundProps;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
declare const entitySymbol: unique symbol;
|
|
55
|
-
|
|
56
|
-
declare type EventsSystem = typeof EventsSystem;
|
|
57
|
-
|
|
58
|
-
declare namespace EventsSystem {
|
|
59
|
-
type Callback = (event: PBPointerEventsResult_PointerCommand) => void | Promise<void>;
|
|
60
|
-
type Options = {
|
|
61
|
-
button?: InputAction;
|
|
62
|
-
hoverText?: string;
|
|
63
|
-
maxDistance?: number;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* @public
|
|
67
|
-
* Remove the callback for onPointerDown event
|
|
68
|
-
* @param entity Entity where the callback was attached
|
|
69
|
-
*/
|
|
70
|
-
function removeOnPointerDown(entity: Entity): void;
|
|
71
|
-
/**
|
|
72
|
-
* @public
|
|
73
|
-
* Remove the callback for onPointerUp event
|
|
74
|
-
* @param entity Entity where the callback was attached
|
|
75
|
-
*/
|
|
76
|
-
function removeOnPointerUp(entity: Entity): void;
|
|
77
|
-
/**
|
|
78
|
-
* @public
|
|
79
|
-
* Execute callback when the user press the InputButton pointing at the entity
|
|
80
|
-
* @param entity Entity to attach the callback
|
|
81
|
-
* @param cb Function to execute when click fires
|
|
82
|
-
* @param opts Opts to trigger Feedback and Button
|
|
83
|
-
*/
|
|
84
|
-
function onPointerDown(entity: Entity, cb: Callback, opts?: Options): void;
|
|
85
|
-
/**
|
|
86
|
-
* @public
|
|
87
|
-
* Execute callback when the user releases the InputButton pointing at the entity
|
|
88
|
-
* @param entity Entity to attach the callback
|
|
89
|
-
* @param cb Function to execute when click fires
|
|
90
|
-
* @param opts Opts to trigger Feedback and Button
|
|
91
|
-
*/
|
|
92
|
-
function onPointerUp(entity: Entity, cb: Callback, opts?: Options): void;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export declare enum Font {
|
|
96
|
-
F_LIBERATION_SANS = 0,
|
|
97
|
-
F_SANS_SERIF = 1,
|
|
98
|
-
UNRECOGNIZED = -1
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
declare const enum InputAction {
|
|
102
|
-
IA_POINTER = 0,
|
|
103
|
-
IA_PRIMARY = 1,
|
|
104
|
-
IA_SECONDARY = 2,
|
|
105
|
-
IA_ANY = 3,
|
|
106
|
-
IA_FORWARD = 4,
|
|
107
|
-
IA_BACKWARD = 5,
|
|
108
|
-
IA_RIGHT = 6,
|
|
109
|
-
IA_LEFT = 7,
|
|
110
|
-
IA_JUMP = 8,
|
|
111
|
-
IA_WALK = 9,
|
|
112
|
-
IA_ACTION_3 = 10,
|
|
113
|
-
IA_ACTION_4 = 11,
|
|
114
|
-
IA_ACTION_5 = 12,
|
|
115
|
-
IA_ACTION_6 = 13
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export declare const isListener: (key: string) => key is "onClick";
|
|
119
|
-
|
|
120
|
-
export declare namespace JSX {
|
|
121
|
-
export interface Element {
|
|
122
|
-
}
|
|
123
|
-
export type IntrinsicElements = EcsElements;
|
|
124
|
-
export interface Component {
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export declare type Key = number | string;
|
|
129
|
-
|
|
130
|
-
export declare type Listeners = {
|
|
131
|
-
onClick?: OnClick;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export declare type OnClick = EventsSystem.Callback;
|
|
135
|
-
|
|
136
|
-
/** this message represents a pointer event, used both for UP and DOWN actions */
|
|
137
|
-
declare interface PBPointerEventsResult_PointerCommand {
|
|
138
|
-
/** identifier of the input */
|
|
139
|
-
button: InputAction;
|
|
140
|
-
hit: RaycastHit | undefined;
|
|
141
|
-
state: PointerEventType;
|
|
142
|
-
/** could be a Lamport timestamp */
|
|
143
|
-
timestamp: number;
|
|
144
|
-
/** if the input is analog then we store it here */
|
|
145
|
-
analog?: number | undefined;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export declare interface PBUiBackground {
|
|
149
|
-
/** default=(0.0, 0.0, 0.0, 0.0) */
|
|
150
|
-
backgroundColor?: Color4 | undefined;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export declare interface PBUiText {
|
|
154
|
-
value: string;
|
|
155
|
-
/** default=(1.0,1.0,1.0,1.0) */
|
|
156
|
-
color?: Color4 | undefined;
|
|
157
|
-
/** default='center' */
|
|
158
|
-
textAlign?: TextAlignMode | undefined;
|
|
159
|
-
/** default=0 */
|
|
160
|
-
font?: Font | undefined;
|
|
161
|
-
/** default=10 */
|
|
162
|
-
fontSize?: number | undefined;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export declare interface PBUiTransform {
|
|
166
|
-
parent: number;
|
|
167
|
-
rightOf: number;
|
|
168
|
-
/** default: YGAlign.YGA_FLEX_START */
|
|
169
|
-
alignContent?: YGAlign | undefined;
|
|
170
|
-
/** default: YGAlign.YGA_STRETCH */
|
|
171
|
-
alignItems?: YGAlign | undefined;
|
|
172
|
-
/** default: YGWrap.YGW_WRAP */
|
|
173
|
-
flexWrap?: YGWrap | undefined;
|
|
174
|
-
/** default: 1 */
|
|
175
|
-
flexShrink?: number | undefined;
|
|
176
|
-
/** YGPositionType.YGPT_RELATIVE */
|
|
177
|
-
positionType: YGPositionType;
|
|
178
|
-
/** YGAlign.YGA_AUTO */
|
|
179
|
-
alignSelf: YGAlign;
|
|
180
|
-
/** YGFlexDirection.YGFD_ROW */
|
|
181
|
-
flexDirection: YGFlexDirection;
|
|
182
|
-
/** YGJustify.YGJ_FLEX_START */
|
|
183
|
-
justifyContent: YGJustify;
|
|
184
|
-
/** YGOverflow.YGO_VISIBLE */
|
|
185
|
-
overflow: YGOverflow;
|
|
186
|
-
/** YGDisplay.YGD_FLEX */
|
|
187
|
-
display: YGDisplay;
|
|
188
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
189
|
-
flexBasisUnit: YGUnit;
|
|
190
|
-
flexBasis: number;
|
|
191
|
-
flexGrow: number;
|
|
192
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
193
|
-
widthUnit: YGUnit;
|
|
194
|
-
width: number;
|
|
195
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
196
|
-
heightUnit: YGUnit;
|
|
197
|
-
height: number;
|
|
198
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
199
|
-
minWidthUnit: YGUnit;
|
|
200
|
-
minWidth: number;
|
|
201
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
202
|
-
minHeightUnit: YGUnit;
|
|
203
|
-
minHeight: number;
|
|
204
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
205
|
-
maxWidthUnit: YGUnit;
|
|
206
|
-
maxWidth: number;
|
|
207
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
208
|
-
maxHeightUnit: YGUnit;
|
|
209
|
-
maxHeight: number;
|
|
210
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
211
|
-
positionLeftUnit: YGUnit;
|
|
212
|
-
positionLeft: number;
|
|
213
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
214
|
-
positionTopUnit: YGUnit;
|
|
215
|
-
positionTop: number;
|
|
216
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
217
|
-
positionRightUnit: YGUnit;
|
|
218
|
-
positionRight: number;
|
|
219
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
220
|
-
positionBottomUnit: YGUnit;
|
|
221
|
-
positionBottom: number;
|
|
222
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
223
|
-
marginLeftUnit: YGUnit;
|
|
224
|
-
marginLeft: number;
|
|
225
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
226
|
-
marginTopUnit: YGUnit;
|
|
227
|
-
marginTop: number;
|
|
228
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
229
|
-
marginRightUnit: YGUnit;
|
|
230
|
-
marginRight: number;
|
|
231
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
232
|
-
marginBottomUnit: YGUnit;
|
|
233
|
-
marginBottom: number;
|
|
234
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
235
|
-
paddingLeftUnit: YGUnit;
|
|
236
|
-
paddingLeft: number;
|
|
237
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
238
|
-
paddingTopUnit: YGUnit;
|
|
239
|
-
paddingTop: number;
|
|
240
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
241
|
-
paddingRightUnit: YGUnit;
|
|
242
|
-
paddingRight: number;
|
|
243
|
-
/** YGUnit.YGU_UNDEFINED */
|
|
244
|
-
paddingBottomUnit: YGUnit;
|
|
245
|
-
paddingBottom: number;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
declare interface PBVector3 {
|
|
249
|
-
x: number;
|
|
250
|
-
y: number;
|
|
251
|
-
z: number;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
declare const enum PointerEventType {
|
|
255
|
-
PET_UP = 0,
|
|
256
|
-
PET_DOWN = 1,
|
|
257
|
-
PET_HOVER_ENTER = 2,
|
|
258
|
-
PET_HOVER_LEAVE = 3
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* @public
|
|
263
|
-
*/
|
|
264
|
-
export declare type Position = {
|
|
265
|
-
top: PositionUnit;
|
|
266
|
-
right: PositionUnit;
|
|
267
|
-
bottom: PositionUnit;
|
|
268
|
-
left: PositionUnit;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
export declare type PositionUnit = `${number}px` | `${number}%` | number;
|
|
272
|
-
|
|
273
|
-
/** Position will be relative to the scene */
|
|
274
|
-
declare interface RaycastHit {
|
|
275
|
-
position: PBVector3 | undefined;
|
|
276
|
-
origin: PBVector3 | undefined;
|
|
277
|
-
direction: PBVector3 | undefined;
|
|
278
|
-
normalHit: PBVector3 | undefined;
|
|
279
|
-
length: number;
|
|
280
|
-
meshName?: string | undefined;
|
|
281
|
-
entityId?: number | undefined;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
declare namespace ReactEcs {
|
|
285
|
-
namespace JSX {
|
|
286
|
-
interface Element {
|
|
287
|
-
}
|
|
288
|
-
type IntrinsicElements = EcsElements;
|
|
289
|
-
interface Component {
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
const createElement: any;
|
|
293
|
-
}
|
|
294
|
-
export { ReactEcs }
|
|
295
|
-
export default ReactEcs;
|
|
296
|
-
|
|
297
|
-
export declare function removeUi(index: number): void;
|
|
298
|
-
|
|
299
|
-
export declare function renderUi(ui: UiComponent): number;
|
|
300
|
-
|
|
301
|
-
export declare enum TextAlignMode {
|
|
302
|
-
TAM_TOP_LEFT = 0,
|
|
303
|
-
TAM_TOP_CENTER = 1,
|
|
304
|
-
TAM_TOP_RIGHT = 2,
|
|
305
|
-
TAM_MIDDLE_LEFT = 3,
|
|
306
|
-
TAM_MIDDLE_CENTER = 4,
|
|
307
|
-
TAM_MIDDLE_RIGHT = 5,
|
|
308
|
-
TAM_BOTTOM_LEFT = 6,
|
|
309
|
-
TAM_BOTTOM_CENTER = 7,
|
|
310
|
-
TAM_BOTTOM_RIGHT = 8,
|
|
311
|
-
UNRECOGNIZED = -1
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export declare type UiBackgroundProps = PBUiBackground;
|
|
315
|
-
|
|
316
|
-
export declare type UiComponent = () => JSX.Element;
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* @public
|
|
320
|
-
*/
|
|
321
|
-
export declare function UiEntity(props: EntityPropTypes & Partial<CommonProps>): ReactEcs.JSX.Element;
|
|
322
|
-
|
|
323
|
-
export declare type UiTextProps = PBUiText;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* @public
|
|
327
|
-
*/
|
|
328
|
-
export declare interface UiTransformProps {
|
|
329
|
-
display?: YGDisplay;
|
|
330
|
-
flex?: number;
|
|
331
|
-
justifyContent?: YGJustify;
|
|
332
|
-
positionType?: YGPositionType;
|
|
333
|
-
alignItems?: YGAlign;
|
|
334
|
-
alignSelf?: YGAlign;
|
|
335
|
-
alignContent?: YGAlign;
|
|
336
|
-
flexDirection?: YGFlexDirection;
|
|
337
|
-
position?: Partial<Position>;
|
|
338
|
-
padding?: Partial<Position>;
|
|
339
|
-
margin?: Partial<Position>;
|
|
340
|
-
width?: PositionUnit;
|
|
341
|
-
height?: PositionUnit;
|
|
342
|
-
minWidth?: PositionUnit;
|
|
343
|
-
maxWidth?: PositionUnit;
|
|
344
|
-
minHeight?: PositionUnit;
|
|
345
|
-
maxHeight?: PositionUnit;
|
|
346
|
-
flexWrap?: YGWrap;
|
|
347
|
-
flexBasis?: number;
|
|
348
|
-
flexGrow?: number;
|
|
349
|
-
flexShrink?: number;
|
|
350
|
-
overflow?: YGOverflow;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export declare enum YGAlign {
|
|
354
|
-
YGA_AUTO = 0,
|
|
355
|
-
YGA_FLEX_START = 1,
|
|
356
|
-
YGA_CENTER = 2,
|
|
357
|
-
YGA_FLEX_END = 3,
|
|
358
|
-
YGA_STRETCH = 4,
|
|
359
|
-
YGA_BASELINE = 5,
|
|
360
|
-
YGA_SPACE_BETWEEN = 6,
|
|
361
|
-
YGA_SPACE_AROUND = 7,
|
|
362
|
-
UNRECOGNIZED = -1
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export declare enum YGDisplay {
|
|
366
|
-
YGD_FLEX = 0,
|
|
367
|
-
YGD_NONE = 1,
|
|
368
|
-
UNRECOGNIZED = -1
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export declare enum YGFlexDirection {
|
|
372
|
-
YGFD_ROW = 0,
|
|
373
|
-
YGFD_COLUMN = 1,
|
|
374
|
-
YGFD_COLUMN_REVERSE = 2,
|
|
375
|
-
YGFD_ROW_REVERSE = 3,
|
|
376
|
-
UNRECOGNIZED = -1
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export declare enum YGJustify {
|
|
380
|
-
YGJ_FLEX_START = 0,
|
|
381
|
-
YGJ_CENTER = 1,
|
|
382
|
-
YGJ_FLEX_END = 2,
|
|
383
|
-
YGJ_SPACE_BETWEEN = 3,
|
|
384
|
-
YGJ_SPACE_AROUND = 4,
|
|
385
|
-
YGJ_SPACE_EVENLY = 5,
|
|
386
|
-
UNRECOGNIZED = -1
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
export declare enum YGOverflow {
|
|
390
|
-
YGO_VISIBLE = 0,
|
|
391
|
-
YGO_HIDDEN = 1,
|
|
392
|
-
YGO_SCROLL = 2,
|
|
393
|
-
UNRECOGNIZED = -1
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
export declare enum YGPositionType {
|
|
397
|
-
YGPT_RELATIVE = 0,
|
|
398
|
-
YGPT_ABSOLUTE = 1,
|
|
399
|
-
UNRECOGNIZED = -1
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
export declare enum YGUnit {
|
|
403
|
-
YGU_UNDEFINED = 0,
|
|
404
|
-
YGU_POINT = 1,
|
|
405
|
-
YGU_PERCENT = 2,
|
|
406
|
-
YGU_AUTO = 3,
|
|
407
|
-
UNRECOGNIZED = -1
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export declare enum YGWrap {
|
|
411
|
-
YGW_NO_WRAP = 0,
|
|
412
|
-
YGW_WRAP = 1,
|
|
413
|
-
YGW_WRAP_REVERSE = 2,
|
|
414
|
-
UNRECOGNIZED = -1
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
export { }
|
|
1
|
+
import { ReactEcs } from './react-ecs';
|
|
2
|
+
export * from './components';
|
|
3
|
+
export * from './system';
|
|
4
|
+
export * from './react-ecs';
|
|
5
|
+
export declare const ReactEcsRenderer: import("./system").ReactBasedUiSystem;
|
|
6
|
+
export default ReactEcs;
|