Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add type annotations for components #15

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading