A host page that opts in with `?save=managed` (or `data-save="managed"`
on the canvas) now gets each Save and Save As of the document with an
`id` (`save-1`, `save-2`, ...), and the document keeps its unsaved
changes until the host answers `figcraft:saved` with that `id`. Hosts
that don't opt in see no change: a file still counts as saved once it is
posted.
- `host_saves.rs`: the bookkeeping, apart from the browser so it is
tested natively. One save waits at a time; a newer one replaces it;
answers for any other `id` are ignored; a file the host opens forgets
the waiting save; a save unanswered after 30 s counts as not stored
(the clock is passed in). A Save As becomes the document's file only
once confirmed, so a retry after a failure is still `saveAs: true`.
- `host.rs`: the listener only queues what the host sent; the shell
handles it in order each frame. Exports and copies carry no `id` and
`saveAs: false`. A timeout tells the user and posts `figcraft:failed`
with the `id`, and the app wakes itself for it.
- ui-egui: `Services::deliver_document` hands the document's own file
over (its default is `download`, so desktop and plain browser saves
are unchanged). `Delivery::Pending` skips `file.markSaved`;
`FigApp::document_stored` and `document_not_stored` finish the save.
- engine: `FileSnapshot::delivered` marks the snapshot's tab saved as of
the snapshot, so edits made while the save was in flight stay unsaved,
and a tab closed or saved since is left alone. It shares its tail with
`FileSnapshot::save`.
`craft-web-host` at the pinned rev has no host-to-app refusal message
and no `host {confirmsSaves}` handshake (storytold/craft-libs#1338), so
a host's refusal shows as the timeout until the crate adds them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
variable.export {format: "dtcg", mode?} writes a group per collection and
a token per variable, nested by the parts of its name: colours as
colorSpace/components objects, numbers as px dimensions or plain numbers
where they are used unitless, aliases as {group.token}, colour
calculations as the colour they show. Strings, booleans, every mode's
value and scopes go under $extensions, so the file reads back whole;
`mode` picks the mode written as $value. Variables > Export offers it,
saved as .tokens.json.
variable.import reads a file holding a $value as tokens: top-level groups
are collections, types are handed down from groups, and color, dimension
(px, rem at 16 px), number, fontWeight, duration, fontFamily, strings,
booleans and aliases become variables, merged as the variables JSON is.
A plain file fills the default mode of the same-named collection.
Composite tokens are skipped and counted in the warnings.
node.create (and the MCP create_node tool) takes children: node.create
params made inside the new layer, each with its own children, in one
command and one undo step. The result mirrors the tree, so a batch step
names any layer in it with a field path (children/1/id). A refused
child names its place (children[1].children[0]: ...) and nothing is
made.
Unlinking the copied styles for a paste into another file cleared
cornerStyle too, which then failed as a bad value: it is a value
(round, chamfer, concave), not a link. Both paths now share one check.
An edit that turned another layer Fixed (a child set to Fill turning its
hugging parent Fixed, a frame set to Hug turning the children that filled
it Fixed) only showed the canvas notice, so a script got no hint why a
frame stopped growing. node.set now lists each such layer in `warnings`
with its id, name, key and old sizing.
A variant grown or moved past a component set that clips and has no auto
layout keeps being cut off (the set is sized only when variants are
combined or added). node.set now names such a variant in `warnings` and
points at layout.add on the set.
An ignored release test that builds a 120k-layer file over 15 pages and
times the server's welcome, Client::join and the engine opening it
through live_poll, for the delta catch-up and the full snapshot:
cargo test --release -p figcraft-engine --lib join_timings -- --ignored --nocapture
It runs natively, where the web heap's page-by-page growth doesn't
happen, so it times decode and apply work only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replica::from_snapshot borrowed the changes and cloned the whole
Vec<Change> before applying it, because the review-settings clamp
rewrites some of them in place. Every caller already owns the snapshot
(Client::join, the rejoin path, Server::restore), so it now takes the
Vec by value: a large file's snapshot is no longer copied and then
dropped twice on the way in. The server's publish path still borrows
and copies explicitly.
In a wasm32 build joining a 120k-layer file through the full-snapshot
catch-up (what an older server sends), this cut peak memory from 722 MiB
to 455 MiB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main moved figcraft-cli to RFC-0018 (#2645): main.rs is a thin wrapper and the
dispatch lives in lib.rs, so mcp_roots, the --automation-allow-server handling
and its test move there; headless mcp is checked before the fonts are scanned.
The ring stroke moved into draw::ring on main; its round-corner guard keeps this
branch's corner-style check. pt-BR.toml goes back to main's: translations are
added in storytold/craft-i18n, and this branch had renamed "Individual corners"
to "Ajustes da borda" (edge settings).