|
1 | 1 | // Generated by dts-bundle-generator v9.5.1
|
2 | 2 |
|
3 |
| -import { EventReceiver, FormHub, StringResolvable } from '@mine-scripters/minecraft-event-driven-form-base'; |
4 | 3 | import React$1 from 'react';
|
5 | 4 |
|
| 5 | +export interface Translate { |
| 6 | + translate: string; |
| 7 | + args?: Array<TextContent>; |
| 8 | +} |
| 9 | +export type TextContent = string | Translate | Array<TextContent>; |
| 10 | +export type NormalizedTextContent = { |
| 11 | + type: "translate"; |
| 12 | + translate: string; |
| 13 | + args?: Array<string> | Array<NormalizedTextContent>; |
| 14 | +} | { |
| 15 | + type: "text"; |
| 16 | + text: string; |
| 17 | +} | { |
| 18 | + type: "array"; |
| 19 | + array: Array<NormalizedTextContent>; |
| 20 | +}; |
| 21 | +export interface FormAction { |
| 22 | + form?: string; |
| 23 | + event?: string; |
| 24 | + eventArgs?: Array<unknown>; |
| 25 | + copyArgs?: boolean; |
| 26 | +} |
| 27 | +export interface DualButtonForm { |
| 28 | + type: "dual-button"; |
| 29 | + title: TextContent; |
| 30 | + body?: TextContent; |
| 31 | + topButton: DualButtonElementButton; |
| 32 | + bottomButton: DualButtonElementButton; |
| 33 | +} |
| 34 | +export interface DualButtonElementButton { |
| 35 | + type: "button"; |
| 36 | + text: TextContent; |
| 37 | + action?: FormAction; |
| 38 | +} |
| 39 | +export interface InputForm { |
| 40 | + type: "input"; |
| 41 | + title: TextContent; |
| 42 | + submit?: TextContent; |
| 43 | + elements: Array<InputElement>; |
| 44 | + action?: FormAction; |
| 45 | +} |
| 46 | +export type InputValue = string | number | boolean; |
| 47 | +export type InputElement = InputElementSlider | InputElementDropdown | InputElementText | InputElementToggle; |
| 48 | +export type InputElementSlider = { |
| 49 | + type: "slider"; |
| 50 | + name?: string; |
| 51 | + text: TextContent; |
| 52 | + min: number; |
| 53 | + max: number; |
| 54 | + step: number; |
| 55 | + defaultValue?: number; |
| 56 | +}; |
| 57 | +export type InputElementDropdown = { |
| 58 | + type: "dropdown"; |
| 59 | + name?: string; |
| 60 | + text: TextContent; |
| 61 | + defaultValue?: InputValue; |
| 62 | + options: Array<{ |
| 63 | + text: TextContent; |
| 64 | + value: InputValue; |
| 65 | + }>; |
| 66 | +}; |
| 67 | +export type InputElementText = { |
| 68 | + type: "text"; |
| 69 | + name?: string; |
| 70 | + text: TextContent; |
| 71 | + placeholder: TextContent; |
| 72 | + defaultValue?: string; |
| 73 | +}; |
| 74 | +export type InputElementToggle = { |
| 75 | + type: "toggle"; |
| 76 | + name?: string; |
| 77 | + text: TextContent; |
| 78 | + defaultValue?: boolean; |
| 79 | +}; |
| 80 | +export interface MultiButtonForm { |
| 81 | + type: "multi-button"; |
| 82 | + title: TextContent; |
| 83 | + body?: TextContent; |
| 84 | + elements: Array<MultiButtonElement>; |
| 85 | +} |
| 86 | +export type MultiButtonElement = MultiButtonElementButton; |
| 87 | +export interface MultiButtonElementButton { |
| 88 | + type: "button"; |
| 89 | + text: TextContent; |
| 90 | + icon?: string; |
| 91 | + action?: FormAction; |
| 92 | +} |
| 93 | +export type Form = MultiButtonForm | InputForm | DualButtonForm; |
| 94 | +/** |
| 95 | + * @inline |
| 96 | + */ |
| 97 | +export interface ToString { |
| 98 | + toString(): string; |
| 99 | +} |
| 100 | +/** |
| 101 | + * @inline |
| 102 | + */ |
| 103 | +export type StringResolvableMap = { |
| 104 | + [key: string]: StringResolvable; |
| 105 | +}; |
| 106 | +export type StringResolvable = ToString | StringResolvableMap; |
| 107 | +declare class FormArguments { |
| 108 | + private _args; |
| 109 | + set(name: string, arg: StringResolvable): void; |
| 110 | + setAll(args: Record<string, StringResolvable>): void; |
| 111 | + getAll(): Record<string, StringResolvable>; |
| 112 | + get<Arg extends StringResolvable>(name: string): Arg; |
| 113 | + resolvePath(path: string): string; |
| 114 | + resolveTemplate(template: string): string; |
| 115 | + normalize(content: TextContent): NormalizedTextContent; |
| 116 | +} |
| 117 | +export interface FormHub { |
| 118 | + entrypoint: string; |
| 119 | + forms: Record<string, Form>; |
| 120 | +} |
| 121 | +declare class FormEvent { |
| 122 | + protected _form: Form | undefined; |
| 123 | + protected _name: string | undefined; |
| 124 | + protected _continueProcessing: boolean; |
| 125 | + protected readonly _hub: FormHub; |
| 126 | + protected _args: FormArguments; |
| 127 | + protected _eventArgs: Array<unknown>; |
| 128 | + constructor(hub: FormHub, action?: FormAction, previousArgs?: FormArguments); |
| 129 | + loadForm(name: string): Form; |
| 130 | + loadForm(name: string, type: "multi-button"): MultiButtonForm; |
| 131 | + loadForm(name: string, type: "input"): InputForm; |
| 132 | + loadForm(name: string, type: "dual-button"): InputForm; |
| 133 | + set form(form: Form | undefined); |
| 134 | + get form(): Form | undefined; |
| 135 | + get name(): string | undefined; |
| 136 | + get args(): FormArguments; |
| 137 | + get eventArgs(): unknown[]; |
| 138 | + get continueProcessing(): boolean; |
| 139 | + cancelProcessing(): void; |
| 140 | +} |
| 141 | +/** |
| 142 | + * @inline |
| 143 | + */ |
| 144 | +export type EventReceiverFunction = (event: FormEvent) => Promise<void>; |
| 145 | +/** |
| 146 | + * @inline |
| 147 | + */ |
| 148 | +export type EventReceiverMap = Record<string, EventReceiverFunction>; |
| 149 | +export type EventReceiver = EventReceiverFunction | EventReceiverMap | undefined; |
6 | 150 | export interface MinecraftEventDrivenFormProps {
|
7 | 151 | formHub: FormHub;
|
8 | 152 | receiver?: EventReceiver;
|
|
0 commit comments