Commit Graph
15 Commits
Author SHA1 Message Date
dotCooCoo bb80534f3e Scripts: path edits honor locked guides, keep selections and stay atomic
PathItem handles carry the document's revert count, as main's page item handles now do, so points and new paths resolve again. resize() scales and changes the stroke weight in one step; paint writes that the command skips throw; Lock Guides refuses edits and removeAll on guide paths; removing a point remaps the selected anchors and segments; new paths go on the active layer while a group is isolated; translate's reflected parameters include changePositions; point tracking revisits only the paths an edit changed. StoryRange lists its fillColor, strokeColor and strokeWeight rows.
2026-11-28 21:37:42 -08:00
dotCooCoo d052deb5ca Merge main into feat/scripts-text-paint
Ports the PathItem, color and text members to main's reflected member form (name, HostMember, MemberInfo), and builds the text paint members on main's TextFrame members.
2026-11-28 18:46:13 -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 1d1c9464cf Merge main into feat/scripts-api-d4-text 2026-11-28 09:12:20 -08:00
dotCooCoo 269024e088 Merge main into feat/scripts-api-d4c-threads-stories
Main gave every class member a reflect type and page item handles a revert
count. The type classes now declare a type for each member, their members
that are not available yet use the unavailable form, TextFrame takes main's
contentVariable, and a text range looks its frame up at the document's
current revert count.

Review fixes:
- A text range length that ends inside a surrogate pair moves its end out
  to the end of the character.
- textFrames.removeAll() refuses type on a locked artboard, as
  pageItems.removeAll() does.
- Joining a story's text across its frames counts toward the run's data
  limit.
- A test shows a script that catches a refused link goes on with the links
  unchanged.
2026-11-28 03:35:11 -08:00
dotCooCoo 2f786096a5 Scripts: path and type edits refuse objects on a locked artboard
- A point edit (anchor, leftDirection, rightDirection, setEntirePath)
  and a paint, stroke or transform change of a path on a locked
  artboard changed it, although its editable property reads false.
  They now throw "Cannot edit PathItem <id>: it is on a locked
  artboard" with nothing changed.
- A text edit, createOutline() or a point/area conversion of type on a
  locked artboard, and areaText() or pathText() given a hidden or
  locked path, now throw "Cannot edit" with nothing changed.
- A point assigned more than 4,000,000 pt from the origin was queued
  without a check and written by a later call. It now throws a range
  error when it is assigned, and the path keeps its points.
2026-11-28 00:54:54 -08:00
dotCooCoo af7bf8bc69 Scripts: textFrames.removeAll() refuses type on a locked artboard
- textFrames.removeAll() deleted a text frame on a locked artboard,
  although its editable property reads false. It now throws "cannot
  delete objects on a locked artboard" with the ids before anything is
  deleted, as pathItems.removeAll() and remove() do.
- add(contents, relativeObject) with a text range of a removed frame
  threw a type error. It now throws "Stale text range"; only an
  argument of another class gets the type error.
- The hidden or locked edit test starts each case from a fresh frame,
  and checks run sizes and justification after each refused edit. The
  add test also checks the text of the frame the script edits.
2026-11-28 00:03:32 -08:00
dotCooCoo 46c3e4bcff Scripts: text and thread tests read frames topmost first, as pageItems lists them 2026-11-26 00:43:17 -08:00
dotCooCoo db059c1be4 Merge main into feat/scripts-api-d4-text 2026-11-26 00:22:24 -08:00
dotCooCoo a22c730c03 Scripts: text edits refuse hidden or locked type, and lists start with the topmost frame
- Text edits (contents, added text, character and paragraph attributes)
  throw Cannot edit with nothing changed when the frame, or a layer or
  group it is in, is hidden or locked.
- Text added after a range that ends inside a character goes after that
  character, and styling an empty range changes nothing.
- Point changes that wait are written before a call that is put back on
  failure, and before the points of another path are read, so a failed
  call does not drop them.
