@minecraft/server-editor 0.1.0-beta.1.21.20-preview.22 → 0.1.0-beta.1.21.20-preview.24

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.
Files changed (2) hide show
  1. package/index.d.ts +584 -99
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -36,11 +36,29 @@ export enum BlockPaletteItemType {
36
36
  Probability = 1,
37
37
  }
38
38
 
39
+ /**
40
+ * The possible variants of a bool.
41
+ */
42
+ export declare enum BoolPropertyItemVariant {
43
+ Checkbox = 0,
44
+ ToggleSwitch = 1,
45
+ }
46
+
39
47
  export enum BrushPipelineOperationType {
40
48
  Include = 0,
41
49
  Exclude = 1,
42
50
  }
43
51
 
52
+ /**
53
+ * The possible variants of a Button property item.
54
+ */
55
+ export declare enum ButtonPropertyItemVariant {
56
+ Primary = 0,
57
+ Secondary = 1,
58
+ Confirmation = 2,
59
+ Destructive = 3,
60
+ }
61
+
44
62
  /**
45
63
  * The possible variants of a color picker.
46
64
  */
@@ -143,26 +161,6 @@ export enum DaylightCycle {
143
161
  LockTime = 2,
144
162
  }
145
163
 
146
- /**
147
- * Type of item that can be added to the property pane
148
- */
149
- export declare enum EDITOR_PANE_PROPERTY_ITEM_TYPE {
150
- Action = 'editorUI:Action',
151
- BlockList = 'editorUI:BlockList',
152
- BlockPicker = 'editorUI:BlockPicker',
153
- Boolean = 'editorUI:Boolean',
154
- ColorPicker = 'editorUI:ColorPicker',
155
- Divider = 'editorUI:Divider',
156
- Dropdown = 'editorUI:Dropdown',
157
- Image = 'editorUI:Image',
158
- Number = 'editorUI:Number',
159
- String = 'editorUI:String',
160
- SubPane = 'editorUI:SubPane',
161
- Table = 'editorUI:Table',
162
- Text = 'editorUI:Text',
163
- Vec3 = 'editorUI:Vec3',
164
- }
165
-
166
164
  /**
167
165
  * Global editor input contexts
168
166
  */
@@ -234,6 +232,15 @@ export enum GraphicsSettingsProperty {
234
232
  ShowInvisibleBlocks = 'ShowInvisibleBlocks',
235
233
  }
236
234
 
235
+ /**
236
+ * Supported image types.
237
+ */
238
+ export declare enum ImageResourceType {
239
+ Default = 0,
240
+ Block = 1,
241
+ Icon = 2,
242
+ }
243
+
237
244
  /**
238
245
  * Input modifier flags to create chorded bindings
239
246
  */
@@ -805,6 +812,15 @@ export declare enum KeyboardKey {
805
812
  QUOTE = 222,
806
813
  }
807
814
 
815
+ /**
816
+ * Alignment options for UI elements
817
+ */
818
+ export declare enum LayoutAlignment {
819
+ Left = 0,
820
+ Center = 1,
821
+ Right = 2,
822
+ }
823
+
808
824
  /**
809
825
  * Layout directions for property panes.
810
826
  */
@@ -888,6 +904,26 @@ export enum ProjectExportType {
888
904
  WorldTemplate = 2,
889
905
  }
890
906
 
