Skip to content

Commit a08b345

Browse files
authored
docs: document the applicability of all yazi-* crates (#3345)
1 parent d3ad1c0 commit a08b345

File tree

33 files changed

+333
-200
lines changed

33 files changed

+333
-200
lines changed

Cargo.lock

Lines changed: 186 additions & 185 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ansi-to-tui = "7.0.0"
2424
anyhow = "1.0.100"
2525
base64 = "0.22.1"
2626
bitflags = { version = "2.10.0", features = [ "serde" ] }
27-
clap = { version = "4.5.51", features = [ "derive" ] }
27+
clap = { version = "4.5.53", features = [ "derive" ] }
2828
core-foundation-sys = "0.8.7"
2929
crossterm = { version = "0.29.0", features = [ "event-stream" ] }
3030
dirs = "6.0.0"

yazi-actor/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yazi-actor
2+
3+
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
4+
5+
[source]: https://github.com/sxyazi/yazi

yazi-adapter/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ ansi-to-tui = { workspace = true }
2020
anyhow = { workspace = true }
2121
base64 = { workspace = true }
2222
crossterm = { workspace = true }
23-
image = { version = "0.25.8", default-features = false, features = [ "avif", "bmp", "dds", "exr", "ff", "gif", "hdr", "ico", "jpeg", "png", "pnm", "qoi", "tga", "webp" ] }
23+
image = { version = "0.25.9", default-features = false, features = [ "avif", "bmp", "dds", "exr", "ff", "gif", "hdr", "ico", "jpeg", "png", "pnm", "qoi", "tga", "webp" ] }
2424
palette = { version = "0.7.6", default-features = false }
25-
quantette = { version = "0.3.0", default-features = false }
25+
quantette = { version = "0.5.1", default-features = false }
2626
ratatui = { workspace = true }
2727
scopeguard = { workspace = true }
2828
tokio = { workspace = true }

yazi-adapter/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yazi-adapter
2+
3+
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
4+
5+
[source]: https://github.com/sxyazi/yazi

yazi-adapter/src/drivers/sixel.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ use anyhow::{Result, bail};
44
use crossterm::{cursor::MoveTo, queue};
55
use image::{DynamicImage, GenericImageView, RgbImage};
66
use palette::{Srgb, cast::ComponentsAs};
7-
use quantette::{ColorSlice, PaletteSize, QuantizeOutput, wu::UIntBinner};
7+
use quantette::{PaletteSize, color_map::IndexedColorMap, wu::{BinnerU8x3, WuU8x3}};
88
use ratatui::layout::Rect;
99

1010
use crate::{CLOSE, ESCAPE, Emulator, Image, START, adapter::Adapter};
1111

1212
pub(crate) struct Sixel;
1313

14+
struct QuantizeOutput<T> {
15+
indices: Vec<u8>,
16+
palette: Vec<T>,
17+
}
18+
1419
impl Sixel {
1520
pub(crate) async fn image_show(path: PathBuf, max: Rect) -> Result<Rect> {
1621
let img = Image::downscale(path, max).await?;
@@ -110,12 +115,14 @@ impl Sixel {
110115

111116
fn quantify(rgb: &RgbImage, alpha: bool) -> Result<QuantizeOutput<Srgb<u8>>> {
112117
let buf = &rgb.as_raw()[..(rgb.pixels().len() * 3)];
113-
let slice: ColorSlice<Srgb<u8>> = buf.components_as().try_into()?;
118+
let colors: &[Srgb<u8>] = buf.components_as();
114119

115-
Ok(quantette::wu::indexed_palette(
116-
&slice,
117-
PaletteSize::try_from(256u16 - alpha as u16)?,
118-
&UIntBinner::<32>,
119-
))
120+
let wu = WuU8x3::run_slice(colors, BinnerU8x3::rgb())?;
121+
let color_map = wu.color_map(PaletteSize::try_from(256u16 - alpha as u16)?);
122+
123+
Ok(QuantizeOutput {
124+
indices: color_map.map_to_indices(colors),
125+
palette: color_map.into_palette().into_vec(),
126+
})
120127
}
121128
}

yazi-binding/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yazi-binding
2+
3+
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
4+
5+
[source]: https://github.com/sxyazi/yazi

yazi-boot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ yazi-shared = { path = "../yazi-shared", version = "25.9.15" }
2828

2929
# External dependencies
3030
clap = { workspace = true }
31-
clap_complete = "4.5.60"
31+
clap_complete = "4.5.61"
3232
clap_complete_fig = "4.5.2"
3333
clap_complete_nushell = "4.5.10"
3434
vergen-gitcl = { version = "1.0.8", features = [ "build", "rustc" ] }

yazi-boot/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yazi-boot
2+
3+
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
4+
5+
[source]: https://github.com/sxyazi/yazi

yazi-build/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yazi-build
2+
3+
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
4+
5+
[source]: https://github.com/sxyazi/yazi

0 commit comments

Comments
 (0)