Variables: Save Variable Library… writes the variables and data sets as an XML library

Squashed from #5147 onto main.
This commit is contained in:
dotCooCoo
2026-11-02 14:32:52 +07:00
committed by bflatastic
parent 9031906abd
commit e8cd6c173a
33 changed files with 628 additions and 11 deletions
+12
View File
@@ -1679,6 +1679,18 @@ already walks Image Trace. Short agent entry points:
comments, processing instructions and up to 64 entity declarations whose values are plain text (no `<`, `&` or
`%`). A declaration that holds anything else, and entity references that expand the library past 8 MiB, are
refused. So are a variable or data set declared twice and a value for a variable the library doesn't declare.
`variable.saveLibrary {path?}` (the panel menu's Save Variable Library…) writes the document's text variables and
every data set as a variable library in the layout `variable.loadLibrary` reads: a `variable` element with
`varName` and `trait="textcontent"` for each text variable, and a `sampleDataSet` element with `dataSetName` for
each data set, holding an element named after each text variable it has a value for, with one `p` element per line
of the value. Loading the file gives back the same text variables, data set names and text values. Variables of
other kinds are left out with their values: the reply lists them in `skipped` (`name`, `kind`), and its `warning`
names each kind with its count. Saving is refused for a document without a text variable, for a text variable whose
name isn't an XML name (it starts with a letter or `_` and holds only letters, digits, `-`, `_` and `.`), for a
data set whose name or text value holds a control character, for a data set name with white space at either end,
for a name longer than 255 characters or used twice, and past `variable.loadLibrary`'s caps (256 variables, 1,000
data sets, 8 MiB). Without `path` the reply is `{xml, variables, datasets, skipped, warning?}`;
with it, the file is written and the reply is `{path, variables, datasets, skipped, warning?}`.
- Batch: `action.batch {commands, source?: folder|datasets, folder?, destination?: none|saveAndClose|folder,
destinationFolder?, overrideOpen?, overrideSave?, overrideExport?, includeSubdirs?, stopOnError?}` plays an
action on every file in a folder or every data set (the Actions panel menu's Batch…). Override Save and Override
+1
View File
@@ -565,6 +565,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 tab-separated files as well as comma-separated ones, and files without a `name` column, whose rows take the first free names Data Set 1, Data Set 2 and so on. An import error about a row's values or name gives the file line the row starts on.
- 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: 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 variable is deleted with its bindings and values, and every data set is deleted; then the library's text variables are defined, unbound, and its data sets take the text of each value's `p` elements, one paragraph each. Variables of other kinds are left out with a warning that names their kinds.
- Variables: Save Variable Library… in the Variables panel menu (`variable.saveLibrary`) writes the document's text variables and data sets as a variable library's XML file, which Load Variable Library reads back with the same text variables, data set names and text values. Variables of other kinds are left out with a warning that names their kinds.
- JSON-lines control channel with real egui pointer and keyboard injection.
- Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709).
- The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s.