Commit Graph
9 Commits
Author SHA1 Message Date
dotCooCoo 232b9e1597 Merge main into feat/scripts-show-color-picker 2026-12-04 01:13:39 -08:00
dotCooCoo 77cc99b2bd Scripts: palette refreshes run their getters' promise jobs, and events keep their place
- A prompt, confirm or alert answer that cannot reach the script is listed
  in the report with the answer "error" instead of the answer given.
- After a named-engine run, point changes that a palette getter makes
  while the palettes are refreshed are written before the run ends.
- The promise jobs a palette getter queues during that refresh run in the
  same fuel, the host gets the controls once more after them, and their
  unhandled rejections are part of the run's report. An update() they
  call takes no waiting event.
- A waiting text change merges with a newer one only when no click or
  close of its palette waits after it.
- With nobody to ask, an open edit that cannot be finished before the run
  ends script.palette.event with that error, and the event does not wait.
- A click whose onClick getter hid the palette runs no handler, and a list
  choice whose list a text getter removed, or whose earlier item text a
  later getter changed, is refused.
- add() and remove() on a shown palette return their result when a getter
  throws while the host's copy is updated; the host gets the controls at
  the next update or when the run ends.
- In the app, a palette event whose run cannot begin shows its own error
  instead of an earlier stopped run's message.
- The overview comments, docs/mcp.md and the progress line describe the
  update() handling, the merge rule, onClose returning false and the
  named engine a palette needs.
2026-11-30 15:05:36 -08:00
dotCooCoo 8107acadf2 Scripts: a color picker answer refuses out-of-range arrays and objects
An answer given as an array or object, such as [1.00000001, 0, 0] or
{c: 100.000001, m: 0, y: 0, k: 0}, was narrowed to f32 before its range
check, so a component just past a limit rounded onto it and passed. Its
components are now checked as written, in f64 and on the scale
paint.setFill reads them in, as color keys already were. Boundary values
are still accepted.

docs/mcp.md and script.run's params text list "stop" as a colorPicker
answer, which a run stopped at the picker records.
2026-11-30 10:50:35 -08:00
dotCooCoo bdb753eef9 Scripts: a color picker answer refuses out-of-range color keys
A headless colorPicker answer written as a color key, such as
"rgb 300 0 0" or "rgb 255.000001 0 0", was clamped into range and
accepted, while the same color as an array or object was refused. The
key's components are now checked as written, in f64, before the key is
read. The near-white gray note in docs/mcp.md and colors.rs now says
which paint keeps its color when the read-back gray is assigned.
2026-11-29 21:40:40 -08:00
dotCooCoo e4d1dabf9e Scripts: path point reads scale with subpaths; the script color picker keeps its color
- app.showColorPicker opens on the script's color even when an earlier
  picker left Only Web Colors on, and a changed RGB pick takes the model
  of the run's own active document, which may be one the script made.
- Point reads and edits look a point up in a cached layout of where each
  subpath's points start, so a loop over a path with many subpaths no
  longer counts every subpath for each point. selectedPathPoints walks the
  selected anchors of a partial selection instead of every point.
- PathPoint.selected writes the waiting point changes whenever any of
  them added or removed points of the path.
- The path creators read the new path's id from the command's own result,
  so an id above 2^53 stays exact.
- typename of a stale PathPoint or PathPoints throws as the other members
  do.
- pageItems, pathItems and documents look up a key that reads as a number
  but is not an index, such as "-1", by name first.
- artboardLayout keeps the columns the rows gave the current artboards
  when a new layout replaces the rows without its own columns.
- Docs: pathItems.add() and the shape creators follow isolation; reading
  another path's points does not write the waiting changes; a gray within
  about 1e-14 % of white reads as 100; assigning documents throws in
  strict mode; when showColorPicker keeps the given color's model.
2026-11-28 01:31:48 -08:00
dotCooCoo 58292d605a Scripts: app.showColorPicker asks for a color
app.showColorPicker(color) opens the Color Picker on an RGBColor,
CMYKColor, GrayColor or LabColor and returns the color picked for OK.
Cancel, and OK with the color unchanged, return a new object of the
color the script gave. Anything else throws a TypeError.

- In the app the run waits at the picker, which previews nothing on
  the selection. Stop and quitting end the run as at the other script
  dialogs and close the picker.
- A run with nobody to ask takes {kind: "colorPicker", value: color |
  null} from answers. The report lists the picker with the color it
  opened on and the answer.
- script.run's params text, docs/mcp.md and the Scripts line in
  docs/target-app-parity.md describe it.
2026-11-25 02:23:19 -08:00
dotCooCoo efd57a4a5d i18n: unused-answers and Liquify skip messages translate for one item too
The script error for answers left in `answers` and Liquify's warning about
objects under the brush that it left as they were built their singular by
adding an empty suffix, so no catalog template could match the singular
form, and neither message had a catalog row for either count.

- Both messages are now built from complete singular and plural English
  sentences; `it was` and `they were` are part of the sentence. The
  English the commands return does not change.
- Every complete-message catalog has an `@msgplural` row for each, with
  the language's own count forms. The tool name and the list of kinds
  stay as written.
2026-11-13 20:31:22 -08:00
dotCooCoo 8bd437687a Scripts: a canceled request stops a sleeping or waiting run at its next slice
script_pump read vectorcraft_doc::cancel only after the guard that keeps
a run waiting, so a run asleep in $.sleep went on waiting until its wake
time (up to 1,000 ms), and a run waiting at a dialog or for approval to
grow waited until someone answered. The check now runs before that
guard, after the dialog-failure check, so a canceled request ends the
run at the next slice and every document goes back.
2026-11-11 20:01:25 -08:00
dotCooCoo df0373aa26 Scripts: alert, confirm and prompt open dialogs with Stop, and headless runs take their answers from script.run
alert(message[, title, errorIcon]), confirm(message[, noAsDflt, title])
and prompt(message, preset[, title]) are globals in a script run. In the
app the run waits at the call for the person's answer, spends no
instructions while it waits, and every dialog has Stop, which ends the
run and puts every document back. A run over MCP or the command line
takes its answers in order from script.run's answers, a list of
{kind, value} records; a missing, mismatched or unused answer ends the
run. The report lists each dialog with its answer in dialogs, with
dialogCount and dialogsTruncated.

The interpreter gains a host call that waits at the call for its
result, from the script's own code only; a dialog called in a callback
of a built-in, a getter or a conversion throws in the app.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-10 22:14:01 -08:00