Commit Graph
397 Commits
Author SHA1 Message Date
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 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 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 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 8a5f206e3c Merge main into feat/scripts-api-d6-save-export-open 2026-11-30 10:55:42 -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 ed0859d0d0 Scripts: kept-default option enumerations and refusal of non-UTF-8 real paths
The enumerations whose default member an option keeps (OutputFlattening,
CompressionQuality, the PDF color, compression, mark and security enums,
and the SVG encoding, DTD, CSS and font enums) are now defined, so a
script that sets an option to its default no longer throws a
ReferenceError; another member still throws as not available yet.

saveAs, exportFile, app.open and close with SAVECHANGES refuse a path
whose real file name is not valid UTF-8 instead of writing to or opening
a file named with a lossy copy of it.
2026-11-30 07:51:17 -08:00
dotCooCoo f4c911d4d3 Scripts: open options with an importer, null export options and close checks for files that keep every artboard
- document.open refuses page, cropTo, pages and crop when a named importer reads the file (linkPages
  still uses the built-in reader).
- exportFile with explicit null options throws a TypeError for GIF, PNG8 and TIFF too.
- close(SaveOptions.SAVECHANGES) saves a modern .ai or .ait file and an SVG file with Preserve
  Editing whatever range was remembered; a range the save refuses still refuses.
- The script checker keeps a try statement's catch and finally, and an else after a nested
  do-while, inside the loop body; a line break after a label does not start a new statement; a
  this assignment in a function that hides a global clears the global's saved methods; and
  holder.d['saveAs'] = ... no longer counts as a write to d.
- docs/mcp.md describes which files keep every artboard on close.
2026-11-30 03:36:01 -08:00
dotCooCoo 82d4ec4336 Scripts: explicit crop boxes, EPS close-with-save and writer receivers checked per call
- document.open with an explicit PDFCROPBOX crop opens on the crop box
  of a file with editing data; the default keeps the trim box and bleed.
- Closing with save changes keeps an EPS document's artboard range, since
  the EPS file holds the whole document.
- The script checker treats a writer receiver captured from an outer
  scope as able to change before each call, and finds the loop that holds
  a call with a binary search instead of a scan of every loop.
2026-11-29 19:01:56 -08:00
dotCooCoo f99ef023ad Scripts: close checks the artboards the saved file keeps; saves report warnings
Document.close(SaveOptions.SAVECHANGES) now judges artboard loss by the
file the save writes. A PDF last saved with useArtboards: false is
refused, since it holds one page of the art's bounds. A native or .ai
file saved with separateArtboards is saved and closed whatever its range
names, since the range picks only the separate files; a version 7 .ai
file keeps the range check.

Document.saveAs, Document.exportFile, app.open and the save that
close(SaveOptions.SAVECHANGES) runs write each warning of their command
to the console after the method's name (for example "saveAs: SVG keeps 1
of the document's 2 artboards ...").

Script Check reports a file write for a saveAs or exportFile call on the
script's own object when the variable is assigned in a loop around the
call, since a later iteration may run the call on a document. Loop bodies
without braces follow if, else and line breaks, and a variable of the
same name that a function declares is kept apart.

A test shows that a waiting point change counts as unsaved for
Document.saved and close().
2026-11-29 16:49:37 -08:00
dotCooCoo b1e9a4cbb3 Merge main into feat/scripts-api-d6-save-export-open
main's Document member list held saveAs and close as members that are not
available yet; this branch's save_open members implement them, so the
merge drops them from that list and keeps main's other entries. The
script host test lists take main's members together with this branch's
open, userInteractionLevel, fullName, path, saved and option classes,
and the heap accounting keeps main's ModuleNamespace arm beside the
FsEntry string arm.
2026-11-29 14:13:21 -08:00
.CooCoo 52de8120d3 Merge pull request #10105 from dotCooCoo/fix/script-dom-path-edits
Scripts: point removals keep the selection, new-art defaults and batching right
2026-11-29 10:58:53 -08:00
.CooCoo 8b96a72de4 Merge pull request #10104 from dotCooCoo/fix/script-name-setter-stale-first
Scripts: page-item setters report a stale item before a bad value
2026-11-29 10:51:52 -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 87b5aef639 Scripts: point removals keep the selection, defaults and batching right
Follow-up to #9288.

