@minecraft/server-editor 0.1.0-beta.1.21.130-preview.20 → 0.1.0-beta.1.21.130-preview.22

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 +217 -0
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -178,6 +178,10 @@ export declare enum CoreMenuType {
178
178
  WorldOptions = 'editor:menu:worldOptions',
179
179
  }
180
180
 
181
+ export declare enum CoreModalDialogType {
182
+ DataPicker = 0,
183
+ }
184
+
181
185
  /**
182
186
  * An enumeration used by the 3D block cursor {@link Cursor}
183
187
  */
@@ -244,6 +248,10 @@ export enum CursorTargetMode {
244
248
  Face = 1,
245
249
  }
246
250
 
251
+ export declare enum DataPickerModalDialogVariant {
252
+ Block = 0,
253
+ }
254
+
247
255
  export enum DaylightCycle {
248
256
  Normal = 0,
249
257
  AlwaysDay = 1,
@@ -992,6 +1000,20 @@ export enum LogChannel {
992
1000
  All = 3,
993
1001
  }
994
1002
 
1003
+ /**
1004
+ * Common response types for modal dialog
1005
+ */
1006
+ export declare enum ModalDialogResponseType {
1007
+ Confirm = 'confirm',
1008
+ Dismiss = 'dismiss',
1009
+ Error = 'error',
1010
+ }
1011
+
1012
+ export declare enum ModalDialogType {
1013
+ DataPicker = 0,
1014
+ Custom = 1,
1015
+ }
1016
+
995
1017
  /**
996
1018
  * Mouse device action categories
997
1019
  */
@@ -1397,6 +1419,7 @@ export type IPlayerUISession<PerPlayerStorage = Record<string, never>> = {
1397
1419
  readonly menuBar: IMenuContainer;
1398
1420
  readonly actionBar: IActionBar;
1399
1421
  readonly statusBar: IStatusBar;
1422
+ readonly dialogManager: IModalDialogManager;
1400
1423
  readonly toolRail: IModalToolContainer;
1401
1424
  readonly log: IPlayerLogger;
1402
1425
  readonly extensionContext: ExtensionContext;
@@ -1535,6 +1558,61 @@ export declare type LocalizedString =
1535
1558
  props?: string[];
1536
1559
  };
1537
1560
 
1561
+ /**
1562
+ * Parameters required to activate a modal dialog instance
1563
+ */
1564
+ export type ModalDialogActivationParams<T extends CoreModalDialogType | string> = {
1565
+ dialogId: T;
1566
+ onResponse?: (
1567
+ payload:
1568
+ | (T extends CoreModalDialogType ? ModalDialogCoreResponseType[T] : ModalDialogCustomResponse)
1569
+ | ModalDialogDismissResponse,
1570
+ ) => void;
1571
+ } & (T extends CoreModalDialogType
1572
+ ? {
1573
+ data: ModalDialogRequestData[T];
1574
+ }
1575
+ : {
1576
+ data?: never;
1577
+ });
1578
+
1579
+ /**
1580
+ * Response data for core modal dialogs
1581
+ */
1582
+ export type ModalDialogCoreResponseType = {
1583
+ [CoreModalDialogType.DataPicker]: ModalDialogDataPickerResponse;
1584
+ };
1585
+
1586
+ /**
1587
+ * Response data for custom modal dialog
1588
+ */
1589
+ export type ModalDialogCustomResponse = {
1590
+ type: ModalDialogResponseType | string;
1591
+ payload?: unknown;
1592
+ };
1593
+
1594
+ /**
1595
+ * Payloads that confirm data picker selection
1596
+ */
1597
+ export type ModalDialogDataPickerResponse = {
1598
+ type: ModalDialogResponseType.Confirm;
1599
+ selected: string;
1600
+ };
1601
+
1602
+ export type ModalDialogDismissResponse = {
1603
+ type: ModalDialogResponseType.Dismiss;
1604
+ };
1605
+
1606
+ /**
1607
+ * Data types supported by a modal dialog request
1608
+ */
1609
+ export type ModalDialogRequestData = {
1610
+ [CoreModalDialogType.DataPicker]: {
1611
+ default: string;
1612
+ variant: DataPickerModalDialogVariant;
1613
+ };
1614
+ };
1615
+
1538
1616
  /**
1539
1617
  * Modal tool lifecycle event payload
1540
1618
  */
@@ -6937,6 +7015,102 @@ export interface IModalControlPane extends IPane {
6937
7015
  addDivider(): IPropertyItemBase;
6938
7016
  }
6939
7017
 
7018
+ export interface IModalDialog {
7019
+ /**
7020
+ * @remarks
7021
+ * Identifier for the active request for this dialog
7022
+ *
7023
+ */
7024
+ readonly activeRequestId: string | undefined;
7025
+ /**
7026
+ * @remarks
7027
+ * Custom pane layout for the dialog
7028
+ *
7029
+ */
7030
+ readonly contentPane: IPropertyPane;
7031
+ /**
7032
+ * @remarks
7033
+ * Custom pane layout for the dialog
7034
+ *
7035
+ */
7036
+ readonly controlPane: IModalControlPane;
7037
+ /**
7038
+ * @remarks
7039
+ * Unique identifier for the dialog
7040
+ *
7041
+ */
7042
+ readonly id: string;
7043
+ /**
7044
+ * @remarks
7045
+ * Dispatches a dismiss message to the active request if it is
7046
+ * available
7047
+ *
7048
+ */
7049
+ sendDismiss(): void;
7050
+ /**
7051
+ * @remarks
7052
+ * Dispatches a response message to the active request if it is
7053
+ * available
7054
+ *
7055
+ * @param response
7056
+ * Response message to be handled by the active request
7057
+ */
7058
+ sendResponse(response: ModalDialogCustomResponse): void;
7059
+ }
7060
+
7061
+ /**
7062
+ * Represents modal dialog state for the specific activation
7063
+ * request
7064
+ */
7065
+ export interface IModalDialogActivationRequest {
7066
+ /**
7067
+ * @remarks
7068
+ * Unique identifier for the request
7069
+ *
7070
+ */
7071
+ readonly id: string;
7072
+ /**
7073
+ * @remarks
7074
+ * Determines if the request is still active
7075
+ *
7076
+ */
7077
+ readonly isValid: boolean;
7078
+ /**
7079
+ * @remarks
7080
+ * Cancels the request if it's still active
7081
+ *
7082
+ */
7083
+ cancel(): void;
7084
+ }
7085
+
7086
+ export interface IModalDialogManager {
7087
+ /**
7088
+ * @remarks
7089
+ * Creates a modal activation request for an existing modal
7090
+ * template
7091
+ *
7092
+ * @param params
7093
+ * Activation parameters
7094
+ */
7095
+ activateDialog<T extends CoreModalDialogType | string>(
7096
+ params: ModalDialogActivationParams<T>,
7097
+ ): IModalDialogActivationRequest;
7098
+ /**
7099
+ * @remarks
7100
+ * Removes the active modal from view
7101
+ *
7102
+ */
7103
+ dismissActiveDialog(): void;
7104
+ /**
7105
+ * @remarks
7106
+ * Creates a custom modal dialog with a property pane
7107
+ *
7108
+ * @param params
7109
+ * Creation parameters
7110
+ */
7111
+ registerDialog(params: ModalDialogCreationParams): IModalDialog;
7112
+ }
7113
+
6940
7114
  /**
6941
7115
  * A modal overlay pane is displayed over a root pane.
6942
7116
  */
@@ -8640,6 +8814,49 @@ export interface LogProperties {
8640
8814
  tags?: string[];
8641
8815
  }
8642
8816
 
8817
+ /**
8818
+ * Represents parameters to create a modal dialog
8819
+ */
8820
+ export interface ModalDialogCreationParams {
8821
+ /**
8822
+ * @remarks
8823
+ * Determines if the panel can be dismissed by the user
8824
+ * actions. If undefined, it will be true.
8825
+ *
8826
+ */
8827
+ canUserDismiss?: boolean;
8828
+ /**
8829
+ * @remarks
8830
+ * Panel height for the dialog
8831
+ *
8832
+ */
8833
+ height?: number;
8834
+ /**
8835
+ * @remarks
8836
+ * Callback to notify changes in active request
8837
+ *
8838
+ */
8839
+ onActiveRequestChange?: (requestId: string | undefined) => void;
8840
+ /**
8841
+ * @remarks
8842
+ * Dialog title
8843
+ *
8844
+ */
8845
+ title?: LocalizedString;
8846
+ /**
8847
+ * @remarks
8848
+ * Optional user defined unique identifier
8849
+ *
8850
+ */
8851
+ uniqueId?: string;
8852
+ /**
8853
+ * @remarks
8854
+ * Panel width for the dialog
8855
+ *
8856
+ */
8857
+ width?: number;
8858
+ }
8859
+
8643
8860
  /**
8644
8861
  * Parameters for creating a modal tool in the tool container
8645
8862
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.130-preview.20",
3
+ "version": "0.1.0-beta.1.21.130-preview.22",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,8 +14,8 @@
14
14
  ],
15
15
  "peerDependencies": {
16
16
  "@minecraft/common": "^1.0.0",
17
- "@minecraft/server": "^2.5.0-beta.1.21.130-preview.20",
18
- "@minecraft/vanilla-data": ">=1.20.70 || 1.21.130-preview.20"
17
+ "@minecraft/server": "^2.5.0-beta.1.21.130-preview.22",
18
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.21.130-preview.22"
19
19
  },
20
20
  "license": "MIT"
21
21
  }