mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 21:42:59 -05:00
Merge main into feat/scripts-text-paint
This commit is contained in:
commit
7abdcad40e
65 files changed
+4905
-197
No files matched your search
+1
-1
@@ -353,7 +353,7 @@ The app decides which cursors exist; whoever draws them works from the list. For
|
||||
|
||||
## Test lint
|
||||
|
||||
`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`) and `thread::sleep` in test code (`sleep`). It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and test code that reads Rust source outside the audits listed in `SOURCE_AUDITS`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail.
|
||||
`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`), `thread::sleep` in test code (`sleep`), test code that reads Rust source outside the audits listed in `SOURCE_AUDITS` (`reads-source`), and a test that a `cfg` on it or on a `mod` above it excludes from every CI target that builds the crate (`never-run`). `never-run` reports a test only when it can evaluate the `cfg` on every such target; a predicate it does not evaluate, such as a `feature`, counts as unknown, so `#[cfg(all(feature = "gpu", not(feature = "gpu")))]` is not reported. It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and the hits of `census`, `mirror`, `constant-echo`, `fixture-only` and `exact-pixel`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
+81
-5
@@ -2756,9 +2756,10 @@ control character, in the first 8 KiB) or `tooLarge` (over 8 MiB). For a script,
|
||||
assign or declare `Folder`; a variable whose name a member assignment writes counts as one that may hold a File
|
||||
object; the same objects left out are not counted for the File-only functions `open`, `read`, `readch`,
|
||||
`readln`, `write`, `writeln`, `copy`, `createAlias`, `openDlg` and `saveDlg`, which a Folder object does not
|
||||
have; a document's `saveAs`, `exportFile` or `exportVariables` counts too, and so does `SaveOptions.SAVECHANGES`
|
||||
wherever the script reads it, since `close` given it saves the document to its file), `filesOpened` (files opened
|
||||
in other apps), `network`,
|
||||
have; a document's `saveAs`, `exportFile` or `exportVariables` counts too, and so do `print` called on
|
||||
`app.activeDocument`, `app.documents[i]`, `documents.add()`, `documents.getByName()` or `app.open()`, or on a
|
||||
variable that holds one of them, and `SaveOptions.SAVECHANGES` wherever the script reads it, since `close` given
|
||||
it saves the document to its file), `filesOpened` (files opened in other apps), `network`,
|
||||
`nativeCode`, `otherApps` (messages to other apps), `environment` (environment variables), `unseenCode` (`eval`,
|
||||
`new Function` and `$.evalFile`) and `preferences` (the reference app's preferences changed).
|
||||
- `problems` lists what would stop the script loading as written (strings, comments, regular expressions,
|
||||
@@ -3214,6 +3215,78 @@ through `$`:
|
||||
show the prompt. A bad value throws an error before anything is written. The warnings of the save or export that
|
||||
`saveAs`, `exportFile`, `app.open` and `close` run go to the console, each after the method's name
|
||||
(`saveAs: …`).
|
||||
- `Document.print(options?)` runs `file.print` on the document, with the options a script assigned over the
|
||||
document's print settings, or over the preset's when `printPreset` is assigned. The document's print settings
|
||||
stay as they are, and `print` adds no undo step
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/Document/, https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/).
|
||||
`options` is a `new PrintOptions()`, whose `jobOptions`, `colorManagementOptions`, `colorSeparationOptions`,
|
||||
`coordinateOptions`, `flattenerOptions`, `fontOptions`, `pageMarksOptions`, `paperOptions` and `postScriptOptions`
|
||||
are `new PrintJobOptions()`, `new PrintColorManagementOptions()`, `new PrintColorSeparationOptions()`,
|
||||
`new PrintCoordinateOptions()`, `new PrintFlattenerOptions()`, `new PrintFontOptions()`,
|
||||
`new PrintPageMarksOptions()`, `new PrintPaperOptions()` and `new PrintPostScriptOptions()`
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ and the pages beside it). Each property reads as
|
||||
its help page's default until it is assigned, and a `PrintOptions` holds its option objects by reference, so a change
|
||||
made after the assignment is printed. `print` maps `printPreset` (a print preset's name) and `flattenerPreset`;
|
||||
`copies` (1 to 999), `collate`, `reversePages`, `designation`, `printAllArtboards`, `artboardRange`,
|
||||
`printAsBitmap` and `file` of the job; `colorProfileMode` (`SOURCEPROFILE` and `CUSTOMPROFILE`), `intent` and
|
||||
`name` (an RGB or CMYK profile) of color management; `colorSeparationMode` (`COMPOSITE` and
|
||||
`HOSTBASEDSEPARATION`), `convertSpotColors` and `overPrintBlack`; `emulsion`, `fitToPage`, `horizontalScale` and
|
||||
`verticalScale` (1 to 1000), `orientation`, `position` and `tiling`; `overprint` of the flattener; `colorBars`,
|
||||
`pageInfoMarks`, `registrationMarks`, `trimMarks`, `pageMarksType` and `trimMarksWeight`; `name`, `width`,
|
||||
`height` and `transverse` of the paper; and `negativePrinting` and `postScriptLevel` (`PSLEVEL2` and `PSLEVEL3`).
|
||||
`app.printPresetsList` gives the print presets' names, `[Default]` first, and `app.PPDFileList` is empty.
|
||||
The enumerations `PrintColorProfile`, `PrintColorIntent`, `PrintColorSeparationMode`, `PrintOrientation`,
|
||||
`PrintPosition`, `PrintTiling`, `PrintArtworkDesignation`, `PrintingBounds`, `PrintFontDownloadMode`,
|
||||
`FontSubstitutionPolicy`, `PageMarksTypes`, `PostScriptImageCompressionType` and `PrinterPostScriptLevelEnum` hold
|
||||
strings such as `"PrintTiling.TILEFULLPAGES"`. VectorCraft's own rules: `print` writes the file `jobOptions.file`
|
||||
names, checked as `saveAs` checks its file: PostScript when the name ends with `.ps` or `postScriptLevel` is
|
||||
assigned, a print-ready PDF otherwise, also when that name is a link to a file with another extension, and
|
||||
`printerName` does not apply. Without a file, `print` prints to the
|
||||
printer `printerName` names, or to the system's default printer when it is `""` or not assigned
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/). The name must be exactly the name of a printer the
|
||||
app listed for the run, or `print` throws `PrintOptions.printerName names no installed printer`; with no default
|
||||
printer it throws `There is no default printer`. `print` composes the job as a print-ready PDF when it is called
|
||||
and sends nothing while the run goes on. When the run ends and its changes are kept, the app asks before it sends
|
||||
the jobs (dialog kind `scriptPrint`, listing each job's document, printer and pages). The dialog does not open
|
||||
while a text field or text being typed on the canvas has the keyboard; it opens once neither does. The jobs are
|
||||
sent only after the person at the keyboard clicks its Print button, or presses Space once Tab has moved the focus to
|
||||
it: the button takes no click for the first second after the dialog appears (VectorCraft's own value), and Enter
|
||||
does not print. `ui.dialog.set` refuses `answer: "print"`, `ui.dialog.confirm` is refused unless `answer` is
|
||||
`"cancel"`, and a Print that synthetic input gives is refused and the dialog opens again. Cancel, Escape,
|
||||
`ui.dialog.cancel` and `answer: "cancel"` drop the jobs and keep the run's changes. A run that fails or is stopped sends
|
||||
nothing. Before it sends them, the app checks that each printer is still installed under that name, and sends none
|
||||
when one is not. A run prepares at most 4 jobs, together at most 100 pages, every copy counted, and 32 MiB, and
|
||||
none while an earlier run's jobs wait for an answer. The pages are counted from the art as it prints, artboard
|
||||
backgrounds and placed files included, before the job is composed. A job for a printer is a PDF, so `postScriptLevel` with no
|
||||
file throws. Where the app lists no printers for scripts (the web build, and MCP or the command line without the app),
|
||||
`print` with no file throws `Printing to a printer is not available here`. `app.printerList` gives a `Printer` for
|
||||
each printer the app listed for the run, at most 256, leaving out names longer than 512 bytes or with a control
|
||||
character; when the system's default printer comes after the first 256, it takes the last place
|
||||
(https://ai-scripting.docsforadobe.dev/jsobjref/Application/,
|
||||
https://ai-scripting.docsforadobe.dev/jsobjref/Printer/). Its `name` is read-only and its `printerInfo` throws an
|
||||
error that says it is not available yet. With no document open, `app.printerList` throws `Application.printerList
|
||||
needs an open document`, as the Printer help page describes, and where the app lists no printers for scripts it
|
||||
throws `Application.printerList is not available here`. A printer name is only compared with the listed names: it
|
||||
is never read as a path, a URL or a command. `fitToPage` set to true wins over the scale factors and the tiling
|
||||
mode. With `printAllArtboards` false, `artboardRange` picks the artboards, and without a range every artboard
|
||||
prints. With `printAllArtboards` not assigned, an assigned `artboardRange` replaces the range of the settings
|
||||
`print` starts from, which prints when those settings print a range. `print` starts from the preset's settings
|
||||
when `printPreset` is assigned, otherwise from the document's saved settings. When those settings ignore the
|
||||
artboards, an assigned `printArea` prints the artboards an assigned `artboardRange` names, or each artboard without
|
||||
a range. With one of `horizontalScale` and `verticalScale` assigned, the other keeps its value in the settings
|
||||
`print` starts from. `print` throws before anything is written when an assigned `artboardRange` names an
|
||||
artboard the document does not have, also with `printAllArtboards` true, when `printPreset` or `flattenerPreset`
|
||||
is not a preset's name (any case), when `colorManagementOptions.name` is not an RGB or CMYK profile's name (any
|
||||
case), when `paperOptions.name` is not a paper `file.print` knows, or when it names a paper other than `custom`
|
||||
and `width` or `height` is assigned above 0. An assigned name that is empty or only spaces, or holds `/`, `\` or
|
||||
a control character (also at either end), throws too, and each checked name is sent without the spaces around it.
|
||||
`PPDName` takes only `""`. A listed option that is not mapped, or a value that is not mapped such as
|
||||
`PrintingBounds.ARTWORKBOUNDS`, `INRIPSEPARATION`, `PSLEVEL1` or a scale above 1000 with `fitToPage` not true,
|
||||
throws an error that says it is not available yet. Each value is checked when it is assigned: a wrong type, a number that is not finite or is
|
||||
out of range, a string longer than 4,096 bytes, an option object of the wrong class or from an earlier run, and a
|
||||
path given as a string all throw. A run makes at most 256 option objects. Each warning `file.print` gives goes to
|
||||
the Script Console as a line that starts with `Document.print: `. `vc.run` still cannot run `file.print` or
|
||||
`print.*`.
|
||||
- `Document.pathItems` (https://ai-scripting.docsforadobe.dev/jsobjref/PathItems/) lists the document's paths in the
|
||||
order of `pageItems`, paths inside groups and compound paths included, with `length`, `[i]`, `[name]` (read as
|
||||
`pageItems["name"]` is read), `index(key)`,
|
||||
@@ -3781,7 +3854,8 @@ In the app, a script past the growth limit stops at a question to continue or to
|
||||
with an error at that limit. The headless reply is `{ok: true, name, changed, written, log, fuelUsed, hostCalls,
|
||||
runTimeMs, timingAvailable, hostCallCounts, slowestCommands, console, dialogs, dialogCount, dialogsTruncated}`, with
|
||||
`unhandledRejections` and `unhandledRejectionCount` as well when a `.js` script left rejected promises unhandled. In
|
||||
the app the reply is `{running: true, name}`, and the report appears later as `scriptReport` in `ui.inspect`. The
|
||||
the app the reply is `{running: true, name}`, and the report appears later as `scriptReport` in `ui.inspect`, with
|
||||
`prints`, the number of jobs the run prepared for a printer, when it prepared any. The
|
||||
report of a failed run has the same fields after `kind`, `message`, `messageOrigin`, `line`, `column`, `file` (when
|
||||
the error is in another file than the script) and `fuelLeft`. `messageOrigin` is `script` when `message` is text the
|
||||
script supplied (a value it threw, or an error it made or whose name or message it changed) and `built-in` for the
|
||||
@@ -13068,7 +13142,9 @@ bleed, composite or separations output, graphics and colour management options o
|
||||
`transform` from the document onto the page (pt, y down), the document `area` it prints, its `trim` box on the page
|
||||
and, with copies per sheet, each copy's artboard on the page (`copies`), plus `tiles`, the
|
||||
`inks` of a separation and `warnings`. `file.print {settings?, path?}` writes the job as a print-ready PDF (one page per
|
||||
sheet, tile, ink and copy); headless it answers `dataBase64`. In the app, `file.print` with no params opens the Print
|
||||
sheet, tile, ink and copy); headless it answers `dataBase64`. With `maxPages`, the job is composed only when it
|
||||
prints at most that many pages, copies counted; with more, `file.print` composes and writes nothing and answers
|
||||
`{pages, format}`. In the app, `file.print` with no params opens the Print
|
||||
dialog, and with params it prints through the system (`printer`: a name from `print.printers`, default the system's
|
||||
default printer) or, with `toFile`, a `path` or no printing available, saves the PDF.
|
||||
|
||||
|
||||
@@ -1119,6 +1119,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- Scripts: `document.characterStyles` and `document.paragraphStyles` add, find, rename, redefine, apply and remove character and paragraph styles, with the Normal styles listed first and kept, and a text range lists the styles its text is in, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/CharacterStyles/, https://ai-scripting.docsforadobe.dev/jsobjref/CharacterStyle/, https://ai-scripting.docsforadobe.dev/jsobjref/ParagraphStyles/, https://ai-scripting.docsforadobe.dev/jsobjref/ParagraphStyle/ and https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ describe them (`docs/mcp.md`). Style names of 1 to 256 characters without control characters, and at most 4,096 styles named in one run, are VectorCraft's own rules. Load Character Styles, Load Paragraph Styles and Load All Styles refuse a file larger than 64 MB. A paragraph style's character attributes are not there yet. `crates/engine/src/tests/script_styles.rs`.
|
||||
- Scripts: a text frame's `nextFrame` and `previousFrame` read and set its links to the frames before and after it, `areaText` and `pathText` thread a new frame to a base frame, and `document.stories` lists the stories, each with its frames in thread order and its text across them as one text range with its characters, words and paragraphs, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItem/, https://ai-scripting.docsforadobe.dev/jsobjref/Story/ and https://ai-scripting.docsforadobe.dev/jsobjref/Stories/ describe them; `text.thread.setNeighbor` links or unlinks two frames by id (`docs/mcp.md`). Which links are refused, and how a story is listed and found, are VectorCraft's own rules. `crates/engine/src/tests/script_threads.rs`.
|
||||
- Scripts: `PageItem.tags` reads, adds, renames and deletes an object's tags, name and value pairs that the native file keeps, and `Document.tags` reads, renames and deletes the tags of every page item but adds none (its `add` throws; a script adds a tag through the page item's `tags`), as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Tags/ and https://ai-scripting.docsforadobe.dev/jsobjref/Tag/ describe them, through `object.tags` and the `object.tag.*` commands, at most 64 tags an object (`docs/mcp.md`). `crates/engine/src/tests/script_tags.rs`.
|
||||
- Scripts: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`.
|
||||
- Scripts: `Document.print` without a file prints to the printer `PrintOptions.printerName` names, or the default printer, and `app.printerList` lists the installed printers as `Printer` objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/Application/ and https://ai-scripting.docsforadobe.dev/jsobjref/Printer/ describe. VectorCraft's own rules: the jobs are sent after the run's changes are kept and the person at the keyboard clicks Print or presses Space on it, which takes no click or focus for the first second, nothing is sent from a failed run, and the web build, and MCP or the command line without the app, cannot print to a printer from a script (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`, `crates/ui-egui/src/tests/script_print.rs`.
|
||||
- Scripts: `Document.saveAs`, `Document.exportFile` and `app.open` save, export and open documents, `Document.fullName` and `saved` give a document's file and saved state, setting `saved` records that state (`document.setSaved`), `Document.path` gives its folder as a `Folder` (VectorCraft's own type), and `Document.close` closes it, saving to its file first with `SaveOptions.SAVECHANGES`, with the option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/IllustratorSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/EPSSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/PDFSaveOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsPNG24/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsJPEG/, https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsSVG/, https://ai-scripting.docsforadobe.dev/jsobjref/PDFFileOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/Document/ describe (the enumerations of the options that keep their defaults included), and read and write only where the script's `File` objects may, refusing a path whose real file name is not valid UTF-8; the warnings of each save, export and open go to the console (`docs/mcp.md`). `crates/engine/src/tests/script_save_open.rs`.
|
||||
- Scripts: the global `app` gives the open documents, new documents from a startup preset and a `DocumentPreset`, the active document, each document's selection and its page items with their names, notes, visibility, lock, opacity, position, size, bounds and stacking order, and moves and copies them into or beside other objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Application/, https://ai-scripting.docsforadobe.dev/jsobjref/Documents/, https://ai-scripting.docsforadobe.dev/jsobjref/DocumentPreset/, https://ai-scripting.docsforadobe.dev/jsobjref/Document/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PageItem/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ describe them; each change runs a command inside the run's transaction (`docs/mcp.md`). A script can check a member with `hasOwnProperty`, and can read a collection by name and name `activeDocument`, `documents` and `selection` without `app.` (https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/). A key such as `1` is an array index and reads that position; in `pageItems` and `documents`, a number that is not an array index, such as `-1` or `1.5`, is looked up by name when the key is the text JavaScript writes for that number. VectorCraft's own rule. `app.executeMenuCommand` runs the menu items Select All, Deselect, Group, Ungroup, Make and Release Clipping Mask, Make and Release Compound Path, and Fit to Artwork Bounds by their menu command names (https://community.adobe.com/questions-652/a-list-of-illustrator-menu-commands-we-can-call-from-javascript-769510, https://gist.github.com/shalakolee/df3246659d4289eb99149b9ed00a00ee). The `parent` of a page item at the top of a layer is a `Layer` with `name`, `typename` and `toString`. A page item's `blendingMode` reads and sets its blend mode with the `BlendModes` values (https://ai-scripting.docsforadobe.dev/jsobjref/scripting-constants/).
|
||||
`Document.views` lists the document's drawn windows with their bounds, center, zoom and screen mode (https://ai-scripting.docsforadobe.dev/jsobjref/View/). Zoom follows each window's displayed percentage, including display density with Display Print Size at 100% Zoom enabled; bounds retain the physical camera scale. View objects keep their targets when windows are renumbered. View changes run no command, add no undo step, and remain when a script fails. A center outside the canvas after coordinate conversion throws a `RangeError`. `Document.layers`, `Document.activeLayer` and the other classes this list does not name are not there yet. `crates/engine/src/tests/script_dom.rs`.
|
||||
|
||||
Reference in new issue
Block a user