Commit Graph
161 Commits
Author SHA1 Message Date
dotCooCoo 3140831da9 Merge main into feat/scripts-text-paint 2026-12-02 13:57:18 -08:00
dotCooCoo 5b5ed84c9f Merge main into feat/scripts-text-paint 2026-12-02 11:55:37 -08:00
dotCooCoo 497e2eb4e7 Merge main into feat/scripts-api-d8b-tracing 2026-12-02 11:33:20 -08:00
.CooCoo 5d22b25bb7 Merge pull request #10333 from dotCooCoo/fix/script-new-document-overprint-links
Scripts: file.new takes Overprint Preview and reads the profile's linked files
2026-12-02 11:15:14 -08:00
dotCooCoo f8eb542e04 Scripts: geometry read from a document in the back matches what the setters measure
The bounds getters (position, left, top, width, height and the bounds
arrays) read an item in a document in the back without measuring its type,
while the setters measure it after the switch to that document since
#10538. A script that read t.width and assigned it back could resize the
item, and every geometry assignment switched to the document and back even
when nothing changed.

The getters now measure type not measured yet in a document in the back
for an item that holds type, a symbol instance or a placed document, the
way the switch measures it, and the check is skipped while the document is
unchanged. An assignment equal to the current value of an object without
such content in a document in the back returns without switching
documents, and no undo step is made.
2026-12-02 07:21:25 -08:00
dotCooCoo 47a8bcde18 Merge main into feat/scripts-api-d8b-tracing 2026-12-02 02:46:39 -08:00
dotCooCoo 70d70ca909 Scripts: width, height and position setters measure after the document comes to the front
Setting width, height, left, top or position on an item in a document in
the back measured the item before its document was made active. Making a
document active measures its type again where it is not measured yet or
where a composite font of the same name changed, so the scale ratio or the
move distance applied to bounds that no longer held, and the item ended
at a different size or place than the one asked for.

The measurement now runs inside the edit, after the switch, through a new
edit_item_with that edit_item also uses.
2026-12-01 21:09:17 -08:00
dotCooCoo 7abdcad40e Merge main into feat/scripts-text-paint 2026-12-01 14:57:03 -08:00
dotCooCoo a7129f3eed Merge main into feat/scripts-api-d8b-tracing 2026-12-01 14:07:15 -08:00
dotCooCoo 9bf07c220e Merge main into fix/script-new-document-overprint-links 2026-12-01 13:53:12 -08:00
.CooCoo a5a3e40c5e Merge pull request #9087 from dotCooCoo/feat/scripts-print-printer
Scripts: Document.print prints to an installed printer and app.printerList lists the printers
2026-12-01 13:11:17 -08:00
dotCooCoo 429bab3afd Merge main into feat/scripts-text-paint 2026-12-01 11:16:48 -08:00
.CooCoo 7936fd6f67 Merge pull request #10153 from dotCooCoo/fix/file-new-rejects-bad-rows
New Document: file.new refuses artboard counts that are not whole numbers
2026-12-01 09:47:36 -08:00
dotCooCoo 5f0b0456d2 Merge main into feat/scripts-text-paint 2026-12-01 09:01:23 -08:00
dotCooCoo 6de89eece9 Merge main into feat/scripts-api-d8b-tracing 2026-12-01 09:00:59 -08:00
dotCooCoo 99bea87cff Merge main into feat/scripts-api-d8b-tracing 2026-12-01 02:16:37 -08:00
dotCooCoo b833903e70 Merge main into feat/scripts-text-paint 2026-11-30 21:03:58 -08:00
dotCooCoo ea8352c5d7 Merge main into feat/scripts-print-printer 2026-11-30 20:57:56 -08:00
dotCooCoo 5134b5a7bc Merge main into fix/script-new-document-overprint-links 2026-11-30 20:54:11 -08:00
dotCooCoo 74e572c8c5 Merge main into fix/script-page-item-edits
# Conflicts:
#	crates/engine/src/script/dom/paths.rs
2026-11-30 19:56:24 -08:00
.CooCoo 703252de65 Merge pull request #10334 from dotCooCoo/fix/script-run-accounting
Scripts: list rebuilds count against the run, a stop is not masked, bad answers throw at the call
2026-11-30 19:18:27 -08:00
dotCooCoo bd1975c937 Merge main into fix/script-page-item-edits 2026-11-30 18:28:53 -08:00
dotCooCoo 1feb6c7f38 Scripts: duplicate refuses a copy of a clipping path below itself
mask.duplicate(mask, ElementPlacement.PLACEAFTER) put the copy directly
above the clipping path without an error. A copy now goes through the
same refusal as other objects; move of the clipping path below itself
still leaves it where it is.
2026-11-30 18:18:59 -08:00
dotCooCoo 805dceafce Merge main into feat/scripts-api-d8b-tracing
# Conflicts:
#	crates/engine/src/tests/script_dom.rs
2026-11-30 17:55:16 -08:00
.CooCoo e3a265870d Merge pull request #10331 from dotCooCoo/fix/script-tests-check-what-they-name
Tests: script DOM and New Document tests check what they name
2026-11-30 17:05:58 -08:00
dotCooCoo fe89d3f81e Scripts: list rebuilds count against the run, a stop is not masked, bad answers throw at the call
- pageItems, pathItems and textFrames build their list of a document again
  after every edit. The rebuild walked the whole document without counting
  anything against the run, so a loop that edits and reads a collection in a
  large document did unbounded host work. A rebuilt list now counts 16 bytes
  per object (as the selection's list does) against the run's host-call
  allowance, and the path and type lists count the page items they scan.
- An edit's own ordinary error was returned ahead of a stop (an uncatchable
  Abort) from putting back the selection or switching back to the active
  document, so a script could catch it and go on. A stop now comes first.
