@dcl/playground-assets 7.0.6-3939099974.commit-727d673 → 7.0.6-3987590195.commit-4fc1536

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/alpha.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import _m0 from 'protobufjs/minimal';
2
2
 
3
+ /**
4
+ * @public
5
+ */
6
+ export declare type AlignType = 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline' | 'space-between' | 'space-around';
7
+
3
8
  export declare const AMOUNT_VERSION_AVAILABLE: number;
4
9
 
5
10
  export declare const Animator: AnimatorComponentDefinitionExtended;
@@ -990,7 +995,8 @@ export declare type CommonProps = {
990
995
  * @public
991
996
  */
992
997
  export declare type ComponentDefinition<T> = {
993
- _id: number;
998
+ readonly componentId: number;
999
+ readonly componentName: string;
994
1000
  /**
995
1001
  * Return the default value of the current component
996
1002
  */
@@ -1107,6 +1113,8 @@ export declare enum CrdtMessageType {
1107
1113
  MAX_MESSAGE_TYPE = 4
1108
1114
  }
1109
1115
 
1116
+ export declare function createComponentDefinitionFromSchema<T>(componentName: string, componentId: number, schema: ISchema<T>): ComponentDefinition<T>;
1117
+
1110
1118
  export declare function createEthereumProvider(): {
1111
1119
  send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
1112
1120
  sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
@@ -1192,8 +1200,6 @@ export declare type DeepReadonlyObject<T> = {
1192
1200
  */
1193
1201
  export declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
1194
1202
 
1195
- export declare function defineComponent<T>(componentId: number, spec: ISchema<T>): ComponentDefinition<T>;
1196
-
1197
1203
  /**
1198
1204
  * Constant used to convert from Euler degrees to radians
1199
1205
  * @public
@@ -1234,6 +1240,11 @@ export declare type DeleteEntityMessageBody = {
1234
1240
  entityId: Entity;
1235
1241
  };
1236
1242
 
1243
+ /**
1244
+ * @public
1245
+ */
1246
+ export declare type DisplayType = 'flex' | 'none';
1247
+
1237
1248
  /**
1238
1249
  * @public
1239
1250
  */
@@ -1356,6 +1367,16 @@ export declare type ExcludeUndefined<T> = {
1356
1367
  */
1357
1368
  export declare const executeTask: (task: Task<unknown>) => void;
1358
1369
 
1370
+ /**
1371
+ * @public
1372
+ */
1373
+ export declare type FlexDirectionType = 'row' | 'column' | 'column-reverse' | 'row-reverse';
1374
+
1375
+ /**
1376
+ * @public
1377
+ */
1378
+ export declare type FlexWrapType = 'wrap' | 'nowrap' | 'wrap-reverse';
1379
+
1359
1380
  /** @public */
1360
1381
  export declare type FloatArray = number[];
1361
1382
 
@@ -1445,42 +1466,40 @@ export declare type IEngine = {
1445
1466
  removeSystem(selector: string | SystemFn): boolean;
1446
1467
  /**
1447
1468
  * Registers a custom component definition.
1448
- * @param component - The component definition
1449
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1469
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1470
+ * @param componentDefinition - The component definition
1450
1471
  */
1451
- registerCustomComponent<T>(component: ComponentDefinition<T>, componentId: number): ComponentDefinition<T>;
1472
+ registerComponentDefinition<T>(componentName: string, componentDefinition: ComponentDefinition<T>): ComponentDefinition<T>;
1452
1473
  /**
1453
1474
  * Define a component and add it to the engine.
1454
1475
  * @param spec - An object with schema fields
1455
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1476
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1456
1477
  * @param constructorDefault - the initial value prefilled when a component is created without a value
1457
1478
  * @returns The component definition
1458
1479
  *
1459
1480
  * ```ts
1460
- * const DoorComponentId = 10017
1461
- * const Door = engine.defineComponent({
1481
+ * const Door = engine.defineComponent("my-scene::Door", {
1462
1482
  * id: Schemas.Int,
1463
1483
  * name: Schemas.String
1464
- * }, DoorComponentId)
1465
- *
1484
+ * })
1466
1485
  * ```
1467
1486
  */
1468
- defineComponent<T extends Spec>(spec: T, componentId: number, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1487
+ defineComponent<T extends Spec>(componentName: string, spec: T, constructorDefault?: Partial<MapResult<T>>): MapComponentDefinition<MapResult<T>>;
1469
1488
  /**
1470
1489
  * Define a component and add it to the engine.
1490
+ * @param componentName - unique name to identify the component, a hash is calculated for it, it will fail if the hash has collisions.
1471
1491
  * @param spec - An object with schema fields
1472
- * @param componentId - unique id to identify the component, if the component id already exist, it will fail.
1473
1492
  * @returns The component definition
1474
1493
  *
1475
1494
  * ```ts
1476
1495
  * const StateComponentId = 10023
1477
- * const StateComponent = engine.defineComponent(Schemas.Bool, VisibleComponentId)
1496
+ * const StateComponent = engine.defineComponentFromSchema("my-lib::VisibleComponent", Schemas.Bool)
1478
1497
  * ```
1479
1498
  */
1480
- defineComponentFromSchema<T>(spec: ISchema<T>, componentId: number): ComponentDefinition<T>;
1499
+ defineComponentFromSchema<T>(componentName: string, spec: ISchema<T>): ComponentDefinition<T>;
1481
1500
  /**
1482
1501
  * Get the component definition from the component id.
1483
- * @param componentId - component number used to identify the component descriptor
1502
+ * @param componentId - component number or name used to identify the component descriptor
1484
1503
  * @returns the component definition, throw an error if it doesn't exist
1485
1504
  * ```ts
1486
1505
  * const StateComponentId = 10023
@@ -1490,7 +1509,7 @@ export declare type IEngine = {
1490
1509
  getComponent<T>(componentId: number): ComponentDefinition<T>;
1491
1510
  /**
1492
1511
  * Get the component definition from the component id.
1493
- * @param componentId - component number used to identify the component descriptor
1512
+ * @param componentId - component number or name used to identify the component descriptor
1494
1513
  * @returns the component definition or null if its not founded
1495
1514
  * ```ts
1496
1515
  * const StateComponentId = 10023
@@ -1542,6 +1561,11 @@ export declare type IEngine = {
1542
1561
  * Iterator of registered components
1543
1562
  */
1544
1563
  componentsIter(): Iterable<ComponentDefinition<unknown>>;
1564
+ /**
1565
+ * Seals the engine components. It is used to clearly define the scope of the
1566
+ * components that will be available to this engine and to run optimizations.
1567
+ */
1568
+ seal(): void;
1545
1569
  };
1546
1570
 
1547
1571
  /**
@@ -1794,12 +1818,17 @@ export declare namespace JSX {
1794
1818
  }
1795
1819
  }
1796
1820
 
1821
+ /**
1822
+ * @public
1823
+ */
1824
+ export declare type JustifyType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
1825
+
1797
1826
  export declare type Key = number | string;
1798
1827
 
1799
1828
  /**
1800
1829
  * @public
1801
1830
  */
1802
- export declare function Label(props: EntityPropTypes & UiTextProps): ReactEcs.JSX.Element;
1831
+ export declare function Label(props: EntityPropTypes & UiLabelProps): ReactEcs.JSX.Element;
1803
1832
 
1804
1833
  export declare type Listeners = {
1805
1834
  onMouseDown?: Callback;
@@ -2837,6 +2866,8 @@ export declare const onRealmChangedObservable: Observable<{
2837
2866
 
2838
2867
  export declare const onSceneReadyObservable: Observable<unknown>;
2839
2868
 
2869
+ export declare function onStart(): Promise<void>;
2870
+
2840
2871
  export declare function onUpdate(deltaTime: number): Promise<void>;
2841
2872
 
2842
2873
  export declare const onVideoEvent: Observable<{
@@ -2847,6 +2878,11 @@ export declare const onVideoEvent: Observable<{
2847
2878
  totalVideoLength: number;
2848
2879
  }>;
2849
2880
 
2881
+ /**
2882
+ * @public
2883
+ */
2884
+ export declare type OverflowType = 'hidden' | 'scroll' | 'visible';
2885
+
2850
2886
  export declare interface PBAnimationState {
2851
2887
  name: string;
2852
2888
  clip: string;
@@ -3875,6 +3911,11 @@ export declare type Position = {
3875
3911
  left: PositionUnit;
3876
3912
  };
3877
3913
 
3914
+ /**
3915
+ * @public
3916
+ */
3917
+ export declare type PositionType = 'absolute' | 'relative';
3918
+
3878
3919
  export declare type PositionUnit = `${number}px` | `${number}%` | number;
3879
3920
 
3880
3921
  export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
@@ -4499,6 +4540,11 @@ export declare const enum TextAlignMode {
4499
4540
  TAM_BOTTOM_RIGHT = 8
4500
4541
  }
4501
4542
 
4543
+ /**
4544
+ * @public
4545
+ */
4546
+ export declare type TextAlignType = 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'middle-center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
4547
+
4502
4548
  /** @public */
4503
4549
  export declare const TextShape: ComponentDefinition<PBTextShape>;
4504
4550
 
@@ -4524,6 +4570,11 @@ export declare const enum TextureFilterMode {
4524
4570
  TFM_TRILINEAR = 2
4525
4571
  }
4526
4572
 
4573
+ /**
4574
+ * @public
4575
+ */
4576
+ export declare type TextureFilterType = 'point' | 'bi-linear' | 'tri-linear';
4577
+
4527
4578
  /**
4528
4579
  * @public
4529
4580
  */
@@ -4538,6 +4589,22 @@ export declare type TextureHelper = {
4538
4589
  Avatar: (avatarTexture: AvatarTexture) => TextureUnion;
4539
4590
  };
4540
4591
 
4592
+ /**
4593
+ * @public
4594
+ * NINE_SLICES - https://docs.unity3d.com/Manual/UIE-USS-SupportedProperties.html (Slicing section)
4595
+ * https://forum.unity.com/threads/how-does-slicing-in-ui-tookkit-works.1235863/
4596
+ * https://docs.unity3d.com/Manual/9SliceSprites.html
4597
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/border-image-slice
4598
+
4599
+ * CENTER - CENTER enables the texture to be rendered centered in relation to the
4600
+ * element. If the element is smaller than the texture then the background
4601
+ * should use the element as stencil to cut off the out-of-bounds area
4602
+
4603
+ * STRETCH - STRETCH enables the texture to cover all the area of the container,
4604
+ * adopting its aspect ratio.
4605
+ */
4606
+ export declare type TextureMode = 'nine-slices' | 'center' | 'stretch';
4607
+
4541
4608
  export declare interface TextureUnion {
4542
4609
  tex?: {
4543
4610
  $case: "texture";
@@ -4563,6 +4630,11 @@ export declare const enum TextureWrapMode {
4563
4630
  TWM_MIRROR_ONCE = 3
4564
4631
  }
4565
4632
 
4633
+ /**
4634
+ * @public
4635
+ */
4636
+ export declare type TextureWrapType = 'repeat' | 'clamp' | 'mirror' | 'mirror-once';
4637
+
4566
4638
  /**
4567
4639
  * Constant used to convert a value to gamma space
4568
4640
  * @public
@@ -4632,7 +4704,11 @@ export declare type TransportMessage = Omit<ReceiveMessage, 'data'>;
4632
4704
  * @public
4633
4705
  */
4634
4706
  export declare type UiAvatarTexture = {
4635
- avatarTexture?: AvatarTexture;
4707
+ avatarTexture?: {
4708
+ userId: string;
4709
+ wrapMode?: TextureWrapType;
4710
+ filterMode?: TextureFilterType;
4711
+ };
4636
4712
  };
4637
4713
 
4638
4714
  /** @public */
@@ -4641,12 +4717,17 @@ export declare const UiBackground: ComponentDefinition<PBUiBackground>;
4641
4717
  /**
4642
4718
  * @public
4643
4719
  */
4644
- export declare type UiBackgroundProps = Partial<Omit<PBUiBackground, 'texture'>> & UiTextureUnion;
4720
+ export declare type UiBackgroundProps = {
4721
+ color?: PBColor4 | undefined;
4722
+ textureMode?: TextureMode;
4723
+ textureSlices?: BorderRect | undefined;
4724
+ uvs?: number[];
4725
+ } & UiTextureUnion;
4645
4726
 
4646
4727
  /**
4647
4728
  * @public
4648
4729
  */
4649
- export declare type UiButtonProps = PBUiText & {
4730
+ export declare type UiButtonProps = UiLabelProps & {
4650
4731
  type?: 'primary' | 'secondary';
4651
4732
  };
4652
4733
 
@@ -4658,8 +4739,10 @@ export declare const UiDropdown: ComponentDefinition<PBUiDropdown>;
4658
4739
  /**
4659
4740
  * @public
4660
4741
  */
4661
- export declare type UiDropdownProps = Partial<PBUiDropdown> & {
4742
+ export declare type UiDropdownProps = Partial<Omit<PBUiDropdown, 'textAlign' | 'font'>> & {
4662
4743
  onChange?(value: number): void;
4744
+ font?: UiFontType;
4745
+ textAlign?: TextAlignType;
4663
4746
  };
4664
4747
 
4665
4748
  /** @public */
@@ -4670,19 +4753,36 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
4670
4753
  */
4671
4754
  export declare function UiEntity(props: EntityPropTypes & Partial<CommonProps>): ReactEcs.JSX.Element;
4672
4755
 
4756
+ /**
4757
+ * @public
4758
+ */
4759
+ export declare type UiFontType = 'sans-serif' | 'serif' | 'monospace';
4760
+
4673
4761
  /** @public */
4674
4762
  export declare const UiInput: ComponentDefinition<PBUiInput>;
4675
4763
 
4676
4764
  /**
4677
4765
  * @public
4678
4766
  */
4679
- export declare type UiInputProps = PBUiInput & {
4767
+ export declare type UiInputProps = Omit<PBUiInput, 'font' | 'textAlign'> & {
4680
4768
  onChange?(value: string): void;
4769
+ font?: UiFontType;
4770
+ textAlign?: TextAlignType;
4681
4771
  };
4682
4772
 
4683
4773
  /** @public */
4684
4774
  export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
4685
4775
 
4776
+ /**
4777
+ * @public
4778
+ */
4779
+ export declare type UiLabelProps = Omit<PBUiText, 'textAlign' | 'font'> & {
4780
+ /** default='middle-center' */
4781
+ textAlign?: TextAlignType | undefined;
4782
+ /** default='sans-serif' */
4783
+ font?: UiFontType | undefined;
4784
+ };
4785
+
4686
4786
  export declare type Uint32 = number;
4687
4787
 
4688
4788
  /**
@@ -4693,16 +4793,15 @@ export declare type uint32 = number;
4693
4793
  /** @public */
4694
4794
  export declare const UiText: ComponentDefinition<PBUiText>;
4695
4795
 
4696
- /**
4697
- * @public
4698
- */
4699
- export declare type UiTextProps = PBUiText;
4700
-
4701
4796
  /**
4702
4797
  * @public
4703
4798
  */
4704
4799
  export declare type UiTexture = {
4705
- texture?: Texture;
4800
+ texture?: {
4801
+ src: string;
4802
+ wrapMode?: TextureWrapType;
4803
+ filterMode?: TextureFilterType;
4804
+ };
4706
4805
  };
4707
4806
 
4708
4807
  /**
@@ -4717,14 +4816,14 @@ export declare const UiTransform: ComponentDefinition<PBUiTransform>;
4717
4816
  * @public
4718
4817
  */
4719
4818
  export declare interface UiTransformProps {
4720
- display?: YGDisplay;
4819
+ display?: DisplayType;
4721
4820
  flex?: number;
4722
- justifyContent?: YGJustify;
4723
- positionType?: YGPositionType;
4724
- alignItems?: YGAlign;
4725
- alignSelf?: YGAlign;
4726
- alignContent?: YGAlign;
4727
- flexDirection?: YGFlexDirection;
4821
+ justifyContent?: JustifyType;
4822
+ positionType?: PositionType;
4823
+ alignItems?: AlignType;
4824
+ alignSelf?: AlignType;
4825
+ alignContent?: AlignType;
4826
+ flexDirection?: FlexDirectionType;
4728
4827
  position?: Partial<Position>;
4729
4828
  padding?: Partial<Position>;
4730
4829
  margin?: Partial<Position>;
@@ -4734,11 +4833,11 @@ export declare interface UiTransformProps {
4734
4833
  maxWidth?: PositionUnit;
4735
4834
  minHeight?: PositionUnit;
4736
4835
  maxHeight?: PositionUnit;
4737
- flexWrap?: YGWrap;
4836
+ flexWrap?: FlexWrapType;
4738
4837
  flexBasis?: number;
4739
4838
  flexGrow?: number;
4740
4839
  flexShrink?: number;
4741
- overflow?: YGOverflow;
4840
+ overflow?: OverflowType;
4742
4841
  }
4743
4842
 
4744
4843
  /**