Skip to content

Commit 9d15f24

Browse files
committed
feat: nightly API updates for sxyazi/yazi#2802
1 parent 4df8f70 commit 9d15f24

File tree

1 file changed

+95
-52
lines changed

1 file changed

+95
-52
lines changed

types.yazi/main.lua

Lines changed: 95 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
---@alias undefined any
55

66
---@alias Color string
7-
---@alias Align integer
8-
---@alias Wrap integer
97
---@alias Direction integer
108
---@alias Position integer
119
---@alias Stdio integer
@@ -610,15 +608,11 @@ ya = ya
610608
-- | Return | `integer` |
611609
---@field width fun(self: self): integer
612610
-- Set the alignment of the line.
613-
-- | In/Out | Type |
614-
-- | ------- | ------- |
615-
-- | `self` | `Self` |
616-
-- | `align` | `Align` |
617-
-- | Return | `self` |
618-
-- The `align` accepts the following constants:
619-
-- - `ui.Line.LEFT`
620-
-- - `ui.Line.CENTER`
621-
-- - `ui.Line.RIGHT`
611+
-- | In/Out | Type |
612+
-- | ------- | ----------------- |
613+
-- | `self` | `Self` |
614+
-- | `align` | [`Align`](#align) |
615+
-- | Return | `self` |
622616
---@field align fun(self: self, align: Align): self
623617
-- Whether the line is visible, i.e. includes any printable characters.
624618
-- | In/Out | Type |
@@ -665,26 +659,18 @@ ya = ya
665659
-- If `rect` is not specified, it returns the current area.
666660
---@field area fun(self: self, rect: ui.Rect?): self|ui.Rect
667661
-- Set the alignment of the text.
668-
-- | In/Out | Type |
669-
-- | ------- | ------- |
670-
-- | `self` | `Self` |
671-
-- | `align` | `Align` |
672-
-- | Return | `self` |
673-
-- The `align` accepts the following constants:
674-
-- - `ui.Text.LEFT`
675-
-- - `ui.Text.CENTER`
676-
-- - `ui.Text.RIGHT`
662+
-- | In/Out | Type |
663+
-- | ------- | ----------------- |
664+
-- | `self` | `Self` |
665+
-- | `align` | [`Align`](#align) |
666+
-- | Return | `self` |
677667
---@field align fun(self: self, align: Align): self
678668
-- Set the wrap of the text.
679-
-- | In/Out | Type |
680-
-- | ------ | ------ |
681-
-- | `self` | `Self` |
682-
-- | `wrap` | `Wrap` |
683-
-- | Return | `self` |
684-
-- The `wrap` accepts the following constants:
685-
-- - `ui.Text.WRAP_NO` - No wrap
686-
-- - `ui.Text.WRAP` - Wrap at the end of the line
687-
-- - `ui.Text.WRAP_TRIM` - Wrap at the end of the line, and trim the leading whitespace
669+
-- | In/Out | Type |
670+
-- | ------ | --------------- |
671+
-- | `self` | `Self` |
672+
-- | `wrap` | [`Wrap`](#wrap) |
673+
-- | Return | `self` |
688674
---@field wrap fun(self: self, wrap: Wrap): self
689675
-- Calculate the maximum width of the text across all lines.
690676
-- | In/Out | Type |
@@ -921,15 +907,9 @@ ya = ya
921907

922908
-- Create a bar:
923909
-- ```lua
924-
-- ui.Bar(direction)
910+
-- ui.Bar(edge)
925911
-- ```
926-
-- The first attribute denotes the direction of the bar and accepts the following constants:
927-
-- - `ui.Bar.NONE`
928-
-- - `ui.Bar.TOP`
929-
-- - `ui.Bar.RIGHT`
930-
-- - `ui.Bar.BOTTOM`
931-
-- - `ui.Bar.LEFT`
932-
-- - `ui.Bar.ALL`
912+
-- The first attribute denotes the direction of the bar and accepts an [`Edge`](#edge) constant.
933913
---@class (exact) ui.Bar
934914
-- Set the area of the bar.
935915
-- | In/Out | Type |
@@ -957,15 +937,9 @@ ya = ya
957937

958938
-- Create a border:
959939
-- ```lua
960-
-- ui.Border(position)
940+
-- ui.Border(edge)
961941
-- ```
962-
-- The first attribute denotes the position of the border and accepts the following constants:
963-
-- - `ui.Border.NONE`
964-
-- - `ui.Border.TOP`
965-
-- - `ui.Border.RIGHT`
966-
-- - `ui.Border.BOTTOM`
967-
-- - `ui.Border.LEFT`
968-
-- - `ui.Border.ALL`
942+
-- The first attribute denotes the edge of the border and accepts an [`Edge`](#edge) constant.
969943
---@class (exact) ui.Border
970944
-- Set the area of the border.
971945
-- | In/Out | Type |
@@ -996,7 +970,7 @@ ya = ya
996970
-- | `style` | [`Style`](#style) |
997971
-- | Return | `self` |
998972
---@field style fun(self: self, style: ui.Style): self
999-
---@overload fun(value: Position): ui.Border
973+
---@overload fun(edge: Edge): ui.Border
1000974

1001975
-- Create a gauge:
1002976
-- ```lua
@@ -1067,6 +1041,75 @@ ya = ya
10671041
---@field area fun(self: self, rect: ui.Rect?): self|ui.Rect
10681042
---@overload fun(): ui.Clear
10691043

1044+
-- Align is used to set the alignment of an element, such as a [Line](#line) or [Text](#text).
1045+
---@class (exact) Align
1046+
-- Align to the left.
1047+
-- | | |
1048+
-- | ---- | ----------- |
1049+
-- | Type | `undefined` |
1050+
---@field LEFT undefined
1051+
-- Align to the center.
1052+
-- | | |
1053+
-- | ---- | ----------- |
1054+
-- | Type | `undefined` |
1055+
---@field CENTER undefined
1056+
-- Align to the right.
1057+
-- | | |
1058+
-- | ---- | ----------- |
1059+
-- | Type | `undefined` |
1060+
---@field RIGHT undefined
1061+
1062+
--
1063+
---@class (exact) Wrap
1064+
-- Disables wrapping.
1065+
-- | | |
1066+
-- | ---- | ----------- |
1067+
-- | Type | `undefined` |
1068+
---@field NO undefined
1069+
-- Enables wrapping.
1070+
-- | | |
1071+
-- | ---- | ----------- |
1072+
-- | Type | `undefined` |
1073+
---@field YES undefined
1074+
-- Enables wrapping and trims the leading whitespace.
1075+
-- | | |
1076+
-- | ---- | ----------- |
1077+
-- | Type | `undefined` |
1078+
---@field TRIM undefined
1079+
1080+
--
1081+
---@class (exact) Edge
1082+
-- No edge is applied.
1083+
-- | | |
1084+
-- | ---- | ----------- |
1085+
-- | Type | `undefined` |
1086+
---@field NONE undefined
1087+
-- Applies the top edge.
1088+
-- | | |
1089+
-- | ---- | ----------- |
1090+
-- | Type | `undefined` |
1091+
---@field TOP undefined
1092+
-- Applies the right edge.
1093+
-- | | |
1094+
-- | ---- | ----------- |
1095+
-- | Type | `undefined` |
1096+
---@field RIGHT undefined
1097+
-- Applies the bottom edge.
1098+
-- | | |
1099+
-- | ---- | ----------- |
1100+
-- | Type | `undefined` |
1101+
---@field BOTTOM undefined
1102+
-- Applies the left edge.
1103+
-- | | |
1104+
-- | ---- | ----------- |
1105+
-- | Type | `undefined` |
1106+
---@field LEFT undefined
1107+
-- Applies all edges.
1108+
-- | | |
1109+
-- | ---- | ----------- |
1110+
-- | Type | `undefined` |
1111+
---@field ALL undefined
1112+
10701113

10711114
-- You can access all states within [sync context](/docs/plugins/overview#sync-context) through `cx`.
10721115
---@class (exact) cx
@@ -2073,7 +2116,7 @@ ya = ya
20732116
-- | `self` | `Self` |
20742117
-- | `args` | `string[]` |
20752118
-- | Return | `self` |
2076-
---@field args fun(args: string[]): self
2119+
---@field args fun(self: self, args: string[]): self
20772120
-- Set the current working directory of the command:
20782121
-- ```lua
20792122
-- local cmd = Command("ls"):cwd("/root")
@@ -2384,11 +2427,11 @@ ya = ya
23842427
-- | Return | `Self` |
23852428
---@field Bar fun(value: Direction): ui.Bar
23862429
-- Make a new border.
2387-
-- | In/Out | Type |
2388-
-- | ------- | ---------- |
2389-
-- | `value` | `Position` |
2390-
-- | Return | `Self` |
2391-
---@field Border fun(value: Position): ui.Border
2430+
-- | In/Out | Type |
2431+
-- | ------ | --------------- |
2432+
-- | `edge` | [`Edge`](#edge) |
2433+
-- | Return | `Self` |
2434+
---@field Border fun(edge: Edge): ui.Border
23922435
-- Make a new gauge.
23932436
-- | In/Out | Type |
23942437
-- | ------ | ------ |

0 commit comments

Comments
 (0)