- An answer to a waiting call that could not be read as a value (nested too
  deep, too many entries) ended the run instead of being thrown at the call.
  It is now thrown there, where the script can catch it, and a ScriptUI dialog
  that waited for the answer stops showing, as when its host call fails.
- The selection cost test also compares the host calls, under the same
  64 KiB limit for both documents.
2026-11-30 15:54:45 -08:00
dotCooCoo 316a4b6bfa Scripts: file.new takes Overprint Preview and reads the profile's linked files
A script's addDocument with previewMode OverprintPreview failed: file.new
turned the view on with view.overprintPreview, which scripts may not
run. A script's file.new now asks for the view, and the run turns
Overprint Preview on when it ends; a run that fails does not turn it on.

The images a New Document profile's symbols, patterns and brushes link
to were read under the script's file gate, after the profile's own file
was read outside it, so images beside the profile showed only their
preview. They are now read the way the profile's file is, under the
automation roots in force.
2026-11-30 15:54:19 -08:00
dotCooCoo 4082035b82 Scripts: locked artboards stop path edits, and move and zOrder respect clipping paths
- PathItem point, paint, stroke and transform changes on a path on a locked
  artboard now throw `Cannot edit` and change nothing, as the PageItem
  setters do. `pathItems.removeAll()` deletes nothing when a path is on a
  locked artboard, as `pageItems.removeAll()` does; it used to delete them.
- `move` and `duplicate` with `PLACEAFTER` and the clipping path of a clip
  group or clipping layer as the relative object throw instead of putting
  the object above the clipping path, or reporting success without moving it.
- `zOrder` counts the art above a clipping path and below the layer's ruler
  guides, as the Arrange commands do, so a method that leaves the object
  where it is runs no command.

Docs: docs/mcp.md.
2026-11-30 15:51:02 -08:00
dotCooCoo 0a56d7df9d Tests: script DOM and New Document tests check what they name
- The grid-by-column test now checks each artboard's row and column, so
  RLGridByCol must fill from the rightmost column. It compared only the
  number of distinct rows and columns before, which a left-to-right fill
  also passes.
- The keepEmpty test asserts that keepEmpty false deletes the compound
  path, instead of accepting any state other than an empty compound.
- The addDocument profile test closes the profile document before the
  script reads the profile, so the read goes through the app-folder
  exemption and not through the rule for open documents' files.
- The report-origin test adds authored ReferenceError controls for
  Window and activeDocument, and for BridgeTalk thrown as an error
  object, so a hint list that grows to those names cannot change a
  message the script wrote.
- New Document profile tests, and the temporary folders and files in
  script_dom.rs and script_run.rs, use vectorcraft_testkit::TempDir, so
  a failing assertion no longer leaves process-id folders behind. The
  linked-profile test keeps its link target in the same temporary
  folder.
