import{_ as e,c as t,o,N as a}from"./chunks/framework.0799945b.js";const p=JSON.parse('{"title":"Module: data/common","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/data/common.md","lastUpdated":null}'),r={name:"api/modules/data/common.md"},d=a('

Module: data/common

Interfaces

LayerTreeNodeOptions

LayerTreeNodeOptions: Object

An object that configures a LayerTreeNode

NameTypeDescription
append?Computable<boolean>Whether or not to append the layer to the tabs list. If set to false, then the tree node will instead always remove all tabs to its right and then add the layer tab. Defaults to true.
canClick?Computable<boolean>Whether or not this tree node can be clicked.
classes?Computable<Record<string, boolean>>Dictionary of CSS classes to apply to this feature.
colorComputable<string>The color to display this tree node as
display?Computable<CoercableComponent>The content to display in the tree node. Defaults to the layer's ID
glowColor?Computable<string>The color of the glow effect shown to notify the user there's something to do with this node.
layerIDstringThe ID of the layer this tree node is associated with
mark?Computable<string | boolean>Shows a marker on the corner of the feature.
onClick?(e?: MouseEvent | TouchEvent) => voidA function that is called when the tree node is clicked.
onHold?VoidFunctionA function that is called when the tree node is held down.
reset?GenericResetA reset object attached to this node, used for propagating resets through the tree.
style?Computable<StyleValue>CSS to apply to this feature.
visibility?Computable<boolean | Visibility>Whether this tree node should be visible.

Defined in

profectus/src/data/common.tsx:176


ResetButtonOptions

ResetButtonOptions: Object

An object that configures a ResetButton

NameTypeDescription
canClick?Computable<boolean>Whether or not this button can currently be clicked. Defaults to checking the current gain amount is greater than minimumGain
classes?Computable<Record<string, boolean>>Dictionary of CSS classes to apply to this feature.
conversionGenericConversionThe conversion the button uses to calculate how much resources will be gained on click
display?Computable<CoercableComponent>The content to display on the button. By default, this includes the reset description, and amount of currency to be gained.
mark?Computable<string | boolean>Shows a marker on the corner of the feature.
minimumGain?Computable<DecimalSource>When canClick is left to its default, minimumGain is used to only enable the reset button when a sufficient amount of currency to gain is available.
onClick?(e?: MouseEvent | TouchEvent) => voidA function that is called when the clickable is clicked.
onHold?VoidFunctionA function that is called when the clickable is held down.
resetDescription?Computable<string>Text to display on low conversion amounts, describing what "resetting" is in this context. Defaults to "Reset for ".
resetTime?Persistent<DecimalSource>A persistent ref to track how much time has passed since the last time this tree node was reset.
showNextAt?Computable<boolean>Whether or not to show how much currency would be required to make the gain amount increase.
small?booleanToggles a smaller design for the feature.
style?Computable<StyleValue>CSS to apply to this feature.
treeGenericTreeThe tree this reset button is apart of
treeNodeGenericTreeNodeThe specific tree node associated with this reset button
visibility?Computable<boolean | Visibility>Whether this clickable should be visible.

Defined in

profectus/src/data/common.tsx:34


Section

Section: Object

An option object for a modifier display as a single section. *

NameTypeDescription
base?Computable<DecimalSource>The base value being modified. *
baseText?Computable<CoercableComponent>The label to call the base amount. Defaults to "Base". *
modifierWithRequired<Modifier, "description">The modifier to be displaying in this section. *
subtitle?Computable<string>A subtitle for this modifier, e.g. to explain the context for the modifier. *
titleComputable<string>The header for this modifier. *
unit?stringThe unit of measurement for the base. *
visible?Computable<boolean>Whether or not this section should be currently visible to the player. *

Defined in

profectus/src/data/common.tsx:241

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:201


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:84


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:193


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: (event?: MouseEvent | TouchEvent) => void ; 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:71

Functions

colorText

colorText(textToColor, color?): JSX.Element

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

JSX.Element

Defined in

profectus/src/data/common.tsx:382

colorText: (textToColor: string, color: string) => JSX.Element

Defined in

profectus/src/data/common.tsx:382


createCollapsibleAchievements

createCollapsibleAchievements(achievements): Object

Creates a collapsible display of a list of achievements

Parameters

NameTypeDescription
achievementsRecord<string, GenericAchievement>A dictionary of the achievements to display, inserted in the order from easiest to hardest

Returns

Object

NameType
collapseAchievementsPersistent<boolean>
displayJSXFunction

Defined in

profectus/src/data/common.tsx:390

createCollapsibleAchievements: (achievements: Record<string, GenericAchievement>) => { collapseAchievements: Persistent<boolean> = collapseAchievements; display: JSXFunction }

Defined in

profectus/src/data/common.tsx:390


createCollapsibleModifierSections

createCollapsibleModifierSections(sectionsFunc, smallerIsBetter?): [JSXFunction, Persistent<Record<number, 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

NameTypeDefault valueDescription
sectionsFunc() => Section[]undefinedA function that returns the sections to display.
smallerIsBetterbooleanfalseDetermines whether numbers larger or smaller than the base should be displayed as red.

Returns

[JSXFunction, Persistent<Record<number, boolean>>]

Defined in

profectus/src/data/common.tsx:264

createCollapsibleModifierSections: (sectionsFunc: () => Section[], smallerIsBetter: boolean) => [JSXFunction, Persistent<Record<number, boolean>>]

Defined in

profectus/src/data/common.tsx:264


createFormulaPreview

createFormulaPreview(formula, showPreview, previewAmount?): ComputedRef<CoercableComponent>

Utility function for displaying the result of a formula such that it will, when told to, preview how the formula's result will change. Requires a formula with a single variable inside.

Parameters

NameTypeDefault valueDescription
formulaGenericFormulaundefinedThe formula to display the result of.
showPreviewComputable<boolean>undefinedWhether or not to preview how the formula's result will change.
previewAmountComputable<DecimalSource>1The amount to add to the current formula's variable amount to preview the change in result.

Returns

ComputedRef<CoercableComponent>

Defined in

profectus/src/data/common.tsx:460

createFormulaPreview: (formula: GenericFormula, showPreview: Computable<boolean>, previewAmount: Computable<DecimalSource>) => ComputedRef<CoercableComponent>

Defined in

profectus/src/data/common.tsx:460


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>

Defined in

profectus/src/data/common.tsx:213

createLayerTreeNode: <T>(optionsFunc: OptionsFunc<T, Record<string, unknown>, Record<string, unknown>>) => LayerTreeNode<T>

Defined in

profectus/src/data/common.tsx:213


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>

Defined in

profectus/src/data/common.tsx:99

createResetButton: <T>(optionsFunc: OptionsFunc<T, Record<string, unknown>, Record<string, unknown>>) => ResetButton<T>

Defined in

profectus/src/data/common.tsx:99


estimateTime

estimateTime(resource, rate, target): ComputedRef<string>

Utility function for getting an ETA for when a target will be reached by a resource with a known (and assumed consistent) gain.

Parameters

NameTypeDescription
resourceResource<DecimalSource>The resource that will be increasing over time.
rateComputable<DecimalSource>The rate at which the resource is increasing.
targetComputable<DecimalSource>The target amount of the resource to estimate the duration until.

Returns

ComputedRef<string>

Defined in

profectus/src/data/common.tsx:434

estimateTime: (resource: Resource<DecimalSource>, rate: Computable<DecimalSource>, target: Computable<DecimalSource>) => ComputedRef<string>

Defined in

profectus/src/data/common.tsx:434


modifierToFormula

modifierToFormula<T>(modifier, base): T

Utility for converting a modifier into a formula. Takes the input for this formula as the base parameter.

Type parameters

NameType
Textends default<any, T>

Parameters

NameTypeDescription
modifierWithRequired<Modifier, "revert">The modifier to convert to the formula
baseTAn existing formula or processed DecimalSource that will be the input to the formula

Returns

T

Defined in

profectus/src/data/common.tsx:500

modifierToFormula(modifier, base): GenericFormula

Parameters

NameType
modifierModifier
baseFormulaSource

Returns

GenericFormula

Defined in

profectus/src/data/common.tsx:504

modifierToFormula: <T>(modifier: WithRequired<Modifier, "revert">, base: T) => T(modifier: Modifier, base: FormulaSource) => GenericFormula

Defined in

profectus/src/data/common.tsx:500

profectus/src/data/common.tsx:504

profectus/src/data/common.tsx:505

',170),c=[d];function l(n,i,s,h,f,u){return o(),t("div",null,c)}const g=e(r,[["render",l]]);export{p as __pageData,g as default};