@dcl/playground-assets 7.0.6-4153633895.commit-4aad233 → 7.0.6-4177592674.commit-39cdc99

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
@@ -3767,6 +3767,20 @@ export declare interface Position {
3767
3767
  left: PositionUnit;
3768
3768
  }
3769
3769
 
3770
+ /**
3771
+ * The values are in clockwise order, beginning at the top: top, right, bottom, then left
3772
+
3773
+ * When one value is specified, it applies the same margin to all four sides.
3774
+ *
3775
+ * When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
3776
+ *
3777
+ * When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
3778
+ *
3779
+ When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
3780
+ * @public
3781
+ */
3782
+ export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
3783
+
3770
3784
  /**
3771
3785
  * @public
3772
3786
  * The position property specifies the type of positioning method used for an element
@@ -3774,11 +3788,10 @@ export declare interface Position {
3774
3788
  export declare type PositionType = 'absolute' | 'relative';
3775
3789
 
3776
3790
  /**
3777
- * Position unit for the user.
3778
- * i.e. width="100", width="100%", width="100px"
3791
+ * unit value specified. i.e. 1 || '100%' || '1px'
3779
3792
  * @public
3780
3793
  */
3781
- export declare type PositionUnit = `${number}px` | `${number}%` | number;
3794
+ export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
3782
3795
 
