The error for a styles file over the load limit reads "the file is larger
than 64 MB". Most complete catalogs translate it through their
`the file is larger than {_1} MB` row; ca, el, fi, id and vi have no such
row, so each gets an exact row next to its 1 MB one. A test checks the
message in every complete-message language.
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.
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.
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.
- 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.
A preset made with file.new's rows under gridByColumn shows the column
count those rows give the current number of artboards. Changing the
Layout field removed the rows and kept the preset's stored columns, so
Create laid out a different number of columns than the dialog showed.
The layout change now writes the shown count into columns, for rows
stored as integers or floats. Under gridByRow the dialog shows the
stored columns and file.new rejects rows, so a layout change from it
keeps the stored columns, as it does for rows file.new would reject.
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.
PageItem.remove() and PageItems.removeAll() checked only whether the
object and its layers and groups were shown and unlocked, then passed the
ids to edit.clear, which deletes named objects without checking artboard
locks. Both now throw "cannot delete objects on a locked artboard" with
the object ids and delete nothing, as art on a locked artboard is not
editable elsewhere in the document.
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.
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.
The dialog read artboardLayout's rows and columns as whole numbers only,
so a value stored as a float (4.0 from ui.dialog.set) fell back to the
stored columns while file.new made the grid from it. The dialog now reads
both as file.new does: a number of 1 or more, rounded and kept to the
artboard limit.
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.
Setting selected to true or false runs select.add or select.toggle for that one object, so the
other objects keep their direct-selected anchors and segments and the key object. Before, it
replaced the selection with whole objects.
- 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).
- new DocumentPreset() now makes an object of the DocumentPreset class whose settings the run
keeps, so addDocument refuses a plain object, one with a typename of DocumentPreset included,
with a TypeError naming presetSettings.
- When file.new reports a profileError, addDocument throws an error that names the profile and
the reason, and the document made with the defaults is put back.
- A script's file.new reads the New Document profile file in the app's own profiles folder;
the automation roots in force still apply. Before, the script's file gate refused the folder,
so a scripted addDocument never used an edited profile.
Docs: docs/mcp.md.
docs/mcp.md said a range made before the frame's last 100,000 edits goes stale. The record keeps up to 100,000 edits and, when it grows past that, drops the older half, so a range goes stale only when it was made before the newest dropped edit (text.rs MAX_EDITS and record).
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.
* svg: cut over CSS transform, CSS string quoting, and symbol unit basis to craft-svg (#789)
* build: repin craft-svg to merged craft-libs main (d20a8248)
remove() on an object that is hidden or locked, sits in a hidden or locked layer or group, or is a group holding such an object now throws and deletes nothing, the same rule pageItems.removeAll() applies. docs/mcp.md states both rules and that width and height scale along the page's axes.
A rotated rectangle given a width and then a height through the scripting object model reads back the values set, its geometric bounds have that size, and other objects stay as they were. The resize doc comment names the page's axes.
artboardSpacing is refused above 100,000 points, the limit file.new
applies, so a value file.new would refuse throws a RangeError that names
artboardSpacing.
When an edit puts the selection back, the Layers panel target, symbol part,
Objects on Path member, ruler guide and key object commands fall back or
skip only when the command refuses with an ordinary error. An internal
failure or a request to stop now ends the run instead of being treated as
a refusal.
The host name test now has rows for app, the document model classes and the enumerations the script host adds. zOrder on a path inside a compound path throws an error and leaves the document unchanged, as duplicate does.
- An edit a script makes puts back a Layers panel target, an object
chosen inside a dynamic symbol instance and an object chosen in an
Objects on Path group, each with its own selection command.
- Assigning a document's selection selects a symbol instance or an
Objects on Path group as a whole when one of its objects was chosen.
- file.newPresets lists a grid by column's rows as set, also when there
are fewer artboards than rows, and New Document's Columns shows the
columns those rows give the current number of artboards.
- docs/roadmap.md's M13 row names the script object model that is
available.
- duplicate() runs Edit > Duplicate, the place and the selection
restore under one savepoint, so a refused place leaves the documents,
the selection and the undo history as they were. It reads the copy's
id from the command's own result, so ids above 2^53 return the copy.
A path inside a compound path throws an error instead of copying the
whole compound path.
- An edit restores a mixed selection (direct-selected anchors and whole
objects) in its original order with one select.anchorsMany.
- Assigning the selection clears a Layers panel target.
- A call on an inactive document switches back even when the selection
restore fails.
- documents.add with a grid by column passes the row count to file.new,
which takes a new artboardLayout.rows key: 5 artboards in 4 rows give
columns of 4 and 1. A preset keeps the rows until columns without
rows, or another layout, is given, and New Document drops them when
Columns or the layout changes.
- A held page item stays the same object when its class changes in the
same family (a placed image that is embedded becomes a RasterItem).
- A waiting class member's answer is read as a class instance, and a
class constructor called with new cannot wait.
Docs: docs/mcp.md (DocumentPreset, duplicate, file.new rows), docs/gaps.md
(G6).
Scripts get an app object with its documents, the active document and its
selection, and the page items of a document, read and edited through
commands so each edit is one undo step and is journaled. Host classes in
the JavaScript engine give each document or item one object while a script
holds it, answer `in` and indexed reads, and throw on stale objects and on
members that are not available yet.
Docs: docs/mcp.md, docs/target-app-parity.md.