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

Module: features/challenges/challenge

Interfaces

BaseChallenge

BaseChallenge: Object

The properties that are added onto a processed ChallengeOptions to create a Challenge.

NameTypeDescription
[Component]GenericComponentThe Vue component used to render this feature.
[GatherProps]() => Record<string, unknown>A function to gather the props the vue component requires for this feature.
activePersistent<boolean>Whether or not this challenge is currently active.
canCompleteRef<DecimalSource>The current amount of times this challenge can be completed.
complete(remainInChallenge?: boolean) => voidA function to complete this challenge.
completedRef<boolean>Whether or not this challenge has been completed.
completionsPersistent<DecimalSource>The current number of times this challenge has been completed.
idstringAn auto-generated ID for identifying features that appear in the DOM. Will not persist between refreshes or updates.
maxedRef<boolean>Whether or not this challenge's completion count is at its limit.
toggleVoidFunctionA function to enter or leave the challenge.
typetypeof ChallengeTypeA symbol that helps identify features of the same type.

Defined in

profectus/src/features/challenges/challenge.tsx:92


ChallengeOptions

ChallengeOptions: Object

An object that configures a Challenge.

NameTypeDescription
canStart?Computable<boolean>Whether this challenge can be started.
classes?Computable<Record<string, boolean>>Dictionary of CSS classes to apply to this feature.
completionLimit?Computable<DecimalSource>The maximum number of times the challenge can be completed.
display?Computable<CoercableComponent | { description: CoercableComponent ; effectDisplay?: CoercableComponent ; goal?: CoercableComponent ; reward?: CoercableComponent ; title?: CoercableComponent }>The display to use for this challenge.
mark?Computable<string | boolean>Shows a marker on the corner of the feature.
maximize?Computable<boolean>Whether or not completing this challenge should grant multiple completions if requirements met. Requires requirements to be a requirement or array of requirements with Requirement.canMaximize true.
onComplete?VoidFunctionA function that is called when the challenge is completed.
onEnter?VoidFunctionA function that is called when the challenge is entered.
onExit?VoidFunctionA function that is called when the challenge is exited.
requirementsRequirementsThe requirement(s) to complete this challenge.
reset?GenericResetThe reset function for this challenge.
style?Computable<StyleValue>CSS to apply to this feature.
visibility?Computable<boolean | Visibility>Whether this challenge should be visible.

Defined in

profectus/src/features/challenges/challenge.tsx:46

Type Aliases

Challenge

Ƭ Challenge<T>: Replace<T & BaseChallenge, { canStart: GetComputableTypeWithDefault<T["canStart"], true> ; classes: GetComputableType<T["classes"]> ; completionLimit: GetComputableTypeWithDefault<T["completionLimit"], 1> ; display: GetComputableType<T["display"]> ; mark: GetComputableTypeWithDefault<T["mark"], Ref<boolean>> ; maximize: GetComputableType<T["maximize"]> ; requirements: GetComputableType<T["requirements"]> ; style: GetComputableType<T["style"]> ; visibility: GetComputableTypeWithDefault<T["visibility"], Visible> }>

An object that represents a feature that can be entered and exited, and have one or more completions with scaling requirements.

Type parameters

NameType
Textends ChallengeOptions

Defined in

profectus/src/features/challenges/challenge.tsx:121


GenericChallenge

Ƭ GenericChallenge: Replace<Challenge<ChallengeOptions>, { canStart: ProcessedComputable<boolean> ; completionLimit: ProcessedComputable<DecimalSource> ; mark: ProcessedComputable<boolean> ; visibility: ProcessedComputable<Visibility | boolean> }>

A type that matches any valid Challenge object.

Defined in

profectus/src/features/challenges/challenge.tsx:137

Variables

ChallengeType

Const ChallengeType: typeof ChallengeType

A symbol used to identify Challenge features.

Defined in

profectus/src/features/challenges/challenge.tsx:41

Functions

createActiveChallenge

createActiveChallenge(challenges): Ref<GenericChallenge | null>

Utility for taking an array of challenges where only one may be active at a time, and giving a ref to the one currently active (or null if none are active)

Parameters
NameTypeDescription
challengesGenericChallenge[]The list of challenges that are mutually exclusive
Returns

Ref<GenericChallenge | null>

Defined in

profectus/src/features/challenges/challenge.tsx:339


createChallenge

createChallenge<T>(optionsFunc, ...decorators): Challenge<T>

Lazily creates a challenge with the given options.

Type parameters
NameType
Textends ChallengeOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T, BaseChallenge, GenericChallenge>Challenge options.
...decoratorsGenericDecorator[]-
Returns

Challenge<T>

Defined in

profectus/src/features/challenges/challenge.tsx:151


isAnyChallengeActive

isAnyChallengeActive(challenges): Ref<boolean>

Utility for reporting if any challenge in a list is currently active. Intended for preventing entering a challenge if another is already active.

Parameters
NameTypeDescription
challengesGenericChallenge[] | Ref<null | GenericChallenge>List of challenges that are mutually exclusive
Returns

Ref<boolean>

Defined in

profectus/src/features/challenges/challenge.tsx:349


setupAutoComplete

setupAutoComplete(challenge, autoActive?, exitOnComplete?): WatchStopHandle

This will automatically complete a challenge when it's requirements are met.

Parameters
NameTypeDefault valueDescription
challengeGenericChallengeundefinedThe challenge to auto-complete
autoActiveComputable<boolean>trueWhether or not auto-completing should currently occur
exitOnCompletebooleantrueWhether or not to exit the challenge after auto-completion
Returns

WatchStopHandle

Defined in

profectus/src/features/challenges/challenge.tsx:319

Components

Challenge Component

Props

NameType
active*processedPropType<boolean>(Boolean)
maxed*processedPropType<boolean>(Boolean)
canComplete*processedPropType<boolean>(Boolean)
displayprocessedPropType<UnwrapRef<GenericChallenge["display"]>>(
String,
Object,
Function
)
requirementsprocessedPropType<Requirements>(Object, Array)
visibility*processedPropType<Visibility | boolean>(Number, Boolean)
styleprocessedPropType<StyleValue>(String, Object, Array)
classesprocessedPropType<Record<string, boolean>>(Object)
completed*processedPropType<boolean>(Boolean)
canStart*processedPropType<boolean>(Boolean)
markprocessedPropType<boolean | string>(Boolean, String)
id*string
toggle*VoidFunction
',81),d=[c];function n(r,i,s,h,g,f){return l(),t("div",null,d)}const y=e(o,[["render",n]]);export{u as __pageData,y as default};