From 8f5aed7ea47de494153cd13c4203d43fdf9709bb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 22:07:06 -0800 Subject: [PATCH 1/3] Variables: Import Data Sets reads % columns of graph data files dataset.import refused every header cell that starts with % unless it was a variable's exact name, so the five-column example on the data source set-up page did not import. A %Name header now defines the graph variable Name, or names it when the document has it, and each cell of the column is the path of a graph data file. The file is read as the Graph Data window's Import Data reads one, and the data becomes the data set's graph value, which applies as graph.setData applies it. A relative path is taken from the new base parameter, else from the folder of the CSV file at path. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value longer than 256 KB, and % columns that hold more than 256 MB in all refuse the import with the line and the column, and the document is left as it was. Each file is read once per import. Import Data's text decoding, cell splitting and sheet-to-data steps move from the Graph Data dialog to the engine (graph/data.rs), so both imports read a file the same way. dataset.export's warning now lists a % header over values as refused and a %-prefixed variable of another kind as read back with another kind. --- crates/engine/src/cmd.rs | 4 + crates/engine/src/cmd/graph.rs | 3 +- crates/engine/src/cmd/graph/data.rs | 96 ++++++++++++++++ crates/engine/src/cmd/variablecmds.rs | 5 +- crates/engine/src/cmd/variablecmds/csv.rs | 121 +++++++++++++++++--- crates/engine/src/tests/variables.rs | 130 ++++++++++++++++++++-- crates/ui-egui/src/dialogs/graph_data.rs | 73 ++---------- crates/ui-egui/src/i18n/cs.tsv | 7 +- crates/ui-egui/src/i18n/de.tsv | 7 +- crates/ui-egui/src/i18n/fr.tsv | 7 +- crates/ui-egui/src/i18n/hi.tsv | 7 +- crates/ui-egui/src/i18n/hu.tsv | 7 +- crates/ui-egui/src/i18n/it.tsv | 7 +- crates/ui-egui/src/i18n/ja.tsv | 7 +- crates/ui-egui/src/i18n/ko.tsv | 7 +- crates/ui-egui/src/i18n/nl.tsv | 7 +- crates/ui-egui/src/i18n/pl.tsv | 7 +- crates/ui-egui/src/i18n/pt-br.tsv | 7 +- crates/ui-egui/src/i18n/sv.tsv | 7 +- crates/ui-egui/src/i18n/tr.tsv | 7 +- crates/ui-egui/src/i18n/uk.tsv | 7 +- crates/ui-egui/src/i18n/zh-hans.tsv | 7 +- crates/ui-egui/src/i18n/zh-hant.tsv | 7 +- crates/ui-egui/src/panels/variables.rs | 2 + docs/mcp.md | 35 ++++-- docs/target-app-parity.md | 1 + 26 files changed, 463 insertions(+), 119 deletions(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 99b8e1ecdd..72ca754ccd 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -896,6 +896,10 @@ pub use brushsym::reset_transformation_changes; /// Data window reads files by it too). pub use variablecmds::utf16_order_without_mark; +/// How the Graph Data window's Import Data and Import Data Sets' `%` columns read a graph data +/// file: its size limit, its text, its cells and the data `graph.setData` takes from them. +pub use graph::{MAX_GRAPH_DATA_FILE, graph_cell_text, graph_data_from_grid, graph_data_text, graph_grid_from_text}; + /// Command ids kept only so older scripts keep working: `(alias, the command it duplicates)`. /// They run as before but the command palette leaves them out (it lists the command once). pub const ALIASES: &[(&str, &str)] = &[("object.convertDocumentColorMode", "file.documentColorMode")]; diff --git a/crates/engine/src/cmd/graph.rs b/crates/engine/src/cmd/graph.rs index 06557e6f59..a504aa4df3 100644 --- a/crates/engine/src/cmd/graph.rs +++ b/crates/engine/src/cmd/graph.rs @@ -37,7 +37,8 @@ use axis::{nice_axis, tick_values}; #[cfg(test)] use columns::{fill_totals, total_text}; pub use commands::specs; -pub(crate) use data::{apply_csv, parse_csv}; +pub use data::{MAX_GRAPH_DATA_FILE, graph_cell_text, graph_data_from_grid, graph_data_text, graph_grid_from_text}; +pub(crate) use data::{apply_csv, graph_csv_from_file, parse_csv}; #[cfg(test)] use data::{fmt_value, to_csv}; pub(crate) use edit::{graphs_holding, keep_placed}; diff --git a/crates/engine/src/cmd/graph/data.rs b/crates/engine/src/cmd/graph/data.rs index 68a83fd80a..b231ee2051 100644 --- a/crates/engine/src/cmd/graph/data.rs +++ b/crates/engine/src/cmd/graph/data.rs @@ -91,6 +91,102 @@ pub(super) fn to_csv(g: &GraphSpec) -> String { g.to_csv() } +// ---------- graph data files ---------- + +/// The largest graph data file that Graph Data's Import Data and Import Data Sets' `%` columns +/// read, 1 MB (1,048,576 bytes). +pub const MAX_GRAPH_DATA_FILE: usize = 1 << 20; + +/// A graph data sheet's size: a row of labels over a graph's categories, a column of labels +/// before its series; a cell's longest text. +const SHEET_ROWS: usize = vectorcraft_doc::MAX_GRAPH_CATEGORIES + 1; +const SHEET_COLS: usize = vectorcraft_doc::MAX_GRAPH_SERIES + 1; +const SHEET_CELL: usize = 256; + +/// A graph data file's bytes as text: UTF-16 with its byte-order mark (spreadsheets' "Unicode +/// Text"), else UTF-16 without one when the bytes hold NUL bytes and Import Data Sets' rule gives +/// them a byte order ([`crate::cmd::utf16_order_without_mark`]), else UTF-8 with or without one. +/// UTF-16 is read as it is after a byte-order mark: an odd last byte is left out, and an unpaired +/// surrogate reads as U+FFFD. +pub fn graph_data_text(bytes: &[u8]) -> String { + let utf16 = |rest: &[u8], le: bool| { + let units: Vec = rest.as_chunks::<2>().0.iter().map(|p| if le { u16::from_le_bytes(*p) } else { u16::from_be_bytes(*p) }).collect(); + String::from_utf16_lossy(&units) + }; + match bytes { + [0xFF, 0xFE, rest @ ..] => utf16(rest, true), + [0xFE, 0xFF, rest @ ..] => utf16(rest, false), + [0xEF, 0xBB, 0xBF, rest @ ..] => String::from_utf8_lossy(rest).into_owned(), + _ => match bytes.contains(&0).then(|| crate::cmd::utf16_order_without_mark(bytes)).flatten() { + Some(le) => utf16(bytes, le), + None => String::from_utf8_lossy(bytes).into_owned(), + }, + } +} + +/// A graph data sheet cell's text: one line (tabs and line breaks become spaces), at most 256 +/// characters. +pub fn graph_cell_text(s: &str) -> String { + s.chars().map(|c| if matches!(c, '\t' | '\r' | '\n') { ' ' } else { c }).take(SHEET_CELL).collect() +} + +/// Text from a file or the clipboard as graph data sheet cells: tab-separated when any line holds +/// a tab, else comma-separated (decided once, so a label with a comma in a tab-separated file +/// stays whole), at most a graph's rows and columns. +pub fn graph_grid_from_text(text: &str) -> Vec> { + let sep = if text.contains('\t') { '\t' } else { ',' }; + text.lines().take(SHEET_ROWS).map(|l| l.trim_end_matches('\r').split(sep).take(SHEET_COLS).map(|c| graph_cell_text(c.trim())).collect()).collect() +} + +/// A graph data sheet as `graph.setData` takes it: the first row holds the series labels, the +/// first column the category labels (none when all are blank), and the other cells the values (a +/// blank cell, or text that isn't a number, has none), without the empty rows and columns past +/// the data. +pub fn graph_data_from_grid(grid: &[Vec]) -> Value { + let cell = |r: usize, c: usize| grid.get(r).and_then(|row| row.get(c)).cloned().unwrap_or_default(); + let filled = |s: &String| !s.trim().is_empty(); + // At most a graph's rows and columns, as a file gives (`graph_grid_from_text`): a grid sent by + // automation is any size, and the values are their product. + let grid = &grid[..grid.len().min(SHEET_ROWS)]; + let rows = grid.iter().rposition(|r| r.iter().take(SHEET_COLS).any(filled)).map_or(1, |i| i + 1).max(1); + let cols = grid.iter().take(rows).filter_map(|r| r.iter().take(SHEET_COLS).rposition(filled)).max().map_or(1, |i| i + 1).max(1); + let label = |s: &str| { + let s = s.trim(); + // A label typed in straight quotes (as the CSV form takes a number as a label) is the text inside. + s.strip_prefix('"').and_then(|t| t.strip_suffix('"')).unwrap_or(s).to_string() + }; + // Series labels up to the last one given (none when all are blank). + let mut series: Vec = (1..cols).map(|c| label(&cell(0, c))).collect(); + while series.last().is_some_and(String::is_empty) { + series.pop(); + } + let mut categories: Vec = (1..rows).map(|r| label(&cell(r, 0))).collect(); + if categories.iter().all(String::is_empty) { + categories.clear(); + } + let values: Vec> = (1..rows) + .map(|r| { + (1..cols) + .map(|c| { + let t = cell(r, c); + t.trim().parse::().ok().filter(|v| v.is_finite() && !t.trim().starts_with('"')).map_or(Value::Null, |v| json!(v)) + }) + .collect() + }) + .collect(); + json!({ "series": series, "categories": categories, "rows": values }) +} + +/// The graph value (the CSV form [`apply_csv`] reads) of a graph data file's bytes, read as Graph +/// Data's Import Data reads the file into its sheet and Apply sends the sheet: so applying the +/// value gives a graph the data that Import Data and Apply give it. +pub(crate) fn graph_csv_from_file(bytes: &[u8]) -> Result { + let data = graph_data_from_grid(&graph_grid_from_text(&graph_data_text(bytes))); + let mut spec = GraphSpec::default(); + apply_data(&mut spec, &data, "dataset.import")?; + Ok(spec.to_csv()) +} + /// Apply CSV graph data to the graph root `id` and rebuild its art (Variables data merge), as `graph.setData` with /// `csv` does. Data the graph already holds leaves the graph as it is. pub(crate) fn apply_csv(d: &mut Document, id: NodeId, csv: &str) -> Result<()> { diff --git a/crates/engine/src/cmd/variablecmds.rs b/crates/engine/src/cmd/variablecmds.rs index a73c16448b..9650a423a9 100644 --- a/crates/engine/src/cmd/variablecmds.rs +++ b/crates/engine/src/cmd/variablecmds.rs @@ -8,7 +8,8 @@ //! variable name per column, which export writes with `#` before a visibility variable and `@` //! before an image variable); import replaces the datasets, names the rows Data Set 1, 2…, //! also reads tab-separated files, and reads header cells that define new variables (`#` for -//! visibility, `@` for image, no prefix for text). `variable.loadLibrary` replaces the variables and data sets with the +//! visibility, `@` for image, `%` for graph, whose cells name graph data files, no prefix for +//! text). `variable.loadLibrary` replaces the variables and data sets with the //! variables and data sets of a variable library, the XML file of the reference app's Save //! Variable Library, and `variable.saveLibrary` writes the variables and data sets as one. //! Agents reach every command through `run_command`, like all engine commands. @@ -868,7 +869,7 @@ pub fn specs() -> Vec { "Import Data Sets…", ["Window", "Variables"], None, - "{path? | data? | dataBase64? | csv?} replace every dataset with the rows of a CSV, comma- or tab-separated, in UTF-16 (with a byte-order mark, or without one when at least half of its two-byte units hold a NUL byte and only one byte order reads a line break; any other file with NUL bytes is refused), UTF-8 or else Windows-1252 (header: one variable name per column, whatever its case; one row per dataset, named Data Set 1, 2… in file order). The document's variables and their bindings stay. A header that names no variable defines one, unbound: `#Name` defines a visibility variable, `@Name` defines an image variable, and a header without a prefix defines a text variable. A prefixed header whose name is a variable of another kind, and a `%` header that isn't a variable's exact name (graph data files), are refused, and so are two headers that name one variable and a header that would define a variable while the variables are locked. An import that leaves the variables and data sets as they were adds no undo step → {imported, names, defined, deletedDataSets}", + "{path? | data? | dataBase64? | csv?, base?: folder} replace every dataset with the rows of a CSV, comma- or tab-separated, in UTF-16 (with a byte-order mark, or without one when at least half of its two-byte units hold a NUL byte and only one byte order reads a line break; any other file with NUL bytes is refused), UTF-8 or else Windows-1252 (header: one variable name per column, whatever its case; one row per dataset, named Data Set 1, 2… in file order). The document's variables and their bindings stay. A header that names no variable defines one, unbound: `#Name` defines a visibility variable, `@Name` defines an image variable, `%Name` defines a graph variable, and a header without a prefix defines a text variable. A `%Name` column's cells are paths of graph data files, each read as Graph Data's Import Data reads one (at most 1 MB; tab-separated when a line holds a tab, else comma-separated; UTF-16 by dataset.import's rule, else UTF-8, with bytes that aren't UTF-8 read as replacement characters; the first row holds the series labels and the first column the category labels) and kept as the data set's graph value, which applies as graph.setData applies it. A relative path is taken from `base`, else from the folder of the CSV file at `path`; with neither, it is refused. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all (each file counted once, each cell's value every time) refuse the import, naming the line and the column. A prefixed header whose name is a variable of another kind is refused, and so are two headers that name one variable and a header that would define a variable while the variables are locked. An import that leaves the variables and data sets as they were adds no undo step → {imported, names, defined, deletedDataSets}", has_doc, dataset_import ), diff --git a/crates/engine/src/cmd/variablecmds/csv.rs b/crates/engine/src/cmd/variablecmds/csv.rs index be9db3b841..0d3d1057c9 100644 --- a/crates/engine/src/cmd/variablecmds/csv.rs +++ b/crates/engine/src/cmd/variablecmds/csv.rs @@ -3,6 +3,7 @@ use super::{ json, read_file_head, str_param, variables_unlocked, write_file, }; use crate::cmd::place::text::windows_1252; +use crate::cmd::{MAX_GRAPH_DATA_FILE, text_param}; /// Cap on a graph variable's CSV (MCP and files are untrusted). pub(super) const MAX_GRAPH_CSV: usize = 256 * 1024; @@ -268,10 +269,11 @@ fn export_header(v: &Variable) -> String { /// What [`dataset_import`] does with each variable's column of the CSV that [`datasets_to_csv`] /// writes, in a document without the variables: the first list names the variables whose header -/// or values it refuses, so it doesn't import the file (a `%` header, a `#` header whose values -/// aren't true or false, a header that names a variable an earlier column named), and the second -/// the variables it reads as another variable (a text variable whose name starts with `#` or `@`, -/// and a graph variable, which no header cell defines). +/// or values it refuses, so it doesn't import the file (a `%` header over values, which it reads as +/// paths of graph data files, a `#` header whose values aren't true or false, a header that names +/// a variable an earlier column named), and the second the variables it reads as another variable +/// (a variable whose name starts with `#`, `@` or `%` and isn't of that prefix's kind, and a graph +/// variable, which the export writes without `%`). fn kinds_a_new_document_loses(vars: &Variables) -> (Vec<&str>, Vec<&str>) { const C: &str = "dataset.import"; let none = BTreeMap::new(); @@ -287,9 +289,11 @@ fn kinds_a_new_document_loses(vars: &Variables) -> (Vec<&str>, Vec<&str>) { refused.push(v.name.as_str()); continue; }; + // A `%` header's cells are paths of graph data files, which the values the export writes aren't. + let files = kind == VariableKind::Graph && name != cell; let cells_read = vars.datasets.iter().filter_map(|d| d.values.get(&v.name)).all(|val| { let cell = value_to_cell(val); - cell_to_value(kind, &cell, cell.is_empty(), &name, 2, C).is_ok() + if files { cell.trim().is_empty() } else { cell_to_value(kind, &cell, cell.is_empty(), &name, 2, C).is_ok() } }); if !cells_read { refused.push(v.name.as_str()); @@ -340,7 +344,9 @@ fn datasets_to_csv(vars: &Variables, cmd: &str) -> Result { /// that earlier columns define) names that variable. Otherwise `#` before the name makes it a /// visibility variable, `@` makes it an image variable, and a cell without a prefix names a text /// variable. A prefixed name that is already a variable must be one of the prefix's kind; a new -/// name is added to `defined`. A `%` cell that names no variable (graph data files) is refused. +/// name is added to `defined`. `%` before a name makes it a graph variable whose column holds the +/// paths of graph data files ([`graph_file_value`]); [`dataset_import`] tells such a column apart +/// by a returned name that is not the cell. fn header_variable( cell: &str, column: usize, @@ -356,8 +362,8 @@ fn header_variable( (rest.trim(), VariableKind::Visibility) } else if let Some(rest) = cell.strip_prefix('@') { (rest.trim(), VariableKind::Image) - } else if cell.starts_with('%') { - return Err(bad(cmd, format!("column {column}: `{cell}` is a `%` column of graph data files, which are not read"))); + } else if let Some(rest) = cell.strip_prefix('%') { + (rest.trim(), VariableKind::Graph) } else { (cell, VariableKind::Text) }; @@ -375,13 +381,90 @@ fn header_variable( } } +/// The most bytes the `%` columns of one import read from graph data files and keep as graph +/// values, counted together: each file's bytes once (it is read once, however many cells name it), +/// and the graph value of every cell, which each data set holds a copy of. +const MAX_GRAPH_FILES_TOTAL: usize = 256 * 1_048_576; + +/// The graph data files the `%` columns of one import have read, by path, and the bytes counted +/// against [`MAX_GRAPH_FILES_TOTAL`] so far. +#[derive(Default)] +struct GraphFiles { + read: BTreeMap, + total: usize, +} + +/// The graph value of a `%` column's cell `path` on file line `line`, in 1-based `column`, for the +/// graph variable `var`: the graph data file at `path` (taken from the folder `base` when +/// relative), read as Graph Data's Import Data reads one ([`crate::cmd::graph::graph_csv_from_file`]), +/// or no value for an empty cell. A relative path without `base`, a file that can't be read or is +/// larger than 1 MB, a file that gives a graph value longer than [`MAX_GRAPH_CSV`] bytes and more +/// than [`MAX_GRAPH_FILES_TOTAL`] bytes in all are refused, with the line and the column. +fn graph_file_value(files: &mut GraphFiles, path: &str, base: Option<&str>, var: &str, (line, column): (usize, usize)) -> Result> { + const C: &str = "dataset.import"; + let path = path.trim(); + if path.is_empty() { + return Ok(None); + } + let full = match base { + _ if std::path::Path::new(path).is_absolute() => path.to_string(), + Some(base) => std::path::Path::new(base).join(path).to_string_lossy().into_owned(), + None => { + return Err(bad( + C, + format!( + "line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path" + ), + )); + } + }; + let csv = match files.read.get(&full) { + Some(csv) => csv.clone(), + None => { + // One byte past the limit is enough to refuse the file. + let bytes = read_file_head(&full, MAX_GRAPH_DATA_FILE + 1) + .map_err(|e| bad(C, format!("line {line}, column {column}: the graph data file for `{var}` can't be read: {e}")))?; + if bytes.len() > MAX_GRAPH_DATA_FILE { + return Err(bad( + C, + format!("line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes"), + )); + } + let csv = crate::cmd::graph::graph_csv_from_file(&bytes)?; + if csv.len() > MAX_GRAPH_CSV { + return Err(bad( + C, + format!( + "line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes" + ), + )); + } + files.total += bytes.len(); + files.read.insert(full, csv.clone()); + csv + } + }; + files.total += csv.len(); + if files.total > MAX_GRAPH_FILES_TOTAL { + return Err(bad(C, format!("line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all"))); + } + Ok(Some(DataValue::Graph(csv))) +} + /// Import datasets from CSV. Every header cell names a variable, as [`header_variable`] reads it, /// and the variables the document doesn't define yet are defined, unbound. Two headers that name -/// one variable are refused. The rows replace every dataset of the document and are named "Data -/// Set 1", "Data Set 2" and so on, in file order. The document's variables and their bindings +/// one variable are refused. The cells of a `%` column are paths of graph data files +/// ([`graph_file_value`]); a relative one is taken from the folder `base` gives, else from the +/// folder of the file `path` names. The rows replace every dataset of the document and are named +/// "Data Set 1", "Data Set 2" and so on, in file order. The document's variables and their bindings /// stay. One undo step, and none when the variables and datasets stay as they were. pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { const C: &str = "dataset.import"; + let base = match text_param(p, "base", C)? { + Some("") => return Err(bad(C, "`base` is empty")), + Some(base) => Some(absolute_path(base)), + None => str_param(p, "path").and_then(|path| std::path::Path::new(&absolute_path(path)).parent().map(|d| d.to_string_lossy().into_owned())), + }; let (bytes, given_as_text) = datasets_csv_bytes(p, C)?; // `data` and `csv` are already text, NUL characters included (`dataset.export` writes them). let text = if given_as_text { String::from_utf8(bytes).map_err(|_| bad(C, "CSV is not UTF-8"))? } else { datasets_csv_text(&bytes, C)? }; @@ -390,7 +473,8 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { return Err(bad(C, "CSV is empty")); }; let kinds: BTreeMap = s.doc()?.doc.variables.variables.iter().map(|v| (v.name.clone(), v.kind)).collect(); - let mut columns: Vec<(usize, String, VariableKind)> = Vec::new(); + // Each column: its index, its variable and kind, and whether its cells are graph data files. + let mut columns: Vec<(usize, String, VariableKind, bool)> = Vec::new(); let mut defined: Vec = Vec::new(); for (i, h) in header.iter().enumerate() { let cell = h.trim(); @@ -398,11 +482,12 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { return Err(bad(C, format!("empty header in column {}", i + 1))); } let (name, kind) = header_variable(cell, i + 1, &kinds, &mut defined, C)?; - if let Some(&(first, ..)) = columns.iter().find(|(_, n, _)| *n == name) { + if let Some(&(first, ..)) = columns.iter().find(|(_, n, ..)| *n == name) { let (first, column) = (first + 1, i + 1); return Err(bad(C, format!("columns {first} and {column} both name the variable `{name}`"))); } - columns.push((i, name, kind)); + let files = kind == VariableKind::Graph && name != cell; + columns.push((i, name, kind, files)); } // Lock Variables refuses New Variable, so the import is refused when a header would define one. if !defined.is_empty() { @@ -412,13 +497,19 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { return Err(bad(C, "CSV has a header but no data rows")); } let mut parsed: Vec = Vec::new(); + let mut files = GraphFiles::default(); for (n, &(line, ref row, ref quoted)) in rows.iter().skip(1).enumerate() { let name = format!("Data Set {}", n + 1); let mut values = BTreeMap::new(); - for &(col, ref var, kind) in &columns { + for &(col, ref var, kind, from_files) in &columns { let cell = row.get(col).map(String::as_str).unwrap_or(""); let was_quoted = quoted.get(col).copied().unwrap_or(false); - if let Some(v) = cell_to_value(kind, cell, was_quoted, var, line, C)? { + let value = if from_files { + graph_file_value(&mut files, cell, base.as_deref(), var, (line, col + 1))? + } else { + cell_to_value(kind, cell, was_quoted, var, line, C)? + }; + if let Some(v) = value { values.insert(var.clone(), v); } } diff --git a/crates/engine/src/tests/variables.rs b/crates/engine/src/tests/variables.rs index bb5b73b2f2..553ce3c4f4 100644 --- a/crates/engine/src/tests/variables.rs +++ b/crates/engine/src/tests/variables.rs @@ -1958,8 +1958,8 @@ fn datasets_csv_export_imports_back_to_the_same_data_sets() { } /// The export's `warning` names the variables whose column a document without the variables -/// refuses, so it doesn't import the file: a `%` header, a `#` header whose values aren't true or -/// false, and a header that names a variable an earlier column defined with another kind. A +/// refuses, so it doesn't import the file: a `%` header over values, a `#` header whose values +/// aren't true or false, and a header that names a variable an earlier column defined with another kind. A /// header that names such a variable with its kind is read with that kind, and is listed as one /// read back with another kind. #[test] @@ -1977,7 +1977,9 @@ fn datasets_csv_export_warns_of_headers_a_new_document_refuses() { let refuses = |names: &str| format!("a new document refuses this file because of these variables: {names}"); let loses = |names: &str| format!("a new document won't read these variables back with their kind: {names}"); - assert_eq!(export(&[("%Rate", "text"), ("Chart", "graph")], json!({})), (refuses("`%Rate`"), true)); + // A `%` header's cells are read as paths of graph data files. + assert_eq!(export(&[("%Rate", "text"), ("Chart", "graph")], json!({"%Rate": "5"})), (refuses("`%Rate`"), true)); + assert_eq!(export(&[("%Rate", "text"), ("Chart", "graph")], json!({})), (loses("`%Rate`, `Chart`"), false)); assert_eq!(export(&[("#Tag", "text")], json!({"#Tag": "hello"})), (refuses("`#Tag`"), true)); assert_eq!(export(&[("#Tag", "text")], json!({"#Tag": "yes"})), (loses("`#Tag`"), false)); assert_eq!(export(&[("#Seen", "text"), ("Seen", "image")], json!({})), (refuses("`Seen`"), true)); @@ -2005,18 +2007,122 @@ fn datasets_csv_export_refuses_a_header_that_names_another_variable() { } } -/// A `%` header cell that isn't a variable's name (graph data files) is refused with its column, -/// and the import defines nothing. +/// The data `graph.setData` reports for the graph `g`: series, categories and rows. +fn graph_data(s: &mut Session, g: NodeId) -> Value { + let v = s.execute("graph.setData", &json!({"id": g.0})).unwrap(); + json!({"series": v["series"], "categories": v["categories"], "rows": v["rows"]}) +} + +/// A `%` header defines a graph variable, and each of its cells is the path of a graph data file, +/// as the set-up page's five-column example has them. A relative path is taken from the CSV file's +/// folder. Selecting a data set gives the bound graph the data that Graph Data's Import Data and +/// Apply give it for the same file: tab- or comma-separated, the first row the series labels and the +/// first column the category labels, in UTF-16 too. An empty cell is no value. #[test] -fn datasets_csv_refuses_graph_data_file_columns() { +fn datasets_csv_reads_graph_data_files_in_percent_columns() { + let dir = Folder::new("vars-csv-graph-files"); + let tabs: &[u8] = b"\t2024\t2025\nQ1\t3\t4\nQ2\t5\t6\n"; + let commas: &[u8] = b",North\nJan,7\nFeb,8\n"; + let utf16: Vec = [0xFF, 0xFE].into_iter().chain(",A\r\nX,9\r\n".encode_utf16().flat_map(u16::to_le_bytes)).collect(); + write(&dir.file("graphs/bill.txt"), tabs); + write(&dir.file("dat.csv"), commas); + write(&dir.file("ruiz.txt"), &utf16); + let absolute = dir.file("dat.csv"); + let csv = format!( + "Name,Age,@Photos,%Graphs,#Visibility\nBill,36,b.jpg,graphs/bill.txt,true\nDat,53,d.jpg,{absolute},true\nMaria,26,r.jpg,ruiz.txt,false\nNone,1,n.jpg,,true\n" + ); + let path = dir.file("data.csv"); + write(&path, csv.as_bytes()); + let mut s = session(); - let error = |s: &mut Session, csv: &str| s.execute("dataset.import", &json!({"csv": csv})).unwrap_err().to_string(); - let named = error(&mut s, "Name,Title,%Sales\nA,x,sales.txt"); - assert!(named.contains("column 3:") && named.contains("`%Sales`"), "{named}"); - let unnamed = error(&mut s, "%Sales\tTitle\nsales.txt\tx"); - assert!(unnamed.contains("column 1:") && unnamed.contains("`%Sales`"), "{unnamed}"); + let graph = s.execute("graph.create", &json!({"type": "column", "x": 10, "y": 10, "width": 100, "height": 80, "csv": ",B\nY,1"})).unwrap(); + let g = NodeId(graph["id"].as_u64().unwrap()); + let imp = s.execute("dataset.import", &json!({"path": path})).unwrap(); + assert_eq!(imp["defined"], json!(["Name", "Age", "Photos", "Graphs", "Visibility"])); + assert_eq!(imp["imported"], 4); + let listed = s.execute("variable.list", &json!({})).unwrap(); + assert_eq!(listed["variables"][3], json!({"name": "Graphs", "kind": "graph", "bindings": 0})); + s.execute("variable.bind", &json!({"variable": "Graphs", "ids": [g.0]})).unwrap(); + + // What Import Data and Apply give the graph for each file. + let sheet = |bytes: &[u8]| { + let data = crate::cmd::graph_data_from_grid(&crate::cmd::graph_grid_from_text(&crate::cmd::graph_data_text(bytes))); + let mut probe = session(); + let p = json!({"type": "column", "x": 10, "y": 10, "width": 100, "height": 80, "csv": ",B\nY,1"}); + let id = NodeId(probe.execute("graph.create", &p).unwrap()["id"].as_u64().unwrap()); + let mut set = data.clone(); + set["id"] = json!(id.0); + probe.execute("graph.setData", &set).unwrap(); + graph_data(&mut probe, id) + }; + for (set, bytes) in ["Data Set 1", "Data Set 2", "Data Set 3"].into_iter().zip([tabs, commas, utf16.as_slice()]) { + s.execute("dataset.select", &json!({"name": set})).unwrap(); + assert_eq!(graph_data(&mut s, g), sheet(bytes), "{set}"); + } + assert_eq!(graph_data(&mut s, g), json!({"series": ["A"], "categories": ["X"], "rows": [[9.0]]})); let vars = &s.doc().unwrap().doc.variables; - assert!(vars.variables.is_empty() && vars.datasets.is_empty()); + assert_eq!(vars.datasets[3].values.get("Graphs"), None, "an empty cell is no value"); + + // A `%` header names a graph variable the document has, and `base` sets the folder of + // relative paths when the CSV comes as text. + let mut t = session(); + t.execute("variable.define", &json!({"name": "Sales", "kind": "graph"})).unwrap(); + let base = dir.0.to_string_lossy().into_owned(); + let imp = t.execute("dataset.import", &json!({"csv": "% Sales\ndat.csv", "base": base})).unwrap(); + assert_eq!(imp["defined"], json!([])); + let value = t.doc().unwrap().doc.variables.datasets[0].values.get("Sales").cloned(); + assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains("North") && c.contains("Feb")), "{value:?}"); +} + +/// A `%` column's file that is missing, a folder, larger than 1 MB, or gives a graph value longer +/// than 256 KB, a relative path with no +/// folder to take it from, a `base` that isn't a folder path, and a `%` header whose name is a +/// variable of another kind refuse the import with the line and column, and leave the variables and +/// data sets as they were. A file of exactly 1 MB is read, and a file named by many cells is read +/// once. +#[test] +fn datasets_csv_refuses_unreadable_graph_data_files() { + let dir = Folder::new("vars-csv-graph-refused"); + write(&dir.file("ok.txt"), b"\tA\nX\t1\n"); + write(&dir.file("big.txt"), &vec![b'1'; crate::cmd::MAX_GRAPH_DATA_FILE + 1]); + let at_limit = [b"\tA\nX\t2\n".as_slice(), &vec![b' '; crate::cmd::MAX_GRAPH_DATA_FILE - 7]].concat(); + write(&dir.file("limit.txt"), &at_limit); + std::fs::create_dir_all(dir.file("folder.txt")).unwrap(); + // 10,000 categories with long labels: under 1 MB, but a graph value over 256 KB. + let long: String = (0..10_000).map(|i| format!("category label number {i:05}\t{i}\n")).collect(); + write(&dir.file("long.txt"), format!("\tA\n{long}").as_bytes()); + let base = dir.0.to_string_lossy().into_owned(); + + let mut s = session(); + s.execute("variable.define", &json!({"name": "Title", "kind": "text"})).unwrap(); + s.execute("dataset.import", &json!({"csv": "Title\nkept"})).unwrap(); + let before = s.doc().unwrap().doc.variables.clone(); + let undo = s.doc().unwrap().history.undo.len(); + let cases = [ + (json!({"csv": "Name,%Chart\na,ok.txt\nb,missing.txt", "base": base}), "line 3, column 2: the graph data file for `Chart` can't be read"), + (json!({"csv": "Name,%Chart\na,folder.txt", "base": base}), "line 2, column 2: the graph data file for `Chart` can't be read"), + (json!({"csv": "%Chart\nbig.txt", "base": base}), "line 2, column 1: the graph data file `big.txt` for `Chart` is larger than 1048576 bytes"), + ( + json!({"csv": "Name,%Chart\na,long.txt", "base": base}), + "line 2, column 2: the graph data file `long.txt` for `Chart` gives a graph value longer than 262144 bytes", + ), + (json!({"csv": "%Chart\nok.txt"}), "line 2, column 1: the graph data file `ok.txt` for `Chart` is a relative path"), + (json!({"csv": "%Chart\nok.txt", "base": ""}), "`base` is empty"), + (json!({"csv": "%Chart\nok.txt", "base": 3}), "`base` must be a string"), + (json!({"csv": "%Title\nok.txt", "base": base}), "column 1: `%Title` names `Title`, which is a text variable"), + ]; + for (p, want) in cases { + let e = s.execute("dataset.import", &p).unwrap_err().to_string(); + assert!(e.contains(want), "{p}: {e}"); + assert_eq!(s.doc().unwrap().doc.variables, before, "{p}"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{p}"); + } + + let rows: String = (0..300).map(|_| "limit.txt\n").collect(); + let imp = s.execute("dataset.import", &json!({"csv": format!("%Chart\n{rows}"), "base": base})).unwrap(); + assert_eq!(imp["imported"], 300, "a 1 MB file named by 300 cells counts once against the import's limit"); + let value = s.doc().unwrap().doc.variables.datasets[299].values.get("Chart").cloned(); + assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains('2')), "{value:?}"); } /// Two header cells that name one variable, by the same name or by a name and its prefix, are diff --git a/crates/ui-egui/src/dialogs/graph_data.rs b/crates/ui-egui/src/dialogs/graph_data.rs index ecfb0c303e..bed1117748 100644 --- a/crates/ui-egui/src/dialogs/graph_data.rs +++ b/crates/ui-egui/src/dialogs/graph_data.rs @@ -26,14 +26,13 @@ use crate::{VectorcraftApp, widgets}; pub const KIND: &str = "graphData"; /// The sheet's size: a row of labels over a graph's categories, a column of labels before its -/// series; the least it shows; a cell's longest text. +/// series; the least it shows. const MAX_ROWS: usize = MAX_GRAPH_CATEGORIES + 1; const MAX_COLS: usize = MAX_GRAPH_SERIES + 1; const MIN_ROWS: usize = 8; const MIN_COLS: usize = 6; -const MAX_CELL: usize = 256; /// The largest file Import Data reads, 1 MB (1,048,576 bytes), the same as Import Data Sets'. -const MAX_IMPORT_BYTES: usize = 1 << 20; +const MAX_IMPORT_BYTES: usize = vectorcraft_engine::cmd::MAX_GRAPH_DATA_FILE; /// The Cell Style limits (Adjust column width and decimal digits). const MAX_DECIMALS: u64 = 10; const MAX_WIDTH: u64 = 20; @@ -103,75 +102,25 @@ pub(crate) fn grid_from_data(v: &Value) -> Grid { grid } -/// The sheet as `graph.setData` takes it: series labels, category labels (none when all are blank) -/// and the values (a blank cell, or text that isn't a number, has none), without the empty rows and -/// columns past the data. +/// The sheet as `graph.setData` takes it ([`vectorcraft_engine::cmd::graph_data_from_grid`]), +/// which Import Data Sets' `%` columns also use. pub(crate) fn data_from_grid(grid: &Grid) -> Value { - let filled = |s: &String| !s.trim().is_empty(); - // At most a graph's rows and columns, as a file gives (`grid_from_text`): a grid sent by - // automation is any size, and the values are their product. - let grid = &grid[..grid.len().min(MAX_ROWS)]; - let rows = grid.iter().rposition(|r| r.iter().take(MAX_COLS).any(filled)).map_or(1, |i| i + 1).max(1); - let cols = grid.iter().take(rows).filter_map(|r| r.iter().take(MAX_COLS).rposition(filled)).max().map_or(1, |i| i + 1).max(1); - let label = |s: &str| { - let s = s.trim(); - // A label typed in straight quotes (as the CSV form takes a number as a label) is the text inside. - s.strip_prefix('"').and_then(|t| t.strip_suffix('"')).unwrap_or(s).to_string() - }; - // Series labels up to the last one given (none when all are blank). - let mut series: Vec = (1..cols).map(|c| label(&cell(grid, 0, c))).collect(); - while series.last().is_some_and(String::is_empty) { - series.pop(); - } - let mut categories: Vec = (1..rows).map(|r| label(&cell(grid, r, 0))).collect(); - if categories.iter().all(String::is_empty) { - categories.clear(); - } - let values: Vec> = (1..rows) - .map(|r| { - (1..cols) - .map(|c| { - let t = cell(grid, r, c); - t.trim().parse::().ok().filter(|v| v.is_finite() && !t.trim().starts_with('"')).map_or(Value::Null, |v| json!(v)) - }) - .collect() - }) - .collect(); - json!({ "series": series, "categories": categories, "rows": values }) + vectorcraft_engine::cmd::graph_data_from_grid(grid) } -/// Text from a file or the clipboard as cells: tab-separated when any line holds a tab, else -/// comma-separated (decided once, so a label with a comma in a tab-separated file stays whole), at -/// most a graph's rows and columns. +/// Text from a file or the clipboard as cells ([`vectorcraft_engine::cmd::graph_grid_from_text`]). pub(crate) fn grid_from_text(text: &str) -> Grid { - let sep = if text.contains('\t') { '\t' } else { ',' }; - text.lines().take(MAX_ROWS).map(|l| l.trim_end_matches('\r').split(sep).take(MAX_COLS).map(|c| clean(c.trim())).collect()).collect() + vectorcraft_engine::cmd::graph_grid_from_text(text) } -/// A text file's bytes as text: UTF-16 with its byte-order mark (spreadsheets' "Unicode Text"), -/// else UTF-16 without one when the bytes hold NUL bytes and Import Data Sets' rule gives them a -/// byte order ([`vectorcraft_engine::cmd::utf16_order_without_mark`]), else UTF-8 with or without -/// one. UTF-16 is read as it is after a byte-order mark: an odd last byte is left out, and an -/// unpaired surrogate reads as U+FFFD. +/// A text file's bytes as text ([`vectorcraft_engine::cmd::graph_data_text`]). pub(crate) fn decode(bytes: &[u8]) -> String { - let utf16 = |rest: &[u8], le: bool| { - let units: Vec = rest.as_chunks::<2>().0.iter().map(|p| if le { u16::from_le_bytes(*p) } else { u16::from_be_bytes(*p) }).collect(); - String::from_utf16_lossy(&units) - }; - match bytes { - [0xFF, 0xFE, rest @ ..] => utf16(rest, true), - [0xFE, 0xFF, rest @ ..] => utf16(rest, false), - [0xEF, 0xBB, 0xBF, rest @ ..] => String::from_utf8_lossy(rest).into_owned(), - _ => match bytes.contains(&0).then(|| vectorcraft_engine::cmd::utf16_order_without_mark(bytes)).flatten() { - Some(le) => utf16(bytes, le), - None => String::from_utf8_lossy(bytes).into_owned(), - }, - } + vectorcraft_engine::cmd::graph_data_text(bytes) } -/// A cell's text: one line (tabs and line breaks become spaces), at most MAX_CELL characters. +/// A cell's text ([`vectorcraft_engine::cmd::graph_cell_text`]). fn clean(s: &str) -> String { - s.chars().map(|c| if matches!(c, '\t' | '\r' | '\n') { ' ' } else { c }).take(MAX_CELL).collect() + vectorcraft_engine::cmd::graph_cell_text(s) } fn cell(grid: &[Vec], r: usize, c: usize) -> String { diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 161e235c56..516757d163 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -8271,7 +8271,12 @@ breakText Glyphs Glyfy @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel musí být {own} (režim dokumentu), grayscale nebo bitmap @msg colour groups can't go into colour groups skupiny barev nelze vkládat do skupin barev @msg colour, mode and spot apply to solid-colour swatches only colour, mode a spot platí jen pro položky vzorníku s plnou barvou -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read sloupec {column}: `{cell}` je sloupec `%` pro soubory dat grafu, které se nečtou +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` je zadán relativní cestou: zadejte `base` nebo absolutní cestu +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} řádek {line}, sloupec {column}: soubor dat grafu pro `{var}` nelze přečíst: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` je větší než {MAX_GRAPH_DATA_FILE} bajtů +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` dává hodnotu grafu delší než {MAX_GRAPH_CSV} bajtů +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all řádek {line}, sloupec {column}: soubory dat grafu obsahují celkem více než {MAX_GRAPH_FILES_TOTAL} bajtů +@msg `base` is empty `base` je prázdné @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable sloupec {column}: `{cell}` uvádí `{name}`, což je proměnná typu {_1} @msg column {column}: `{cell}` names no variable sloupec {column}: `{cell}` neuvádí žádnou proměnnou @msg column {column}: the variable name is longer than {MAX_NAME} characters sloupec {column}: název proměnné je delší než {MAX_NAME} znaků diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 2a5f32a5d9..007a7f7a10 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7956,7 +7956,12 @@ breakText Glyphs Glyphen @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel muss {own} (der Modus des Dokuments), grayscale oder bitmap sein @msg colour groups can't go into colour groups Farbgruppen können nicht in Farbgruppen eingefügt werden @msg colour, mode and spot apply to solid-colour swatches only colour, mode und spot gelten nur für Vollfarbfelder -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read Spalte {column}: `{cell}` ist eine `%`-Spalte von Diagrammdatendateien, die nicht gelesen werden +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ist ein relativer Pfad: Geben Sie `base` oder einen absoluten Pfad an +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} Zeile {line}, Spalte {column}: die Diagrammdatendatei für `{var}` kann nicht gelesen werden: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ist größer als {MAX_GRAPH_DATA_FILE} Byte +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ergibt einen Diagrammwert, der länger als {MAX_GRAPH_CSV} Byte ist +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all Zeile {line}, Spalte {column}: die Diagrammdatendateien enthalten insgesamt mehr als {MAX_GRAPH_FILES_TOTAL} Byte +@msg `base` is empty `base` ist leer @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable Spalte {column}: `{cell}` nennt `{name}`, eine Variable vom Typ {_1} @msg column {column}: `{cell}` names no variable Spalte {column}: `{cell}` nennt keine Variable @msg column {column}: the variable name is longer than {MAX_NAME} characters Spalte {column}: Der Variablenname ist länger als {MAX_NAME} Zeichen diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 2762d2a954..e42715fb58 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -8132,7 +8132,12 @@ breakText Glyphs Glyphes @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel doit valoir {own} (le mode du document), grayscale ou bitmap @msg colour groups can't go into colour groups un groupe de couleurs ne peut pas aller dans un groupe de couleurs @msg colour, mode and spot apply to solid-colour swatches only couleur, mode et ton direct s’appliquent uniquement aux nuances de couleur unie -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read colonne {column} : `{cell}` est une colonne `%` des fichiers de données de graphe, qui ne sont pas lus +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` est un chemin relatif : indiquez `base` ou un chemin absolu +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} ligne {line}, colonne {column} : impossible de lire le fichier de données de graphe pour `{var}` : {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` dépasse {MAX_GRAPH_DATA_FILE} octets +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` donne une valeur de graphe de plus de {MAX_GRAPH_CSV} octets +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all ligne {line}, colonne {column} : les fichiers de données de graphe contiennent plus de {MAX_GRAPH_FILES_TOTAL} octets au total +@msg `base` is empty `base` est vide @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable colonne {column} : `{cell}` désigne `{name}`, qui est une variable {_1} @msg column {column}: `{cell}` names no variable colonne {column} : `{cell}` ne désigne aucune variable @msg column {column}: the variable name is longer than {MAX_NAME} characters colonne {column} : le nom de variable dépasse {MAX_NAME} caractères diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 548f961f51..670c356710 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6587,7 +6587,12 @@ antiAlias Sharp शार्प @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: अधिकतम {MAX_TABLE} रंग @msg colour groups can't go into colour groups रंग समूह रंग समूहों में नहीं जा सकते हैं @msg colour, mode and spot apply to solid-colour swatches only रंग, मोड और स्पॉट केवल ठोस रंग वाले स्वॉच पर लागू होते हैं -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read कॉलम {column}: `{cell}` ग्राफ़ डेटा फ़ाइल का `%` कॉलम है, जिसे पढ़ा नहीं जाता +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` एक सापेक्ष पाथ है: `base` या एक पूर्ण पाथ दें +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल पढ़ी नहीं जा सकती: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` {MAX_GRAPH_DATA_FILE} बाइट्स से बड़ी है +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` से मिलने वाला ग्राफ़ मूल्य {MAX_GRAPH_CSV} बाइट्स से अधिक है +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all लाइन {line}, कॉलम {column}: ग्राफ़ डेटा फ़ाइलों में कुल मिलाकर {MAX_GRAPH_FILES_TOTAL} बाइट्स से अधिक हैं +@msg `base` is empty `base` खाली है @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable कॉलम {column}: `{cell}` में `{name}` नाम का {_1} वेरिएबल है @msg column {column}: `{cell}` names no variable कॉलम {column}: `{cell}` किसी वेरिएबल का नाम नहीं है @msg column {column}: the variable name is longer than {MAX_NAME} characters कॉलम {column}: वेरिएबल का नाम {MAX_NAME} कैरेक्टर से लंबा है diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 200b45d1b1..6873c4ffb2 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -8141,7 +8141,12 @@ breakText Glyphs Glifák @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel: {own} (a dokumentum módja), grayscale vagy bitmap kell @msg colour groups can't go into colour groups színcsoport nem kerülhet színcsoportba @msg colour, mode and spot apply to solid-colour swatches only colour, mode és spot: csak egyszínű színmintákra vonatkozik -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read {column}. oszlop: `{cell}` a diagramadat-fájlok `%` oszlopa, ezek beolvasása nem történik meg +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja relatív elérési út: adja meg a `base` értéket vagy egy abszolút elérési utat +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line}. sor, {column}. oszlop: a(z) `{var}` diagramadat-fájlja nem olvasható: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja nagyobb {MAX_GRAPH_DATA_FILE} bájtnál +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja {MAX_GRAPH_CSV} bájtnál hosszabb diagramértéket ad +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line}. sor, {column}. oszlop: a diagramadat-fájlok összesen több mint {MAX_GRAPH_FILES_TOTAL} bájtot tartalmaznak +@msg `base` is empty a `base` üres @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable {column}. oszlop: `{cell}` ezt nevezi meg: `{name}`, amely {_1} típusú változó @msg column {column}: `{cell}` names no variable {column}. oszlop: `{cell}` nem nevez meg változót @msg column {column}: the variable name is longer than {MAX_NAME} characters {column}. oszlop: a változó neve hosszabb {MAX_NAME} karakternél diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 90ec79404c..0f92f38878 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -8004,7 +8004,12 @@ breakText Glyphs Glifi @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel deve essere {own} (il metodo del documento), grayscale o bitmap @msg colour groups can't go into colour groups i gruppi di colori non possono entrare in altri gruppi di colori @msg colour, mode and spot apply to solid-colour swatches only colore, metodo e spot si applicano solo ai campioni di colore pieno -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read colonna {column}: `{cell}` è una colonna `%` dei file di dati dei grafici, che non vengono letti +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` è un percorso relativo: indica `base` o un percorso assoluto +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} riga {line}, colonna {column}: impossibile leggere il file di dati del grafico per `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` supera i {MAX_GRAPH_DATA_FILE} byte +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` dà un valore di grafico che supera i {MAX_GRAPH_CSV} byte +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all riga {line}, colonna {column}: i file di dati dei grafici contengono in tutto più di {MAX_GRAPH_FILES_TOTAL} byte +@msg `base` is empty `base` è vuoto @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable colonna {column}: `{cell}` indica `{name}`, che è una variabile {_1} @msg column {column}: `{cell}` names no variable colonna {column}: `{cell}` non indica alcuna variabile @msg column {column}: the variable name is longer than {MAX_NAME} characters colonna {column}: il nome della variabile supera {MAX_NAME} caratteri diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index d98acfa22d..8bf1a33a52 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7205,7 +7205,12 @@ axis Y Axis Y 軸 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel には {own} (ドキュメントのモード)、grayscale、bitmap のいずれかを指定してください @msg colour groups can't go into colour groups カラーグループをカラーグループに入れることはできません @msg colour, mode and spot apply to solid-colour swatches only colour、mode、spot を適用できるのは単色のスウォッチだけです -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 列 {column}: `{cell}` はグラフデータファイルの `%` 列で、読み込まれません +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` は相対パスです: `base` か絶対パスを指定してください +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line} 行目、列 {column}: `{var}` のグラフデータファイルを読み込めません: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` が {MAX_GRAPH_DATA_FILE} バイトを超えています +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` から得られるグラフの値が {MAX_GRAPH_CSV} バイトを超えています +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line} 行目、列 {column}: グラフデータファイルが合計で {MAX_GRAPH_FILES_TOTAL} バイトを超えています +@msg `base` is empty `base` が空です @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 列 {column}: `{cell}` が指定している `{name}` は {_1} 変数です @msg column {column}: `{cell}` names no variable 列 {column}: `{cell}` に該当する変数はありません @msg column {column}: the variable name is longer than {MAX_NAME} characters 列 {column}: 変数名が {MAX_NAME} 文字を超えています diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index bb8676df71..4fcdff6e06 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7867,7 +7867,12 @@ breakText Glyphs 글리프 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel은 {own}(문서의 모드), grayscale 또는 bitmap이어야 합니다 @msg colour groups can't go into colour groups 색상 그룹은 색상 그룹 안에 넣을 수 없습니다 @msg colour, mode and spot apply to solid-colour swatches only colour, mode, spot은 단색 견본에만 적용됩니다 -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read {column}열: `{cell}`은(는) 그래프 데이터 파일의 `%` 열이며, 이 열은 읽지 않습니다 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`은(는) 상대 경로입니다. `base` 또는 절대 경로를 지정하세요 +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line}행, {column}열: `{var}`의 그래프 데이터 파일을 읽을 수 없습니다: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`이(가) {MAX_GRAPH_DATA_FILE}바이트보다 큽니다 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`에서 나온 그래프 값이 {MAX_GRAPH_CSV}바이트보다 깁니다 +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line}행, {column}열: 그래프 데이터 파일이 모두 합쳐 {MAX_GRAPH_FILES_TOTAL}바이트를 넘습니다 +@msg `base` is empty `base`가 비어 있습니다 @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable {column}열: `{cell}`이(가) 가리키는 `{name}`은(는) {_1} 변수입니다 @msg column {column}: `{cell}` names no variable {column}열: `{cell}`이(가) 가리키는 변수가 없습니다 @msg column {column}: the variable name is longer than {MAX_NAME} characters {column}열: 변수 이름이 {MAX_NAME}자보다 깁니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index a597a03fd0..8d1ff71086 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -6206,7 +6206,12 @@ imageTrace Outline Contour @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel moet {own} (de modus van het document), grayscale of bitmap zijn @msg colour groups can't go into colour groups kleurgroepen kunnen niet in kleurgroepen worden geplaatst @msg colour, mode and spot apply to solid-colour swatches only colour, mode en spot gelden alleen voor stalen met een effen kleur -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolom {column}: `{cell}` is een `%`-kolom van grafiekgegevensbestanden, die niet worden gelezen +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` is een relatief pad: geef `base` of een absoluut pad op +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} regel {line}, kolom {column}: het grafiekgegevensbestand voor `{var}` kan niet worden gelezen: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` is groter dan {MAX_GRAPH_DATA_FILE} bytes +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` geeft een grafiekwaarde langer dan {MAX_GRAPH_CSV} bytes +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all regel {line}, kolom {column}: de grafiekgegevensbestanden bevatten samen meer dan {MAX_GRAPH_FILES_TOTAL} bytes +@msg `base` is empty `base` is leeg @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolom {column}: `{cell}` noemt `{name}`, en dat is een variabele van het type {_1} @msg column {column}: `{cell}` names no variable kolom {column}: `{cell}` noemt geen variabele @msg column {column}: the variable name is longer than {MAX_NAME} characters kolom {column}: de naam van de variabele is langer dan {MAX_NAME} tekens diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 99ee2080b8..b13aa895f1 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -8243,7 +8243,12 @@ breakText Glyphs Glify @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel musi mieć wartość {own} (tryb dokumentu), grayscale lub bitmap @msg colour groups can't go into colour groups grup kolorów nie można umieszczać w grupach kolorów @msg colour, mode and spot apply to solid-colour swatches only color, mode i spot dotyczą tylko próbek kolorów jednolitych -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolumna {column}: `{cell}` to kolumna `%` plików danych wykresu, które nie są odczytywane +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` ma ścieżkę względną: podaj `base` albo ścieżkę bezwzględną +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} wiersz {line}, kolumna {column}: nie można odczytać pliku danych wykresu dla `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` jest większy niż {MAX_GRAPH_DATA_FILE} bajtów +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` daje wartość wykresu dłuższą niż {MAX_GRAPH_CSV} bajtów +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all wiersz {line}, kolumna {column}: pliki danych wykresu zawierają łącznie ponad {MAX_GRAPH_FILES_TOTAL} bajtów +@msg `base` is empty `base` jest puste @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolumna {column}: `{cell}` wskazuje `{name}`, czyli zmienną typu {_1} @msg column {column}: `{cell}` names no variable kolumna {column}: `{cell}` nie wskazuje żadnej zmiennej @msg column {column}: the variable name is longer than {MAX_NAME} characters kolumna {column}: nazwa zmiennej ma więcej niż {MAX_NAME} znaków diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 677c8e460f..abaeda7401 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -8335,7 +8335,12 @@ swatch Yellow Green Verde-amarelado @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel deve ser {own} (o modo do documento), grayscale ou bitmap @msg colour groups can't go into colour groups grupos de cores não podem ficar dentro de grupos de cores @msg colour, mode and spot apply to solid-colour swatches only colour, mode e spot se aplicam somente a amostras de cor sólida -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read coluna {column}: `{cell}` é uma coluna `%` de arquivos de dados de gráfico, que não são lidos +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` é um caminho relativo: informe `base` ou um caminho absoluto +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} linha {line}, coluna {column}: não é possível ler o arquivo de dados de gráfico de `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` tem mais de {MAX_GRAPH_DATA_FILE} bytes +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` gera um valor de gráfico com mais de {MAX_GRAPH_CSV} bytes +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all linha {line}, coluna {column}: os arquivos de dados de gráfico têm mais de {MAX_GRAPH_FILES_TOTAL} bytes no total +@msg `base` is empty `base` está vazio @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable coluna {column}: `{cell}` indica `{name}`, que é uma variável de {_1} @msg column {column}: `{cell}` names no variable coluna {column}: `{cell}` não indica nenhuma variável @msg column {column}: the variable name is longer than {MAX_NAME} characters coluna {column}: o nome da variável tem mais de {MAX_NAME} caracteres diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index cc854aa362..7c9466d97e 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7903,7 +7903,12 @@ digits Hindi Hindi @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel måste vara {own} (dokumentets läge), grayscale eller bitmap @msg colour groups can't go into colour groups färggrupper kan inte läggas i färggrupper @msg colour, mode and spot apply to solid-colour swatches only färg, läge och dekor gäller endast enfärgade färgrutor -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolumn {column}: `{cell}` är en `%`-kolumn i diagramdatafiler, som inte läses +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` är en relativ sökväg: ange `base` eller en absolut sökväg +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} rad {line}, kolumn {column}: diagramdatafilen för `{var}` kan inte läsas: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` är större än {MAX_GRAPH_DATA_FILE} byte +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` ger ett diagramvärde som är längre än {MAX_GRAPH_CSV} byte +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all rad {line}, kolumn {column}: diagramdatafilerna innehåller sammanlagt mer än {MAX_GRAPH_FILES_TOTAL} byte +@msg `base` is empty `base` är tom @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolumn {column}: `{cell}` anger `{name}`, som är en {_1}-variabel @msg column {column}: `{cell}` names no variable kolumn {column}: `{cell}` anger ingen variabel @msg column {column}: the variable name is longer than {MAX_NAME} characters kolumn {column}: variabelnamnet är längre än {MAX_NAME} tecken diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f2888a30f0..86111722ee 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -7590,7 +7590,12 @@ axis Y Axis Y ekseni @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel {own} (belgenin modu), grayscale veya bitmap olmalıdır @msg colour groups can't go into colour groups renk grupları renk gruplarının içine konulamaz @msg colour, mode and spot apply to solid-colour swatches only colour, mode ve spot yalnızca düz renkli renk örnekleri için geçerlidir -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read sütun {column}: `{cell}`, grafik veri dosyalarının bir `%` sütunudur ve bu dosyalar okunmaz +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası göreli bir yoldur: `base` ya da mutlak bir yol verin +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} satır {line}, sütun {column}: `{var}` için grafik veri dosyası okunamıyor: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası {MAX_GRAPH_DATA_FILE} bayttan büyük +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası {MAX_GRAPH_CSV} bayttan uzun bir grafik değeri veriyor +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all satır {line}, sütun {column}: grafik veri dosyaları toplamda {MAX_GRAPH_FILES_TOTAL} bayttan fazla +@msg `base` is empty `base` boş @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable sütun {column}: `{cell}`, {_1} türünde bir değişken olan `{name}` değişkenini belirtiyor @msg column {column}: `{cell}` names no variable sütun {column}: `{cell}` hiçbir değişkeni belirtmiyor @msg column {column}: the variable name is longer than {MAX_NAME} characters sütun {column}: değişken adı {MAX_NAME} karakterden uzun diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 411b2c3baf..cf1aa8cef5 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7869,7 +7869,12 @@ breakText Glyphs Гліфи @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel має бути {own} (режим документа), grayscale або bitmap @msg colour groups can't go into colour groups групи кольорів не можна поміщати в групи кольорів @msg colour, mode and spot apply to solid-colour swatches only colour, mode і spot застосовуються лише до зразків суцільного кольору -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read стовпець {column}: `{cell}` — це стовпець `%` файлів даних діаграм, які не читаються +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` задано відносним шляхом: укажіть `base` або абсолютний шлях +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} рядок {line}, стовпець {column}: не вдається прочитати файл даних діаграми для `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` більший за {MAX_GRAPH_DATA_FILE} байтів +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` дає значення діаграми довше за {MAX_GRAPH_CSV} байтів +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all рядок {line}, стовпець {column}: файли даних діаграм разом містять понад {MAX_GRAPH_FILES_TOTAL} байтів +@msg `base` is empty `base` порожнє @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable стовпець {column}: `{cell}` указує `{name}`, а це змінна типу {_1} @msg column {column}: `{cell}` names no variable стовпець {column}: `{cell}` не вказує жодної змінної @msg column {column}: the variable name is longer than {MAX_NAME} characters стовпець {column}: ім’я змінної довше за {MAX_NAME} символів diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 3fe2f9e009..f3875a12c5 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -8229,7 +8229,12 @@ breakText Glyphs 字形 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel 必须是 {own} (文档的模式)、grayscale 或 bitmap @msg colour groups can't go into colour groups 颜色组不能放入颜色组 @msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只适用于纯色色板 -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 第 {column} 列:`{cell}` 是图表数据文件的 `%` 列,不会读取 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 是相对路径:请提供 `base` 或绝对路径 +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} 第 {line} 行,第 {column} 列:无法读取 `{var}` 的图表数据文件:{e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 超过 {MAX_GRAPH_DATA_FILE} 字节 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 得到的图表值超过 {MAX_GRAPH_CSV} 字节 +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all 第 {line} 行,第 {column} 列:图表数据文件总计超过 {MAX_GRAPH_FILES_TOTAL} 字节 +@msg `base` is empty `base` 为空 @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 第 {column} 列:`{cell}` 指定了 `{name}`,而它是 {_1} 变量 @msg column {column}: `{cell}` names no variable 第 {column} 列:`{cell}` 没有对应的变量 @msg column {column}: the variable name is longer than {MAX_NAME} characters 第 {column} 列:变量名称超过 {MAX_NAME} 个字符 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index ab7f9d9dd2..6d10ceced1 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -8157,7 +8157,12 @@ breakText Glyphs 字符 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel 必須是 {own} (文件的模式)、grayscale 或 bitmap @msg colour groups can't go into colour groups 顏色群組不能放入顏色群組 @msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只適用於純色色票 -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 第 {column} 欄:`{cell}` 是圖表資料檔案的 `%` 欄,不會讀取 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 是相對路徑:請提供 `base` 或絕對路徑 +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} 第 {line} 行,第 {column} 欄:無法讀取 `{var}` 的圖表資料檔案:{e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 超過 {MAX_GRAPH_DATA_FILE} 位元組 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 得到的圖表值超過 {MAX_GRAPH_CSV} 位元組 +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all 第 {line} 行,第 {column} 欄:圖表資料檔案合計超過 {MAX_GRAPH_FILES_TOTAL} 位元組 +@msg `base` is empty `base` 為空 @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 第 {column} 欄:`{cell}` 指定了 `{name}`,而它是 {_1} 變數 @msg column {column}: `{cell}` names no variable 第 {column} 欄:`{cell}` 未指定任何變數 @msg column {column}: the variable name is longer than {MAX_NAME} characters 第 {column} 欄:變數名稱超過 {MAX_NAME} 個字元 diff --git a/crates/ui-egui/src/panels/variables.rs b/crates/ui-egui/src/panels/variables.rs index 3ab5fc2484..f5ca49b025 100644 --- a/crates/ui-egui/src/panels/variables.rs +++ b/crates/ui-egui/src/panels/variables.rs @@ -528,6 +528,8 @@ mod tests { assert_eq!(app.ui.status, "a new document won't read these variables back with their kind: `#Tag`"); let warning = app.ui.status.clone(); app.run("variable.define", json!({"name": "%Rate", "kind": "text"})).unwrap(); + // A new document reads a `%` header's values as paths of graph data files. + app.run("dataset.new", json!({"name": "Rates", "values": {"%Rate": "5"}})).unwrap(); app.run("dataset.export", json!({"path": path})).unwrap(); assert_eq!(app.ui.status, "a new document refuses this file because of these variables: `%Rate`"); let refuses = app.ui.status.clone(); diff --git a/docs/mcp.md b/docs/mcp.md index 1288fe7fff..e5da18d198 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3329,7 +3329,7 @@ already walks Image Trace. Short agent entry points: - Data sets: `dataset.list`, `dataset.new {name, values?}`, `dataset.set {name, newName?, values?}` (`newName` also renames the row, in the same undo step; Edit Data Set's Name field sends it), `dataset.rename`, `dataset.delete`, `dataset.capture`, `dataset.update`, `dataset.select {name}`, `dataset.next` / - `dataset.prev` (each `dataset.select` / next / prev is one undo step over every bound object), `dataset.import {path|data|dataBase64|csv}` / + `dataset.prev` (each `dataset.select` / next / prev is one undo step over every bound object), `dataset.import {path|data|dataBase64|csv, base?}` / `dataset.export {path?}` (CSV: one column per variable, and no column of data set names). `dataset.import` also reads tab-separated files. Every header cell is a variable, whatever its case (`name` and `Name` included). The first row holds the field names, as the @@ -3337,16 +3337,29 @@ already walks Image Trace. Short agent entry points: describes. The rows replace every data set of the document and are named `Data Set 1`, `Data Set 2` and so on, in file order; the document's variables and their bindings stay, and the reply's `deletedDataSets` lists the data sets that were replaced. An import error about a row's values gives the file line the row starts on. A header cell that names no variable defines one, unbound, in the same undo step as the - rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, and a cell without - a prefix defines a text variable. `dataset.export` writes a visibility variable's header as `#Shown` and an image - variable's as `@Photo`, and a text or graph variable's as its name alone. Its reply's `warning` names the variables - whose header or values make an import into a document without them refuse the file (a `%` header, a `#` header - whose values aren't true or false). Otherwise it names the variables that such an import does not read back with - their kind: text variables whose names start with `#` or `@`, and graph variables. Export is refused, naming both variables, when a variable's header is - another variable's name (a visibility variable `Show` next to a text variable `#Show`). A prefixed cell whose name - is already a variable of the prefix's kind names it; - one whose name is a variable of another kind fails the import. A `%` cell that isn't a variable's exact name (graph - data files) is refused, and so are two cells that name one variable (`City` twice, or `Shown` and `#Shown`). The + rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, `%Sales` defines a + graph variable `Sales`, and a cell without a prefix defines a text variable. The cells of a `%` column are paths of + graph data files, as the set-up page's example shows. Each file is read as the Graph Data window's Import Data reads + one ([add graph data](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/visualize-data/add-graph-data.html)): + at most 1 MB; tab-separated when any line holds a tab, else comma-separated; the first row holds the series labels + and the first column the category labels; UTF-16 by the rule below, else UTF-8. The data becomes the data set's + graph value, which `dataset.select` applies as `graph.setData` applies it, so the graph gets the data that Import + Data and Apply give it. A relative path is taken from `dataset.import`'s `base` folder, else from the folder of the + CSV file at `path`; with neither (`csv`, `data` or `dataBase64` and no `base`), it fails the import. This is + VectorCraft's own rule. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value + longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all fail the import with + the line and the column, and the document is left as it was. Each file is read once per import, however many cells + name it, and counts once toward the 256 MB; each cell's graph value counts every time. `dataset.export` writes a + visibility variable's header as `#Shown` and an image variable's as `@Photo`, and a text or graph variable's as its + name alone. Its reply's `warning` names the variables whose header or values make an import into a document without + them refuse the file (a `%` header over values, which such an import reads as file paths, and a `#` header whose + values aren't true or false). Otherwise it names the variables that such an import does not read back with their + kind: variables whose names start with `#`, `@` or `%` and aren't of that prefix's kind, and graph variables. Export + is refused, naming both variables, when a variable's header is another variable's name (a visibility variable + `Show` next to a text variable `#Show`). A prefixed cell whose name is already a variable of the prefix's kind names + it; one whose name is a variable of another kind fails the import, and so do two cells that name one variable + (`City` twice, or `Shown` and `#Shown`). A cell that is a variable's exact name, prefix included, names that + variable, so the cells under a graph variable named `%Sales` are read as graph data in CSV form. The reply's `defined` lists the variables the import defined. While the variables are locked, an import whose header would define a variable fails with "variables are locked". A `dataset.import` file that isn't UTF-8 is read as Windows-1252, unless it starts with the UTF-8 byte-order mark. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5980ecb89c..ba0b9b8f32 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -822,6 +822,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Variables: Import Data Sets… (`dataset.import`) reads a UTF-16 file without a byte-order mark, instead of refusing it, when at least half of its two-byte units hold a NUL byte; it uses the byte order that reads its line breaks. - Graphs: the Graph Data window's Import Data reads a UTF-16 text file without a byte-order mark by the same rule as Import Data Sets…, instead of filling the cells with NUL characters. It reads a file cut short by one byte, or with an unpaired surrogate, as it reads one after a byte-order mark. - Variables: Import Data Sets… (`dataset.import`) defines the variables a file's header names that the document lacks, unbound. `#Shown` defines a visibility variable, `@Photo` defines an image variable, and a header without a prefix defines a text variable. A header that is a variable's exact name keeps naming it, and any other `%` header (graph data files) is refused. + - Variables: Import Data Sets… (`dataset.import`) reads `%` columns instead of refusing them: `%Sales` defines or names the graph variable `Sales`, and each cell is the path of a graph data file, read as the Graph Data window's Import Data reads one and kept as the data set's graph value. A relative path is taken from the CSV file's folder, or from `base`. A missing, unreadable or larger than 1 MB file fails the import with its line and column, and the document is left as it was (`crates/engine/src/tests/variables.rs`). - Variables: Load Variable Library… in the Variables panel menu (`variable.loadLibrary`) replaces the document's variables and data sets with a variable library's, read from its XML file, in one undo step: every data set is deleted, and every variable is deleted with its bindings and values, except a variable the library also declares with the same kind, which stays bound so the library's data sets change its objects (#4136); then the library's other variables are defined, unbound: text, visibility, image (linked file) and graph variables, and variables without a known `trait` as unknown. Its data sets take text values from each value's `p` elements, one paragraph each, visibility values from `true` or `false`, image values from a file's absolute path or `file:` URL, and graph values from a `data` element of series names and rows. - Variables: Save Variable Library… in the Variables panel menu (`variable.saveLibrary`) writes the document's variables of every kind and its data sets as a variable library's XML file, which Load Variable Library reads back with the same variables, kinds, data set names and values. - JSON-lines control channel with real egui pointer and keyboard injection. From 06e212e1bbe1a53d5e3d41dcee5df7ba4fc6009c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 07:20:21 -0800 Subject: [PATCH 2/3] Variables: Import Data Sets follows % column paths as image paths A `%` column's cell was read as given when absolute, or joined to the CSV's folder or `base`, so a CSV could make dataset.import open a file on another computer (a UNC path or a `file:` URL with a host). Each cell now goes through fileio::document_path, as an image variable's path does when a data set is selected (crates/engine/src/cmd/links.rs:1169-1173), with the CSV's folder or `base` as the document's folder. Paths on another computer or on another network share, devices and URLs are refused before any file is read, with the line, the column and the reason. Absolute local paths, `file:` URLs without a host and relative paths are still read, as image paths are. The params text and docs/mcp.md state the rule, and that relative `%` paths are taken from the CSV's folder at import while relative `@` paths are taken from the document's folder when a data set is selected. --- crates/engine/src/cmd/variablecmds.rs | 2 +- crates/engine/src/cmd/variablecmds/csv.rs | 34 ++++++++++--------- crates/engine/src/tests/variables.rs | 40 +++++++++++++++++++++++ crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/mcp.md | 12 ++++--- 20 files changed, 84 insertions(+), 20 deletions(-) diff --git a/crates/engine/src/cmd/variablecmds.rs b/crates/engine/src/cmd/variablecmds.rs index e8867d5505..63119257bc 100644 --- a/crates/engine/src/cmd/variablecmds.rs +++ b/crates/engine/src/cmd/variablecmds.rs @@ -1054,7 +1054,7 @@ pub fn specs() -> Vec { "Import Data Sets…", ["Window", "Variables"], None, - "{path? | data? | dataBase64? | csv?, base?: folder} replace every dataset with the rows of a CSV, comma- or tab-separated, in UTF-16 (with a byte-order mark, or without one when at least half of its two-byte units hold a NUL byte and only one byte order reads a line break; any other file with NUL bytes is refused), UTF-8 or else Windows-1252 (header: one variable name per column, whatever its case; one row per dataset, named Data Set 1, 2… in file order). The document's variables and their bindings stay. A header that names no variable defines one, unbound: `#Name` defines a visibility variable, `@Name` defines an image variable, `%Name` defines a graph variable, and a header without a prefix defines a text variable. A `%Name` column's cells are paths of graph data files, each read as Graph Data's Import Data reads one (at most 1 MB; tab-separated when a line holds a tab, else comma-separated; UTF-16 by dataset.import's rule, else UTF-8, with bytes that aren't UTF-8 read as replacement characters; the first row holds the series labels and the first column the category labels) and kept as the data set's graph value, which applies as graph.setData applies it. A relative path is taken from `base`, else from the folder of the CSV file at `path`; with neither, it is refused. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all (each file counted once, each cell's value every time) refuse the import, naming the line and the column. A prefixed header whose name is a variable of another kind is refused, and so are two headers that name one variable and a header that would define a variable while the variables are locked. An import that leaves the variables and data sets as they were adds no undo step → {imported, names, defined, deletedDataSets}", + "{path? | data? | dataBase64? | csv?, base?: folder} replace every dataset with the rows of a CSV, comma- or tab-separated, in UTF-16 (with a byte-order mark, or without one when at least half of its two-byte units hold a NUL byte and only one byte order reads a line break; any other file with NUL bytes is refused), UTF-8 or else Windows-1252 (header: one variable name per column, whatever its case; one row per dataset, named Data Set 1, 2… in file order). The document's variables and their bindings stay. A header that names no variable defines one, unbound: `#Name` defines a visibility variable, `@Name` defines an image variable, `%Name` defines a graph variable, and a header without a prefix defines a text variable. A `%Name` column's cells are paths of graph data files, each read as Graph Data's Import Data reads one (at most 1 MB; tab-separated when a line holds a tab, else comma-separated; UTF-16 by dataset.import's rule, else UTF-8, with bytes that aren't UTF-8 read as replacement characters; the first row holds the series labels and the first column the category labels) and kept as the data set's graph value, which applies as graph.setData applies it. The files are read at import. A relative path is taken from `base`, else from the folder of the CSV file at `path`; with neither, it is refused (an `@Name` column's relative paths are kept as they are and taken from the document's folder when a data set is selected). A path on another computer, or on a network share other than the one `base` or the CSV is on, a device and a URL other than a `file:` URL without a host are refused, as image variables' paths are, before anything is read. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all (each file counted once, each cell's value every time) refuse the import, naming the line and the column. A prefixed header whose name is a variable of another kind is refused, and so are two headers that name one variable and a header that would define a variable while the variables are locked. An import that leaves the variables and data sets as they were adds no undo step → {imported, names, defined, deletedDataSets}", has_doc, dataset_import ), diff --git a/crates/engine/src/cmd/variablecmds/csv.rs b/crates/engine/src/cmd/variablecmds/csv.rs index 0d3d1057c9..856ea4060e 100644 --- a/crates/engine/src/cmd/variablecmds/csv.rs +++ b/crates/engine/src/cmd/variablecmds/csv.rs @@ -397,27 +397,31 @@ struct GraphFiles { /// The graph value of a `%` column's cell `path` on file line `line`, in 1-based `column`, for the /// graph variable `var`: the graph data file at `path` (taken from the folder `base` when /// relative), read as Graph Data's Import Data reads one ([`crate::cmd::graph::graph_csv_from_file`]), -/// or no value for an empty cell. A relative path without `base`, a file that can't be read or is -/// larger than 1 MB, a file that gives a graph value longer than [`MAX_GRAPH_CSV`] bytes and more -/// than [`MAX_GRAPH_FILES_TOTAL`] bytes in all are refused, with the line and the column. +/// or no value for an empty cell. The path is followed as an image variable's path is +/// ([`crate::cmd::fileio::document_path`]): only files on this computer, or on the network share +/// `base` is on, are read. A relative path without `base`, a path on another computer or share, a +/// device or a URL, a file that can't be read or is larger than 1 MB, a file that gives a graph +/// value longer than [`MAX_GRAPH_CSV`] bytes and more than [`MAX_GRAPH_FILES_TOTAL`] bytes in all +/// are refused, with the line and the column. fn graph_file_value(files: &mut GraphFiles, path: &str, base: Option<&str>, var: &str, (line, column): (usize, usize)) -> Result> { const C: &str = "dataset.import"; let path = path.trim(); if path.is_empty() { return Ok(None); } - let full = match base { - _ if std::path::Path::new(path).is_absolute() => path.to_string(), - Some(base) => std::path::Path::new(base).join(path).to_string_lossy().into_owned(), - None => { - return Err(bad( - C, - format!( - "line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path" - ), - )); - } - }; + // Without `base`, a path that stays relative once a `file:` URL is read is refused here, so the + // error says what to give. + if base.is_none() && craft_docpath::resolve(path, None).is_ok_and(|p| !p.is_absolute()) { + return Err(bad( + C, + format!("line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path"), + )); + } + // `document_path` takes a relative path from the folder of a document; any file name in `base` + // stands for the CSV there. + let document = base.map(|base| std::path::Path::new(base).join("data sets.csv").to_string_lossy().into_owned()); + let full = crate::cmd::fileio::document_path(path, document.as_deref()) + .map_err(|r| bad(C, format!("line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r}")))?; let csv = match files.read.get(&full) { Some(csv) => csv.clone(), None => { diff --git a/crates/engine/src/tests/variables.rs b/crates/engine/src/tests/variables.rs index 604e372a09..711c7c40bb 100644 --- a/crates/engine/src/tests/variables.rs +++ b/crates/engine/src/tests/variables.rs @@ -2229,6 +2229,46 @@ fn datasets_csv_refuses_unreadable_graph_data_files() { assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains('2')), "{value:?}"); } +/// A `%` column's path is followed as an image variable's path is: a path on another computer (a +/// UNC path or a `file:` URL with a host) or a URL other than `file:` refuses the import with the +/// line and column and the reason, before any file is read, and leaves the variables and data sets +/// as they were. A relative path inside the CSV's folder is still read, and so is a `file:` URL +/// without a host when no folder is given. +#[test] +fn datasets_csv_refuses_graph_data_files_on_other_computers() { + let dir = Folder::new("vars-csv-graph-network"); + write(&dir.file("sub/ok.txt"), b"\tA\nX\t1\n"); + let path = dir.file("data.csv"); + write(&path, b"Name,%Chart\na,sub/ok.txt\n"); + let base = dir.0.to_string_lossy().into_owned(); + + let mut s = session(); + let imp = s.execute("dataset.import", &json!({"path": path})).unwrap(); + assert_eq!(imp["imported"], 1); + let value = s.doc().unwrap().doc.variables.datasets[0].values.get("Chart").cloned(); + assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains('A')), "{value:?}"); + // A `file:` URL without a host is a path on this computer, read without a folder to take it from. + let file = dir.file("sub/ok.txt").replace('\\', "/"); + let url = if file.starts_with('/') { format!("file://{file}") } else { format!("file:///{file}") }; + let imp = s.execute("dataset.import", &json!({"csv": format!("%Chart\n{url}")})).unwrap(); + assert_eq!(imp["imported"], 1, "{url}"); + let before = s.doc().unwrap().doc.variables.clone(); + let undo = s.doc().unwrap().history.undo.len(); + for (cell, reason) in [ + (r"\\server\share\ok.txt", "the path is on another computer"), + ("//server/share/ok.txt", "the path is on another computer"), + ("file://server/share/ok.txt", "the path is on another computer"), + ("https://example.com/ok.txt", "the link is not a file path"), + ] { + let want = format!("line 3, column 2: the graph data file `{cell}` for `Chart` isn't followed: {reason}"); + let p = json!({"csv": format!("Name,%Chart\na,sub/ok.txt\nb,{cell}"), "base": base}); + let e = s.execute("dataset.import", &p).unwrap_err().to_string(); + assert!(e.contains(&want), "{cell}: {e}"); + assert_eq!(s.doc().unwrap().doc.variables, before, "{cell}"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{cell}"); + } +} + /// Two header cells that name one variable, by the same name or by a name and its prefix, are /// refused with both columns, and the import changes nothing. #[test] diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 0061c153a3..8f24867021 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -8390,6 +8390,7 @@ breakText Glyphs Glyfy @msg colour, mode and spot apply to solid-colour swatches only colour, mode a spot platí jen pro položky vzorníku s plnou barvou @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` je zadán relativní cestou: zadejte `base` nebo absolutní cestu @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} řádek {line}, sloupec {column}: soubor dat grafu pro `{var}` nelze přečíst: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` se nenačítá: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` je větší než {MAX_GRAPH_DATA_FILE} bajtů @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` dává hodnotu grafu delší než {MAX_GRAPH_CSV} bajtů @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all řádek {line}, sloupec {column}: soubory dat grafu obsahují celkem více než {MAX_GRAPH_FILES_TOTAL} bajtů diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index c5c18e601d..0f64a2feb6 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -8071,6 +8071,7 @@ breakText Glyphs Glyphen @msg colour, mode and spot apply to solid-colour swatches only colour, mode und spot gelten nur für Vollfarbfelder @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ist ein relativer Pfad: Geben Sie `base` oder einen absoluten Pfad an @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} Zeile {line}, Spalte {column}: die Diagrammdatendatei für `{var}` kann nicht gelesen werden: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} Zeile {line}, Spalte {column}: der Diagrammdatendatei `{path}` für `{var}` wird nicht gefolgt: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ist größer als {MAX_GRAPH_DATA_FILE} Byte @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ergibt einen Diagrammwert, der länger als {MAX_GRAPH_CSV} Byte ist @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all Zeile {line}, Spalte {column}: die Diagrammdatendateien enthalten insgesamt mehr als {MAX_GRAPH_FILES_TOTAL} Byte diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 72cfd4fb39..5d97577cb7 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -8250,6 +8250,7 @@ breakText Glyphs Glyphes @msg colour groups can't go into colour groups un groupe de couleurs ne peut pas aller dans un groupe de couleurs @msg colour, mode and spot apply to solid-colour swatches only couleur, mode et ton direct s’appliquent uniquement aux nuances de couleur unie @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` est un chemin relatif : indiquez `base` ou un chemin absolu +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` n’est pas suivi : {r} @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} ligne {line}, colonne {column} : impossible de lire le fichier de données de graphe pour `{var}` : {e} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` dépasse {MAX_GRAPH_DATA_FILE} octets @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` donne une valeur de graphe de plus de {MAX_GRAPH_CSV} octets diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 3b171d2ed7..d07235e525 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6703,6 +6703,7 @@ antiAlias Sharp शार्प @msg colour, mode and spot apply to solid-colour swatches only रंग, मोड और स्पॉट केवल ठोस रंग वाले स्वॉच पर लागू होते हैं @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` एक सापेक्ष पाथ है: `base` या एक पूर्ण पाथ दें @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल पढ़ी नहीं जा सकती: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` का पालन नहीं किया गया है: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` {MAX_GRAPH_DATA_FILE} बाइट्स से बड़ी है @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` से मिलने वाला ग्राफ़ मूल्य {MAX_GRAPH_CSV} बाइट्स से अधिक है @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all लाइन {line}, कॉलम {column}: ग्राफ़ डेटा फ़ाइलों में कुल मिलाकर {MAX_GRAPH_FILES_TOTAL} बाइट्स से अधिक हैं diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 87a55ff0a2..82ec1d41c0 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -8261,6 +8261,7 @@ breakText Glyphs Glifák @msg colour, mode and spot apply to solid-colour swatches only colour, mode és spot: csak egyszínű színmintákra vonatkozik @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja relatív elérési út: adja meg a `base` értéket vagy egy abszolút elérési utat @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line}. sor, {column}. oszlop: a(z) `{var}` diagramadat-fájlja nem olvasható: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} {line}. sor, {column}. oszlop: a(z) `{var}` diagramadat-fájlja nem lesz követve: `{path}`: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja nagyobb {MAX_GRAPH_DATA_FILE} bájtnál @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja {MAX_GRAPH_CSV} bájtnál hosszabb diagramértéket ad @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line}. sor, {column}. oszlop: a diagramadat-fájlok összesen több mint {MAX_GRAPH_FILES_TOTAL} bájtot tartalmaznak diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 6632a9e43c..2179049bf1 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -8121,6 +8121,7 @@ breakText Glyphs Glifi @msg colour, mode and spot apply to solid-colour swatches only colore, metodo e spot si applicano solo ai campioni di colore pieno @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` è un percorso relativo: indica `base` o un percorso assoluto @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} riga {line}, colonna {column}: impossibile leggere il file di dati del grafico per `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` non viene seguito: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` supera i {MAX_GRAPH_DATA_FILE} byte @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` dà un valore di grafico che supera i {MAX_GRAPH_CSV} byte @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all riga {line}, colonna {column}: i file di dati dei grafici contengono in tutto più di {MAX_GRAPH_FILES_TOTAL} byte diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 93e85b0fbf..bf433e9eb7 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7322,6 +7322,7 @@ axis Y Axis Y 軸 @msg colour, mode and spot apply to solid-colour swatches only colour、mode、spot を適用できるのは単色のスウォッチだけです @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` は相対パスです: `base` か絶対パスを指定してください @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line} 行目、列 {column}: `{var}` のグラフデータファイルを読み込めません: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` は参照しません: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` が {MAX_GRAPH_DATA_FILE} バイトを超えています @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` から得られるグラフの値が {MAX_GRAPH_CSV} バイトを超えています @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line} 行目、列 {column}: グラフデータファイルが合計で {MAX_GRAPH_FILES_TOTAL} バイトを超えています diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 052958a93e..0326de8152 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7986,6 +7986,7 @@ breakText Glyphs 글리프 @msg colour, mode and spot apply to solid-colour swatches only colour, mode, spot은 단색 견본에만 적용됩니다 @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`은(는) 상대 경로입니다. `base` 또는 절대 경로를 지정하세요 @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line}행, {column}열: `{var}`의 그래프 데이터 파일을 읽을 수 없습니다: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`을(를) 따라가지 않습니다: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`이(가) {MAX_GRAPH_DATA_FILE}바이트보다 큽니다 @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`에서 나온 그래프 값이 {MAX_GRAPH_CSV}바이트보다 깁니다 @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line}행, {column}열: 그래프 데이터 파일이 모두 합쳐 {MAX_GRAPH_FILES_TOTAL}바이트를 넘습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index a586ff049e..2962182786 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -6308,6 +6308,7 @@ imageTrace Outline Contour @msg colour, mode and spot apply to solid-colour swatches only colour, mode en spot gelden alleen voor stalen met een effen kleur @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` is een relatief pad: geef `base` of een absoluut pad op @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} regel {line}, kolom {column}: het grafiekgegevensbestand voor `{var}` kan niet worden gelezen: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` wordt niet gevolgd: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` is groter dan {MAX_GRAPH_DATA_FILE} bytes @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` geeft een grafiekwaarde langer dan {MAX_GRAPH_CSV} bytes @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all regel {line}, kolom {column}: de grafiekgegevensbestanden bevatten samen meer dan {MAX_GRAPH_FILES_TOTAL} bytes diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 24010e54e6..fe612ca322 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -8362,6 +8362,7 @@ breakText Glyphs Glify @msg colour, mode and spot apply to solid-colour swatches only color, mode i spot dotyczą tylko próbek kolorów jednolitych @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` ma ścieżkę względną: podaj `base` albo ścieżkę bezwzględną @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} wiersz {line}, kolumna {column}: nie można odczytać pliku danych wykresu dla `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` nie jest pobierany: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` jest większy niż {MAX_GRAPH_DATA_FILE} bajtów @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` daje wartość wykresu dłuższą niż {MAX_GRAPH_CSV} bajtów @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all wiersz {line}, kolumna {column}: pliki danych wykresu zawierają łącznie ponad {MAX_GRAPH_FILES_TOTAL} bajtów diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 75d0408eb0..f86d87853b 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -8452,6 +8452,7 @@ swatch Yellow Green Verde-amarelado @msg colour, mode and spot apply to solid-colour swatches only colour, mode e spot se aplicam somente a amostras de cor sólida @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` é um caminho relativo: informe `base` ou um caminho absoluto @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} linha {line}, coluna {column}: não é possível ler o arquivo de dados de gráfico de `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` não é seguido: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` tem mais de {MAX_GRAPH_DATA_FILE} bytes @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` gera um valor de gráfico com mais de {MAX_GRAPH_CSV} bytes @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all linha {line}, coluna {column}: os arquivos de dados de gráfico têm mais de {MAX_GRAPH_FILES_TOTAL} bytes no total diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index de31b66c23..d213772382 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -8029,6 +8029,7 @@ digits Hindi Hindi @msg colour, mode and spot apply to solid-colour swatches only färg, läge och dekor gäller endast enfärgade färgrutor @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` är en relativ sökväg: ange `base` eller en absolut sökväg @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} rad {line}, kolumn {column}: diagramdatafilen för `{var}` kan inte läsas: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` följs inte: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` är större än {MAX_GRAPH_DATA_FILE} byte @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` ger ett diagramvärde som är längre än {MAX_GRAPH_CSV} byte @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all rad {line}, kolumn {column}: diagramdatafilerna innehåller sammanlagt mer än {MAX_GRAPH_FILES_TOTAL} byte diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 407588758f..195693612c 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -7705,6 +7705,7 @@ axis Y Axis Y ekseni @msg colour, mode and spot apply to solid-colour swatches only colour, mode ve spot yalnızca düz renkli renk örnekleri için geçerlidir @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası göreli bir yoldur: `base` ya da mutlak bir yol verin @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} satır {line}, sütun {column}: `{var}` için grafik veri dosyası okunamıyor: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası izlenmiyor: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası {MAX_GRAPH_DATA_FILE} bayttan büyük @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası {MAX_GRAPH_CSV} bayttan uzun bir grafik değeri veriyor @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all satır {line}, sütun {column}: grafik veri dosyaları toplamda {MAX_GRAPH_FILES_TOTAL} bayttan fazla diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 311894ad57..8979298d23 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7988,6 +7988,7 @@ breakText Glyphs Гліфи @msg colour, mode and spot apply to solid-colour swatches only colour, mode і spot застосовуються лише до зразків суцільного кольору @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` задано відносним шляхом: укажіть `base` або абсолютний шлях @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} рядок {line}, стовпець {column}: не вдається прочитати файл даних діаграми для `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} рядок {line}, стовпець {column}: перехід до файлу даних діаграми `{path}` для `{var}` не виконується: {r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` більший за {MAX_GRAPH_DATA_FILE} байтів @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` дає значення діаграми довше за {MAX_GRAPH_CSV} байтів @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all рядок {line}, стовпець {column}: файли даних діаграм разом містять понад {MAX_GRAPH_FILES_TOTAL} байтів diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 6132c78d9f..659c8297bf 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -8348,6 +8348,7 @@ breakText Glyphs 字形 @msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只适用于纯色色板 @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 是相对路径:请提供 `base` 或绝对路径 @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} 第 {line} 行,第 {column} 列:无法读取 `{var}` 的图表数据文件:{e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} 第 {line} 行,第 {column} 列:未跟随 `{var}` 的图表数据文件 `{path}`:{r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 超过 {MAX_GRAPH_DATA_FILE} 字节 @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 得到的图表值超过 {MAX_GRAPH_CSV} 字节 @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all 第 {line} 行,第 {column} 列:图表数据文件总计超过 {MAX_GRAPH_FILES_TOTAL} 字节 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index e034fcb82a..732fe86def 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -8276,6 +8276,7 @@ breakText Glyphs 字符 @msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只適用於純色色票 @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 是相對路徑:請提供 `base` 或絕對路徑 @msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} 第 {line} 行,第 {column} 欄:無法讀取 `{var}` 的圖表資料檔案:{e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} 第 {line} 行,第 {column} 欄:未跟隨 `{var}` 的圖表資料檔案 `{path}` 的連結:{r} @msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 超過 {MAX_GRAPH_DATA_FILE} 位元組 @msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 得到的圖表值超過 {MAX_GRAPH_CSV} 位元組 @msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all 第 {line} 行,第 {column} 欄:圖表資料檔案合計超過 {MAX_GRAPH_FILES_TOTAL} 位元組 diff --git a/docs/mcp.md b/docs/mcp.md index 495d415593..4f3b2f6c30 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3486,10 +3486,14 @@ already walks Image Trace. Short agent entry points: at most 1 MB; tab-separated when any line holds a tab, else comma-separated; the first row holds the series labels and the first column the category labels; UTF-16 by the rule below, else UTF-8. The data becomes the data set's graph value, which `dataset.select` applies as `graph.setData` applies it, so the graph gets the data that Import - Data and Apply give it. A relative path is taken from `dataset.import`'s `base` folder, else from the folder of the - CSV file at `path`; with neither (`csv`, `data` or `dataBase64` and no `base`), it fails the import. This is - VectorCraft's own rule. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value - longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all fail the import with + Data and Apply give it. The files are read at import. A relative path is taken from `dataset.import`'s `base` + folder, else from the folder of the CSV file at `path`; with neither (`csv`, `data` or `dataBase64` and no `base`), + it fails the import. This is VectorCraft's own rule, and it differs from an `@` column's: an image path is kept as + the cell gives it, and a relative one is taken from the document's folder when a data set is selected. A `%` path is + followed as an image path is: a path on another computer, or on a network share other than the one `base` or the + CSV file is on, a device, and a URL other than a `file:` URL without a host fail the import with the line, the + column and the reason, and no file is read. A file that is missing, can't be read or is larger than 1 MB, a file + that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all fail the import with the line and the column, and the document is left as it was. Each file is read once per import, however many cells name it, and counts once toward the 256 MB; each cell's graph value counts every time. `dataset.export` writes a visibility variable's header as `#Shown` and an image variable's as `@Photo`, and a text or graph variable's as its From 3c0d32c1c34565737e026eb964048318ef74d0bf Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 08:28:07 -0800 Subject: [PATCH 3/3] Graphs: CSV graph data keeps the series labels given, as Graph Data does Graph data applied as CSV kept a blank series label for each column after the last label given, because to_csv writes one for every series without a label. A graph data file named in an Import Data Sets % column therefore gave the graph ["A", ""] where Graph Data's Import Data and Apply give it ["A"]. The CSV branch of apply_data now drops trailing blank labels, as graph_data_from_grid does; blank labels between given ones stay. --- crates/engine/src/cmd/graph/data.rs | 5 +++++ crates/engine/src/tests/variables.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/crates/engine/src/cmd/graph/data.rs b/crates/engine/src/cmd/graph/data.rs index b231ee2051..11cfd4ed26 100644 --- a/crates/engine/src/cmd/graph/data.rs +++ b/crates/engine/src/cmd/graph/data.rs @@ -245,6 +245,11 @@ pub(super) fn apply_data(g: &mut GraphSpec, p: &Value, cmd: &str) -> Result