@minecraft/server-editor 0.1.0-beta.1.21.40-preview.25 → 0.1.0-beta.1.21.50-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 +258 -13
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -889,6 +889,17 @@ export declare enum NumberPropertyItemVariant {
889
889
  InputFieldAndSlider = 1,
890
890
  }
891
891
 
892
+ export enum PaintCompletionState {
893
+ Success = 0,
894
+ Canceled = 1,
895
+ Failed = 2,
896
+ }
897
+
898
+ export enum PaintMode {
899
+ BlockPaint = 0,
900
+ FreehandSelect = 1,
901
+ }
902
+
892
903
  export enum Plane {
893
904
  XY = 'XY',
894
905
  XZ = 'XZ',
@@ -948,6 +959,7 @@ export declare enum PropertyItemType {
948
959
  SubPane = 'editorUI:SubPane',
949
960
  Table = 'editorUI:Table',
950
961
  Text = 'editorUI:Text',
962
+ ToggleGroup = 'editorUI:ToggleGroup',
951
963
  Vector3 = 'editorUI:Vector3',
952
964
  }
953
965
 
@@ -1054,6 +1066,12 @@ export enum WidgetGroupSelectionMode {
1054
1066
  Single = 'Single',
1055
1067
  }
1056
1068
 
1069
+ export enum WidgetMouseButtonActionType {
1070
+ Pressed = 0,
1071
+ Released = 1,
1072
+ Drag = 2,
1073
+ }
1074
+
1057
1075
  /**
1058
1076
  * Defines type information for graphics settings properties.
1059
1077
  */
@@ -1301,6 +1319,27 @@ export type SupportedKeyboardActionTypes = RegisteredAction<NoArgsAction>;
1301
1319
  */
1302
1320
  export type SupportedMouseActionTypes = RegisteredAction<MouseRayCastAction>;
1303
1321
 
1322
+ /**
1323
+ * Content properties to display interactive tooltips
1324
+ */
1325
+ export declare type TooltipInteractiveContent = {
1326
+ title?: LocalizedString;
1327
+ description?: TooltipInteractiveContentDescription[];
1328
+ };
1329
+
1330
+ /**
1331
+ * Possible tooltip description items
1332
+ */
1333
+ export declare type TooltipInteractiveContentDescription = LocalizedString | TooltipLink;
1334
+
1335
+ /**
1336
+ * Tooltip link description
1337
+ */
1338
+ export declare type TooltipLink = {
1339
+ text: LocalizedString;
1340
+ link: string;
1341
+ };
1342
+
1304
1343
  export type UnregisterInputBindingCallback = () => void;
1305
1344
 
1306
1345
  /**
@@ -1458,35 +1497,38 @@ export class BrushShapeManager {
1458
1497
  * @remarks
1459
1498
  * This function can't be called in read-only mode.
1460
1499
  *
1461
- * @throws This function can throw errors.
1462
- *
1463
- * {@link minecraftserver.Error}
1464
1500
  */
1465
- activateBrushShape(name: string): minecraftserver.CompoundBlockVolume;
1501
+ activateBrushTool(): void;
1466
1502
  /**
1467
1503
  * @remarks
1468
1504
  * This function can't be called in read-only mode.
1469
1505
  *
1506
+ * @throws This function can throw errors.
1507
+ *
1508
+ * {@link Error}
1470
1509
  */
1471
- activateBrushTool(): void;
1510
+ beginPainting(onComplete: (arg: PaintCompletionState) => void): void;
1472
1511
  /**
1473
1512
  * @remarks
1474
1513
  * This function can't be called in read-only mode.
1475
1514
  *
1476
1515
  */
1477
- beginPainting(): void;
1516
+ deactivateBrushTool(): void;
1478
1517
  /**
1479
1518
  * @remarks
1480
1519
  * This function can't be called in read-only mode.
1481
1520
  *
1521
+ * @throws This function can throw errors.
1522
+ *
1523
+ * {@link Error}
1482
1524
  */
1483
- deactivateBrushTool(): void;
1525
+ endPainting(cancelled: boolean): void;
1484
1526
  /**
1485
1527
  * @remarks
1486
1528
  * This function can't be called in read-only mode.
1487
1529
  *
1488
1530
  */
1489
- endPainting(): void;
1531
+ getBrushShapeOffset(): minecraftserver.Vector3;
1490
1532
  /**
1491
1533
  * @remarks
1492
1534
  * This function can't be called in read-only mode.
@@ -1518,9 +1560,19 @@ export class BrushShapeManager {
1518
1560
  *
1519
1561
  * {@link Error}
1520
1562
  */
1521
- setBlockPaletteOverride(
1522
- overrideBlock?: minecraftserver.BlockPermutation | minecraftserver.BlockType | string,
1523
- ): void;
1563
+ setBrushMask(mask: BlockMaskList): void;
1564
+ /**
1565
+ * @remarks
1566
+ * This function can't be called in read-only mode.
1567
+ *
1568
+ */
1569
+ setBrushShape(shape: minecraftserver.Vector3[] | minecraftserver.CompoundBlockVolume): void;
1570
+ /**
1571
+ * @remarks
1572
+ * This function can't be called in read-only mode.
1573
+ *
1574
+ */
1575
+ setBrushShapeOffset(offset: minecraftserver.Vector3): void;
1524
1576
  /**
1525
1577
  * @remarks
1526
1578
  * This function can't be called in read-only mode.
@@ -1529,13 +1581,22 @@ export class BrushShapeManager {
1529
1581
  *
1530
1582
  * {@link Error}
1531
1583
  */
1532
- setBrushMask(mask: BlockMaskList): void;
1584
+ singlePaint(onComplete: (arg: PaintCompletionState) => void): void;
1533
1585
  /**
1534
1586
  * @remarks
1535
1587
  * This function can't be called in read-only mode.
1536
1588
  *
1537
1589
  */
1538
- setBrushShape(shape: minecraftserver.Vector3[] | minecraftserver.CompoundBlockVolume): void;
1590
+ switchBrushPaintMode(paintMode: PaintMode): void;
1591
+ /**
1592
+ * @remarks
1593
+ * This function can't be called in read-only mode.
1594
+ *
1595
+ * @throws This function can throw errors.
1596
+ *
1597
+ * {@link minecraftserver.Error}
1598
+ */
1599
+ switchBrushShape(name: string): minecraftserver.CompoundBlockVolume;
1539
1600
  /**
1540
1601
  * @remarks
1541
1602
  * This function can't be called in read-only mode.
@@ -2935,6 +2996,7 @@ export class ThemeSettings {
2935
2996
  */
2936
2997
  deleteTheme(id: string): void;
2937
2998
  getCurrentTheme(): string;
2999
+ getThemeColors(id: string): Record<string, minecraftserver.RGBA> | undefined;
2938
3000
  getThemeList(): string[];
2939
3001
  resolveColorKey(key: ThemeSettingsColorKey): minecraftserver.RGBA;
2940
3002
  /**
@@ -3790,10 +3852,19 @@ export class WidgetManager {
3790
3852
  deleteGroup(groupToDelete: WidgetGroup): void;
3791
3853
  }
3792
3854
 
3855
+ export class WidgetMouseButtonEventData {
3856
+ private constructor();
3857
+ readonly action: WidgetMouseButtonActionType;
3858
+ readonly altPressed: boolean;
3859
+ readonly controlPressed: boolean;
3860
+ readonly shiftPressed: boolean;
3861
+ }
3862
+
3793
3863
  export class WidgetStateChangeEventData {
3794
3864
  private constructor();
3795
3865
  readonly group: WidgetGroup;
3796
3866
  readonly location?: minecraftserver.Vector3;
3867
+ readonly mouseEvent?: WidgetMouseButtonEventData;
3797
3868
  readonly selected?: boolean;
3798
3869
  readonly visible?: boolean;
3799
3870
  readonly widget: Widget;
@@ -4976,6 +5047,7 @@ export interface IModalToolContainer {
4976
5047
  */
4977
5048
  readonly currentTools: IModalTool[];
4978
5049
  addTool(params: ModalToolCreationParameters, action?: RegisteredAction<NoArgsAction>): IModalTool;
5050
+ focusToolInputContext(): void;
4979
5051
  getSelectedToolId(): string | undefined;
4980
5052
  removeTool(id: string): void;
4981
5053
  setSelectedToolId(id: string | undefined): void;
@@ -5543,6 +5615,12 @@ export interface IPropertyPane {
5543
5615
  *
5544
5616
  */
5545
5617
  addText(value: IObservableProp<LocalizedString>, options?: ITextPropertyItemOptions): ITextPropertyItem;
5618
+ /**
5619
+ * @remarks
5620
+ * Adds a toggle button group to the pane.
5621
+ *
5622
+ */
5623
+ addToggleGroup(value: IObservableProp<number>, options?: IToggleGroupPropertyItemOptions): IToggleGroupPropertyItem;
5546
5624
  /**
5547
5625
  * @remarks
5548
5626
  * Adds a Vec3 item to the pane.
@@ -5703,6 +5781,13 @@ export interface IRootPropertyPaneOptions extends IPropertyPaneOptions {
5703
5781
  *
5704
5782
  */
5705
5783
  headerAction?: IRootPropertyPaneHeaderAction;
5784
+ /**
5785
+ * @remarks
5786
+ * Optional information tooltip for the pane to be displayed on
5787
+ * the header.
5788
+ *
5789
+ */
5790
+ infoTooltip?: TooltipInteractiveContent;
5706
5791
  }
5707
5792
 
5708
5793
  /**
@@ -6450,6 +6535,138 @@ export interface ITextPropertyItemOptions extends IPropertyItemOptionsBase {
6450
6535
  title?: LocalizedString;
6451
6536
  }
6452
6537
 
6538
+ /**
6539
+ * A property item which supports toggle button properties
6540
+ */
6541
+ // @ts-ignore Class inheritance allowed for native defined classes
6542
+ export interface IToggleGroupPropertyItem extends IPropertyItemBase {
6543
+ /**
6544
+ * @remarks
6545
+ * Current selected entry value.
6546
+ *
6547
+ */
6548
+ readonly value: number;
6549
+ /**
6550
+ * @remarks
6551
+ * Find a toggle entry at an index in the group.
6552
+ *
6553
+ * @param index
6554
+ * Index of the toggle entry in the list.
6555
+ */
6556
+ getEntryByIndex(index: number): IToggleGroupPropertyItemEntry | undefined;
6557
+ /**
6558
+ * @remarks
6559
+ * Find a toggle entry with a specific value associated with
6560
+ * property item.
6561
+ *
6562
+ * @param value
6563
+ * Value of the toggle entry in the group.
6564
+ */
6565
+ getEntryByValue(value: number): IToggleGroupPropertyItemEntry | undefined;
6566
+ /**
6567
+ * @remarks
6568
+ * Updates title of the property item.
6569
+ *
6570
+ * @param title
6571
+ * New title.
6572
+ */
6573
+ setTitle(title: LocalizedString | undefined): void;
6574
+ /**
6575
+ * @remarks
6576
+ * Updates tooltip of the property item.
6577
+ *
6578
+ * @param tooltip
6579
+ * New tooltip.
6580
+ */
6581
+ setTooltip(tooltip: LocalizedString | undefined): void;
6582
+ /**
6583
+ * @remarks
6584
+ * Update list of toggle group entries.
6585
+ *
6586
+ * @param entries
6587
+ * New list of updated entries.
6588
+ * @param newValue
6589
+ * New value value to use for the selected toggle button.
6590
+ */
6591
+ updateEntries(entries: IToggleGroupPropertyItemEntry[], newValue?: number): void;
6592
+ }
6593
+
6594
+ /**
6595
+ * Properties of toggle group property item list entry
6596
+ */
6597
+ export interface IToggleGroupPropertyItemEntry {
6598
+ /**
6599
+ * @remarks
6600
+ * Optional icon of the dropdown entry.
6601
+ *
6602
+ */
6603
+ readonly icon?: string;
6604
+ /**
6605
+ * @remarks
6606
+ * Localized display text of the entry.
6607
+ *
6608
+ */
6609
+ readonly label?: LocalizedString;
6610
+ /**
6611
+ * @remarks
6612
+ * Optional tooltip description text of the entry.
6613
+ *
6614
+ */
6615
+ readonly tooltip?: LocalizedString;
6616
+ /**
6617
+ * @remarks
6618
+ * The selectable value of the entry.
6619
+ *
6620
+ */
6621
+ readonly value: number;
6622
+ }
6623
+
6624
+ /**
6625
+ * Optional properties for Toggle Group property item
6626
+ */
6627
+ // @ts-ignore Class inheritance allowed for native defined classes
6628
+ export interface IToggleGroupPropertyItemOptions extends IPropertyItemOptionsBase {
6629
+ /**
6630
+ * @remarks
6631
+ * List of toggle button entries associated with the property
6632
+ * item. If undefined, list will be empty.
6633
+ *
6634
+ */
6635
+ entries?: IToggleGroupPropertyItemEntry[];
6636
+ /**
6637
+ * @remarks
6638
+ * If true toggle buttons will be displayed vertically with
6639
+ * their labels. If undefined, labels will be hidden.
6640
+ *
6641
+ */
6642
+ hiddenEntryLabels?: boolean;
6643
+ /**
6644
+ * @remarks
6645
+ * If true label text will be hidden. It will be visible by
6646
+ * default.
6647
+ *
6648
+ */
6649
+ hiddenLabel?: boolean;
6650
+ /**
6651
+ * @remarks
6652
+ * This callback is called when UI control value is changed.
6653
+ *
6654
+ */
6655
+ onChange?: (newValue: number, oldValue: number, items: IToggleGroupPropertyItemEntry[]) => void;
6656
+ /**
6657
+ * @remarks
6658
+ * Localized title of the property item.
6659
+ *
6660
+ */
6661
+ title?: LocalizedString;
6662
+ /**
6663
+ * @remarks
6664
+ * Tooltip description of the property item.
6665
+ *
6666
+ */
6667
+ tooltip?: LocalizedString;
6668
+ }
6669
+
6453
6670
  /**
6454
6671
  * A property item which supports Vector3 properties
6455
6672
  */
@@ -6605,6 +6822,14 @@ export declare function bindDataSource<T extends PropertyBag, Prop extends keyof
6605
6822
  propertyPane: IPropertyPane,
6606
6823
  target: T,
6607
6824
  ): T;
