Commit Graph
32 Commits
Author SHA1 Message Date
dotCooCoo 44c89a7912 Merge main into feat/scripts-api-d4b-text-styles 2026-11-28 18:11:24 -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 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 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 e75b26cffc Merge main into feat/scripts-reflection 2026-11-27 23:38:58 -08:00
dotCooCoo f56fcd99f6 Merge main into feat/scripts-reflection 2026-11-27 22:13:50 -08:00
dotCooCoo 13c44353cf Merge main into feat/scripts-api-d4b-text-styles 2026-11-27 22:13:49 -08:00
dotCooCoo fc48b42f71 Merge main into feat/scripts-api-d4c-threads-stories
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/src/tests.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/mcp.md
#	docs/roadmap.md
#	docs/target-app-parity.md
2026-11-27 22:12:29 -08:00
dotCooCoo d7425b47d3 Merge main into feat/scripts-api-d4-text
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/src/tests.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-27 21:57:48 -08:00
dotCooCoo c97b5eac1e Merge main into feat/scripts-api-d7a-variables 2026-11-27 21:57:44 -08:00
dotCooCoo 27c3f8cb29 Scripts: variables follow the topmost-first page item order and the gate's linked-file argument 2026-11-26 00:44:53 -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 e4992df1ef Merge feat/scripts-api-d4-text into feat/scripts-api-d4c-threads-stories 2026-11-26 00:06:20 -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 9c636b9036 Scripts: a character style applied to an empty frame styles text set later
CharacterStyle.applyTo returned early on any empty range, so on an empty
text frame it never reached charStyle.apply, which restyles the stored
runs of empty text. It now passes an empty frame through and keeps the
no-op only for an empty range inside text.
2026-11-22 03:42:21 -08:00
dotCooCoo 8e23d74985 Scripts: textFrames.removeAll() refuses type on a locked artboard
textFrames.removeAll() now stops with the same error as pageItems.removeAll()
and PageItem.remove() when a type object sits on a locked artboard, and
deletes nothing.
2026-11-22 03:42:20 -08:00
dotCooCoo 997375be0d Scripts: a batch keeps one copy of the style lists for its style objects
While a script runs a `command.batch`, the session kept the style lists
of every step that changed them, so each such step also made the next
edit copy the whole list. The session now keeps one copy of each open
document's lists, as the last step left them, and records the names of
the styles a step removed or renamed and the documents a step reverted.
The style objects check those names, so a style that a batch removes and
makes again, or renames and names back, is still a different style.
2026-11-21 22:27:14 -08:00
dotCooCoo a5690d2d35 Scripts: stories of one thread share their text index, and a deleted story's missing members say Stale story
Stories read from different frames of one thread share one index of the
story's text while the document is unchanged, instead of each keeping its
own copy. A frame listed in two threads shares only with a story whose
frames match. Story.lines, insertionPoints, textRanges and textSelection
check the story first, so a story whose frame was deleted throws Stale
story.

The cross-document baseFrame test passes a rectangle of the other document
and checks the error and that the rectangle stays a path. docs/mcp.md no
longer says baseFrame and postFix throw, the text-frame entry in
docs/target-app-parity.md no longer lists stories and threading as missing,
and the M13 row in docs/roadmap.md lists text frames and stories.
2026-11-21 22:08:05 -08:00
dotCooCoo c7671c615b Scripts: style objects see a style a batch removes and adds again
- A style object goes stale when the steps of one `command.batch` remove
  its style and add another under the same name, as it does when separate
  `vc.run` calls do. The session notes each batch step's style lists while
  a script runs, and the style objects check each of them.
- `add(name)` with all 4,096 style slots of the run taken throws before it
  adds the style; with one slot left it adds it.
- `typename` of a removed style's `characterAttributes` or
  `paragraphAttributes` throws `Stale style`, as its other members do.
- The style load commands refuse `data` over 64 MB without copying it.
- docs/mcp.md states the 64 MB limit for `data` and decoded `dataBase64`;
  docs/gaps.md G6 and the docs/roadmap.md M13 row list the script text
  and style members.
