From ef7a68057e22370205419226bac6a9e92bac3ead Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 6 Jan 2024 15:53:34 +0800 Subject: [PATCH] docs: complete `ui.Border` documentation --- docs/plugin/api.md | 48 +++++++++++++++++++++++------------------ docs/plugin/overview.md | 2 +- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/docs/plugin/api.md b/docs/plugin/api.md index 9c35cfe7..48891502 100644 --- a/docs/plugin/api.md +++ b/docs/plugin/api.md @@ -9,51 +9,57 @@ description: Learn how to use Yazi's Lua API. ### `ui.Bar` -Create a bar. +Create a bar: ```lua ui.Bar(rect, direction) ``` -The first attribute is a [Rect](#uirect) object representing the position of this bar. -The second attribute denotes the direction of the bar and accepts the following constants: +The first attribute is a [Rect](#uirect), representing the position of this bar. +The second denotes the direction of the bar and accepts the following constants: - `ui.Bar.NONE` - `ui.Bar.TOP` - `ui.Bar.RIGHT` - `ui.Bar.BOTTOM` +- `ui.Bar.LEFT` - `ui.Bar.ALL` Methods: - `ui.Bar:symbol(symbol)` - accepts a string, specifying the symbol for the bar -- `ui.Bar:style(style)` - accepts a Style object, specifying the style of the bar +- `ui.Bar:style(style)` - accepts a [Style](#uistyle), specifying the style of the bar ### `ui.Border` -TODO +Create a border: ```lua ui.Border(rect, position) ``` -Position +The first attribute is a [Rect](#uirect), representing the position of this border. +The second denotes the position of the border and accepts the following constants: + +- `ui.Border.NONE` +- `ui.Border.TOP` +- `ui.Border.RIGHT` +- `ui.Border.BOTTOM` +- `ui.Border.LEFT` +- `ui.Border.ALL` -- ("NONE", Borders::NONE.bits().into_lua(lua)?), -- ("TOP", Borders::TOP.bits().into_lua(lua)?), -- ("RIGHT", Borders::RIGHT.bits().into_lua(lua)?), -- ("BOTTOM", Borders::BOTTOM.bits().into_lua(lua)?), -- ("LEFT", Borders::LEFT.bits().into_lua(lua)?), -- ("ALL", Borders::ALL.bits().into_lua(lua)?), +You can also use `ui.Border:type(type)` to specify different types for the border. It accepts the following type constants: -Type +- `ui.Border.PLAIN` +- `ui.Border.ROUNDED` +- `ui.Border.DOUBLE` +- `ui.Border.THICK` +- `ui.Border.QUADRANT_INSIDE` +- `ui.Border.QUADRANT_OUTSIDE` + +Methods: -- ("PLAIN", PLAIN.into_lua(lua)?), -- ("ROUNDED", ROUNDED.into_lua(lua)?), -- ("DOUBLE", DOUBLE.into_lua(lua)?), -- ("THICK", THICK.into_lua(lua)?), -- ("QUADRANT_INSIDE", QUADRANT_INSIDE.into_lua(lua)?), -- ("QUADRANT_OUTSIDE", QUADRANT_OUTSIDE.into_lua(lua)?), +- `ui.Border:style(style)` - accepts a [Style](#uistyle), specifying the style of the border ### `ui.Constraint` @@ -63,7 +69,7 @@ percentage of the available space, a ratio of the available space, or a minimum ```lua ui.Constraint.Percentage(50) -- Apply a percentage to a given amount ui.Constraint.Ratio(1, 3) -- Apply a ratio -ui.Constraint.Length(10) -- Apply no more than the given amount (currently roughly equal to `Constraint::Max`) +ui.Constraint.Length(10) -- Apply no more than the given amount (currently roughly equal to `ui.Constraint.Max`) ui.Constraint.Max(5) -- Apply at most the given amount ui.Constraint.Min(3) -- Apply at least the given amount ``` @@ -193,7 +199,7 @@ Properties: Methods: -- `padding(padding)` - Set padding. It accepts a [Padding](#uipadding) object +- `padding(padding)` - Set padding. It accepts a [Padding](#uipadding) ### `ui.Span` diff --git a/docs/plugin/overview.md b/docs/plugin/overview.md index 91655fe7..ee7da10b 100644 --- a/docs/plugin/overview.md +++ b/docs/plugin/overview.md @@ -22,7 +22,7 @@ You can extend Yazi's functionality through Lua plugins, which need to be placed ``` Each plugin is a directory ending with `.yazi`, containing an `init.lua` file for the plugin's initialization. -For instance, the directory structure of the `zoxide.yazi` plugin is as follows: +For instance, the structure of the `zoxide.yazi` plugin is as: ``` zoxide.yazi/