@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
173 lines (170 loc) • 5.28 kB
TypeScript
import { LabelIdType } from '../types/LabelIdType.js';
import { StorageObjectType } from '../types/StorageElementType.js';
import Label from './Label.js';
import { CloseType } from '../types/CloseType.js';
import LabelRunModeType from '../types/LabelRunModeType.js';
import '../types/StepLabelType.js';
import '@drincs/pixi-vn/dist/override';
import './LabelAbstract.js';
import '../types/StepHistoryDataType.js';
import '../interface/LabelProps.js';
/**
* ChoiceMenuOption is a class that contains a Label and a text that will be displayed in the menu.
* @example
* ```typescript
* new ChoiceMenuOption("Hello", HelloLabel, {})
* ```
*/
declare class ChoiceMenuOption<T extends StorageObjectType> {
/**
* Text to be displayed in the menu
*/
text: string;
private _label;
/**
* Label to be opened when the option is selected
*/
get label(): Label<T>;
/**
* Type of the label to be opened
*/
type: LabelRunModeType;
/**
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
* @example
* ```tsx
* setChoiceMenuOptions([
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
* ])
* return <List>
* {getChoiceMenuOptions()?.map((item, index) => {
* return (
* <ChoiceButton
* disabled={item.props.disabled}
* onClick={() => {
* afterSelectChoice(item)
* }}
* >
* {item.text}
* </ChoiceButton>
* )
* })}
* </List>
* ```
*/
props: StorageObjectType;
/**
* @param text Text to be displayed in the menu
* @param label Label to be opened when the option is selected or the id of the label
* @param props Properties to be passed to the label and olther parameters that you can use when get all the choice menu options. It be converted to a JSON string, so it cannot contain functions or classes.
* @param type Type of the label to be opened. @default "call"
*/
constructor(text: string, label: Label<T> | LabelIdType, props: T, type?: LabelRunModeType);
}
/**
* ChoiceMenuOptionClose is a class that contains a text that will be displayed in the menu.
* It is used to close the menu.
* @example
* ```typescript
* new ChoiceMenuOptionClose("Return")
* ```
*/
declare class ChoiceMenuOptionClose<T extends {} = {}> {
/**
* Label to be opened when the option is selected
*/
label: Label<T>;
/**
* Text to be displayed in the menu
*/
text: string;
/**
* If true, the current label will be closed
*/
closeCurrentLabel: boolean;
/**
* Type of the label to be opened
*/
type: CloseType;
/**
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
* @example
* ```tsx
* setChoiceMenuOptions([
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
* ])
* return <List>
* {getChoiceMenuOptions()?.map((item, index) => {
* return (
* <ChoiceButton
* disabled={item.props.disabled}
* onClick={() => {
* afterSelectChoice(item)
* }}
* >
* {item.text}
* </ChoiceButton>
* )
* })}
* </List>
* ```
*/
props: StorageObjectType;
/**
* @param text Text to be displayed in the menu
* @param closeCurrentLabel If true, the current label will be closed. @default false
*/
constructor(text: string, closeCurrentLabel?: boolean);
}
type IStoratedChoiceMenuOption = {
/**
* Text to be displayed in the menu
*/
text: string;
/**
* Label Id to be opened when the option is selected
*/
label: LabelIdType;
/**
* Type of the label to be opened
*/
type: LabelRunModeType;
/**
* Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
* @example
* ```tsx
* setChoiceMenuOptions([
* new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
* ])
* return <List>
* {getChoiceMenuOptions()?.map((item, index) => {
* return (
* <ChoiceButton
* disabled={item.props.disabled}
* onClick={() => {
* afterSelectChoice(item)
* }}
* >
* {item.text}
* </ChoiceButton>
* )
* })}
* </List>
* ```
*/
props: StorageObjectType;
} | {
/**
* Text to be displayed in the menu
*/
text: string;
/**
* Type of the label to be opened
*/
type: CloseType;
/**
* If true, the current label will be closed
*/
closeCurrentLabel: boolean;
};
export { ChoiceMenuOptionClose, type IStoratedChoiceMenuOption, ChoiceMenuOption as default };