2026-11-30 15:50:56 -08:00
dotCooCoo b8ee4686b0 Scripts: getIsFileOpen keeps backslashes in Unix file names; DocumentPreset checks its receiver
app.getIsFileOpen treated any path with a backslash as a Windows path,
turning each backslash into a folder separator and ignoring letter case.
On macOS and Linux a backslash is a character of a file name, so
getIsFileOpen answered true for the path /work/a\b.ai while /work/a/b.ai
was open.
Paths now get the Windows rules only on Windows or when they start with a
drive letter.

DocumentPreset.typename and toString() answered for a preset kept from
an earlier run with #targetengine, while its settings throw a TypeError.
Both now check the preset the way the settings do.

Documents.addDocumentNoUI(startupPreset) was missing. It now makes the
document addDocument(startupPreset) makes.
2026-11-30 15:39:56 -08:00
dotCooCoo 59eff04041 Merge main into feat/scripts-text-paint 2026-11-30 15:21:19 -08:00
dotCooCoo 0c13a1edb2 Scripts: close the review gaps in print, saveAs, File paths and presets
- The 1000% scale limit applies only when Fit to Page is off, since the
  scale factors are not used with it on.
- A script run clears the print command allowance when it ends, so a
  panic inside print cannot leave file.print open to later runs.
- saveAs without options takes the format from the path the script
  names, so a link at that path cannot change it.
- A File the host gives back charges its path to the heap.
- DocumentPreset.typename throws for a preset from an earlier run.
- Documents.addDocumentNoUI throws that it is not available yet.
- The print tests remove their folders when an assertion fails.
2026-11-30 14:54:47 -08:00
dotCooCoo c1af5511fb Merge main into feat/scripts-api-d8b-tracing 2026-11-30 11:24:27 -08:00
.CooCoo 82108c11bd Merge pull request #9277 from dotCooCoo/feat/scripts-app-select-tool
Scripts: app.selectTool picks a tool
2026-11-30 09:44:47 -08:00
dotCooCoo affd7a8853 Scripts: tracing keeps its source image; image edits roll back on failure
- Moving a tracing's source image out of its tracing throws instead of
  breaking the tracing.
- PlacedItem.file places and checks the linked image under one savepoint,
  so a failed check leaves no linked image behind.
- Retracing restores the selection under the same savepoint as the trace.
- matrix assignment compares the linear part exactly, so a small change
  to the scale or rotation is applied.
- ExportOptionsPNG24 and ExportOptionsJPEG accept white, their default
  matteColor; another color is still an error.
- File objects made without charging their path no longer reserve it.
- Tests: the RTL artboard column check reads the direction from the
  layout, js_path escapes line breaks and quotes, rejected tracing
  options leave the saved document unchanged, and the Image Trace panel
  targets a second image selected with its tracing's source.
- docs/mcp.md: the scale and clipping options apply to PNG24 and JPEG,
  and the source image move error is documented.
2026-11-30 06:16:56 -08:00
dotCooCoo a4bd58e181 Merge main into feat/scripts-text-paint 2026-11-29 22:15:06 -08:00
dotCooCoo 4edede500d Scripts: retracing refuses added artwork; PlacedItem.file resolves linked paths
- Retracing a tracing that holds artwork added after the trace throws before
  the document changes; the retrace limit counts retraces, not mappings.
- Image Trace warnings from trace and option changes go to the console.
- PlacedItem.file resolves the link against the document's folder.
- saveAs picks the format from the name it was given before resolving aliases.
- controlBounds includes handles inside blends, envelopes and other containers.
2026-11-29 19:07:40 -08:00
dotCooCoo 59d7c483c9 New Document: file.new refuses artboard counts that are not whole numbers
file.new rounded artboards, artboardLayout.columns and artboardLayout.rows
before checking them, so a value such as 2.4 or 0.6 was quietly taken as
a different count, and artboards or columns outside 1 to 1000 were
clamped. A direct call now refuses a count that is not a whole number
from 1 to 1000 and opens no document. A step replayed from a journal or
played from the Actions panel keeps the earlier rounding, so saved steps
still play.

