Rename the Table type's "rows" -> "items" and "columns" -> "attributes" everywhere (#4130)

* Rename TableRow -> Item

* Rename row -> item and column -> attribute throughout

* Fix a few missed ones

* Format
This commit is contained in:
Keavon Chambers
2026-05-08 23:11:33 -07:00
committed by GitHub
parent cb21e5960b
commit 6b3e4757de
26 changed files with 554 additions and 550 deletions

View File

@@ -4,7 +4,7 @@ use base64::Engine;
use canvas_utils::{Canvas, CanvasHandle};
#[cfg(target_family = "wasm")]
use core_types::math::bbox::Bbox;
use core_types::table::{Table, TableRow};
use core_types::table::{Item, Table};
#[cfg(target_family = "wasm")]
use core_types::transform::Footprint;
#[cfg(target_family = "wasm")]
@@ -116,14 +116,14 @@ async fn post_request(
/// Converts a text string to raw binary data. Useful for transmission over HTTP or writing to files.
#[node_macro::node(category("Web Request"), name("String to Bytes"))]
fn string_to_bytes(_: impl Ctx, string: String) -> Table<u8> {
string.into_bytes().into_iter().map(TableRow::new_from_element).collect()
string.into_bytes().into_iter().map(Item::new_from_element).collect()
}
/// Converts extracted raw RGBA pixel data from an input image. Each pixel becomes 4 sequential bytes. Useful for transmission over HTTP or writing to files.
#[node_macro::node(category("Web Request"), name("Image to Bytes"))]
fn image_to_bytes(_: impl Ctx, image: Table<Raster<CPU>>) -> Table<u8> {
let Some(image) = image.element(0) else { return Table::new() };
image.data.iter().flat_map(|color| color.to_rgba8_srgb()).map(TableRow::new_from_element).collect()
image.data.iter().flat_map(|color| color.to_rgba8_srgb()).map(Item::new_from_element).collect()
}
/// Loads binary from URLs and local asset paths. Returns a transparent placeholder if the resource fails to load, allowing rendering to continue.
@@ -235,8 +235,8 @@ where
let rasterized = context.get_image_data(0., 0., resolution.x as f64, resolution.y as f64).unwrap();
let image = Image::from_image_data(&rasterized.data().0, resolution.x as u32, resolution.y as u32);
Table::new_from_row(
TableRow::new_from_element(Raster::new_cpu(image))
Table::new_from_item(
Item::new_from_element(Raster::new_cpu(image))
.with_attribute(ATTR_TRANSFORM, footprint.transform)
.with_attribute(ATTR_EDITOR_MERGED_LAYERS, upstream_graphic_table),
)