907
+ /**
908
+ * Type of item that can be added to the property pane
909
+ */
910
+ export declare enum PropertyItemType {
911
+ BlockList = 'editorUI:BlockList',
912
+ BlockPicker = 'editorUI:BlockPicker',
913
+ Boolean = 'editorUI:Boolean',
914
+ Button = 'editorUI:Button',
915
+ ColorPicker = 'editorUI:ColorPicker',
916
+ Divider = 'editorUI:Divider',
917
+ Dropdown = 'editorUI:Dropdown',
918
+ Image = 'editorUI:Image',
919
+ Number = 'editorUI:Number',
920
+ String = 'editorUI:String',
921
+ SubPane = 'editorUI:SubPane',
922
+ Table = 'editorUI:Table',
923
+ Text = 'editorUI:Text',
924
+ Vector3 = 'editorUI:Vector3',
925
+ }
926
+
891
927
  /**
892
928
  * Define the visibility of the status bar item If the tool
893
929
  * does not have an `ISimpleToolPropertyPane` component, then
@@ -898,6 +934,22 @@ export declare enum SimpleToolStatusBarVisibility {
898
934
  VisibleWhenActive = 1,
899
935
  }
900
936
 
937
+ export enum ThemeSettingsColorKey {
938
+ ControlsGeneralFill = 'ControlsGeneralFill',
939
+ ControlsGeneralHighlight = 'ControlsGeneralHighlight',
940
+ CoordinateControlX = 'CoordinateControlX',
941
+ CoordinateControlY = 'CoordinateControlY',
942
+ CoordinateControlZ = 'CoordinateControlZ',
943
+ CursorVolumeBorder = 'CursorVolumeBorder',
944
+ CursorVolumeFill = 'CursorVolumeFill',
945
+ PlacementVolumeBorder = 'PlacementVolumeBorder',
946
+ PlacementVolumeFill = 'PlacementVolumeFill',
947
+ PrefillVolumeBorder = 'PrefillVolumeBorder',
948
+ PrefillVolumeFill = 'PrefillVolumeFill',
949
+ SelectionVolumeBorder = 'SelectionVolumeBorder',
950
+ SelectionVolumeFill = 'SelectionVolumeFill',
951
+ }
952
+
901
953
  export enum WidgetGroupSelectionMode {
902
954
  Multiple = 'Multiple',
903
955
  None = 'None',
@@ -934,24 +986,11 @@ export type ActivationFunctionType<PerPlayerStorageType> = (
934
986
  uiSession: IPlayerUISession<PerPlayerStorageType>,
935
987
  ) => IDisposable[];
936
988
 
937
- /**
938
- * The possible variants of a button.
939
- */
940
- export declare type ButtonVariant = 'secondary' | 'primary' | 'destructive' | 'hero';
941
-
942
989
  /**
943
990
  * A generic handler for an event sink.
944
991
  */
945
992
  export declare type EventHandler<T> = (eventArg: T) => void;
946
993
 
947
- /**
948
- * A property item which supports bound actions and replacing
949
- * the bound action
950
- */
951
- export type IActionPropertyItem<T extends PropertyBag, Prop extends keyof T & string> = IPropertyItem<T, Prop> & {
952
- replaceBoundAction(action: RegisteredAction<NoArgsAction> | undefined): void;
953
- };
954
-
955
994
  /**
956
995
  * A property item which supports BlockList properties
957
996
  */
@@ -969,6 +1008,16 @@ export type IDropdownPropertyItem<
969
1008
  Prop extends keyof T & string,
970
1009
  > = IPropertyItem<T, Prop> & IDropdownPropertyItemMixIn;
971
1010
 
1011
+ export declare type ImageResourceData = {
1012
+ path: string;
1013
+ type: ImageResourceType;
1014
+ };
1015
+
1016
+ /**
1017
+ * Type that can be an observable or a value.
1018
+ */
1019
+ export type IObservableProp<T> = IObservable<T> | T;
1020
+
972
1021
  /**
973
1022
  * The IPlayerUISession represents the editor user interface
974
1023
  * for a given player and given extension. Extensions
@@ -1009,7 +1058,10 @@ export type ITablePropertyItem<T extends PropertyBag, Prop extends keyof T & str
1009
1058
  /**
1010
1059
  * A property item which supports Vector3 properties
1011
1060
  */
