Skip to content

Commit 1ec8232

Browse files
committed
feat: add type annotations for components
1 parent 6202be4 commit 1ec8232

11 files changed

+34
-1
lines changed

lua/nui-components/box.lua

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
local Component = require("nui-components.component")
22
local fn = require("nui-components.utils.fn")
33

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

69
function Box:init(props, popup_options)

lua/nui-components/button.lua

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ local Paragraph = require("nui-components.paragraph")
33
local event = require("nui.utils.autocmd").event
44
local fn = require("nui-components.utils.fn")
55

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

811
function Button:init(props, popup_options)

lua/nui-components/checkbox.lua

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ local Paragraph = require("nui-components.paragraph")
33

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

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

811
function Checkbox:init(props, popup_options)

lua/nui-components/columns.lua

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
local Box = require("nui-components.box")
22
local fn = require("nui-components.utils.fn")
33

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

69
function Columns:init(props, popup_options)

lua/nui-components/component/init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ local Text = require("nui.text")
77
local event = require("nui.utils.autocmd").event
88
local fn = require("nui-components.utils.fn")
99

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

1215
function Component:init(props, popup_options)

lua/nui-components/form.lua

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
local Component = require("nui-components.component")
22
local fn = require("nui-components.utils.fn")
33

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

69
function Form:init(props, popup_options)

lua/nui-components/gap.lua

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ local Component = require("nui-components.component")
22
local Layout = require("nui.layout")
33
local fn = require("nui-components.utils.fn")
44

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

710
function Gap:init(props, popup_options)

lua/nui-components/paragraph.lua

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ local Line = require("nui.line")
44

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

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

912
local function get_max_width(lines)

lua/nui-components/prompt.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ local Text = require("nui.text")
22
local TextInput = require("nui-components.text-input")
33
local fn = require("nui-components.utils.fn")
44

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

710
function Prompt:init(props, popup_options)
811
Prompt.super.init(

lua/nui-components/rows.lua

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
local Box = require("nui-components.box")
22
local fn = require("nui-components.utils.fn")
33

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

69
function Rows:init(props, popup_options)

lua/nui-components/text-input.lua

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ local Signal = require("nui-components.signal")
33
local event = require("nui.utils.autocmd").event
44
local fn = require("nui-components.utils.fn")
55

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

811
function TextInput:init(props, popup_options)

0 commit comments

Comments
 (0)