Commit Graph
13 Commits
Author SHA1 Message Date
dotCooCoo f9b0cc88ba Merge main into feat/scripts-scriptui-palettes
# Conflicts:
#	crates/scriptcheck/src/lib.rs
#	docs/mcp.md
2026-11-25 11:30:47 -08:00
dotCooCoo 08638f5859 Merge feat/scripts-scriptui-dialogs into feat/scripts-scriptui-palettes 2026-11-25 11:30:03 -08:00
dotCooCoo 8b05d98951 Scripts: every script reads E4X and has the XML objects
The script host ran its realm with E4X off, so XML literals were syntax
errors and XML, XMLList, Namespace, QName, isXMLName and
setDefaultXMLNamespace were missing from every script, although
vectorcraft-js has them. script.run and File › Scripts now turn E4X on
for .js and .jsx files, script text, #include files, $.evalFile, eval
and Function, and for a #targetengine engine.

script.check lists the e4x and xml features under the language need
instead of hostOnly, since VectorCraft runs them.
2026-11-25 04:23:32 -08:00
dotCooCoo 69d00d5fe1 Merge main into feat/scripts-scriptui-dialogs 2026-11-24 17:20:43 -08:00
dotCooCoo 73394611d1 Scripts: ScriptUI windows, groups and panels have update()
Window.update() was missing, so a palette handler that moved a progress
bar and called update() ended with an error. The window-object reference
describes update() as redrawing the window and taking the person's
waiting events, so that a Cancel button can stop a long loop
(https://extendscript.docsforadobe.dev/user-interface-tools/window-object/).

- update() on a shown palette, or on a group or panel in it, runs the
  handlers of the clicks, changes and closes that wait for the palettes
  of the run's engine, oldest first, so a loop that calls update() sees
  a Cancel button's onClick. Those events do not get runs of their own.
- In the app, an update() in the script's own code then pauses the run
  so the app draws the palette, at most once every 16 ms of the run's
  time (VectorCraft's own interval). Only an update() that pauses gives
  the host the palette's controls, so a loop of many update() calls does
  not use up the run's host-call or bridge limits. An update() in a
  handler, a callback of a built-in function, a getter or a conversion,
  and any update() on the web, does not pause the run.
- update() on the showing dialog, or a group or panel in it, runs
  without an error; the dialog shows a handler's changes when the
  handler returns. On a window that is not showing it throws an Error,
  and on a control that is not a container a TypeError. Whether a
  palette is showing comes from show() and hide(), not from its visible
  property.
- docs/mcp.md and the progress-doc line describe update().
2026-11-24 11:46:45 -08:00
.CooCoo 5f35daad7b Scripts: File and Folder give their localizedName (#9185) 2026-11-25 00:54:37 +07:00
dotCooCoo a0e2aa6c19 Merge main into feat/scripts-scriptui-dialogs 2026-11-24 09:22:14 -08:00
dotCooCoo 29153af625 Scripts: ScriptUI controls take size objects, event listeners, list find and remove, and Window.alert
- Every element starts with preferredSize, size, minimumSize and
  maximumSize objects whose width and height are -1, so a script can
  set one side, as in preferredSize.width = 100. A positive side of
  size takes the place of preferredSize's, and the layout keeps a
  control within its minimum and maximum.
- Controls and the dialog take addEventListener and
  removeEventListener for click, change, changing and show. Handlers
  run in the capture phase on the containers, on the control after its
  onClick, onChange or onChanging, then on the containers again until
  one calls stopPropagation(). A button with a click listener no longer
  closes the dialog by itself.
- Window.alert, Window.confirm and Window.prompt open the same dialogs
  as alert, confirm and prompt.
- A list has find(text) and remove(what), and takes its items in
  properties.items; a container has remove(what).
- A group takes its creation properties as the third argument of add(),
  and orientation, alignChildren, spacing, margins and alignment given
  there are its first values.
- Setting a radio button's value to true turns off the radio buttons
  added next to it in its container, and notify("onClick") turns a
  radio button on and a check box over before onClick runs.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 11:35:40 -08:00
dotCooCoo 26e0cef48d Scripts: ScriptUI palettes stay open after the run and run their handlers in line
new Window("palette") in a script with a named #targetengine shows a
palette that stays open beside the documents after the run ends.
show() runs onShow and returns at once; hide(), show() and close()
work as for a dialog, and close() and the close box run onClose.

Each click, change or close on a palette runs its handler as a run of
its own in the palette's engine, with its own report and undo step.
While another run goes on, the event waits and runs after it, oldest
first; a newer event for the same control or close replaces a waiting
one. An error in a handler ends that run and leaves the palette open.
A palette in a script without #targetengine, or with #targetengine
main, throws an Error that asks for a #targetengine line.

Palettes close when their engine is dropped or ends with an internal
error, and when the session ends. A session keeps at most 16 palettes
and 64 waiting events.

script.palettes lists the palettes and their controls, and
script.palette.event gives a palette a click, change or close. The
script checker lists palettes under dialogs instead of hostOnly.
2026-11-22 11:19:11 -08:00
dotCooCoo c3ea4e2f9c Scripts: build and show ScriptUI dialogs with new Window("dialog")
A script can now build a modal dialog with new Window("dialog", title)
and add() groups, panels, static text, edit fields, buttons, check
boxes, radio buttons, drop-down lists, list boxes, sliders and progress
bars. The engine checks the description and lays it out without
recursion, within VectorCraft's own limits (512 controls 16 deep, 1024
list items, 16 KiB a text, sizes clamped to 8192 px). Other control
types, palettes and resource strings throw that they are not available
yet.

- show() waits like alert, runs onClick, onChanging, onChange, onShow
  and onClose in the run's fuel, and returns close(result)'s result, 1
  for the default button or 2 for the cancel button, or 0 for the close
  box. A show() inside a handler throws.
- In the app the dialog draws the controls where the engine placed
  them, gives text still typed in a field before a click or a close,
  and keeps its state while a handler runs. Enter clicks the default
  button, Escape the cancel button, and Stop ends the run and puts the
  documents back.
- A run over MCP or the command line takes a window answer: the steps
  of one show(), each a click, a change or a close.
- The report lists each dialog with its controls, events and result;
  vc.api.has("scriptui") is true.

Docs: docs/mcp.md (script.run), docs/target-app-parity.md.
2026-11-22 00:14:17 -08:00
dotCooCoo 1ab09c8978 Scripts: UnitValue measurements convert and calculate with their units
Scripts get the global UnitValue constructor: a number with one of the
length units (inches, feet, yards, miles, millimeters, centimeters,
meters, kilometers, points, picas, traditional points and picas,
ciceros), pixels or percent. as() and convert() give or change the
unit, baseUnit sets what one pixel and 100% measure, and the arithmetic,
comparison and unary operators calculate with the object's number. With
two objects the right one is converted to the left one's unit.

Conversions go through exact ratios to the inch, so 1 in is exactly
72 pt. An unknown unit or text makes an invalid object; converting it or
using it with an operator, a result that is not finite and a comparison
with a number that is not finite throw a RangeError.

A realm without UnitValue keeps the standard operators. docs/mcp.md
describes the class.
2026-11-21 19:56:57 -08:00
dotCooCoo b2e7784160 Docs: progress line for the script checker's File setters and host test
docs/target-app-parity.md gets a line for the file.write report on a
File object's length, hidden and readonly and for the test that lists
every name the script host adds, with the tests that cover them. The
test's comment on vc no longer names another app.
2026-11-20 19:05:54 -08:00
dotCooCoo 417ed94431 Script checker: setting a File's length, hidden or readonly counts as a file write
Setting a File object's length truncates or pads the file, and setting
readonly or hidden changes it, but script.check reported no outside
category for those assignments. It now reports file.write and
filesWritten for them: plain and compound assignment, ++ and -- before
or after, and the property name as a string literal in brackets.

A new integration test lists every global and member the script host
adds to the JavaScript engine (the own properties of the global object,
of each object or function it holds and of each function's prototype,
compared with a plain engine) and fails when one has no row. Each name
that reaches outside the document has a probe script, and the test
checks that script.check gives it the expected outside id. vc is listed
as not checked: script.check reads scripts written for the reference
app's scripting, and what vc.run does depends on the command. The test
also checks that the checker lists every preprocessor directive the
host reads, through the new DirectiveName::ALL.

File object properties:
https://extendscript.docsforadobe.dev/file-system-access/file-object/
2026-11-20 18:36:13 -08:00