1 line
34 KiB
JavaScript
1 line
34 KiB
JavaScript
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 "Module: game/layers""></a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to "Interfaces""></a></h2><h3 id="baselayer" tabindex="-1">BaseLayer <a class="header-anchor" href="#baselayer" aria-label="Permalink to "BaseLayer""></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;"><K>(...<code>args</code>: [<code>K</code>, ...Parameters<LayerEvents[K]>[]]) => <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><<a href="./layers#layerevents"><code>LayerEvents</code></a>></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><<code>boolean</code>></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><<a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <code>undefined</code> | <a href="./layers#featurenode"><code>FeatureNode</code></a>>></td><td style="text-align:left;">A map of <a href="./layers#featurenode">FeatureNode</a>s present in this layer'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]) => <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 "Defined in""></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 "FeatureNode""></a></h3><p>• <strong>FeatureNode</strong>: <code>Object</code></p><p>A feature'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 "Defined in""></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 "LayerEvents""></a></h3><p>• <strong>LayerEvents</strong>: <code>Object</code></p><p>All types of events able to be sent or emitted from a layer'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>) => <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>) => <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>) => <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 "Defined in""></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 "LayerOptions""></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><<a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <code>boolean</code>>></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><<code>string</code>></td><td style="text-align:left;">The color of the layer, used to theme the entire layer'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><<a href="./../features/feature#coercablecomponent"><code>CoercableComponent</code></a>></td><td style="text-align:left;">The layout of this layer'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><<code>boolean</code>></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><<code>string</code> | <code>number</code>></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><<code>boolean</code>></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><<a href="./../features/feature#coercablecomponent"><code>CoercableComponent</code></a>></td><td style="text-align:left;">The layout of this layer'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><<code>string</code>></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><<a href="./../features/feature#stylevalue"><code>StyleValue</code></a>></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 "Defined in""></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 "Position""></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'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'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 "Defined in""></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 "Type Aliases""></a></h2><h3 id="genericlayer" tabindex="-1">GenericLayer <a class="header-anchor" href="#genericlayer" aria-label="Permalink to "GenericLayer""></a></h3><p>Ƭ <strong>GenericLayer</strong>: <a href="./../features/feature#replace"><code>Replace</code></a><<a href="./layers#layer"><code>Layer</code></a><<a href="./layers#layeroptions"><code>LayerOptions</code></a>>, { <code>minWidth</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a><<code>number</code>> ; <code>minimizable</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a><<code>boolean</code>> ; <code>name</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a><<code>string</code>> }></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 "Defined in""></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 "Layer""></a></h3><p>Ƭ <strong>Layer</strong><<code>T</code>>: <a href="./../features/feature#replace"><code>Replace</code></a><<code>T</code> & <a href="./layers#baselayer"><code>BaseLayer</code></a>, { <code>classes</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"classes"</code>]> ; <code>color</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"color"</code>]> ; <code>display</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"display"</code>]> ; <code>forceHideGoBack</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"forceHideGoBack"</code>]> ; <code>minWidth</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a><<code>T</code>[<code>"minWidth"</code>], <code>600</code>> ; <code>minimizable</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a><<code>T</code>[<code>"minimizable"</code>], <code>true</code>> ; <code>minimizedDisplay</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"minimizedDisplay"</code>]> ; <code>name</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a><<code>T</code>[<code>"name"</code>], <code>string</code>> ; <code>style</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"style"</code>]> }></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 "Type parameters""></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 "Defined in""></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 "Variables""></a></h2><h3 id="boundsinjectionkey" tabindex="-1">BoundsInjectionKey <a class="header-anchor" href="#boundsinjectionkey" aria-label="Permalink to "BoundsInjectionKey""></a></h3><p>• <code>Const</code> <strong>BoundsInjectionKey</strong>: <code>InjectionKey</code><<code>Ref</code><<a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMRect" target="_blank" rel="noreferrer"><code>DOMRect</code></a> | <code>undefined</code>>></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 "Defined in""></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 "NodesInjectionKey""></a></h3><p>• <code>Const</code> <strong>NodesInjectionKey</strong>: <code>InjectionKey</code><<code>Ref</code><<a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <a href="./layers#featurenode"><code>FeatureNode</code></a> | <code>undefined</code>>>></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 "Defined in""></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 "RegisterNodeInjectionKey""></a></h3><p>• <code>Const</code> <strong>RegisterNodeInjectionKey</strong>: <code>InjectionKey</code><(<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>) => <code>void</code>></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 "Defined in""></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 "UnregisterNodeInjectionKey""></a></h3><p>• <code>Const</code> <strong>UnregisterNodeInjectionKey</strong>: <code>InjectionKey</code><(<code>id</code>: <code>string</code>) => <code>void</code>></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 "Defined in""></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 "addingLayers""></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 "Defined in""></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 "layers""></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><<code>string</code>, <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype" target="_blank" rel="noreferrer"><code>Readonly</code></a><<a href="./layers#genericlayer"><code>GenericLayer</code></a>> | <code>undefined</code>></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 "Defined in""></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 "persistentRefs""></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><<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><<a href="./persistence#persistent"><code>Persistent</code></a>>> = <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'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 "Defined in""></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 "Functions""></a></h2><h3 id="addlayer" tabindex="-1">addLayer <a class="header-anchor" href="#addlayer" aria-label="Permalink to "addLayer""></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 "Parameters""></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><<code>string</code>, <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <code>unknown</code>>></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 "Returns""></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 "Defined in""></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 "createLayer""></a></h3><p>▸ <strong>createLayer</strong><<code>T</code>>(<code>id</code>, <code>optionsFunc</code>): <a href="./layers#layer"><code>Layer</code></a><<code>T</code>></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 "Type parameters""></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 "Parameters""></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><<code>T</code>, <a href="./layers#baselayer"><code>BaseLayer</code></a>></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 "Returns""></a></h5><p><a href="./layers#layer"><code>Layer</code></a><<code>T</code>></p><h4 id="defined-in-15" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-15" aria-label="Permalink to "Defined in""></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 "getLayer""></a></h3><p>▸ <strong>getLayer</strong><<code>T</code>>(<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 "Type parameters""></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 "Parameters""></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 "Returns""></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 "Defined in""></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 "reloadLayer""></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 "Parameters""></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 "Returns""></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 "Defined in""></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 "removeLayer""></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 "Parameters""></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 "Returns""></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 "Defined in""></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 "setupLayerModal""></a></h3><p>▸ <strong>setupLayerModal</strong>(<code>layer</code>): <code>Object</code></p><p>Utility function for creating a modal that display'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 "Parameters""></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 "Returns""></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 "Defined in""></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};
|