- Removing the last anchor of a closed path with its closing segment
  selected also deselects the first anchor, the segment's other end.
- Removing a point puts back new art's paint, so a default stroke width
  a script set still applies to the next path it draws.
- A removal that leaves the direct selection as it was waits with the
  other point changes, unless every remaining anchor is now selected,
  the selection refers to points that are gone, or the path is in an
  Objects on Path group.
- Reading the points of a path first writes the waiting point changes
  of another path in the same Objects on Path group.
- Writing a path in an Objects on Path group checks the other tracked
  paths in the outermost such group, so their PathPoint handles go stale
  when the group moves them, even after an undo.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-29 10:24:53 -08:00
ruchirguitar a4659724f6 Merge main into feat/spell-check
Cargo.toml: #10049 moved craft-libs to 186a229c; the font store crates this
branch adds move with it, so every craft-libs crate stays at one rev.
2026-11-29 22:41:45 +05:30
dotCooCoo 7a71837dea Scripts: keep new-art defaults and direct selections through path edits
- PathPoint.remove() renumbers the direct-selected anchors and segments
  after the removed point, and drops the removed anchor and the selected
  segments it ended, through selection commands after the points are
  written. A removed anchor no longer stays selected, and the same index
  no longer selects a different point.
- pathItems.add() reads new art's paint after the target document is
  active, so a path added to a document in the back keeps the stroke
  that document's selection gives new art.
- Paths a script draws put new art's paint back afterwards, so a
  defaultStrokeWidth the script set applies to every path it draws, not
  only the first.
- appearance.setNewArt refuses a fill or stroke paint with a setting a
  paint does not take, such as opacity, instead of applying the rest.
2026-11-29 05:51:46 -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 0bd735f53d Merge main into feat/scripts-doc-defaults 2026-11-28 23:20:21 -08:00
dotCooCoo 043650d794 Scripts: tighten save, open and close edge cases
- saveAs picks the encoder from the requested name, so a link to a file of
  another format writes the format the name asks for.
- fullName, path and close(SaveOptions.SAVECHANGES) resolve a relative saved
  path against the working directory.
- close(SAVECHANGES) accepts an artboard range that covers every artboard and
  keeps the document open when the save would drop artboards.
- app.open keeps the requested file name, rejects a file over 128 MiB before
  reading it, applies the requested color space to plug-in imports, and
  rejects PDF options for files that are not PDF content; null PDF options
  keep their defaults.
- Explicit null options throw; assigning the current Document.saved value
  runs no command; Document.path reflects as Folder or string.
- An implicit multi-file save names no refused path in its error.
- The script checker counts SAVECHANGES only on SaveOptions and keeps write
  warnings for receivers that evaluated code can rebind.
