Skip to content

Commit

Permalink
docs: add type annotations for components
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy committed Apr 1, 2024
1 parent 6202be4 commit 8f97c2c
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lua/nui-components/box.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Component = require("nui-components.component")
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Box: NuiComponents.Component
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Box
---@field super NuiComponents.Component
local Box = Component:extend("Box")

function Box:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ local Paragraph = require("nui-components.paragraph")
local event = require("nui.utils.autocmd").event
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Button: NuiComponents.Paragraph
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Button
---@field super NuiComponents.Paragraph
local Button = Paragraph:extend("Button")

function Button:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/checkbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ local Paragraph = require("nui-components.paragraph")

local fn = require("nui-components.utils.fn")

---@class NuiComponents.Checkbox: NuiComponents.Paragraph
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Checkbox
---@field super NuiComponents.Paragraph
local Checkbox = Paragraph:extend("Checkbox")

function Checkbox:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/columns.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Box = require("nui-components.box")
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Columns: NuiComponents.Box
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Columns
---@field super NuiComponents.Box
local Columns = Box:extend("Columns")

function Columns:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/component/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ local Text = require("nui.text")
local event = require("nui.utils.autocmd").event
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Component: NuiPopup
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Component
---@field super NuiPopup
local Component = Popup:extend("Component")

function Component:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/form.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Component = require("nui-components.component")
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Form: NuiComponents.Component
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Form
---@field super NuiComponents.Component
local Form = Component:extend("Form")

function Form:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/gap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ local Component = require("nui-components.component")
local Layout = require("nui.layout")
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Gap: NuiComponents.Component
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Gap
---@field super NuiComponents.Component
local Gap = Component:extend("Gap")

function Gap:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/paragraph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ local Line = require("nui.line")

local fn = require("nui-components.utils.fn")

---@class NuiComponents.Paragraph: NuiComponents.Component
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Paragraph
---@field super NuiComponents.Component
local Paragraph = Component:extend("Paragraph")

local function get_max_width(lines)
Expand Down
5 changes: 4 additions & 1 deletion lua/nui-components/prompt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ local Text = require("nui.text")
local TextInput = require("nui-components.text-input")
local fn = require("nui-components.utils.fn")

local Prompt = TextInput:extend("Gap")
---@class NuiComponents.Prompt: NuiComponents.TextInput
---@overload fun(_, props: table, popup_options: NuiPopupOptions): NuiComponents.Prompt
---@field super NuiComponents.TextInput
local Prompt = TextInput:extend("Prompt")

function Prompt:init(props, popup_options)
Prompt.super.init(
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/rows.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Box = require("nui-components.box")
local fn = require("nui-components.utils.fn")

---@class NuiComponents.Rows: NuiComponents.Box
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.Rows
---@field super NuiComponents.Box
local Rows = Box:extend("Rows")

function Rows:init(props, popup_options)
Expand Down
3 changes: 3 additions & 0 deletions lua/nui-components/text-input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ local Signal = require("nui-components.signal")
local event = require("nui.utils.autocmd").event
local fn = require("nui-components.utils.fn")

---@class NuiComponents.TextInput: NuiComponents.Component
---@overload fun(_, props: table<string, any>, popup_options: NuiPopupOptions): NuiComponents.TextInput
---@field super NuiComponents.Component
local TextInput = Component:extend("TextInput")

function TextInput:init(props, popup_options)
Expand Down

0 comments on commit 8f97c2c

Please sign in to comment.