@minecraft/server-ui 2.1.0-beta.1.26.30-preview.25 → 2.1.0-beta.1.26.30-preview.27
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.
- package/index.d.ts +762 -221
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -35,32 +35,32 @@ import * as minecraftcommon from '@minecraft/common';
|
|
|
35
35
|
import * as minecraftserver from '@minecraft/server';
|
|
36
36
|
/**
|
|
37
37
|
* @beta
|
|
38
|
-
* The reason why a data driven screen (
|
|
38
|
+
* The reason why a data driven UI screen (MessageBox or
|
|
39
39
|
* CustomForm) was closed.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export enum DataDrivenScreenClosedReason {
|
|
42
42
|
/**
|
|
43
43
|
* @remarks
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* The screen was closed by the client (e.g., the player
|
|
45
|
+
* dismissed it or there was a client authoritative close
|
|
46
|
+
* button).
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
+
ClientClosed = 'ClientClosed',
|
|
49
50
|
/**
|
|
50
51
|
* @remarks
|
|
51
|
-
*
|
|
52
|
+
* The screen was closed by the server, likely by the close
|
|
53
|
+
* API.
|
|
52
54
|
*
|
|
53
55
|
*/
|
|
54
|
-
|
|
56
|
+
ServerClosed = 'ServerClosed',
|
|
55
57
|
/**
|
|
56
58
|
* @remarks
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* message box, the 'Close' button on a custom form, or either
|
|
60
|
-
* button in the message box)
|
|
59
|
+
* The screen could not be shown because the player was busy
|
|
60
|
+
* with another UI interaction.
|
|
61
61
|
*
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
UserBusy = 'UserBusy',
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export enum FormCancelationReason {
|
|
@@ -74,13 +74,34 @@ export enum FormRejectReason {
|
|
|
74
74
|
ServerShutdown = 'ServerShutdown',
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* @beta
|
|
79
|
+
* The reason why a form visibility operation failed.
|
|
80
|
+
*/
|
|
81
|
+
export enum FormVisibilityErrorReason {
|
|
82
|
+
/**
|
|
83
|
+
* @remarks
|
|
84
|
+
* The operation failed because the form is already being shown
|
|
85
|
+
* to the player.
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
AlreadyShowing = 'AlreadyShowing',
|
|
89
|
+
/**
|
|
90
|
+
* @remarks
|
|
91
|
+
* The operation failed because the form is not currently being
|
|
92
|
+
* shown to the player.
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
NotShowing = 'NotShowing',
|
|
96
|
+
}
|
|
97
|
+
|
|
77
98
|
/**
|
|
78
99
|
* @beta
|
|
79
100
|
* An enum representing the errors that can occur during text
|
|
80
101
|
* filtering. This is used to provide more context about the
|
|
81
102
|
* filtering process.
|
|
82
103
|
*/
|
|
83
|
-
export
|
|
104
|
+
export enum TextFilteringError {
|
|
84
105
|
/**
|
|
85
106
|
* @remarks
|
|
86
107
|
* The text was not filtered because the player disabled text
|
|
@@ -303,151 +324,290 @@ export class ActionFormResponse extends FormResponse {
|
|
|
303
324
|
|
|
304
325
|
/**
|
|
305
326
|
* @beta
|
|
306
|
-
* A customizable form that lets you
|
|
307
|
-
* toggles, dropdowns, sliders,
|
|
308
|
-
*
|
|
309
|
-
*
|
|
327
|
+
* A customizable data driven (DDUI) form that lets you add
|
|
328
|
+
* buttons, labels, toggles, dropdowns, sliders, text fields,
|
|
329
|
+
* and more. The form layout is built by calling methods to add
|
|
330
|
+
* components before calling show(). Any Observable values
|
|
331
|
+
* bound to form components will automatically update the UI
|
|
332
|
+
* when their values change.
|
|
310
333
|
*/
|
|
311
|
-
export
|
|
334
|
+
export class CustomForm {
|
|
312
335
|
/**
|
|
313
336
|
* @remarks
|
|
314
|
-
*
|
|
315
|
-
*
|
|
337
|
+
* Creates a new CustomForm for the specified player with the
|
|
338
|
+
* given title.
|
|
339
|
+
*
|
|
340
|
+
* @param player
|
|
341
|
+
* The player to show this form to.
|
|
342
|
+
* @param title
|
|
343
|
+
* The title text to display at the top of the form.
|
|
344
|
+
* @throws This function can throw errors.
|
|
316
345
|
*
|
|
346
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
347
|
+
*/
|
|
348
|
+
constructor(
|
|
349
|
+
player: minecraftserver.Player,
|
|
350
|
+
title: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
351
|
+
);
|
|
352
|
+
/**
|
|
353
|
+
* @remarks
|
|
354
|
+
* Adds a clickable button to the form layout. Returns the form
|
|
355
|
+
* instance to allow method chaining.
|
|
356
|
+
*
|
|
357
|
+
* This function can't be called in restricted-execution mode.
|
|
358
|
+
*
|
|
359
|
+
* @param label
|
|
360
|
+
* The text label to display on the button.
|
|
361
|
+
* @param onClick
|
|
362
|
+
* A callback function that is invoked when the player clicks
|
|
363
|
+
* the button.
|
|
364
|
+
* @param options
|
|
365
|
+
* Optional configuration for the button, such as a tooltip,
|
|
366
|
+
* disabled state, or visibility.
|
|
367
|
+
* @throws This function can throw errors.
|
|
368
|
+
*
|
|
369
|
+
* {@link InvalidFormModificationError}
|
|
317
370
|
*/
|
|
318
371
|
button(
|
|
319
|
-
label:
|
|
372
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
320
373
|
onClick: () => void,
|
|
321
374
|
options?: ButtonOptions,
|
|
322
375
|
): CustomForm;
|
|
323
376
|
/**
|
|
324
377
|
* @remarks
|
|
325
|
-
*
|
|
326
|
-
* form is not
|
|
378
|
+
* Closes the form if it is currently being shown to the
|
|
379
|
+
* player. Throws a FormVisibilityError if the form is not
|
|
380
|
+
* currently open.
|
|
381
|
+
*
|
|
382
|
+
* This function can't be called in restricted-execution mode.
|
|
383
|
+
*
|
|
384
|
+
* @throws This function can throw errors.
|
|
385
|
+
*
|
|
386
|
+
* {@link minecraftcommon.EngineError}
|
|
387
|
+
*
|
|
388
|
+
* {@link FormVisibilityError}
|
|
327
389
|
*
|
|
390
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
328
391
|
*/
|
|
329
392
|
close(): void;
|
|
330
393
|
/**
|
|
331
394
|
* @remarks
|
|
332
|
-
* Adds a close
|
|
395
|
+
* Adds a close button to the form at the bottom and as an 'X'
|
|
396
|
+
* in the corner. Returns the form instance to allow method
|
|
397
|
+
* chaining.
|
|
333
398
|
*
|
|
399
|
+
* This function can't be called in restricted-execution mode.
|
|
400
|
+
*
|
|
401
|
+
* @throws This function can throw errors.
|
|
402
|
+
*
|
|
403
|
+
* {@link InvalidFormModificationError}
|
|
334
404
|
*/
|
|
335
405
|
closeButton(): CustomForm;
|
|
336
406
|
/**
|
|
337
407
|
* @remarks
|
|
338
|
-
*
|
|
408
|
+
* Adds a horizontal divider line to the form layout. Useful
|
|
409
|
+
* for visually separating sections of the form. Returns the
|
|
410
|
+
* form instance to allow method chaining.
|
|
411
|
+
*
|
|
412
|
+
* This function can't be called in restricted-execution mode.
|
|
413
|
+
*
|
|
414
|
+
* @param options
|
|
415
|
+
* Optional configuration for the divider, such as visibility.
|
|
416
|
+
* @throws This function can throw errors.
|
|
339
417
|
*
|
|
418
|
+
* {@link InvalidFormModificationError}
|
|
340
419
|
*/
|
|
341
420
|
divider(options?: DividerOptions): CustomForm;
|
|
342
421
|
/**
|
|
343
422
|
* @remarks
|
|
344
|
-
*
|
|
345
|
-
*
|
|
423
|
+
* Adds a dropdown selection control to the form layout. The
|
|
424
|
+
* current selection is tracked via an ObservableNumber and
|
|
425
|
+
* will update when the player changes the selection. Returns
|
|
426
|
+
* the form instance to allow method chaining.
|
|
346
427
|
*
|
|
428
|
+
* This function can't be called in restricted-execution mode.
|
|
429
|
+
*
|
|
430
|
+
* @param label
|
|
431
|
+
* The text label displayed around the dropdown.
|
|
432
|
+
* @param value
|
|
433
|
+
* An ObservableNumber that holds the index of the currently
|
|
434
|
+
* selected item.
|
|
435
|
+
* @param items
|
|
436
|
+
* The list of items to display in the dropdown.
|
|
437
|
+
* @param options
|
|
438
|
+
* Optional configuration for the dropdown, such as a
|
|
439
|
+
* description, disabled state, or visibility.
|
|
440
|
+
* @throws This function can throw errors.
|
|
441
|
+
*
|
|
442
|
+
* {@link InvalidFormModificationError}
|
|
347
443
|
*/
|
|
348
444
|
dropdown(
|
|
349
|
-
label:
|
|
350
|
-
value:
|
|
351
|
-
items:
|
|
445
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
446
|
+
value: ObservableNumber,
|
|
447
|
+
items: DropdownItemData[],
|
|
352
448
|
options?: DropdownOptions,
|
|
353
449
|
): CustomForm;
|
|
354
450
|
/**
|
|
355
451
|
* @remarks
|
|
356
|
-
*
|
|
357
|
-
*
|
|
452
|
+
* Adds a header text component to the form layout. Headers are
|
|
453
|
+
* displayed in a larger or bolder style than regular labels,
|
|
454
|
+
* and are suitable for section titles. Returns the form
|
|
455
|
+
* instance to allow method chaining.
|
|
456
|
+
*
|
|
457
|
+
* This function can't be called in restricted-execution mode.
|
|
458
|
+
*
|
|
459
|
+
* @param text
|
|
460
|
+
* The header text to display.
|
|
461
|
+
* @param options
|
|
462
|
+
* Optional configuration for the header, such as visibility.
|
|
463
|
+
* @throws This function can throw errors.
|
|
358
464
|
*
|
|
465
|
+
* {@link InvalidFormModificationError}
|
|
359
466
|
*/
|
|
360
|
-
header(
|
|
361
|
-
text: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
362
|
-
options?: TextOptions,
|
|
363
|
-
): CustomForm;
|
|
467
|
+
header(text: ObservableString | ObservableUIRawMessage | string | UIRawMessage, options?: TextOptions): CustomForm;
|
|
364
468
|
/**
|
|
365
469
|
* @remarks
|
|
366
470
|
* Returns true if the form is currently being shown to the
|
|
367
|
-
* player.
|
|
471
|
+
* player, false otherwise.
|
|
472
|
+
*
|
|
473
|
+
* This function can't be called in restricted-execution mode.
|
|
368
474
|
*
|
|
369
475
|
*/
|
|
370
476
|
isShowing(): boolean;
|
|
371
477
|
/**
|
|
372
478
|
* @remarks
|
|
373
|
-
*
|
|
374
|
-
* form.
|
|
479
|
+
* Adds a read-only text label to the form layout. Returns the
|
|
480
|
+
* form instance to allow method chaining.
|
|
375
481
|
*
|
|
482
|
+
* This function can't be called in restricted-execution mode.
|
|
483
|
+
*
|
|
484
|
+
* @param text
|
|
485
|
+
* The text to display in the label.
|
|
486
|
+
* @param options
|
|
487
|
+
* Optional configuration for the label, such as visibility.
|
|
488
|
+
* @throws This function can throw errors.
|
|
489
|
+
*
|
|
490
|
+
* {@link InvalidFormModificationError}
|
|
376
491
|
*/
|
|
377
|
-
label(
|
|
378
|
-
text: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
379
|
-
options?: TextOptions,
|
|
380
|
-
): CustomForm;
|
|
492
|
+
label(text: ObservableString | ObservableUIRawMessage | string | UIRawMessage, options?: TextOptions): CustomForm;
|
|
381
493
|
/**
|
|
382
494
|
* @remarks
|
|
383
|
-
* Shows the form to the player.
|
|
384
|
-
*
|
|
385
|
-
*
|
|
495
|
+
* Shows the form to the player. Returns a promise that
|
|
496
|
+
* resolves with a DataDrivenScreenClosedReason indicating how
|
|
497
|
+
* the form was closed.
|
|
498
|
+
*
|
|
499
|
+
* This function can't be called in restricted-execution mode.
|
|
386
500
|
*
|
|
387
|
-
* @throws
|
|
388
|
-
*
|
|
501
|
+
* @throws This function can throw errors.
|
|
502
|
+
*
|
|
503
|
+
* {@link minecraftcommon.EngineError}
|
|
504
|
+
*
|
|
505
|
+
* {@link FormVisibilityError}
|
|
506
|
+
*
|
|
507
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
389
508
|
*/
|
|
390
509
|
show(): Promise<DataDrivenScreenClosedReason>;
|
|
391
510
|
/**
|
|
392
511
|
* @remarks
|
|
393
|
-
*
|
|
394
|
-
*
|
|
512
|
+
* Adds a numeric slider control to the form layout. The
|
|
513
|
+
* current value is tracked via an ObservableNumber and will
|
|
514
|
+
* update as the player moves the slider. Returns the form
|
|
515
|
+
* instance to allow method chaining.
|
|
516
|
+
*
|
|
517
|
+
* This function can't be called in restricted-execution mode.
|
|
518
|
+
*
|
|
519
|
+
* @param label
|
|
520
|
+
* The text label displayed around the slider.
|
|
521
|
+
* @param value
|
|
522
|
+
* An ObservableNumber that holds the current value of the
|
|
523
|
+
* slider.
|
|
524
|
+
* @param min
|
|
525
|
+
* The minimum value of the slider range.
|
|
526
|
+
* @param max
|
|
527
|
+
* The maximum value of the slider range.
|
|
528
|
+
* @param options
|
|
529
|
+
* Optional configuration for the slider, such as step size, a
|
|
530
|
+
* description, disabled state, or visibility.
|
|
531
|
+
* @throws This function can throw errors.
|
|
395
532
|
*
|
|
533
|
+
* {@link InvalidFormModificationError}
|
|
396
534
|
*/
|
|
397
535
|
slider(
|
|
398
|
-
label:
|
|
399
|
-
value:
|
|
400
|
-
|
|
401
|
-
|
|
536
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
537
|
+
value: ObservableNumber,
|
|
538
|
+
min: number | ObservableNumber,
|
|
539
|
+
max: number | ObservableNumber,
|
|
402
540
|
options?: SliderOptions,
|
|
403
541
|
): CustomForm;
|
|
404
542
|
/**
|
|
405
543
|
* @remarks
|
|
406
|
-
*
|
|
544
|
+
* Adds a vertical spacer component to the form layout. Useful
|
|
545
|
+
* for adding empty space between form components. Returns the
|
|
546
|
+
* form instance to allow method chaining.
|
|
407
547
|
*
|
|
548
|
+
* This function can't be called in restricted-execution mode.
|
|
549
|
+
*
|
|
550
|
+
* @param options
|
|
551
|
+
* Optional configuration for the spacer, such as visibility.
|
|
552
|
+
* @throws This function can throw errors.
|
|
553
|
+
*
|
|
554
|
+
* {@link InvalidFormModificationError}
|
|
408
555
|
*/
|
|
409
556
|
spacer(options?: SpacingOptions): CustomForm;
|
|
410
557
|
/**
|
|
411
558
|
* @remarks
|
|
412
|
-
*
|
|
413
|
-
*
|
|
559
|
+
* Adds a text input field to the form layout. The current text
|
|
560
|
+
* value is tracked via an ObservableString and will update as
|
|
561
|
+
* the player types. Returns the form instance to allow method
|
|
562
|
+
* chaining.
|
|
563
|
+
*
|
|
564
|
+
* This function can't be called in restricted-execution mode.
|
|
414
565
|
*
|
|
566
|
+
* @param label
|
|
567
|
+
* The text label displayed around the text field.
|
|
568
|
+
* @param text
|
|
569
|
+
* An ObservableString that holds the current text value of the
|
|
570
|
+
* input field.
|
|
571
|
+
* @param options
|
|
572
|
+
* Optional configuration for the text field, such as a
|
|
573
|
+
* description, disabled state, or visibility.
|
|
574
|
+
* @throws This function can throw errors.
|
|
575
|
+
*
|
|
576
|
+
* {@link InvalidFormModificationError}
|
|
415
577
|
*/
|
|
416
578
|
textField(
|
|
417
|
-
label:
|
|
418
|
-
text:
|
|
579
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
580
|
+
text: ObservableString,
|
|
419
581
|
options?: TextFieldOptions,
|
|
420
582
|
): CustomForm;
|
|
421
583
|
/**
|
|
422
584
|
* @remarks
|
|
423
|
-
*
|
|
424
|
-
*
|
|
585
|
+
* Adds a toggle (on/off switch) control to the form layout.
|
|
586
|
+
* The current state is tracked via an ObservableBoolean and
|
|
587
|
+
* will update when the player toggles it. Returns the form
|
|
588
|
+
* instance to allow method chaining.
|
|
425
589
|
*
|
|
590
|
+
* This function can't be called in restricted-execution mode.
|
|
591
|
+
*
|
|
592
|
+
* @param label
|
|
593
|
+
* The text label displayed next to the toggle.
|
|
594
|
+
* @param toggled
|
|
595
|
+
* An ObservableBoolean that holds the current on/off state of
|
|
596
|
+
* the toggle.
|
|
597
|
+
* @param options
|
|
598
|
+
* Optional configuration for the toggle, such as a
|
|
599
|
+
* description, disabled state, or visibility.
|
|
600
|
+
* @throws This function can throw errors.
|
|
601
|
+
*
|
|
602
|
+
* {@link InvalidFormModificationError}
|
|
426
603
|
*/
|
|
427
604
|
toggle(
|
|
428
|
-
label:
|
|
429
|
-
toggled:
|
|
605
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
606
|
+
toggled: ObservableBoolean,
|
|
430
607
|
options?: ToggleOptions,
|
|
431
608
|
): CustomForm;
|
|
432
|
-
/**
|
|
433
|
-
* @remarks
|
|
434
|
-
* Creates a Custom form to show to the player. Use this
|
|
435
|
-
* instead of a constructor.
|
|
436
|
-
*
|
|
437
|
-
*/
|
|
438
|
-
static create(
|
|
439
|
-
player: minecraftserver.Player,
|
|
440
|
-
title: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
441
|
-
): CustomForm;
|
|
442
609
|
}
|
|
443
610
|
|
|
444
|
-
/**
|
|
445
|
-
* @beta
|
|
446
|
-
* Thrown when attempting to close a DDUI form that isn't open.
|
|
447
|
-
*/
|
|
448
|
-
// @ts-ignore Class inheritance allowed for native defined classes
|
|
449
|
-
export declare class FormCloseError extends Error {}
|
|
450
|
-
|
|
451
611
|
/**
|
|
452
612
|
* Base type for a form response.
|
|
453
613
|
*/
|
|
@@ -470,67 +630,126 @@ export class FormResponse {
|
|
|
470
630
|
|
|
471
631
|
/**
|
|
472
632
|
* @beta
|
|
473
|
-
* A simple message form
|
|
633
|
+
* A simple message form with two buttons and a text body. Use
|
|
634
|
+
* this class to show a basic dialog to a player and handle the
|
|
635
|
+
* player's button selection.
|
|
474
636
|
*/
|
|
475
|
-
export
|
|
637
|
+
export class MessageBox {
|
|
638
|
+
/**
|
|
639
|
+
* @remarks
|
|
640
|
+
* Creates a new MessageBox for the specified player with the
|
|
641
|
+
* given title.
|
|
642
|
+
*
|
|
643
|
+
* @param player
|
|
644
|
+
* The player to show this message box to.
|
|
645
|
+
* @param title
|
|
646
|
+
* The title text to display at the top of the message box.
|
|
647
|
+
* @throws This function can throw errors.
|
|
648
|
+
*
|
|
649
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
650
|
+
*/
|
|
651
|
+
constructor(
|
|
652
|
+
player: minecraftserver.Player,
|
|
653
|
+
title: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
654
|
+
);
|
|
476
655
|
/**
|
|
477
656
|
* @remarks
|
|
478
|
-
* Sets the
|
|
479
|
-
*
|
|
480
|
-
*
|
|
657
|
+
* Sets the body text displayed in the message box. Returns the
|
|
658
|
+
* message box instance to allow method chaining.
|
|
659
|
+
*
|
|
660
|
+
* This function can't be called in restricted-execution mode.
|
|
661
|
+
*
|
|
662
|
+
* @param body
|
|
663
|
+
* The body text to display. Accepts either a plain string or
|
|
664
|
+
* an ObservableString.
|
|
665
|
+
* @throws This function can throw errors.
|
|
481
666
|
*
|
|
667
|
+
* {@link InvalidFormModificationError}
|
|
482
668
|
*/
|
|
483
|
-
body(
|
|
669
|
+
body(body: ObservableString | ObservableUIRawMessage | string | UIRawMessage): MessageBox;
|
|
484
670
|
/**
|
|
485
671
|
* @remarks
|
|
486
|
-
* Sets the
|
|
672
|
+
* Sets the label for the first button of the message box.
|
|
673
|
+
* Returns the message box instance to allow method chaining.
|
|
674
|
+
*
|
|
675
|
+
* This function can't be called in restricted-execution mode.
|
|
676
|
+
*
|
|
677
|
+
* @param label
|
|
678
|
+
* The text label to display on the first button.
|
|
679
|
+
* @param tooltip
|
|
680
|
+
* Optional tooltip text shown when hovering over the first
|
|
681
|
+
* button.
|
|
682
|
+
* @throws This function can throw errors.
|
|
487
683
|
*
|
|
684
|
+
* {@link InvalidFormModificationError}
|
|
488
685
|
*/
|
|
489
686
|
button1(
|
|
490
|
-
label:
|
|
491
|
-
tooltip?:
|
|
687
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
688
|
+
tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
492
689
|
): MessageBox;
|
|
493
690
|
/**
|
|
494
691
|
* @remarks
|
|
495
|
-
* Sets the
|
|
692
|
+
* Sets the label for the second button of the message box.
|
|
693
|
+
* Returns the message box instance to allow method chaining.
|
|
496
694
|
*
|
|
695
|
+
* This function can't be called in restricted-execution mode.
|
|
696
|
+
*
|
|
697
|
+
* @param label
|
|
698
|
+
* The text label to display on the second button.
|
|
699
|
+
* @param tooltip
|
|
700
|
+
* Optional tooltip text shown when hovering over the second
|
|
701
|
+
* button.
|
|
702
|
+
* @throws This function can throw errors.
|
|
703
|
+
*
|
|
704
|
+
* {@link InvalidFormModificationError}
|
|
497
705
|
*/
|
|
498
706
|
button2(
|
|
499
|
-
label:
|
|
500
|
-
tooltip?:
|
|
707
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
708
|
+
tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage,
|
|
501
709
|
): MessageBox;
|
|
502
710
|
/**
|
|
503
711
|
* @remarks
|
|
504
|
-
*
|
|
505
|
-
*
|
|
712
|
+
* Closes the message box if it is currently being shown to the
|
|
713
|
+
* player. Throws a FormVisibilityError if the form is not
|
|
714
|
+
* currently open.
|
|
715
|
+
*
|
|
716
|
+
* This function can't be called in restricted-execution mode.
|
|
717
|
+
*
|
|
718
|
+
* @throws This function can throw errors.
|
|
719
|
+
*
|
|
720
|
+
* {@link minecraftcommon.EngineError}
|
|
506
721
|
*
|
|
722
|
+
* {@link FormVisibilityError}
|
|
723
|
+
*
|
|
724
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
507
725
|
*/
|
|
508
726
|
close(): void;
|
|
509
727
|
/**
|
|
510
728
|
* @remarks
|
|
511
729
|
* Returns true if the message box is currently being shown to
|
|
512
|
-
* the player.
|
|
730
|
+
* the player, false otherwise.
|
|
731
|
+
*
|
|
732
|
+
* This function can't be called in restricted-execution mode.
|
|
513
733
|
*
|
|
514
734
|
*/
|
|
515
735
|
isShowing(): boolean;
|
|
516
736
|
/**
|
|
517
737
|
* @remarks
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
738
|
+
* Shows the message box to the player. Returns a promise that
|
|
739
|
+
* resolves with a MessageBoxResult containing the close reason
|
|
740
|
+
* and the player's button selection.
|
|
521
741
|
*
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
* @remarks
|
|
526
|
-
* Creates a message box for a certain player. Use this instead
|
|
527
|
-
* of a constructor.
|
|
742
|
+
* This function can't be called in restricted-execution mode.
|
|
743
|
+
*
|
|
744
|
+
* @throws This function can throw errors.
|
|
528
745
|
*
|
|
746
|
+
* {@link minecraftcommon.EngineError}
|
|
747
|
+
*
|
|
748
|
+
* {@link FormVisibilityError}
|
|
749
|
+
*
|
|
750
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
529
751
|
*/
|
|
530
|
-
|
|
531
|
-
player: minecraftserver.Player,
|
|
532
|
-
title: Observable<string> | Observable<UIRawMessage> | string | UIRawMessage,
|
|
533
|
-
): MessageBox;
|
|
752
|
+
show(): Promise<MessageBoxResult>;
|
|
534
753
|
}
|
|
535
754
|
|
|
536
755
|
/**
|
|
@@ -918,81 +1137,299 @@ export class ModalFormResponse extends FormResponse {
|
|
|
918
1137
|
|
|
919
1138
|
/**
|
|
920
1139
|
* @beta
|
|
921
|
-
*
|
|
922
|
-
*
|
|
1140
|
+
* An observable that holds a boolean value. Listeners are
|
|
1141
|
+
* notified whenever the value changes.
|
|
923
1142
|
*/
|
|
924
|
-
export
|
|
1143
|
+
export class ObservableBoolean {
|
|
925
1144
|
/**
|
|
926
1145
|
* @remarks
|
|
927
|
-
*
|
|
1146
|
+
* Creates a new ObservableBoolean with the provided initial
|
|
1147
|
+
* boolean value.
|
|
1148
|
+
*
|
|
1149
|
+
* This function can't be called in restricted-execution mode.
|
|
928
1150
|
*
|
|
1151
|
+
* This function can be called in early-execution mode.
|
|
1152
|
+
*
|
|
1153
|
+
* @param data
|
|
1154
|
+
* The initial boolean value for this observable.
|
|
1155
|
+
* @param options
|
|
1156
|
+
* Optional configuration for the observable, such as whether
|
|
1157
|
+
* the value can be written by the client.
|
|
929
1158
|
*/
|
|
930
|
-
|
|
1159
|
+
constructor(data: boolean, options?: ObservableOptions);
|
|
931
1160
|
/**
|
|
932
1161
|
* @remarks
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
* This delay is only applied to the getFilteredText function
|
|
939
|
-
* and can be used to simulate network latency when testing.
|
|
1162
|
+
* Returns the current boolean value held by this observable.
|
|
1163
|
+
*
|
|
1164
|
+
* This function can't be called in restricted-execution mode.
|
|
1165
|
+
*
|
|
1166
|
+
* This function can be called in early-execution mode.
|
|
940
1167
|
*
|
|
941
1168
|
*/
|
|
942
|
-
|
|
943
|
-
this: Observable<T & string>,
|
|
944
|
-
player: minecraftserver.Player,
|
|
945
|
-
): Promise<string | TextFilteringError[]>;
|
|
1169
|
+
getData(): boolean;
|
|
946
1170
|
/**
|
|
947
1171
|
* @remarks
|
|
948
|
-
*
|
|
949
|
-
*
|
|
1172
|
+
* Updates the boolean value held by this observable. If the
|
|
1173
|
+
* new value differs from the current value, all subscribed
|
|
1174
|
+
* listeners are notified with the new value.
|
|
1175
|
+
*
|
|
1176
|
+
* This function can't be called in restricted-execution mode.
|
|
950
1177
|
*
|
|
1178
|
+
* This function can be called in early-execution mode.
|
|
1179
|
+
*
|
|
1180
|
+
* @param data
|
|
1181
|
+
* The new boolean value to set.
|
|
951
1182
|
*/
|
|
952
|
-
setData(data:
|
|
1183
|
+
setData(data: boolean): void;
|
|
953
1184
|
/**
|
|
954
1185
|
* @remarks
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
1186
|
+
* Registers a callback to be invoked whenever the observable's
|
|
1187
|
+
* value changes. Returns the callback, which can be passed to
|
|
1188
|
+
* unsubscribe to remove the listener.
|
|
1189
|
+
*
|
|
1190
|
+
* This function can't be called in restricted-execution mode.
|
|
958
1191
|
*
|
|
1192
|
+
* This function can be called in early-execution mode.
|
|
1193
|
+
*
|
|
1194
|
+
* @param callback
|
|
1195
|
+
* A function that receives the new boolean value each time the
|
|
1196
|
+
* observable changes.
|
|
959
1197
|
*/
|
|
960
|
-
subscribe(
|
|
961
|
-
toJSON(): unknown;
|
|
1198
|
+
subscribe(callback: (arg0: boolean) => void): (arg0: boolean) => void;
|
|
962
1199
|
/**
|
|
963
1200
|
* @remarks
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
*
|
|
1201
|
+
* Removes a previously registered listener from this
|
|
1202
|
+
* observable. Returns true if the listener was found and
|
|
1203
|
+
* removed, false if it was not found.
|
|
1204
|
+
*
|
|
1205
|
+
* This function can't be called in restricted-execution mode.
|
|
967
1206
|
*
|
|
1207
|
+
* This function can be called in early-execution mode.
|
|
1208
|
+
*
|
|
1209
|
+
* @param callback
|
|
1210
|
+
* The callback handle previously returned by subscribe.
|
|
968
1211
|
*/
|
|
969
|
-
unsubscribe(
|
|
1212
|
+
unsubscribe(callback: (arg0: boolean) => void): boolean;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* @beta
|
|
1217
|
+
* An observable that holds a numeric value. Listeners are
|
|
1218
|
+
* notified whenever the value changes.
|
|
1219
|
+
*/
|
|
1220
|
+
export class ObservableNumber {
|
|
1221
|
+
/**
|
|
1222
|
+
* @remarks
|
|
1223
|
+
* Creates a new ObservableNumber with the provided initial
|
|
1224
|
+
* numeric value.
|
|
1225
|
+
*
|
|
1226
|
+
* This function can't be called in restricted-execution mode.
|
|
1227
|
+
*
|
|
1228
|
+
* This function can be called in early-execution mode.
|
|
1229
|
+
*
|
|
1230
|
+
* @param data
|
|
1231
|
+
* The initial numeric value for this observable.
|
|
1232
|
+
* @param options
|
|
1233
|
+
* Optional configuration for the observable, such as whether
|
|
1234
|
+
* the value can be written by the client.
|
|
1235
|
+
*/
|
|
1236
|
+
constructor(data: number, options?: ObservableOptions);
|
|
1237
|
+
/**
|
|
1238
|
+
* @remarks
|
|
1239
|
+
* Returns the current numeric value held by this observable.
|
|
1240
|
+
*
|
|
1241
|
+
* This function can't be called in restricted-execution mode.
|
|
1242
|
+
*
|
|
1243
|
+
* This function can be called in early-execution mode.
|
|
1244
|
+
*
|
|
1245
|
+
*/
|
|
1246
|
+
getData(): number;
|
|
1247
|
+
/**
|
|
1248
|
+
* @remarks
|
|
1249
|
+
* Updates the numeric value held by this observable. If the
|
|
1250
|
+
* new value differs from the current value, all subscribed
|
|
1251
|
+
* listeners are notified with the new value.
|
|
1252
|
+
*
|
|
1253
|
+
* This function can't be called in restricted-execution mode.
|
|
1254
|
+
*
|
|
1255
|
+
* This function can be called in early-execution mode.
|
|
1256
|
+
*
|
|
1257
|
+
* @param data
|
|
1258
|
+
* The new numeric value to set.
|
|
1259
|
+
*/
|
|
1260
|
+
setData(data: number): void;
|
|
970
1261
|
/**
|
|
971
1262
|
* @remarks
|
|
972
|
-
*
|
|
1263
|
+
* Registers a callback to be invoked whenever the observable's
|
|
1264
|
+
* value changes. Returns the callback, which can be passed to
|
|
1265
|
+
* unsubscribe to remove the listener.
|
|
973
1266
|
*
|
|
1267
|
+
* This function can't be called in restricted-execution mode.
|
|
1268
|
+
*
|
|
1269
|
+
* This function can be called in early-execution mode.
|
|
1270
|
+
*
|
|
1271
|
+
* @param callback
|
|
1272
|
+
* A function that receives the new numeric value each time the
|
|
1273
|
+
* observable changes.
|
|
974
1274
|
*/
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1275
|
+
subscribe(callback: (arg0: number) => void): (arg0: number) => void;
|
|
1276
|
+
/**
|
|
1277
|
+
* @remarks
|
|
1278
|
+
* Removes a previously registered listener from this
|
|
1279
|
+
* observable. Returns true if the listener was found and
|
|
1280
|
+
* removed, false if it was not found.
|
|
1281
|
+
*
|
|
1282
|
+
* This function can't be called in restricted-execution mode.
|
|
1283
|
+
*
|
|
1284
|
+
* This function can be called in early-execution mode.
|
|
1285
|
+
*
|
|
1286
|
+
* @param callback
|
|
1287
|
+
* The callback handle previously returned by subscribe.
|
|
1288
|
+
*/
|
|
1289
|
+
unsubscribe(callback: (arg0: number) => void): boolean;
|
|
979
1290
|
}
|
|
980
1291
|
|
|
981
1292
|
/**
|
|
982
1293
|
* @beta
|
|
983
|
-
*
|
|
984
|
-
*
|
|
1294
|
+
* An observable that holds a string value. Listeners are
|
|
1295
|
+
* notified whenever the value changes.
|
|
985
1296
|
*/
|
|
986
|
-
|
|
987
|
-
|
|
1297
|
+
export class ObservableString {
|
|
1298
|
+
/**
|
|
1299
|
+
* @remarks
|
|
1300
|
+
* Creates a new ObservableString with the provided initial
|
|
1301
|
+
* string value.
|
|
1302
|
+
*
|
|
1303
|
+
* This function can't be called in restricted-execution mode.
|
|
1304
|
+
*
|
|
1305
|
+
* This function can be called in early-execution mode.
|
|
1306
|
+
*
|
|
1307
|
+
* @param data
|
|
1308
|
+
* The initial string value for this observable.
|
|
1309
|
+
* @param options
|
|
1310
|
+
* Optional configuration for the observable, such as whether
|
|
1311
|
+
* the value can be written by the client.
|
|
1312
|
+
*/
|
|
1313
|
+
constructor(data: string, options?: ObservableOptions);
|
|
1314
|
+
/**
|
|
1315
|
+
* @remarks
|
|
1316
|
+
* Returns the current string value held by this observable.
|
|
1317
|
+
*
|
|
1318
|
+
* This function can't be called in restricted-execution mode.
|
|
1319
|
+
*
|
|
1320
|
+
* This function can be called in early-execution mode.
|
|
1321
|
+
*
|
|
1322
|
+
*/
|
|
1323
|
+
getData(): string;
|
|
1324
|
+
/**
|
|
1325
|
+
* @remarks
|
|
1326
|
+
* Gets filtered data from the Observable (only available for
|
|
1327
|
+
* strings). In case of failure, it will return an array of
|
|
1328
|
+
* TextFilteringError that can provide more context about the
|
|
1329
|
+
* filtering process. For testing purposes, the options are
|
|
1330
|
+
* available under 'Creator -> Text Filtering' settings menu.
|
|
1331
|
+
* This delay is only applied to the getFilteredText function
|
|
1332
|
+
* and can be used to simulate network latency when testing.
|
|
1333
|
+
*
|
|
1334
|
+
* This function can't be called in restricted-execution mode.
|
|
1335
|
+
*
|
|
1336
|
+
* @throws This function can throw errors.
|
|
1337
|
+
*
|
|
1338
|
+
* {@link minecraftcommon.EngineError}
|
|
1339
|
+
*
|
|
1340
|
+
* {@link minecraftserver.InvalidEntityError}
|
|
1341
|
+
*/
|
|
1342
|
+
getFilteredText(player: minecraftserver.Player): Promise<TextFilteringError[] | string>;
|
|
1343
|
+
/**
|
|
1344
|
+
* @remarks
|
|
1345
|
+
* Updates the string value held by this observable. If the new
|
|
1346
|
+
* value differs from the current value, all subscribed
|
|
1347
|
+
* listeners are notified with the new value.
|
|
1348
|
+
*
|
|
1349
|
+
* This function can't be called in restricted-execution mode.
|
|
1350
|
+
*
|
|
1351
|
+
* This function can be called in early-execution mode.
|
|
1352
|
+
*
|
|
1353
|
+
* @param data
|
|
1354
|
+
* The new string value to set.
|
|
1355
|
+
*/
|
|
1356
|
+
setData(data: string): void;
|
|
1357
|
+
/**
|
|
1358
|
+
* @remarks
|
|
1359
|
+
* Registers a callback to be invoked whenever the observable's
|
|
1360
|
+
* value changes. Returns the callback, which can be passed to
|
|
1361
|
+
* unsubscribe to remove the listener.
|
|
1362
|
+
*
|
|
1363
|
+
* This function can't be called in restricted-execution mode.
|
|
1364
|
+
*
|
|
1365
|
+
* This function can be called in early-execution mode.
|
|
1366
|
+
*
|
|
1367
|
+
* @param callback
|
|
1368
|
+
* A function that receives the new string value each time the
|
|
1369
|
+
* observable changes.
|
|
1370
|
+
*/
|
|
1371
|
+
subscribe(callback: (arg0: string) => void): (arg0: string) => void;
|
|
1372
|
+
/**
|
|
1373
|
+
* @remarks
|
|
1374
|
+
* Removes a previously registered listener from this
|
|
1375
|
+
* observable. Returns true if the listener was found and
|
|
1376
|
+
* removed, false if it was not found.
|
|
1377
|
+
*
|
|
1378
|
+
* This function can't be called in restricted-execution mode.
|
|
1379
|
+
*
|
|
1380
|
+
* This function can be called in early-execution mode.
|
|
1381
|
+
*
|
|
1382
|
+
* @param callback
|
|
1383
|
+
* The callback handle previously returned by subscribe.
|
|
1384
|
+
*/
|
|
1385
|
+
unsubscribe(callback: (arg0: string) => void): boolean;
|
|
1386
|
+
}
|
|
988
1387
|
|
|
989
1388
|
/**
|
|
990
1389
|
* @beta
|
|
991
|
-
* Thrown when a DDUI screen is rejected because the server is
|
|
992
|
-
* shutting down.
|
|
993
1390
|
*/
|
|
994
|
-
|
|
995
|
-
|
|
1391
|
+
export class ObservableUIRawMessage {
|
|
1392
|
+
/**
|
|
1393
|
+
* @remarks
|
|
1394
|
+
* This function can't be called in restricted-execution mode.
|
|
1395
|
+
*
|
|
1396
|
+
* This function can be called in early-execution mode.
|
|
1397
|
+
*
|
|
1398
|
+
*/
|
|
1399
|
+
constructor(data: UIRawMessage, options?: ObservableOptions);
|
|
1400
|
+
/**
|
|
1401
|
+
* @remarks
|
|
1402
|
+
* This function can't be called in restricted-execution mode.
|
|
1403
|
+
*
|
|
1404
|
+
* This function can be called in early-execution mode.
|
|
1405
|
+
*
|
|
1406
|
+
*/
|
|
1407
|
+
getData(): UIRawMessage;
|
|
1408
|
+
/**
|
|
1409
|
+
* @remarks
|
|
1410
|
+
* This function can't be called in restricted-execution mode.
|
|
1411
|
+
*
|
|
1412
|
+
* This function can be called in early-execution mode.
|
|
1413
|
+
*
|
|
1414
|
+
*/
|
|
1415
|
+
setData(data: UIRawMessage): void;
|
|
1416
|
+
/**
|
|
1417
|
+
* @remarks
|
|
1418
|
+
* This function can't be called in restricted-execution mode.
|
|
1419
|
+
*
|
|
1420
|
+
* This function can be called in early-execution mode.
|
|
1421
|
+
*
|
|
1422
|
+
*/
|
|
1423
|
+
subscribe(callback: (arg0: UIRawMessage) => void): (arg0: UIRawMessage) => void;
|
|
1424
|
+
/**
|
|
1425
|
+
* @remarks
|
|
1426
|
+
* This function can't be called in restricted-execution mode.
|
|
1427
|
+
*
|
|
1428
|
+
* This function can be called in early-execution mode.
|
|
1429
|
+
*
|
|
1430
|
+
*/
|
|
1431
|
+
unsubscribe(callback: (arg0: UIRawMessage) => void): boolean;
|
|
1432
|
+
}
|
|
996
1433
|
|
|
997
1434
|
export class UIManager {
|
|
998
1435
|
private constructor();
|
|
@@ -1007,64 +1444,69 @@ export class UIManager {
|
|
|
1007
1444
|
|
|
1008
1445
|
/**
|
|
1009
1446
|
* @beta
|
|
1010
|
-
*
|
|
1447
|
+
* Options for configuring a button component.
|
|
1011
1448
|
*/
|
|
1012
1449
|
export interface ButtonOptions {
|
|
1013
1450
|
/**
|
|
1014
1451
|
* @remarks
|
|
1015
|
-
*
|
|
1452
|
+
* When true or bound to a true ObservableBoolean, the button
|
|
1453
|
+
* is shown but cannot be pressed.
|
|
1016
1454
|
*
|
|
1017
1455
|
*/
|
|
1018
|
-
disabled?:
|
|
1456
|
+
disabled?: boolean | ObservableBoolean;
|
|
1019
1457
|
/**
|
|
1020
1458
|
* @remarks
|
|
1021
|
-
*
|
|
1459
|
+
* Text shown in a tooltip when the player hovers over the
|
|
1460
|
+
* button.
|
|
1022
1461
|
*
|
|
1023
1462
|
*/
|
|
1024
|
-
tooltip?:
|
|
1463
|
+
tooltip?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1025
1464
|
/**
|
|
1026
1465
|
* @remarks
|
|
1027
|
-
*
|
|
1466
|
+
* When false or bound to a false ObservableBoolean, the button
|
|
1467
|
+
* is hidden.
|
|
1028
1468
|
*
|
|
1029
1469
|
*/
|
|
1030
|
-
visible?:
|
|
1470
|
+
visible?: boolean | ObservableBoolean;
|
|
1031
1471
|
}
|
|
1032
1472
|
|
|
1033
1473
|
/**
|
|
1034
1474
|
* @beta
|
|
1035
|
-
*
|
|
1475
|
+
* Options for configuring a divider component in a CustomForm.
|
|
1036
1476
|
*/
|
|
1037
1477
|
export interface DividerOptions {
|
|
1038
1478
|
/**
|
|
1039
1479
|
* @remarks
|
|
1040
|
-
*
|
|
1480
|
+
* When false or bound to a false ObservableBoolean, the
|
|
1481
|
+
* divider is hidden.
|
|
1041
1482
|
*
|
|
1042
1483
|
*/
|
|
1043
|
-
visible?:
|
|
1484
|
+
visible?: boolean | ObservableBoolean;
|
|
1044
1485
|
}
|
|
1045
1486
|
|
|
1046
1487
|
/**
|
|
1047
1488
|
* @beta
|
|
1048
|
-
*
|
|
1489
|
+
* Represents a single item in a dropdown component.
|
|
1049
1490
|
*/
|
|
1050
|
-
export interface
|
|
1491
|
+
export interface DropdownItemData {
|
|
1051
1492
|
/**
|
|
1052
1493
|
* @remarks
|
|
1053
|
-
*
|
|
1054
|
-
* selected.
|
|
1494
|
+
* Optional descriptive text shown around the dropdown when
|
|
1495
|
+
* this item is selected.
|
|
1055
1496
|
*
|
|
1056
1497
|
*/
|
|
1057
|
-
description?:
|
|
1498
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1058
1499
|
/**
|
|
1059
1500
|
* @remarks
|
|
1060
|
-
* The
|
|
1501
|
+
* The text displayed for this item in the dropdown list.
|
|
1061
1502
|
*
|
|
1062
1503
|
*/
|
|
1063
|
-
label:
|
|
1504
|
+
label: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1064
1505
|
/**
|
|
1065
1506
|
* @remarks
|
|
1066
|
-
* The value
|
|
1067
|
-
*
|
|
1507
|
+
* The numeric value associated with this dropdown item. This
|
|
1508
|
+
* is the value the bound ObservableNumber will be set to when
|
|
1509
|
+
* the player selects this item.
|
|
1068
1510
|
*
|
|
1069
1511
|
*/
|
|
1070
1512
|
value: number;
|
|
@@ -1072,32 +1514,37 @@ export interface DropdownItem {
|
|
|
1072
1514
|
|
|
1073
1515
|
/**
|
|
1074
1516
|
* @beta
|
|
1075
|
-
*
|
|
1517
|
+
* Options for configuring a dropdown component.
|
|
1076
1518
|
*/
|
|
1077
1519
|
export interface DropdownOptions {
|
|
1078
1520
|
/**
|
|
1079
1521
|
* @remarks
|
|
1080
|
-
*
|
|
1522
|
+
* Descriptive text shown around the dropdown to provide
|
|
1523
|
+
* additional context.
|
|
1081
1524
|
*
|
|
1082
1525
|
*/
|
|
1083
|
-
description?:
|
|
1526
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1084
1527
|
/**
|
|
1085
1528
|
* @remarks
|
|
1086
|
-
*
|
|
1529
|
+
* When true or bound to a true ObservableBoolean, the dropdown
|
|
1530
|
+
* is shown but cannot be changed.
|
|
1087
1531
|
*
|
|
1088
1532
|
*/
|
|
1089
|
-
disabled?:
|
|
1533
|
+
disabled?: boolean | ObservableBoolean;
|
|
1090
1534
|
/**
|
|
1091
1535
|
* @remarks
|
|
1092
|
-
*
|
|
1536
|
+
* When false or bound to a false ObservableBoolean, the
|
|
1537
|
+
* dropdown is hidden.
|
|
1093
1538
|
*
|
|
1094
1539
|
*/
|
|
1095
|
-
visible?:
|
|
1540
|
+
visible?: boolean | ObservableBoolean;
|
|
1096
1541
|
}
|
|
1097
1542
|
|
|
1098
1543
|
/**
|
|
1099
1544
|
* @beta
|
|
1100
|
-
* The result when
|
|
1545
|
+
* The result returned when an MessageBox is closed. Contains
|
|
1546
|
+
* the reason the message box was closed and the player's
|
|
1547
|
+
* button selection, if applicable.
|
|
1101
1548
|
*/
|
|
1102
1549
|
export interface MessageBoxResult {
|
|
1103
1550
|
/**
|
|
@@ -1108,8 +1555,9 @@ export interface MessageBoxResult {
|
|
|
1108
1555
|
closeReason: DataDrivenScreenClosedReason;
|
|
1109
1556
|
/**
|
|
1110
1557
|
* @remarks
|
|
1111
|
-
* The button
|
|
1112
|
-
* without
|
|
1558
|
+
* The index of the button the player selected. Not set if the
|
|
1559
|
+
* message box was closed without a button selection (e.g., the
|
|
1560
|
+
* player was busy or the server closed it).
|
|
1113
1561
|
*
|
|
1114
1562
|
*/
|
|
1115
1563
|
selection?: number;
|
|
@@ -1209,128 +1657,137 @@ export interface ModalFormDataToggleOptions {
|
|
|
1209
1657
|
|
|
1210
1658
|
/**
|
|
1211
1659
|
* @beta
|
|
1212
|
-
*
|
|
1660
|
+
* Configuration options for creating an Observable. Controls
|
|
1661
|
+
* how the observable value can be accessed and modified.
|
|
1213
1662
|
*/
|
|
1214
1663
|
export interface ObservableOptions {
|
|
1215
1664
|
/**
|
|
1216
1665
|
* @remarks
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
* to this observable.
|
|
1666
|
+
* When true, allows the client to write to this observable's
|
|
1667
|
+
* value directly, enabling two-way data binding between the UI
|
|
1668
|
+
* and the observable.
|
|
1221
1669
|
*
|
|
1222
1670
|
*/
|
|
1223
|
-
clientWritable
|
|
1671
|
+
clientWritable: boolean;
|
|
1224
1672
|
}
|
|
1225
1673
|
|
|
1226
1674
|
/**
|
|
1227
1675
|
* @beta
|
|
1228
|
-
*
|
|
1676
|
+
* Options for configuring a slider component.
|
|
1229
1677
|
*/
|
|
1230
1678
|
export interface SliderOptions {
|
|
1231
1679
|
/**
|
|
1232
1680
|
* @remarks
|
|
1233
|
-
*
|
|
1681
|
+
* Descriptive text shown around the slider to provide
|
|
1682
|
+
* additional context.
|
|
1234
1683
|
*
|
|
1235
1684
|
*/
|
|
1236
|
-
description?:
|
|
1685
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1237
1686
|
/**
|
|
1238
1687
|
* @remarks
|
|
1239
|
-
*
|
|
1688
|
+
* When true or bound to a true ObservableBoolean, the slider
|
|
1689
|
+
* is shown but cannot be moved.
|
|
1240
1690
|
*
|
|
1241
1691
|
*/
|
|
1242
|
-
disabled?:
|
|
1692
|
+
disabled?: boolean | ObservableBoolean;
|
|
1243
1693
|
/**
|
|
1244
1694
|
* @remarks
|
|
1245
|
-
* The
|
|
1246
|
-
*
|
|
1247
|
-
* will be 0, 2, 4, 6, 8, 10.
|
|
1695
|
+
* The increment amount between each slider step. Defaults to 1
|
|
1696
|
+
* if not specified.
|
|
1248
1697
|
*
|
|
1249
1698
|
*/
|
|
1250
|
-
step?:
|
|
1699
|
+
step?: number | ObservableNumber;
|
|
1251
1700
|
/**
|
|
1252
1701
|
* @remarks
|
|
1253
|
-
*
|
|
1702
|
+
* When false or bound to a false ObservableBoolean, the slider
|
|
1703
|
+
* is hidden.
|
|
1254
1704
|
*
|
|
1255
1705
|
*/
|
|
1256
|
-
visible?:
|
|
1706
|
+
visible?: boolean | ObservableBoolean;
|
|
1257
1707
|
}
|
|
1258
1708
|
|
|
1259
1709
|
/**
|
|
1260
1710
|
* @beta
|
|
1261
|
-
*
|
|
1711
|
+
* Options for configuring a spacer component.
|
|
1262
1712
|
*/
|
|
1263
1713
|
export interface SpacingOptions {
|
|
1264
1714
|
/**
|
|
1265
1715
|
* @remarks
|
|
1266
|
-
*
|
|
1716
|
+
* When false or bound to a false ObservableBoolean, the spacer
|
|
1717
|
+
* is hidden.
|
|
1267
1718
|
*
|
|
1268
1719
|
*/
|
|
1269
|
-
visible?:
|
|
1720
|
+
visible?: boolean | ObservableBoolean;
|
|
1270
1721
|
}
|
|
1271
1722
|
|
|
1272
1723
|
/**
|
|
1273
1724
|
* @beta
|
|
1274
|
-
*
|
|
1725
|
+
* Options for configuring a text field component.
|
|
1275
1726
|
*/
|
|
1276
1727
|
export interface TextFieldOptions {
|
|
1277
1728
|
/**
|
|
1278
1729
|
* @remarks
|
|
1279
|
-
*
|
|
1730
|
+
* Descriptive text shown around the text field label to
|
|
1731
|
+
* provide additional context.
|
|
1280
1732
|
*
|
|
1281
1733
|
*/
|
|
1282
|
-
description?:
|
|
1734
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1283
1735
|
/**
|
|
1284
1736
|
* @remarks
|
|
1285
|
-
*
|
|
1737
|
+
* When true or bound to a true ObservableBoolean, the text
|
|
1738
|
+
* field is shown but cannot be edited.
|
|
1286
1739
|
*
|
|
1287
1740
|
*/
|
|
1288
|
-
disabled?:
|
|
1741
|
+
disabled?: boolean | ObservableBoolean;
|
|
1289
1742
|
/**
|
|
1290
1743
|
* @remarks
|
|
1291
|
-
*
|
|
1744
|
+
* When false or bound to a false ObservableBoolean, the text
|
|
1745
|
+
* field is hidden.
|
|
1292
1746
|
*
|
|
1293
1747
|
*/
|
|
1294
|
-
visible?:
|
|
1748
|
+
visible?: boolean | ObservableBoolean;
|
|
1295
1749
|
}
|
|
1296
1750
|
|
|
1297
1751
|
/**
|
|
1298
1752
|
* @beta
|
|
1299
|
-
*
|
|
1300
|
-
* CustomForm}.
|
|
1753
|
+
* Options for configuring a text component (label or header).
|
|
1301
1754
|
*/
|
|
1302
1755
|
export interface TextOptions {
|
|
1303
1756
|
/**
|
|
1304
1757
|
* @remarks
|
|
1305
|
-
*
|
|
1758
|
+
* When false or bound to a false ObservableBoolean, the text
|
|
1759
|
+
* component is hidden.
|
|
1306
1760
|
*
|
|
1307
1761
|
*/
|
|
1308
|
-
visible?:
|
|
1762
|
+
visible?: boolean | ObservableBoolean;
|
|
1309
1763
|
}
|
|
1310
1764
|
|
|
1311
1765
|
/**
|
|
1312
1766
|
* @beta
|
|
1313
|
-
*
|
|
1767
|
+
* Options for configuring a toggle component.
|
|
1314
1768
|
*/
|
|
1315
1769
|
export interface ToggleOptions {
|
|
1316
1770
|
/**
|
|
1317
1771
|
* @remarks
|
|
1318
|
-
*
|
|
1772
|
+
* Descriptive text shown around the toggle to provide
|
|
1773
|
+
* additional context.
|
|
1319
1774
|
*
|
|
1320
1775
|
*/
|
|
1321
|
-
description?:
|
|
1776
|
+
description?: ObservableString | ObservableUIRawMessage | string | UIRawMessage;
|
|
1322
1777
|
/**
|
|
1323
1778
|
* @remarks
|
|
1324
|
-
*
|
|
1779
|
+
* When true or bound to a true ObservableBoolean, the toggle
|
|
1780
|
+
* is shown but cannot be interacted with.
|
|
1325
1781
|
*
|
|
1326
1782
|
*/
|
|
1327
|
-
disabled?:
|
|
1783
|
+
disabled?: boolean | ObservableBoolean;
|
|
1328
1784
|
/**
|
|
1329
1785
|
* @remarks
|
|
1330
|
-
*
|
|
1786
|
+
* When false or bound to a false ObservableBoolean, the toggle
|
|
1787
|
+
* is hidden.
|
|
1331
1788
|
*
|
|
1332
1789
|
*/
|
|
1333
|
-
visible?:
|
|
1790
|
+
visible?: boolean | ObservableBoolean;
|
|
1334
1791
|
}
|
|
1335
1792
|
|
|
1336
1793
|
/**
|
|
@@ -1353,17 +1810,17 @@ export interface UIRawMessage {
|
|
|
1353
1810
|
text?: string;
|
|
1354
1811
|
/**
|
|
1355
1812
|
* @remarks
|
|
1356
|
-
* Provides a
|
|
1813
|
+
* Provides a localization string where, if the client has an
|
|
1357
1814
|
* available resource in the players' language which matches
|
|
1358
|
-
* the
|
|
1815
|
+
* the localization string, will get translated on the client.
|
|
1359
1816
|
*
|
|
1360
1817
|
*/
|
|
1361
1818
|
translate?: string;
|
|
1362
1819
|
/**
|
|
1363
1820
|
* @remarks
|
|
1364
|
-
* Arguments for the
|
|
1365
|
-
* of strings or UIRawMessage containing an array of raw
|
|
1366
|
-
* objects.
|
|
1821
|
+
* Arguments for the localization string. Can be either an
|
|
1822
|
+
* array of strings or UIRawMessage containing an array of raw
|
|
1823
|
+
* text objects.
|
|
1367
1824
|
*
|
|
1368
1825
|
*/
|
|
1369
1826
|
with?: string[] | UIRawMessage;
|
|
@@ -1380,4 +1837,88 @@ export class FormRejectError extends Error {
|
|
|
1380
1837
|
readonly reason: FormRejectReason;
|
|
1381
1838
|
}
|
|
1382
1839
|
|
|
1840
|
+
/**
|
|
1841
|
+
* @beta
|
|
1842
|
+
* Thrown when a form visibility operation fails, such as
|
|
1843
|
+
* attempting to show a form that is already showing or
|
|
1844
|
+
* attempting to close a form that is not currently open.
|
|
1845
|
+
*/
|
|
1846
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1847
|
+
export class FormVisibilityError extends Error {
|
|
1848
|
+
private constructor();
|
|
1849
|
+
/**
|
|
1850
|
+
* @remarks
|
|
1851
|
+
* The identifier of the form that caused the visibility error.
|
|
1852
|
+
*
|
|
1853
|
+
* This property can be read in early-execution mode.
|
|
1854
|
+
*
|
|
1855
|
+
*/
|
|
1856
|
+
readonly formId: string;
|
|
1857
|
+
/**
|
|
1858
|
+
* @remarks
|
|
1859
|
+
* The reason the form visibility operation failed.
|
|
1860
|
+
*
|
|
1861
|
+
* This property can be read in early-execution mode.
|
|
1862
|
+
*
|
|
1863
|
+
*/
|
|
1864
|
+
readonly reason: FormVisibilityErrorReason;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* @beta
|
|
1869
|
+
* Thrown when attempting to interact with a form using an
|
|
1870
|
+
* invalid or unknown form identifier.
|
|
1871
|
+
*/
|
|
1872
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1873
|
+
export class InvalidFormError extends Error {
|
|
1874
|
+
private constructor();
|
|
1875
|
+
/**
|
|
1876
|
+
* @remarks
|
|
1877
|
+
* The identifier of the invalid form that was referenced.
|
|
1878
|
+
*
|
|
1879
|
+
* This property can be read in early-execution mode.
|
|
1880
|
+
*
|
|
1881
|
+
*/
|
|
1882
|
+
readonly formId: string;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
/**
|
|
1886
|
+
* @beta
|
|
1887
|
+
* Thrown when attempting to modify a form after it has already
|
|
1888
|
+
* been shown to a player. Form properties cannot be changed
|
|
1889
|
+
* while the form is active.
|
|
1890
|
+
*/
|
|
1891
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1892
|
+
export class InvalidFormModificationError extends Error {
|
|
1893
|
+
private constructor();
|
|
1894
|
+
/**
|
|
1895
|
+
* @remarks
|
|
1896
|
+
* The identifier of the form that was illegally modified after
|
|
1897
|
+
* being shown.
|
|
1898
|
+
*
|
|
1899
|
+
* This property can be read in early-execution mode.
|
|
1900
|
+
*
|
|
1901
|
+
*/
|
|
1902
|
+
readonly formId: string;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* @beta
|
|
1907
|
+
* Thrown when a form operation fails because the target player
|
|
1908
|
+
* has left the game.
|
|
1909
|
+
*/
|
|
1910
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1911
|
+
export class PlayerLeftError extends Error {
|
|
1912
|
+
private constructor();
|
|
1913
|
+
/**
|
|
1914
|
+
* @remarks
|
|
1915
|
+
* The identifier of the form that was being shown when the
|
|
1916
|
+
* player left the game.
|
|
1917
|
+
*
|
|
1918
|
+
* This property can be read in early-execution mode.
|
|
1919
|
+
*
|
|
1920
|
+
*/
|
|
1921
|
+
readonly formId: string;
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1383
1924
|
export const uiManager: UIManager;
|