mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
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:
@@ -1,4 +1,4 @@
|
||||
use core_types::table::{Table, TableRow};
|
||||
use core_types::table::{Item, Table};
|
||||
use core_types::{ATTR_TYPE, Ctx};
|
||||
use serde_json::Value;
|
||||
|
||||
@@ -248,10 +248,7 @@ fn query_json_all(
|
||||
let mut results = Vec::new();
|
||||
resolve_all(&value, &segments, !unquote_strings, &mut results);
|
||||
|
||||
results
|
||||
.into_iter()
|
||||
.map(|(text, ty)| TableRow::new_from_element(text).with_attribute(ATTR_TYPE, ty.to_string()))
|
||||
.collect()
|
||||
results.into_iter().map(|(text, ty)| Item::new_from_element(text).with_attribute(ATTR_TYPE, ty.to_string())).collect()
|
||||
}
|
||||
|
||||
/// A parsed segment of a JSON access path.
|
||||
|
||||
@@ -8,7 +8,7 @@ mod to_path;
|
||||
use convert_case::{Boundary, Converter, pattern};
|
||||
use core_types::graphene_hash::CacheHash;
|
||||
use core_types::registry::types::{SignedInteger, TextArea};
|
||||
use core_types::table::{Table, TableRow};
|
||||
use core_types::table::{Item, Table};
|
||||
use core_types::{CloneVarArgs, Context, Ctx, ExtractAll, ExtractVarArgs, OwnedContextImpl};
|
||||
use dyn_any::DynAny;
|
||||
use glam::{DAffine2, DVec2};
|
||||
@@ -30,10 +30,13 @@ pub use vector_types;
|
||||
pub enum TextAlign {
|
||||
#[default]
|
||||
#[icon("TextAlignLeft")]
|
||||
#[cfg_attr(feature = "serde", serde(alias = "Left"))]
|
||||
AlignLeft,
|
||||
#[icon("TextAlignCenter")]
|
||||
#[cfg_attr(feature = "serde", serde(alias = "Center"))]
|
||||
AlignCenter,
|
||||
#[icon("TextAlignRight")]
|
||||
#[cfg_attr(feature = "serde", serde(alias = "Right"))]
|
||||
AlignRight,
|
||||
#[icon("TextJustifyLeft")]
|
||||
JustifyLeft,
|
||||
@@ -737,7 +740,7 @@ fn string_split(
|
||||
) -> Table<String> {
|
||||
let delimiter = if delimiter_escaping { unescape_string(delimiter) } else { delimiter };
|
||||
|
||||
string.split(&delimiter).map(str::to_string).map(TableRow::new_from_element).collect()
|
||||
string.split(&delimiter).map(str::to_string).map(Item::new_from_element).collect()
|
||||
}
|
||||
|
||||
/// Joins a list of strings together with a separator between each pair. This is the inverse of the **String Split** node.
|
||||
@@ -778,7 +781,7 @@ async fn map_string(
|
||||
let owned_ctx = owned_ctx.with_vararg(Box::new(string)).with_index(i);
|
||||
let mapped_string = mapped.eval(owned_ctx.into_context()).await;
|
||||
|
||||
result.push(TableRow::new_from_element(mapped_string));
|
||||
result.push(Item::new_from_element(mapped_string));
|
||||
}
|
||||
|
||||
result
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use core_types::table::{Table, TableRow};
|
||||
use core_types::table::{Item, Table};
|
||||
use core_types::{ATTR_EDITOR_CLICK_TARGET, ATTR_EDITOR_TEXT_FRAME, ATTR_TRANSFORM};
|
||||
use glam::{DAffine2, DVec2};
|
||||
use parley::GlyphRun;
|
||||
@@ -84,7 +84,7 @@ impl PathBuilder {
|
||||
// back to the layer-local frame origin, regardless of which glyph survived
|
||||
let frame_in_item_local = DAffine2::from_scale_angle_translation(self.text_frame_size, 0., -glyph_offset);
|
||||
|
||||
let item = TableRow::new_from_element(Vector::from_subpaths(core::mem::take(&mut self.glyph_subpaths), false))
|
||||
let item = Item::new_from_element(Vector::from_subpaths(core::mem::take(&mut self.glyph_subpaths), false))
|
||||
.with_attribute(ATTR_TRANSFORM, DAffine2::from_translation(glyph_offset))
|
||||
.with_attribute(ATTR_EDITOR_TEXT_FRAME, frame_in_item_local);
|
||||
self.vector_table.push(item);
|
||||
@@ -169,7 +169,7 @@ impl PathBuilder {
|
||||
// TODO: Remove this hack and move the attribute up to the parent return value when <https://github.com/GraphiteEditor/Graphite/issues/3779> is done.
|
||||
if self.vector_table.is_empty() {
|
||||
let frame_in_item_local = DAffine2::from_scale_angle_translation(self.text_frame_size, 0., -self.first_glyph_offset);
|
||||
let item = TableRow::new_from_element(Vector::default())
|
||||
let item = Item::new_from_element(Vector::default())
|
||||
.with_attribute(ATTR_TRANSFORM, DAffine2::from_translation(self.first_glyph_offset))
|
||||
.with_attribute(ATTR_EDITOR_TEXT_FRAME, frame_in_item_local);
|
||||
self.vector_table.push(item);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use core_types::registry::types::SignedInteger;
|
||||
use core_types::table::{Table, TableRow};
|
||||
use core_types::table::{Item, Table};
|
||||
use core_types::{ATTR_END, ATTR_NAME, ATTR_START, Ctx};
|
||||
|
||||
/// Checks whether the string contains a match for the given regular expression pattern. Optionally restricts the match to only the start and/or end of the string.
|
||||
@@ -143,7 +143,7 @@ fn regex_find(
|
||||
let start = captured.map_or(0_u64, |m| m.start() as u64);
|
||||
let end = captured.map_or(0_u64, |m| m.end() as u64);
|
||||
let name = capture_names.get(i).cloned().flatten().unwrap_or_default();
|
||||
TableRow::new_from_element(text)
|
||||
Item::new_from_element(text)
|
||||
.with_attribute(ATTR_START, start)
|
||||
.with_attribute(ATTR_END, end)
|
||||
.with_attribute(ATTR_NAME, name)
|
||||
@@ -187,7 +187,7 @@ fn regex_find_all(
|
||||
.find_iter(&string)
|
||||
.filter_map(|m| m.ok())
|
||||
.map(|m| {
|
||||
TableRow::new_from_element(m.as_str().to_string())
|
||||
Item::new_from_element(m.as_str().to_string())
|
||||
.with_attribute(ATTR_START, m.start() as u64)
|
||||
.with_attribute(ATTR_END, m.end() as u64)
|
||||
})
|
||||
@@ -226,5 +226,5 @@ fn regex_split(
|
||||
return Table::new_from_element(string);
|
||||
};
|
||||
|
||||
regex.split(&string).filter_map(|s| s.ok()).map(|s| s.to_string()).map(TableRow::new_from_element).collect()
|
||||
regex.split(&string).filter_map(|s| s.ok()).map(|s| s.to_string()).map(Item::new_from_element).collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user