The artboardLayout error messages now list rows among the keys.
2026-11-29 16:20:08 -08:00
dotCooCoo 68ac11f96e Merge main into feat/scripts-api-d8b-tracing
# Conflicts:
#	docs/target-app-parity.md
2026-11-29 13:43:24 -08:00
dotCooCoo 92a2056a8b Scripts: page-item setters report a stale item before a bad value
The name, note, hidden, locked, opacity, blendingMode, position, left,
top, width and height setters checked the assigned value before the
item, so a bad value on a removed item reported the value error instead
of "Stale page item". Each setter now looks up its item first.
2026-11-29 10:26:04 -08:00
dotCooCoo fda48b02d0 Merge main into feat/scripts-app-select-tool 2026-11-29 10:25:17 -08:00
dotCooCoo 73499bb62f Merge main into feat/scripts-api-d8b-tracing 2026-11-29 09:57:07 -08:00
dotCooCoo 6ef6df3407 Scripts: round artboard rows as main's New Document test expects, and drop pathItems= from the host table
Cause of the CI failures on 212090fd7a:
- main's dialogs::new_document test a_presets_rows_reach_the_document_create_makes
  sets artboardLayout.rows to 3.6 and expects 4, but this branch refused a
  rows value that was not a whole number. rows now rounds like columns and is
  still refused outside 1 to 1000.
- script_host_vs_scriptcheck listed Document.prototype.pathItems=, the
  setter of main's placeholder. This branch makes pathItems a read-only
  collection, like pageItems, so the row goes.
2026-11-29 06:45:32 -08:00
dotCooCoo dd93247cbf Scripts: tests index page items topmost first and check the preset fallback
Cause of the script_dom and script_dom_paths failures: main's 9872e6b679
("page items report their own members, and lists start with the topmost
object") made pageItems, pathItems and the selection list art topmost first.
The branch's tests still indexed the objects bottom first, so pageItems[1]
and pathItems[0] named the other object. The tests now make the objects in
the order the lists read them, and index them topmost first.

The own-members test asked about rotate, which this branch makes available,
so it now asks about transform, which is not available yet.

The fallback test for addDocument relied on five 1,000,000 pt artboards not
fitting, but a new DocumentPreset puts them in one column. It now unsets the
layout so the built-in preset puts them in one row, and the test fails when
addDocument falls back to the saved preset of the same name.
2026-11-29 04:41:14 -08:00
dotCooCoo 4b7ac69692 Scripts: fix path handles after main's revert count and review findings on path edits
PathItem handles carry the document's revert count, as page item
handles on main do, so path members find their path again.

setEntirePath and the path point setters throw a RangeError for a point
off the canvas. Opening a path whose closing segment is selected keeps
the edit. pathItems.add() leaves new art's paint as it was with New Art
Has Basic Appearance off. addDocument reports settings the built-in
preset refuses. appearance.setNewArt refuses a swatch that is not a
name. Writing one path's points looks only at that path afterwards.
2026-11-29 00:42:20 -08:00
dotCooCoo 743e38ebf6 Scripts: path creation and paint edits replay as run; mixed picks keep their anchors
Scripted shapes record the layer they were drawn on, so replay does not
draw them behind other art or inside an isolated group. Paint edits on
objects keep the new-art defaults on replay, and a solid new-art color
copied to a path keeps its color model. An anchor picked next to a
selected segment stays selected and is listed by selectedPathPoints.
closed set on an empty path applies to its first points. Text fillColor
and strokeColor reflect as Color. Saved file.new steps keep the old row
rounding.
2026-11-29 00:08:13 -08:00
dotCooCoo 0bd735f53d Merge main into feat/scripts-doc-defaults 2026-11-28 23:20:21 -08:00
dotCooCoo 8c642f6ee0 Merge main into feat/scripts-text-paint 2026-11-28 23:07:33 -08:00
dotCooCoo 38dfb800e1 Scripts: leave getIsFileOpen's path comparison as main has it
The change to how getIsFileOpen compares paths on and off Windows goes in its own change, with
its test.
2026-11-28 20:03:45 -08:00
dotCooCoo 8c668944d1 Scripts: name app.undo and app.redo in script.run's help, and leave file.new's messages to their own change
script.run's params text now says what app.undo() and app.redo() do. The artboardLayout messages,
their test and their catalog rows go back to main's text; they belong to file.new rather than to
script history.
2026-11-28 19:51:50 -08:00