2026-11-21 21:02:47 -08:00
dotCooCoo d82fe4e8d9 Scripts: nextFrame, previousFrame, story and document.stories for threaded type
Text frames get nextFrame, previousFrame and story, and documents get stories, a
Stories collection with one story for each thread and each type object in no
thread. Assigning nextFrame or previousFrame links the last frame of one story
to the first frame of another, and null breaks the link with each frame keeping
its text; loops, links to the frame itself or into the middle of a story, point
type, frames of another document and hidden or locked frames are refused with
nothing changed. A story of two or more frames reads and writes its text across
its frames in UTF-16 units, and areaText and pathText take baseFrame and
postFix to thread the new frame to an existing one.

The new command text.thread.setNeighbor {id, side, neighbor} links or breaks
by id without a selection, for MCP, the CLI and vc.run.
2026-11-21 18:54:45 -08:00
dotCooCoo de11e1e755 Scripts: style objects made before File > Revert go stale
A style object kept working after file.revert when the file read back held a style with the same name. Each style object now keeps the document's revert count, as text ranges do, and one made before a revert throws Stale style. The range style lists follow the per-paragraph entries of the text model, and the host name table lists the style classes.
2026-11-21 18:47:00 -08:00
dotCooCoo a2063cea75 Scripts: a style change that is put back keeps its style object
A removal or rename whose result cannot reach the script is put back,
and style objects now follow a command only once it is kept. A failed
atomic object-model call puts style objects back with the documents.
2026-11-21 18:10:38 -08:00
dotCooCoo 69448d0c23 Scripts: character and paragraph styles for scripts
document.characterStyles and document.paragraphStyles list a document's
styles, the Normal style first, and add, find and remove them. Each
CharacterStyle and ParagraphStyle has a name, its attributes, applyTo
with clearingOverrides, and remove; setting an attribute redefines the
style through charStyle.setAttrs or paraStyle.setAttrs. A text range's
characterStyles and paragraphStyles list the styles its text is in.

Style names are trimmed and must have 1 to 256 characters and no
control characters, one run names at most 4,096 styles, and a style
object throws Stale style once its style is removed or renamed by a
command. ParagraphStyle.characterAttributes is not available yet.

charStyle.load, paraStyle.load and textStyle.loadAll refuse a file
larger than 64 MB without reading it in full.
2026-11-21 18:10:34 -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
dotCooCoo bb1da3771d Scripts: tags on page items and documents
PageItem.tags and Document.tags give scripts the Tags and Tag objects
the scripting reference describes: name and value pairs on a page item,
read, added, renamed and deleted through the new object.tags,
object.tag.add, object.tag.set, object.tag.remove and
object.tag.removeAll commands, each one undo step. The native file keeps
the tags and their ids. On opening, each object keeps its first 64 tags
whose name and value are at most 65,536 bytes, and a tag whose id is
missing, out of range or repeated gets a new one. A deleted tag's id is
not given out again, so a script's Tag for it throws "Stale tag".

The undo history's memory estimate now counts the text an object's
attributes hold (note, URL, data, events, classes, foreign attributes
and tags).
2026-11-21 12:59:03 -08:00
dotCooCoo 6db0f6c1ad Scripts: visibility variables on embedded images, data sets kept after a no-op import
- variable.setBinding refuses an embedded image only for an image variable,
  so a script can bind an embedded image's visibility.
- A Dataset object stays usable after dataset.import, variable.loadLibrary
  or variable.import leaves the document's data sets as they were, or the
  import is put back; it goes stale only when the data sets change.
- script.check reports a document's exportVariables as filesWritten and
  file.write, and the script host test lists the variable and data set
  names the host adds.

Docs: docs/mcp.md.
2026-11-21 10:15:47 -08:00
dotCooCoo 90752660ad Scripts: documents give scripts their variables, data sets and variable libraries
A script's Document has variables, dataSets, activeDataset, variablesLocked,
importVariables(file) and exportVariables(file), with the Variables,
Variable, Datasets and Dataset classes and the VariableKind enumeration.
Every page item has visibilityVariable, and type, placed and raster images
and graphs have contentVariable. Each change runs a variable.* or dataset.*
command and joins the run's undo step; a value that changes nothing runs no
command.

- variable.setBinding binds one object's visibility or content slot to one
  variable, or to none, in one undo step.
- dataset.update takes a name, to update a data set that is not the active
  one without switching to it.
- A File crosses to the host as its path under a hidden key, and a plain
  object that carries the key is refused. importVariables and
  exportVariables check the path against what the script's own File
  objects may read or write; the open documents' files do not count.

Docs: docs/mcp.md, docs/target-app-parity.md, docs/gaps.md (G6).
2026-11-21 09:18:50 -08:00