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.
Main took its own host class engine, member descriptions for reflect, a
topmost-first pageItems order, revert-aware handles and the New Document
More Settings rework. The merge keeps main's versions of crates/js and
crates/ui-egui/src/dialogs/new_document.rs and moves the branch onto them:
- The layers, groups, compound paths and artboards members carry their
reflect types, and Layer gains toString. The Layer class from layers.rs
replaces main's name-only Layer class.
- Layer, Layers, Artboard and container collection handles carry the
document's revert count, so they go stale after File > Revert as page
items do (a layer then throws "Stale page item", as main's tests expect).
- A layer's or group's pageItems and the GroupItems and CompoundPathItems
collections read names, index and toString as the document's pageItems
does on main.
- controlBounds keeps the branch's rule (anchors and handles of shown
paths, a clip group's clipping path only) and main's zeros for an empty
object.
- areaText and pathText into a layer or group keep main's threading.
- group.clipped is refused on a locked artboard, a compound path keeps
itself when its pathItems are cleared, a path in a locked layer is not
converted into a layer's textFrames, layers.removeAll refuses more rows
than layer.delete takes, and a path moved into a pixel-aligned compound
path is snapped.
- A compound path's pathItems read the typename PageItems, the class they
are, and the TextFrames reflect types name a TextFrame from index and any
type from parent.
Tests whose rule main changed now assert main's rule: pageItems and
textFrames list topmost first, an empty selection is an empty list, a
segment-only path is restored with no anchors (the objects stay selected,
order not asserted), and the members not available yet are swatches, not
views or layers. The branch's tests of its own host class engine in
crates/js were dropped with that engine, since main's implementation
replaces it.
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.
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.
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.