1012
- export type IVector3PropertyItem<T extends PropertyBag, Prop extends keyof T & string> = IPropertyItem<T, Prop> & {
1061
+ export type IVector3PropertyItem_deprecated<T extends PropertyBag, Prop extends keyof T & string> = IPropertyItem<
1062
+ T,
1063
+ Prop
1064
+ > & {
1013
1065
  updateAxisLimits(limits: {
1014
1066
  minX?: number;
1015
1067
  maxX?: number;
@@ -1037,6 +1089,17 @@ export type KeyBindingInfo = {
1037
1089
  tooltip?: string;
1038
1090
  };
1039
1091
 
1092
+ /**
1093
+ * Represents a localized string or an object with a localized
1094
+ * string and optional properties
1095
+ */
1096
+ export declare type LocalizedString =
1097
+ | string
1098
+ | {
1099
+ id: string;
1100
+ props?: string[];
1101
+ };
1102
+
1040
1103
  /**
1041
1104
  * Modal tool lifecycle event payload
1042
1105
  */
@@ -2116,6 +2179,13 @@ export class ModeChangeAfterEventSignal {
2116
2179
  unsubscribe(callback: (arg: ModeChangeAfterEvent) => void): void;
2117
2180
  }
2118
2181
 
2182
+ /**
2183
+ * Used for validating an observable value before it gets set
2184
+ */
2185
+ export declare abstract class ObservableValidator<T> {
2186
+ abstract validate(newValue: T): T;
2187
+ }
2188
+
2119
2189
  export class PlaytestManager {
2120
2190
  private constructor();
2121
2191
  /**
@@ -2167,6 +2237,7 @@ export class ProbabilityBlockPaletteItem extends IBlockPaletteItem {
2167
2237
  * {@link Error}
2168
2238
  */
2169
2239
  addBlock(block: minecraftserver.BlockPermutation | minecraftserver.BlockType | string, weight: number): void;
2240
+ getBlocks(): WeightedBlock[];
2170
2241
  /**
2171
2242
  * @remarks
2172
2243
  * This function can't be called in read-only mode.
@@ -2440,6 +2511,7 @@ export class SettingsManager {
2440
2511
  *
2441
2512
  */
2442
2513
  readonly graphics: GraphicsSettings;
2514
+ readonly theme: ThemeSettings;
2443
2515
  }
2444
2516
 
2445
2517
  export class SettingsUIElement {
@@ -2525,6 +2597,21 @@ export class SimulationState {
2525
2597
  setPaused(isPaused: boolean): void;
2526
2598
  }
2527
2599
 
2600
+ export class ThemeSettings {
2601
+ private constructor();
2602
+ getThemeList(): string[];
2603
+ resolveColorKey(key: ThemeSettingsColorKey): minecraftserver.RGBA | undefined;
2604
+ /**
2605
+ * @remarks
2606
+ * This function can't be called in read-only mode.
2607
+ *
2608
+ * @throws This function can throw errors.
2609
+ *
2610
+ * {@link Error}
2611
+ */
2612
+ setCurrentTheme(name: string): void;
2613
+ }
2614
+
2528
2615
  /**
2529
2616
  * The Transaction Manager is responsible for tracking and
2530
2617
  * managing all of the registered transaction operations which
@@ -2809,6 +2896,34 @@ export class UserDefinedTransactionHandlerId {
2809
2896
  private constructor();
2810
2897
  }
2811
2898
 
2899
+ /**
2900
+ * Validates min/max limits of observable objects that support
2901
+ * Vector3
2902
+ */
2903
+ export declare class Vector3LimitObservableValidator implements ObservableValidator<minecraftserver.Vector3> {
2904
+ /**
2905
+ * @remarks
2906
+ * This property can't be edited in read-only mode.
2907
+ *
2908
+ */
2909
+ protected _max: Partial<minecraftserver.Vector3>;
2910
+ /**
2911
+ * @remarks
2912
+ * This property can't be edited in read-only mode.
2913
+ *
2914
+ */
2915
+ protected _min: Partial<minecraftserver.Vector3>;
2916
+ /**
2917
+ * @remarks
2918
+ * Constructs a new instance of the
2919
+ * `Vector3LimitObservableValidator` class
2920
+ *
2921
+ */
2922
+ constructor(min: Partial<minecraftserver.Vector3>, max: Partial<minecraftserver.Vector3>);
2923
+ updateLimits(min: Partial<minecraftserver.Vector3>, max: Partial<minecraftserver.Vector3>): void;
2924
+ validate(newValue: minecraftserver.Vector3): minecraftserver.Vector3;
2925
+ }
2926
+
2812
2927
  export class Widget {
2813
2928
  private constructor();
2814
2929
  readonly valid: boolean;
@@ -3190,6 +3305,11 @@ export interface SettingsUIElementOptions {
3190
3305
  refreshOnChange?: boolean;
3191
3306
  }
3192
3307
 
3308
+ export interface WeightedBlock {
3309
+ block: minecraftserver.BlockType;
3310
+ weight: number;
3311
+ }
3312
+
3193
3313
  export interface WidgetCreateOptions {
3194
3314
  initialVisibility?: boolean;
3195
3315
  isSelectable?: boolean;
@@ -3380,6 +3500,147 @@ export interface IActionBarItemCreationParams {
3380
3500
  tooltipTitle?: string;
3381
3501
  }
3382
3502
 
3503
+ /**
3504
+ * A property item which supports Vector3 properties
3505
+ */
3506
+ // @ts-ignore Class inheritance allowed for native defined classes
3507
+ export interface IBoolPropertyItem extends IPropertyItemBase {
3508
+ /**
3509
+ * @remarks
3510
+ * Current value of the property item.
3511
+ *
3512
+ */
3513
+ readonly value: boolean;
3514
+ /**
3515
+ * @remarks
3516
+ * Sets title of the property item.
3517
+ *
3518
+ */
3519
+ setTitle(title: LocalizedString | undefined): void;
3520
+ /**
3521
+ * @remarks
3522
+ * Sets tooltip description of the property item.
3523
+ *
3524
+ */
3525
+ setTooltip(title: LocalizedString | undefined): void;
3526
+ }
3527
+
3528
+ /**
3529
+ * Optional properties for Bool property item
3530
+ */
3531
+ // @ts-ignore Class inheritance allowed for native defined classes
3532
+ export interface IBoolPropertyItemOptions extends IPropertyItemOptionsBase {
3533
+ /**
3534
+ * @remarks
3535
+ * If true label text will be hidden. It will be visible by
3536
+ * default.
3537
+ *
3538
+ */
3539
+ hiddenLabel?: boolean;
3540
+ /**
3541
+ * @remarks
3542
+ * This callback is called when UI control value is changed.
3543
+ *
3544
+ */
3545
+ onChange?: (newValue: boolean, oldValue: boolean) => void;
3546
+ /**
3547
+ * @remarks
3548
+ * Localized title of the text item.
3549
+ *
3550
+ */
3551
+ title?: LocalizedString;
3552
+ /**
3553
+ * @remarks
3554
+ * Tooltip description of the property item
3555
+ *
3556
+ */
3557
+ tooltip?: LocalizedString;
3558
+ /**
3559
+ * @remarks
3560
+ * Determines how we display bool as a UI element. If
3561
+ * undefined, it will default to Checkbox.
3562
+ *
3563
+ */
3564
+ variant?: BoolPropertyItemVariant;
3565
+ }
3566
+
3567
+ /**
3568
+ * A property item which supports Button properties
3569
+ */
3570
+ // @ts-ignore Class inheritance allowed for native defined classes
3571
+ export interface IButtonPropertyItem extends IPropertyItemBase {
3572
+ /**
3573
+ * @remarks
3574
+ * Replace action assigned to the button.
3575
+ *
3576
+ * @param action
3577
+ * New action to replace the existing with.
3578
+ */
3579
+ replaceAction(action: RegisteredAction<NoArgsAction>): void;
3580
+ /**
3581
+ * @remarks
3582
+ * Updates icon of the button.
3583
+ *
3584
+ * @param icon
3585
+ * New button icon.
3586
+ */
3587
+ setIcon(icon: string | undefined): void;
3588
+ /**
3589
+ * @remarks
3590
+ * Updates title of the button.
3591
+ *
3592
+ * @param title
3593
+ * New button title.
3594
+ */
3595
+ setTitle(title: LocalizedString | undefined): void;
3596
+ /**
3597
+ * @remarks
3598
+ * Updates tooltip description of the button.
3599
+ *
3600
+ * @param tooltip
3601
+ * New button tooltip.
3602
+ */
3603
+ setTooltip(tooltip: LocalizedString | undefined): void;
3604
+ }
3605
+
3606
+ /**
3607
+ * Optional properties for Button property item
3608
+ */
3609
+ // @ts-ignore Class inheritance allowed for native defined classes
3610
+ export interface IButtonPropertyItemOptions extends IPropertyItemOptionsBase {
3611
+ /**
3612
+ * @remarks
3613
+ * If true label text will be hidden. It will be visible by
3614
+ * default.
3615
+ *
3616
+ */
3617
+ hiddenLabel?: boolean;
3618
+ /**
3619
+ * @remarks
3620
+ * Icon image of the property item.
3621
+ *
3622
+ */
3623
+ icon?: string;
3624
+ /**
3625
+ * @remarks
3626
+ * Localized title of the property item.
3627
+ *
3628
+ */
3629
+ title?: LocalizedString;
3630
+ /**
3631
+ * @remarks
3632
+ * Tooltip description of the property item.
3633
+ *
3634
+ */
3635
+ tooltip?: LocalizedString;
3636
+ /**
3637
+ * @remarks
3638
+ * The variant for the button. By default it is Primary.
3639
+ *
3640
+ */
3641
+ variant?: ButtonPropertyItemVariant;
3642
+ }
3643
+
3383
3644
  /**
3384
3645
  * Simple abstraction for disposable objects.
3385
3646
  */
@@ -3446,6 +3707,72 @@ export interface IGlobalInputManager {
3446
3707
  ): void;
3447
3708
  }
3448
3709
 
3710
+ /**
3711
+ * A property item which supports Image properties
3712
+ */
3713
+ // @ts-ignore Class inheritance allowed for native defined classes
3714
+ export interface IImagePropertyItem extends IPropertyItemBase {
3715
+ /**
3716
+ * @remarks
3717
+ * Height of the image.
3718
+ *
3719
+ */
3720
+ readonly imageHeight: number;
3721
+ /**
3722
+ * @remarks
3723
+ * Width of the image.
3724
+ *
3725
+ */
3726
+ readonly imageWidth: number;
3727
+ /**
3728
+ * @remarks
3729
+ * Current value of the property item.
3730
+ *
3731
+ */
3732
+ readonly value: Readonly<string | ImageResourceData>;
3733
+ /**
3734
+ * @remarks
3735
+ * Updates the size of the image.
3736
+ *
3737
+ * @param width
3738
+ * New width of the image.
3739
+ * @param height
3740
+ * New height of the image.
3741
+ */
3742
+ resizeImage(width: number, height: number): void;
3743
+ }
3744
+
3745
+ /**
3746
+ * Optional properties for Image property item
3747
+ */
3748
+ // @ts-ignore Class inheritance allowed for native defined classes
3749
+ export interface IImagePropertyItemOptions extends IPropertyItemOptionsBase {
3750
+ /**
3751
+ * @remarks
3752
+ * Alignment of the image in the container. If not defined,
3753
+ * LayoutAlignment.Left is used.
3754
+ *
3755
+ */
3756
+ alignment?: LayoutAlignment;
3757
+ /**
3758
+ * @remarks
3759
+ * Size of the image. If undefined, defaults to 10.
3760
+ *
3761
+ */
3762
+ imageSize?:
3763
+ | number
3764
+ | {
3765
+ width: number;
3766
+ height: number;
3767
+ };
3768
+ /**
3769
+ * @remarks
3770
+ * Called when image is clicked.
3771
+ *
3772
+ */
3773
+ onClick?: (x: number, y: number) => void;
3774
+ }
3775
+
3449
3776
  export interface IMenu {
3450
3777
  /**
3451
3778
  * @remarks
@@ -3577,6 +3904,34 @@ export interface IModalToolContainer {
3577
3904
  show(): void;
3578
3905
  }
3579
3906
 
3907
+ /**
3908
+ * Represents a stateful value that can be observed by
3909
+ * different objects.
3910
+ */
3911
+ export interface IObservable<T> {
3912
+ /**
3913
+ * @remarks
3914
+ * Optional validator that will pre-process the new value.
3915
+ *
3916
+ */
3917
+ readonly validator?: ObservableValidator<T>;
3918
+ /**
3919
+ * @remarks
3920
+ * Current value of the observable.
3921
+ *
3922
+ */
3923
+ readonly value: Readonly<T>;
3924
+ /**
3925
+ * @remarks
3926
+ * Updates the value and notifies dependent objects.
3927
+ *
3928
+ * @param newValue
3929
+ * New value to be set (will be processed by the validator if
3930
+ * it exists).
3931
+ */
3932
+ set(newValue: T): boolean;
3933
+ }
3934
+
3580
3935
  /**
3581
3936
  * Log helper interface for Player.
3582
3937
  */
@@ -3615,56 +3970,63 @@ export interface IPlayerLogger {
3615
3970
  warning(message: string): void;
3616
3971
  }
3617
3972
 
3618
- export interface IPropertyItem<T extends PropertyBag, Prop extends keyof T & string> {
3973
+ // @ts-ignore Class inheritance allowed for native defined classes
3974
+ export interface IPropertyItem<T extends PropertyBag, Prop extends keyof T & string> extends IPropertyItemBase {
3619
3975
  /**
3620
3976
  * @remarks
3621
- * If the item is enabled in the UI.
3977
+ * The object associated.
3622
3978
  *
3623
3979
  */
3624
- enable: boolean;
3980
+ readonly obj: T;
3625
3981
  /**
3626
3982
  * @remarks
3627
- * Unique ID for the property item.
3983
+ * The target property of the object associated.
3628
3984
  *
3629
3985
  */
3630
- readonly id: string;
3986
+ readonly property: Prop;
3631
3987
  /**
3632
3988
  * @remarks
3633
- * The object associated.
3989
+ * The value of the property.
3634
3990
  *
3635
3991
  */
3636
- readonly obj: T;
3992
+ readonly value: T[Prop];
3993
+ dispose(): void;
3994
+ }
3995
+
3996
+ /**
3997
+ * Common base for all property items
3998
+ */
3999
+ export interface IPropertyItemBase {
3637
4000
  /**
3638
4001
  * @remarks
3639
- * The parent pane id.
4002
+ * If the item is enabled in the UI.
3640
4003
  *
3641
4004
  */
3642
- readonly paneId: string;
4005
+ enable: boolean;
3643
4006
  /**
3644
4007
  * @remarks
3645
- * The target property of the object associated.
4008
+ * Unique ID for the property item.
3646
4009
  *
3647
4010
  */
3648
- readonly property: Prop;
4011
+ readonly id: string;
3649
4012
  /**
3650
4013
  * @remarks
3651
- * The type name of the target property.
4014
+ * The parent pane id.
3652
4015
  *
3653
4016
  */
3654
- readonly typeName: EDITOR_PANE_PROPERTY_ITEM_TYPE;
4017
+ readonly paneId: string;
3655
4018
  /**
3656
4019
  * @remarks
3657
- * The value of the property.
4020
+ * The type name of the target property.
3658
4021
  *
3659
4022
  */
3660
- readonly value: T[Prop];
4023
+ readonly typeName: PropertyItemType;
3661
4024
  /**
3662
4025
  * @remarks
3663
4026
  * If the item should be visible in the UI.
3664
4027
  *
3665
4028
  */
3666
4029
  visible: boolean;
3667
- dispose(): void;
3668
4030
  }
3669
4031
 
3670
4032
  export interface IPropertyItemOptions {
@@ -3694,6 +4056,26 @@ export interface IPropertyItemOptions {
3694
4056
  visible?: boolean;
3695
4057
  }
3696
4058
 
4059
+ /**
4060
+ * Common optional properties for property items
4061
+ */
4062
+ export interface IPropertyItemOptionsBase {
4063
+ /**
4064
+ * @remarks
4065
+ * Initial enabled state of property item. If undefined, it
4066
+ * will default to true.
4067
+ *
4068
+ */
4069
+ enable?: boolean;
4070
+ /**
4071
+ * @remarks
4072
+ * Initial visibility state of property item. If undefined, it
4073
+ * will default to true.
4074
+ *
4075
+ */
4076
+ visible?: boolean;
4077
+ }
4078
+
3697
4079
  // @ts-ignore Class inheritance allowed for native defined classes
3698
4080
  export interface IPropertyItemOptionsBlockList extends IPropertyItemOptions {
3699
4081
  blockList: string[];
@@ -3709,17 +4091,6 @@ export interface IPropertyItemOptionsBool extends IPropertyItemOptions {
3709
4091
  displayAsToggleSwitch?: boolean;
3710
4092
  }
3711
4093
 
3712
- // @ts-ignore Class inheritance allowed for native defined classes
3713
- export interface IPropertyItemOptionsButton extends IPropertyItemOptions {
3714
- icon?: string;
3715
- /**
3716
- * @remarks
3717
- * The variant for the button. By default it is "primary"
3718
- *
3719
- */
3720
- variant?: ButtonVariant;
3721
- }
3722
-
3723
4094
  // @ts-ignore Class inheritance allowed for native defined classes
3724
4095
  export interface IPropertyItemOptionsColorPicker extends IPropertyItemOptions {
3725
4096
  showAlpha?: boolean;
@@ -3746,12 +4117,6 @@ export interface IPropertyItemOptionsDropdown extends IPropertyItemOptions {
3746
4117
  dropdownItems: IDropdownItem[];
3747
4118
  }
3748
4119
 
3749
- // @ts-ignore Class inheritance allowed for native defined classes
3750
- export interface IPropertyItemOptionsImage extends IPropertyItemOptions {
3751
- imageHeight: number;
3752
- imageWidth: number;
3753
- }
3754
-
3755
4120
  // @ts-ignore Class inheritance allowed for native defined classes
3756
4121
  export interface IPropertyItemOptionsNumber extends IPropertyItemOptions {
3757
4122
  /**
@@ -3797,16 +4162,6 @@ export interface IPropertyItemOptionsTable extends IPropertyItemOptions {
3797
4162
  titleId?: string;
3798
4163
  }
3799
4164
 
3800
- /**
3801
- * Localization string id and border enable boolean for
3802
- * multiline text component.
3803
- */
3804
- // @ts-ignore Class inheritance allowed for native defined classes
3805
- export interface IPropertyItemOptionsText extends IPropertyItemOptions {
3806
- border?: boolean;
3807
- valueStringId?: string;
3808
- }
3809
-
3810
4165
  // @ts-ignore Class inheritance allowed for native defined classes
3811
4166
  export interface IPropertyItemOptionsVector3 extends IPropertyItemOptions {
3812
4167
  /**
@@ -3922,12 +4277,16 @@ export interface IPropertyPane {
3922
4277
  property: Prop,
3923
4278
  options?: IPropertyItemOptionsDataPicker,
3924
4279
  ): IPropertyItem<T, Prop>;
4280
+ /**
4281
+ * @remarks
4282
+ */
4283
+ addBool(value: IObservableProp<boolean>, options?: IBoolPropertyItemOptions): IBoolPropertyItem;
3925
4284
  /**
3926
4285
  * @remarks
3927
4286
  * Adds a boolean item to the pane.
3928
4287
  *
3929
4288
  */
3930
- addBool<T extends PropertyBag, Prop extends keyof T & string>(
4289
+ addBool_deprecated<T extends PropertyBag, Prop extends keyof T & string>(
3931
4290
  obj: T,
3932
4291
  property: Prop,
3933
4292
  options?: IPropertyItemOptionsBool,
@@ -3939,14 +4298,9 @@ export interface IPropertyPane {
3939
4298
  *
3940
4299
  */
3941
4300
  addButton(
3942
- action: RegisteredAction<NoArgsAction>,
3943
- options?: IPropertyItemOptionsButton,
3944
- ): IActionPropertyItem<
3945
- {
3946
- EMPTY: undefined;
3947
- },
3948
- 'EMPTY'
3949
- >;
4301
+ action: (() => void) | RegisteredAction<NoArgsAction>,
4302
+ options?: IButtonPropertyItemOptions,
4303
+ ): IButtonPropertyItem;
3950
4304
  /**
3951
4305
  * @remarks
3952
4306
  * Adds a color picker item to the pane.
@@ -3962,7 +4316,7 @@ export interface IPropertyPane {
3962
4316
  * Adds an divider item to the pane.
3963
4317
  *
3964
4318
  */
3965
- addDivider(): IPropertyItem<PropertyBag, string>;
4319
+ addDivider(): IPropertyItemBase;
3966
4320
  /**
3967
4321
  * @remarks
3968
4322
  * Adds an DropDown item to the pane.
@@ -3993,11 +4347,10 @@ export interface IPropertyPane {
3993
4347
  * Adds an image item to the pane.
3994
4348
  *
3995
4349
  */
3996
- addImage<T extends PropertyBag, Prop extends keyof T & string>(
3997
- obj: T,
3998
- property: Prop,
3999
- options?: IPropertyItemOptionsImage,
4000
- ): IPropertyItem<T, Prop>;
4350
+ addImage(
4351
+ value: IObservableProp<string | ImageResourceData>,
4352
+ options?: IImagePropertyItemOptions,
4353
+ ): IImagePropertyItem;
4001
4354
  /**
4002
4355
  * @remarks
4003
4356
  * Adds a number item to the pane.
@@ -4034,21 +4387,26 @@ export interface IPropertyPane {
4034
4387
  * Adds a multiline Text item to the pane.
4035
4388
  *
4036
4389
  */
4037
- addText<T extends PropertyBag, Prop extends keyof T & string>(
4038
- obj: T,
4039
- property: Prop,
4040
- options?: IPropertyItemOptionsText,
4041
- ): IPropertyItem<T, Prop>;
4390
+ addText(value: IObservableProp<LocalizedString>, options?: ITextPropertyItemOptions): ITextPropertyItem;
4391
+ /**
4392
+ * @remarks
4393
+ * Adds a Vec3 item to the pane.
4394
+ *
4395
+ */
4396
+ addVector3(
4397
+ value: IObservableProp<minecraftserver.Vector3>,
4398
+ options?: IVector3PropertyItemOptions,
4399
+ ): IVector3PropertyItem;
4042
4400
  /**
4043
4401
  * @remarks
4044
4402
  * Adds a Vec3 item to the pane.
4045
4403
  *
4046
4404
  */
4047
- addVector3<T extends PropertyBag, Prop extends keyof T & string>(
4405
+ addVector3_deprecated<T extends PropertyBag, Prop extends keyof T & string>(
4048
4406
  obj: T,
4049
4407
  property: Prop,
4050
4408
  options?: IPropertyItemOptionsVector3,
4051
- ): IVector3PropertyItem<T, Prop>;
4409
+ ): IVector3PropertyItem_deprecated<T, Prop>;
4052
4410
  /**
4053
4411
  * @remarks
4054
4412
  * Collapse the pane.
@@ -4643,6 +5001,123 @@ export interface IStatusBarItem {
4643
5001
  show(): void;
4644
5002
  }
4645
5003
 
5004
+ /**
5005
+ * A property item which supports Vector3 properties
5006
+ */
5007
+ // @ts-ignore Class inheritance allowed for native defined classes
5008
+ export interface ITextPropertyItem extends IPropertyItemBase {
5009
+ /**
5010
+ * @remarks
5011
+ * Current value of the property item.
5012
+ *
5013
+ */
5014
+ readonly value: Readonly<LocalizedString>;
5015
+ /**
5016
+ * @remarks
5017
+ * Gets layout alignment of the property item.
5018
+ *
5019
+ */
5020
+ setAlignment(alignment: LayoutAlignment): void;
5021
+ /**
5022
+ * @remarks
5023
+ * Sets title of the property item.
5024
+ *
5025
+ */
5026
+ setTitle(title: LocalizedString | undefined): void;
5027
+ }
5028
+
5029
+ /**
5030
+ * Optional properties for Text property item
5031
+ */
5032
+ // @ts-ignore Class inheritance allowed for native defined classes
5033
+ export interface ITextPropertyItemOptions extends IPropertyItemOptionsBase {
5034
+ /**
5035
+ * @remarks
5036
+ * Determines alignment of the text. If undefined, it will
5037
+ * default to left aligned.
5038
+ *
5039
+ */
5040
+ alignment?: LayoutAlignment;
5041
+ /**
5042
+ * @remarks
5043
+ * Adds a border around the text. If undefined, it will default
5044
+ * to true.
5045
+ *
5046
+ */
5047
+ border?: boolean;
5048
+ /**
5049
+ * @remarks
5050
+ * Localized title of the text item.
5051
+ *
5052
+ */
5053
+ title?: LocalizedString;
5054
+ }
5055
+
5056
+ /**
5057
+ * A property item which supports Vector3 properties
5058
+ */
5059
+ // @ts-ignore Class inheritance allowed for native defined classes
5060
+ export interface IVector3PropertyItem extends IPropertyItemBase {
5061
+ /**
5062
+ * @remarks
5063
+ * Current value of the property item.
5064
+ *
5065
+ */
5066
+ readonly value: Readonly<minecraftserver.Vector3>;
5067
+ /**
5068
+ * @remarks
5069
+ * Updates Vector3 limits and clamps the current value.
5070
+ *
5071
+ */
5072
+ updateAxisLimits(limits: { min?: Partial<minecraftserver.Vector3>; max?: Partial<minecraftserver.Vector3> }): void;
5073
+ }
5074
+
5075
+ /**
5076
+ * Optional properties for Vector3 property item
5077
+ */
5078
+ // @ts-ignore Class inheritance allowed for native defined classes
5079
+ export interface IVector3PropertyItemOptions extends IPropertyItemOptionsBase {
5080
+ /**
5081
+ * @remarks
5082
+ * If true label text will be hidden. It will be visible by
5083
+ * default.
5084
+ *
5085
+ */
5086
+ hiddenLabel?: boolean;
5087
+ /**
5088
+ * @remarks
5089
+ * The min possible limits. If undefined,
5090
+ * Number.MAX_SAFE_INTEGER will be used.
5091
+ *
5092
+ */
5093
+ max?: Partial<minecraftserver.Vector3>;
5094
+ /**
5095
+ * @remarks
5096
+ * The min possible limits. If undefined,
5097
+ * Number.MIN_SAFE_INTEGER will be used.
5098
+ *
5099
+ */
5100
+ min?: Partial<minecraftserver.Vector3>;
5101
+ /**
5102
+ * @remarks
5103
+ * This callback is called when UI control is changed.
5104
+ *
5105
+ */
5106
+ onChange?: (newValue: minecraftserver.Vector3, oldValue: minecraftserver.Vector3) => void;
5107
+ /**
5108
+ * @remarks
5109
+ * Localized title of the property item
5110
+ *
5111
+ */
5112
+ title?: LocalizedString;
5113
+ /**
5114
+ * @remarks
5115
+ * Tooltip description of the property item
5116
+ *
5117
+ */
5118
+ tooltip?: LocalizedString;
5119
+ }
5120
+
4646
5121
  /**
4647
5122
  * Parameters for creating a modal tool in the tool container
4648
5123
  */
@@ -4733,6 +5208,16 @@ export declare function executeLargeOperationFromIterator(
4733
5208
  * Default allowed block list
4734
5209
  */
4735
5210
  export declare function getBlockPickerDefaultAllowBlockList(): string[];
5211
+ /**
5212
+ * @remarks
5213
+ * Creates an observable object that stores a value state.
5214
+ *
5215
+ * @param initialValue
5216
+ * Initial value of the observable.
5217
+ * @param validator
5218
+ * Optional validator to use for the setter.
5219
+ */
5220
+ export declare function makeObservable<T>(initialValue: T, validator?: ObservableValidator<T>): IObservable<T>;
4736
5221
  /**
4737
5222
  * @remarks
4738
5223
  * Registers an editor extension into Minecraft. This function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.20-preview.22",
3
+ "version": "0.1.0-beta.1.21.20-preview.24",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "@minecraft/common": "^1.0.0",
17
- "@minecraft/server": "^1.14.0-beta.1.21.20-preview.22"
17
+ "@minecraft/server": "^1.14.0-beta.1.21.20-preview.24"
18
18
  },
19
19
  "license": "MIT"
20
20
  }