3783
3796
  export declare enum ProcessMessageResultType {
3784
3797
  /**
@@ -4725,7 +4738,9 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
4725
4738
  * @public
4726
4739
  * @category Component
4727
4740
  */
4728
- export declare function UiEntity(props: EntityPropTypes): ReactEcs.JSX.Element;
4741
+ export declare function UiEntity(props: EntityPropTypes & {
4742
+ uiText?: UiLabelProps;
4743
+ }): ReactEcs.JSX.Element;
4729
4744
 
4730
4745
  /**
4731
4746
  * @public
@@ -4808,11 +4823,11 @@ export declare interface UiTransformProps {
4808
4823
  /** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
4809
4824
  flexDirection?: FlexDirectionType;
4810
4825
  /** 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. */
4811
- position?: Partial<Position>;
4826
+ position?: Partial<Position> | PositionShorthand;
4812
4827
  /** The padding shorthand property sets the padding area on all four sides of an element at once. */
4813
- padding?: Partial<Position>;
4828
+ padding?: Partial<Position> | PositionShorthand;
4814
4829
  /** The margin shorthand property sets the margin area on all four sides of an element. */
4815
- margin?: Partial<Position>;
4830
+ margin?: Partial<Position> | PositionShorthand;
4816
4831
  /** The width property specifies the width of an element. */
4817
4832
  width?: PositionUnit;
4818
4833
  /** The height property specifies the height of an element. */
package/dist/beta.d.ts CHANGED
@@ -3763,6 +3763,20 @@ export declare interface Position {
3763
3763
  left: PositionUnit;
3764
3764
  }
3765
3765
 
3766
+ /**
3767
+ * The values are in clockwise order, beginning at the top: top, right, bottom, then left
3768
+
3769
+ * When one value is specified, it applies the same margin to all four sides.
3770
+ *
3771
+ * When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
3772
+ *
3773
+ * When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
3774
+ *
3775
+ When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
3776
+ * @public
3777
+ */
3778
+ export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
3779
+
3766
3780
  /**
3767
3781
  * @public
3768
3782
  * The position property specifies the type of positioning method used for an element
@@ -3770,11 +3784,10 @@ export declare interface Position {
3770
3784
  export declare type PositionType = 'absolute' | 'relative';
3771
3785
 
3772
3786
  /**
3773
- * Position unit for the user.
3774
- * i.e. width="100", width="100%", width="100px"
3787
+ * unit value specified. i.e. 1 || '100%' || '1px'
3775
3788
  * @public
3776
3789
  */
3777
- export declare type PositionUnit = `${number}px` | `${number}%` | number;
3790
+ export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
3778
3791
 
3779
3792
  export declare enum ProcessMessageResultType {
3780
3793
  /**
@@ -4721,7 +4734,9 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
4721
4734
  * @public
4722
4735
  * @category Component
4723
4736
  */
4724
- export declare function UiEntity(props: EntityPropTypes): ReactEcs.JSX.Element;
4737
+ export declare function UiEntity(props: EntityPropTypes & {
4738
+ uiText?: UiLabelProps;
4739
+ }): ReactEcs.JSX.Element;
4725
4740
 
4726
4741
  /**
4727
4742
  * @public
@@ -4804,11 +4819,11 @@ export declare interface UiTransformProps {
4804
4819
  /** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
4805
4820
  flexDirection?: FlexDirectionType;
4806
4821
  /** 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. */
4807
- position?: Partial<Position>;
4822
+ position?: Partial<Position> | PositionShorthand;
4808
4823
  /** The padding shorthand property sets the padding area on all four sides of an element at once. */
4809
- padding?: Partial<Position>;
4824
+ padding?: Partial<Position> | PositionShorthand;
4810
4825
  /** The margin shorthand property sets the margin area on all four sides of an element. */
4811
- margin?: Partial<Position>;
4826
+ margin?: Partial<Position> | PositionShorthand;
4812
4827
  /** The width property specifies the width of an element. */
4813
4828
  width?: PositionUnit;
4814
4829
  /** The height property specifies the height of an element. */
@@ -3763,6 +3763,20 @@ export declare interface Position {
3763
3763
  left: PositionUnit;
3764
3764
  }
3765
3765
 
3766
+ /**
3767
+ * The values are in clockwise order, beginning at the top: top, right, bottom, then left
3768
+
3769
+ * When one value is specified, it applies the same margin to all four sides.
3770
+ *
3771
+ * When two values are specified, the first margin applies to the top and bottom, the second to the left and right.
3772
+ *
3773
+ * When three values are specified, the first margin applies to the top, the second to the left and right, the third to the bottom.
3774
+ *
3775
+ When four values are specified, the margins apply to the top, right, bottom, and left in that order (clockwise).
3776
+ * @public
3777
+ */
3778
+ export declare type PositionShorthand = PositionUnit | `${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit}` | `${PositionUnit} ${PositionUnit} ${PositionUnit} ${PositionUnit}`;
3779
+
3766
3780
  /**
3767
3781
  * @public
3768
3782
  * The position property specifies the type of positioning method used for an element
@@ -3770,11 +3784,10 @@ export declare interface Position {
3770
3784
  export declare type PositionType = 'absolute' | 'relative';
3771
3785
 
3772
3786
  /**
3773
- * Position unit for the user.
3774
- * i.e. width="100", width="100%", width="100px"
3787
+ * unit value specified. i.e. 1 || '100%' || '1px'
3775
3788
  * @public
3776
3789
  */
3777
- export declare type PositionUnit = `${number}px` | `${number}%` | number;
3790
+ export declare type PositionUnit = `${number}px` | `${number}%` | number | `${number}`;
3778
3791
 
3779
3792
  export declare enum ProcessMessageResultType {
3780
3793
  /**
@@ -4721,7 +4734,9 @@ export declare const UiDropdownResult: ComponentDefinition<PBUiDropdownResult>;
4721
4734
  * @public
4722
4735
  * @category Component
4723
4736
  */
4724
- export declare function UiEntity(props: EntityPropTypes): ReactEcs.JSX.Element;
4737
+ export declare function UiEntity(props: EntityPropTypes & {
4738
+ uiText?: UiLabelProps;
4739
+ }): ReactEcs.JSX.Element;
4725
4740
 
4726
4741
  /**
4727
4742
  * @public
@@ -4804,11 +4819,11 @@ export declare interface UiTransformProps {
4804
4819
  /** The flex-direction property sets how flex items are placed in the flex container defining the main axis and the direction (normal or reversed). */
4805
4820
  flexDirection?: FlexDirectionType;
4806
4821
  /** 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. */
4807
- position?: Partial<Position>;
4822
+ position?: Partial<Position> | PositionShorthand;
4808
4823
  /** The padding shorthand property sets the padding area on all four sides of an element at once. */
4809
- padding?: Partial<Position>;
4824
+ padding?: Partial<Position> | PositionShorthand;
4810
4825
  /** The margin shorthand property sets the margin area on all four sides of an element. */
4811
- margin?: Partial<Position>;
4826
+ margin?: Partial<Position> | PositionShorthand;
4812
4827
  /** The width property specifies the width of an element. */
4813
4828
  width?: PositionUnit;
4814
4829
  /** The height property specifies the height of an element. */
package/dist/index.js CHANGED
@@ -40862,6 +40862,39 @@
40862
40862
  var reactReconcilerExports = requireReactReconciler();
40863
40863
  var Reconciler = /*@__PURE__*/getDefaultExportFromCjs(reactReconcilerExports);
40864
40864
 
40865
+ const parseFont = {
40866
+ 'sans-serif': 0 /* Font.F_SANS_SERIF */,
40867
+ serif: 1 /* Font.F_SERIF */,
40868
+ monospace: 2 /* Font.F_MONOSPACE */
40869
+ };
40870
+ /**
40871
+ * @internal
40872
+ */
40873
+ function getFont(font) {
40874
+ if (!font)
40875
+ return undefined;
40876
+ return { font: parseFont[font] };
40877
+ }
40878
+ const parseTextAlign = {
40879
+ 'top-left': 0 /* TextAlignMode.TAM_TOP_LEFT */,
40880
+ 'top-center': 1 /* TextAlignMode.TAM_TOP_CENTER */,
40881
+ 'top-right': 2 /* TextAlignMode.TAM_TOP_RIGHT */,
40882
+ 'middle-left': 3 /* TextAlignMode.TAM_MIDDLE_LEFT */,
40883
+ 'middle-center': 4 /* TextAlignMode.TAM_MIDDLE_CENTER */,
40884
+ 'middle-right': 5 /* TextAlignMode.TAM_MIDDLE_RIGHT */,
40885
+ 'bottom-left': 6 /* TextAlignMode.TAM_BOTTOM_LEFT */,
40886
+ 'bottom-center': 7 /* TextAlignMode.TAM_BOTTOM_CENTER */,
40887
+ 'bottom-right': 8 /* TextAlignMode.TAM_BOTTOM_RIGHT */
40888
+ };
40889
+ /**
40890
+ * @internal
40891
+ */
40892
+ function getTextAlign(textAlign) {
40893
+ if (!textAlign)
40894
+ return undefined;
40895
+ return { textAlign: parseTextAlign[textAlign] };
40896
+ }
40897
+
40865
40898
  const parseTextureMode = {
40866
40899
  'nine-slices': 0 /* BackgroundTextureMode.NINE_SLICES */,
40867
40900
  center: 1 /* BackgroundTextureMode.CENTER */,
@@ -40947,7 +40980,7 @@
40947
40980
  if (val === undefined || val === null) {
40948
40981
  return [undefined, 0 /* YGUnit.YGU_UNDEFINED */];
40949
40982
  }
40950
- if (typeof val === 'number') {
40983
+ if (typeof val === 'number' || (typeof val === 'string' && !isNaN(Number(val)))) {
40951
40984
  return [Number(val), 1 /* YGUnit.YGU_POINT */];
40952
40985
  }
40953
40986
  if (isPercent(val)) {
@@ -40958,20 +40991,39 @@
40958
40991
  }
40959
40992
  return [undefined, 0 /* YGUnit.YGU_UNDEFINED */];
40960
40993
  }
40961
- // position: { top: '1px' } => { positionTop: 1, positionTopUnit: YGUnit.YGU_Point }
40962
40994
  function parsePosition(position = {}, prop) {
40963
- const obj = {};
40964
- for (const key in position) {
40965
- const typedKey = key;
40966
- const propKey = `${prop}${capitalize(typedKey)}`;
40967
- const propKeyUnit = `${prop}${capitalize(typedKey)}Unit`;
40968
- const [value, unit] = parsePositionUnit(position[typedKey]);
40969
- if (value === undefined)
40970
- continue;
40971
- obj[propKeyUnit] = unit;
40972
- obj[propKey] = value;
40973
- }
40974
- return obj;
40995
+ if (typeof position === 'object') {
40996
+ const obj = {};
40997
+ for (const key in position) {
40998
+ const typedKey = key;
40999
+ const propKey = `${prop}${capitalize(typedKey)}`;
41000
+ const propKeyUnit = `${prop}${capitalize(typedKey)}Unit`;
41001
+ const [value, unit] = parsePositionUnit(position[typedKey]);
41002
+ if (value === undefined)
41003
+ continue;
41004
+ obj[propKeyUnit] = unit;
41005
+ obj[propKey] = value;
41006
+ }
41007
+ return obj;
41008
+ }
41009
+ if (typeof position === 'number') {
41010
+ return parsePosition({ top: position, left: position, right: position, bottom: position }, prop);
41011
+ }
41012
+ const values = position.split(' ').filter((a) => a !== '');
41013
+ if (values.length === 1) {
41014
+ const [value] = values;
41015
+ return parsePosition({ top: value, left: value, right: value, bottom: value }, prop);
41016
+ }
41017
+ if (values.length === 2) {
41018
+ const [topBottom, rigthLeft] = values;
41019
+ return parsePosition({ top: topBottom, left: rigthLeft, right: rigthLeft, bottom: topBottom }, prop);
41020
+ }
41021
+ if (values.length === 3) {
41022
+ const [top, rigthLeft, bottom] = values;
41023
+ return parsePosition({ top, left: rigthLeft, right: rigthLeft, bottom }, prop);
41024
+ }
41025
+ const [top, right, bottom, left] = values;
41026
+ return parsePosition({ top, right, bottom, left }, prop);
40975
41027
  }
40976
41028
  function parseSize(val, key) {
40977
41029
  const unitKey = `${key}Unit`;
@@ -41012,8 +41064,8 @@
41012
41064
  /**
41013
41065
  * @internal
41014
41066
  */
41015
- function getAlign(prop, align, defaultValue) {
41016
- const value = align ? parseAligns[align] : defaultValue;
41067
+ function getAlign(prop, align) {
41068
+ const value = parseAligns[align];
41017
41069
  return { [prop]: value };
41018
41070
  }
41019
41071
  const parseAligns = {
@@ -41043,7 +41095,7 @@
41043
41095
  * @internal
41044
41096
  */
41045
41097
  function getFlexWrap(flexWrap) {
41046
- const value = flexWrap ? parseFlexWrap[flexWrap] : 1 /* YGWrap.YGW_WRAP */;
41098
+ const value = parseFlexWrap[flexWrap];
41047
41099
  return { flexWrap: value };
41048
41100
  }
41049
41101
  const parseFlexWrap = {
@@ -41080,6 +41132,12 @@
41080
41132
  */
41081
41133
  const CANVAS_ROOT_ENTITY = 0;
41082
41134
  const defaultUiTransform = {
41135
+ overflow: 0 /* YGOverflow.YGO_VISIBLE */,
41136
+ display: 0 /* YGDisplay.YGD_FLEX */,
41137
+ justifyContent: 0 /* YGJustify.YGJ_FLEX_START */,
41138
+ alignSelf: 0 /* YGAlign.YGA_AUTO */,
41139
+ flexDirection: 0 /* YGFlexDirection.YGFD_ROW */,
41140
+ positionType: 0 /* YGPositionType.YGPT_RELATIVE */,
41083
41141
  parent: CANVAS_ROOT_ENTITY,
41084
41142
  rightOf: 0,
41085
41143
  flexBasis: 0,
@@ -41127,7 +41185,7 @@
41127
41185
  */
41128
41186
 
41129
41187
  function parseUiTransform(props = {}) {
41130
- const { height, minHeight, maxHeight, width, minWidth, maxWidth, ...otherProps } = props;
41188
+ const { height, minHeight, maxHeight, width, minWidth, maxWidth, alignItems, alignContent, flexWrap, ...otherProps } = props;
41131
41189
  return {
41132
41190
  ...defaultUiTransform,
41133
41191
  ...otherProps,
@@ -41141,14 +41199,15 @@
41141
41199
  ...parseSize(props.minWidth, 'minWidth'),
41142
41200
  ...parseSize(props.maxWidth, 'maxWidth'),
41143
41201
  ...getDisplay(props.display),
41144
- ...getAlign('alignContent', props.alignContent, 1 /* YGAlign.YGA_FLEX_START */),
41145
- ...getAlign('alignSelf', props.alignSelf, 1 /* YGAlign.YGA_FLEX_START */),
41146
- ...getAlign('alignItems', props.alignItems, 1 /* YGAlign.YGA_FLEX_START */),
41202
+ ...getAlign('alignSelf', props.alignSelf ?? 'auto'),
41147
41203
  ...getJustify(props.justifyContent),
41148
41204
  ...getFlexDirection(props.flexDirection),
41149
- ...getFlexWrap(props.flexWrap),
41150
41205
  ...getOverflow(props.overflow),
41151
- ...getPoistionType(props.positionType)
41206
+ ...getPoistionType(props.positionType),
41207
+ // Optional values
41208
+ ...(alignContent && getAlign('alignContent', alignContent)),
41209
+ ...(alignItems && getAlign('alignItems', alignItems)),
41210
+ ...(flexWrap && getFlexWrap(flexWrap))
41152
41211
  };
41153
41212
  }
41154
41213
 
@@ -41176,39 +41235,6 @@
41176
41235
  */
41177
41236
  const isListener = (key) => listenersKey.includes(key);
41178
41237
 
41179
- const parseFont = {
41180
- 'sans-serif': 0 /* Font.F_SANS_SERIF */,
41181
- serif: 1 /* Font.F_SERIF */,
41182
- monospace: 2 /* Font.F_MONOSPACE */
41183
- };
41184
- /**
41185
- * @internal
41186
- */
41187
- function getFont(font) {
41188
- if (!font)
41189
- return undefined;
41190
- return { font: parseFont[font] };
41191
- }
41192
- const parseTextAlign = {
41193
- 'top-left': 0 /* TextAlignMode.TAM_TOP_LEFT */,
41194
- 'top-center': 1 /* TextAlignMode.TAM_TOP_CENTER */,
41195
- 'top-right': 2 /* TextAlignMode.TAM_TOP_RIGHT */,
41196
- 'middle-left': 3 /* TextAlignMode.TAM_MIDDLE_LEFT */,
41197
- 'middle-center': 4 /* TextAlignMode.TAM_MIDDLE_CENTER */,
41198
- 'middle-right': 5 /* TextAlignMode.TAM_MIDDLE_RIGHT */,
41199
- 'bottom-left': 6 /* TextAlignMode.TAM_BOTTOM_LEFT */,
41200
- 'bottom-center': 7 /* TextAlignMode.TAM_BOTTOM_CENTER */,
41201
- 'bottom-right': 8 /* TextAlignMode.TAM_BOTTOM_RIGHT */
41202
- };
41203
- /**
41204
- * @internal
41205
- */
41206
- function getTextAlign(textAlign) {
41207
- if (!textAlign)
41208
- return undefined;
41209
- return { textAlign: parseTextAlign[textAlign] };
41210
- }
41211
-
41212
41238
  function parseUiDropdown(props) {
41213
41239
  const { textAlign, font, ...otherProps } = props;
41214
41240
  return {
@@ -41377,7 +41403,14 @@
41377
41403
  */
41378
41404
 
41379
41405
  function UiEntity(props) {
41380
- return ReactEcs$1.createElement("entity", { ...parseProps(props) });
41406
+ const uiText = props.uiText && {
41407
+ uiText: {
41408
+ ...props.uiText,
41409
+ ...getFont(props.uiText.font),
41410
+ ...getTextAlign(props.uiText.textAlign)
41411
+ }
41412
+ };
41413
+ return ReactEcs$1.createElement("entity", { ...parseProps(props), ...uiText });
41381
41414
  }
41382
41415
 
41383
41416
  function propsChanged(component, prevProps, nextProps) {