6825
+ /**
6826
+ * @remarks
6827
+ * Deserialize anything, defaults to the same behavior as
6828
+ * JSON.parse but will use custom deserializers passed into
6829
+ * {@link registerSerializationForType}.
6830
+ *
6831
+ */
6832
+ export declare function deserialize(s: string): unknown;
6608
6833
  /**
6609
6834
  * @remarks
6610
6835
  * Executes an operation over a selection via chunks to allow
@@ -6670,6 +6895,18 @@ export declare function registerEditorExtension<PerPlayerStorageType = Record<st
6670
6895
  shutdownFunction: ShutdownFunctionType<PerPlayerStorageType>,
6671
6896
  options?: IRegisterExtensionOptionalParameters,
6672
6897
  ): Extension;
6898
+ /**
6899
+ * @remarks
6900
+ * Register a type to have custom serialization/deserialization
6901
+ * when using {@link serialize} and {@link deserialize}.
6902
+ *
6903
+ */
6904
+ export declare function registerSerializationForType<T>(
6905
+ typeConstructor: Function,
6906
+ name: string,
6907
+ serializer: (obj: T) => Record<string, unknown>,
6908
+ deserializer: (vals: Record<string, unknown>) => T,
6909
+ ): void;
6673
6910
  /**
6674
6911
  * @remarks
6675
6912
  * Creates a strongly typed transaction handle to enforce type
@@ -6715,6 +6952,14 @@ export declare function registerUserDefinedTransactionHandler<T>(
6715
6952
  undoHandler: (payload: T) => void,
6716
6953
  redoHandler: (payload: T) => void,
6717
6954
  ): UserDefinedTransactionHandle<T>;
6955
+ /**
6956
+ * @remarks
6957
+ * Serialize anything, defaults to the same behavior as
6958
+ * JSON.stringify but will use custom serializers passed into
6959
+ * {@link registerSerializationForType}.
6960
+ *
6961
+ */
6962
+ export declare function serialize(obj: unknown): string;
6718
6963
  /**
6719
6964
  * @remarks
6720
6965
  * Small utility for getting a string from an unknown exception
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.40-preview.25",
3
+ "version": "0.1.0-beta.1.21.50-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.16.0-beta.1.21.40-preview.25"
17
+ "@minecraft/server": "^1.17.0-beta.1.21.50-preview.24"
18
18
  },
19
19
  "license": "MIT"
20
20
  }