mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 05:53:08 -05:00
Merge main into fix/dxf-group-block-reference
The craft-libs pins take main's rev. Until storytold/craft-libs#5381 merges, crates/cad/src/blocks_compat.rs writes the block records, BLOCK definitions and INSERT entities that #5381 adds to the drawing writer.
This commit is contained in:
commit
60cdfc1eb4
83 files changed
+4328
-707
No files matched your search
+17
-17
@@ -119,7 +119,7 @@ the two can still win that race.
|
||||
| `ui.render` | `{path?, scale?, artboard?, data?, traceViews?}` | render an artboard headlessly (PNG with the pixels of `app.export {format: "png", background: "white"}` at the same scale; `artboard`: its 0-based index, default the first; `traceViews: true`: Image Trace objects draw in their View, as on the canvas, instead of their tracing result): written to `path`, else (or with `data: true` as well) sent back as `pngBase64` |
|
||||
| `ui.resize` | `{width?, height?}` | request the window's inner size; omitted or null `width` and `height` default to 1440 and 900. Returns `null` |
|
||||
| `ui.focus` | `{}` | request keyboard focus for the window. Returns `null` |
|
||||
| `app.open` / `app.save` / `app.export` / `app.quit` | `{path, importer?, params?}` / `{path?}` / `{path?, format?, artboard?, range?, scale?, …}` | `app.open` reads every format `document.open` reads (see `document.formats`) and returns its result (`{index, title, format, warnings, …}`; `warnings` say what didn't come in as it was, such as an EPS shown as its preview image and why its PostScript couldn't be read), or null when a dialog asks first or a library loads. The status bar (`ui.inspect` → `ui.status`), after a line about the document's linked files when there is one (Missing linked files below), counts the `warnings` and names the first that says reading the file left something out (the notes that make Save ask before writing over it), else the first; with several, hovering it lists them in that order, as many as fit in the window (at most 30), then how many more. After `app.save`, and `app.export` with a `path`, the status bar counts the reply's `warnings` and names the first, and with several, hovering it lists them in the reply's order (a save's notes start with what the format loses). With `importer` (an importer plug-in's format id, `plugin.<id>`) it runs `file.openWith`: the file opens with that importer, also when a built-in format reads its extension, with the importer's parameters `params` (their defaults when omitted; no dialog asks for them). Without `importer`, `params` go to the importer that opens the file, and a built-in format does not read them. `app.export` encodes through the engine's `document.export` (same options; the document keeps its path) and writes `path` through the host; without `path` it returns `{dataBase64, format, bytes}`, as headless mode does. It refuses a key that no format takes, and an unknown key inside a PDF or EPS option object, before it writes anything (`docs/mcp.md`, Parameter keys). It accepts a key that only another format takes and does not use it: the reply's `warnings` and the status bar name the key ("`quality` was not used: PDF files don't read it"). `app.save` refuses a key that no save format takes, beside the path or in `options`, the same way. `app.quit`, `file.close` and `file.closeAll` first open a `saveChanges` dialog for each modified document (they return `{"pending": "saveChanges"}`): `ui.dialog.confirm` saves, `ui.dialog.set {field: "discard", value: true}` then confirm discards, `ui.dialog.cancel` cancels the whole close or quit |
|
||||
| `app.open` / `app.save` / `app.export` / `app.quit` | `{path, importer?, params?}` / `{path?}` / `{path?, format?, artboard?, range?, scale?, …}` | `app.open` reads every format `document.open` reads (see `document.formats`) and returns its result (`{index, title, format, warnings, …}`; `warnings` say what didn't come in as it was, such as an EPS shown as its preview image and why its PostScript couldn't be read), or null when a dialog asks first or a library loads. The status bar (`ui.inspect` → `ui.status`), after a line about the document's linked files when there is one (Missing linked files below), counts the `warnings` and names the first that says reading the file left something out (the notes that make Save ask before writing over it), else the first; with several, hovering it lists them in that order, as many as fit in the window (at most 30), then how many more. After `app.save`, and `app.export` with a `path`, the status bar counts the reply's `warnings` and names the first, and with several, hovering it lists them in the reply's order (a save's notes start with what the format loses). With `importer` (an importer plug-in's format id, `plugin.<id>`) it runs `file.openWith`: the file opens with that importer, also when a built-in format reads its extension, with the importer's parameters `params` (their defaults when omitted; no dialog asks for them). Without `importer`, `params` go to the importer that opens the file, and a built-in format does not read them. `app.export` encodes through the engine's `document.export` (same options; the document keeps its path) and writes `path` through the host; without `path` it returns `{dataBase64, format, bytes}`, as headless mode does. It refuses a key that no format takes, and an unknown key inside a PDF or EPS option object, before it writes anything (`docs/mcp.md`, Parameter keys). It accepts a key that only another format takes and does not use it: the reply's `warnings` and the status bar name the key ("`quality` was not used: PDF files don't read it"). `app.save` refuses a key that no save format takes, beside the path or in `options`, the same way. `app.quit`, `file.close` and `file.closeAll` first open a `saveChanges` dialog for each modified document (they return `{"pending": "saveChanges"}`): `ui.dialog.confirm` saves, `ui.dialog.set {field: "choice", value: "dontSave"}` then confirm closes the document without saving, `ui.dialog.cancel` cancels the whole close or quit. `choice` takes `save`, `dontSave` or `cancel`, and any other field or value is an error. While more modified documents wait to be asked about, the dialog also has `applyToAll`: `ui.dialog.set {field: "applyToAll", value: true}` before confirm gives the same answer for each of them. `ui.dialog.set {fields: [{field: "choice", value: "dontSave"}], action: "confirm"}` answers the same question in one request, so no other dialog can be answered between the set and the confirm, and `{field: "applyToAll", value: true}` can go in the same `fields` |
|
||||
| `app.export` with `useArtboards` | `{path, useArtboards: true, range? \| artboards?, …}` | Export As: PNG, JPEG and WebP write one file per chosen artboard (default all; SVG does so for a `range`), `<path stem>-<artboard>.<ext>`, and return `{path, files: [path…]}`; a PDF keeps them as pages of `path`. `useArtboards: false` covers the bounds of the visible art. The menu's Export As… is `file.exportAs`: the `exportAs` dialog (`format`, `useArtboards`, `all`, `range`), then a save dialog and the format's options: `pngOptions` / `jpgOptions` / `webpOptions`, `svgOptions`, or `savePdf` for a PDF |
|
||||
| `ui.dialog.*` on `gradientStop` | `{field: "color" \| "opacity" \| "location", value}` | double-clicking a stop on the Gradient tool's annotator opens its popover (fields `index`, `x`, `y`, `tab`); set `color` (hex), `opacity` or `location` (percentages) and `ui.dialog.confirm` to apply them to the selected stop. `gradient.selectStop {index}` picks the stop the annotator, the panels and Delete/←/→ (`ui.key`) act on |
|
||||
| `engine.execute` `ui.savePdfDialog` | `{path?, preset?, range?, …document.exportPdf options}` | opens the Save PDF dialog (`file.export.pdf` with no params opens it too). Its fields are the `document.exportPdf` options: set `compatibility` with `ui.dialog.set {field: "compatibility", value: "1.5"}`, a section with `{field: "compression", value: {…}}` (the options it leaves out keep the dialog's values, in Save PDF and in the preset editor, and in an object inside a section such as `compression.color`; a value that isn't an object, null included, is an error), the artboards with `__allArtboards: false` and `range`, the visible section with `__section` (General, Compression, Marks and Bleeds, Output, Advanced, Security, Summary), and the bleed link with `__bleedLinked` (true gives every side the top value; any value other than true or false is an error; setting `bleed` turns the link on when its four sides are equal and off when they differ). In Advanced, Custom… beside Flattener preset (enabled when the file is flattened: PDF 1.3, PDF/X-1a, PDF/X-3) opens the `pdfFlattenerOptions` dialog over Save PDF on the flattener options the save would use; its fields are those options, with `clipComplexRegions`, `preserveAlpha` and `preserveOverprints` set by the writer and Overprint. Its `ui.dialog.confirm` sets `flattener` (the preset then shows [Custom]; options equal to the preset's leave it unset) and goes back to Save PDF, and `ui.dialog.cancel` goes back unchanged. Setting `flattenerPreset` drops `flattener`. `useArtboards: false` opens it for one page of the visible art's bounds, as Export As with Use Artboards off does: the dialog has no Artboards section and its `__artBounds` field is true. `ui.dialog.confirm` writes `path` (else asks for one), returns `{path, bytes, warnings}` and opens the file when `viewAfterSaving` is set. With `useArtboards: false` it writes the page as `app.export` does and returns `{path, warnings}`, or `{background: true, status}` while Background Export writes it |
|
||||
@@ -956,11 +956,11 @@ with `overprints: "preserve"`. Its `ui.dialog.confirm` sets every option as `fla
|
||||
in the dropdown or with `ui.dialog.set {flattenerPreset}`, drops `flattener`, and so does `ui.epsOptionsDialog` with
|
||||
a `flattenerPreset` and no `flattener`.
|
||||
|
||||
Data Recovery: at launch, copies left behind by a crash open the `recovery` dialog (never copies another running
|
||||
instance keeps, so instances started side by side for screenshots don't get it). Fields: `copies` (`[{file, title,
|
||||
saved}]`, from `file.recovery.list`) and `discard`. `ui.dialog.confirm` restores them all (`file.recovery.restore`
|
||||
each, opening "<name> [Recovered]" documents), `discard: true` then confirm deletes them, `ui.dialog.cancel` keeps them
|
||||
for the next launch. While copies are written in the background `ui.inspect` lists them under `background`
|
||||
Data Recovery: at launch, the app asks about each copy left behind by a crash in turn (never copies another running
|
||||
instance keeps, so instances started side by side for screenshots don't get it). `ui.inspect` lists each question in
|
||||
`dialogs` with key null and one field, `choice`: `recover` (the default) or `discard`. `ui.dialog.confirm` answers for that copy: `recover` restores it (`file.recovery.restore`, opening a
|
||||
"<name> [Recovered]" document) and `discard` deletes it (`file.recovery.discard`); the next copy is then asked about.
|
||||
`ui.dialog.cancel` keeps that copy and every later one for the next launch. While copies are written in the background `ui.inspect` lists them under `background`
|
||||
("Saving recovery data for <name>"). After a restore the status bar shows the count followed by the first of the
|
||||
restored documents' notes: each document's lines about its linked files, then its warnings (what reading the copy left
|
||||
out first), named with the document's title when more than one was restored. Hovering the message lists them all. The
|
||||
@@ -1027,15 +1027,15 @@ document starts on `cmyk`), `layers` (true: Write Layers; false: Flat Image, who
|
||||
`preserveText`, `maxEditability` and `hiddenLayers` (with layers) and `embedIcc`. `ui.dialog.set` the fields and
|
||||
`ui.dialog.confirm` writes the file(s) with `document.export`; with Flat Image it leaves `preserveText` out.
|
||||
|
||||
Print: File → Print… (`file.print` with no params, Ctrl/Cmd+P) opens the `print` dialog on the document's print
|
||||
settings. Its fields are the `print.setup` settings (`copies`, `artboards`, `range`, `media`, `orientation`,
|
||||
`placement`, `scaling`, `marks`, `bleed`, `output`, `graphics`, `color`, `margin`…; a section is an object, as
|
||||
`{field: "marks", value: {"trim": true}}`) plus `printer` (a name from `print.printers`, `""` the system's default) and
|
||||
`toFile` (save the job as a PDF), and the UI-only `__section` (General, Marks and Bleed, Output, Graphics, Color
|
||||
Management, Advanced, Summary) and `__sheet` (the page the preview shows, 0-based). `ui.dialog.confirm` (Print) keeps
|
||||
the settings with the document (`print.setup`, one undo step) and prints them: to the printer through the system's
|
||||
print queue (the web: the browser's print dialog), else, with `toFile` or no printing available, a save panel for the
|
||||
PDF. With `discard: true` it is Done: it only keeps the settings. Settings that can't print (a missing artboard, a
|
||||
Print: File → Print… (`file.print` with no params, Ctrl/Cmd+P) opens the Print dialog on the document's print
|
||||
settings. `ui.inspect` lists it last in `dialogs`, with key null. Its fields are the `print.setup` settings (`copies`,
|
||||
`artboards`, `range`, `media`, `orientation`, `placement`, `scaling`, `marks`, `bleed`, `output`, `graphics`,
|
||||
`color`, `margin`…; a section is an object, as `{field: "marks", value: {"trim": true}}`) plus `printer` (a name from
|
||||
`print.printers`, or `PDF File`, with which Print saves the job as a PDF), and the UI-only `section` (General, Marks and Bleed, Output, Graphics, Color Management, Advanced,
|
||||
Summary) and `sheet` (the page the preview shows, 0-based). `ui.dialog.confirm` (Print) keeps the settings with the
|
||||
document (`print.setup`, one undo step) and prints them: to the printer through the system's print queue (the web:
|
||||
the browser's print dialog), else, with `PDF File` or no printing available, a save panel for the PDF. After
|
||||
`ui.dialog.set {field: "choice", value: "done"}`, `ui.dialog.confirm` is Done: it only keeps the settings. Settings that can't print (a missing artboard, a
|
||||
range of no tiles) answer with an error and keep the dialog open. `file.print {settings?, printer?, toFile?, path?}`
|
||||
prints without the dialog; `print.printers` lists the printers and `print.printerSetup {printer?}` opens their system
|
||||
settings (Setup…). Desktop submission returns `{background: true, printed: false, printer, status}`
|
||||
@@ -1050,13 +1050,13 @@ reply `{ok: false, error: "…"}`; later spooler failures appear in `ui.inspect`
|
||||
no second reply or structured backend error object. Headless MCP keeps its engine-only `file.print`
|
||||
result (`path` or `dataBase64`, plus the same print metadata); no spooler fields are added there.
|
||||
|
||||
Print presets: in the `print` dialog, `preset` names the print preset whose settings were loaded last; setting it
|
||||
Print presets: in the Print dialog, `preset` names the print preset whose settings were loaded last; setting it
|
||||
(`ui.dialog.set {field: "preset", value: "Posters"}`) loads that preset's settings, and the list reads `[Custom]` once
|
||||
they differ. Save Preset… shows a name field (`__savePresetAs`): while it shows, `ui.dialog.confirm` saves the dialog's
|
||||
settings as that preset (`print.presets.save`) and selects it instead of printing. `ui.printPresetsDialog {selected?}`
|
||||
opens Edit → Print Presets (dialog `printPresets`, field `selected`); `[Default]` is protected. New… and Edit… open the
|
||||
preset editor, which `ui.printPresetDialog {name? (a saved preset to edit) | preset? (the preset a new one starts
|
||||
from)}` opens too: dialog `printPreset`, the Print dialog's settings fields plus `name`; `ui.dialog.confirm` runs
|
||||
from)}` opens too, listed last in `dialogs` with key null: the Print dialog's settings fields plus `name`; `ui.dialog.confirm` runs
|
||||
`print.presets.save` and returns to Print Presets (a new preset can't take a name in use). Delete, Import… and
|
||||
Export… are `print.presets.delete`, `print.presets.import` and `print.presets.export`; `ui.dialog.confirm` closes.
|
||||
Opening a `.vcprintpresets` file with `app.open` imports its presets.
|
||||
|
||||
Reference in new issue
Block a user