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

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 +564 -0
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -955,6 +955,22 @@ export declare enum LayoutDirection {
955
955
  Horizontal = 1,
956
956
  }
957
957
 
958
+ export declare enum ListPaneEntryType {
959
+ Button = 0,
960
+ Bool = 1,
961
+ Image = 2,
962
+ Text = 3,
963
+ }
964
+
965
+ /**
966
+ * Determines how list pane slots will be sorted
967
+ */
968
+ export declare enum ListPaneViewSortType {
969
+ Default = 0,
970
+ AtoZ = 1,
971
+ ZtoA = 2,
972
+ }
973
+
958
974
  export enum LogChannel {
959
975
  /**
960
976
  * @remarks
@@ -1106,6 +1122,7 @@ export declare enum PropertyItemType {
1106
1122
  Dropdown = 'editorUI:Dropdown',
1107
1123
  Image = 'editorUI:Image',
1108
1124
  Link = 'editorUI:Link',
1125
+ ListPane = 'editorUI:ListPane',
1109
1126
  Menu = 'editorUI:Menu',
1110
1127
  Number = 'editorUI:Number',
1111
1128
  NumberTimeline = 'editorUI:NumberTimeline',
@@ -1405,6 +1422,108 @@ export type KeyBindingInfo = {
1405
1422
  tooltip?: string;
1406
1423
  };
1407
1424
 
1425
+ /**
1426
+ * Layout size definition
1427
+ */
1428
+ export declare type LayoutSize = {
1429
+ value: number;
1430
+ type?: 'default' | 'percentage';
1431
+ };
1432
+
1433
+ /**
1434
+ * List Pane Bool entry creation parameter
1435
+ */
1436
+ export type ListPaneBoolEntryParams = {
1437
+ type: ListPaneEntryType.Bool;
1438
+ value: IObservableProp<boolean>;
1439
+ tooltip?: BasicTooltipContent;
1440
+ icon?: string;
1441
+ enabled?: boolean;
1442
+ visible?: boolean;
1443
+ onChange?: (newValue: boolean, oldValue: boolean, entry: IListPaneBoolEntry) => void;
1444
+ };
1445
+
1446
+ /**
1447
+ * List Pane Button entry creation parameter
1448
+ */
1449
+ export type ListPaneButtonEntryParams = {
1450
+ type: ListPaneEntryType.Button;
1451
+ onClick: (entry: IListPaneButtonEntry) => void;
1452
+ title?: LocalizedString;
1453
+ tooltip?: BasicTooltipContent;
1454
+ variant?: ButtonPropertyItemVariant;
1455
+ icon?: string;
1456
+ enabled?: boolean;
1457
+ visible?: boolean;
1458
+ };
1459
+
1460
+ /**
1461
+ * List Pane entry type map
1462
+ */
1463
+ export type ListPaneEntryMap = {
1464
+ [ListPaneEntryType.Button]: IListPaneEntry;
1465
+ [ListPaneEntryType.Bool]: IListPaneBoolEntry;
1466
+ [ListPaneEntryType.Image]: IListPaneImageEntry;
1467
+ [ListPaneEntryType.Text]: IListPaneTextEntry;
1468
+ };
1469
+
1470
+ /**
1471
+ * List Pane entry creation parameters
1472
+ */
1473
+ export type ListPaneEntryParams =
1474
+ | ListPaneButtonEntryParams
1475
+ | ListPaneBoolEntryParams
1476
+ | ListPaneTextEntryParams
1477
+ | ListPaneImageEntryParams;
1478
+
1479
+ /**
1480
+ * List Pane Image entry creation parameter
1481
+ */
1482
+ export type ListPaneImageEntryParams = {
1483
+ type: ListPaneEntryType.Image;
1484
+ value: IObservableProp<ImageResourceData>;
1485
+ visible?: boolean;
1486
+ };
1487
+
1488
+ /**
1489
+ * Properties required to create a slot
1490
+ */
1491
+ export type ListPaneSlotCreationProps = {
1492
+ entries: ListPaneEntryParams[];
1493
+ options?: IListPaneSlotOptions;
1494
+ };
1495
+
1496
+ export declare type ListPaneSlotLayout = {
1497
+ height: number;
1498
+ columns?: number;
1499
+ clickable?: boolean;
1500
+ outline?: boolean;
1501
+ entryLayout: ListPaneSlotLayoutEntry[];
1502
+ };
1503
+
1504
+ export declare type ListPaneSlotLayoutEntry = {
1505
+ type: ListPaneEntryType;
1506
+ size?: number | LayoutSize | 'shrink' | 'grow';
1507
+ alignment?: LayoutAlignment;
1508
+ };
1509
+
1510
+ /**
1511
+ * List Pane Text entry creation parameter
1512
+ */
1513
+ export type ListPaneTextEntryParams = {
1514
+ type: ListPaneEntryType.Text;
1515
+ value?: IObservableProp<LocalizedString>;
1516
+ visible?: boolean;
1517
+ };
1518
+
1519
+ /**
1520
+ * Determines filtering properties for list pane
1521
+ */
1522
+ export declare type ListPaneViewFilter = {
1523
+ slots?: string[];
1524
+ tags?: string[];
1525
+ };
1526
+
1408
1527
  /**
1409
1528
  * Represents a localized string or an object with a localized
1410
1529
  * string and optional properties
@@ -6134,6 +6253,444 @@ export interface ILinkPropertyItemOptions extends IPropertyItemOptionsBase {
6134
6253
  tooltip?: LocalizedString;
6135
6254
  }
6136
6255
 
6256
+ /**
6257
+ * List Pane button entry
6258
+ */
6259
+ // @ts-ignore Class inheritance allowed for native defined classes
6260
+ export interface IListPaneBoolEntry extends IListPaneEntry {
6261
+ /**
6262
+ * @remarks
6263
+ * Enabled state of the entry.
6264
+ *
6265
+ */
6266
+ readonly enabled: boolean;
6267
+ /**
6268
+ * @remarks
6269
+ * Value of the entry.
6270
+ *
6271
+ */
6272
+ readonly value: boolean;
6273
+ /**
6274
+ * @remarks
6275
+ * Updates enabled state of the entry.
6276
+ *
6277
+ * @param enabled
6278
+ * New enabled state.
6279
+ */
6280
+ setEnabled(enabled: true): void;
6281
+ /**
6282
+ * @remarks
6283
+ * Updates tooltip of the entry.
6284
+ *
6285
+ * @param tooltip
6286
+ * New tooltip.
6287
+ */
6288
+ setTooltip(tooltip: BasicTooltipContent): void;
6289
+ /**
6290
+ * @remarks
6291
+ * Updates value of the entry.
6292
+ *
6293
+ * @param value
6294
+ * New value.
6295
+ */
6296
+ setValue(value: boolean): void;
6297
+ }
6298
+
6299
+ /**
6300
+ * List Pane button entry
6301
+ */
6302
+ // @ts-ignore Class inheritance allowed for native defined classes
6303
+ export interface IListPaneButtonEntry extends IListPaneEntry {
6304
+ /**
6305
+ * @remarks
6306
+ * Enabled state of the entry.
6307
+ *
6308
+ */
6309
+ readonly enabled: boolean;
6310
+ /**
6311
+ * @remarks
6312
+ * Updates enabled state of the entry.
6313
+ *
6314
+ * @param enabled
6315
+ * New enabled state.
6316
+ */
6317
+ setEnabled(enabled: true): void;
6318
+ /**
6319
+ * @remarks
6320
+ * Updates icon of the entry.
6321
+ *
6322
+ * @param icon
6323
+ * New icon.
6324
+ */
6325
+ setIcon(icon: string): void;
6326
+ /**
6327
+ * @remarks
6328
+ * Updates title of the entry.
6329
+ *
6330
+ * @param title
6331
+ * New title.
6332
+ */
6333
+ setTitle(title: string): void;
6334
+ /**
6335
+ * @remarks
6336
+ * Updates tooltip of the entry.
6337
+ *
6338
+ * @param tooltip
6339
+ * New tooltip.
6340
+ */
6341
+ setTooltip(tooltip: BasicTooltipContent): void;
6342
+ }
6343
+
6344
+ /**
6345
+ * List Pane entry
6346
+ */
6347
+ export interface IListPaneEntry {
6348
+ /**
6349
+ * @remarks
6350
+ * Sequence index of the entry.
6351
+ *
6352
+ */
6353
+ readonly index: number;
6354
+ /**
6355
+ * @remarks
6356
+ * Slot that owns the entry.
6357
+ *
6358
+ */
6359
+ readonly slot: IListPaneSlot;
6360
+ /**
6361
+ * @remarks
6362
+ * Type of the entry.
6363
+ *
6364
+ */
6365
+ readonly type: ListPaneEntryType;
6366
+ /**
6367
+ * @remarks
6368
+ * Visibility state of the entry.
6369
+ *
6370
+ */
6371
+ readonly visible: boolean;
6372
+ /**
6373
+ * @remarks
6374
+ * Updates visibility of the entry.
6375
+ *
6376
+ * @param visible
6377
+ * New value.
6378
+ */
6379
+ setVisible(visible: boolean): void;
6380
+ }
6381
+
6382
+ /**
6383
+ * List Pane image entry
6384
+ */
6385
+ // @ts-ignore Class inheritance allowed for native defined classes
6386
+ export interface IListPaneImageEntry extends IListPaneEntry {
6387
+ /**
6388
+ * @remarks
6389
+ * Value of the entry.
6390
+ *
6391
+ */
6392
+ readonly value: Readonly<ImageResourceData>;
6393
+ /**
6394
+ * @remarks
6395
+ * Updates value of the entry.
6396
+ *
6397
+ * @param value
6398
+ * New value.
6399
+ */
6400
+ setValue(value: ImageResourceData): void;
6401
+ }
6402
+
6403
+ /**
6404
+ * A property item which supports Sub Pane properties
6405
+ */
6406
+ // @ts-ignore Class inheritance allowed for native defined classes
6407
+ export interface IListPanePropertyItem extends IPropertyItemBase, IPane {
6408
+ /**
6409
+ * @remarks
6410
+ * Count of the slots managed by the list.
6411
+ *
6412
+ */
6413
+ readonly slotCount: number;
6414
+ /**
6415
+ * @remarks
6416
+ * Current sorting type for the pane slots
6417
+ *
6418
+ */
6419
+ readonly viewSortType: ListPaneViewSortType;
6420
+ /**
6421
+ * @remarks
6422
+ * Adds a new slot to the list.
6423
+ *
6424
+ */
6425
+ addSlot(params: ListPaneSlotCreationProps): IListPaneSlot;
6426
+ /**
6427
+ * @remarks
6428
+ * Finds the slot with the identifier.
6429
+ *
6430
+ * @param id
6431
+ * Unique identifier of the slot.
6432
+ */
6433
+ getSlotById(id: string): IListPaneSlot | undefined;
6434
+ /**
6435
+ * @remarks
6436
+ * Finds the slot with the index.
6437
+ *
6438
+ * @param index
6439
+ * Index of the slot in the component list.
6440
+ */
6441
+ getSlotByIndex(index: number): IListPaneSlot | undefined;
6442
+ /**
6443
+ * @remarks
6444
+ * @returns
6445
+ * Active view filter
6446
+ */
6447
+ getViewFilter(): ListPaneViewFilter | undefined;
6448
+ /**
6449
+ * @remarks
6450
+ * Removes the slot from the list.
6451
+ *
6452
+ * @param id
6453
+ * Unique identifier of the slot.
6454
+ */
6455
+ removeSlot(id: string): void;
6456
+ /**
6457
+ * @remarks
6458
+ * Selects slot by id.
6459
+ *
6460
+ * @param id
6461
+ * Unique identifier of the slot.
6462
+ * @param deselectOtherSlots
6463
+ * Deselects already selected slots if defined.
6464
+ */
6465
+ selectSlot(id: string, deselectOtherSlots?: boolean): void;
6466
+ /**
6467
+ * @remarks
6468
+ * Filters displaying slots to match the define properties
6469
+ *
6470
+ * @param filter
6471
+ * Slots that don't match filter properties won't be included.
6472
+ */
6473
+ setViewFilter(filter: ListPaneViewFilter | undefined): void;
6474
+ /**
6475
+ * @remarks
6476
+ * Updates how slots will be sorted in the view
6477
+ *
6478
+ * @param sortType
6479
+ * New sort type, it undefined Default will be used.
6480
+ */
6481
+ setViewSortType(sortType: ListPaneViewSortType | undefined): void;
6482
+ /**
6483
+ * @remarks
6484
+ * Updates all slots with the new list.
6485
+ *
6486
+ * @param newSlots
6487
+ * Creation properties for the new slots.
6488
+ */
6489
+ updateSlots(newSlots: ListPaneSlotCreationProps[]): void;
6490
+ }
6491
+
6492
+ /**
6493
+ * Optional properties for List Pane property item
6494
+ */
6495
+ // @ts-ignore Class inheritance allowed for native defined classes
6496
+ export interface IListPanePropertyItemOptions extends IPropertyItemOptionsBase {
6497
+ /**
6498
+ * @remarks
6499
+ * This will be the height of the list withing the pane
6500
+ *
6501
+ */
6502
+ defaultSlots?: ListPaneSlotCreationProps[];
6503
+ /**
6504
+ * @remarks
6505
+ * This will be the height of the list withing the pane
6506
+ *
6507
+ */
6508
+ height?: number;
6509
+ /**
6510
+ * @remarks
6511
+ * Layout for the list will need to be predefined, and using
6512
+ * wrong layout shape while creating slots will throw
6513
+ *
6514
+ */
6515
+ layout: ListPaneSlotLayout;
6516
+ /**
6517
+ * @remarks
6518
+ * This callback is fired whenever a clickable slot is pressed
6519
+ *
6520
+ */
6521
+ onSlotClicked?: (slot: IListPaneSlot) => void;
6522
+ /**
6523
+ * @remarks
6524
+ * This callback is fired whenever selected state of a slot is
6525
+ * changed
6526
+ *
6527
+ */
6528
+ onSlotSelectionChange?: (slot: IListPaneSlot, state: boolean) => void;
6529
+ /**
6530
+ * @remarks
6531
+ * Localized title of the property item.
6532
+ *
6533
+ */
6534
+ title?: LocalizedString;
6535
+ /**
6536
+ * @remarks
6537
+ * Filter properties for viewing subset of slots.
6538
+ *
6539
+ */
6540
+ viewFilter?: ListPaneViewFilter;
6541
+ /**
6542
+ * @remarks
6543
+ * Sort type for the slots in the view. If undefined, default
6544
+ * list order will be used.
6545
+ *
6546
+ */
6547
+ viewSortType?: ListPaneViewSortType;
6548
+ }
6549
+
6550
+ /**
6551
+ * List Pane slot
6552
+ */
6553
+ export interface IListPaneSlot {
6554
+ /**
6555
+ * @remarks
6556
+ * Count of entries.
6557
+ *
6558
+ */
6559
+ readonly entryCount: number;
6560
+ /**
6561
+ * @remarks
6562
+ * Unique identifier of the slot.
6563
+ *
6564
+ */
6565
+ readonly id: string;
6566
+ /**
6567
+ * @remarks
6568
+ * Unique identifier of the parent pane.
6569
+ *
6570
+ */
6571
+ readonly paneId: string;
6572
+ /**
6573
+ * @remarks
6574
+ * Selected state of the slot.
6575
+ *
6576
+ */
6577
+ readonly selected: boolean;
6578
+ /**
6579
+ * @remarks
6580
+ * List of tags associated with the slot.
6581
+ *
6582
+ */
6583
+ readonly tags: ReadonlyArray<string>;
6584
+ /**
6585
+ * @remarks
6586
+ * Count of entries.
6587
+ *
6588
+ */
6589
+ readonly title: LocalizedString;
6590
+ /**
6591
+ * @remarks
6592
+ * Finds the entry with the index if it exists.
6593
+ *
6594
+ * @param index
6595
+ * Sequence index of the entry in the slot.
6596
+ * @param type
6597
+ * Optional type check for the entry.
6598
+ */
6599
+ getEntry<K extends ListPaneEntryType | undefined = undefined>(
6600
+ index: number,
6601
+ type?: K,
6602
+ ): (K extends ListPaneEntryType ? ListPaneEntryMap[K] : IListPaneEntry) | undefined;
6603
+ /**
6604
+ * @remarks
6605
+ * @returns
6606
+ * User data associated with the slot.
6607
+ */
6608
+ getUserData(): unknown;
6609
+ /**
6610
+ * @remarks
6611
+ * Updates selected state of the slot.
6612
+ *
6613
+ * @param selected
6614
+ * New selected state.
6615
+ */
6616
+ setSelected(selected: boolean): void;
6617
+ /**
6618
+ * @remarks
6619
+ * Updates tags of the slot.
6620
+ *
6621
+ * @param tags
6622
+ * New tag list.
6623
+ */
6624
+ setTags(tags: string[] | undefined): void;
6625
+ /**
6626
+ * @remarks
6627
+ * Updates title of the slot.
6628
+ *
6629
+ * @param title
6630
+ * New title.
6631
+ */
6632
+ setTitle(title: LocalizedString): void;
6633
+ /**
6634
+ * @remarks
6635
+ * Updates user data associated with the slot
6636
+ *
6637
+ * @param data
6638
+ * New user data.
6639
+ */
6640
+ setUserData(data: unknown): void;
6641
+ }
6642
+
6643
+ /**
6644
+ * List Pane slot optional properties
6645
+ */
6646
+ export interface IListPaneSlotOptions {
6647
+ /**
6648
+ * @remarks
6649
+ * List of tags associated with the slot.
6650
+ *
6651
+ */
6652
+ tags?: string[];
6653
+ /**
6654
+ * @remarks
6655
+ * Localized title of the slot.
6656
+ *
6657
+ */
6658
+ title?: LocalizedString;
6659
+ /**
6660
+ * @remarks
6661
+ * Unique identifier to use for the slot.
6662
+ *
6663
+ */
6664
+ uniqueId?: string;
6665
+ /**
6666
+ * @remarks
6667
+ * Optional user data that can be associated with a slot.
6668
+ *
6669
+ */
6670
+ userData?: unknown;
6671
+ }
6672
+
6673
+ /**
6674
+ * List Pane text entry
6675
+ */
6676
+ // @ts-ignore Class inheritance allowed for native defined classes
6677
+ export interface IListPaneTextEntry extends IListPaneEntry {
6678
+ /**
6679
+ * @remarks
6680
+ * Value of the entry.
6681
+ *
6682
+ */
6683
+ readonly value: Readonly<LocalizedString>;
6684
+ /**
6685
+ * @remarks
6686
+ * Updates value of the entry.
6687
+ *
6688
+ * @param value
6689
+ * New value.
6690
+ */
6691
+ setValue(value: LocalizedString): void;
6692
+ }
6693
+
6137
6694
  export interface IMenu {
6138
6695
  /**
6139
6696
  * @remarks
@@ -7162,6 +7719,13 @@ export interface IPropertyPane extends IPane {
7162
7719
  *
7163
7720
  */
7164
7721
  addLink(value: IObservableProp<string>, options?: ILinkPropertyItemOptions): ILinkPropertyItem;
7722
+ /**
7723
+ * @remarks
7724
+ * Adds a pane for displaying list of items in a predefined
7725
+ * layout.
7726
+ *
7727
+ */
7728
+ addListPane(options: IListPanePropertyItemOptions): IListPanePropertyItem;
7165
7729
  /**
7166
7730
  * @remarks
7167
7731
  * Adds a menu button property item to the pane.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-editor",
3
- "version": "0.1.0-beta.1.21.120-preview.25",
3
+ "version": "0.1.0-beta.1.21.130-preview.20",
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.4.0-beta.1.21.120-preview.25",
18
- "@minecraft/vanilla-data": ">=1.20.70 || 1.21.120-preview.25"
17
+ "@minecraft/server": "^2.5.0-beta.1.21.130-preview.20",
18
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.21.130-preview.20"
19
19
  },
20
20
  "license": "MIT"
21
21
  }