From 3b01769d46bcb7a1920667e75cc952c6c21d79ff Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 27 Oct 2026 19:17:27 -0700 Subject: [PATCH 1/4] Export for Screens: a ZIP export deflates its files With `zip: true`, document.exportForScreens deflated nothing: every file went into the archive stored. Each file is now deflated, or stored when deflating does not make it smaller, as file.package's archive does. The file list, the names and the reply's fields stay the same; `bytes` and the archive's contents change. Entries keep the fixed 1980-01-01 date, so the same files still give the same archive. The deflating writer moves from package.rs into fileio/zip.rs as `zip::deflate`, beside `zip::store`, and file.package calls it there with its own date and error text. The test reader `zip::entries` reads deflated entries too. The `zip` option's text in docs/mcp.md, docs/control-protocol.md and the command's params says the files are deflated. --- crates/engine/src/cmd/fileio/commands.rs | 2 +- crates/engine/src/cmd/fileio/screens.rs | 2 +- crates/engine/src/cmd/fileio/tests_screens.rs | 61 ++++++++++++++ crates/engine/src/cmd/fileio/zip.rs | 84 ++++++++++++++++--- crates/engine/src/cmd/package.rs | 49 +---------- docs/control-protocol.md | 2 +- docs/mcp.md | 3 +- 7 files changed, 141 insertions(+), 62 deletions(-) diff --git a/crates/engine/src/cmd/fileio/commands.rs b/crates/engine/src/cmd/fileio/commands.rs index 4be6d8ccb..0c38079df 100644 --- a/crates/engine/src/cmd/fileio/commands.rs +++ b/crates/engine/src/cmd/fileio/commands.rs @@ -54,7 +54,7 @@ pub fn specs() -> Vec { "Export for Screens", ["File", "Export"], None, - "{folder?, zip?: false (one store-only .zip of every file: no folder → {name, dataBase64, bytes, files: [name…]}; with a folder it is written there → {path, bytes, files}), artboards?: [index…] | range?: \"1-3\" (default all), assets?: [asset id…] (instead of artboards: each asset's art alone, cropped to its bounds and named after the asset; see assets.list), layers?: [layer id…] (instead of artboards: each layer's art alone, sublayers included, named after the layer), selection?: one|each (instead of artboards: the selected art as one file, or a file per selected object, named after it), fullDocument?: false (one file per format instead: a PDF of every artboard, other formats the bounds of all visible art, named after the document), includeBleed?: false (artboards grown by the document's bleed), exportPreset?: (a preset of document.exportPresets.list: its settings, under these params), subfolders?: false (each row's files in a sub-folder: its folder, else its size for raster (1x, 2x, 100w…) or its format (SVG, PDF)), folders?: none|rows (as subfolders)|format (a folder per extension: png, svg, pdf…)|item (a folder per artboard, asset, layer or object)|itemFormat (item/extension) (default: rows with subfolders or a preset, else none), name?: (a file name pattern instead of the item's name, with for the document, for the artboard, asset, layer or object, from 1, #### for the counter zero-padded to the run of #, , , (else the row's suffix ends the name), YYYYMMDD, YYYY-MM-DD, YYYY, ,