diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-25 18:56:49 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-25 18:56:49 +0530 |
| commit | 2c7d36b4aa53ffa638a7aa7046767f10e7a152bf (patch) | |
| tree | 679c34d6566f5a774bcd5f979af755cf3cfeac4f /lua | |
| parent | 51be15cd7c9f39276f27d416356744041e62c22c (diff) | |
| download | null-browser-2c7d36b4aa53ffa638a7aa7046767f10e7a152bf.tar.gz null-browser-2c7d36b4aa53ffa638a7aa7046767f10e7a152bf.zip | |
Expose decorations enable/disable lua api
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/null-browser/api.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/null-browser/api.lua b/lua/null-browser/api.lua index 7189ae2..e1053b8 100644 --- a/lua/null-browser/api.lua +++ b/lua/null-browser/api.lua @@ -9,6 +9,7 @@ web.keymap = web.keymap or {} web.view = web.view or {} web.history = web.history or {} web.event = web.event or {} +web.decorations = web.decorations or {} require 'null-browser.utils' @@ -278,4 +279,24 @@ function web.view.scroll_to_top(view_id) return __internals.view_scroll_to_top(v --- TODO: Document function web.view.scroll_to_bottom(view_id) return __internals.view_scroll_to_bottom(view_id) end +--- Decoration api +--- +--- @alias DecorationType number +--- +--- @param type DecorationType +local function create_decoration_api(type) + return { + enable = function() __internals.decorations_set_enabled(type, true) end, + disable = function() __internals.decorations_set_enabled(type, false) end, + } +end + +--- @see DecorationType in ./src/widgets/Decorations.hpp +local DecorationType = { top = 1, bottom = 2, left = 3, right = 4 } + +web.decorations.top = create_decoration_api(DecorationType.top) +web.decorations.bottom = create_decoration_api(DecorationType.bottom) +web.decorations.left = create_decoration_api(DecorationType.left) +web.decorations.right = create_decoration_api(DecorationType.right) + print("api loaded") |
