@minecraft/server-ui 2.2.0-beta.1.26.40-preview.26 → 2.2.0-beta.1.26.40-preview.30

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 +61 -0
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -498,6 +498,31 @@ export class CustomForm {
498
498
  * {@link InvalidFormModificationError}
499
499
  */
500
500
  header(text: ObservableString | ObservableUIRawMessage | string | UIRawMessage, options?: TextOptions): CustomForm;
501
+ /**
502
+ * @beta
503
+ * @remarks
504
+ * Adds an image component to the form layout.
505
+ *
506
+ * This function can't be called in restricted-execution mode.
507
+ *
508
+ * @param src
509
+ * The image source path to display. Must be a relative path to
510
+ * an image file within the provided pack.
511
+ * @param pack
512
+ * The resource pack identifier that contains the provided
513
+ * image source.
514
+ * @param options
515
+ * Optional configuration for the image, such as visibility or
516
+ * width.
517
+ * @returns
518
+ * The form instance to allow method chaining.
519
+ * @throws This function can throw errors.
520
+ *
521
+ * {@link InvalidFormModificationError}
522
+ *
523
+ * {@link InvalidObservableError}
524
+ */
525
+ image(src: ObservableString | string, pack: ObservableString | string, options?: ImageOptions): CustomForm;
501
526
  /**
502
527
  * @remarks
503
528
  * Returns true if the form is currently being shown to the
@@ -1602,6 +1627,42 @@ export interface DropdownOptions {
1602
1627
  visible?: boolean | ObservableBoolean;
1603
1628
  }
1604
1629
 
1630
+ /**
1631
+ * @beta
1632
+ * Options for configuring an image component.
1633
+ */
1634
+ export interface ImageOptions {
1635
+ /**
1636
+ * @remarks
1637
+ * Sets a callback to be executed when the image is clicked.
1638
+ *
1639
+ */
1640
+ onClick?: () => void;
1641
+ /**
1642
+ * @remarks
1643
+ * Sets a tooltip to be displayed when the user hovers over the
1644
+ * image.
1645
+ *
1646
+ */
1647
+ tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
1648
+ /**
1649
+ * @remarks
1650
+ * When false or bound to a false ObservableBoolean, the image
1651
+ * is hidden.
1652
+ *
1653
+ */
1654
+ visible?: boolean | ObservableBoolean;
1655
+ /**
1656
+ * @remarks
1657
+ * Sets the width of the image as a percentage of the width of
1658
+ * the form. 1 is the entire form width, 0.5 is half of the
1659
+ * form width. Greater than 1 or less than/equal to 0 will
1660
+ * become 1.
1661
+ *
1662
+ */
1663
+ width?: number | ObservableNumber;
1664
+ }
1665
+
1605
1666
  /**
1606
1667
  * The result returned when an MessageBox is closed. Contains
1607
1668
  * the reason the message box was closed and the player's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-ui",
3
- "version": "2.2.0-beta.1.26.40-preview.26",
3
+ "version": "2.2.0-beta.1.26.40-preview.30",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "peerDependencies": {
16
16
  "@minecraft/common": "^1.0.0",
17
- "@minecraft/server": "^2.0.0 || ^2.10.0-beta.1.26.40-preview.26"
17
+ "@minecraft/server": "^2.0.0 || ^2.10.0-beta.1.26.40-preview.30"
18
18
  },
19
19
  "license": "MIT"
20
20
  }