Skip to content
On this page

Module: data/common

Interfaces

Type Aliases

GenericLayerTreeNode

Ƭ GenericLayerTreeNode: Replace<LayerTreeNode<LayerTreeNodeOptions>, { append?: ProcessedComputable<boolean> ; display: ProcessedComputable<CoercableComponent> }>

A type that matches any valid LayerTreeNode object.

Defined in

profectus/src/data/common.tsx:196


GenericResetButton

Ƭ GenericResetButton: Replace<GenericClickable & ResetButton<ResetButtonOptions>, { canClick: ProcessedComputable<boolean> ; display: ProcessedComputable<CoercableComponent> ; minimumGain: ProcessedComputable<DecimalSource> ; resetDescription: ProcessedComputable<string> ; showNextAt: ProcessedComputable<boolean> }>

A type that matches any valid ResetButton object.

Defined in

profectus/src/data/common.tsx:79


LayerTreeNode

Ƭ LayerTreeNode<T>: Replace<TreeNode<T>, { append: GetComputableType<T["append"]> ; display: GetComputableTypeWithDefault<T["display"], T["layerID"]> }>

A tree node that is associated with a given layer, and which opens the layer when clicked.

Type parameters

NameType
Textends LayerTreeNodeOptions

Defined in

profectus/src/data/common.tsx:188


ResetButton

Ƭ ResetButton<T>: Replace<Clickable<T>, { canClick: GetComputableTypeWithDefault<T["canClick"], Ref<boolean>> ; display: GetComputableTypeWithDefault<T["display"], Ref<JSX.Element>> ; minimumGain: GetComputableTypeWithDefault<T["minimumGain"], 1> ; onClick: VoidFunction ; resetDescription: GetComputableTypeWithDefault<T["resetDescription"], Ref<string>> ; showNextAt: GetComputableTypeWithDefault<T["showNextAt"], true> }>

A button that is used to control a conversion. It will show how much can be converted currently, and can show when that amount will go up, as well as handle only being clickable when a sufficient amount of currency can be gained. Assumes this button is associated with a specific node on a tree, and triggers that tree's reset propagation.

Type parameters

NameType
Textends ResetButtonOptions

Defined in

profectus/src/data/common.tsx:66

Functions

colorText

colorText(textToColor, color?): string

Creates an HTML string for a span that writes some given text in a given color.

Parameters

NameTypeDefault valueDescription
textToColorstringundefinedThe content to change the color of
colorstring"var(--accent2)"The color to change the content to look like. Defaults to the current theme's accent 2 variable.

Returns

string


createCollapsibleModifierSections

createCollapsibleModifierSections(sections): [JSXFunction, Persistent<boolean>[]]

Takes an array of modifier "sections", and creates a JSXFunction that can render all those sections, and allow each section to be collapsed. Also returns a list of persistent refs that are used to control which sections are currently collapsed.

Parameters

NameTypeDescription
sections{ base?: Computable<DecimalSource> ; baseText?: Computable<CoercableComponent> ; modifier: WithRequired<Modifier, "description"> ; subtitle?: string ; title: string ; unit?: string ; visible?: Computable<boolean> }[]An array of options objects for each section to display.

Returns

[JSXFunction, Persistent<boolean>[]]


createLayerTreeNode

createLayerTreeNode<T>(optionsFunc): LayerTreeNode<T>

Lazily creates a tree node that's associated with a specific layer, with the given options.

Type parameters

NameType
Textends LayerTreeNodeOptions

Parameters

NameTypeDescription
optionsFuncOptionsFunc<T, Record<string, unknown>, Record<string, unknown>>A function that returns the options object for this tree node.

Returns

LayerTreeNode<T>


createResetButton

createResetButton<T>(optionsFunc): ResetButton<T>

Lazily creates a reset button with the given options.

Type parameters

NameType
Textends ClickableOptions & ResetButtonOptions

Parameters

NameTypeDescription
optionsFuncOptionsFunc<T, Record<string, unknown>, Record<string, unknown>>A function that returns the options object for this reset button.

Returns

ResetButton<T>