profectus-docs/assets/api_modules_features_action.md.57ac6d70.js

1 line
15 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,c as t,o,N as a}from"./chunks/framework.0799945b.js";const b=JSON.parse('{"title":"Module: features/action","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/features/action.md","lastUpdated":null}'),c={name:"api/modules/features/action.md"},d=a('<h1 id="module-features-action" tabindex="-1">Module: features/action <a class="header-anchor" href="#module-features-action" aria-label="Permalink to &quot;Module: features/action&quot;"></a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to &quot;Interfaces&quot;"></a></h2><h3 id="actionoptions" tabindex="-1">ActionOptions <a class="header-anchor" href="#actionoptions" aria-label="Permalink to &quot;ActionOptions&quot;"></a></h3><p>• <strong>ActionOptions</strong>: <code>Object</code></p><p>An object that configures an <a href="./action#action">Action</a>.</p><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>autoStart?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>boolean</code>&gt;</td><td style="text-align:left;">Whether or not the action should perform automatically when the cooldown is finished.</td></tr><tr><td style="text-align:left;"><code>barOptions?</code></td><td style="text-align:left;"><a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype" target="_blank" rel="noreferrer"><code>Partial</code></a>&lt;<a href="./bar#baroptions"><code>BarOptions</code></a>&gt;</td><td style="text-align:left;">A pass-through to the Bar used to display the cooldown progress for the action.</td></tr><tr><td style="text-align:left;"><code>canClick?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>boolean</code>&gt;</td><td style="text-align:left;">Whether or not the clickable may be clicked.</td></tr><tr><td style="text-align:left;"><code>classes?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a>&lt;<code>string</code>, <code>boolean</code>&gt;&gt;</td><td style="text-align:left;">Dictionary of CSS classes to apply to this feature.</td></tr><tr><td style="text-align:left;"><code>display?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> | { <code>description</code>: <a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> ; <code>title?</code>: <a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> }&gt;</td><td style="text-align:left;">The display to use for this clickable.</td></tr><tr><td style="text-align:left;"><code>duration</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The cooldown during which the action cannot be performed again, in seconds.</td></tr><tr><td style="text-align:left;"><code>mark?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>string</code> | <code>boolean</code>&gt;</td><td style="text-align:left;">Shows a marker on the corner of the feature.</td></tr><tr><td style="text-align:left;"><code>onClick</code></td><td style="text-align:left;">(<code>amount</code>: <a href="./../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>) =&gt; <code>void</code></td><td style="text-align:left;">A function that is called when the action is clicked.</td></tr><tr><td style="text-align:left;"><code>small?</code></td><td style="text-align:left;"><code>boolean</code></td><td style="text-align:left;">Toggles a smaller design for the feature.</td></tr><tr><td style="text-align:left;"><code>style?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<a href="./feature#stylevalue"><code>StyleValue</code></a>&gt;</td><td style="text-align:left;">CSS to apply to this feature.</td></tr><tr><td style="text-align:left;"><code>visibility?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>boolean</code> | <a href="./feature#visibility"><code>Visibility</code></a>&gt;</td><td style="text-align:left;">Whether this clickable should be visible.</td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/b666e0c/src/features/action.tsx#L41" target="_blank" rel="noreferrer">profectus/src/features/action.tsx:41</a></p><hr><h3 id="baseaction" tabindex="-1">BaseAction <a class="header-anchor" href="#baseaction" aria-label="Permalink to &quot;BaseAction&quot;"></a></h3><p>• <strong>BaseAction</strong>: <code>Object</code></p><p>The properties that are added onto a processed <a href="./action#actionoptions">ActionOptions</a> to create an <a href="./action#action">Action</a>.</p><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>[Component]</code></td><td style="text-align:left;"><a href="./feature#genericcomponent"><code>GenericComponent</code></a></td><td style="text-align:left;">The Vue component used to render this feature.</td></tr><tr><td style="text-align:left;"><code>[GatherProps]</code></td><td style="text-align:left;">() =&gt; <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a>&lt;<code>string</code>, <code>unknown</code>&gt;</td><td style="text-align:left;">A function to gather the props the vue component requires for this feature.</td></tr><tr><td style="text-align:left;"><code>id</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">An auto-generated ID for identifying features that appear in the DOM. Will not persist between refreshes or updates.</td></tr><tr><td style="text-align:left;"><code>isHolding</code></td><td style="text-align:left;"><code>Ref</code>&lt;<code>boolean</code>&gt;</td><td style="text-align:left;">Whether or not the player is holding down the action. Actions will be considered clicked as soon as the cooldown completes when being held down.</td></tr><tr><td style="text-align:left;"><code>progress</code></td><td style="text-align:left;"><code>Ref</code>&lt;<a href="./../lib/break_eternity#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The current amount of progress through the cooldown.</td></tr><tr><td style="text-align:left;"><code>progressBar</code></td><td style="text-align:left;"><a href="./bar#genericbar"><code>GenericBar</code></a></td><td style="text-align:left;">The bar used to display the current cooldown progress.</td></tr><tr><td style="text-align:left;"><code>type</code></td><td style="text-align:left;">typeof <a href="./action#actiontype"><code>ActionType</code></a></td><td style="text-align:left;">A symbol that helps identify features of the same type.</td></tr><tr><td style="text-align:left;"><code>update</code></td><td style="text-align:left;">(<code>diff</code>: <code>number</code>) =&gt; <code>void</code></td><td style="text-align:left;">Update the cooldown the specified number of seconds</td></tr></tbody></table><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/b666e0c/src/features/action.tsx#L55" target="_blank" rel="noreferrer">profectus/src/features/action.tsx:55</a></p><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-label="Permalink to &quot;Type Aliases&quot;"></a></h2><h3 id="action" tabindex="-1">Action <a class="header-anchor" href="#action" aria-label="Permalink to &quot;Action&quot;"></a></h3><p>Ƭ <strong>Action</strong>&lt;<code>T</code>&gt;: <a href="./feature#replace"><code>Replace</code></a>&lt;<code>T</code> &amp; <a href="./action#baseaction"><code>BaseAction</code></a>, { <code>autoStart</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;autoStart&quot;</code>], <code>false</code>&gt; ; <code>canClick</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;canClick&quot;</code>], <code>true</code>&gt; ; <code>classes</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;classes&quot;</code>]&gt; ; <code>display</code>: <a href="./feature#jsxfunction"><code>JSXFunction</code></a> ; <code>duration</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;duration&quot;</code>]&gt; ; <code>mark</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;mark&quot;</code>]&gt; ; <code>onClick</code>: <code>VoidFunction</code> ; <code>style</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;style&quot;</code>]&gt; ; <code>visibility</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;visibility&quot;</code>], <a href="./feature#visible"><code>Visible</code></a>&gt; }&gt;</p><p>An object that represents a feature that can be clicked upon, and then has a cooldown before it can be clicked again.</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-label="Permalink to &quot;Type parameters&quot;"></a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="./action#actionoptions"><code>ActionOptions</code></a></td></tr></tbody></table><h4 id="defined-in-2" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-2" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/b666e0c/src/features/action.tsx#L75" target="_blank" rel="noreferrer">profectus/src/features/action.tsx:75</a></p><hr><h3 id="genericaction" tabindex="-1">GenericAction <a class="header-anchor" href="#genericaction" aria-label="Permalink to &quot;GenericAction&quot;"></a></h3><p>Ƭ <strong>GenericAction</strong>: <a href="./feature#replace"><code>Replace</code></a>&lt;<a href="./action#action"><code>Action</code></a>&lt;<a href="./action#actionoptions"><code>ActionOptions</code></a>&gt;, { <code>autoStart</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>boolean</code>&gt; ; <code>canClick</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>boolean</code>&gt; ; <code>visibility</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a>&lt;<a href="./feature#visibility"><code>Visibility</code></a> | <code>boolean</code>&gt; }&gt;</p><p>A type that matches any valid <a href="./action#action">Action</a> object.</p><h4 id="defined-in-3" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-3" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/b666e0c/src/features/action.tsx#L91" target="_blank" rel="noreferrer">profectus/src/features/action.tsx:91</a></p><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-label="Permalink to &quot;Variables&quot;"></a></h2><h3 id="actiontype" tabindex="-1">ActionType <a class="header-anchor" href="#actiontype" aria-label="Permalink to &quot;ActionType&quot;"></a></h3><p>• <code>Const</code> <strong>ActionType</strong>: typeof <a href="./action#actiontype"><code>ActionType</code></a></p><p>A symbol used to identify <a href="./action#action">Action</a> features.</p><h4 id="defined-in-4" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-4" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/b666e0c/src/features/action.tsx#L36" target="_blank" rel="noreferrer">profectus/src/features/action.tsx:36</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h2><h3 id="createaction" tabindex="-1">createAction <a class="header-anchor" href="#createaction" aria-label="Permalink to &quot;createAction&quot;"></a></h3><p>▸ <strong>createAction</strong>&lt;<code>T</code>&gt;(<code>optionsFunc?</code>): <a href="./action#action"><code>Action</code></a>&lt;<code>T</code>&gt;</p><p>Lazily creates an action with the given options.</p><h5 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-label="Permalink to &quot;Type parameters&quot;"></a></h5><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="./action#actionoptions"><code>ActionOptions</code></a>&lt;<code>T</code>&gt;</td></tr></tbody></table><h5 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></a></h5><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>optionsFunc?</code></td><td style="text-align:left;"><a href="./feature#optionsfunc"><code>OptionsFunc</code></a>&lt;<code>T</code>, <a href="./action#baseaction"><code>BaseAction</code></a>, <a href="./action#genericaction"><code>GenericAction</code></a>&gt;</td><td style="text-align:left;">Action options.</td></tr></tbody></table><h5 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><a href="./action#action"><code>Action</code></a>&lt;<code>T</code>&gt;</p><h4 id="defined-in-5" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-5" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/b666e0c/src/features/action.tsx#L104" target="_blank" rel="noreferrer">profectus/src/features/action.tsx:104</a></p>',47),l=[d];function i(r,n,s,h,f,p){return o(),t("div",null,l)}const g=e(c,[["render",i]]);export{b as __pageData,g as default};