@termun/core - v0.0.0
    Preparing search index...

    Class MenuInput

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new input menu with optional pre-configured value and callbacks.

      Parameters

      • data: MenuInputJson

        Menu JSON including name, type, optional value, and input-specific configs.

      Returns MenuInput

    Methods

    • Returns the current input value (the user's last answer).

      Returns string

    • Overrides the stored input value.

      Parameters

      • v: string

        New value string.

      Returns this

    • Returns the global sidebar choices rendered alongside the prompt.

      Returns (Separator | Choice)[]

    • Replaces the global sidebar choices.

      Parameters

      • choices: (Separator | Choice)[]

        Array of Choice or Separator items.

      Returns this

    • Sets the configs from an instance or a plain JSON object.

      Parameters

      Returns this

    • Sets the configs from an instance or a plain JSON object.

      Parameters

      Returns this

    • Returns the translated placeholder string, or undefined if not set.

      Parameters

      • Optionallanguage: string

        Optional language override.

      Returns string | undefined

    • Returns the validation function, or undefined if not configured.

      Returns ((value: string) => string | boolean) | undefined

    • Returns the submission callback, or undefined if not configured.

      Returns
          | (
              (
                  data: {
                      menu: MenuInput;
                      value: string;
                      language?: string;
                      parent?: string;
                  },
              ) => Promise<void>
          )
          | undefined

    • Renders and runs the interactive input prompt.

      Parameters

      • Optionallanguage: string

        Optional language override for label translation.

      Returns Promise<string | string[]>

    • Returns the menu's unique name.

      Returns string

    • Returns the menu type: "choice", "input", "field", or "editor".

      Returns "input" | "field" | "choice" | "editor"

    • Returns the plugin namespace this menu belongs to, or undefined for the default plugin.

      Returns string | undefined

    • Sets the plugin namespace for this menu.

      Parameters

      • plugin: string | undefined

        Plugin name string.

      Returns this

    • Returns the display order index, or undefined if not set.

      Returns number | undefined

    • Sets the display order index.

      Parameters

      • index: number | undefined

        Numeric sort position.

      Returns this

    • Returns all registered parent names as a flat array.

      Returns string[]

    • Returns the parent entry matching the given name, or undefined.

      Parameters

      • name: string

        Parent name to look up.

      Returns string | undefined

    • Registers a parent menu name.

      Parameters

      • name: string

        Parent name to add.

      Returns this

    • Returns true when this menu is accessible from every context.

      Returns boolean

    • Returns true when this menu is the anchor point of a wizard/flow. Global actions that target this menu will be hidden in this menu and in all its descendants, resolved through the regular parents chain.

      Returns boolean

    • Sets the styles for this menu from an instance or a plain JSON object.

      Parameters

      • styles: MenuStyles

        MenuStyles instance or compatible JSON.

      Returns this

    • Sets the styles for this menu from an instance or a plain JSON object.

      Parameters

      Returns this

    • Sets the labels for this menu from an instance or a plain JSON object.

      Parameters

      • labels: MenuLabels

        MenuLabels instance or compatible JSON.

      Returns this

    • Sets the labels for this menu from an instance or a plain JSON object.

      Parameters

      Returns this

    Properties

    type: "input" | "field" | "choice" | "editor" = "input"
    value: string = ""
    configs: MenuInputConfigs = ...
    globalChoices: (Separator | Choice)[] = []
    name: string
    plugin?: string
    parents: Record<string, Exclude<MenuJson["parents"], undefined>[number]> = {}
    index: number | undefined
    global: boolean
    anchorGlobal: boolean
    styles: MenuStyles