@dcl/sdk 7.0.0-3008112906.commit-524d1bd → 7.0.0-3039764556.commit-d9e186e
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/ecs7/index.d.ts +274 -11
- package/dist/ecs7/index.js +1437 -244
- package/dist/ecs7/index.min.js +1 -1
- package/dist/ecs7/index.min.js.map +1 -1
- package/dist/ecs7/proto-definitions/PointerEvents.proto +28 -0
- package/dist/ecs7/proto-definitions/PointerEventsResult.proto +22 -0
- package/dist/ecs7/proto-definitions/Raycast.proto +19 -0
- package/dist/ecs7/proto-definitions/RaycastResult.proto +24 -0
- package/dist/ecs7/proto-definitions/UiTransform.proto +3 -2
- package/package.json +4 -4
- package/types/dcl/decentraland-ecs.api.json +102 -102
- package/types/dcl/decentraland-ecs.api.md +35 -35
- package/types/ecs7/index.d.ts +274 -11
- package/types/tsconfig.ecs7.json +2 -0
package/dist/ecs7/index.d.ts
CHANGED
@@ -247,14 +247,24 @@ export declare namespace Components {
|
|
247
247
|
/** @public */
|
248
248
|
const PlaneShape: ComponentDefinition<ISchema<PBPlaneShape>, PBPlaneShape>;
|
249
249
|
/** @public */
|
250
|
+
const PointerEvents: ComponentDefinition<ISchema<PBPointerEvents>, PBPointerEvents>;
|
251
|
+
/** @public */
|
252
|
+
const PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
|
253
|
+
/** @public */
|
250
254
|
const PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
|
251
255
|
/** @public */
|
256
|
+
const Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
|
257
|
+
/** @public */
|
258
|
+
const RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
|
259
|
+
/** @public */
|
252
260
|
const SphereShape: ComponentDefinition<ISchema<PBSphereShape>, PBSphereShape>;
|
253
261
|
/** @public */
|
254
262
|
const TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
|
255
263
|
/** @public */
|
256
264
|
const UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
|
257
265
|
/** @public */
|
266
|
+
const UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
|
267
|
+
/** @public */
|
258
268
|
const VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
|
259
269
|
}
|
260
270
|
|
@@ -480,10 +490,15 @@ declare function defineSdkComponents(engine: PreEngine): {
|
|
480
490
|
OnPointerUp: ComponentDefinition<ISchema<PBOnPointerUp>, PBOnPointerUp>;
|
481
491
|
OnPointerUpResult: ComponentDefinition<ISchema<PBOnPointerUpResult>, PBOnPointerUpResult>;
|
482
492
|
PlaneShape: ComponentDefinition<ISchema<PBPlaneShape>, PBPlaneShape>;
|
493
|
+
PointerEvents: ComponentDefinition<ISchema<PBPointerEvents>, PBPointerEvents>;
|
494
|
+
PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
|
483
495
|
PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
|
496
|
+
Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
|
497
|
+
RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
|
484
498
|
SphereShape: ComponentDefinition<ISchema<PBSphereShape>, PBSphereShape>;
|
485
499
|
TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
|
486
500
|
UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
|
501
|
+
UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
|
487
502
|
VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
|
488
503
|
};
|
489
504
|
|
@@ -587,13 +602,13 @@ export declare type IEngine = {
|
|
587
602
|
* engine.addSystem(mySystem, 10)
|
588
603
|
* ```
|
589
604
|
*/
|
590
|
-
addSystem(system:
|
605
|
+
addSystem(system: SystemFn, priority?: number, name?: string): void;
|
591
606
|
/**
|
592
607
|
* Remove a system from the engine.
|
593
608
|
* @param selector the function or the unique name to identify
|
594
609
|
* @returns if it was found and removed
|
595
610
|
*/
|
596
|
-
removeSystem(selector: string |
|
611
|
+
removeSystem(selector: string | SystemFn): boolean;
|
597
612
|
/**
|
598
613
|
* Define a component and add it to the engine.
|
599
614
|
* @param spec An object with schema fields
|
@@ -610,7 +625,7 @@ export declare type IEngine = {
|
|
610
625
|
*
|
611
626
|
* ```
|
612
627
|
*/
|
613
|
-
defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?:
|
628
|
+
defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType): ComponentDefinition<ISchema<Result<T>>, Partial<Result<T>>>;
|
614
629
|
/**
|
615
630
|
* Define a component and add it to the engine.
|
616
631
|
* @param spec An object with schema fields
|
@@ -646,6 +661,7 @@ export declare type IEngine = {
|
|
646
661
|
* ```
|
647
662
|
*/
|
648
663
|
getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ReadonlyComponentSchema<T>]>;
|
664
|
+
RootEntity: Entity;
|
649
665
|
baseComponents: SdkComponents;
|
650
666
|
};
|
651
667
|
|
@@ -700,6 +716,17 @@ export declare interface ISize {
|
|
700
716
|
height: number;
|
701
717
|
}
|
702
718
|
|
719
|
+
/**
|
720
|
+
* Check if a pointer event has been emited in the last tick-update.
|
721
|
+
* @param entity the entity to query, for global clicks use `engine.RootEntity`
|
722
|
+
* @param actionButton
|
723
|
+
* @param pointerEventType
|
724
|
+
* @returns
|
725
|
+
*/
|
726
|
+
export declare function isPointerEventActive(entity: Entity, actionButton: ActionButton, pointerEventType: PointerEventType): boolean;
|
727
|
+
|
728
|
+
export declare function isPointerEventActiveGenerator(engine: IEngine): (entity: Entity, actionButton: ActionButton, pointerEventType: PointerEventType) => boolean;
|
729
|
+
|
703
730
|
export declare const log: (...a: any[]) => void;
|
704
731
|
|
705
732
|
/** @public */
|
@@ -2072,10 +2099,63 @@ declare interface PBPlaneShape {
|
|
2072
2099
|
uvs: number[];
|
2073
2100
|
}
|
2074
2101
|
|
2102
|
+
declare interface PBPointerEvents {
|
2103
|
+
pointerEvents: PBPointerEvents_Entry[];
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
declare interface PBPointerEvents_Entry {
|
2107
|
+
eventType: PointerEventType;
|
2108
|
+
eventInfo: PBPointerEvents_Info | undefined;
|
2109
|
+
}
|
2110
|
+
|
2111
|
+
declare interface PBPointerEvents_Info {
|
2112
|
+
/** default=ActionButton.ANY */
|
2113
|
+
button?: ActionButton | undefined;
|
2114
|
+
/** default='Interact' */
|
2115
|
+
hoverText?: string | undefined;
|
2116
|
+
/** default=10 */
|
2117
|
+
maxDistance?: number | undefined;
|
2118
|
+
/** default=true */
|
2119
|
+
showFeedback?: boolean | undefined;
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
/** the renderer will set this component to the root entity once per frame with all the events */
|
2123
|
+
declare interface PBPointerEventsResult {
|
2124
|
+
/** a list of the last N pointer commands (from the engine) */
|
2125
|
+
commands: PBPointerEventsResult_PointerCommand[];
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
/** this message represents a pointer event, used both for UP and DOWN actions */
|
2129
|
+
declare interface PBPointerEventsResult_PointerCommand {
|
2130
|
+
/** identifier of the input */
|
2131
|
+
button: ActionButton;
|
2132
|
+
hit: RaycastHit | undefined;
|
2133
|
+
state: PointerEventType;
|
2134
|
+
/** could be a Lamport timestamp */
|
2135
|
+
timestamp: number;
|
2136
|
+
/** if the input is analog then we store it here */
|
2137
|
+
analog?: number | undefined;
|
2138
|
+
}
|
2139
|
+
|
2075
2140
|
declare interface PBPointerLock {
|
2076
2141
|
isPointerLocked: boolean;
|
2077
2142
|
}
|
2078
2143
|
|
2144
|
+
declare interface PBRaycast {
|
2145
|
+
timestamp: number;
|
2146
|
+
origin: Vector3_2 | undefined;
|
2147
|
+
direction: Vector3_2 | undefined;
|
2148
|
+
maxDistance: number;
|
2149
|
+
queryType: RaycastQueryType;
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
declare interface PBRaycastResult {
|
2153
|
+
timestamp: number;
|
2154
|
+
origin: Vector3_2 | undefined;
|
2155
|
+
direction: Vector3_2 | undefined;
|
2156
|
+
hits: RaycastHit[];
|
2157
|
+
}
|
2158
|
+
|
2079
2159
|
declare interface PBSphereShape {
|
2080
2160
|
/** @deprecated use MeshCollider instead https://github.com/decentraland/sdk/issues/366 */
|
2081
2161
|
withCollisions?: boolean | undefined;
|
@@ -2127,6 +2207,67 @@ declare interface PBUiText {
|
|
2127
2207
|
textColor: Color3 | undefined;
|
2128
2208
|
}
|
2129
2209
|
|
2210
|
+
declare interface PBUiTransform {
|
2211
|
+
parent: number;
|
2212
|
+
rightOf: number;
|
2213
|
+
positionType: YGPositionType;
|
2214
|
+
alignContent: YGAlign;
|
2215
|
+
alignItems: YGAlign;
|
2216
|
+
alignSelf: YGAlign;
|
2217
|
+
flexDirection: YGFlexDirection;
|
2218
|
+
flexWrap: YGWrap;
|
2219
|
+
justifyContent: YGJustify;
|
2220
|
+
overflow: YGOverflow;
|
2221
|
+
display: YGDisplay;
|
2222
|
+
direction: YGDirection;
|
2223
|
+
flex: number;
|
2224
|
+
flexBasisUnit: YGUnit;
|
2225
|
+
flexBasis: number;
|
2226
|
+
flexGrow: number;
|
2227
|
+
flexShrink: number;
|
2228
|
+
widthUnit: YGUnit;
|
2229
|
+
width: number;
|
2230
|
+
heightUnit: YGUnit;
|
2231
|
+
height: number;
|
2232
|
+
minWidthUnit: YGUnit;
|
2233
|
+
minWidth: number;
|
2234
|
+
minHeightUnit: YGUnit;
|
2235
|
+
minHeight: number;
|
2236
|
+
maxWidthUnit: YGUnit;
|
2237
|
+
maxWidth: number;
|
2238
|
+
maxHeightUnit: YGUnit;
|
2239
|
+
maxHeight: number;
|
2240
|
+
positionLeftUnit: YGUnit;
|
2241
|
+
positionLeft: number;
|
2242
|
+
positionTopUnit: YGUnit;
|
2243
|
+
positionTop: number;
|
2244
|
+
positionRightUnit: YGUnit;
|
2245
|
+
positionRight: number;
|
2246
|
+
positionBottomUnit: YGUnit;
|
2247
|
+
positionBottom: number;
|
2248
|
+
/** margin */
|
2249
|
+
marginLeftUnit: YGUnit;
|
2250
|
+
marginLeft: number;
|
2251
|
+
marginTopUnit: YGUnit;
|
2252
|
+
marginTop: number;
|
2253
|
+
marginRightUnit: YGUnit;
|
2254
|
+
marginRight: number;
|
2255
|
+
marginBottomUnit: YGUnit;
|
2256
|
+
marginBottom: number;
|
2257
|
+
paddingLeftUnit: YGUnit;
|
2258
|
+
paddingLeft: number;
|
2259
|
+
paddingTopUnit: YGUnit;
|
2260
|
+
paddingTop: number;
|
2261
|
+
paddingRightUnit: YGUnit;
|
2262
|
+
paddingRight: number;
|
2263
|
+
paddingBottomUnit: YGUnit;
|
2264
|
+
paddingBottom: number;
|
2265
|
+
borderLeft: number;
|
2266
|
+
borderTop: number;
|
2267
|
+
borderRight: number;
|
2268
|
+
borderBottom: number;
|
2269
|
+
}
|
2270
|
+
|
2130
2271
|
declare interface PBVisibilityComponent {
|
2131
2272
|
/** default=true */
|
2132
2273
|
visible?: boolean | undefined;
|
@@ -2244,6 +2385,20 @@ declare namespace Plane {
|
|
2244
2385
|
/** @public */
|
2245
2386
|
export declare const PlaneShape: ComponentDefinition<ISchema<PBPlaneShape>, PBPlaneShape>;
|
2246
2387
|
|
2388
|
+
/** @public */
|
2389
|
+
export declare const PointerEvents: ComponentDefinition<ISchema<PBPointerEvents>, PBPointerEvents>;
|
2390
|
+
|
2391
|
+
/** @public */
|
2392
|
+
export declare const PointerEventsResult: ComponentDefinition<ISchema<PBPointerEventsResult>, PBPointerEventsResult>;
|
2393
|
+
|
2394
|
+
declare const enum PointerEventType {
|
2395
|
+
UP = 0,
|
2396
|
+
DOWN = 1,
|
2397
|
+
HOVER_ENTER = 2,
|
2398
|
+
HOVER_LEAVE = 3,
|
2399
|
+
UNRECOGNIZED = -1
|
2400
|
+
}
|
2401
|
+
|
2247
2402
|
/** @public */
|
2248
2403
|
export declare const PointerLock: ComponentDefinition<ISchema<PBPointerLock>, PBPointerLock>;
|
2249
2404
|
|
@@ -2258,13 +2413,13 @@ declare function preEngine(): {
|
|
2258
2413
|
addEntity: (dynamic?: boolean) => Entity;
|
2259
2414
|
addDynamicEntity: () => Entity;
|
2260
2415
|
removeEntity: (entity: Entity) => boolean;
|
2261
|
-
addSystem: (fn:
|
2416
|
+
addSystem: (fn: SystemFn, priority?: number, name?: string | undefined) => void;
|
2262
2417
|
getSystems: () => {
|
2263
|
-
fn:
|
2418
|
+
fn: SystemFn;
|
2264
2419
|
priority: number;
|
2265
2420
|
name?: string | undefined;
|
2266
2421
|
}[];
|
2267
|
-
removeSystem: (selector: string |
|
2422
|
+
removeSystem: (selector: string | SystemFn) => boolean;
|
2268
2423
|
defineComponent: <T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType | undefined) => ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
|
2269
2424
|
defineComponentFromSchema: <T_1 extends ISchema<any>, ConstructorType_1 = EcsResult<T_1>>(spec: T_1, componentId: number, constructorDefault?: ConstructorType_1 | undefined) => ComponentDefinition<T_1, ConstructorType_1>;
|
2270
2425
|
getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...ReadonlyComponentSchema<T_2>]>;
|
@@ -2442,6 +2597,29 @@ export declare namespace Quaternion {
|
|
2442
2597
|
*/
|
2443
2598
|
export declare const RAD2DEG: number;
|
2444
2599
|
|
2600
|
+
/** @public */
|
2601
|
+
export declare const Raycast: ComponentDefinition<ISchema<PBRaycast>, PBRaycast>;
|
2602
|
+
|
2603
|
+
/** Position will be relative to the scene */
|
2604
|
+
declare interface RaycastHit {
|
2605
|
+
position: Vector3_2 | undefined;
|
2606
|
+
origin: Vector3_2 | undefined;
|
2607
|
+
direction: Vector3_2 | undefined;
|
2608
|
+
normalHit: Vector3_2 | undefined;
|
2609
|
+
length: number;
|
2610
|
+
meshName?: string | undefined;
|
2611
|
+
entityId?: number | undefined;
|
2612
|
+
}
|
2613
|
+
|
2614
|
+
declare const enum RaycastQueryType {
|
2615
|
+
HIT_FIRST = 0,
|
2616
|
+
QUERY_ALL = 1,
|
2617
|
+
UNRECOGNIZED = -1
|
2618
|
+
}
|
2619
|
+
|
2620
|
+
/** @public */
|
2621
|
+
export declare const RaycastResult: ComponentDefinition<ISchema<PBRaycastResult>, PBRaycastResult>;
|
2622
|
+
|
2445
2623
|
/**
|
2446
2624
|
* @public
|
2447
2625
|
*/
|
@@ -2519,6 +2697,11 @@ export declare interface Spec {
|
|
2519
2697
|
/** @public */
|
2520
2698
|
export declare const SphereShape: ComponentDefinition<ISchema<PBSphereShape>, PBSphereShape>;
|
2521
2699
|
|
2700
|
+
/**
|
2701
|
+
* @public
|
2702
|
+
*/
|
2703
|
+
export declare type SystemFn = (dt: number) => void;
|
2704
|
+
|
2522
2705
|
/** @public */
|
2523
2706
|
export declare const TextShape: ComponentDefinition<ISchema<PBTextShape>, PBTextShape>;
|
2524
2707
|
|
@@ -2593,15 +2776,13 @@ declare type Uint32 = number;
|
|
2593
2776
|
/** @public */
|
2594
2777
|
export declare const UiText: ComponentDefinition<ISchema<PBUiText>, PBUiText>;
|
2595
2778
|
|
2596
|
-
/**
|
2597
|
-
|
2598
|
-
*/
|
2599
|
-
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
2779
|
+
/** @public */
|
2780
|
+
export declare const UiTransform: ComponentDefinition<ISchema<PBUiTransform>, PBUiTransform>;
|
2600
2781
|
|
2601
2782
|
/**
|
2602
2783
|
* @public
|
2603
2784
|
*/
|
2604
|
-
export declare type
|
2785
|
+
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
2605
2786
|
|
2606
2787
|
/**
|
2607
2788
|
* @public
|
@@ -2815,6 +2996,16 @@ declare interface Vector3_2 {
|
|
2815
2996
|
/** @public */
|
2816
2997
|
export declare const VisibilityComponent: ComponentDefinition<ISchema<PBVisibilityComponent>, PBVisibilityComponent>;
|
2817
2998
|
|
2999
|
+
/**
|
3000
|
+
* Check if an entity emitted a clicked event
|
3001
|
+
* @param entity the entity to query, for global clicks use `engine.RootEntity`
|
3002
|
+
* @param actionButton
|
3003
|
+
* @returns true if the entity was clicked in the last tick-update
|
3004
|
+
*/
|
3005
|
+
export declare function wasEntityClicked(entity: Entity, actionButton: ActionButton): boolean;
|
3006
|
+
|
3007
|
+
export declare function wasEntityClickedGenerator(engine: IEngine): (entity: Entity, actionButton: ActionButton) => boolean;
|
3008
|
+
|
2818
3009
|
declare namespace WireMessage {
|
2819
3010
|
enum Enum {
|
2820
3011
|
RESERVED = 0,
|
@@ -2839,4 +3030,76 @@ declare namespace WireMessage {
|
|
2839
3030
|
function readHeader(buf: ByteBuffer): Header | null;
|
2840
3031
|
}
|
2841
3032
|
|
3033
|
+
declare const enum YGAlign {
|
3034
|
+
YGAlignAuto = 0,
|
3035
|
+
YGAlignFlexStart = 1,
|
3036
|
+
YGAlignCenter = 2,
|
3037
|
+
YGAlignFlexEnd = 3,
|
3038
|
+
YGAlignStretch = 4,
|
3039
|
+
YGAlignBaseline = 5,
|
3040
|
+
YGAlignSpaceBetween = 6,
|
3041
|
+
YGAlignSpaceAround = 7,
|
3042
|
+
UNRECOGNIZED = -1
|
3043
|
+
}
|
3044
|
+
|
3045
|
+
declare const enum YGDirection {
|
3046
|
+
YGDirectionInherit = 0,
|
3047
|
+
YGDirectionLTR = 1,
|
3048
|
+
YGDirectionRTL = 2,
|
3049
|
+
UNRECOGNIZED = -1
|
3050
|
+
}
|
3051
|
+
|
3052
|
+
declare const enum YGDisplay {
|
3053
|
+
YGDisplayFlex = 0,
|
3054
|
+
YGDisplayNone = 1,
|
3055
|
+
UNRECOGNIZED = -1
|
3056
|
+
}
|
3057
|
+
|
3058
|
+
declare const enum YGFlexDirection {
|
3059
|
+
YGFlexDirectionColumn = 0,
|
3060
|
+
YGFlexDirectionColumnReverse = 1,
|
3061
|
+
YGFlexDirectionRow = 2,
|
3062
|
+
YGFlexDirectionRowReverse = 3,
|
3063
|
+
UNRECOGNIZED = -1
|
3064
|
+
}
|
3065
|
+
|
3066
|
+
declare const enum YGJustify {
|
3067
|
+
YGJustifyFlexStart = 0,
|
3068
|
+
YGJustifyCenter = 1,
|
3069
|
+
YGJustifyFlexEnd = 2,
|
3070
|
+
YGJustifySpaceBetween = 3,
|
3071
|
+
YGJustifySpaceAround = 4,
|
3072
|
+
YGJustifySpaceEvenly = 5,
|
3073
|
+
UNRECOGNIZED = -1
|
3074
|
+
}
|
3075
|
+
|
3076
|
+
declare const enum YGOverflow {
|
3077
|
+
YGOverflowVisible = 0,
|
3078
|
+
YGOverflowHidden = 1,
|
3079
|
+
YGOverflowScroll = 2,
|
3080
|
+
UNRECOGNIZED = -1
|
3081
|
+
}
|
3082
|
+
|
3083
|
+
declare const enum YGPositionType {
|
3084
|
+
YGPositionTypeStatic = 0,
|
3085
|
+
YGPositionTypeRelative = 1,
|
3086
|
+
YGPositionTypeAbsolute = 2,
|
3087
|
+
UNRECOGNIZED = -1
|
3088
|
+
}
|
3089
|
+
|
3090
|
+
declare const enum YGUnit {
|
3091
|
+
YGUnitUndefined = 0,
|
3092
|
+
YGUnitPoint = 1,
|
3093
|
+
YGUnitPercent = 2,
|
3094
|
+
YGUnitAuto = 3,
|
3095
|
+
UNRECOGNIZED = -1
|
3096
|
+
}
|
3097
|
+
|
3098
|
+
declare const enum YGWrap {
|
3099
|
+
YGWrapNoWrap = 0,
|
3100
|
+
YGWrapWrap = 1,
|
3101
|
+
YGWrapWrapReverse = 2,
|
3102
|
+
UNRECOGNIZED = -1
|
3103
|
+
}
|
3104
|
+
|
2842
3105
|
export { }
|