From d8f9242d0ff5674be2c1a5d7055d55419da4144e Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sun, 15 Nov 2026 12:34:23 +0100 Subject: [PATCH] Support native FigCraft geometry import and export --- README.md | 2 +- .../examples/check_geometry_exchange.rs | 7 ++++- crates/midra-layout/src/exchange_metadata.rs | 5 ++- crates/midra-layout/src/gui.rs | 7 +++-- crates/midra-layout/src/interchange.rs | 20 +++++++++--- crates/midra-layout/src/vendor_formats.rs | 22 ++++++++----- crates/midra-layout/tests/exchange.rs | 2 +- .../midra-layout/tests/exchange_metadata.rs | 7 ++++- crates/midra-layout/tests/interchange.rs | 22 +++++++++++-- docs/interfaces/midra-extra-parameters.md | 1 + docs/interfaces/midra-layout-exchange.md | 29 +++++++++++++++--- docs/midra-layout/README.md | 2 +- docs/midra-layout/changelog.md | 5 +++ docs/midra-layout/guide/files.md | 10 +++--- docs/midra-layout/plan.md | 2 +- docs/templates/midra-layout/README.md | 7 +++-- .../midra-layout-1080p-2-layers.figcraft | Bin 0 -> 607 bytes .../midra-layout-4k-2-layers.figcraft | Bin 0 -> 608 bytes .../midra-layout-all-templates.zip | Bin 80666 -> 82136 bytes scripts/manuals.py | 2 +- tests/test_midra_templates.py | 2 +- 21 files changed, 116 insertions(+), 38 deletions(-) create mode 100644 docs/templates/midra-layout/midra-layout-1080p-2-layers.figcraft create mode 100644 docs/templates/midra-layout/midra-layout-4k-2-layers.figcraft diff --git a/README.md b/README.md index d061ec0..c6b9049 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ See [development setup](https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/ [**Download all templates as ZIP**](https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/raw/branch/main/docs/templates/midra-layout/midra-layout-all-templates.zip) · [Browse individual starter files →](https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/src/branch/main/docs/templates/midra-layout/README.md) Matching Full HD and UHD 4K layouts are available in SVG, draw.io, geometry JSON, -CSV, DXF/DWG, HTML, PPTX, Figma FIG and Illustrator AI. The catalog contains every +CSV, DXF/DWG, HTML, PPTX, Figma FIG, FigCraft and Illustrator AI. The catalog contains every base file, import guidance and format dependencies. ## Explore further diff --git a/crates/midra-layout/examples/check_geometry_exchange.rs b/crates/midra-layout/examples/check_geometry_exchange.rs index b9d3ffb..404e0ac 100644 --- a/crates/midra-layout/examples/check_geometry_exchange.rs +++ b/crates/midra-layout/examples/check_geometry_exchange.rs @@ -134,7 +134,12 @@ fn main() -> Result<(), String> { let codecs = if extensions.is_empty() { Codec::available() .into_iter() - .filter(|c| !matches!(c, Codec::Pptx | Codec::Figma | Codec::Illustrator)) + .filter(|c| { + !matches!( + c, + Codec::Pptx | Codec::Figma | Codec::Figcraft | Codec::Illustrator + ) + }) .collect::>() } else { extensions diff --git a/crates/midra-layout/src/exchange_metadata.rs b/crates/midra-layout/src/exchange_metadata.rs index fd3d43e..46c2cd0 100644 --- a/crates/midra-layout/src/exchange_metadata.rs +++ b/crates/midra-layout/src/exchange_metadata.rs @@ -8,7 +8,10 @@ const MAX_METADATA: usize = 1024 * 1024; const PREFIX: &str = "beffroi-midra-parameters:"; pub fn supported(codec: Codec) -> bool { - !matches!(codec, Codec::Dwg | Codec::Figma | Codec::Illustrator) + !matches!( + codec, + Codec::Dwg | Codec::Figma | Codec::Figcraft | Codec::Illustrator + ) } /// Exclude unexported layers, unused inputs, image bytes and device capture bindings. diff --git a/crates/midra-layout/src/gui.rs b/crates/midra-layout/src/gui.rs index 57085a9..7723070 100644 --- a/crates/midra-layout/src/gui.rs +++ b/crates/midra-layout/src/gui.rs @@ -715,7 +715,10 @@ impl Editor { .is_some_and(|extension| { let extension = extension.to_ascii_lowercase(); midra_layout::interchange::extensions().contains(&extension.as_str()) - || matches!(extension.as_str(), "pptx" | "fig" | "ai" | "dwg") + || matches!( + extension.as_str(), + "pptx" | "fig" | "figcraft" | "ai" | "dwg" + ) }) } fn read_geometry_files(files: Vec, p: &mut Paste) { @@ -6426,7 +6429,7 @@ mod tests { app.paste = None; } } - for extension in ["pptx", "fig", "ai", "xml"] { + for extension in ["pptx", "fig", "figcraft", "ai", "xml"] { assert!(Editor::geometry_drop(&egui::DroppedFile { name: format!("test.{extension}"), ..Default::default() diff --git a/crates/midra-layout/src/interchange.rs b/crates/midra-layout/src/interchange.rs index cce09f1..8382c46 100644 --- a/crates/midra-layout/src/interchange.rs +++ b/crates/midra-layout/src/interchange.rs @@ -17,6 +17,7 @@ pub enum Codec { Html, Pptx, Figma, + Figcraft, Illustrator, } @@ -34,7 +35,13 @@ impl Codec { feature = "vendor_formats", not(feature = "no_proprietary") )) { - formats.extend([Self::Dwg, Self::Pptx, Self::Figma, Self::Illustrator]); + formats.extend([ + Self::Dwg, + Self::Pptx, + Self::Figma, + Self::Figcraft, + Self::Illustrator, + ]); } formats } @@ -49,6 +56,7 @@ impl Codec { Self::Html => "HTML / CSS", Self::Pptx => "PowerPoint · PPTX", Self::Figma => "Figma · FIG", + Self::Figcraft => "FigCraft · FIGCRAFT", Self::Illustrator => "Illustrator · AI (VectorCraft)", } } @@ -63,6 +71,7 @@ impl Codec { Self::Html => "html", Self::Pptx => "pptx", Self::Figma => "fig", + Self::Figcraft => "figcraft", Self::Illustrator => "ai", } } @@ -77,6 +86,7 @@ impl Codec { Self::Pptx => { "One editable slide. Coordinates use 96 pixels per inch. Import lets you choose a slide." } + Self::Figcraft => "Editable FigCraft document. Import lets you choose a page or frame.", Self::Figma => { "Editable Figma frame. Import lets you choose a page or frame. Uses FigCraft's best-effort native codec." } @@ -164,8 +174,10 @@ pub fn import(bytes: &[u8], filename: &str) -> Result, String> { .and_then(|s| s.to_str()) .unwrap_or("") .to_ascii_lowercase(); - let vendor = matches!(extension.as_str(), "pptx" | "fig" | "ai" | "dwg") - || bytes.starts_with(b"PK") + let vendor = matches!( + extension.as_str(), + "pptx" | "fig" | "figcraft" | "ai" | "dwg" + ) || bytes.starts_with(b"PK") || bytes.starts_with(b"fig-") || bytes.starts_with(b"AC10"); if vendor { @@ -188,7 +200,7 @@ pub fn import(bytes: &[u8], filename: &str) -> Result, String> { }]); } let text = std::str::from_utf8(bytes).map_err( - |_| "Unrecognized binary format. Choose PPTX, FIG, AI or a supported geometry file.", + |_| "Unrecognized binary format. Choose PPTX, FIG, FIGCRAFT, AI or a supported geometry file.", )?; Ok(vec![Page { name: filename.into(), diff --git a/crates/midra-layout/src/vendor_formats.rs b/crates/midra-layout/src/vendor_formats.rs index d920866..e55a2a7 100644 --- a/crates/midra-layout/src/vendor_formats.rs +++ b/crates/midra-layout/src/vendor_formats.rs @@ -47,7 +47,7 @@ pub(crate) fn export( canvas: [u32; 2], shapes: &[ExportShape], ) -> Result, String> { - if matches!(codec, Codec::Pptx | Codec::Figma) + if matches!(codec, Codec::Pptx | Codec::Figma | Codec::Figcraft) && shapes .iter() .any(|s| !s.background && s.name == "midra-background") @@ -64,7 +64,8 @@ pub(crate) fn export( Ok(bytes) } Codec::Pptx => export_pptx(canvas, shapes), - Codec::Figma => export_fig(canvas, shapes), + Codec::Figma => export_fig(canvas, shapes, false), + Codec::Figcraft => export_fig(canvas, shapes, true), Codec::Illustrator => { let svg = exchange::encode_shapes(exchange::Format::Svg, canvas, shapes)?; let (bytes, warnings) = convert_ai(svg.as_bytes(), "svg", "ai", None)?; @@ -101,7 +102,7 @@ pub(crate) fn import(bytes: &[u8], extension: &str, filename: &str) -> Result Result, String> { @@ -243,7 +244,7 @@ fn collect_pptx( Ok(()) } -fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result, String> { +fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape], native: bool) -> Result, String> { use figcraft_doc::{ Document, Node, NodeKind, color::{ImageScaleMode, Paint}, @@ -287,6 +288,9 @@ fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result, Strin doc.insert(node, frame_id, None) .map_err(|e| e.to_string())?; } + if native { + return figcraft_format::save_bytes(&doc, None).map_err(|e| e.to_string()); + } let (bytes, warnings) = figcraft_format::fig::export(&doc, None).map_err(|e| e.to_string())?; if !warnings.is_empty() { return Err(format!( @@ -297,10 +301,14 @@ fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result, Strin Ok(bytes) } -fn import_fig(bytes: &[u8], filename: &str) -> Result, String> { +fn import_fig(bytes: &[u8], filename: &str, native: bool) -> Result, String> { use figcraft_doc::NodeKind; - let (doc, warnings) = - figcraft_format::fig::import(bytes, filename).map_err(|e| e.to_string())?; + let (doc, warnings) = if native { + figcraft_format::load_bytes(bytes) + } else { + figcraft_format::fig::import(bytes, filename) + } + .map_err(|e| e.to_string())?; let mut pages = Vec::new(); for id in &doc.pages { let Some(p) = doc.node(*id) else { diff --git a/crates/midra-layout/tests/exchange.rs b/crates/midra-layout/tests/exchange.rs index f9e299e..0a8b91d 100644 --- a/crates/midra-layout/tests/exchange.rs +++ b/crates/midra-layout/tests/exchange.rs @@ -506,7 +506,7 @@ fn check_native_templates(codecs: &[midra_layout::interchange::Codec]) { #[test] fn native_readme_templates_preserve_two_layer_geometry() { use midra_layout::interchange::Codec; - check_native_templates(&[Codec::Pptx, Codec::Figma, Codec::Dwg]); + check_native_templates(&[Codec::Pptx, Codec::Figma, Codec::Figcraft, Codec::Dwg]); } #[cfg(all(feature = "vendor_formats", not(feature = "no_proprietary")))] diff --git a/crates/midra-layout/tests/exchange_metadata.rs b/crates/midra-layout/tests/exchange_metadata.rs index 2894d0d..97cb427 100644 --- a/crates/midra-layout/tests/exchange_metadata.rs +++ b/crates/midra-layout/tests/exchange_metadata.rs @@ -139,7 +139,12 @@ fn metadata_is_optional_versioned_and_not_silently_applied_to_edited_artwork() { assert!(interchange::import(&invalid, "x.json").is_ok()); json.as_object_mut().unwrap().remove(metadata::KEY); assert!(interchange::import(&serde_json::to_vec(&json).unwrap(), "x.json").is_err()); - for codec in [Codec::Dwg, Codec::Figma, Codec::Illustrator] { + for codec in [ + Codec::Dwg, + Codec::Figma, + Codec::Figcraft, + Codec::Illustrator, + ] { assert!(!metadata::supported(codec)); assert!( interchange::export( diff --git a/crates/midra-layout/tests/interchange.rs b/crates/midra-layout/tests/interchange.rs index 94a4c14..6b889d6 100644 --- a/crates/midra-layout/tests/interchange.rs +++ b/crates/midra-layout/tests/interchange.rs @@ -42,7 +42,7 @@ fn native_binary_codecs_roundtrip_boxes_background_and_artwork() { let mut project = Project::from_layout(&layout); project.layers[0].name = "Camera & écran".into(); let ids: Vec<_> = project.layers.iter().map(|l| l.id).collect(); - for codec in [Codec::Pptx, Codec::Figma] { + for codec in [Codec::Pptx, Codec::Figma, Codec::Figcraft] { for artwork in [false, true] { let bytes = interchange::export( &project, @@ -56,6 +56,16 @@ fn native_binary_codecs_roundtrip_boxes_background_and_artwork() { ) .unwrap(); assert!(bytes.starts_with(b"PK")); + if codec == Codec::Figcraft { + let (doc, _) = figcraft_format::load_bytes(&bytes).unwrap(); + let resaved = figcraft_format::save_bytes(&doc, None).unwrap(); + let json = figcraft_format::to_json(&doc).unwrap().to_string(); + for data in [&resaved[..], json.as_bytes()] { + let pages = interchange::import(data, "resaved.FIGCRAFT").unwrap(); + assert_eq!(pages[0].document.shapes.len(), 3); + assert_eq!(pages[0].document.shapes[1].geometry.x, -13.0); + } + } let pages = interchange::import(&bytes, &format!("layout.{}", codec.extension())).unwrap(); assert_eq!(pages.len(), 1, "{codec:?}"); @@ -80,7 +90,11 @@ fn native_binary_codecs_roundtrip_boxes_background_and_artwork() { let native = deckcraft_pptx::import(&bytes).unwrap(); assert_eq!(native.media.len(), 3); } else { - let (native, _) = figcraft_format::fig::import(&bytes, "layout.fig").unwrap(); + let (native, _) = if codec == Codec::Figcraft { + figcraft_format::load_bytes(&bytes).unwrap() + } else { + figcraft_format::fig::import(&bytes, "layout.fig").unwrap() + }; assert!(!native.images.is_empty()); } } else if codec == Codec::Pptx { @@ -141,6 +155,8 @@ fn disabled_vendor_codecs_are_not_advertised_or_accepted() { return; } assert!(!Codec::available().contains(&Codec::Figma)); + assert!(!Codec::available().contains(&Codec::Figcraft)); + assert!(interchange::import(b"{}", "test.figcraft").is_err()); assert!(interchange::import(b"fig-test", "test.fig").is_err()); let project = Project::from_layout(&Layout::default()); assert!( @@ -190,7 +206,7 @@ fn figma_frames_get_independent_origins_and_keep_hidden_children_out() { fn native_export_refuses_names_that_would_turn_content_into_a_background() { let mut project = Project::from_layout(&Layout::default()); project.layers[0].name = "midra-background".into(); - for codec in [Codec::Pptx, Codec::Figma] { + for codec in [Codec::Pptx, Codec::Figma, Codec::Figcraft] { let error = interchange::export(&project, &[project.layers[0].id], codec, Options::default()) .unwrap_err(); diff --git a/docs/interfaces/midra-extra-parameters.md b/docs/interfaces/midra-extra-parameters.md index 326a664..08be0a0 100644 --- a/docs/interfaces/midra-extra-parameters.md +++ b/docs/interfaces/midra-extra-parameters.md @@ -24,6 +24,7 @@ external editor moves/resizes a shape without updating the embedded snapshot. | HTML | `` in `` | Inert document metadata, no scripts or hidden visible objects. HTML geometry version stays 1. | | PPTX | `docProps/custom.xml`, string property `beffroi_midra_parameters` | Standard custom-properties content type and package-root relationship; `vt:lpwstr`, pid 2, fmtid `{D5CDD505-2E9C-101B-9397-08002B2CF9AE}`. Existing ZIP parts are preserved; native DeckCraft import checks unchanged geometry. Microsoft PowerPoint resave not tested here. | | DWG | Not enabled | DXF comments do not provide a reliable binary-DWG carrier. XRECORD/XData are potential future paths, but the current Craft conversion bridge has no verified application-payload round trip. No bytes are appended to the binary file. | +| FigCraft FIGCRAFT | Not enabled | Native geometry and image exchange only; no Midra snapshot field is emitted or restored. | | Figma FIG | Not enabled | Figma has plugin data, but the installed FigCraft 0.5.1 native exporter explicitly warns `plugin data was left out`. Its model field is not evidence of native preservation. | | Illustrator AI | Not enabled | PDF-compatible AI can have document metadata, but the current VectorCraft SVG↔AI conversion path has no verified application-payload preservation. No unverified PDF/AI trailer changes are made. | | Midra project JSON | Already complete | Project v12 remains the authoritative full-fidelity save. This task does not change its schema. | diff --git a/docs/interfaces/midra-layout-exchange.md b/docs/interfaces/midra-layout-exchange.md index e02eadf..7a6f352 100644 --- a/docs/interfaces/midra-layout-exchange.md +++ b/docs/interfaces/midra-layout-exchange.md @@ -1,7 +1,7 @@ # Midra Layout geometry exchange The Export menu writes **SVG v2**, **draw.io v1**, **geometry JSON v1**, -**geometry CSV v1**, **DXF/DWG**, **HTML/CSS v1**, **PPTX**, **Figma FIG** and +**geometry CSV v1**, **DXF/DWG**, **HTML/CSS v1**, **PPTX**, **Figma FIG / FigCraft** and **Illustrator AI** (the latter via a local VectorCraft CLI). Project JSON is version 12 and is the full-fidelity save format. These exchanges preserve layer **visible-box geometry**, not sources, crop settings, zoom, pivots, @@ -10,7 +10,7 @@ cropping; importing a picture does not reconstruct its crop or source settings. The [starter-file catalog](../templates/midra-layout/README.md) centralizes ready-to-open two-layer templates under `docs/templates/midra-layout/` for Full HD (1920 × 1080) and UHD 4K -(3840 × 2160), in all ten exchange formats (including PPTX, FIG and AI). The 4K geometry is an exact +(3840 × 2160), in all eleven exchange formats (including PPTX, FIG and AI). The 4K geometry is an exact 2× scale of the Full HD layout. Regenerate them with: ```sh @@ -45,6 +45,7 @@ MIDRA_VECTORCRAFT_CLI=/path/to/vectorcraft-cli cargo test --locked -p midra-layo | Browsers and web layout tools | HTML/CSS | Yes | Embedded PNG | Embedded PNG | | PowerPoint, LibreOffice Impress, DeckCraft | PPTX | Yes; slide picker on import | Embedded PNG | Embedded PNG | | Figma, FigCraft | Native FIG | Yes; page/frame picker on import | Embedded PNG | Embedded PNG | +| FigCraft | Native FIGCRAFT | Yes; page/frame picker on import | Embedded PNG | Embedded PNG | | Illustrator, VectorCraft | Native AI via VectorCraft CLI | Yes; artboard picker on import | Embedded PNG | Embedded PNG | PSD, VSDX and ODG remain future adapters rather than implied support. @@ -129,7 +130,7 @@ Standard OOXML ZIP, one slide matching the screen; 96 screen pixels per inch, or 0.75 points per pixel (9525 EMU/px). Native shapes/pictures preserve editable names and boxes. The background is named `midra-background`, a reserved marker excluded from mapping. PNGs are embedded as media; no source URLs are used. -PPTX/FIG export asks to rename a content layer with that reserved name so it +PPTX/FIG/FIGCRAFT export asks to rename a content layer with that reserved name so it cannot silently become an ignored background on reimport. Stable Midra device/source IDs are not represented in the native file. @@ -158,6 +159,24 @@ components, auto-layout rules, text and styling do not become Midra parameters. Native round-trip tests verify geometry/artwork with the pinned upstream codec; they do not constitute validation against every Figma service version. +### FigCraft FIGCRAFT + +The separate `.figcraft` option uses the pinned `figcraft-format` crate's native +version 1 reader/writer, not a renamed `.fig`. Its ZIP contains `document.json` +(with `format: "figcraft"` and `version: 1`) and image assets under `images/`. +Import also accepts the native bare JSON representation with a `.figcraft` +extension; unsupported future versions are rejected by the upstream reader. + +Geometry, page/frame selection, reserved background names and artwork follow the +FIG contract above. Export rounds positions and sizes to whole screen pixels; +import retains fractional coordinates. One output-sized frame contains the named +layer rectangles. Background and placeholder pictures are optional. Midra source, +crop, mapping and workspace settings are omitted; extra-parameter embedding is +not enabled. FigCraft history, branches and library data are not imported into +Midra or recreated on export. Reader repair warnings appear in the import review. +This option shares the FIG vendor feature and is excluded by `no_proprietary`. +Tests cover native resaving, bare JSON, geometry, artwork and both starter sizes. + ### Illustrator AI Uses [VectorCraft CLI](https://github.com/storytold/vectorcraft), discovered through @@ -351,7 +370,7 @@ the only positions present in that SVG. Include Midra Layout's background layer before exporting through draw.io when the full output-screen origin must survive the round trip. -Tests cover each format/artwork combination, the twelve text templates and six native PPTX/FIG/DWG templates (plus two AI templates in the opt-in CLI check), +Tests cover each format/artwork combination, the twelve text templates and eight native PPTX/FIG/FIGCRAFT/DWG templates (plus two AI templates in the opt-in CLI check), full-screen layers vs backgrounds, negative/fractional coordinates, repeat round trips, compressed clipboard/files, embedded references, invalid IDs/versions and no-overwrite file handling. @@ -411,5 +430,5 @@ capture bindings. See the [complete carrier contract and format audit](midra-ext Restore the original snapshot with **Project → Restore parameters from export…**. Normal geometry import continues to use the artwork's current boxes, including any -external edits. Third-party editors may strip metadata. DWG, FIG and AI are not +external edits. Third-party editors may strip metadata. DWG, FIG, FIGCRAFT and AI are not enabled until their current codec paths can preserve it reliably. diff --git a/docs/midra-layout/README.md b/docs/midra-layout/README.md index 2abb159..74f3a47 100644 --- a/docs/midra-layout/README.md +++ b/docs/midra-layout/README.md @@ -70,7 +70,7 @@ See [formats and crop](guide/formats-and-crop.md) and - **Work with another application:** drop a supported geometry file into the window, use **Import → Geometry file…**, or **Project → Export → Export layers…**. The [starter-file catalog](../templates/midra-layout/README.md) has matching Full HD and 4K files in SVG, draw.io, geometry JSON, CSV, DXF/DWG, - HTML, PPTX, Figma FIG and Illustrator AI. It also lists format dependencies. + HTML, PPTX, Figma FIG, FigCraft and Illustrator AI. It also lists format dependencies. - **Use an Eikos 4K:** connect, review layer mappings, then explicitly load or send the chosen layers. Ordinary editing does not send commands to the device. Follow the [connection and transfer guide](guide/device.md) and its linked diff --git a/docs/midra-layout/changelog.md b/docs/midra-layout/changelog.md index ae64e13..8d36216 100644 --- a/docs/midra-layout/changelog.md +++ b/docs/midra-layout/changelog.md @@ -4,6 +4,11 @@ ## Unreleased +- Add native FigCraft (.figcraft) geometry import/export, file drops and page/frame + selection using the existing crate. Include background/artwork options and both + starter sizes in the combined ZIP. Test native resaving and geometry/artwork + round trips; no_proprietary builds keep this codec disabled. + - Offer Download all templates as ZIP first in the README and starter catalog, replacing the Illustrator-only archive with all 20 Full HD/UHD starter files. Tests check every archived filename and byte against the individual templates. diff --git a/docs/midra-layout/guide/files.md b/docs/midra-layout/guide/files.md index 2444ada..f37aabc 100644 --- a/docs/midra-layout/guide/files.md +++ b/docs/midra-layout/guide/files.md @@ -4,7 +4,7 @@ ## Paste layer values and import geometry -Drop SVG, draw.io/XML, geometry JSON/CSV, DXF/DWG, HTML, PPTX, FIG or AI files into +Drop SVG, draw.io/XML, geometry JSON/CSV, DXF/DWG, HTML, PPTX, FIG, FIGCRAFT or AI files into the window to open the same geometry review as **Import → Geometry file…**. Native codecs still require their normal build options/dependencies. Filename extensions are case-insensitive; PNG/JPEG/BMP drops remain reference images. @@ -120,21 +120,21 @@ viewport preferences, and all embedded reference images. Apply pending edits before saving. Opening asks before replacing current work and starts a fresh undo history. Existing files require confirmation before replacement. -The [starter-file catalog](../../templates/midra-layout/README.md) contains all ten +The [starter-file catalog](../../templates/midra-layout/README.md) contains all eleven exchange formats, with two layers for 1920 × 1080 and 3840 × 2160 canvases. **Project → Export → Export layers…** opens one shared window. Choose SVG, -draw.io, JSON, CSV, DXF/DWG, HTML, PPTX, Figma FIG or Illustrator AI, then +draw.io, JSON, CSV, DXF/DWG, HTML, PPTX, Figma FIG, FigCraft or Illustrator AI, then **Current layer…**, **Selected layers…**, **Specific layer…**, **All layers…** and **Visible layers only…**. A current-layer export keeps its original screen position and full-screen canvas. The window offers **Include background layer**. SVG, draw.io, geometry -JSON, HTML, PPTX, FIG and AI also offer **Include placeholder pictures** with embedded source-grid +JSON, HTML, PPTX, FIG, FIGCRAFT and AI also offer **Include placeholder pictures** with embedded source-grid imagery; CSV and DXF explicitly disable pictures and carry rectangle geometry. Import a supported format with **Import → Geometry file…** or paste its text, then choose a slide/page/frame where applicable, then map detected layers to destinations. -PPTX uses 96 pixels per inch; FIG uses native pixels. AI requires a separately +PPTX uses 96 pixels per inch; FIG/FIGCRAFT use native pixels. AI requires a separately installed `vectorcraft-cli`; its artboards appear in the same canvas selector. Import/export runs in the background and reports conversion failures without modifying the project. Backgrounds are automatically ignored; diff --git a/docs/midra-layout/plan.md b/docs/midra-layout/plan.md index 4ea988c..08b63ba 100644 --- a/docs/midra-layout/plan.md +++ b/docs/midra-layout/plan.md @@ -43,7 +43,7 @@ device readback and physical-screen acceptance. - [x] Ten-format file exchange: SVG, draw.io, geometry JSON, CSV, DXF/DWG, HTML, PPTX, FIG and AI through VectorCraft. Shared geometry, scope and review, optional artwork where supported, page/frame selection and licensing build flag. - Two-layer Full HD and UHD templates exist for all ten formats. + Two-layer Full HD and UHD templates exist for all eleven formats. - [x] Project JSON v12, tested legacy/recovery migration, saved layer links, central application preferences, full Settings, themes and recent-theme list. - [x] Separate Midra connection and mapping/transfer controls, saved address, diff --git a/docs/templates/midra-layout/README.md b/docs/templates/midra-layout/README.md index 5773819..bdd55c1 100644 --- a/docs/templates/midra-layout/README.md +++ b/docs/templates/midra-layout/README.md @@ -2,8 +2,8 @@ [Midra Layout](../../midra-layout/README.md) · [User guide](../../midra-layout/guide/README.md) · [Geometry format contract](../../interfaces/midra-layout-exchange.md) -**[Download all templates as ZIP](midra-layout-all-templates.zip)** — all ten formats -in both Full HD and UHD 4K (20 files). Extract the archive and use whichever +**[Download all templates as ZIP](midra-layout-all-templates.zip)** — all eleven formats +in both Full HD and UHD 4K (22 files). Extract the archive and use whichever format suits your editor. This also preserves file names when browsers would otherwise preview a template, including PDF-compatible Illustrator files. @@ -29,6 +29,7 @@ Review the detected rectangles and their destination layers before applying. | HTML | [Download .html](midra-layout-1080p-2-layers.html) | [Download .html](midra-layout-4k-2-layers.html) | Browsers and web layouts | | PowerPoint | [Download .pptx](midra-layout-1080p-2-layers.pptx) | [Download .pptx](midra-layout-4k-2-layers.pptx) | PowerPoint, LibreOffice Impress or DeckCraft | | Figma FIG | [Download .fig](midra-layout-1080p-2-layers.fig) | [Download .fig](midra-layout-4k-2-layers.fig) | Figma or FigCraft | +| FigCraft | [Download .figcraft](midra-layout-1080p-2-layers.figcraft) | [Download .figcraft](midra-layout-4k-2-layers.figcraft) | FigCraft | | Illustrator AI | [Download .ai](midra-layout-1080p-2-layers.ai) | [Download .ai](midra-layout-4k-2-layers.ai) | Illustrator or VectorCraft | ## Geometry files and saved projects @@ -52,7 +53,7 @@ After updating any starter file, rebuild the combined download from this folder: python3 -m zipfile -c midra-layout-all-templates.zip midra-layout-*-2-layers.* ``` -The archive contains exact copies of all 20 templates; regression tests verify +The archive contains exact copies of all 22 templates; regression tests verify the file names and bytes and the manual includes the same archive. Keep all formats here and link to this catalog instead of copying files or diff --git a/docs/templates/midra-layout/midra-layout-1080p-2-layers.figcraft b/docs/templates/midra-layout/midra-layout-1080p-2-layers.figcraft new file mode 100644 index 0000000000000000000000000000000000000000..5fcc7a1589c2e1f5051e420ae6a42d5b5cbd08c2 GIT binary patch literal 607 zcmWIWW@Zs#U|`??Vnv47m3KZrW@KQHVr5|91&XBPCzs}?=9TDW73b$&nR2^twt+xf ze5&d7#T?AuLiZK~MTfph6ODdjEW!&NJ;pL5a^DAAVwdNk}6@2AU>2Tz4L^4%|S{q%D6o}G=#RySA3 zeVY70J?7|lWe&TST1#dgt~=po%jxi8d!OlXMkmG7@w__^hRHZhaNnIQ_Le`h>4MFQ zM~z;8|8h*-^=cA#ZTYv!PEKz&m&m6UFZFE;njMop@$)5i zn+ukoRJOKrE|e_!aQ1yb+?JIdkth5=N5h{(*(ub9s~jxRR_^=gtSTtmv~H{6pSs7BHkZ4FHw0Kc&UmKy<7C=CvCpMj-&sXw z)z6;3e%JNZzzNk-B2I}S$*iYkQxlT-+{(Yd=e?fO>=ZmV*{ch^0-+S zy_ie6J|16BRk{9`=;he=U)oH#DK!6I>q8smFaOe}aqjlIw27nW$@$cflg2*_zaQy1 z-8kch_m8_D-h`}^iHhTlubLTk{nIVm7v{jY{{NquA;6oFNrV}9dH^Z|gC&h13MF*} Sc(byB1Q~(Q8c6dofp`F3-U$}~ literal 0 HcmV?d00001 diff --git a/docs/templates/midra-layout/midra-layout-4k-2-layers.figcraft b/docs/templates/midra-layout/midra-layout-4k-2-layers.figcraft new file mode 100644 index 0000000000000000000000000000000000000000..a05451b65afb26b28f6c578c8c7cfe2a1e998965 GIT binary patch literal 608 zcmWIWW@Zs#U|`??Vnv1*6Y5tzVPs&CVP#<81&XBPCzs}?=9TDW73b$&nQ}X8iGx5} zyy}%w!y8#?J^33paB^2$@+`c1Epyx3X`AMz2;8q-DaSAAlo0tXP2c9v-LR?u)2Aw5 z>5F=)*dArBdh!Nt{q%76o?VT~RySA3 zeOmlLJ?7|lWe&TST1#dgt~=po%i-|hdY|cWMkmG7@w__^hRHZhaNoVWw&cVmmW4Zm zkItPmp*z+@@yfBig@1*e+|TWf{w1hYdQnxps_MiE6KaJD71&DQpGiy0rzUOW-*xTShu^*4=k7_yGCIBNSv<4-f%@#9QD?4S-Ss+U z<=@h{eJ|p~-5lR#25__n_K50~PigG5l(>6$n|e#i$60IQ>SrCuDfL|S<&xR6#g~5s zr?L27`gUjMoub_wH|6DPx93cFHT7%PKf~E7KmOG}@ZkvC`#XHu=Z*`%S4XD3QSv;kbYkNE>4B>LPoLja zHr8WLN?HG~{qW`Bokbaysx_}t^I}hDZ(nd97}@{-GcyEuGct)V<4zDjWni$R5k#RR Uj{t90Hjp4A5LyFiekKqP0H&J^;Q#;t literal 0 HcmV?d00001 diff --git a/docs/templates/midra-layout/midra-layout-all-templates.zip b/docs/templates/midra-layout/midra-layout-all-templates.zip index 27239ed34be24d429a3f346f00095b3e50018ff1..aa263e436c4ed28b78a9980661ab83cadc086260 100644 GIT binary patch delta 1567 zcmZ{kdoRQvy#LP zYh0T#smPrrvBQwNTyhzQF=jM7*gc)S^uFgg=lgum`#$gU$LD=AS4IDb-&rc*w2$fY z_OmraLc`p(dSbrskq4 zg%dP7T7)J$;u>Z6P1bl`E(`W>g0b2vI#oec&!>CGR{IhfRzfdbhp6>;V^Wi9M>oQp z*~5i8=NUXTN-ml*M5Q8`Gn0F3Y=}zF8s#@AZ5|vud~@5IaCMd+Lc!E;LC>V)kvEH=-jkT}`Qj@$Kz_vThajkAm~fx5y)cZw4>> zPBX$*kI=}YlJn=xQVe8E9y;g_2D4$tiTyzjZmRXS+)&DP*y)|s>#xtZ=R|c+hEy#k zi4--;c1jaSRs-s*HDR;HMNP%)%y)eYFNWj@hGdtE^%_XkM=RxizGtO!UAdep(w(%J zo-3H#60C%R@df-s#!w3fCV*KelIRVUs6d{ANkL#Eb0N~~_P`>&FEledVG0%#POgfb z(vFjMa$(WUXIqyX1TZ(hM~@GNYV3Cj+=ERy>w$$O5`O^dZnnUmv!usV2%^OHbL-W%Ijnu zsw1@z{aaiJs@i9!AND9ZpOULMKSVA1i@fCjAy3{E^&6 zUWP)?>iPI^d!F3o(IZ`zt zYmC+=a<8{e5t+@_xSO3J6}b>#A9#Ulh_^;<6z@Rf=M*teCt@ns*r~%O4+tzj%+Jy7 z%d^Iw(qr$Q;zf4M#ON6vi%>rp&IgxRAua(+Aqpi^v1w%4{bvQwkB?kVF)1BiCG9DB z8uw`(XXrZ7_;P)hsk}!F;g&X!6+D9B%ruo7T+AtWaLI~gW@7tZFuhD`d3$~Cg2t>; zr4mD)PCb%mS25|}i=LaF`y@86r=!Ccbhb$hw>PQ2PBA`HSC?)s@l*OK2;G@^Iw3_o zMZ8yBT%2#EthmkI2ZWHlJT~%&e~mrB0MOd~_t*o+;lNQynhPjl09Zk2DDbpCpa{kq z0LLK=x9y~5Gg-^pPQEh)v>?jaL^Asjc-0U%2BBAO>7q^FzX}XS0P^6PJ|F{%37?1T zuGw}h;D8k9u<1lFHysNI>ciH(UIegT{vUrsPxpwgs|IRI6_kiR5cRn zR_<0AypgcSuJtV~>{lA(=>Za8zY(x^$6f?L>{^kN4UNFrTJD5yRzD!zX+ouI1PHS~ E0d7_O=>Px# delta 246 zcmcc7$U5sA%Lajn&GVz0XH8#j&nU3@!1q9x>B%;XQq#3<7!{_^wPDm_(utb>z?xBR z`fCtJKN`ZZv;}f9XF@pbwv4(=6K72}_$ocU+KN$V@~LeCJPc5\]\()(?P[^\s)]+)(?P\))" r"|(?P(?:href|src)=[\"'])(?P[^\"']+)(?P[\"'])") diff --git a/tests/test_midra_templates.py b/tests/test_midra_templates.py index 8511251..e29ab64 100644 --- a/tests/test_midra_templates.py +++ b/tests/test_midra_templates.py @@ -9,7 +9,7 @@ ROOT = pathlib.Path(__file__).resolve().parents[1] / "docs/templates/midra-layou class MidraTemplateDownloads(unittest.TestCase): def test_all_templates_archive_preserves_names_and_original_bytes(self): names = {path.name for path in ROOT.glob("midra-layout-*-2-layers.*")} - self.assertEqual(len(names), 20) + self.assertEqual(len(names), 22) with zipfile.ZipFile(ROOT / "midra-layout-all-templates.zip") as archive: self.assertEqual(set(archive.namelist()), names) self.assertEqual(len(archive.namelist()), len(names))