profectus-docs/assets/api_modules_game_layers.md.c59031e6.js

1 line
34 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 as a,N as r}from"./chunks/framework.0799945b.js";const u=JSON.parse('{"title":"Module: game/layers","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/layers.md","lastUpdated":null}'),o={name:"api/modules/game/layers.md"},d=r('<h1 id="module-game-layers" tabindex="-1">Module: game/layers <a class="header-anchor" href="#module-game-layers" aria-label="Permalink to &quot;Module: game/layers&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="baselayer" tabindex="-1">BaseLayer <a class="header-anchor" href="#baselayer" aria-label="Permalink to &quot;BaseLayer&quot;"></a></h3><p>• <strong>BaseLayer</strong>: <code>Object</code></p><p>The properties that are added onto a processed <a href="./layers#layeroptions">LayerOptions</a> to create a <a href="./layers#layer">Layer</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>emit</code></td><td style="text-align:left;">&lt;K&gt;(...<code>args</code>: [<code>K</code>, ...Parameters&lt;LayerEvents[K]&gt;[]]) =&gt; <code>void</code></td><td style="text-align:left;">A function to emit a <a href="./layers#layerevents">LayerEvents</a> event to this layer.</td></tr><tr><td style="text-align:left;"><code>emitter</code></td><td style="text-align:left;"><code>Emitter</code>&lt;<a href="./layers#layerevents"><code>LayerEvents</code></a>&gt;</td><td style="text-align:left;">An emitter for sending <a href="./layers#layerevents">LayerEvents</a> events for this layer.</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;">The ID of the layer. Populated from the <a href="./layers#createlayer">createLayer</a> parameters. Used for saving and tracking open tabs.</td></tr><tr><td style="text-align:left;"><code>minimized</code></td><td style="text-align:left;"><a href="./persistence#persistent"><code>Persistent</code></a>&lt;<code>boolean</code>&gt;</td><td style="text-align:left;">A persistent ref tracking if the tab is minimized or not.</td></tr><tr><td style="text-align:left;"><code>nodes</code></td><td style="text-align:left;"><code>Ref</code>&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>undefined</code> | <a href="./layers#featurenode"><code>FeatureNode</code></a>&gt;&gt;</td><td style="text-align:left;">A map of <a href="./layers#featurenode">FeatureNode</a>s present in this layer&#39;s ContextComponent component.</td></tr><tr><td style="text-align:left;"><code>on</code></td><td style="text-align:left;">(...<code>args</code>: [event: keyof LayerEvents, cb: Function | Function | Function]) =&gt; <code>Unsubscribe</code></td><td style="text-align:left;">A function to register an event listener on <a href="./layers#emitter">emitter</a>.</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/ba67ff4/src/game/layers.tsx#L148" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:148</a></p><hr><h3 id="featurenode" tabindex="-1">FeatureNode <a class="header-anchor" href="#featurenode" aria-label="Permalink to &quot;FeatureNode&quot;"></a></h3><p>• <strong>FeatureNode</strong>: <code>Object</code></p><p>A feature&#39;s node in the DOM that has its size tracked.</p><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>element</code></td><td style="text-align:left;"><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement" target="_blank" rel="noreferrer"><code>HTMLElement</code></a></td></tr><tr><td style="text-align:left;"><code>observer</code></td><td style="text-align:left;"><a href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver" target="_blank" rel="noreferrer"><code>MutationObserver</code></a></td></tr><tr><td style="text-align:left;"><code>rect</code></td><td style="text-align:left;"><a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMRect" target="_blank" rel="noreferrer"><code>DOMRect</code></a></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/ba67ff4/src/game/layers.tsx#L28" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:28</a></p><hr><h3 id="layerevents" tabindex="-1">LayerEvents <a class="header-anchor" href="#layerevents" aria-label="Permalink to &quot;LayerEvents&quot;"></a></h3><p>• <strong>LayerEvents</strong>: <code>Object</code></p><p>All types of events able to be sent or emitted from a layer&#39;s emitter.</p><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>postUpdate</code></td><td style="text-align:left;">(<code>diff</code>: <code>number</code>) =&gt; <code>void</code></td></tr><tr><td style="text-align:left;"><code>preUpdate</code></td><td style="text-align:left;">(<code>diff</code>: <code>number</code>) =&gt; <code>void</code></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></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/ba67ff4/src/game/layers.tsx#L55" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:55</a></p><hr><h3 id="layeroptions" tabindex="-1">LayerOptions <a class="header-anchor" href="#layeroptions" aria-label="Permalink to &quot;LayerOptions&quot;"></a></h3><p>• <strong>LayerOptions</strong>: <code>Object</code></p><p>An object that configures a <a href="./layers#layer">Layer</a>. Even moreso than features, the developer is expected to include extra properties in this object. All <a href="./persistence#persistent">Persistent</a> refs must be included somewhere within the layer object.</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>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;">An object of classes that should be applied to the display.</td></tr><tr><td style="text-align:left;"><code>color?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>string</code>&gt;</td><td style="text-align:left;">The color of the layer, used to theme the entire layer&#39;s display.</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="./../features/feature#coercablecomponent"><code>CoercableComponent</code></a>&gt;</td><td style="text-align:left;">The layout of this layer&#39;s features. When the layer is open in game/player.PlayerData.tabs, this is the content that is displayed.</td></tr><tr><td style="text-align:left;"><code>forceHideGoBack?</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 to force the go back button to be hidden. If true, go back will be hidden regardless of data/projInfo.allowGoBack.</td></tr><tr><td style="text-align:left;"><code>minWidth?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>string</code> | <code>number</code>&gt;</td><td style="text-align:left;">A CSS min-width value that is applied to the layer. Can be a number, in which case the unit is assumed to be px. Defaults to 600px.</td></tr><tr><td style="text-align:left;"><code>minimizable?</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 layer can be minimized. Defaults to true.</td></tr><tr><td style="text-align:left;"><code>minimizedDisplay?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<a href="./../features/feature#coercablecomponent"><code>CoercableComponent</code></a>&gt;</td><td style="text-align:left;">The layout of this layer&#39;s features. When the layer is open in game/player.PlayerData.tabs, but the tab is Layer.minimized this is the content that is displayed.</td></tr><tr><td style="text-align:left;"><code>name?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a>&lt;<code>string</code>&gt;</td><td style="text-align:left;">The name of the layer, used on minimized tabs. Defaults to <a href="./layers#id">id</a>.</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="./../features/feature#stylevalue"><code>StyleValue</code></a>&gt;</td><td style="text-align:left;">Styles that should be applied to the display.</td></tr></tbody></table><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/ba67ff4/src/game/layers.tsx#L107" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:107</a></p><hr><h3 id="position" tabindex="-1">Position <a class="header-anchor" href="#position" aria-label="Permalink to &quot;Position&quot;"></a></h3><p>• <strong>Position</strong>: <code>Object</code></p><p>An object representing the position of some entity.</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>x</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">The X component of the entity&#39;s position.</td></tr><tr><td style="text-align:left;"><code>y</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">The Y component of the entity&#39;s position.</td></tr></tbody></table><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/ba67ff4/src/game/layers.tsx#L95" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:95</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="genericlayer" tabindex="-1">GenericLayer <a class="header-anchor" href="#genericlayer" aria-label="Permalink to &quot;GenericLayer&quot;"></a></h3><p>Ƭ <strong>GenericLayer</strong>: <a href="./../features/feature#replace"><code>Replace</code></a>&lt;<a href="./layers#layer"><code>Layer</code></a>&lt;<a href="./layers#layeroptions"><code>LayerOptions</code></a>&gt;, { <code>minWidth</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>number</code>&gt; ; <code>minimizable</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>boolean</code>&gt; ; <code>name</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a>&lt;<code>string</code>&gt; }&gt;</p><p>A type that matches any valid <a href="./layers#layer">Layer</a> object.</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/ba67ff4/src/game/layers.tsx#L184" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:184</a></p><hr><h3 id="layer" tabindex="-1">Layer <a class="header-anchor" href="#layer" aria-label="Permalink to &quot;Layer&quot;"></a></h3><p>Ƭ <strong>Layer</strong>&lt;<code>T</code>&gt;: <a href="./../features/feature#replace"><code>Replace</code></a>&lt;<code>T</code> &amp; <a href="./layers#baselayer"><code>BaseLayer</code></a>, { <code>classes</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;classes&quot;</code>]&gt; ; <code>color</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;color&quot;</code>]&gt; ; <code>display</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;display&quot;</code>]&gt; ; <code>forceHideGoBack</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;forceHideGoBack&quot;</code>]&gt; ; <code>minWidth</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;minWidth&quot;</code>], <code>600</code>&gt; ; <code>minimizable</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;minimizable&quot;</code>], <code>true</code>&gt; ; <code>minimizedDisplay</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;minimizedDisplay&quot;</code>]&gt; ; <code>name</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a>&lt;<code>T</code>[<code>&quot;name&quot;</code>], <code>string</code>&gt; ; <code>style</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a>&lt;<code>T</code>[<code>&quot;style&quot;</code>]&gt; }&gt;</p><p>An unit of game content. Displayed to the user as a tab or modal.</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="./layers#layeroptions"><code>LayerOptions</code></a></td></tr></tbody></table><h4 id="defined-in-6" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-6" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L168" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:168</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="boundsinjectionkey" tabindex="-1">BoundsInjectionKey <a class="header-anchor" href="#boundsinjectionkey" aria-label="Permalink to &quot;BoundsInjectionKey&quot;"></a></h3><p>• <code>Const</code> <strong>BoundsInjectionKey</strong>: <code>InjectionKey</code>&lt;<code>Ref</code>&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMRect" target="_blank" rel="noreferrer"><code>DOMRect</code></a> | <code>undefined</code>&gt;&gt;</p><p>An injection key that a ContextComponent will use to provide a ref to a bounding rect of the Context.</p><h4 id="defined-in-7" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-7" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L52" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:52</a></p><hr><h3 id="nodesinjectionkey" tabindex="-1">NodesInjectionKey <a class="header-anchor" href="#nodesinjectionkey" aria-label="Permalink to &quot;NodesInjectionKey&quot;"></a></h3><p>• <code>Const</code> <strong>NodesInjectionKey</strong>: <code>InjectionKey</code>&lt;<code>Ref</code>&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>, <a href="./layers#featurenode"><code>FeatureNode</code></a> | <code>undefined</code>&gt;&gt;&gt;</p><p>An injection key that a ContextComponent will use to provide a ref to a map of all currently registered <a href="./layers#featurenode">FeatureNode</a>s.</p><h4 id="defined-in-8" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-8" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L47" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:47</a></p><hr><h3 id="registernodeinjectionkey" tabindex="-1">RegisterNodeInjectionKey <a class="header-anchor" href="#registernodeinjectionkey" aria-label="Permalink to &quot;RegisterNodeInjectionKey&quot;"></a></h3><p>• <code>Const</code> <strong>RegisterNodeInjectionKey</strong>: <code>InjectionKey</code>&lt;(<code>id</code>: <code>string</code>, <code>element</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement" target="_blank" rel="noreferrer"><code>HTMLElement</code></a>) =&gt; <code>void</code>&gt;</p><p>An injection key that a ContextComponent will use to provide a function that registers a <a href="./layers#featurenode">FeatureNode</a> with the given id and HTML element.</p><h4 id="defined-in-9" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-9" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L37" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:37</a></p><hr><h3 id="unregisternodeinjectionkey" tabindex="-1">UnregisterNodeInjectionKey <a class="header-anchor" href="#unregisternodeinjectionkey" aria-label="Permalink to &quot;UnregisterNodeInjectionKey&quot;"></a></h3><p>• <code>Const</code> <strong>UnregisterNodeInjectionKey</strong>: <code>InjectionKey</code>&lt;(<code>id</code>: <code>string</code>) =&gt; <code>void</code>&gt;</p><p>An injection key that a ContextComponent will use to provide a function that unregisters a <a href="./layers#featurenode">FeatureNode</a> with the given id.</p><h4 id="defined-in-10" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-10" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L42" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:42</a></p><hr><h3 id="addinglayers" tabindex="-1">addingLayers <a class="header-anchor" href="#addinglayers" aria-label="Permalink to &quot;addingLayers&quot;"></a></h3><p>• <code>Const</code> <strong>addingLayers</strong>: <code>string</code>[] = <code>[]</code></p><p>When creating layers, this array stores the layers currently being created, as a stack.</p><h4 id="defined-in-11" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-11" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L200" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:200</a></p><hr><h3 id="layers" tabindex="-1">layers <a class="header-anchor" href="#layers" aria-label="Permalink to &quot;layers&quot;"></a></h3><p>• <code>Const</code> <strong>layers</strong>: <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>, <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype" target="_blank" rel="noreferrer"><code>Readonly</code></a>&lt;<a href="./layers#genericlayer"><code>GenericLayer</code></a>&gt; | <code>undefined</code>&gt;</p><p>A reference to all the current layers. It is shallow reactive so it will update when layers are added or removed, but not interfere with the existing refs within each layer.</p><h4 id="defined-in-12" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-12" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L77" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:77</a></p><hr><h3 id="persistentrefs" tabindex="-1">persistentRefs <a class="header-anchor" href="#persistentrefs" aria-label="Permalink to &quot;persistentRefs&quot;"></a></h3><p>• <code>Const</code> <strong>persistentRefs</strong>: <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>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set" target="_blank" rel="noreferrer"><code>Set</code></a>&lt;<a href="./persistence#persistent"><code>Persistent</code></a>&gt;&gt; = <code>{}</code></p><p>When creating layers, this object a map of layer ID to a set of any created persistent refs in order to check they&#39;re all included in the final layer object.</p><h4 id="defined-in-13" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-13" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L196" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:196</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="addlayer" tabindex="-1">addLayer <a class="header-anchor" href="#addlayer" aria-label="Permalink to &quot;addLayer&quot;"></a></h3><p>▸ <strong>addLayer</strong>(<code>layer</code>, <code>player</code>): <code>void</code></p><p>Enables a layer object, so it will be updated every tick. Note that accessing a layer/its properties does NOT require it to be enabled. For dynamic layers you can call this function and <a href="./layers#removelayer">removeLayer</a> as necessary. Just make sure <a href="./../data/projEntry#getinitiallayers">getInitialLayers</a> will provide an accurate list of layers based on the player data object. For static layers just make <a href="./../data/projEntry#getinitiallayers">getInitialLayers</a> return all the layers.</p><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>layer</code></td><td style="text-align:left;"><a href="./layers#genericlayer"><code>GenericLayer</code></a></td><td style="text-align:left;">The layer to add.</td></tr><tr><td style="text-align:left;"><code>player</code></td><td style="text-align:left;"><code>Object</code></td><td style="text-align:left;">The player data object, which will have a data object for this layer.</td></tr><tr><td style="text-align:left;"><code>player.layers?</code></td><td style="text-align:left;"><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>, <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;&gt;</td><td style="text-align:left;">-</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><code>void</code></p><h4 id="defined-in-14" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-14" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L284" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:284</a></p><hr><h3 id="createlayer" tabindex="-1">createLayer <a class="header-anchor" href="#createlayer" aria-label="Permalink to &quot;createLayer&quot;"></a></h3><p>▸ <strong>createLayer</strong>&lt;<code>T</code>&gt;(<code>id</code>, <code>optionsFunc</code>): <a href="./layers#layer"><code>Layer</code></a>&lt;<code>T</code>&gt;</p><p>Lazily creates a layer 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="./layers#layeroptions"><code>LayerOptions</code></a></td></tr></tbody></table><h5 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" 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>id</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The ID this layer will have. See <a href="./layers#id">id</a>.</td></tr><tr><td style="text-align:left;"><code>optionsFunc</code></td><td style="text-align:left;"><a href="./../features/feature#optionsfunc"><code>OptionsFunc</code></a>&lt;<code>T</code>, <a href="./layers#baselayer"><code>BaseLayer</code></a>&gt;</td><td style="text-align:left;">Layer options.</td></tr></tbody></table><h5 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><a href="./layers#layer"><code>Layer</code></a>&lt;<code>T</code>&gt;</p><h4 id="defined-in-15" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-15" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L206" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:206</a></p><hr><h3 id="getlayer" tabindex="-1">getLayer <a class="header-anchor" href="#getlayer" aria-label="Permalink to &quot;getLayer&quot;"></a></h3><p>▸ <strong>getLayer</strong>&lt;<code>T</code>&gt;(<code>layerID</code>): <code>T</code></p><p>Convenience method for getting a layer by its ID with correct typing.</p><h5 id="type-parameters-2" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-2" 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="./layers#genericlayer"><code>GenericLayer</code></a></td></tr></tbody></table><h5 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" 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>layerID</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">The ID of the layer to get.</td></tr></tbody></table><h5 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><code>T</code></p><h4 id="defined-in-16" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-16" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L311" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:311</a></p><hr><h3 id="reloadlayer" tabindex="-1">reloadLayer <a class="header-anchor" href="#reloadlayer" aria-label="Permalink to &quot;reloadLayer&quot;"></a></h3><p>▸ <strong>reloadLayer</strong>(<code>layer</code>): <code>void</code></p><p>Convenience method for removing and immediately re-adding a layer. This is useful for layers with dynamic content, to ensure persistent refs are correctly configured.</p><h5 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" 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>layer</code></td><td style="text-align:left;"><a href="./layers#genericlayer"><code>GenericLayer</code></a></td><td style="text-align:left;">Layer to remove and then re-add</td></tr></tbody></table><h5 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><code>void</code></p><h4 id="defined-in-17" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-17" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L332" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:332</a></p><hr><h3 id="removelayer" tabindex="-1">removeLayer <a class="header-anchor" href="#removelayer" aria-label="Permalink to &quot;removeLayer&quot;"></a></h3><p>▸ <strong>removeLayer</strong>(<code>layer</code>): <code>void</code></p><p>Disables a layer, so it will no longer be updated every tick. Note that accessing a layer/its properties does NOT require it to be enabled.</p><h5 id="parameters-4" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-4" 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>layer</code></td><td style="text-align:left;"><a href="./layers#genericlayer"><code>GenericLayer</code></a></td><td style="text-align:left;">The layer to remove.</td></tr></tbody></table><h5 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><code>void</code></p><h4 id="defined-in-18" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-18" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L320" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:320</a></p><hr><h3 id="setuplayermodal" tabindex="-1">setupLayerModal <a class="header-anchor" href="#setuplayermodal" aria-label="Permalink to &quot;setupLayerModal&quot;"></a></h3><p>▸ <strong>setupLayerModal</strong>(<code>layer</code>): <code>Object</code></p><p>Utility function for creating a modal that display&#39;s a <a href="./layers#display">display</a>. Returns the modal itself, which can be rendered anywhere you need, as well as a function to open the modal.</p><h5 id="parameters-5" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-5" 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>layer</code></td><td style="text-align:left;"><a href="./layers#genericlayer"><code>GenericLayer</code></a></td><td style="text-align:left;">The layer to display in the modal.</td></tr></tbody></table><h5 id="returns-5" tabindex="-1">Returns <a class="header-anchor" href="#returns-5" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><code>Object</code></p><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>modal</code></td><td style="text-align:left;"><a href="./../features/feature#jsxfunction"><code>JSXFunction</code></a></td></tr><tr><td style="text-align:left;"><code>openModal</code></td><td style="text-align:left;"><code>VoidFunction</code></td></tr></tbody></table><h4 id="defined-in-19" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-19" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/ba67ff4/src/game/layers.tsx#L344" target="_blank" rel="noreferrer">profectus/src/game/layers.tsx:344</a></p>',157),l=[d];function n(i,s,c,h,f,y){return a(),t("div",null,l)}const g=e(o,[["render",n]]);export{u as __pageData,g as default};