- A new path's id is read exactly from the command's result.
- A saved or Recent preset's rows above 1,000 read as 1,000, so file.new
  takes the preset as file.newPresets lists it.
- textFrames lists type topmost first, as pageItems does on main; the
  tests and docs/mcp.md follow.
2026-11-25 21:21:28 -08:00
dotCooCoo c70eb7fc98 Scripts: character attributes set the fill and stroke of text
A text range and its characterAttributes now have fillColor, strokeColor
and strokeWeight. The colors take and give the same color objects as a
path's fill and stroke; a NoColor takes the paint away, and a color out
of range or of a kind that cannot be assigned yet throws with nothing
changed. strokeWeight is 0 to 1000 points and reads in document points
on scaled type. Setting the value a range already has records no undo
step.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-25 02:53:40 -08:00
dotCooCoo 1a21617e73 Scripts: text ranges take a number as contents, a new length and paragraph attributes
- `contents` on a text frame or text range takes a number and writes it as
  `String(number)` gives it; other values still throw.
- Setting a text range's `length` moves its end and leaves the text as it
  is (https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ lists it as
  read/write). A value that is not a whole number from 0 to the units left
  in the frame throws. Each read of a member that gives a range gives a new
  object, so setting one range's length leaves the others alone.
- A text range has the paragraph attributes as well as the character
  attributes, so `range.justification` reads and sets the paragraphs the
  range touches.
- `characters`, `words` and `paragraphs` have `add(contents,
  relativeObject?, insertionLocation?)` and `addBefore(contents)`
  (https://ai-scripting.docsforadobe.dev/jsobjref/Words/), which insert the
  text as one `text.editRange` and give its range. An added word is kept
  apart from its neighbors by a space and an added paragraph by a
  paragraph break; an empty string runs no command.
- `app.textFonts.getByName` also finds a bundled face by its PostScript
  name.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 11:25:06 -08:00
dotCooCoo b7893282ba Scripts: text ranges made before File > Revert go stale
A text range kept working after file.revert when the file read back held the same text, because the frame's record compared only the text. The record now keeps the document's revert count, and a range made before a revert throws Stale text range.
2026-11-21 17:28:30 -08:00
dotCooCoo c691279f72 Scripts: covered text ranges hold the new text, and text members report stale ranges
- An edit over the end of a text range takes that end to the end of the
  edit's new text, so a range the edit covers holds the new text instead
  of becoming empty.
- The edit record keeps the frame's last 100,000 edits and drops only the
  oldest one past that.
- A numeric leading set on characters with auto leading turns auto
  leading off even when it equals the auto value.
- typename of a stale text range, its collections and attribute objects
  throws Stale text range, as the other members do; TextFrames and
  TextFont check their document and run first.
- createOutline() gives null when the type has nothing to outline,
  instead of throwing after the command removed the frame.
- New frames, outlines and conversions read the new id from the
  command's JSON result, so ids above 2^53 stay exact.
- Character attribute reads look up only the first style of the range.
- The font assignment test picks a font that draws "abc".

Docs: docs/mcp.md, docs/gaps.md (G6).
2026-11-21 14:50:30 -08:00
dotCooCoo 7c9b2a85a2 Scripts: text frames, text ranges and fonts for scripts
document.textFrames lists the document's type and makes point type, area
type and type on a path. A TextFrame gives its kind, contents, text range,
characters, words and paragraphs, outlines, and point and area conversion.
A TextRange gives its contents, offsets, sub-collections, character
attributes (size, leading, tracking, baseline shift, scales, rotation,
underline, strikethrough, font) and paragraph attributes (alignment,
indents, space before and after). app.textFonts lists the fonts.

Offsets count UTF-16 code units. A range follows edits made through these
objects and throws Stale text range after the frame's text changes
another way. Each change runs an existing text command inside the run's
transaction, and a value a range already has runs no command.
2026-11-21 13:55:18 -08:00