### ws.applyState(state) Source: https://docs.luxalgo.com/vela/user/workspace Applies a state object to the workspace, restoring charts and layout. ```APIDOC ## ws.applyState(state) ### Description Restores the workspace from a provided state object. Malformed fields are dropped, and structural changes trigger a grid rebuild. ### Parameters - **state** (object) - Required - The state object retrieved from `getState()`. ``` -------------------------------- ### ws.getState() Source: https://docs.luxalgo.com/vela/user/workspace Retrieves the current configuration and content of every chart in the workspace. ```APIDOC ## ws.getState() ### Description Returns the complete workspace state object, including layout, active cell, and individual chart configurations. ### Returns - **state** (object) - The workspace state document containing version, layout, charts, and plugin-specific state. ``` -------------------------------- ### VelaStorage Interface Source: https://docs.luxalgo.com/vela/user/workspace Interface for implementing custom storage adapters for workspace persistence. ```APIDOC ## VelaStorage Interface ### Description Defines the contract for storage adapters used by the workspace to persist state. ### Methods - **get(key: string)** - Returns string | null | Promise. - **set(key: string, value: string)** - Returns void | Promise. - **remove(key: string)** (Optional) - Returns void | Promise. ``` -------------------------------- ### Configure topbar entries in VelaWorkspace Source: https://docs.luxalgo.com/vela/user/workspace Initializes a new VelaWorkspace instance with a custom topbar configuration. The left side is explicitly defined, while the right side remains at its default state. ```javascript new VelaWorkspace('#chart', { topbar: { // right undeclared ⇒ default right side (actions, alerts, panels, screenshot) left: ['symbol', 'timeframes', 'style', 'my-plugin.indicator-menu.open', 'undo-redo'], }, }); ``` -------------------------------- ### Indicator Manifest Structure Source: https://docs.luxalgo.com/vela/user/workspace Defines the indicator library as an array of objects, supporting either inline Pine Script source code or external URLs. Entries with 'enabled: false' are available in the picker but not automatically added to the chart. ```json [ { "name": "EMA 20", "script": "//@version=5\nindicator(\"EMA 20\", overlay=true)\nplot(ta.ema(close, 20))" }, { "name": "My RSI", "url": "/scripts/rsi.pine", "language": "pine", "enabled": false } ] ``` -------------------------------- ### Keyboard Shortcut Registration Source: https://docs.luxalgo.com/vela/user/workspace Registers custom keyboard shortcuts using the ws.keymap.register function, which accepts an object containing the ID, key combination, label, category, optional scope, and the execution function. ```javascript register({ id, keys: 'mod+shift+k', label, category, scope?, run }) ```