Skip to main content

CraftingSlotsMode

A namespace with helper types for implementing custom crafting slot modes; modes that can be added by adding a callback to CraftingSlots.modeData.

Index

Interfaces

Type Aliases

Interfaces

Args

Args:

Arguments for Callback representing a crafting item + button pair

button

button: HTMLButtonElement

The .crafting-slot-button button in question

craft

The crafting item (if any) associated with the button

multiSelectListeners

multiSelectListeners: { click: (this: HTMLButtonElement, ev: PointerEvent) => void; focus: (this: HTMLButtonElement, ev: FocusEvent) => void }

Multi select listeners that can be attached to the button in order to implement click and shift + click selection behavior


Type declaration

  • click: (this: HTMLButtonElement, ev: PointerEvent) => void
      • (this: HTMLButtonElement, ev: PointerEvent): void
      • Parameters

        • this: HTMLButtonElement
        • ev: PointerEvent

        Returns void

  • focus: (this: HTMLButtonElement, ev: FocusEvent) => void
      • (this: HTMLButtonElement, ev: FocusEvent): void
      • Parameters

        • this: HTMLButtonElement
        • ev: FocusEvent

        Returns void

Result

Result:

The return type of Callback representing mode-specific heading and mode-accept-button customization

heading

heading: string | Node | readonly (string | Node)[]

The content of the main crafting slot heading.

Must contain a 1-line summary of the relevant crafting mode. See Result.modeAcceptTooltip if a more extensive description is also desired.

optionalmodeAcceptImgSrc

modeAcceptImgSrc?: string = ```ts "./Icons/Crafting.png" ```

The image source of the mode-accept button.

optionalmodeAcceptListener

modeAcceptListener?: (this: HTMLButtonElement, ev: PointerEvent) => void = (this: HTMLButtonElement, ev: PointerEvent) => void

A click listener for the mode-accept button.

If present, the button should serve a "accept all changes" type of role.

If absent, disable the button.


Type declaration

    • (this: HTMLButtonElement, ev: PointerEvent): void
    • Parameters

      • this: HTMLButtonElement
      • ev: PointerEvent

      Returns void

optionalmodeAcceptQuestionColor

modeAcceptQuestionColor?: string = ```ts "white" ```

The color of the mode-accept button's question mark icon.

optionalmodeAcceptTooltip

modeAcceptTooltip?: string | Node | readonly (string | Node)[] = string | Node | readonly (string | Node)[]

The tooltip content of the mode-accept button.

Should contain a more extensive description of the relevant crafting mode (if so required; see Result.heading).

Type Aliases

Callback

Callback: (crafts: readonly Args[]) => Result

The to-be registered callback

@returns

The final mode-specific config


Type declaration

    • Parameters

      • crafts: readonly Args[]

        A list of crafting arguments, which most prominently include the crafting items and their respective buttons

      Returns Result

Data

Data: { callback: Callback; selectLabel?: string }

Type declaration

  • readonlycallback: Callback

    The to-be registered callback used for setting up mode-specific configurations

  • optionalselectLabel?: string

    The <select> label associated with the registered slot mode. If absent, default to the TextGet(Label${SlotModeName}) output

Page Options