2026-11-28 21:21:56 -08:00
dotCooCoo cb75bb73fc Merge main into feat/scripts-app-undo-redo
# Conflicts:
#	crates/engine/src/cmd/scripts.rs
2026-11-28 20:45:40 -08:00
dotCooCoo cac93ca107 Merge main into feat/js-es2015-modules 2026-11-28 20:44:06 -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 ecf193cc06 Merge main into feat/scripts-app-undo-redo
# Conflicts:
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/target-app-parity.md
2026-11-28 19:47:12 -08:00
dotCooCoo 3e2a615aee Merge main into feat/js-es2015-modules 2026-11-28 19:45:10 -08:00
ruchirguitar 8d3895d491 Merge main into feat/spell-check
Cargo.toml: main moved craft-libs to 610c8679; the font store crates this
branch adds move with it, so every craft-libs crate stays at one rev.
2026-11-29 08:29:24 +05:30
dotCooCoo 0d5850f616 Scripts: build on main's optional item bounds and painting-tool check
main's item_rect now gives no bounds for an empty object, and the
Live Paint Bucket check became tool_paints for the fill and the
stroke. rotate and resize leave a path without bounds unchanged, and
appearance.setNewArt uses the same inheritance test as paint.rs.
2026-11-28 18:41:43 -08:00
dotCooCoo 6112616e13 Merge main into feat/scripts-app-undo-redo 2026-11-28 18:30:41 -08:00
.CooCoo dc2c6ff30f Merge pull request #9061 from dotCooCoo/feat/scripts-api-d4b-text-styles
Scripts: character and paragraph styles for scripts
2026-11-28 18:26:11 -08:00
dotCooCoo d2a14e2ef5 Merge main into feat/scripts-doc-defaults
# Conflicts:
#	crates/engine/src/script/dom.rs
2026-11-28 18:11:57 -08:00
dotCooCoo d471933b0d Merge main into feat/scripts-doc-defaults 2026-11-28 18:11:42 -08:00
dotCooCoo 44c89a7912 Merge main into feat/scripts-api-d4b-text-styles 2026-11-28 18:11:24 -08:00
dotCooCoo eb41460cd5 Merge main into feat/scripts-api-d6-save-export-open
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
2026-11-28 18:11:12 -08:00
dotCooCoo 52c731bb2f Merge main into feat/scripts-api-d6-save-export-open 2026-11-28 18:10:43 -08:00
.CooCoo 0ac2b74614 Merge pull request #9055 from dotCooCoo/feat/scripts-api-d9-do-script
Scripts: app.doScript plays an action of the Actions panel
2026-11-28 17:55:11 -08:00
.CooCoo 1fe4d824c8 Merge pull request #9064 from dotCooCoo/feat/scripts-api-d4c-threads-stories
Scripts: nextFrame, previousFrame, story and document.stories for threaded type
2026-11-28 17:38:38 -08:00
dotCooCoo 1935494805 Merge main into fix/script-collection-numeric-names
# Conflicts:
#	crates/engine/src/tests/script_dom.rs
#	docs/target-app-parity.md
2026-11-28 17:18:25 -08:00
dotCooCoo 4999199bd5 Merge main into feat/scripts-api-d4c-threads-stories
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/src/script/dom/text.rs
#	crates/engine/src/tests.rs
#	crates/engine/src/tests/script_text.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/gaps.md
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-28 17:15:13 -08:00
dotCooCoo 1729de3109 Merge main into feat/scripts-api-d9-do-script 2026-11-28 16:57:36 -08:00
dotCooCoo fbb0f2d5ff Merge main into feat/scripts-api-d4b-text-styles 2026-11-28 16:57:12 -08:00
dotCooCoo 98e51a3811 Merge main into feat/scripts-app-select-tool
# Conflicts:
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
2026-11-28 16:56:44 -08:00
.CooCoo d4b6d7f10d Merge pull request #9050 from dotCooCoo/feat/scripts-api-d4-text
Scripts: text frames, text ranges and fonts for scripts
2026-11-28 16:50:36 -08:00
dotCooCoo 328c6221e1 Merge main into feat/scripts-api-d4b-text-styles 2026-11-28 16:28:02 -08:00
dotCooCoo 31844b57dd Merge feat/scripts-api-d4-text into feat/scripts-api-d4b-text-styles 2026-11-28 16:13:51 -08:00
dotCooCoo e449a91380 Merge main into feat/scripts-app-select-tool
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/src/tests/script_dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-28 14:50:06 -08:00
dotCooCoo 64c985d328 Merge main into feat/scripts-api-d4c-threads-stories
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/target-app-parity.md
2026-11-28 14:36:12 -08:00