feat: more API documentation
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
|
|
||||||
The following plugins can be installed using the [`ya pkg` package manager](https://yazi-rs.github.io/docs/cli#package-manager) introduced in Yazi v25.5.28.
|
The following plugins can be installed using the [`ya pkg` package manager](https://yazi-rs.github.io/docs/cli#pm) introduced in Yazi v25.5.28.
|
||||||
|
|
||||||
For specific installation commands and configuration instructions, check the individual `README.md` of each plugin by clicking the link below:
|
For specific installation commands and configuration instructions, check the individual `README.md` of each plugin by clicking the link below:
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
|
|
||||||
-- luacheck: globals Command Url cx fs ps rt th ui ya
|
-- luacheck: globals Command Url cx fs ps rt th ui ya
|
||||||
|
|
||||||
---@alias Color string
|
---@alias Color string
|
||||||
---@alias Position integer
|
|
||||||
---@alias Stdio integer
|
---@alias Stdio integer
|
||||||
|
|
||||||
---@alias Sendable nil|boolean|number|string|Url|{ [Sendable]: Sendable }
|
---@alias Sendable nil|boolean|number|string|Url|{ [Sendable]: Sendable }
|
||||||
@@ -133,9 +131,14 @@ ya = ya
|
|||||||
-- | `another` | `string` |
|
-- | `another` | `string` |
|
||||||
-- | Return | `Self` |
|
-- | Return | `Self` |
|
||||||
---@field __concat fun(self: self, another: string): self
|
---@field __concat fun(self: self, another: string): self
|
||||||
|
-- Make a new url.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | ------------------ |
|
||||||
|
-- | `value` | `string` \| `Self` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: string|self): Url
|
---@overload fun(value: string|self): Url
|
||||||
|
|
||||||
-- Cha means one file's characteristics.
|
-- One file's characteristics.
|
||||||
---@class (exact) Cha
|
---@class (exact) Cha
|
||||||
-- Whether the file is a directory.
|
-- Whether the file is a directory.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -238,7 +241,7 @@ ya = ya
|
|||||||
-- | Available | Unix-like systems only |
|
-- | Available | Unix-like systems only |
|
||||||
---@field perm string?
|
---@field perm string?
|
||||||
|
|
||||||
--
|
-- A bare file without any context information. See also [`fs::File`](/docs/plugins/context#fs-file).
|
||||||
---@class (exact) File
|
---@class (exact) File
|
||||||
-- Url of the file.
|
-- Url of the file.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -261,7 +264,7 @@ ya = ya
|
|||||||
-- | Type | `string` |
|
-- | Type | `string` |
|
||||||
---@field name string
|
---@field name string
|
||||||
|
|
||||||
--
|
-- An icon.
|
||||||
---@class (exact) Icon
|
---@class (exact) Icon
|
||||||
-- Text of the icon.
|
-- Text of the icon.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -274,7 +277,7 @@ ya = ya
|
|||||||
-- | Type | `Style` |
|
-- | Type | `Style` |
|
||||||
---@field style ui.Style
|
---@field style ui.Style
|
||||||
|
|
||||||
--
|
-- An error.
|
||||||
---@class (exact) Error
|
---@class (exact) Error
|
||||||
-- Raw error code.
|
-- Raw error code.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -379,6 +382,11 @@ ya = ya
|
|||||||
-- | `padding` | [`Pad`](#pad) |
|
-- | `padding` | [`Pad`](#pad) |
|
||||||
-- | Return | `self` |
|
-- | Return | `self` |
|
||||||
---@field pad fun(self: self, padding: ui.Pad): self
|
---@field pad fun(self: self, padding: ui.Pad): self
|
||||||
|
-- Make a new rect.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | -------------------------------------------------------- |
|
||||||
|
-- | `value` | `{ x: integer?, y: integer?, w: integer?, h: integer? }` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: { x: integer?, y: integer?, w: integer?, h: integer? }): ui.Rect
|
---@overload fun(value: { x: integer?, y: integer?, w: integer?, h: integer? }): ui.Rect
|
||||||
|
|
||||||
-- `Pad` represents a padding, and all of its parameters are integers:
|
-- `Pad` represents a padding, and all of its parameters are integers:
|
||||||
@@ -449,6 +457,14 @@ ya = ya
|
|||||||
-- | `y` | `integer` |
|
-- | `y` | `integer` |
|
||||||
-- | Return | `Self` |
|
-- | Return | `Self` |
|
||||||
---@field xy fun(x: integer, y: integer): self
|
---@field xy fun(x: integer, y: integer): self
|
||||||
|
-- Make a new padding.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | -------- | --------- |
|
||||||
|
-- | `top` | `integer` |
|
||||||
|
-- | `right` | `integer` |
|
||||||
|
-- | `bottom` | `integer` |
|
||||||
|
-- | `left` | `integer` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(top: integer, right: integer, bottom: integer, left: integer): ui.Pad
|
---@overload fun(top: integer, right: integer, bottom: integer, left: integer): ui.Pad
|
||||||
|
|
||||||
-- Create a style:
|
-- Create a style:
|
||||||
@@ -539,6 +555,10 @@ ya = ya
|
|||||||
-- | `another` | `Self` |
|
-- | `another` | `Self` |
|
||||||
-- | Return | `self` |
|
-- | Return | `self` |
|
||||||
---@field patch fun(self: self, another: self): self
|
---@field patch fun(self: self, another: self): self
|
||||||
|
-- Make a new style.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------ | ------ |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(): ui.Style
|
---@overload fun(): ui.Style
|
||||||
|
|
||||||
-- `ui.Span` is the smallest unit of text, yet a component of `ui.Line`. Create a span:
|
-- `ui.Span` is the smallest unit of text, yet a component of `ui.Line`. Create a span:
|
||||||
@@ -572,6 +592,11 @@ ya = ya
|
|||||||
-- ui.Span("Hello world"):fg("white"):bg("black"):bold()
|
-- ui.Span("Hello world"):fg("white"):bg("black"):bold()
|
||||||
-- ```
|
-- ```
|
||||||
---@field style fun(self: self, style: ui.Style): self
|
---@field style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new span.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | ------------------ |
|
||||||
|
-- | `value` | `string` \| `Self` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: string|self): ui.Span
|
---@overload fun(value: string|self): ui.Span
|
||||||
|
|
||||||
-- `ui.Line` represents a line, consisting of multiple `ui.Span`s, and it accepts a table of them:
|
-- `ui.Line` represents a line, consisting of multiple `ui.Span`s, and it accepts a table of them:
|
||||||
@@ -628,6 +653,11 @@ ya = ya
|
|||||||
-- ui.Line("Hello world"):fg("white"):bg("black"):bold()
|
-- ui.Line("Hello world"):fg("white"):bg("black"):bold()
|
||||||
-- ```
|
-- ```
|
||||||
---@field style fun(self: self, style: ui.Style): self
|
---@field style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new line.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | -------------------------------------------------------- |
|
||||||
|
-- | `value` | `string` \| `Span` \| `Self` \| `(string\|Span\|Self)[]` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: string|ui.Span|self|(string|ui.Span|self)[]): ui.Line
|
---@overload fun(value: string|ui.Span|self|(string|ui.Span|self)[]): ui.Line
|
||||||
|
|
||||||
-- `ui.Text` is used to represent multi-line text, it takes a table of `ui.Line`:
|
-- `ui.Text` is used to represent multi-line text, it takes a table of `ui.Line`:
|
||||||
@@ -686,6 +716,11 @@ ya = ya
|
|||||||
-- ui.Text("Hello world"):fg("white"):bg("black"):bold()
|
-- ui.Text("Hello world"):fg("white"):bg("black"):bold()
|
||||||
-- ```
|
-- ```
|
||||||
---@field style fun(self: self, style: ui.Style): self
|
---@field style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new text.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | -------------------------------------------------------- |
|
||||||
|
-- | `value` | `string` \| `Span` \| `Line` \| `(string\|Span\|Line)[]` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: string|ui.Span|ui.Line|(string|ui.Span|ui.Line)[]): ui.Text
|
---@overload fun(value: string|ui.Span|ui.Line|(string|ui.Span|ui.Line)[]): ui.Text
|
||||||
|
|
||||||
-- Create a layout:
|
-- Create a layout:
|
||||||
@@ -743,6 +778,10 @@ ya = ya
|
|||||||
-- | `rect` | [`Rect`](#rect) |
|
-- | `rect` | [`Rect`](#rect) |
|
||||||
-- | Return | [`Rect[]`](#rect) |
|
-- | Return | [`Rect[]`](#rect) |
|
||||||
---@field split fun(self: self, rect: ui.Rect): ui.Rect[]
|
---@field split fun(self: self, rect: ui.Rect): ui.Rect[]
|
||||||
|
-- Make a new layout.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------ | ------ |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(): ui.Layout
|
---@overload fun(): ui.Layout
|
||||||
|
|
||||||
-- A constraint that defines the size of a layout element.
|
-- A constraint that defines the size of a layout element.
|
||||||
@@ -900,6 +939,11 @@ ya = ya
|
|||||||
-- | `style` | [`Style`](#style) |
|
-- | `style` | [`Style`](#style) |
|
||||||
-- | Return | `self` |
|
-- | Return | `self` |
|
||||||
---@field style fun(self: self, style: ui.Style): self
|
---@field style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new list.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | ------------------------------------------------------------------------ |
|
||||||
|
-- | `value` | `string` \| `Span` \| `Line` \| `Text` \| `(string\|Span\|Line\|Text)[]` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: string|ui.Span|ui.Line|ui.Text|(string|ui.Span|ui.Line|ui.Text)[]): ui.List
|
---@overload fun(value: string|ui.Span|ui.Line|ui.Text|(string|ui.Span|ui.Line|ui.Text)[]): ui.List
|
||||||
|
|
||||||
-- Create a bar:
|
-- Create a bar:
|
||||||
@@ -930,6 +974,11 @@ ya = ya
|
|||||||
-- | `style` | [`Style`](#style) |
|
-- | `style` | [`Style`](#style) |
|
||||||
-- | Return | `self` |
|
-- | Return | `self` |
|
||||||
---@field style fun(self: self, style: ui.Style): self
|
---@field style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new bar.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------ | --------------- |
|
||||||
|
-- | `edge` | [`Edge`](#edge) |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(edge: ui.Edge): ui.Bar
|
---@overload fun(edge: ui.Edge): ui.Bar
|
||||||
|
|
||||||
-- Create a border:
|
-- Create a border:
|
||||||
@@ -967,6 +1016,11 @@ ya = ya
|
|||||||
-- | `style` | [`Style`](#style) |
|
-- | `style` | [`Style`](#style) |
|
||||||
-- | Return | `self` |
|
-- | Return | `self` |
|
||||||
---@field style fun(self: self, style: ui.Style): self
|
---@field style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new border.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------ | --------------- |
|
||||||
|
-- | `edge` | [`Edge`](#edge) |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(edge: ui.Edge): ui.Border
|
---@overload fun(edge: ui.Edge): ui.Border
|
||||||
|
|
||||||
-- Create a gauge:
|
-- Create a gauge:
|
||||||
@@ -1017,6 +1071,10 @@ ya = ya
|
|||||||
-- | `style` | [`Style`](#style) |
|
-- | `style` | [`Style`](#style) |
|
||||||
-- | Return | `self` |
|
-- | Return | `self` |
|
||||||
---@field gauge_style fun(self: self, style: ui.Style): self
|
---@field gauge_style fun(self: self, style: ui.Style): self
|
||||||
|
-- Make a new gauge.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------ | ------ |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(): ui.Gauge
|
---@overload fun(): ui.Gauge
|
||||||
|
|
||||||
-- Clear the content of a specific area, which is a [Rect](#rect). Place it followed by the component that you want to clear:
|
-- Clear the content of a specific area, which is a [Rect](#rect). Place it followed by the component that you want to clear:
|
||||||
@@ -1036,9 +1094,14 @@ ya = ya
|
|||||||
-- | Return | `self` \| [`Rect`](#rect) |
|
-- | Return | `self` \| [`Rect`](#rect) |
|
||||||
-- If `rect` is not specified, it returns the current area.
|
-- If `rect` is not specified, it returns the current area.
|
||||||
---@field area fun(self: self, rect: ui.Rect?): self|ui.Rect
|
---@field area fun(self: self, rect: ui.Rect?): self|ui.Rect
|
||||||
|
-- Make a new clear.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------ | --------------- |
|
||||||
|
-- | `rect` | [`Rect`](#rect) |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(rect: ui.Rect): ui.Clear
|
---@overload fun(rect: ui.Rect): ui.Clear
|
||||||
|
|
||||||
-- Align is used to set the alignment of an element, such as a [Line](#line) or [Text](#text).
|
-- Alignment of an element such as [`Text`](#text) or [`Line`](#line).
|
||||||
---@class (exact) ui.Align
|
---@class (exact) ui.Align
|
||||||
-- Align to the left.
|
-- Align to the left.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1056,7 +1119,7 @@ ya = ya
|
|||||||
-- | Type | `Self` |
|
-- | Type | `Self` |
|
||||||
---@field RIGHT self
|
---@field RIGHT self
|
||||||
|
|
||||||
--
|
-- Wrapping behavior of a [`Text`](#text).
|
||||||
---@class (exact) ui.Wrap
|
---@class (exact) ui.Wrap
|
||||||
-- Disables wrapping.
|
-- Disables wrapping.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1074,7 +1137,7 @@ ya = ya
|
|||||||
-- | Type | `Self` |
|
-- | Type | `Self` |
|
||||||
---@field TRIM self
|
---@field TRIM self
|
||||||
|
|
||||||
--
|
-- Which edges of elements such as [`Bar`](#bar) or [`Border`](#border) should be applied.
|
||||||
---@class (exact) ui.Edge
|
---@class (exact) ui.Edge
|
||||||
-- No edge is applied.
|
-- No edge is applied.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1125,7 +1188,7 @@ ya = ya
|
|||||||
-- | ---- | ------------------------------ |
|
-- | ---- | ------------------------------ |
|
||||||
-- | Type | [`tasks::Tasks`](#tasks-tasks) |
|
-- | Type | [`tasks::Tasks`](#tasks-tasks) |
|
||||||
---@field tasks tasks__Tasks
|
---@field tasks tasks__Tasks
|
||||||
-- The yanked files.
|
-- Yanked files.
|
||||||
-- | | |
|
-- | | |
|
||||||
-- | ---- | ---------------------------- |
|
-- | ---- | ---------------------------- |
|
||||||
-- | Type | [`mgr::Yanked`](#mgr-yanked) |
|
-- | Type | [`mgr::Yanked`](#mgr-yanked) |
|
||||||
@@ -1193,7 +1256,7 @@ ya = ya
|
|||||||
-- | Type | `boolean` |
|
-- | Type | `boolean` |
|
||||||
---@field show_hidden boolean
|
---@field show_hidden boolean
|
||||||
|
|
||||||
--
|
-- [Url](#url)s of the selected files.
|
||||||
---@class (exact) tab__Selected
|
---@class (exact) tab__Selected
|
||||||
-- Returns the number of selected [Url](#url)s.
|
-- Returns the number of selected [Url](#url)s.
|
||||||
-- | In/Out | Type |
|
-- | In/Out | Type |
|
||||||
@@ -1208,7 +1271,7 @@ ya = ya
|
|||||||
-- | Return | `fun(t: self, k: any): integer, Url` |
|
-- | Return | `fun(t: self, k: any): integer, Url` |
|
||||||
---@field __pairs fun(self: self): fun(t: self, k: any): integer, Url
|
---@field __pairs fun(self: self): fun(t: self, k: any): integer, Url
|
||||||
|
|
||||||
--
|
-- State of the preview pane.
|
||||||
---@class (exact) tab__Preview
|
---@class (exact) tab__Preview
|
||||||
-- Number of units to skip. The units largely depend on your previewer, such as lines for code and percentages for videos.
|
-- Number of units to skip. The units largely depend on your previewer, such as lines for code and percentages for videos.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1221,7 +1284,7 @@ ya = ya
|
|||||||
-- | Type | [`tab::Folder?`](#tab-folder) |
|
-- | Type | [`tab::Folder?`](#tab-folder) |
|
||||||
---@field folder tab__Folder?
|
---@field folder tab__Folder?
|
||||||
|
|
||||||
--
|
-- A folder.
|
||||||
---@class (exact) tab__Folder
|
---@class (exact) tab__Folder
|
||||||
-- Current working directory.
|
-- Current working directory.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1254,7 +1317,7 @@ ya = ya
|
|||||||
-- | Type | [`fs::File?`](#fs-file) |
|
-- | Type | [`fs::File?`](#fs-file) |
|
||||||
---@field hovered fs__File?
|
---@field hovered fs__File?
|
||||||
|
|
||||||
--
|
-- Files in a [`tab::Folder`](#tab-folder).
|
||||||
---@class (exact) fs__Files
|
---@class (exact) fs__Files
|
||||||
-- Returns the number of files in this folder.
|
-- Returns the number of files in this folder.
|
||||||
-- | In/Out | Type |
|
-- | In/Out | Type |
|
||||||
@@ -1270,7 +1333,7 @@ ya = ya
|
|||||||
-- | Return | [`fs::File?`](#fs-file) |
|
-- | Return | [`fs::File?`](#fs-file) |
|
||||||
---@field __index fun(self: self, idx: integer): fs__File?
|
---@field __index fun(self: self, idx: integer): fs__File?
|
||||||
|
|
||||||
--
|
-- A file lives in the current context, which has many more context-specific properties and methods compared to [`File`](/docs/plugins/types#file).
|
||||||
---@class (exact) fs__File
|
---@class (exact) fs__File
|
||||||
-- Url of the file.
|
-- Url of the file.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1350,7 +1413,7 @@ ya = ya
|
|||||||
-- | Return | `integer?, integer?` |
|
-- | Return | `integer?, integer?` |
|
||||||
---@field found fun(self: self): integer?, integer?
|
---@field found fun(self: self): integer?, integer?
|
||||||
|
|
||||||
--
|
-- All of tabs.
|
||||||
---@class (exact) mgr__Tabs
|
---@class (exact) mgr__Tabs
|
||||||
-- Index of the active tab.
|
-- Index of the active tab.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1371,7 +1434,7 @@ ya = ya
|
|||||||
-- | Return | [`tab::Tab?`](#tab-tab) |
|
-- | Return | [`tab::Tab?`](#tab-tab) |
|
||||||
---@field __index fun(self: self, idx: integer): tab__Tab?
|
---@field __index fun(self: self, idx: integer): tab__Tab?
|
||||||
|
|
||||||
--
|
-- A tab.
|
||||||
---@class (exact) tab__Tab
|
---@class (exact) tab__Tab
|
||||||
-- Name of the tab.
|
-- Name of the tab.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1428,7 +1491,7 @@ ya = ya
|
|||||||
-- | Type | `{ total: integer, succ: integer, fail: integer, found: integer, processed: integer }` |
|
-- | Type | `{ total: integer, succ: integer, fail: integer, found: integer, processed: integer }` |
|
||||||
---@field progress { total: integer, succ: integer, fail: integer, found: integer, processed: integer }
|
---@field progress { total: integer, succ: integer, fail: integer, found: integer, processed: integer }
|
||||||
|
|
||||||
--
|
-- Yanked files.
|
||||||
---@class (exact) mgr__Yanked
|
---@class (exact) mgr__Yanked
|
||||||
-- Whether in cut mode.
|
-- Whether in cut mode.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -1456,7 +1519,7 @@ ya = ya
|
|||||||
-- | ---- | ---------------------- |
|
-- | ---- | ---------------------- |
|
||||||
-- | Type | [`rt::Args`](#rt-args) |
|
-- | Type | [`rt::Args`](#rt-args) |
|
||||||
---@field args rt__Args
|
---@field args rt__Args
|
||||||
-- User's terminal properties.
|
-- User's terminal emulator properties.
|
||||||
-- | | |
|
-- | | |
|
||||||
-- | ---- | ---------------------- |
|
-- | ---- | ---------------------- |
|
||||||
-- | Type | [`rt::Term`](#rt-term) |
|
-- | Type | [`rt::Term`](#rt-term) |
|
||||||
@@ -1553,7 +1616,7 @@ ya = ya
|
|||||||
--
|
--
|
||||||
---@class (exact) rt__Args
|
---@class (exact) rt__Args
|
||||||
|
|
||||||
--
|
-- User's terminal emulator properties.
|
||||||
---@class (exact) rt__Term
|
---@class (exact) rt__Term
|
||||||
-- Whether the terminal is in light mode.
|
-- Whether the terminal is in light mode.
|
||||||
-- | | |
|
-- | | |
|
||||||
@@ -2212,6 +2275,11 @@ ya = ya
|
|||||||
-- | `self` | `Self` |
|
-- | `self` | `Self` |
|
||||||
-- | Return | `Status?, Error?` |
|
-- | Return | `Status?, Error?` |
|
||||||
---@field status fun(self: self): Status?, Error?
|
---@field status fun(self: self): Status?, Error?
|
||||||
|
-- Make a new command.
|
||||||
|
-- | In/Out | Type |
|
||||||
|
-- | ------- | -------- |
|
||||||
|
-- | `value` | `string` |
|
||||||
|
-- | Return | `Self` |
|
||||||
---@overload fun(value: string): Command
|
---@overload fun(value: string): Command
|
||||||
|
|
||||||
-- This object is created by [`Command:spawn()`](#Command.spawn) and represents a running child process.
|
-- This object is created by [`Command:spawn()`](#Command.spawn) and represents a running child process.
|
||||||
@@ -2374,85 +2442,141 @@ ya = ya
|
|||||||
|
|
||||||
--
|
--
|
||||||
---@class (exact) ui
|
---@class (exact) ui
|
||||||
--
|
-- A constraint that defines the size of a layout element.
|
||||||
|
-- Constraints can be used to specify a fixed size, a percentage of the available space, a ratio of
|
||||||
|
-- the available space, a minimum or maximum size or a fill proportional value for a layout
|
||||||
|
-- element.
|
||||||
|
-- Relative constraints (percentage, ratio) are calculated relative to the entire space being
|
||||||
|
-- divided, rather than the space available after applying more fixed constraints (min, max,
|
||||||
|
-- length).
|
||||||
|
-- Constraints are prioritized in the following order:
|
||||||
|
-- 1. `ui.Constraint.Min(min)`
|
||||||
|
-- 2. `ui.Constraint.Max(max)`
|
||||||
|
-- 3. `ui.Constraint.Length(len)`
|
||||||
|
-- 4. `ui.Constraint.Percentage(p)`
|
||||||
|
-- 5. `ui.Constraint.Ratio(num, den)`
|
||||||
|
-- 6. `ui.Constraint.Fill(scale)`
|
||||||
---@field Constraint ui.Constraint
|
---@field Constraint ui.Constraint
|
||||||
--
|
-- Alignment of an element such as [`Text`](#text) or [`Line`](#line).
|
||||||
---@field Align ui.Align
|
---@field Align ui.Align
|
||||||
--
|
-- Wrapping behavior of a [`Text`](#text).
|
||||||
---@field Wrap ui.Wrap
|
---@field Wrap ui.Wrap
|
||||||
--
|
-- Which edges of elements such as [`Bar`](#bar) or [`Border`](#border) should be applied.
|
||||||
---@field Edge ui.Edge
|
---@field Edge ui.Edge
|
||||||
-- Make a new rect.
|
-- A Rect is represented an area within the terminal by four attributes:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------- | -------------------------------------------------------- |
|
-- ui.Rect {
|
||||||
-- | `value` | `{ x: integer?, y: integer?, w: integer?, h: integer? }` |
|
-- x = 10, -- x position
|
||||||
-- | Return | `Self` |
|
-- y = 10, -- y position
|
||||||
|
-- w = 20, -- width
|
||||||
|
-- h = 30, -- height
|
||||||
|
-- }
|
||||||
|
-- ui.Rect.default -- Equal to `ui.Rect { x = 0, y = 0, w = 0, h = 0 }`
|
||||||
|
-- ```
|
||||||
|
-- You can get a pre-computed `Rect` through [`ui.Layout()`](#layout).
|
||||||
|
-- Note that if you intend to create a `Rect` yourself, ensure these values are calculated accurately; otherwise, it may cause Yazi to crash!
|
||||||
---@field Rect fun(value: { x: integer?, y: integer?, w: integer?, h: integer? }): ui.Rect
|
---@field Rect fun(value: { x: integer?, y: integer?, w: integer?, h: integer? }): ui.Rect
|
||||||
-- Make a new padding.
|
-- `Pad` represents a padding, and all of its parameters are integers:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | -------- | --------- |
|
-- ui.Pad(top, right, bottom, left)
|
||||||
-- | `top` | `integer` |
|
-- ```
|
||||||
-- | `right` | `integer` |
|
|
||||||
-- | `bottom` | `integer` |
|
|
||||||
-- | `left` | `integer` |
|
|
||||||
-- | Return | `Self` |
|
|
||||||
---@field Pad fun(top: integer, right: integer, bottom: integer, left: integer): ui.Pad
|
---@field Pad fun(top: integer, right: integer, bottom: integer, left: integer): ui.Pad
|
||||||
-- Make a new style.
|
-- Create a style:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------ | ------ |
|
-- ui.Style()
|
||||||
-- | Return | `Self` |
|
-- ```
|
||||||
---@field Style fun(): ui.Style
|
---@field Style fun(): ui.Style
|
||||||
-- Make a new span.
|
-- `ui.Span` is the smallest unit of text, yet a component of `ui.Line`. Create a span:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------- | ------------------ |
|
-- ui.Span("foo")
|
||||||
-- | `value` | `string` \| `Self` |
|
-- ```
|
||||||
-- | Return | `Self` |
|
-- For convenience, `ui.Span` can also accept itself as a argument:
|
||||||
|
-- ```lua
|
||||||
|
-- ui.Span(ui.Span("bar"))
|
||||||
|
-- ```
|
||||||
---@field Span fun(value: string|self): ui.Span
|
---@field Span fun(value: string|self): ui.Span
|
||||||
-- Make a new line.
|
-- `ui.Line` represents a line, consisting of multiple `ui.Span`s, and it accepts a table of them:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------- | -------------------------------------------------------- |
|
-- ui.Line { ui.Span("foo"), ui.Span("bar") }
|
||||||
-- | `value` | `string` \| `Span` \| `Self` \| `(string\|Span\|Self)[]` |
|
-- ```
|
||||||
-- | Return | `Self` |
|
-- For convenience, the following types are also supported:
|
||||||
|
-- ```lua
|
||||||
|
-- -- string
|
||||||
|
-- ui.Line("foo")
|
||||||
|
-- -- ui.Span
|
||||||
|
-- ui.Line(ui.Span("bar"))
|
||||||
|
-- -- ui.Line itself
|
||||||
|
-- ui.Line(ui.Line("baz"))
|
||||||
|
-- -- Mixed table of string, ui.Span, ui.Line
|
||||||
|
-- ui.Line { "foo", ui.Span("bar"), ui.Line("baz") }
|
||||||
|
-- ```
|
||||||
---@field Line fun(value: string|ui.Span|self|(string|ui.Span|self)[]): ui.Line
|
---@field Line fun(value: string|ui.Span|self|(string|ui.Span|self)[]): ui.Line
|
||||||
-- Make a new text.
|
-- `ui.Text` is used to represent multi-line text, it takes a table of `ui.Line`:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------- | -------------------------------------------------------- |
|
-- ui.Text { ui.Line("foo"), ui.Line("bar") }
|
||||||
-- | `value` | `string` \| `Span` \| `Line` \| `(string\|Span\|Line)[]` |
|
-- ```
|
||||||
-- | Return | `Self` |
|
-- For convenience, the following types are also supported:
|
||||||
|
-- ```lua
|
||||||
|
-- -- string
|
||||||
|
-- ui.Text("foo\nbar")
|
||||||
|
-- -- ui.Line
|
||||||
|
-- ui.Text(ui.Line("foo"))
|
||||||
|
-- -- ui.Span
|
||||||
|
-- ui.Text(ui.Span("bar"))
|
||||||
|
-- -- Mixed table of string, ui.Line, ui.Span
|
||||||
|
-- ui.Text { "foo", ui.Line("bar"), ui.Span("baz") }
|
||||||
|
-- ```
|
||||||
|
-- You can also use `ui.Text.parse(code)` to parse an [ANSI escape sequence](https://en.wikipedia.org/wiki/ANSI_escape_code) string into a text.
|
||||||
---@field Text fun(value: string|ui.Span|ui.Line|(string|ui.Span|ui.Line)[]): ui.Text
|
---@field Text fun(value: string|ui.Span|ui.Line|(string|ui.Span|ui.Line)[]): ui.Text
|
||||||
-- Make a new layout.
|
-- Create a layout:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------ | ------ |
|
-- local areas = ui.Layout()
|
||||||
-- | Return | `Self` |
|
-- :direction(ui.Layout.HORIZONTAL)
|
||||||
|
-- :constraints({ ui.Constraint.Percentage(50), ui.Constraint.Percentage(50) })
|
||||||
|
-- :split(area)
|
||||||
|
-- local left = areas[1] -- The first rect
|
||||||
|
-- local right = areas[2] -- The second rect
|
||||||
|
-- ```
|
||||||
---@field Layout fun(): ui.Layout
|
---@field Layout fun(): ui.Layout
|
||||||
-- Make a new list.
|
-- Create a `List` that takes a table of `ui.Text`:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------- | ------------------------------------------------------------------------ |
|
-- ui.List { ui.Text("foo"), ui.Text("bar") }
|
||||||
-- | `value` | `string` \| `Span` \| `Line` \| `Text` \| `(string\|Span\|Line\|Text)[]` |
|
-- ```
|
||||||
-- | Return | `Self` |
|
-- For convenience, the following types are also supported:
|
||||||
|
-- ```lua
|
||||||
|
-- -- Table of string
|
||||||
|
-- ui.List { "foo", "bar" }
|
||||||
|
-- -- Table of ui.Line
|
||||||
|
-- ui.List { ui.Line("foo"), ui.Line("bar") }
|
||||||
|
-- -- Table of ui.Span
|
||||||
|
-- ui.List { ui.Span("foo"), ui.Span("bar") }
|
||||||
|
-- -- Mixed table of string, ui.Line, ui.Span
|
||||||
|
-- ui.List { "foo", ui.Line("bar"), ui.Span("baz") }
|
||||||
|
-- ```
|
||||||
---@field List fun(value: string|ui.Span|ui.Line|ui.Text|(string|ui.Span|ui.Line|ui.Text)[]): ui.List
|
---@field List fun(value: string|ui.Span|ui.Line|ui.Text|(string|ui.Span|ui.Line|ui.Text)[]): ui.List
|
||||||
-- Make a new bar.
|
-- Create a bar:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------ | --------------- |
|
-- ui.Bar(edge)
|
||||||
-- | `edge` | [`Edge`](#edge) |
|
-- ```
|
||||||
-- | Return | `Self` |
|
-- The first attribute denotes the direction of the bar and accepts an [`Edge`](#edge) constant.
|
||||||
---@field Bar fun(edge: ui.Edge): ui.Bar
|
---@field Bar fun(edge: ui.Edge): ui.Bar
|
||||||
-- Make a new border.
|
-- Create a border:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------ | --------------- |
|
-- ui.Border(edge)
|
||||||
-- | `edge` | [`Edge`](#edge) |
|
-- ```
|
||||||
-- | Return | `Self` |
|
-- The first attribute denotes the edge of the border and accepts an [`Edge`](#edge) constant.
|
||||||
---@field Border fun(edge: ui.Edge): ui.Border
|
---@field Border fun(edge: ui.Edge): ui.Border
|
||||||
-- Make a new gauge.
|
-- Create a gauge:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------ | ------ |
|
-- ui.Gauge()
|
||||||
-- | Return | `Self` |
|
-- ```
|
||||||
---@field Gauge fun(): ui.Gauge
|
---@field Gauge fun(): ui.Gauge
|
||||||
-- Make a new clear.
|
-- Clear the content of a specific area, which is a [Rect](#rect). Place it followed by the component that you want to clear:
|
||||||
-- | In/Out | Type |
|
-- ```lua
|
||||||
-- | ------ | --------------- |
|
-- local components = {
|
||||||
-- | `rect` | [`Rect`](#rect) |
|
-- ui.Text("..."):area(rect),
|
||||||
-- | Return | `Self` |
|
-- -- ...
|
||||||
|
-- ui.Clear(rect),
|
||||||
|
-- }
|
||||||
|
-- ```
|
||||||
---@field Clear fun(rect: ui.Rect): ui.Clear
|
---@field Clear fun(rect: ui.Rect): ui.Clear
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user