From 0ab000b74b29e2f691b59386f46997107453fc3b Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 15:46:57 -0400
Subject: [PATCH 01/23] ci: add SonarCloud scan via shared reusable workflow
Calls storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main
with secrets: inherit. Adds SonarCloud badge to README where missing and
removes the redundant sonar-project.properties (config now passed by the
reusable workflow).
---
.github/workflows/sonarcloud.yml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 .github/workflows/sonarcloud.yml
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
new file mode 100644
index 00000000..ecee45a6
--- /dev/null
+++ b/.github/workflows/sonarcloud.yml
@@ -0,0 +1,20 @@
+name: SonarCloud
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: sonarcloud-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ sonarcloud:
+ # Tracked at @main so org-wide CI improvements propagate without PR churn.
+ uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main
+ secrets: inherit
From c1a4f2d954edee6c00a8e2f28decef01b7555682 Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 16:00:36 -0400
Subject: [PATCH 02/23] ci: add sonar-project.properties for CI-based analysis
Marks the project ineligible for SonarCloud Automatic Analysis, resolving the
CI-vs-automatic-analysis conflict so the SonarCloud workflow succeeds.
---
sonar-project.properties | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 sonar-project.properties
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 00000000..92562d54
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,2 @@
+sonar.projectKey=storytold_figcraft
+sonar.organization=storytold
From cb7966556ccc54cd47caaaacced815c8b275b885 Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 19:36:11 -0400
Subject: [PATCH 03/23] security: enforce HTTPS on curl downloads (SonarCloud
S6506) (#1016)
Add --proto '=https' to curl invocations so redirects cannot downgrade to
plaintext HTTP. Resolves SonarCloud S6506 (shell/docker/githubactions).
---
packaging/linux/package.sh | 2 +-
packaging/server/install.sh | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh
index 20da2f76..d38dc0bc 100755
--- a/packaging/linux/package.sh
+++ b/packaging/linux/package.sh
@@ -121,7 +121,7 @@ if has appimage; then
if [ -z "$TOOL" ]; then
TOOL="$CARGO_TARGET_DIR/appimagetool-$ARCH.AppImage"
if [ ! -x "$TOOL" ]; then
- curl -fsSL -o "$TOOL" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
+ curl --proto '=https' -fsSL -o "$TOOL" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
chmod +x "$TOOL"
fi
fi
diff --git a/packaging/server/install.sh b/packaging/server/install.sh
index 11c489a3..826c2bb4 100755
--- a/packaging/server/install.sh
+++ b/packaging/server/install.sh
@@ -147,7 +147,7 @@ FILES="$HERE" # where the units and the Caddyfile come from
from_release() { # download and check the release archive; sets NEW_BIN and FILES
local version="$VERSION" name dir
if [ -z "$version" ]; then
- version="$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p' | head -n 1)" || return 1
+ version="$(curl --proto '=https' -fsSL "https://api.github.com/repos/$REPO/releases/latest" | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p' | head -n 1)" || return 1
[ -n "$version" ] || return 1
fi
name="figcraft-server-$version-linux-$ARCH"
@@ -155,8 +155,8 @@ from_release() { # download and check the release archive; sets NEW_BIN and FILE
rm -rf "$dir"
mkdir -p "$dir"
say "Downloading $name"
- curl -fsSL -o "$dir/$name.tar.gz" "https://github.com/$REPO/releases/download/v$version/$name.tar.gz" || return 1
- curl -fsSL -o "$dir/SHA256SUMS.txt" "https://github.com/$REPO/releases/download/v$version/SHA256SUMS.txt" || return 1
+ curl --proto '=https' -fsSL -o "$dir/$name.tar.gz" "https://github.com/$REPO/releases/download/v$version/$name.tar.gz" || return 1
+ curl --proto '=https' -fsSL -o "$dir/SHA256SUMS.txt" "https://github.com/$REPO/releases/download/v$version/SHA256SUMS.txt" || return 1
(cd "$dir" && grep " $name.tar.gz\$" SHA256SUMS.txt | sha256sum -c --quiet -) || die "the download doesn't match SHA256SUMS.txt"
tar -C "$dir" -xzf "$dir/$name.tar.gz"
NEW_BIN="$dir/$name/figcraft-server"
From a86897dc919b8ae7fb0142fe7e0034c10715f7d9 Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 19:36:23 -0400
Subject: [PATCH 04/23] ci: pin GitHub Actions to full commit SHA (SonarCloud
githubactions:S7637) (#1015)
Pin third-party actions to full-length commit SHAs (with version comments)
instead of mutable tags/branches to prevent supply-chain tampering via
retagged releases. Resolves SonarCloud rule githubactions:S7637.
---
.github/workflows/ci.yml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9700a8e9..3dfa31d9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -42,12 +42,12 @@ jobs:
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev \
libgl1-mesa-dev libgtk-3-dev
- - uses: dtolnay/rust-toolchain@stable
+ - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
components: clippy, rustfmt
# Only main saves caches; PRs restore main's, so PR caches don't evict main's.
- - uses: Swatinem/rust-cache@v2
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-on-failure: true
@@ -75,10 +75,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- - uses: dtolnay/rust-toolchain@stable
+ - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
targets: wasm32-unknown-unknown
- - uses: Swatinem/rust-cache@v2
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: wasm32
save-if: ${{ github.ref == 'refs/heads/main' }}
From ce8a224c9e7c5bd7725abec202c707903e42cb76 Mon Sep 17 00:00:00 2001
From: bflatastic
Date: Thu, 22 Oct 2026 17:57:45 +0700
Subject: [PATCH 05/23] README: the app icon above the title
---
README.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 63bc739b..ebbf7fa0 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,10 @@
+
+
+
+
FigCraft
From 0e3876e6d6ce0f81ad71047d681fb62f69ce36f4 Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 07:52:34 -0400
Subject: [PATCH 06/23] Use chrono for UTC/calendar conversion instead of
hand-rolled copies
Replaces the two hand-rolled Howard Hinnant days-from-civil copies with chrono
as a workspace dependency:
- crates/collab/src/message.rs: utc_date (YYYY-MM-DD HH:MM UTC)
- crates/ui-egui/src/home_recents.rs: date (Mon D, YYYY, UTC; keeps the
translated month names and trf formatting)
Output is unchanged. Neither function had a test, so each gains one pinning the
exact strings the old code produced (leap days included). chrono uses only std,
so wasm stays safe. AGENTS.md/CLAUDE.md now say time goes through chrono.
Follow-up to storytold/cadcraft#1785
---
AGENTS.md | 1 +
CLAUDE.md | 1 +
Cargo.lock | 11 +++++++++++
Cargo.toml | 2 ++
crates/collab/Cargo.toml | 1 +
crates/collab/src/message.rs | 31 +++++++++++++++++-------------
crates/ui-egui/Cargo.toml | 1 +
crates/ui-egui/src/home_recents.rs | 28 +++++++++++++++++----------
8 files changed, 53 insertions(+), 23 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 708da805..51157976 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -81,6 +81,7 @@ code.
L6 depends on egui/eframe/rfd/winit. **The UI crate is swappable.**
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.set_props(ids, props)`. Colours come from `theme::Tokens`.
+- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string.
- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
### Quality gates (before every commit)
diff --git a/CLAUDE.md b/CLAUDE.md
index 708da805..51157976 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -81,6 +81,7 @@ code.
L6 depends on egui/eframe/rfd/winit. **The UI crate is swappable.**
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.set_props(ids, props)`. Colours come from `theme::Tokens`.
+- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string.
- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
### Quality gates (before every commit)
diff --git a/Cargo.lock b/Cargo.lock
index 459c8320..d2052d22 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -742,6 +742,15 @@ dependencies = [
"rand_core 0.10.1",
]
+[[package]]
+name = "chrono"
+version = "0.4.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
+dependencies = [
+ "num-traits",
+]
+
[[package]]
name = "clipboard-win"
version = "5.4.1"
@@ -1499,6 +1508,7 @@ name = "figcraft-collab"
version = "0.9.0"
dependencies = [
"base64 0.22.1",
+ "chrono",
"figcraft-color",
"figcraft-doc",
"figcraft-geom",
@@ -1744,6 +1754,7 @@ name = "figcraft-ui-egui"
version = "0.9.0"
dependencies = [
"base64 0.22.1",
+ "chrono",
"egui",
"egui_extras",
"figcraft-color",
diff --git a/Cargo.toml b/Cargo.toml
index 6cc17546..7bc0b082 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,6 +45,8 @@ serde = { version = "1", features = ["derive", "rc"] }
serde_json = { version = "1", features = ["float_roundtrip"] }
regex = "1.13"
log = "0.4"
+# All date/time conversion goes through chrono (no hand-rolled calendar code; AGENTS.md).
+chrono = { version = "0.4.45", default-features = false, features = ["std"] }
proptest = "1"
imbl = { version = "7", features = ["serde"] }
postcard = { version = "1", default-features = false, features = ["alloc"] }
diff --git a/crates/collab/Cargo.toml b/crates/collab/Cargo.toml
index 89a79687..ed85201d 100644
--- a/crates/collab/Cargo.toml
+++ b/crates/collab/Cargo.toml
@@ -13,6 +13,7 @@ figcraft-doc = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
+chrono = { workspace = true }
imbl = { workspace = true }
base64 = { workspace = true }
postcard = { workspace = true }
diff --git a/crates/collab/src/message.rs b/crates/collab/src/message.rs
index d035042b..71e69461 100644
--- a/crates/collab/src/message.rs
+++ b/crates/collab/src/message.rs
@@ -699,19 +699,8 @@ pub enum ServerMsg {
/// `YYYY-MM-DD HH:MM UTC` for seconds since 1970 (how servers and apps show the times in these
/// messages).
pub fn utc_date(secs: u64) -> String {
- let days = i64::try_from(secs / 86_400).unwrap_or(0);
- let (h, m) = ((secs % 86_400) / 3600, (secs % 3600) / 60);
- // Days to a civil date (proleptic Gregorian).
- let z = days + 719_468;
- let era = z.div_euclid(146_097);
- let doe = z.rem_euclid(146_097);
- let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;
- let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
- let mp = (5 * doy + 2) / 153;
- let d = doy - (153 * mp + 2) / 5 + 1;
- let mo = if mp < 10 { mp + 3 } else { mp - 9 };
- let y = yoe + era * 400 + i64::from(mo <= 2);
- format!("{y:04}-{mo:02}-{d:02} {h:02}:{m:02} UTC")
+ let t = i64::try_from(secs).ok().and_then(|s| chrono::DateTime::from_timestamp(s, 0)).unwrap_or_default();
+ t.format("%Y-%m-%d %H:%M UTC").to_string()
}
/// The binary form of `msg`: [`WIRE_VERSION`], then postcard.
@@ -752,3 +741,19 @@ pub fn decode_json(text: &str, max_bytes: usize) -> Result<
}
serde_json::from_str(text).map_err(|e| Error::Decode(e.to_string()))
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// `utc_date` keeps the exact `YYYY-MM-DD HH:MM UTC` output the hand-rolled civil-from-days
+ /// code produced (leap days and all).
+ #[test]
+ fn utc_date_formats_seconds_since_1970() {
+ assert_eq!(utc_date(0), "1970-01-01 00:00 UTC");
+ assert_eq!(utc_date(1_000_000), "1970-01-12 13:46 UTC");
+ assert_eq!(utc_date(951_782_400), "2000-02-29 00:00 UTC");
+ assert_eq!(utc_date(1_709_164_800), "2024-02-29 00:00 UTC");
+ assert_eq!(utc_date(1_791_208_980), "2026-10-05 14:03 UTC");
+ }
+}
diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml
index 65a3592d..09cd2226 100644
--- a/crates/ui-egui/Cargo.toml
+++ b/crates/ui-egui/Cargo.toml
@@ -22,6 +22,7 @@ egui = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
log = { workspace = true }
+chrono = { workspace = true }
base64 = { workspace = true }
image = { workspace = true }
egui_extras = { workspace = true }
diff --git a/crates/ui-egui/src/home_recents.rs b/crates/ui-egui/src/home_recents.rs
index 81d68240..dcfd1aa2 100644
--- a/crates/ui-egui/src/home_recents.rs
+++ b/crates/ui-egui/src/home_recents.rs
@@ -10,6 +10,7 @@
use std::collections::HashMap;
use std::path::Path;
+use chrono::Datelike;
use egui::{Align2, Color32, CornerRadius, Id, Key, Rect, Response, Sense, Stroke, StrokeKind, Ui, pos2, vec2};
use figcraft_engine::Prefs;
use figcraft_format::thumbnail::{FileKind, Preview};
@@ -202,16 +203,8 @@ const MONTHS: [&str; 12] = [
/// `secs` since 1970 as a date in UTC: "Mar 4, 2026".
fn date(secs: u64) -> String {
- // Days to a civil date (Howard Hinnant's days_from_civil, inverted).
- let z = i64::try_from(secs / 86_400).unwrap_or(0) + 719_468;
- let era = z.div_euclid(146_097);
- let doe = z.rem_euclid(146_097);
- let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;
- let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
- let mp = (5 * doy + 2) / 153;
- let day = doy - (153 * mp + 2) / 5 + 1;
- let month = if mp < 10 { mp + 3 } else { mp - 9 };
- let year = yoe + era * 400 + i64::from(month <= 2);
+ let dt = i64::try_from(secs).ok().and_then(|s| chrono::DateTime::from_timestamp(s, 0)).unwrap_or_default().naive_utc();
+ let (year, month, day) = (i64::from(dt.year()), i64::from(dt.month()), i64::from(dt.day()));
let name = usize::try_from(month - 1).ok().and_then(|m| MONTHS.get(m)).map_or("", |m| tr(m));
trf("{month} {day}, {year}", &[("month", &name), ("day", &day), ("year", &year)])
}
@@ -965,3 +958,18 @@ fn list(ui: &mut Ui, t: &Tokens, recents: &mut Recents, files: &[Shown], now: u6
arrows(ui, recents, files, 0, 1);
action
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// `date` keeps the exact "Mon D, YYYY" (UTC) output the hand-rolled days-from-civil code
+ /// produced. With no catalog loaded the month and format strings pass through in English.
+ #[test]
+ fn date_formats_seconds_since_1970_in_utc() {
+ assert_eq!(date(0), "Jan 1, 1970");
+ assert_eq!(date(951_782_400), "Feb 29, 2000");
+ assert_eq!(date(1_709_164_800), "Feb 29, 2024");
+ assert_eq!(date(1_741_046_400), "Mar 4, 2025");
+ }
+}
From 630e0dd4034e41058863696a3579ecfe8abf37ae Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 09:11:43 -0400
Subject: [PATCH 07/23] Keep 5-digit years unprefixed in utc_date
chrono's %Y writes a '+' before years past 9999, whereas the old hand-rolled
{y:04} did not. utc_date now writes the year with {:04} to keep the exact old
output. from_timestamp already reads a clock past chrono's range as the epoch
rather than panicking. Tests cover the 5-digit-year and out-of-range cases.
---
crates/collab/src/message.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/crates/collab/src/message.rs b/crates/collab/src/message.rs
index 71e69461..fb14924a 100644
--- a/crates/collab/src/message.rs
+++ b/crates/collab/src/message.rs
@@ -697,10 +697,12 @@ pub enum ServerMsg {
}
/// `YYYY-MM-DD HH:MM UTC` for seconds since 1970 (how servers and apps show the times in these
-/// messages).
+/// messages). A time past the last date chrono can represent (year 262143) reads as the epoch.
pub fn utc_date(secs: u64) -> String {
+ use chrono::Datelike;
let t = i64::try_from(secs).ok().and_then(|s| chrono::DateTime::from_timestamp(s, 0)).unwrap_or_default();
- t.format("%Y-%m-%d %H:%M UTC").to_string()
+ // `{:04}` rather than `%Y`, which writes a `+` before years past 9999 (the old `{y:04}` did not).
+ format!("{:04}-{}", t.year(), t.format("%m-%d %H:%M UTC"))
}
/// The binary form of `msg`: [`WIRE_VERSION`], then postcard.
@@ -755,5 +757,9 @@ mod tests {
assert_eq!(utc_date(951_782_400), "2000-02-29 00:00 UTC");
assert_eq!(utc_date(1_709_164_800), "2024-02-29 00:00 UTC");
assert_eq!(utc_date(1_791_208_980), "2026-10-05 14:03 UTC");
+ // A year past 9999 keeps the plain zero-padded year (no `+`), as the old `{y:04}` did.
+ assert_eq!(utc_date(253_402_300_800), "10000-01-01 00:00 UTC");
+ // Past chrono's range reads as the epoch instead of panicking.
+ assert_eq!(utc_date(u64::MAX), "1970-01-01 00:00 UTC");
}
}
From e3169e5a61401d4981ddbd43c10a5cc9a32c2ace Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 17:18:14 -0400
Subject: [PATCH 08/23] collab/ui-egui: keep old UTC output past chrono's year
range
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
`utc_date` (collab) and `date` (ui-egui) took `u64` seconds, which the old
hand-rolled civil-from-days code converted for the whole `u64` range. The
chrono rewrite used `from_timestamp(..).unwrap_or_default()`, so any instant
past chrono's own year limit (262143) silently became the epoch — changing
existing output. `u64::MAX` seconds, for example, used to read
`584554051223-11-09 07:00 UTC` / `Nov 9, 584554051223`, not 1970.
Fix: add a `utc_parts(days, sod, nanos)` helper per crate that moves the
instant into chrono's range by whole 400-year Gregorian cycles (146_097 days),
lets chrono do the month/day/time, and restores the real year afterwards.
chrono stays the only calendar logic; the cycle count just shifts the year, and
every `u64` day count fits in `i64` so the conversion is always exact (no epoch
fallback). Split seconds with `u64` arithmetic first to avoid the `i64` seconds
overflow near `u64::MAX`, matching the old code.
Tests now pin the old output instead of the epoch:
- collab utc_date(u64::MAX) == "584554051223-11-09 07:00 UTC"
(and utc_date(253_402_300_800) == "10000-01-01 00:00 UTC", already pinned)
- ui-egui date(253_402_300_800) == "Jan 1, 10000"
date(u64::MAX) == "Nov 9, 584554051223"
---
crates/collab/src/message.rs | 43 ++++++++++++++++++++++++------
crates/ui-egui/src/home_recents.rs | 37 ++++++++++++++++++++++---
2 files changed, 69 insertions(+), 11 deletions(-)
diff --git a/crates/collab/src/message.rs b/crates/collab/src/message.rs
index fb14924a..4fda776a 100644
--- a/crates/collab/src/message.rs
+++ b/crates/collab/src/message.rs
@@ -696,13 +696,38 @@ pub enum ServerMsg {
},
}
-/// `YYYY-MM-DD HH:MM UTC` for seconds since 1970 (how servers and apps show the times in these
-/// messages). A time past the last date chrono can represent (year 262143) reads as the epoch.
-pub fn utc_date(secs: u64) -> String {
+/// (days since 1970-01-01, seconds-of-day, nanos) → (proleptic Gregorian year, the same wall-clock
+/// instant moved into chrono's range by whole 400-year cycles). The calendar repeats every 400
+/// years (146_097 days), so month, day and time of day come from chrono and only the year is
+/// carried, which keeps the result exact for any `i64` day count. This is not hand-rolled calendar
+/// math: chrono still does the date, the cycle count just shifts the year.
+fn utc_parts(days: i64, sod: u32, nanos: u32) -> (i64, chrono::NaiveDateTime) {
use chrono::Datelike;
- let t = i64::try_from(secs).ok().and_then(|s| chrono::DateTime::from_timestamp(s, 0)).unwrap_or_default();
- // `{:04}` rather than `%Y`, which writes a `+` before years past 9999 (the old `{y:04}` did not).
- format!("{:04}-{}", t.year(), t.format("%m-%d %H:%M UTC"))
+ let (cycles, rest) = (days.div_euclid(146_097), days.rem_euclid(146_097));
+ // `rest + 719_163` (1970-01-01 is CE day 719_163) is always a valid CE day, and `sod` < 86_400.
+ let date = i32::try_from(rest + 719_163).ok().and_then(chrono::NaiveDate::from_num_days_from_ce_opt);
+ let time = chrono::NaiveTime::from_num_seconds_from_midnight_opt(sod.min(86_399), nanos.min(999_999_999));
+ match (date, time) {
+ (Some(d), Some(t)) => {
+ let y = i128::from(d.year()) + i128::from(cycles) * 400;
+ (i64::try_from(y).unwrap_or(if y < 0 { i64::MIN } else { i64::MAX }), d.and_time(t))
+ }
+ _ => (1970, chrono::NaiveDateTime::default()), // unreachable
+ }
+}
+
+/// `YYYY-MM-DD HH:MM UTC` for seconds since 1970 (how servers and apps show the times in these
+/// messages). Years past chrono's own range (262143) keep converting: the instant is moved into
+/// range by whole 400-year cycles and the real year restored, so every `u64` reads as the date the
+/// old hand-rolled conversion produced (e.g. `u64::MAX` → `584554051223-11-09 07:00 UTC`).
+pub fn utc_date(secs: u64) -> String {
+ // The day count of any `u64` seconds fits in `i64` (`u64::MAX / 86_400` ≈ 2.1e14), and the
+ // seconds-of-day is < 86_400, so the conversion is always exact (no epoch fallback). Splitting
+ // with `u64` arithmetic (as the old code did) avoids the `i64` seconds overflow near `u64::MAX`.
+ let (days, sod) = (i64::try_from(secs / 86_400).unwrap_or(i64::MAX), (secs % 86_400) as u32);
+ let (y, t) = utc_parts(days, sod, 0);
+ // `{y:04}` rather than `%Y`, which writes a `+` before years past 9999 (the old code did not).
+ format!("{y:04}-{}", t.format("%m-%d %H:%M UTC"))
}
/// The binary form of `msg`: [`WIRE_VERSION`], then postcard.
@@ -759,7 +784,9 @@ mod tests {
assert_eq!(utc_date(1_791_208_980), "2026-10-05 14:03 UTC");
// A year past 9999 keeps the plain zero-padded year (no `+`), as the old `{y:04}` did.
assert_eq!(utc_date(253_402_300_800), "10000-01-01 00:00 UTC");
- // Past chrono's range reads as the epoch instead of panicking.
- assert_eq!(utc_date(u64::MAX), "1970-01-01 00:00 UTC");
+ // Past chrono's own year range (262143) the instant is moved into range by whole 400-year
+ // cycles and the real year restored, so it keeps the old hand-rolled output instead of
+ // falling back to the epoch.
+ assert_eq!(utc_date(u64::MAX), "584554051223-11-09 07:00 UTC");
}
}
diff --git a/crates/ui-egui/src/home_recents.rs b/crates/ui-egui/src/home_recents.rs
index dcfd1aa2..ca50d78f 100644
--- a/crates/ui-egui/src/home_recents.rs
+++ b/crates/ui-egui/src/home_recents.rs
@@ -201,10 +201,35 @@ const MONTHS: [&str; 12] = [
tr_noop("Dec"),
];
-/// `secs` since 1970 as a date in UTC: "Mar 4, 2026".
+/// (days since 1970-01-01, seconds-of-day, nanos) → (proleptic Gregorian year, the same wall-clock
+/// instant moved into chrono's range by whole 400-year cycles). The calendar repeats every 400
+/// years (146_097 days), so month, day and time of day come from chrono and only the year is
+/// carried, which keeps the result exact for any `i64` day count. This is not hand-rolled calendar
+/// math: chrono still does the date, the cycle count just shifts the year.
+fn utc_parts(days: i64, sod: u32, nanos: u32) -> (i64, chrono::NaiveDateTime) {
+ let (cycles, rest) = (days.div_euclid(146_097), days.rem_euclid(146_097));
+ // `rest + 719_163` (1970-01-01 is CE day 719_163) is always a valid CE day, and `sod` < 86_400.
+ let date = i32::try_from(rest + 719_163).ok().and_then(chrono::NaiveDate::from_num_days_from_ce_opt);
+ let time = chrono::NaiveTime::from_num_seconds_from_midnight_opt(sod.min(86_399), nanos.min(999_999_999));
+ match (date, time) {
+ (Some(d), Some(t)) => {
+ let y = i128::from(d.year()) + i128::from(cycles) * 400;
+ (i64::try_from(y).unwrap_or(if y < 0 { i64::MIN } else { i64::MAX }), d.and_time(t))
+ }
+ _ => (1970, chrono::NaiveDateTime::default()), // unreachable
+ }
+}
+
+/// `secs` since 1970 as a date in UTC: "Mar 4, 2026". Years past chrono's own range (262143) keep
+/// converting: the instant is moved into range by whole 400-year cycles and the real year restored,
+/// so every `u64` reads as the date the old hand-rolled conversion produced.
fn date(secs: u64) -> String {
- let dt = i64::try_from(secs).ok().and_then(|s| chrono::DateTime::from_timestamp(s, 0)).unwrap_or_default().naive_utc();
- let (year, month, day) = (i64::from(dt.year()), i64::from(dt.month()), i64::from(dt.day()));
+ // The day count of any `u64` seconds fits in `i64` (`u64::MAX / 86_400` ≈ 2.1e14), so the
+ // conversion is always exact (no epoch fallback). Splitting with `u64` arithmetic (as the old
+ // code did) avoids the `i64` seconds overflow near `u64::MAX`.
+ let (days, sod) = (i64::try_from(secs / 86_400).unwrap_or(i64::MAX), (secs % 86_400) as u32);
+ let (year, dt) = utc_parts(days, sod, 0);
+ let (month, day) = (i64::from(dt.month()), i64::from(dt.day()));
let name = usize::try_from(month - 1).ok().and_then(|m| MONTHS.get(m)).map_or("", |m| tr(m));
trf("{month} {day}, {year}", &[("month", &name), ("day", &day), ("year", &year)])
}
@@ -971,5 +996,11 @@ mod tests {
assert_eq!(date(951_782_400), "Feb 29, 2000");
assert_eq!(date(1_709_164_800), "Feb 29, 2024");
assert_eq!(date(1_741_046_400), "Mar 4, 2025");
+ // A year past chrono's own `NaiveDate` range (262143): the instant is moved into range by
+ // whole 400-year cycles and the real year restored.
+ assert_eq!(date(253_402_300_800), "Jan 1, 10000");
+ // Past chrono's year range, `u64::MAX` keeps the old hand-rolled output instead of falling
+ // back to the epoch.
+ assert_eq!(date(u64::MAX), "Nov 9, 584554051223");
}
}
From a0e937918c0f3923570a68933924ba44f0af6fef Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 18:29:17 -0400
Subject: [PATCH 09/23] Name the 400-year range extension as the one exception
to the time rule
The rule said never to hand-roll calendar math, but the range fix
(shifting by whole 400-year Gregorian cycles so dates past chrono's year
range keep their old output) is cycle arithmetic, so the rule and the code
disagreed. The rule now names that exception: the library still computes
month, day and time, and only whole cycles are carried in the year.
---
AGENTS.md | 2 +-
CLAUDE.md | 2 +-
Cargo.toml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 51157976..80c55db5 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -81,7 +81,7 @@ code.
L6 depends on egui/eframe/rfd/winit. **The UI crate is swappable.**
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.set_props(ids, props)`. Colours come from `theme::Tokens`.
-- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string.
+- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string. The one exception is range extension: past the years chrono can represent, shift the date by whole 400-year Gregorian cycles (146,097 days, after which the calendar repeats), let chrono compute the month, day and time, and add the cycles back to the year.
- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
### Quality gates (before every commit)
diff --git a/CLAUDE.md b/CLAUDE.md
index 51157976..80c55db5 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -81,7 +81,7 @@ code.
L6 depends on egui/eframe/rfd/winit. **The UI crate is swappable.**
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.set_props(ids, props)`. Colours come from `theme::Tokens`.
-- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string.
+- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string. The one exception is range extension: past the years chrono can represent, shift the date by whole 400-year Gregorian cycles (146,097 days, after which the calendar repeats), let chrono compute the month, day and time, and add the cycles back to the year.
- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
### Quality gates (before every commit)
diff --git a/Cargo.toml b/Cargo.toml
index 7bc0b082..b6fb2704 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,7 +45,7 @@ serde = { version = "1", features = ["derive", "rc"] }
serde_json = { version = "1", features = ["float_roundtrip"] }
regex = "1.13"
log = "0.4"
-# All date/time conversion goes through chrono (no hand-rolled calendar code; AGENTS.md).
+# All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md).
chrono = { version = "0.4.45", default-features = false, features = ["std"] }
proptest = "1"
imbl = { version = "7", features = ["serde"] }
From 9ec80bf2c2b6ad8eb34c2fec374ccab4a8219e0d Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Wed, 21 Oct 2026 19:07:03 -0400
Subject: [PATCH 10/23] Say the library computes month and day; time-of-day is
plain arithmetic
Narrows the range-extension wording: the date library computes the
calendar fields, and splitting seconds into hours, minutes and seconds
is ordinary arithmetic, which is what the code does.
---
AGENTS.md | 2 +-
CLAUDE.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 80c55db5..b2384311 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -81,7 +81,7 @@ code.
L6 depends on egui/eframe/rfd/winit. **The UI crate is swappable.**
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.set_props(ids, props)`. Colours come from `theme::Tokens`.
-- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string. The one exception is range extension: past the years chrono can represent, shift the date by whole 400-year Gregorian cycles (146,097 days, after which the calendar repeats), let chrono compute the month, day and time, and add the cycles back to the year.
+- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string. The one exception is range extension: past the years chrono can represent, shift the date by whole 400-year Gregorian cycles (146,097 days, after which the calendar repeats), let chrono compute the month and day, and add the cycles back to the year (splitting seconds into hours, minutes and seconds is plain arithmetic).
- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
### Quality gates (before every commit)
diff --git a/CLAUDE.md b/CLAUDE.md
index 80c55db5..b2384311 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -81,7 +81,7 @@ code.
L6 depends on egui/eframe/rfd/winit. **The UI crate is swappable.**
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.set_props(ids, props)`. Colours come from `theme::Tokens`.
-- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string. The one exception is range extension: past the years chrono can represent, shift the date by whole 400-year Gregorian cycles (146,097 days, after which the calendar repeats), let chrono compute the month, day and time, and add the cycles back to the year.
+- **Time goes through `chrono`** (workspace dependency). Never hand-roll UTC/calendar conversion (days-to-date algorithms, leap-year math); a crate owns only its output format string. The one exception is range extension: past the years chrono can represent, shift the date by whole 400-year Gregorian cycles (146,097 days, after which the calendar repeats), let chrono compute the month and day, and add the cycles back to the year (splitting seconds into hours, minutes and seconds is plain arithmetic).
- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
### Quality gates (before every commit)
From 80f916326fb94f3a88cb24e64f396f564a0ebc06 Mon Sep 17 00:00:00 2001
From: Brandon Thomas
Date: Thu, 22 Oct 2026 15:39:04 -0400
Subject: [PATCH 11/23] Release 0.10.0
Co-Authored-By: Claude Opus 5.5
---
Cargo.lock | 42 +++++++++++++++++++++---------------------
Cargo.toml | 2 +-
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index d2052d22..27cb0d4e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1465,7 +1465,7 @@ checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693"
[[package]]
name = "figcraft"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"arboard",
"craft-window",
@@ -1491,7 +1491,7 @@ dependencies = [
[[package]]
name = "figcraft-cli"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-doc",
"figcraft-engine",
@@ -1505,7 +1505,7 @@ dependencies = [
[[package]]
name = "figcraft-collab"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -1521,7 +1521,7 @@ dependencies = [
[[package]]
name = "figcraft-collab-net"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"base64 0.22.1",
"figcraft-collab",
@@ -1544,7 +1544,7 @@ dependencies = [
[[package]]
name = "figcraft-color"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"kurbo",
"serde",
@@ -1553,7 +1553,7 @@ dependencies = [
[[package]]
name = "figcraft-doc"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-color",
"figcraft-geom",
@@ -1565,7 +1565,7 @@ dependencies = [
[[package]]
name = "figcraft-engine"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"base64 0.22.1",
"craft-docpath",
@@ -1593,7 +1593,7 @@ dependencies = [
[[package]]
name = "figcraft-format"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-doc",
"figcraft-pathops",
@@ -1608,7 +1608,7 @@ dependencies = [
[[package]]
name = "figcraft-geom"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"kurbo",
"serde",
@@ -1616,7 +1616,7 @@ dependencies = [
[[package]]
name = "figcraft-layout"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-doc",
"figcraft-geom",
@@ -1624,7 +1624,7 @@ dependencies = [
[[package]]
name = "figcraft-mcp"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"base64 0.22.1",
"figcraft-collab-net",
@@ -1640,7 +1640,7 @@ dependencies = [
[[package]]
name = "figcraft-pathops"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-doc",
"figcraft-geom",
@@ -1649,7 +1649,7 @@ dependencies = [
[[package]]
name = "figcraft-pdf"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-color",
"figcraft-doc",
@@ -1666,7 +1666,7 @@ dependencies = [
[[package]]
name = "figcraft-plugin"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-color",
"serde",
@@ -1679,7 +1679,7 @@ dependencies = [
[[package]]
name = "figcraft-render"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"crc32fast",
"figcraft-color",
@@ -1697,7 +1697,7 @@ dependencies = [
[[package]]
name = "figcraft-server"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"crc32fast",
"ctrlc",
@@ -1721,7 +1721,7 @@ dependencies = [
[[package]]
name = "figcraft-svg"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"base64 0.22.1",
"figcraft-color",
@@ -1737,7 +1737,7 @@ dependencies = [
[[package]]
name = "figcraft-text"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-doc",
"figcraft-geom",
@@ -1751,7 +1751,7 @@ dependencies = [
[[package]]
name = "figcraft-ui-egui"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -1777,7 +1777,7 @@ dependencies = [
[[package]]
name = "figcraft-web"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"eframe",
"egui",
@@ -5882,7 +5882,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee"
[[package]]
name = "xtask"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"figcraft-engine",
"serde_json",
diff --git a/Cargo.toml b/Cargo.toml
index b6fb2704..95c956d5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ exclude = ["plugins"]
# default-members = ["crates/*", "apps/figcraft", "apps/figcraft-cli", "xtask"]
[workspace.package]
-version = "0.9.0"
+version = "0.10.0"
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.95"
From 32735549c4d05e2b8f8dd163e2d9b038775f24bc Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Fri, 23 Oct 2026 09:29:39 -0400
Subject: [PATCH 12/23] test: explain the discarded reads in the fake servers
(SonarCloud)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
read() returns Result, not a lock guard; these test loops
deliberately ignore what the client sent first.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff
---
apps/figcraft-server/src/server_tests.rs | 4 +++-
crates/collab-net/src/code_tests.rs | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/apps/figcraft-server/src/server_tests.rs b/apps/figcraft-server/src/server_tests.rs
index 153bb5ab..f60150da 100644
--- a/apps/figcraft-server/src/server_tests.rs
+++ b/apps/figcraft-server/src/server_tests.rs
@@ -261,7 +261,9 @@ fn fuzzed_frames_dont_hurt_the_server() {
break;
}
}
- let _ = ws.read();
+ // read() returns Result, not a lock guard; the fuzz loop ends here on purpose and
+ // the close frame from the server is not interesting.
+ let _ = ws.read(); // NOSONAR
}
// Still serving, the file intact.
let mut b = join(&p.edit, "Bo");
diff --git a/crates/collab-net/src/code_tests.rs b/crates/collab-net/src/code_tests.rs
index 4880242f..7fe766ec 100644
--- a/crates/collab-net/src/code_tests.rs
+++ b/crates/collab-net/src/code_tests.rs
@@ -141,7 +141,9 @@ fn old_server() -> (Endpoint, std::thread::JoinHandle<()>) {
let t = std::thread::spawn(move || {
for stream in listener.incoming().take(2).flatten() {
let Ok(mut ws) = tungstenite::accept(stream) else { continue };
- let _ = ws.read();
+ // read() returns Result, not a lock guard; this test server deliberately
+ // ignores whatever the client sent first.
+ let _ = ws.read(); // NOSONAR
let refused = ServerMsg::Refused { reason: "that message couldn't be read".into() };
let _ = ws.send(Message::Binary(Bytes::from(message::encode(&refused).unwrap())));
let _ = ws.close(None);
From 8d790607ff1ad40e32343ca2116d8fdcf3244c8d Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Fri, 23 Oct 2026 11:17:32 -0400
Subject: [PATCH 13/23] packaging: bash test and function hygiene (SonarCloud
S7688, S7679, S7682, S131, S7677) (#1201)
- Use [[ ]] instead of [ ] for conditional tests in the bash packaging scripts (S7688). Every
converted test compares quoted values to literals, so no pattern-matching change.
- Name positional parameters with locals inside functions (S7679).
- End the env.sh helpers with an explicit return that keeps their exit status (S7682).
- Give case statements a default branch (S131).
- Send the check-app-specific.sh error to stderr (S7677).
packaging/freebsd/package.sh is left alone while #1158 rewrites it.
---
packaging/check-app-specific.sh | 2 +-
packaging/env.sh | 26 ++++++----
packaging/linux/apprun-test.sh | 30 +++++------
packaging/linux/flatpak-bundle.sh | 10 ++--
packaging/linux/package.sh | 18 +++----
packaging/macos/import-cert.sh | 6 +--
packaging/macos/package.sh | 26 +++++-----
packaging/macos/verify.sh | 30 +++++------
packaging/server/install-test.sh | 6 +--
packaging/server/install.sh | 84 ++++++++++++++++---------------
packaging/server/package.sh | 3 +-
packaging/web/package.sh | 10 ++--
12 files changed, 131 insertions(+), 120 deletions(-)
diff --git a/packaging/check-app-specific.sh b/packaging/check-app-specific.sh
index ebf23c0b..e9b03946 100644
--- a/packaging/check-app-specific.sh
+++ b/packaging/check-app-specific.sh
@@ -6,7 +6,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.."
bash packaging/server/install-test.sh
if grep -rniE 'photoshop|psd|photocraft|vectorcraft|illustrator|adobe|figma' packaging/ .github/ \
--exclude=packaging-lint.yml --exclude=check-app-specific.sh; then
- echo "::error::package metadata mentions another product (see above)"
+ echo "::error::package metadata mentions another product (see above)" >&2
exit 1
fi
diff --git a/packaging/env.sh b/packaging/env.sh
index b68406a0..eb6547c9 100644
--- a/packaging/env.sh
+++ b/packaging/env.sh
@@ -24,10 +24,11 @@ workspace_version() {
/^\[/ { in_pkg = ($0 == "[workspace.package]") ; next }
in_pkg && $1 == "version" { gsub(/[" ]/, "", $3); print $3; exit }
' "$ROOT/Cargo.toml"
+ return $?
}
VERSION="${FIGCRAFT_VERSION:-$(workspace_version)}"
-if [ -z "$VERSION" ]; then
+if [[ -z "$VERSION" ]]; then
echo "error: could not read [workspace.package] version from $ROOT/Cargo.toml" >&2
exit 1
fi
@@ -37,7 +38,7 @@ DIST="${DIST:-$ROOT/dist/release}"
mkdir -p "$DIST"
export DIST
-if [ -z "${FIGCRAFT_BUILD_SHA:-}" ]; then
+if [[ -z "${FIGCRAFT_BUILD_SHA:-}" ]]; then
FIGCRAFT_BUILD_SHA="$(git -C "$ROOT" rev-parse HEAD 2>/dev/null || true)"
fi
export FIGCRAFT_BUILD_SHA
@@ -47,7 +48,7 @@ export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT/target}"
# The headless CLI ships next to the app once apps/figcraft-cli exists.
BINS=(figcraft)
HAS_CLI=0
-if [ -f "$ROOT/apps/figcraft-cli/Cargo.toml" ]; then
+if [[ -f "$ROOT/apps/figcraft-cli/Cargo.toml" ]]; then
BINS+=(figcraft-cli)
HAS_CLI=1
fi
@@ -58,7 +59,8 @@ unset _bin
# The binary used for a `--version` smoke test: the CLI when shipped, else the app (which answers
# --version before opening a window).
smoke_bin() {
- if [ "$HAS_CLI" = 1 ]; then echo figcraft-cli; else echo figcraft; fi
+ if [[ "$HAS_CLI" = 1 ]]; then echo figcraft-cli; else echo figcraft; fi
+ return 0
}
# Emit a GitHub Actions warning (plain stderr outside Actions).
@@ -68,31 +70,33 @@ retry() {
local attempt
for attempt in 1 2 3 4 5; do
"$@" && return 0
- [ "$attempt" = 5 ] || { echo "retrying ($attempt/5): $*" >&2; sleep 15; }
+ [[ "$attempt" = 5 ]] || { echo "retrying ($attempt/5): $*" >&2; sleep 15; }
done
return 1
}
warn() {
- if [ -n "${GITHUB_ACTIONS:-}" ]; then echo "::warning::$*"; else echo "warning: $*" >&2; fi
+ if [[ -n "${GITHUB_ACTIONS:-}" ]]; then echo "::warning::$*"; else echo "warning: $*" >&2; fi
+ return 0
}
# Copy licence and readme files that exist into a package directory.
copy_docs() {
local dest="$1" f
for f in README.md LICENSE LICENSE-MIT LICENSE-APACHE NOTICE COPYRIGHT; do
- if [ -f "$ROOT/$f" ]; then cp "$ROOT/$f" "$dest/"; fi
+ if [[ -f "$ROOT/$f" ]]; then cp "$ROOT/$f" "$dest/"; fi
done
copy_font_licences "$dest"
+ return $?
}
# Builds made with craft-fonts (CRAFT_FONTS_DIR, all official releases) embed its fonts, which
# are OFL-1.1: ship each font's licence as OFL-.txt. No-op without CRAFT_FONTS_DIR.
copy_font_licences() {
local dest="$1" lic fam
- [ -n "${CRAFT_FONTS_DIR:-}" ] || return 0
+ [[ -n "${CRAFT_FONTS_DIR:-}" ]] || return 0
for lic in "$CRAFT_FONTS_DIR"/fonts/*/OFL.txt; do
- [ -f "$lic" ] || continue
+ [[ -f "$lic" ]] || continue
fam="$(basename "$(dirname "$lic")")"
cp "$lic" "$dest/OFL-$fam.txt"
done
@@ -100,5 +104,7 @@ copy_font_licences() {
# Portable SHA-256 of a file (prints just the hash).
sha256() {
- if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
+ local file="$1"
+ if command -v sha256sum >/dev/null; then sha256sum "$file" | cut -d' ' -f1; else shasum -a 256 "$file" | cut -d' ' -f1; fi
+ return $?
}
diff --git a/packaging/linux/apprun-test.sh b/packaging/linux/apprun-test.sh
index c6d98da0..75625480 100755
--- a/packaging/linux/apprun-test.sh
+++ b/packaging/linux/apprun-test.sh
@@ -37,10 +37,10 @@ fail() {
# 1. Launch works and passes arguments through.
out="$("$APPDIR/AppRun" open file.png)" || fail "AppRun exited non-zero"
-[ "$out" = "stub: open file.png" ] || fail "arguments not forwarded: $out"
+[[ "$out" = "stub: open file.png" ]] || fail "arguments not forwarded: $out"
DESKTOP="$XDG_DATA_HOME/applications/$APP_ID.desktop"
-[ -f "$DESKTOP" ] || fail "desktop entry not installed"
+[[ -f "$DESKTOP" ]] || fail "desktop entry not installed"
# 2. Exec rewritten to the AppImage (quoted, spaces intact), TryExec dropped,
# everything else preserved from the packaged entry.
@@ -55,15 +55,15 @@ fi
# 3. Icons landed under the name the .desktop entry references.
for f in "16x16/apps/$APP_ID.png" "256x256/apps/$APP_ID.png" "scalable/apps/$APP_ID.svg"; do
- [ -f "$XDG_DATA_HOME/icons/hicolor/$f" ] || fail "icon missing: $f"
+ [[ -f "$XDG_DATA_HOME/icons/hicolor/$f" ]] || fail "icon missing: $f"
done
# 4. Idempotent: a second launch must not rewrite anything (inode unchanged).
before="$(stat -c %i "$DESKTOP")"
out="$("$APPDIR/AppRun")" || fail "second launch exited non-zero"
-[ "$out" = "stub: " ] || fail "second launch output: $out"
+[[ "$out" = "stub: " ]] || fail "second launch output: $out"
after="$(stat -c %i "$DESKTOP")"
-[ "$before" = "$after" ] || fail "desktop entry rewritten although unchanged"
+[[ "$before" = "$after" ]] || fail "desktop entry rewritten although unchanged"
# 5. Moving the AppImage refreshes Exec.
mv "$APPIMAGE" "$TMP/moved.AppImage"
@@ -74,40 +74,40 @@ grep -Fxq "Exec=\"$(readlink -f "$APPIMAGE")\" %U" "$DESKTOP" || fail "Exec not
# 6. Opt-out installs nothing.
rm -rf "$XDG_DATA_HOME"
FIGCRAFT_NO_DESKTOP_INTEGRATION=1 "$APPDIR/AppRun" >/dev/null || fail "opt-out launch exited non-zero"
-[ ! -e "$XDG_DATA_HOME" ] || fail "opt-out still integrated"
+[[ ! -e "$XDG_DATA_HOME" ]] || fail "opt-out still integrated"
# 7. An unwritable data dir never blocks the launch.
mkdir -p "$TMP/ro" && chmod a-w "$TMP/ro"
out="$(XDG_DATA_HOME="$TMP/ro/data" "$APPDIR/AppRun" out.txt)" || fail "launch blocked by unwritable data dir"
-[ "$out" = "stub: out.txt" ] || fail "stub not run against unwritable data dir: $out"
+[[ "$out" = "stub: out.txt" ]] || fail "stub not run against unwritable data dir: $out"
chmod u+w "$TMP/ro"
# 8. No $APPIMAGE (extracted AppDir): launch only, nothing installed.
rm -rf "$XDG_DATA_HOME"
env -u APPIMAGE "$APPDIR/AppRun" >/dev/null || fail "extracted-AppDir launch exited non-zero"
-[ ! -e "$XDG_DATA_HOME" ] || fail "integrated without $APPIMAGE"
+[[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated without $APPIMAGE"
# 9. A path that would need Exec escaping (here a `$`): launch only, nothing installed.
rm -rf "$XDG_DATA_HOME"
odd="$TMP/odd\$(id).AppImage"
: >"$odd"
out="$(APPIMAGE="$odd" "$APPDIR/AppRun" x)" || fail "launch with an odd path exited non-zero"
-[ "$out" = "stub: x" ] || fail "odd path: $out"
-[ ! -e "$XDG_DATA_HOME" ] || fail "integrated an AppImage path that needs escaping"
+[[ "$out" = "stub: x" ]] || fail "odd path: $out"
+[[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated an AppImage path that needs escaping"
# 10. `cli ` runs figcraft-cli with the remaining arguments and integrates nothing.
rm -rf "$XDG_DATA_HOME"
out="$("$APPDIR/AppRun" cli mcp --attach 7979 2>&1)" && fail "cli ran without figcraft-cli in the AppDir"
-[ "$out" = "figcraft: this AppImage was built without figcraft-cli" ] || fail "missing cli: $out"
+[[ "$out" = "figcraft: this AppImage was built without figcraft-cli" ]] || fail "missing cli: $out"
printf '#!/bin/sh\necho "cli stub: $*"\n' >"$APPDIR/usr/bin/figcraft-cli"
chmod +x "$APPDIR/usr/bin/figcraft-cli"
out="$("$APPDIR/AppRun" cli mcp --attach 7979)" || fail "cli launch exited non-zero"
-[ "$out" = "cli stub: mcp --attach 7979" ] || fail "cli arguments not forwarded: $out"
+[[ "$out" = "cli stub: mcp --attach 7979" ]] || fail "cli arguments not forwarded: $out"
out="$("$APPDIR/AppRun" cli)" || fail "bare cli launch exited non-zero"
-[ "$out" = "cli stub: " ] || fail "bare cli output: $out"
-[ ! -e "$XDG_DATA_HOME" ] || fail "cli launch integrated the desktop"
+[[ "$out" = "cli stub: " ]] || fail "bare cli output: $out"
+[[ ! -e "$XDG_DATA_HOME" ]] || fail "cli launch integrated the desktop"
# Only the first argument selects the CLI.
out="$("$APPDIR/AppRun" file.figcraft cli)" || fail "app launch with a later cli argument exited non-zero"
-[ "$out" = "stub: file.figcraft cli" ] || fail "later cli argument hijacked the launch: $out"
+[[ "$out" = "stub: file.figcraft cli" ]] || fail "later cli argument hijacked the launch: $out"
echo "AppRun desktop integration ok"
diff --git a/packaging/linux/flatpak-bundle.sh b/packaging/linux/flatpak-bundle.sh
index 127c3af9..b3353b38 100755
--- a/packaging/linux/flatpak-bundle.sh
+++ b/packaging/linux/flatpak-bundle.sh
@@ -22,7 +22,7 @@ FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo
TEST=1
TARBALL=""
-while [ $# -gt 0 ]; do
+while [[ $# -gt 0 ]]; do
case "$1" in
--no-test) TEST=0; shift ;;
-h | --help) sed -n '2,14p' "$0"; exit 0 ;;
@@ -39,7 +39,7 @@ case "$ARCH" in
esac
BASENAME="figcraft-$VERSION-linux-$ARCH"
TARBALL="${TARBALL:-$DIST/$BASENAME.tar.gz}"
-[ -f "$TARBALL" ] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; }
+[[ -f "$TARBALL" ]] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; }
for tool in flatpak flatpak-builder; do
command -v "$tool" >/dev/null || { echo "error: $tool not found (apt install flatpak flatpak-builder librsvg2-common)" >&2; exit 1; }
done
@@ -50,7 +50,7 @@ WORK="$CARGO_TARGET_DIR/flatpak-bundle"
rm -rf "$WORK"
mkdir -p "$WORK/stage"
tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
-[ -x "$WORK/stage/bin/figcraft" ] || { echo "error: $TARBALL has no bin/figcraft" >&2; exit 1; }
+[[ -x "$WORK/stage/bin/figcraft" ]] || { echo "error: $TARBALL has no bin/figcraft" >&2; exit 1; }
cp "$HERE/flatpak/$APP_ID.bundle.yml" "$WORK/$APP_ID.yml"
flatpak remote-add --user --if-not-exists flathub "$FLATHUB"
@@ -63,10 +63,10 @@ OUT="$DIST/$BASENAME.flatpak"
flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable
echo "wrote $OUT"
-if [ "$TEST" = 1 ]; then
+if [[ "$TEST" = 1 ]]; then
flatpak install --user -y --noninteractive --reinstall "$OUT"
flatpak info --user "$APP_ID"
- if [ -x "$WORK/stage/bin/figcraft-cli" ]; then smoke=figcraft-cli; else smoke=figcraft; fi
+ if [[ -x "$WORK/stage/bin/figcraft-cli" ]]; then smoke=figcraft-cli; else smoke=figcraft; fi
flatpak run --command="$smoke" "$APP_ID" --version
flatpak run --command=sh "$APP_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/mime/packages /app/share/icons/hicolor/256x256/apps'
fi
diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh
index d38dc0bc..2480f204 100755
--- a/packaging/linux/package.sh
+++ b/packaging/linux/package.sh
@@ -27,7 +27,7 @@ APP_ID=ai.storyteller.figcraft
SKIP_BUILD=0
FORMATS="appimage deb rpm tar"
-while [ $# -gt 0 ]; do
+while [[ $# -gt 0 ]]; do
case "$1" in
--skip-build) SKIP_BUILD=1; shift ;;
--formats) FORMATS="$2"; shift 2 ;;
@@ -48,7 +48,7 @@ BASENAME="figcraft-$VERSION-linux-$ARCH"
echo "==> FigCraft $VERSION for Linux $ARCH ($FORMATS; ${BINS[*]})"
-if [ "$SKIP_BUILD" = 0 ]; then
+if [[ "$SKIP_BUILD" = 0 ]]; then
(cd "$ROOT" && cargo build --release --locked "${CARGO_PKGS[@]}" ${CROSS_TARGET:+--target "$CROSS_TARGET"})
fi
BIN="$CARGO_TARGET_DIR/${CROSS_TARGET:+$CROSS_TARGET/}release"
@@ -78,7 +78,7 @@ if command -v appstreamcli >/dev/null; then
appstreamcli validate --no-net --explain "$STAGE/usr/share/metainfo/$APP_ID.metainfo.xml"
fi
-has() { case " $FORMATS " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
+has() { local format="$1"; case " $FORMATS " in *" $format "*) return 0 ;; *) return 1 ;; esac; }
# ---- .tar.gz ------------------------------------------------------------------------------------
if has tar; then
@@ -96,7 +96,7 @@ if has deb || has rpm; then
# nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src`.
# Without the CLI, drop its `#cli` lines.
cli_filter='/#cli$/d'
- [ "$HAS_CLI" = 1 ] && cli_filter='s/ #cli$//'
+ [[ "$HAS_CLI" = 1 ]] && cli_filter='s/ #cli$//'
sed -e "s|\${STAGE}|$STAGE|g" -e "$cli_filter" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
for fmt in deb rpm; do
if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
@@ -118,9 +118,9 @@ if has appimage; then
ln -s "$APP_ID.png" "$APPDIR/.DirIcon"
TOOL="${APPIMAGETOOL:-$(command -v appimagetool || true)}"
- if [ -z "$TOOL" ]; then
+ if [[ -z "$TOOL" ]]; then
TOOL="$CARGO_TARGET_DIR/appimagetool-$ARCH.AppImage"
- if [ ! -x "$TOOL" ]; then
+ if [[ ! -x "$TOOL" ]]; then
curl --proto '=https' -fsSL -o "$TOOL" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
chmod +x "$TOOL"
fi
@@ -143,16 +143,16 @@ if has appimage; then
# package) appimagetool also writes the .zsync, into its working directory, hence the cd.
(cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream -u "$UPDATE_INFO" "$APPDIR" "$OUT")
echo "wrote $OUT"
- if [ -s "$OUT.zsync" ]; then
+ if [[ -s "$OUT.zsync" ]]; then
echo "wrote $OUT.zsync"
else
warn "zsyncmake not found, so $OUT.zsync was not written; AppImage delta updates need it"
fi
fi
-if [ -z "${CROSS_TARGET:-}" ]; then
+if [[ -z "${CROSS_TARGET:-}" ]]; then
"$STAGE/usr/bin/$(smoke_bin)" --version
-elif [ -n "${EMULATOR:-}" ]; then
+elif [[ -n "${EMULATOR:-}" ]]; then
"$EMULATOR" "$STAGE/usr/bin/$(smoke_bin)" --version
fi
echo "==> done"
diff --git a/packaging/macos/import-cert.sh b/packaging/macos/import-cert.sh
index 1150163e..77611537 100755
--- a/packaging/macos/import-cert.sh
+++ b/packaging/macos/import-cert.sh
@@ -12,7 +12,7 @@ umask 077
# shellcheck source=../env.sh
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
-if [ -z "${APPLE_CERTIFICATE:-}" ]; then
+if [[ -z "${APPLE_CERTIFICATE:-}" ]]; then
warn "APPLE_CERTIFICATE is not set: macOS builds will be ad-hoc signed and not notarized"
exit 0
fi
@@ -36,13 +36,13 @@ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KC_PASS"
security list-keychains -d user -s "$KEYCHAIN" $(security list-keychains -d user | tr -d '"')
IDENTITY="$(security find-identity -v -p codesigning "$KEYCHAIN" | awk '/Developer ID Application/ { print $2; exit }')"
-if [ -z "$IDENTITY" ]; then
+if [[ -z "$IDENTITY" ]]; then
security find-identity -v -p codesigning "$KEYCHAIN" >&2
echo "error: no 'Developer ID Application' identity in APPLE_CERTIFICATE" >&2
exit 1
fi
echo "Imported signing identity $IDENTITY"
-if [ -n "${GITHUB_ENV:-}" ]; then
+if [[ -n "${GITHUB_ENV:-}" ]]; then
{ echo "MACOS_SIGN_IDENTITY=$IDENTITY"; echo "MACOS_KEYCHAIN=$KEYCHAIN"; } >>"$GITHUB_ENV"
else
echo "MACOS_SIGN_IDENTITY=$IDENTITY"
diff --git a/packaging/macos/package.sh b/packaging/macos/package.sh
index 87abe94c..7407af7b 100755
--- a/packaging/macos/package.sh
+++ b/packaging/macos/package.sh
@@ -19,7 +19,7 @@ HERE="$ROOT/packaging/macos"
ARCH=universal
SKIP_BUILD=0
-while [ $# -gt 0 ]; do
+while [[ $# -gt 0 ]]; do
case "$1" in
--arch) ARCH="$2"; shift 2 ;;
--skip-build) SKIP_BUILD=1; shift ;;
@@ -44,9 +44,9 @@ DMG="$DIST/figcraft-$VERSION-macos-$ARCH.dmg"
CLI_ZIP="$DIST/figcraft-cli-$VERSION-macos-$ARCH.zip"
NOTARIZE=0
-if [ "$IDENTITY" = "-" ]; then
+if [[ "$IDENTITY" = "-" ]]; then
warn "macOS: ad-hoc signing (no MACOS_SIGN_IDENTITY); artifacts are not notarized"
-elif [ -n "${APPLE_ID:-}" ] && [ -n "${APPLE_PASSWORD:-}" ] && [ -n "${APPLE_TEAM_ID:-}" ]; then
+elif [[ -n "${APPLE_ID:-}" ]] && [[ -n "${APPLE_PASSWORD:-}" ]] && [[ -n "${APPLE_TEAM_ID:-}" ]]; then
NOTARIZE=1
else
warn "macOS: APPLE_ID / APPLE_PASSWORD / APPLE_TEAM_ID incomplete; signed but not notarized"
@@ -55,7 +55,7 @@ fi
echo "==> FigCraft $VERSION for macOS ($ARCH; ${BINS[*]}), identity: $IDENTITY, notarize: $NOTARIZE"
# ---- build -------------------------------------------------------------------------------------
-if [ "$SKIP_BUILD" = 0 ]; then
+if [[ "$SKIP_BUILD" = 0 ]]; then
args=()
for t in "${TARGETS[@]}"; do args+=(--target "$t"); done
(cd "$ROOT" && cargo build --release --locked "${CARGO_PKGS[@]}" "${args[@]}")
@@ -74,9 +74,9 @@ done
sign() {
# Hardened runtime + secure timestamp for a real identity; ad-hoc can't be timestamped.
local ts=(--timestamp)
- [ "$IDENTITY" = "-" ] && ts=(--timestamp=none)
+ [[ "$IDENTITY" = "-" ]] && ts=(--timestamp=none)
local kc=()
- [ -n "${MACOS_KEYCHAIN:-}" ] && kc=(--keychain "$MACOS_KEYCHAIN")
+ [[ -n "${MACOS_KEYCHAIN:-}" ]] && kc=(--keychain "$MACOS_KEYCHAIN")
codesign --force --sign "$IDENTITY" ${kc[@]+"${kc[@]}"} "${ts[@]}" "$@"
}
@@ -88,8 +88,8 @@ notarize() {
echo "$out"
id="$(printf '%s' "$out" | plutil -extract id raw -o - - 2>/dev/null || true)"
status="$(printf '%s' "$out" | plutil -extract status raw -o - - 2>/dev/null || true)"
- if [ "$status" != "Accepted" ]; then
- if [ -n "$id" ]; then
+ if [[ "$status" != "Accepted" ]]; then
+ if [[ -n "$id" ]]; then
xcrun notarytool log "$id" --apple-id "$APPLE_ID" --password "$APPLE_PASSWORD" --team-id "$APPLE_TEAM_ID" || true
fi
echo "error: notarization of $(basename "$file") failed (status: ${status:-unknown})" >&2
@@ -116,7 +116,7 @@ mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp "$WORK/bin/figcraft" "$APP/Contents/MacOS/FigCraft"
cp "$WORK/FigCraft.icns" "$APP/Contents/Resources/FigCraft.icns"
# Licences of the embedded craft-fonts fonts (only when built with CRAFT_FONTS_DIR).
-if [ -n "${CRAFT_FONTS_DIR:-}" ]; then
+if [[ -n "${CRAFT_FONTS_DIR:-}" ]]; then
mkdir -p "$APP/Contents/Resources/Licenses"
copy_font_licences "$APP/Contents/Resources/Licenses"
fi
@@ -132,7 +132,7 @@ sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP/Contents/
sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP"
codesign --verify --strict --deep --verbose=2 "$APP"
-if [ "$NOTARIZE" = 1 ]; then
+if [[ "$NOTARIZE" = 1 ]]; then
ditto -c -k --keepParent "$APP" "$WORK/FigCraft-notarize.zip"
notarize "$WORK/FigCraft-notarize.zip"
retry xcrun stapler staple "$APP"
@@ -154,7 +154,7 @@ hdiutil convert "$WORK/raw.dmg" -format UDZO -imagekey zlib-level=9 -o "$DMG"
rm -f "$WORK/raw.dmg"
sign "$DMG"
codesign --verify --strict --verbose=2 "$DMG"
-if [ "$NOTARIZE" = 1 ]; then
+if [[ "$NOTARIZE" = 1 ]]; then
notarize "$DMG"
retry xcrun stapler staple "$DMG"
retry xcrun stapler validate "$DMG"
@@ -162,7 +162,7 @@ if [ "$NOTARIZE" = 1 ]; then
fi
# ---- CLI ---------------------------------------------------------------------------------------
-if [ "$HAS_CLI" = 1 ]; then
+if [[ "$HAS_CLI" = 1 ]]; then
echo "==> building $CLI_ZIP"
CLI_DIR="$WORK/figcraft-cli-$VERSION-macos-$ARCH"
mkdir -p "$CLI_DIR"
@@ -176,7 +176,7 @@ if [ "$HAS_CLI" = 1 ]; then
ditto -c -k --keepParent "$CLI_DIR" "$CLI_ZIP"
# notarytool accepts a zip of the bare binary. A bare Mach-O can't carry a stapled ticket, so
# Gatekeeper looks the notarization up online when a quarantined copy first runs.
- if [ "$NOTARIZE" = 1 ]; then notarize "$CLI_ZIP"; fi
+ if [[ "$NOTARIZE" = 1 ]]; then notarize "$CLI_ZIP"; fi
"$WORK/bin/figcraft-cli" --version
else
warn "apps/figcraft-cli is not in this workspace: no CLI zip"
diff --git a/packaging/macos/verify.sh b/packaging/macos/verify.sh
index 6080cf87..071629cb 100755
--- a/packaging/macos/verify.sh
+++ b/packaging/macos/verify.sh
@@ -23,7 +23,7 @@ set -euo pipefail
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
ARCH=universal
-while [ $# -gt 0 ]; do
+while [[ $# -gt 0 ]]; do
case "$1" in
--arch) ARCH="$2"; shift 2 ;;
-h | --help) sed -n '2,20p' "$0"; exit 0 ;;
@@ -41,13 +41,13 @@ DMG="$DIST/figcraft-$VERSION-macos-$ARCH.dmg"
CLI_ZIP="$DIST/figcraft-cli-$VERSION-macos-$ARCH.zip"
IDENTITY="${MACOS_SIGN_IDENTITY:--}"
STRICT=0
-if [ "$IDENTITY" != "-" ] && [ -n "${APPLE_ID:-}" ] && [ -n "${APPLE_PASSWORD:-}" ] && [ -n "${APPLE_TEAM_ID:-}" ]; then
+if [[ "$IDENTITY" != "-" ]] && [[ -n "${APPLE_ID:-}" ]] && [[ -n "${APPLE_PASSWORD:-}" ]] && [[ -n "${APPLE_TEAM_ID:-}" ]]; then
STRICT=1
fi
FAILED=0
fail() {
- if [ "$STRICT" = 1 ]; then
+ if [[ "$STRICT" = 1 ]]; then
echo "error: $*" >&2
FAILED=1
else
@@ -58,22 +58,22 @@ fail() {
# spctl's online ticket lookup can lag a few seconds behind notarytool's "Accepted".
assess() {
local out attempt tries=1
- [ "$STRICT" = 1 ] && tries=5
+ [[ "$STRICT" = 1 ]] && tries=5
for attempt in $(seq "$tries"); do
if out="$(spctl "$@" 2>&1)"; then
printf '%s\n' "$out"
return 0
fi
- [ "$attempt" = "$tries" ] || sleep 10
+ [[ "$attempt" = "$tries" ]] || sleep 10
done
printf '%s\n' "$out"
return 1
}
FILES=("$DMG")
-if [ "$HAS_CLI" = 1 ]; then FILES+=("$CLI_ZIP"); fi
+if [[ "$HAS_CLI" = 1 ]]; then FILES+=("$CLI_ZIP"); fi
for f in "${FILES[@]}"; do
- if [ ! -f "$f" ]; then
+ if [[ ! -f "$f" ]]; then
echo "error: missing $f" >&2
exit 1
fi
@@ -83,11 +83,11 @@ WORK="$(mktemp -d "${RUNNER_TEMP:-${TMPDIR:-/tmp}}/figcraft-verify.XXXXXX")"
trap 'rm -rf "$WORK"' EXIT
# ---- CLI zip (when apps/figcraft-cli exists) ----------------------------------------------------
-if [ "$HAS_CLI" = 1 ]; then
+if [[ "$HAS_CLI" = 1 ]]; then
echo "==> $(basename "$CLI_ZIP")"
ditto -x -k "$CLI_ZIP" "$WORK/cli"
CLI="$WORK/cli/figcraft-cli-$VERSION-macos-$ARCH/figcraft-cli"
- if [ ! -x "$CLI" ]; then
+ if [[ ! -x "$CLI" ]]; then
echo "error: $(basename "$CLI_ZIP") has no executable figcraft-cli-$VERSION-macos-$ARCH/figcraft-cli" >&2
exit 1
fi
@@ -111,7 +111,7 @@ if [ "$HAS_CLI" = 1 ]; then
|| fail "figcraft-cli is not signed with a Developer ID Application identity"
printf '%s\n' "$details" | grep -q '^Timestamp=' \
|| fail "figcraft-cli signature has no secure timestamp"
- if [ -n "${APPLE_TEAM_ID:-}" ]; then
+ if [[ -n "${APPLE_TEAM_ID:-}" ]]; then
printf '%s\n' "$details" | grep -qx "TeamIdentifier=$APPLE_TEAM_ID" \
|| fail "figcraft-cli is signed by a different team"
fi
@@ -129,25 +129,25 @@ fi
# ---- DMG ---------------------------------------------------------------------------------------
echo "==> $(basename "$DMG")"
codesign --verify --strict --verbose=2 "$DMG"
-if [ "$STRICT" = 1 ]; then
+if [[ "$STRICT" = 1 ]]; then
retry xcrun stapler validate "$DMG" || fail "no notarization ticket stapled to the DMG"
assess --assess --type open --context context:primary-signature -vv "$DMG" \
|| fail "Gatekeeper rejects the DMG"
fi
-if [ "$FAILED" != 0 ]; then
+if [[ "$FAILED" != 0 ]]; then
echo "error: macOS artifacts failed verification" >&2
exit 1
fi
-if [ "$STRICT" = 1 ]; then
+if [[ "$STRICT" = 1 ]]; then
result="signed (Developer ID, hardened runtime), notarized; DMG stapled"
else
result="signature intact; Developer ID and notarization not required (no signing secrets)"
fi
echo "==> verified: $result"
-if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
+if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
names="\`$(basename "$DMG")\`"
- if [ "$HAS_CLI" = 1 ]; then names="$names, \`$(basename "$CLI_ZIP")\`"; fi
+ if [[ "$HAS_CLI" = 1 ]]; then names="$names, \`$(basename "$CLI_ZIP")\`"; fi
echo "- macOS $names: $result" >>"$GITHUB_STEP_SUMMARY"
fi
diff --git a/packaging/server/install-test.sh b/packaging/server/install-test.sh
index 303d08de..2ebe5176 100755
--- a/packaging/server/install-test.sh
+++ b/packaging/server/install-test.sh
@@ -10,7 +10,7 @@ WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
FAILED=0
-main() { bash "$HERE/install.sh" --caddy-main "$1" ops@example.com; }
+main() { local caddyfile="$1"; bash "$HERE/install.sh" --caddy-main "$caddyfile" ops@example.com; }
fail() { printf 'FAIL: %s\n' "$*" >&2; FAILED=1; }
# Missing: ours.
@@ -28,7 +28,7 @@ printf 'shop.example.com {\n\treverse_proxy 127.0.0.1:8080\n}\n' >"$WORK/theirs"
cp "$WORK/theirs" "$WORK/run1"
main "$WORK/run1" >"$WORK/run2"
grep -q 'shop.example.com' "$WORK/run2" || fail "the operator's site is kept"
-[ "$(grep -c 'import figcraft-server.caddy' "$WORK/run2")" = 1 ] || fail "one import line is added"
+[[ "$(grep -c 'import figcraft-server.caddy' "$WORK/run2")" = 1 ]] || fail "one import line is added"
main "$WORK/run2" >"$WORK/run3"
cmp -s "$WORK/run2" "$WORK/run3" || fail "running again leaves a Caddyfile with other sites as it is"
main "$WORK/run3" >"$WORK/run4"
@@ -39,5 +39,5 @@ main "$WORK/none" >"$WORK/ours1"
main "$WORK/ours1" >"$WORK/ours2"
cmp -s "$WORK/ours1" "$WORK/ours2" || fail "our own Caddyfile stays the same"
-if [ "$FAILED" = 0 ]; then echo "install.sh Caddyfile handling: ok"; fi
+if [[ "$FAILED" = 0 ]]; then echo "install.sh Caddyfile handling: ok"; fi
exit "$FAILED"
diff --git a/packaging/server/install.sh b/packaging/server/install.sh
index 826c2bb4..94acd578 100755
--- a/packaging/server/install.sh
+++ b/packaging/server/install.sh
@@ -41,7 +41,7 @@ SERVICE=figcraft-server
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# The source tree this script sits in (packaging/server/ of a copy or checkout), if any.
LOCAL_SRC=""
-if [ -f "$HERE/../../Cargo.toml" ] && [ -d "$HERE/../../apps/figcraft-server" ]; then
+if [[ -f "$HERE/../../Cargo.toml" ]] && [[ -d "$HERE/../../apps/figcraft-server" ]]; then
LOCAL_SRC="$(cd "$HERE/../.." && pwd)"
fi
@@ -64,9 +64,9 @@ MARK="# figcraft-server (install.sh)"
caddy_main() { # caddy_main FILE EMAIL: the main Caddyfile to install, on stdout
local file="$1" email="$2"
- if [ -f "$file" ] && grep -qE '^[[:space:]]*import[[:space:]]+figcraft-server\.caddy[[:space:]]*$' "$file"; then
+ if [[ -f "$file" ]] && grep -qE '^[[:space:]]*import[[:space:]]+figcraft-server\.caddy[[:space:]]*$' "$file"; then
cat "$file" # it imports our site already: kept exactly as it is
- elif [ ! -f "$file" ] || ! grep -qvE '^[[:space:]]*(#|$|:80|\{|\}|root|file_server)' "$file"; then
+ elif [[ ! -f "$file" ]] || ! grep -qvE '^[[:space:]]*(#|$|:80|\{|\}|root|file_server)' "$file"; then
# Missing, or only the example site the package ships: ours, with the certificate email.
printf '%s\n{\n\temail %s\n}\n\nimport figcraft-server.caddy\n' "$MARK" "$email"
else
@@ -76,7 +76,7 @@ caddy_main() { # caddy_main FILE EMAIL: the main Caddyfile to install, on stdout
fi
}
-while [ $# -gt 0 ]; do
+while [[ $# -gt 0 ]]; do
case "$1" in
# For tests (packaging/server/install-test.sh): print the Caddyfile this script would write.
--caddy-main) caddy_main "${2:-}" "${3:-}"; exit 0 ;;
@@ -95,7 +95,7 @@ while [ $# -gt 0 ]; do
esac
done
-[ "$(id -u)" -eq 0 ] || die "run it as root (sudo ./install.sh ...)"
+[[ "$(id -u)" -eq 0 ]] || die "run it as root (sudo ./install.sh ...)"
# shellcheck source=/dev/null
. /etc/os-release
case " ${ID:-} ${ID_LIKE:-} " in
@@ -104,9 +104,9 @@ case " ${ID:-} ${ID_LIKE:-} " in
esac
ask() { # ask VAR "question" FLAG: read an answer from the terminal when the value wasn't given
- local var="$1" question="$2" answer
- if [ -z "${!var}" ]; then
- [ -t 0 ] || die "give $3 (no terminal to ask on)"
+ local var="$1" question="$2" flag="$3" answer
+ if [[ -z "${!var}" ]]; then
+ [[ -t 0 ]] || die "give $flag (no terminal to ask on)"
read -r -p "$question " answer
printf -v "$var" '%s' "$answer"
fi
@@ -115,6 +115,7 @@ ask HOST "DNS name people will use (e.g. figcraft.example.com):" "--host"
ask EMAIL "Email for Let's Encrypt and the abuse contact shown to users:" "--email"
case "$HOST" in
"" | *[!A-Za-z0-9.-]* | .* | *. ) die "--host must be a DNS name like figcraft.example.com" ;;
+ *) ;;
esac
case "$EMAIL" in
*@*.*) ;;
@@ -126,6 +127,7 @@ case "$TERMS" in
esac
case "$EMAIL$TERMS" in
*[[:space:]\"\\]*) die "--email and --terms can't contain spaces, quotes or backslashes" ;;
+ *) ;;
esac
export DEBIAN_FRONTEND=noninteractive
@@ -138,6 +140,7 @@ ARCH="$(uname -m)"
case "$ARCH" in
amd64) ARCH=x86_64 ;;
arm64) ARCH=aarch64 ;;
+ *) ;; # already a release name (x86_64, aarch64)
esac
# --- The binary -----------------------------------------------------------------------------
@@ -146,9 +149,9 @@ FILES="$HERE" # where the units and the Caddyfile come from
from_release() { # download and check the release archive; sets NEW_BIN and FILES
local version="$VERSION" name dir
- if [ -z "$version" ]; then
+ if [[ -z "$version" ]]; then
version="$(curl --proto '=https' -fsSL "https://api.github.com/repos/$REPO/releases/latest" | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p' | head -n 1)" || return 1
- [ -n "$version" ] || return 1
+ [[ -n "$version" ]] || return 1
fi
name="figcraft-server-$version-linux-$ARCH"
dir="$WORK/release"
@@ -165,7 +168,7 @@ from_release() { # download and check the release archive; sets NEW_BIN and FILE
SWAP=""
cleanup() {
- if [ -n "$SWAP" ]; then
+ if [[ -n "$SWAP" ]]; then
swapoff "$SWAP" 2>/dev/null || true
rm -f "$SWAP"
fi
@@ -174,7 +177,7 @@ trap cleanup EXIT
as_builder() { # run a command as the unprivileged build user, with its own toolchain
local jobs=()
- if [ -n "${CARGO_BUILD_JOBS:-}" ]; then jobs=("CARGO_BUILD_JOBS=$CARGO_BUILD_JOBS"); fi
+ if [[ -n "${CARGO_BUILD_JOBS:-}" ]]; then jobs=("CARGO_BUILD_JOBS=$CARGO_BUILD_JOBS"); fi
runuser -u "$BUILDER" -- env HOME="$BUILD" RUSTUP_HOME="$BUILD/rustup" CARGO_HOME="$BUILD/cargo" \
CARGO_TARGET_DIR="$BUILD/target" "${jobs[@]}" "$@"
}
@@ -184,27 +187,27 @@ from_source() { # build the source tree around this script, else a fresh clone;
apt-get install -y -qq build-essential git pkg-config >/dev/null
id -u "$BUILDER" >/dev/null 2>&1 || useradd --system --home-dir "$BUILD" --shell /usr/sbin/nologin "$BUILDER"
install -d -o "$BUILDER" -g "$BUILDER" -m 755 "$BUILD"
- if [ ! -x "$BUILD/cargo/bin/cargo" ]; then
+ if [[ ! -x "$BUILD/cargo/bin/cargo" ]]; then
as_builder sh -c "curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable --no-modify-path" >/dev/null
else
as_builder "$BUILD/cargo/bin/rustup" update stable >/dev/null
fi
# The source root installs files from is root's own (the copy beside this script, or root's
# clone); the build user only ever builds a copy of it.
- if [ -n "$LOCAL_SRC" ]; then
+ if [[ -n "$LOCAL_SRC" ]]; then
src="$LOCAL_SRC"
say "Building the source in $LOCAL_SRC: this takes a while"
else
src="$WORK/src"
- if [ -d "$src/.git" ]; then
+ if [[ -d "$src/.git" ]]; then
git -C "$src" fetch --quiet --tags origin
else
git clone --quiet "https://github.com/$REPO" "$src" ||
die "can't clone $REPO (a private repository: copy the source to this machine and run its packaging/server/install.sh)"
fi
- if [ -z "$ref" ]; then
- if [ -n "$VERSION" ]; then ref="v$VERSION"; else ref="$(git -C "$src" tag --list 'v*' --sort=-v:refname | head -n 1)"; fi
- [ -n "$ref" ] || ref=main
+ if [[ -z "$ref" ]]; then
+ if [[ -n "$VERSION" ]]; then ref="v$VERSION"; else ref="$(git -C "$src" tag --list 'v*' --sort=-v:refname | head -n 1)"; fi
+ [[ -n "$ref" ]] || ref=main
fi
say "Building $ref from a clone: this takes a while"
# A branch as it is upstream now, or a tag.
@@ -216,7 +219,7 @@ from_source() { # build the source tree around this script, else a fresh clone;
tar -C "$src" --exclude=./target --exclude=./plugins/target --exclude=./.git -cf - . | as_builder tar -C "$copy" -xf -
# The compiler needs about 2 GB: add a temporary swap file on smaller machines.
mem_kb="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
- if [ "$mem_kb" -lt 2000000 ] && [ -z "$(swapon --show --noheadings)" ]; then
+ if [[ "$mem_kb" -lt 2000000 ]] && [[ -z "$(swapon --show --noheadings)" ]]; then
SWAP="$WORK/swapfile"
say "Adding a temporary 2 GB swap file for the build"
fallocate -l 2G "$SWAP" 2>/dev/null || dd if=/dev/zero of="$SWAP" bs=1M count=2048 status=none
@@ -237,19 +240,19 @@ from_source() { # build the source tree around this script, else a fresh clone;
FILES="$src/packaging/server"
}
-if [ -x "$HERE/figcraft-server" ] && [ "$FROM_SOURCE" = false ]; then
+if [[ -x "$HERE/figcraft-server" ]] && [[ "$FROM_SOURCE" = false ]]; then
NEW_BIN="$HERE/figcraft-server" # run from an unpacked release archive
-elif [ -n "$LOCAL_SRC" ] && [ -z "$VERSION" ]; then
+elif [[ -n "$LOCAL_SRC" ]] && [[ -z "$VERSION" ]]; then
from_source # the source copied to (or checked out on) this machine, as it is
-elif [ "$FROM_SOURCE" = true ] || ! from_release; then
- [ "$FROM_SOURCE" = true ] || say "No release archive for linux-$ARCH: building from source instead"
+elif [[ "$FROM_SOURCE" = true ]] || ! from_release; then
+ [[ "$FROM_SOURCE" = true ]] || say "No release archive for linux-$ARCH: building from source instead"
from_source
fi
-[ -x "$NEW_BIN" ] || die "no figcraft-server binary to install"
+[[ -x "$NEW_BIN" ]] || die "no figcraft-server binary to install"
# The units and the Caddyfile beside this script when it has them (a checkout or an archive).
-[ -f "$HERE/figcraft-backup.timer" ] && FILES="$HERE"
+[[ -f "$HERE/figcraft-backup.timer" ]] && FILES="$HERE"
for f in figcraft-server.service Caddyfile figcraft-backup.service figcraft-backup.timer; do
- [ -f "$FILES/$f" ] || die "$FILES/$f is missing"
+ [[ -f "$FILES/$f" ]] || die "$FILES/$f is missing"
done
# The server's own account runs the binary, from here on too (root never runs what was built).
@@ -267,7 +270,7 @@ fi
# --- Data and settings ----------------------------------------------------------------------
install -d -o figcraft -g figcraft -m 700 "$DATA"
install -d -m 755 "$CONFIG_DIR"
-if [ ! -f "$CONFIG" ]; then
+if [[ ! -f "$CONFIG" ]]; then
say "Writing $CONFIG"
{
printf '# figcraft-server settings (docs/server.md, "Configuration"). install.sh never overwrites this file.\n'
@@ -303,8 +306,9 @@ as_server "$BIN" --config "$CONFIG" check >/dev/null ||
die "$CONFIG isn't right for this figcraft-server (see above; a release older than open hosting needs --from-source)"
install_file() { # install_file SOURCE TARGET MODE: true when it changed
- if cmp -s "$1" "$2"; then return 1; fi
- install -m "$3" "$1" "$2"
+ local source="$1" target="$2" mode="$3"
+ if cmp -s "$source" "$target"; then return 1; fi
+ install -m "$mode" "$source" "$target"
}
# --- systemd --------------------------------------------------------------------------------
@@ -312,16 +316,16 @@ UNITS=false
install_file "$FILES/figcraft-server.service" /etc/systemd/system/figcraft-server.service 644 && UNITS=true
install_file "$FILES/figcraft-backup.service" /etc/systemd/system/figcraft-backup.service 644 && UNITS=true
install_file "$FILES/figcraft-backup.timer" /etc/systemd/system/figcraft-backup.timer 644 && UNITS=true
-if [ "$UNITS" = true ]; then
+if [[ "$UNITS" = true ]]; then
systemctl daemon-reload
CHANGED=true
fi
systemctl enable --quiet "$SERVICE"
-if [ "$CHANGED" = true ] || ! systemctl is-active --quiet "$SERVICE"; then
+if [[ "$CHANGED" = true ]] || ! systemctl is-active --quiet "$SERVICE"; then
say "Starting figcraft-server"
systemctl restart "$SERVICE"
fi
-if [ "$BACKUPS" = true ]; then
+if [[ "$BACKUPS" = true ]]; then
systemctl enable --now --quiet figcraft-backup.timer
fi
@@ -339,15 +343,15 @@ MAIN="$(mktemp)"
caddy_main "$CADDYFILE" "$EMAIL" >"$MAIN"
CADDY_CHANGED=false
for f in "$CADDYFILE" "$SITE_FILE"; do
- if [ -f "$f" ]; then cp -p "$f" "$f.before-figcraft"; else rm -f "$f.before-figcraft"; fi
+ if [[ -f "$f" ]]; then cp -p "$f" "$f.before-figcraft"; else rm -f "$f.before-figcraft"; fi
done
install_file "$SITE" "$SITE_FILE" 644 && CADDY_CHANGED=true
install_file "$MAIN" "$CADDYFILE" 644 && CADDY_CHANGED=true
rm -f "$SITE" "$MAIN"
-if [ "$CADDY_CHANGED" = true ]; then
+if [[ "$CADDY_CHANGED" = true ]]; then
if ! caddy validate --config "$CADDYFILE" --adapter caddyfile >/dev/null 2>&1; then
for f in "$CADDYFILE" "$SITE_FILE"; do
- if [ -f "$f.before-figcraft" ]; then cp -p "$f.before-figcraft" "$f"; else rm -f "$f"; fi
+ if [[ -f "$f.before-figcraft" ]]; then cp -p "$f.before-figcraft" "$f"; else rm -f "$f"; fi
done
die "Caddy doesn't accept the new configuration (the old one is back; see: caddy validate --config $CADDYFILE)"
fi
@@ -356,10 +360,10 @@ fi
systemctl enable --now --quiet caddy
# --- Firewall -------------------------------------------------------------------------------
-if [ "$FIREWALL" = true ]; then
+if [[ "$FIREWALL" = true ]]; then
# The ports sshd really listens on (sudo doesn't pass SSH_CONNECTION on).
SSH_PORTS="$(sshd -T 2>/dev/null | awk '/^port / {print $2}' | sort -u)"
- [ -n "$SSH_PORTS" ] || SSH_PORTS=22
+ [[ -n "$SSH_PORTS" ]] || SSH_PORTS=22
say "Firewall: SSH ($(echo "$SSH_PORTS" | tr '\n' ' ' | sed 's/ $//')), 80 and 443"
for p in $SSH_PORTS; do ufw allow "$p/tcp" >/dev/null; done
ufw allow 80/tcp >/dev/null
@@ -370,12 +374,12 @@ if [ "$FIREWALL" = true ]; then
# Other services reachable from outside would be cut off by enabling ufw.
OTHERS=""
for a in $(ss -Hltn | awk '{print $4}'); do
- case "$a" in 127.* | "[::1]:"* | ::1:*) continue ;; esac
+ case "$a" in 127.* | "[::1]:"* | ::1:*) continue ;; *) ;; esac
port="${a##*:}"
case " $(echo "$SSH_PORTS" | tr '\n' ' ') 80 443 " in *" $port "*) continue ;; esac
OTHERS="$OTHERS $port"
done
- if [ -n "$OTHERS" ] && [ "$FIREWALL_ANYWAY" = false ]; then
+ if [[ -n "$OTHERS" ]] && [[ "$FIREWALL_ANYWAY" = false ]]; then
warn "other services listen on port(s)$OTHERS: ufw was not enabled (rules added; allow those ports, then 'ufw enable', or run again with --firewall-anyway)"
else
ufw --force enable >/dev/null
@@ -395,7 +399,7 @@ cat < Publish to server..., address wss://$HOST/
- $(if [ "$OPEN" = true ]; then echo "(open to the public: no key needed; each file gets an owner token)"; else echo "(with the key: $ADMIN key)"; fi)
+ $(if [[ "$OPEN" = true ]]; then echo "(open to the public: no key needed; each file gets an owner token)"; else echo "(with the key: $ADMIN key)"; fi)
Check: curl https://$HOST/healthz (once DNS points here and Caddy has its certificate)
Logs: journalctl -u $SERVICE -f
diff --git a/packaging/server/package.sh b/packaging/server/package.sh
index 7d2f9c54..5f306327 100755
--- a/packaging/server/package.sh
+++ b/packaging/server/package.sh
@@ -25,11 +25,12 @@ ARCH="$(uname -m)"
case "$ARCH" in
arm64) ARCH=aarch64 ;;
amd64) ARCH=x86_64 ;;
+ *) ;; # already a release name (x86_64, aarch64)
esac
NAME="figcraft-server-$VERSION-$OS-$ARCH"
echo "==> figcraft-server $VERSION for $OS $ARCH"
-if [ "$SKIP_BUILD" = 0 ]; then
+if [[ "$SKIP_BUILD" = 0 ]]; then
(cd "$ROOT" && cargo build --release --locked -p figcraft-server)
fi
WORK="$CARGO_TARGET_DIR/server-package"
diff --git a/packaging/web/package.sh b/packaging/web/package.sh
index 0e45c515..f9ee34a7 100755
--- a/packaging/web/package.sh
+++ b/packaging/web/package.sh
@@ -11,13 +11,13 @@ set -euo pipefail
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
HERE="$ROOT/packaging/web"
-if [ "${1:-}" != "--skip-build" ]; then
+if [[ "${1:-}" != "--skip-build" ]]; then
command -v trunk >/dev/null || { echo "error: trunk not found (cargo install trunk --locked)" >&2; exit 1; }
(cd "$ROOT/apps/figcraft-web" && trunk build --release)
fi
SITE="$ROOT/dist/web"
-[ -f "$SITE/index.html" ] || { echo "error: $SITE/index.html missing; run without --skip-build" >&2; exit 1; }
+[[ -f "$SITE/index.html" ]] || { echo "error: $SITE/index.html missing; run without --skip-build" >&2; exit 1; }
# Paths must be relative so the site works under any prefix (public_url = "./" in Trunk.toml).
if grep -Eq '(src|href)="/[^/]' "$SITE/index.html"; then
echo "error: $SITE/index.html has root-absolute URLs; it would break when served from a sub-path" >&2
@@ -30,16 +30,16 @@ fi
MAX_WASM_BYTES="${FIGCRAFT_WASM_MAX_BYTES:-25165824}" # 24 MiB
WASM_COUNT=0
for wasm in "$SITE"/*.wasm; do
- [ -f "$wasm" ] || continue
+ [[ -f "$wasm" ]] || continue
WASM_COUNT=$((WASM_COUNT + 1))
size=$(wc -c <"$wasm" | tr -d ' ')
echo "$(basename "$wasm"): $size bytes ($((size / 1048576)) MiB; limit $MAX_WASM_BYTES)"
- if [ "$size" -gt "$MAX_WASM_BYTES" ]; then
+ if [[ "$size" -gt "$MAX_WASM_BYTES" ]]; then
echo "error: $(basename "$wasm") is $size bytes, over the $MAX_WASM_BYTES-byte limit (Cloudflare's per-file cap is 25 MiB)" >&2
exit 1
fi
done
-[ "$WASM_COUNT" -gt 0 ] || { echo "error: no .wasm in $SITE" >&2; exit 1; }
+[[ "$WASM_COUNT" -gt 0 ]] || { echo "error: no .wasm in $SITE" >&2; exit 1; }
NAME="figcraft-web-$VERSION"
WORK="$CARGO_TARGET_DIR/web-package"
From e66780a39beeb75c0e5721fa9cc3576b0949909f Mon Sep 17 00:00:00 2001
From: "Dylan M. Taylor"
Date: Fri, 23 Oct 2026 12:56:34 -0400
Subject: [PATCH 14/23] packaging: use [[ for bash conditional tests
(SonarCloud S7688) (#1225)
SonarCloud flags every bare [ conditional in bash scripts under packaging/ as a reliability smell (rule S7688). Convert the flagged [ ... ] tests to [[ ... ]]: safer word-splitting and no glob surprises, same semantics for these string and file tests.
---
packaging/freebsd/package.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.sh
index bb9a7799..e11a58a0 100755
--- a/packaging/freebsd/package.sh
+++ b/packaging/freebsd/package.sh
@@ -21,7 +21,7 @@ APP_ID=ai.storyteller.figcraft
SKIP_BUILD=0
DRY_RUN=0
-while [ $# -gt 0 ]; do
+while [[ $# -gt 0 ]]; do
case "$1" in
--skip-build) SKIP_BUILD=1; shift ;;
--dry-run) DRY_RUN=1; SKIP_BUILD=1; shift ;;
@@ -37,7 +37,7 @@ case "$MACHINE" in
arm64 | aarch64) ARCH=aarch64 ;;
*) echo "unsupported architecture $MACHINE" >&2; exit 2 ;;
esac
-if [ "$DRY_RUN" = 0 ] && [ "$(uname -s)" != FreeBSD ]; then
+if [[ "$DRY_RUN" = 0 ]] && [[ "$(uname -s)" != FreeBSD ]]; then
echo "error: build on FreeBSD (or pass --dry-run to check the tree layout)" >&2
exit 2
fi
@@ -47,7 +47,7 @@ echo "==> FigCraft $VERSION for FreeBSD $ARCH"
# The release VM has 12 GB; full parallelism on the biggest crates runs it out of memory.
export CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-4}"
-if [ "$SKIP_BUILD" = 0 ]; then
+if [[ "$SKIP_BUILD" = 0 ]]; then
(cd "$ROOT" && cargo build --release --locked "${CARGO_PKGS[@]}")
fi
WORK="$CARGO_TARGET_DIR/freebsd-package"
@@ -57,7 +57,7 @@ mkdir -p "$WORK"
BIN="$CARGO_TARGET_DIR/release"
OUT_DIR="$DIST"
-if [ "$DRY_RUN" = 1 ]; then
+if [[ "$DRY_RUN" = 1 ]]; then
# Stub binaries, and the tarball stays in the work dir so dist/ only ever holds real builds.
BIN="$WORK/stub-bin"
OUT_DIR="$WORK"
@@ -86,12 +86,12 @@ sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$FIGCRAFT_BUILD_DATE/g" \
"$LINUX/$APP_ID.metainfo.xml.in" >"$STAGE/share/metainfo/$APP_ID.metainfo.xml"
cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/share/icons/"
copy_docs "$STAGE/share/doc/figcraft"
-if [ -f "$ROOT/ATTRIBUTION.md" ]; then install -m 644 "$ROOT/ATTRIBUTION.md" "$STAGE/share/doc/figcraft/"; fi
+if [[ -f "$ROOT/ATTRIBUTION.md" ]]; then install -m 644 "$ROOT/ATTRIBUTION.md" "$STAGE/share/doc/figcraft/"; fi
for f in "${BINS[@]/#/bin/}" "share/applications/$APP_ID.desktop" \
"share/icons/hicolor/256x256/apps/$APP_ID.png" \
share/doc/figcraft/LICENSE-MIT share/doc/figcraft/LICENSE-APACHE; do
- if [ ! -e "$STAGE/$f" ]; then echo "error: $f is missing from the package" >&2; exit 1; fi
+ if [[ ! -e "$STAGE/$f" ]]; then echo "error: $f is missing from the package" >&2; exit 1; fi
done
# ---- .tar.gz ------------------------------------------------------------------------------------
@@ -100,7 +100,7 @@ tar -C "$WORK" -czf "$OUT_DIR/$BASENAME.tar.gz" "$BASENAME"
echo "wrote $OUT_DIR/$BASENAME.tar.gz"
"$STAGE/bin/$(smoke_bin)" --version
-if [ "$DRY_RUN" = 1 ]; then
+if [[ "$DRY_RUN" = 1 ]]; then
echo "==> dry run: tarball contents"
tar -tzvf "$OUT_DIR/$BASENAME.tar.gz"
fi
From fc7a74451936c62d6aa219ab20a0065df203ac1a Mon Sep 17 00:00:00 2001
From: aiongg <67543387+aiongg@users.noreply.github.com>
Date: Fri, 23 Oct 2026 13:01:12 -0400
Subject: [PATCH 15/23] CI: one test binary per crate, nextest, line tables
only (#1208)
* Dev profile: line tables for workspace crates, no debug info for dependencies
* Tests: one integration-test binary per crate with several test files
* xtask ci: nextest, doctests, tests without examples, --keep-going; add xtask test
---
Cargo.toml | 10 +++++---
apps/figcraft-cli/tests/{ => it}/cli.rs | 1 -
.../tests/{ => it}/export_depth.rs | 1 -
apps/figcraft-cli/tests/{ => it}/fonts.rs | 1 -
apps/figcraft-cli/tests/it/main.rs | 12 +++++++++
apps/figcraft-cli/tests/{ => it}/pdf.rs | 1 -
apps/figcraft-cli/tests/{ => it}/pdf_print.rs | 1 -
.../tests/{ => it}/header_recovery.rs | 1 -
apps/figcraft-server/tests/it/main.rs | 5 ++++
.../tests/{ => it}/problem_retention.rs | 0
.../tests/{ => it}/empty_text_box_undo.rs | 2 --
.../{ => it}/library_style_acceptance.rs | 1 -
.../tests/{ => it}/list_indent_response.rs | 1 -
crates/engine/tests/it/main.rs | 14 +++++++++++
crates/engine/tests/{ => it}/scope_reset.rs | 2 --
.../engine/tests/{ => it}/selection_colors.rs | 2 --
.../tests/{ => it}/shape_builder_response.rs | 1 -
.../tests/{ => it}/distributed_alignment.rs | 0
.../tests/{ => it}/import_link_contract.rs | 0
crates/format/tests/it/main.rs | 5 ++++
.../{ => it}/range_hyperlink_round_trip.rs | 0
crates/mcp/tests/{ => it}/agent_tasks.rs | 3 +--
crates/mcp/tests/{ => it}/attached.rs | 1 -
crates/mcp/tests/{ => it}/automation_roots.rs | 1 -
crates/mcp/tests/{ => it}/common/mod.rs | 1 -
.../mcp/tests/{ => it}/export_hidden_roots.rs | 3 +--
crates/mcp/tests/{ => it}/garbage.rs | 1 -
crates/mcp/tests/it/main.rs | 18 +++++++++++++
crates/mcp/tests/{ => it}/protocol.rs | 3 +--
.../tests/{ => it}/screenshot_pixel_limit.rs | 3 +--
.../tests/{ => it}/canvas_pan_release.rs | 1 -
.../tests/{ => it}/comment_open_other_page.rs | 0
.../ui-egui/tests/{ => it}/file_menu_pdf.rs | 1 -
.../tests/{ => it}/guide_label_narrow.rs | 2 --
crates/ui-egui/tests/it/main.rs | 11 ++++++++
.../tests/{ => it}/recent_file_names.rs | 1 -
docs/mcp.md | 2 +-
xtask/src/main.rs | 25 ++++++++++++++++---
38 files changed, 98 insertions(+), 40 deletions(-)
rename apps/figcraft-cli/tests/{ => it}/cli.rs (99%)
rename apps/figcraft-cli/tests/{ => it}/export_depth.rs (97%)
rename apps/figcraft-cli/tests/{ => it}/fonts.rs (98%)
create mode 100644 apps/figcraft-cli/tests/it/main.rs
rename apps/figcraft-cli/tests/{ => it}/pdf.rs (97%)
rename apps/figcraft-cli/tests/{ => it}/pdf_print.rs (97%)
rename apps/figcraft-server/tests/{ => it}/header_recovery.rs (98%)
create mode 100644 apps/figcraft-server/tests/it/main.rs
rename apps/figcraft-server/tests/{ => it}/problem_retention.rs (100%)
rename crates/engine/tests/{ => it}/empty_text_box_undo.rs (96%)
rename crates/engine/tests/{ => it}/library_style_acceptance.rs (97%)
rename crates/engine/tests/{ => it}/list_indent_response.rs (97%)
create mode 100644 crates/engine/tests/it/main.rs
rename crates/engine/tests/{ => it}/scope_reset.rs (95%)
rename crates/engine/tests/{ => it}/selection_colors.rs (99%)
rename crates/engine/tests/{ => it}/shape_builder_response.rs (95%)
rename crates/format/tests/{ => it}/distributed_alignment.rs (100%)
rename crates/format/tests/{ => it}/import_link_contract.rs (100%)
create mode 100644 crates/format/tests/it/main.rs
rename crates/format/tests/{ => it}/range_hyperlink_round_trip.rs (100%)
rename crates/mcp/tests/{ => it}/agent_tasks.rs (99%)
rename crates/mcp/tests/{ => it}/attached.rs (99%)
rename crates/mcp/tests/{ => it}/automation_roots.rs (98%)
rename crates/mcp/tests/{ => it}/common/mod.rs (97%)
rename crates/mcp/tests/{ => it}/export_hidden_roots.rs (96%)
rename crates/mcp/tests/{ => it}/garbage.rs (98%)
create mode 100644 crates/mcp/tests/it/main.rs
rename crates/mcp/tests/{ => it}/protocol.rs (99%)
rename crates/mcp/tests/{ => it}/screenshot_pixel_limit.rs (96%)
rename crates/ui-egui/tests/{ => it}/canvas_pan_release.rs (98%)
rename crates/ui-egui/tests/{ => it}/comment_open_other_page.rs (100%)
rename crates/ui-egui/tests/{ => it}/file_menu_pdf.rs (97%)
rename crates/ui-egui/tests/{ => it}/guide_label_narrow.rs (97%)
create mode 100644 crates/ui-egui/tests/it/main.rs
rename crates/ui-egui/tests/{ => it}/recent_file_names.rs (97%)
diff --git a/Cargo.toml b/Cargo.toml
index 95c956d5..90297f29 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -103,11 +103,15 @@ todo = "deny"
unimplemented = "deny"
unreachable = "deny"
-[profile.dev.package."*"]
-opt-level = 2
-
+# Workspace crates keep file:line in panic backtraces; dependencies carry no debug info. Both make
+# the test build faster and the target dir smaller.
[profile.dev]
opt-level = 1
+debug = "line-tables-only"
+
+[profile.dev.package."*"]
+opt-level = 2
+debug = false
[profile.release]
lto = "thin"
diff --git a/apps/figcraft-cli/tests/cli.rs b/apps/figcraft-cli/tests/it/cli.rs
similarity index 99%
rename from apps/figcraft-cli/tests/cli.rs
rename to apps/figcraft-cli/tests/it/cli.rs
index eb42b8d8..4af73d69 100644
--- a/apps/figcraft-cli/tests/cli.rs
+++ b/apps/figcraft-cli/tests/it/cli.rs
@@ -1,5 +1,4 @@
//! The binary end to end.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::io::Write;
use std::process::{Command, Stdio};
diff --git a/apps/figcraft-cli/tests/export_depth.rs b/apps/figcraft-cli/tests/it/export_depth.rs
similarity index 97%
rename from apps/figcraft-cli/tests/export_depth.rs
rename to apps/figcraft-cli/tests/it/export_depth.rs
index d8b3ef36..37350c1e 100644
--- a/apps/figcraft-cli/tests/export_depth.rs
+++ b/apps/figcraft-cli/tests/it/export_depth.rs
@@ -1,5 +1,4 @@
//! Depth refusal through the actual CLI, including its exit status and destination writes.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use figcraft_doc::color::{Color, Paint};
use figcraft_doc::{Document, NodeKind};
diff --git a/apps/figcraft-cli/tests/fonts.rs b/apps/figcraft-cli/tests/it/fonts.rs
similarity index 98%
rename from apps/figcraft-cli/tests/fonts.rs
rename to apps/figcraft-cli/tests/it/fonts.rs
index ef5c638f..a48056bd 100644
--- a/apps/figcraft-cli/tests/fonts.rs
+++ b/apps/figcraft-cli/tests/it/fonts.rs
@@ -1,6 +1,5 @@
//! Headless runs lay text out with the installed fonts, like the desktop app, unless
//! `--no-system-fonts` or `FIGCRAFT_NO_SYSTEM_FONTS=1` opts out.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::process::Command;
diff --git a/apps/figcraft-cli/tests/it/main.rs b/apps/figcraft-cli/tests/it/main.rs
new file mode 100644
index 00000000..ae4b0488
--- /dev/null
+++ b/apps/figcraft-cli/tests/it/main.rs
@@ -0,0 +1,12 @@
+//! The crate's integration tests, built as one test binary.
+
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod cli;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod export_depth;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod fonts;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod pdf;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod pdf_print;
diff --git a/apps/figcraft-cli/tests/pdf.rs b/apps/figcraft-cli/tests/it/pdf.rs
similarity index 97%
rename from apps/figcraft-cli/tests/pdf.rs
rename to apps/figcraft-cli/tests/it/pdf.rs
index 28d5ca6c..185d5b60 100644
--- a/apps/figcraft-cli/tests/pdf.rs
+++ b/apps/figcraft-cli/tests/it/pdf.rs
@@ -1,5 +1,4 @@
//! `figcraft-cli export --format pdf` and `convert … .pdf` end to end.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::process::Command;
diff --git a/apps/figcraft-cli/tests/pdf_print.rs b/apps/figcraft-cli/tests/it/pdf_print.rs
similarity index 97%
rename from apps/figcraft-cli/tests/pdf_print.rs
rename to apps/figcraft-cli/tests/it/pdf_print.rs
index b2ce3c9a..f12725ed 100644
--- a/apps/figcraft-cli/tests/pdf_print.rs
+++ b/apps/figcraft-cli/tests/it/pdf_print.rs
@@ -1,5 +1,4 @@
//! `figcraft-cli export` with PDF print options: bleed, marks, CMYK; bad lengths are usage errors.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::process::Command;
diff --git a/apps/figcraft-server/tests/header_recovery.rs b/apps/figcraft-server/tests/it/header_recovery.rs
similarity index 98%
rename from apps/figcraft-server/tests/header_recovery.rs
rename to apps/figcraft-server/tests/it/header_recovery.rs
index d728908d..bb0be1d0 100644
--- a/apps/figcraft-server/tests/header_recovery.rs
+++ b/apps/figcraft-server/tests/it/header_recovery.rs
@@ -2,7 +2,6 @@
//! holds confirmed edits (#408): the log is replayed over the snapshot, which only the changes the
//! snapshot lacks survive, and the damage is reported. A genuine leftover of a compaction cut short
//! still restores silently.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use figcraft_collab::message::{Access, ClientMsg};
use figcraft_collab::{Client, Outgoing, Replica, Server};
diff --git a/apps/figcraft-server/tests/it/main.rs b/apps/figcraft-server/tests/it/main.rs
new file mode 100644
index 00000000..3027ed99
--- /dev/null
+++ b/apps/figcraft-server/tests/it/main.rs
@@ -0,0 +1,5 @@
+//! The crate's integration tests, built as one test binary.
+
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod header_recovery;
+mod problem_retention;
diff --git a/apps/figcraft-server/tests/problem_retention.rs b/apps/figcraft-server/tests/it/problem_retention.rs
similarity index 100%
rename from apps/figcraft-server/tests/problem_retention.rs
rename to apps/figcraft-server/tests/it/problem_retention.rs
diff --git a/crates/engine/tests/empty_text_box_undo.rs b/crates/engine/tests/it/empty_text_box_undo.rs
similarity index 96%
rename from crates/engine/tests/empty_text_box_undo.rs
rename to crates/engine/tests/it/empty_text_box_undo.rs
index ec73b83a..0a302ac2 100644
--- a/crates/engine/tests/empty_text_box_undo.rs
+++ b/crates/engine/tests/it/empty_text_box_undo.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
-
use figcraft_engine::{
Session,
doc::NodeKind,
diff --git a/crates/engine/tests/library_style_acceptance.rs b/crates/engine/tests/it/library_style_acceptance.rs
similarity index 97%
rename from crates/engine/tests/library_style_acceptance.rs
rename to crates/engine/tests/it/library_style_acceptance.rs
index 233ddc8b..07940132 100644
--- a/crates/engine/tests/library_style_acceptance.rs
+++ b/crates/engine/tests/it/library_style_acceptance.rs
@@ -1,5 +1,4 @@
//! Accepting a library update that changes only a paint style refreshes the layers linked to it.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::disallowed_methods)]
use figcraft_doc::{NodeId, StyleKind};
use figcraft_engine::Session;
diff --git a/crates/engine/tests/list_indent_response.rs b/crates/engine/tests/it/list_indent_response.rs
similarity index 97%
rename from crates/engine/tests/list_indent_response.rs
rename to crates/engine/tests/it/list_indent_response.rs
index 1dae8754..e6d47956 100644
--- a/crates/engine/tests/list_indent_response.rs
+++ b/crates/engine/tests/it/list_indent_response.rs
@@ -1,5 +1,4 @@
//! `text.listIndent` / `text.listOutdent` report `changed` only when the document changed.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use figcraft_engine::{
Session,
diff --git a/crates/engine/tests/it/main.rs b/crates/engine/tests/it/main.rs
new file mode 100644
index 00000000..a97e3434
--- /dev/null
+++ b/crates/engine/tests/it/main.rs
@@ -0,0 +1,14 @@
+//! The crate's integration tests, built as one test binary.
+
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod empty_text_box_undo;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::disallowed_methods)]
+mod library_style_acceptance;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod list_indent_response;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod scope_reset;
+#[allow(clippy::unwrap_used)]
+mod selection_colors;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod shape_builder_response;
diff --git a/crates/engine/tests/scope_reset.rs b/crates/engine/tests/it/scope_reset.rs
similarity index 95%
rename from crates/engine/tests/scope_reset.rs
rename to crates/engine/tests/it/scope_reset.rs
index 6d875d12..1838e8a9 100644
--- a/crates/engine/tests/scope_reset.rs
+++ b/crates/engine/tests/it/scope_reset.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
-
use figcraft_engine::Session;
use serde_json::json;
diff --git a/crates/engine/tests/selection_colors.rs b/crates/engine/tests/it/selection_colors.rs
similarity index 99%
rename from crates/engine/tests/selection_colors.rs
rename to crates/engine/tests/it/selection_colors.rs
index e13f9f59..4e559d27 100644
--- a/crates/engine/tests/selection_colors.rs
+++ b/crates/engine/tests/it/selection_colors.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::unwrap_used)]
-
use figcraft_color::Paint;
use figcraft_doc::NodeId;
use figcraft_engine::{
diff --git a/crates/engine/tests/shape_builder_response.rs b/crates/engine/tests/it/shape_builder_response.rs
similarity index 95%
rename from crates/engine/tests/shape_builder_response.rs
rename to crates/engine/tests/it/shape_builder_response.rs
index e1426823..6187e556 100644
--- a/crates/engine/tests/shape_builder_response.rs
+++ b/crates/engine/tests/it/shape_builder_response.rs
@@ -1,4 +1,3 @@
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use figcraft_engine::Session;
use serde_json::{Value, json};
diff --git a/crates/format/tests/distributed_alignment.rs b/crates/format/tests/it/distributed_alignment.rs
similarity index 100%
rename from crates/format/tests/distributed_alignment.rs
rename to crates/format/tests/it/distributed_alignment.rs
diff --git a/crates/format/tests/import_link_contract.rs b/crates/format/tests/it/import_link_contract.rs
similarity index 100%
rename from crates/format/tests/import_link_contract.rs
rename to crates/format/tests/it/import_link_contract.rs
diff --git a/crates/format/tests/it/main.rs b/crates/format/tests/it/main.rs
new file mode 100644
index 00000000..6286e8db
--- /dev/null
+++ b/crates/format/tests/it/main.rs
@@ -0,0 +1,5 @@
+//! The crate's integration tests, built as one test binary.
+
+mod distributed_alignment;
+mod import_link_contract;
+mod range_hyperlink_round_trip;
diff --git a/crates/format/tests/range_hyperlink_round_trip.rs b/crates/format/tests/it/range_hyperlink_round_trip.rs
similarity index 100%
rename from crates/format/tests/range_hyperlink_round_trip.rs
rename to crates/format/tests/it/range_hyperlink_round_trip.rs
diff --git a/crates/mcp/tests/agent_tasks.rs b/crates/mcp/tests/it/agent_tasks.rs
similarity index 99%
rename from crates/mcp/tests/agent_tasks.rs
rename to crates/mcp/tests/it/agent_tasks.rs
index b35f3e7f..b83fc3b8 100644
--- a/crates/mcp/tests/agent_tasks.rs
+++ b/crates/mcp/tests/it/agent_tasks.rs
@@ -1,8 +1,7 @@
//! End-to-end agent tasks: an in-process MCP client completes realistic design tasks only through
//! MCP tool calls, and checks every result through inspect_document / get_node like an agent would.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
-mod common;
+use crate::common;
use common::{Client, approx, png_dims};
use serde_json::{Value, json};
diff --git a/crates/mcp/tests/attached.rs b/crates/mcp/tests/it/attached.rs
similarity index 99%
rename from crates/mcp/tests/attached.rs
rename to crates/mcp/tests/it/attached.rs
index 69194604..f1343dd2 100644
--- a/crates/mcp/tests/attached.rs
+++ b/crates/mcp/tests/it/attached.rs
@@ -1,6 +1,5 @@
//! The attached backend against a fake app: a loopback control server answering with a headless
//! session, speaking the desktop app's JSON-lines protocol.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::io::{BufRead, BufReader, Write};
use std::net::TcpListener;
diff --git a/crates/mcp/tests/automation_roots.rs b/crates/mcp/tests/it/automation_roots.rs
similarity index 98%
rename from crates/mcp/tests/automation_roots.rs
rename to crates/mcp/tests/it/automation_roots.rs
index ced1e145..aa8e1b24 100644
--- a/crates/mcp/tests/automation_roots.rs
+++ b/crates/mcp/tests/it/automation_roots.rs
@@ -1,6 +1,5 @@
//! `--automation-read-root` / `--automation-write-root` over MCP (#715): a tool call reads only
//! inside the read and write roots and writes only inside the write roots.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::disallowed_methods)]
use std::path::PathBuf;
diff --git a/crates/mcp/tests/common/mod.rs b/crates/mcp/tests/it/common/mod.rs
similarity index 97%
rename from crates/mcp/tests/common/mod.rs
rename to crates/mcp/tests/it/common/mod.rs
index be4dcea2..51e74865 100644
--- a/crates/mcp/tests/common/mod.rs
+++ b/crates/mcp/tests/it/common/mod.rs
@@ -1,5 +1,4 @@
//! An in-process MCP client: feeds JSON-RPC lines to `Server::handle_line`.
-#![allow(dead_code, clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use figcraft_mcp::Server;
use serde_json::{Value, json};
diff --git a/crates/mcp/tests/export_hidden_roots.rs b/crates/mcp/tests/it/export_hidden_roots.rs
similarity index 96%
rename from crates/mcp/tests/export_hidden_roots.rs
rename to crates/mcp/tests/it/export_hidden_roots.rs
index ded6f731..0a3b8de4 100644
--- a/crates/mcp/tests/export_hidden_roots.rs
+++ b/crates/mcp/tests/it/export_hidden_roots.rs
@@ -1,7 +1,6 @@
//! Hidden top-level layers in an export take no room in the image (issue #447).
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
-mod common;
+use crate::common;
use common::{Client, png_dims};
use serde_json::{Value, json};
diff --git a/crates/mcp/tests/garbage.rs b/crates/mcp/tests/it/garbage.rs
similarity index 98%
rename from crates/mcp/tests/garbage.rs
rename to crates/mcp/tests/it/garbage.rs
index 262934c7..5d9e237e 100644
--- a/crates/mcp/tests/garbage.rs
+++ b/crates/mcp/tests/it/garbage.rs
@@ -1,5 +1,4 @@
//! Fuzz-ish: no input line may crash the server or leave it unable to answer.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use figcraft_mcp::{Server, TOOL_NAMES};
use proptest::prelude::*;
diff --git a/crates/mcp/tests/it/main.rs b/crates/mcp/tests/it/main.rs
new file mode 100644
index 00000000..b5e3d89d
--- /dev/null
+++ b/crates/mcp/tests/it/main.rs
@@ -0,0 +1,18 @@
+//! The crate's integration tests, built as one test binary.
+
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod agent_tasks;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod attached;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::disallowed_methods)]
+mod automation_roots;
+#[allow(dead_code, clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod common;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod export_hidden_roots;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod garbage;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod protocol;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod screenshot_pixel_limit;
diff --git a/crates/mcp/tests/protocol.rs b/crates/mcp/tests/it/protocol.rs
similarity index 99%
rename from crates/mcp/tests/protocol.rs
rename to crates/mcp/tests/it/protocol.rs
index 6e943a1e..617790f4 100644
--- a/crates/mcp/tests/protocol.rs
+++ b/crates/mcp/tests/it/protocol.rs
@@ -1,7 +1,6 @@
//! JSON-RPC / MCP protocol behaviour.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
-mod common;
+use crate::common;
use common::Client;
use figcraft_mcp::{PROTOCOL_VERSION, Server, TOOL_NAMES};
diff --git a/crates/mcp/tests/screenshot_pixel_limit.rs b/crates/mcp/tests/it/screenshot_pixel_limit.rs
similarity index 96%
rename from crates/mcp/tests/screenshot_pixel_limit.rs
rename to crates/mcp/tests/it/screenshot_pixel_limit.rs
index 095992ff..e575f1d5 100644
--- a/crates/mcp/tests/screenshot_pixel_limit.rs
+++ b/crates/mcp/tests/it/screenshot_pixel_limit.rs
@@ -1,6 +1,5 @@
//! `screenshot` with `ids` must honour `maxSize` for the rendered paint area (shadows, overflow).
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
-mod common;
+use crate::common;
use common::{Client, png_dims};
use serde_json::{Value, json};
diff --git a/crates/ui-egui/tests/canvas_pan_release.rs b/crates/ui-egui/tests/it/canvas_pan_release.rs
similarity index 98%
rename from crates/ui-egui/tests/canvas_pan_release.rs
rename to crates/ui-egui/tests/it/canvas_pan_release.rs
index c54d20dc..cd1a6e1c 100644
--- a/crates/ui-egui/tests/canvas_pan_release.rs
+++ b/crates/ui-egui/tests/it/canvas_pan_release.rs
@@ -1,6 +1,5 @@
//! A canvas pan (middle button or Space + primary) ends when its button is released, even when the
//! release happens over a panel: returning to the canvas with no button held must not move the view.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use egui::{Event, Key, PointerButton, Pos2, RawInput, Rect, vec2};
use figcraft_engine::Session;
diff --git a/crates/ui-egui/tests/comment_open_other_page.rs b/crates/ui-egui/tests/it/comment_open_other_page.rs
similarity index 100%
rename from crates/ui-egui/tests/comment_open_other_page.rs
rename to crates/ui-egui/tests/it/comment_open_other_page.rs
diff --git a/crates/ui-egui/tests/file_menu_pdf.rs b/crates/ui-egui/tests/it/file_menu_pdf.rs
similarity index 97%
rename from crates/ui-egui/tests/file_menu_pdf.rs
rename to crates/ui-egui/tests/it/file_menu_pdf.rs
index 30b847b7..812529e0 100644
--- a/crates/ui-egui/tests/file_menu_pdf.rs
+++ b/crates/ui-egui/tests/it/file_menu_pdf.rs
@@ -1,6 +1,5 @@
//! File > Export frames to PDF: the menu asks where to save and writes the frames' PDF there,
//! one visible top-level frame per page.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::path::PathBuf;
diff --git a/crates/ui-egui/tests/guide_label_narrow.rs b/crates/ui-egui/tests/it/guide_label_narrow.rs
similarity index 97%
rename from crates/ui-egui/tests/guide_label_narrow.rs
rename to crates/ui-egui/tests/it/guide_label_narrow.rs
index 6c4276ad..464fbfed 100644
--- a/crates/ui-egui/tests/guide_label_narrow.rs
+++ b/crates/ui-egui/tests/it/guide_label_narrow.rs
@@ -1,5 +1,3 @@
-#![allow(clippy::unwrap_used)]
-
use egui::{Pos2, RawInput, Rect, Vec2, vec2};
use figcraft_engine::Session;
use figcraft_ui_egui::{FigApp, NoServices};
diff --git a/crates/ui-egui/tests/it/main.rs b/crates/ui-egui/tests/it/main.rs
new file mode 100644
index 00000000..007f450d
--- /dev/null
+++ b/crates/ui-egui/tests/it/main.rs
@@ -0,0 +1,11 @@
+//! The crate's integration tests, built as one test binary.
+
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod canvas_pan_release;
+mod comment_open_other_page;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod file_menu_pdf;
+#[allow(clippy::unwrap_used)]
+mod guide_label_narrow;
+#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
+mod recent_file_names;
diff --git a/crates/ui-egui/tests/recent_file_names.rs b/crates/ui-egui/tests/it/recent_file_names.rs
similarity index 97%
rename from crates/ui-egui/tests/recent_file_names.rs
rename to crates/ui-egui/tests/it/recent_file_names.rs
index 461d0c73..41e37ec2 100644
--- a/crates/ui-egui/tests/recent_file_names.rs
+++ b/crates/ui-egui/tests/it/recent_file_names.rs
@@ -1,5 +1,4 @@
//! Recent file rows keep their full accessible name.
-#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use egui::{Context, Id, Pos2, RawInput, Rect, accesskit::Role, vec2};
use figcraft_engine::Session;
diff --git a/docs/mcp.md b/docs/mcp.md
index dfea95cc..211b98d8 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -1675,7 +1675,7 @@ other key next to `$step` fails the whole batch, which is rolled back. Only an o
value too) is read as a reference. A step that is itself a `command.batch` is passed on as written,
so the references in its steps are to its own steps, not the outer batch's.
-The end-to-end tests in `crates/mcp/tests/agent_tasks.rs` are worked examples of realistic tasks
+The end-to-end tests in `crates/mcp/tests/it/agent_tasks.rs` are worked examples of realistic tasks
(auto layout, a card built in one batch with step references, components and overrides, gradients
and shadows, paint styles, Light/Dark variables, align/distribute/group, boolean subtract + flatten,
export, undo/redo, drawing with tools).
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index e3f00e8b..81d48471 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -1,6 +1,7 @@
//! Project tasks: `cargo xtask `.
//!
//! - `ci` fmt check, clippy -D warnings, tests, layers, assets, wasm check
+//! - `test` the workspace tests (nextest when installed) and doctests
//! - `layers` crate dependency layering check
//! - `assets` every file under assets/ and docs/ has a row in ATTRIBUTION.md
//! - `parity` menu-catalog coverage → docs/parity-checklist.md
@@ -16,7 +17,7 @@
mod icon;
mod layers;
-use std::process::{Command, ExitCode};
+use std::process::{Command, ExitCode, Stdio};
fn run(cmd: &mut Command) -> bool {
eprintln!("$ {cmd:?}");
@@ -36,6 +37,7 @@ fn main() -> ExitCode {
let task = args.first().map(String::as_str).unwrap_or("help");
let ok = match task {
"ci" => ci(),
+ "test" => test(),
"layers" => layers::check(&root()),
"assets" => assets(),
"parity" => parity(),
@@ -45,7 +47,7 @@ fn main() -> ExitCode {
"plugins" => plugins(),
"bench" => bench(args.get(1).map_or("1000,10000,50000", String::as_str)),
_ => {
- eprintln!("tasks: ci, layers, assets, parity, version [set X.Y.Z], icon, wasm, plugins, bench [SIZES]");
+ eprintln!("tasks: ci, test, layers, assets, parity, version [set X.Y.Z], icon, wasm, plugins, bench [SIZES]");
task == "help"
}
};
@@ -54,16 +56,31 @@ fn main() -> ExitCode {
fn ci() -> bool {
run(cargo().args(["fmt", "--all", "--check"]))
- && run(cargo().args(["clippy", "--workspace", "--all-targets", "--", "-D", "warnings"]))
- && run(cargo().args(["test", "--workspace"]))
+ && run(cargo().args(["clippy", "--workspace", "--all-targets", "--keep-going", "--", "-D", "warnings"]))
+ && test()
&& layers::check(&root())
&& assets()
&& wasm()
}
+/// Unit and integration tests with nextest when it is installed (`cargo install cargo-nextest`),
+/// else with `cargo test`; then the doctests, which nextest does not run. Examples are not built:
+/// clippy's `--all-targets` already checks them.
+fn test() -> bool {
+ let nextest = cargo().args(["nextest", "--version"]).stdout(Stdio::null()).stderr(Stdio::null()).status().is_ok_and(|s| s.success());
+ let units = if nextest {
+ run(cargo().args(["nextest", "run", "--workspace", "--lib", "--bins", "--tests"]))
+ } else {
+ eprintln!("xtask: cargo-nextest not installed; running unit and integration tests with `cargo test`");
+ run(cargo().args(["test", "--workspace", "--lib", "--bins", "--tests"]))
+ };
+ units && run(cargo().args(["test", "--workspace", "--doc"]))
+}
+
fn wasm() -> bool {
run(cargo().args([
"check",
+ "--keep-going",
"--target",
"wasm32-unknown-unknown",
"-p",
From c48102350b1ef00614b105ac07451ff0ca8a5141 Mon Sep 17 00:00:00 2001
From: aiongg <67543387+aiongg@users.noreply.github.com>
Date: Fri, 23 Oct 2026 13:02:11 -0400
Subject: [PATCH 16/23] Packaging: pin the signing client and appimagetool, and
check their hashes (#950)
* Packaging: pin the Windows signing client and check its hash
* Packaging: pin appimagetool and check its hash
* Reject AppImage download for architectures without a pinned appimagetool
* Pin the AppImage runtime
---
packaging/linux/package.sh | 46 +++++++++++++++++++++++++++++++++-----
packaging/windows/sign.ps1 | 13 ++++++++---
2 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh
index 2480f204..a3ea29b1 100755
--- a/packaging/linux/package.sh
+++ b/packaging/linux/package.sh
@@ -105,6 +105,23 @@ fi
# ---- AppImage -----------------------------------------------------------------------------------
if has appimage; then
+ APPIMAGETOOL_VERSION=1.9.1
+ case "$ARCH" in
+ x86_64) APPIMAGETOOL_SHA256=ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0 ;;
+ aarch64) APPIMAGETOOL_SHA256=f0837e7448a0c1e4e650a93bb3e85802546e60654ef287576f46c71c126a9158 ;;
+ *) APPIMAGETOOL_SHA256='' ;;
+ esac
+ # appimagetool otherwise fetches the unpinned type2-runtime `continuous` build and embeds it.
+ APPIMAGE_RUNTIME_VERSION=20251108
+ case "$ARCH" in
+ x86_64) APPIMAGE_RUNTIME_SHA256=2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d ;;
+ aarch64) APPIMAGE_RUNTIME_SHA256=00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444 ;;
+ *) APPIMAGE_RUNTIME_SHA256='' ;;
+ esac
+ if [[ -z "$APPIMAGE_RUNTIME_SHA256" ]]; then
+ echo "no pinned AppImage runtime for $ARCH; build the AppImage on x86_64 or aarch64" >&2
+ exit 2
+ fi
APPDIR="$WORK/FigCraft.AppDir"
cp -R "$STAGE" "$APPDIR"
mv "$APPDIR/usr/share/doc" "$WORK/doc-unused"
@@ -119,17 +136,36 @@ if has appimage; then
TOOL="${APPIMAGETOOL:-$(command -v appimagetool || true)}"
if [[ -z "$TOOL" ]]; then
- TOOL="$CARGO_TARGET_DIR/appimagetool-$ARCH.AppImage"
- if [[ ! -x "$TOOL" ]]; then
- curl --proto '=https' -fsSL -o "$TOOL" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
- chmod +x "$TOOL"
+ if [[ -z "$APPIMAGETOOL_SHA256" ]]; then
+ echo "no pinned appimagetool for $ARCH; set APPIMAGETOOL or put appimagetool on PATH" >&2
+ exit 2
fi
+ TOOL="$CARGO_TARGET_DIR/appimagetool-$APPIMAGETOOL_VERSION-$ARCH.AppImage"
+ if [[ ! -x "$TOOL" ]]; then
+ download="$TOOL.download"
+ curl --proto '=https' -fsSL -o "$download" \
+ "https://github.com/AppImage/appimagetool/releases/download/$APPIMAGETOOL_VERSION/appimagetool-$ARCH.AppImage"
+ printf '%s %s\n' "$APPIMAGETOOL_SHA256" "$download" | sha256sum -c -
+ chmod 755 "$download"
+ mv "$download" "$TOOL"
+ fi
+ printf '%s %s\n' "$APPIMAGETOOL_SHA256" "$TOOL" | sha256sum -c -
fi
+ RUNTIME="$CARGO_TARGET_DIR/appimage-runtime-$APPIMAGE_RUNTIME_VERSION-$ARCH"
+ if [[ ! -f "$RUNTIME" ]]; then
+ download="$RUNTIME.download"
+ curl --proto '=https' -fsSL -o "$download" \
+ "https://github.com/AppImage/type2-runtime/releases/download/$APPIMAGE_RUNTIME_VERSION/runtime-$ARCH"
+ printf '%s %s\n' "$APPIMAGE_RUNTIME_SHA256" "$download" | sha256sum -c -
+ mv "$download" "$RUNTIME"
+ fi
+ printf '%s %s\n' "$APPIMAGE_RUNTIME_SHA256" "$RUNTIME" | sha256sum -c -
# Absolute, because appimagetool runs in $DIST below (CARGO_TARGET_DIR or APPIMAGETOOL may be
# relative, e.g. target/agent-).
OUT="$(cd "$DIST" && pwd)/$BASENAME.AppImage"
APPDIR="$(cd "$APPDIR" && pwd)"
TOOL="$(cd "$(dirname "$TOOL")" && pwd)/$(basename "$TOOL")"
+ RUNTIME="$(cd "$(dirname "$RUNTIME")" && pwd)/$(basename "$RUNTIME")"
# A .zsync left by an earlier run would hide a missing zsyncmake and describe another file.
rm -f "$OUT.zsync"
# Update information: AppImageUpdate, AppImageLauncher and the like read it from the
@@ -141,7 +177,7 @@ if has appimage; then
# Extract-and-run: works without FUSE (containers, CI). The output embeds the static runtime,
# so users don't need libfuse2 either. With zsyncmake on the host (CI installs the zsync
# package) appimagetool also writes the .zsync, into its working directory, hence the cd.
- (cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream -u "$UPDATE_INFO" "$APPDIR" "$OUT")
+ (cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream --runtime-file "$RUNTIME" -u "$UPDATE_INFO" "$APPDIR" "$OUT")
echo "wrote $OUT"
if [[ -s "$OUT.zsync" ]]; then
echo "wrote $OUT.zsync"
diff --git a/packaging/windows/sign.ps1 b/packaging/windows/sign.ps1
index 3d94747a..795ef067 100644
--- a/packaging/windows/sign.ps1
+++ b/packaging/windows/sign.ps1
@@ -56,8 +56,8 @@ if (-not $haveCert -and -not $haveAzure) {
$script:SignTool = Find-SignTool
$common = @('sign', '/v', '/fd', 'SHA256', '/td', 'SHA256', '/d', 'FigCraft', '/du', 'https://github.com/storytold/figcraft')
-$tmp = Join-Path ([IO.Path]::GetTempPath()) "figcraft-sign-$PID"
-New-Item -ItemType Directory -Force -Path $tmp | Out-Null
+$tmp = Join-Path ([IO.Path]::GetTempPath()) "figcraft-sign-$([IO.Path]::GetRandomFileName())"
+New-Item -ItemType Directory -Path $tmp | Out-Null
try {
if ($haveCert) {
@@ -73,8 +73,15 @@ try {
Write-Output "Signing with Azure Trusted Signing ($env:AZURE_SIGNING_ACCOUNT / $env:AZURE_CERT_PROFILE): $($Files -join ', ')"
# The dlib authenticates with DefaultAzureCredential, which reads AZURE_TENANT_ID,
# AZURE_CLIENT_ID and AZURE_CLIENT_SECRET from the environment.
+ $trustedSigningVersion = '1.0.95'
+ $trustedSigningSha256 = '3bfcf1e0a3cb42af1692f0a8ed45c15de070c2de86f28a59b2795d904d8a920f'
$pkg = Join-Path $tmp 'trusted-signing.zip'
- Invoke-WebRequest -Uri 'https://www.nuget.org/api/v2/package/Microsoft.Trusted.Signing.Client' -OutFile $pkg
+ $uri = "https://api.nuget.org/v3-flatcontainer/microsoft.trusted.signing.client/$trustedSigningVersion/microsoft.trusted.signing.client.$trustedSigningVersion.nupkg"
+ Invoke-WebRequest -Uri $uri -OutFile $pkg
+ $actualHash = (Get-FileHash -Path $pkg -Algorithm SHA256).Hash.ToLowerInvariant()
+ if ($actualHash -ne $trustedSigningSha256) {
+ throw "Microsoft.Trusted.Signing.Client $trustedSigningVersion checksum mismatch"
+ }
Expand-Archive -Path $pkg -DestinationPath (Join-Path $tmp 'client') -Force
$dlib = Get-ChildItem -Path (Join-Path $tmp 'client') -Recurse -Filter Azure.CodeSigning.Dlib.dll |
Where-Object { $_.FullName -match '\\x64\\' } | Select-Object -First 1
From 6ba02236367320fef0b373b461f6e9796bfc6de0 Mon Sep 17 00:00:00 2001
From: aiongg <67543387+aiongg@users.noreply.github.com>
Date: Fri, 23 Oct 2026 13:50:42 -0400
Subject: [PATCH 17/23] Tests: the paragraph indent test loads system fonts and
skips only without glyphs (#1227)
---
crates/engine/src/text_behaviour_tests.rs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/crates/engine/src/text_behaviour_tests.rs b/crates/engine/src/text_behaviour_tests.rs
index 84315f1f..b9a76fbc 100644
--- a/crates/engine/src/text_behaviour_tests.rs
+++ b/crates/engine/src/text_behaviour_tests.rs
@@ -177,20 +177,19 @@ fn vertical_trim_through_node_set() {
#[test]
fn paragraph_indent_only_moves_left_aligned_text() {
+ figcraft_text::scan_system_fonts();
let mut s = Session::new();
let t = text(&mut s, "Indented paragraph", json!({"fontSize": 20, "paragraphIndent": 30}));
let first_x = |s: &Session| {
let (l, _) = figcraft_text::layout_node(s.doc().unwrap().node(t).unwrap()).unwrap();
- (l.glyphs.first().map_or(0.0, |g| g.x), l.width)
+ (l.glyphs.first().map(|g| g.x), l.width)
};
- let (x, w) = first_x(&s);
- if w <= 0.0 {
- return;
- }
+ // Without any font there are no glyphs, but the indent alone still gives the box a width.
+ let (Some(x), w) = first_x(&s) else { return };
assert!((x - 30.0).abs() < 1e-6, "left: indented");
s.execute("node.set", &json!({"id": t, "props": {"textAlign": "center"}})).unwrap();
let (x, w2) = first_x(&s);
- assert!((w2 - (w - 30.0)).abs() < 1e-6 && x.abs() < 1e-6, "centered auto-width text: no indent, the box shrinks by it");
+ assert!((w2 - (w - 30.0)).abs() < 1e-6 && x.is_some_and(|x| x.abs() < 1e-6), "centered auto-width text: no indent, the box shrinks by it");
}
/// A new text made with the Text tool by a press at `from`, a drag to `to` and a release, holding
From 87e0c8a7da1e06ec76f0eb83ae3600e72f09db81 Mon Sep 17 00:00:00 2001
From: aiongg <67543387+aiongg@users.noreply.github.com>
Date: Fri, 23 Oct 2026 14:31:08 -0400
Subject: [PATCH 18/23] CI: shared gate workflow; FreeBSD nightly and on
release (#1206)
* CI: run the gate through craft-common-actions' shared gate.yml; FreeBSD nightly and on release
ci.yml calls the shared workflow (cached apt packages, nextest, main-only cache saves, Cargo.lock check). FreeBSD runs nightly and on pushes to release instead of on pull requests. Depends on storytold/craft-common-actions#69.
* CI: build the shared gate without craft-fonts, as before
* CI: build the shared gate with release.yml's craft-fonts pin
---
.github/workflows/ci.yml | 89 +++++++----------------------------
.github/workflows/freebsd.yml | 10 ++--
2 files changed, 21 insertions(+), 78 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3dfa31d9..1968076f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,9 +1,7 @@
-# CI for pull requests and main: format, clippy, tests, dependency layering, asset attribution and
-# the wasm32 check (the same gates as `cargo xtask ci`). Linux only: macOS is built and tested only
-# by release.yml (the org's macOS runners are kept for releases; craftrules release/playbook.md),
-# and Windows/FreeBSD packaging have their own workflows.
name: CI
+# Quality gates for every push to main and every pull request (`cargo xtask ci`), through the
+# suite's shared gate workflow in craft-common-actions.
on:
push:
branches: [main]
@@ -13,76 +11,21 @@ on:
permissions:
contents: read
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: 0
- RUST_BACKTRACE: 1
- # Debug and test builds keep line tables (file:line in panic backtraces) but drop the rest of the
- # debug info: faster codegen and links, and a smaller target dir.
- CARGO_PROFILE_DEV_DEBUG: line-tables-only
-
-# A newer push to a PR branch cancels its older run. Runs on main are never cancelled, so every
-# main state that gets a run is checked to the end.
+# A newer push to a PR branch cancels its older run; every push to main runs to the end.
concurrency:
- group: ci-${{ github.ref }}
+ group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
- test:
- timeout-minutes: 35
- name: test (ubuntu-latest)
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v7
-
- - name: Install Linux system dependencies (egui/winit/rfd)
- run: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends \
- libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev \
- libgl1-mesa-dev libgtk-3-dev
-
- - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
- with:
- components: clippy, rustfmt
-
- # Only main saves caches; PRs restore main's, so PR caches don't evict main's.
- - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- with:
- save-if: ${{ github.ref == 'refs/heads/main' }}
- cache-on-failure: true
-
- - name: Format
- run: cargo fmt --all -- --check
-
- - name: Clippy
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
-
- # Without craft-fonts (the optional CRAFT_FONTS_DIR input, which .cargo/config.toml points at
- # a sibling checkout that CI doesn't have): everything must build and pass without it.
- - name: Test
- run: cargo test --workspace --locked
-
- - name: Dependency layering
- run: cargo run --locked -q -p xtask -- layers
-
- - name: Asset attribution
- run: cargo run --locked -q -p xtask -- assets
-
- wasm:
- timeout-minutes: 30
- name: wasm32 check
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v7
- - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
- with:
- targets: wasm32-unknown-unknown
- - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- with:
- key: wasm32
- save-if: ${{ github.ref == 'refs/heads/main' }}
- cache-on-failure: true
- # The engine, the UI crate and apps/figcraft-web must keep compiling for the browser.
- - name: Check wasm-safe crates
- run: cargo run --locked -q -p xtask -- wasm
+ gate:
+ # Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
+ uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
+ with:
+ # The craft-fonts commit release.yml builds with. Needs fonts/latin-manifest.txt (Inter):
+ # crates/text/build.rs fails a build that requires craft-fonts without it. Only craft-fonts'
+ # pr/latin-presentation-fonts has it; its main has Noto Sans Georgian but no Inter. Re-pin
+ # once one commit has both (storytold/craft-fonts#42).
+ craft-fonts-ref: 43913056ce82a3fdad0ef69f6b88d1dc922a8104
+ packages: >-
+ libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
+ libgtk-3-dev
diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml
index ff15bfbc..3b03a99c 100644
--- a/.github/workflows/freebsd.yml
+++ b/.github/workflows/freebsd.yml
@@ -4,12 +4,10 @@
# before it can fail a release. Nothing is uploaded and no secrets are used.
name: FreeBSD
-# The VM build takes one to several hours, so it runs nightly on main rather than on every push
-# or dependency change: a drifted dependency still shows up within a day. PRs that change the
-# FreeBSD packaging itself still run it.
+# The VM build is slow, so it runs nightly on main and on pushes to `release`, not on every pull
+# request: a drifted dependency still shows up within a day, and always before a release ships.
+# PRs that change the FreeBSD workflow or packaging itself still run it.
on:
- schedule:
- - cron: "17 2 * * *"
push:
branches: [release]
pull_request:
@@ -17,6 +15,8 @@ on:
- .github/workflows/freebsd.yml
- packaging/freebsd/**
- packaging/env.sh
+ schedule:
+ - cron: "17 2 * * *"
workflow_dispatch:
concurrency:
From d6e8a6e8745434b0f4e495b5216ad19b4a820722 Mon Sep 17 00:00:00 2001
From: BFlat
Date: Sat, 24 Oct 2026 02:02:19 +0700
Subject: [PATCH 19/23] Docs: roadmap entries for the community PRs in #507,
#510, #529 and #530 (#587)
Roadmap, milestone and parity rows for the 93 community PRs landed in batches #507, #510, #529 and #530.
---
ROADMAP.md | 65 ++++++++++++++++++++++++++++++++++---
docs/file-format-parity.md | 7 ++--
docs/gaps.md | 7 ++--
docs/hardware-parity.md | 7 ++--
docs/localization-parity.md | 9 +++--
docs/roadmap.md | 58 ++++++++++++++++++++++++++++++---
docs/target-app-parity.md | 3 +-
docs/ui-parity.md | 11 ++++---
8 files changed, 141 insertions(+), 26 deletions(-)
diff --git a/ROADMAP.md b/ROADMAP.md
index f43cd015..b3edc4ee 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -2,7 +2,7 @@
**Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents)
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (community batch #753: Selection colors, smart-selection spacing, a Present tab; language table re-measured from the catalogs; community fixes from #524 up (55 PRs: `.fig` import fidelity, paste from other apps, the Actions palette, editor fixes, server limits) and a boolean-op crash guard; number variables in the text content picker (#629); frames and sections convert into each other (#719); bounded canvas pan overscan; community fixes from #478 up and a control-channel fix (#589); bounded canvas pan overscan; Typography spacing icons support scrubbing (#373); font scans skip named pipes; system theme on first run; recent files as cards with thumbnails on the home screen; community fixes: lost images reported on loading (#207), SVG import budgets (#190), Leptos code (#223), full screen (#227), server snapshots readable again (#188), owner-only preferences (#200), ruzstd 0.9.1 (#182), layer cycle repair (#205), batch rollback, Direct3D 12 on Windows, plugin metering (#192); vector edit mode regions: hover hatch, selection and drag; SVG/PDF exports refuse over-depth documents (#208); bounded MCP/control framing, connections and queues (#201); plugin log limits (#191); live-session revert guard (#198); attached MCP no longer replays after a lost reply (#194); repeat command recursion fix; the Layout panel's constrain-proportions link scales the other side, #220; core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; starter templates, a Templates tab and Getting started tips on the home screen; your online files; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; Windows QA pass with eight fixes; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7)
FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow,
native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through
@@ -50,7 +50,7 @@ against real Figma documents. Ready-for-real-work is ~53%, inside alpha's ~40–
~75% **and** reliable `.fig` import: the `.fig` import's tail (5–10 h), a real-file corpus with measured
fidelity (15–30 h), the interaction pass (25–40 h of the 40–60), core depth to ~80% (40–75 h),
basic multiplayer on the landed core (30–55 h), stability and platform QA (20–40 h), a partial GPU path (15–30 h);
-native speakers' reviews of the six language drafts need people.
+native speakers' reviews of the nine language drafts need people.
## By dimension
@@ -63,7 +63,7 @@ native speakers' reviews of the six language drafts need people.
| Stability | 55% | 20–40 | [gaps](docs/gaps.md) |
| Performance | 60% | 30–60 | [hardware-parity](docs/hardware-parity.md) |
| Hardware | 60% | 10–21 | [hardware-parity](docs/hardware-parity.md) |
-| Localization | 39% (layer; English; Spanish with a Latin American overlay, French, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese drafts; CJK UI fonts) | 29–51 | [localization-parity](docs/localization-parity.md) |
+| Localization | 39% (layer; English; Russian and Turkish reviewed by native speakers; Spanish with a Latin American overlay, French, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese, Indonesian and Czech drafts; CJK UI fonts) | 29–51 | [localization-parity](docs/localization-parity.md) |
| Platforms | 75% | 10–20 | [hardware-parity](docs/hardware-parity.md) |
| Ecosystem / plugins | 38% (own WASM plugins with panels, settings and widgets; a self-hosted plugin directory) | 8–26 | [gaps](docs/gaps.md) |
| AI features | 0% | 30–60 | [gaps](docs/gaps.md) |
@@ -126,11 +126,19 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
1. `.fig` import's tail: fixes from real files, connector labels, table cells, filled areas with their own fills (the best-effort import, editable vector networks, the other layer kinds and variable prototype actions landed 2026-10-11): 5–10 h; then checking the rest of the experimental `.fig` export (landed 2026-10-12; written files open and draw in other software) on effects, images, prototypes and real files: 5–15 h.
2. Real-file corpus and measured fidelity: 15–30 h.
3. Tool-by-tool interaction pass against Figma: 40–60 h.
-4. Languages: native reviews of the es, fr, de, pt-BR, ja and ko drafts (people), Latin American Spanish (1–2 h), then Simplified Chinese (3–5 h).
+4. Languages: native reviews of the es (with es-419), fr, de, pt-BR, ja, ko, zh-Hans, id and cs drafts (people), the entries added since each catalog was written, then Hindi, Vietnamese and Arabic ([localization-parity](docs/localization-parity.md)).
5. Multiplayer (M9): accounts and teams on top of the live sessions and the standalone server (transport, hosting, invite links that open the app, document sync, presence with remote text carets, cursor chat and spotlight, per-user undo, reconnect with offline edits, collision-free ids for styles, variables and comments, the browser client, `figcraft-server` with persistence and share links to edit or view, team libraries on the server landed): 42–84 h.
## Progress log
+- **2026-10-15** · Auto-save (M1, #305): Preferences ▸ Save files automatically (`pref.autoSave`, off by default, desktop only) saves each open file that has a path 3 s after its last change, never during a gesture, a live text preview or while a version is shown; the file is encoded off the UI thread, a failed save says why and is tried again a minute later. Numbers unchanged.
+- **2026-10-15** · A text box by dragging (M1, #363): a drag with the Text tool makes a fixed-size text box the size of the drag; a click still makes auto-width text. Numbers unchanged.
+- **2026-10-15** · Batch step references (M0.9, #400): a `command.batch` step can use the id an earlier step made (`{"$step": n}`, a reserved key), so a nested tree takes one call and one undo step. Numbers unchanged.
+- **2026-10-15** · Removing someone from a live session (M9, #338): the host or the file's owner removes a person from the avatar's menu or with `collab.removePerson`; they keep their copy and can't rejoin while the session runs. Numbers unchanged.
+- **2026-10-15** · Languages (M10, #257, #263, #469, #477, #288): Russian (one/few/many plurals) and Turkish catalogs reviewed by native speakers, Czech and Indonesian drafts, the Japanese draft completed; Preferences ▸ Language lists 12 languages and Latin American Spanish. Numbers unchanged.
+- **2026-10-15** · Zoom previews (M8, #312): when renders from scratch are slow, a new zoom shows the whole view coarsely first, then refines it. Numbers unchanged.
+- **2026-10-15** · Web clipboard (M1, #375): copy and paste in the browser go through the system clipboard. Numbers unchanged.
+- **2026-10-15** · Alt-drag copies snap to their original and Duplicate (Cmd+D) repeats the last copy's offset (M1, #283). Numbers unchanged.
- **2026-10-17** · Control channel while the window is minimised (M8, #720): a minimised or covered window answers every request that acts on the app's state (edits, `ui.inspect`, `ui.pointer`, `ui.key`, `ui.type`, `ui.set`, `app.quit`…) without drawing, and what needs a drawn frame (`ui.screenshot`, `ui.input`, `window.new`) is an error at once; before, those waited up to 60 s and held up every later request on the connection (an attached agent's `inspect_ui` or window screenshot stalled until the window came back). Measured on Windows 11, minimised: requests ~100 ms each (eframe wakes a minimised window at most ten times a second; ~2 ms on screen), a window screenshot fails in ~100 ms instead of 60 s, idle CPU 0. Numbers unchanged.
- **2026-10-17** · Number variables on text content (M3, #629): the Typography section's variable picker also lists number variables for a text layer's content, as the engine already accepted (the text shows the number, e.g. 42.5, and follows the variable). Other text fields keep their own types. Numbers unchanged.
- **2026-10-17** · Frames and sections convert into each other (M1, #719): `object.convertToSection` turns a frame on the page or in a section into a section in place (same box, name, fill and layers, which stay where they are; what only a frame has goes: auto layout, clipping, layout grids, guides, scrolling), and `object.convertToFrame` now also turns a section into a frame that keeps its fill and doesn't clip, so the look stays. Nested frames, instances, main components and sections holding sections are refused with the reason; one undo step each. Both are in the canvas context menu (Convert to section / Convert to frame) and in Spanish. Numbers unchanged.
@@ -316,6 +324,55 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Auto-save (#305, #296): Preferences ▸ Save files automatically (`pref.autoSave`, off by default; desktop only, the browser has no files to save to) saves each open file that has a path 3 s after its last change, so steady editing doesn't save every few seconds, and never during a gesture, a live text preview or while a version is shown. The file is encoded on a thread of its own and written as of that moment (edits made meanwhile stay unsaved); a failed save says why in a toast and is tried again a minute later, and version history checkpoints keep coming with it on. Numbers unchanged |
+| 2026-10-15 | minor | A text box by dragging (#363, #360): a drag with the Text tool makes a fixed-size text box the size of the drag (at least one line tall); a click, or a drag shorter than the drag threshold, still makes auto-width text. Numbers unchanged |
+| 2026-10-15 | minor | Batch step references (#400): inside `command.batch` (MCP `batch`), `{"$step": n}` anywhere in a step's params stands for the `id` step n returned (`{"$step": n, "field": …}` for another field; `$step` is a reserved key), so a frame with its children takes one batch and one undo step; a malformed reference fails the batch, which rolls back, and a nested batch keeps references to its own steps. Numbers unchanged |
+| 2026-10-15 | minor | Removing someone from a live session (#338): right-click a person's avatar ▸ Remove *name* from session, or `collab.removePerson {client}`, when you host the session or own the file on a server; the session ends for them (they keep their copy), the code or link they hold no longer gets them back in while it runs, and everyone else stays. Numbers unchanged |
+| 2026-10-15 | minor | Pages list (#272, #258): a long pages list scrolls in its own area, so the layers below stay in view; page and layer drops count only inside the list's visible rows. Numbers unchanged |
+| 2026-10-15 | minor | Variables export in the browser (#368): Export… ▸ Variables JSON / CSS custom properties did nothing in the web build and now arrives as a download; importing there still needs a file picker. Numbers unchanged |
+| 2026-10-15 | minor | Font picker keys (#352, #345): Up and Down step through the font families from the current one, keeping the highlight in view and previewing it on the canvas; Enter applies it, Escape leaves the text as it was. Numbers unchanged |
+| 2026-10-15 | minor | Leaving Design ends the pen path (#308, #307): switching to Prototype or Inspect while the Pen draws ends the path and goes back to Move (pressing Design again keeps drawing), and a click on the toolbar no longer reaches the canvas under it. Numbers unchanged |
+| 2026-10-15 | minor | Vector edit mode keeps the canvas still (#322): the edit mode hints in the Design panel wrap, so entering edit mode and picking a region no longer shift the canvas by about 25 points in the middle of the click (which dragged the region picked). Numbers unchanged |
+| 2026-10-15 | minor | Drop shadows under a background blur (#317, #255): a layer with both casts its shadows from what it paints (a translucent fill casts a lighter shadow than an opaque one) and reads the backdrop only after drawing them, so a shadow shown behind transparent areas is seen through the blur. Numbers unchanged |
+| 2026-10-15 | minor | When the window can't open (#306, #261): Windows release builds have no console, so a graphics failure at start quit without a word; the error is now logged and shown in a message box in the interface language, with what to try (unset `WGPU_BACKEND`, update the driver, OpenGL) and where to report it, skipped with `--control`. Numbers unchanged |
+| 2026-10-15 | minor | Crashes on Windows (#271, #314, #337; #224 and two more): a text field focused before it was drawn aborted the screen-reader layer; double-clicking a page, creating a variable collection and renaming a style folder no longer close the app. Numbers unchanged |
+| 2026-10-15 | minor | Deeply nested layers (#330, #210): one depth guard (256) on the three recursive layout paths, so a deep file can't run the layout out of stack. Numbers unchanged |
+| 2026-10-15 | minor | Image memory budgets (#326; #203, #189): decoded images and a file's images have budgets; the decode cache evicts its least recently used entries. Numbers unchanged |
+| 2026-10-15 | minor | macOS file dialogs (#253, #250) no longer re-enter the event loop; a dialog's result goes to the file and window it was opened for, and dialogs are parented to the main window. Numbers unchanged |
+| 2026-10-15 | minor | Recovery copies (#297, #303, #331, #336; #202, #185, #187): a copy counts only after its write succeeds and a failed one is retried; saves and closes wait for the write in flight; copies keep version history and branches; a recovered copy stays until this run has its own. Numbers unchanged |
+| 2026-10-15 | minor | Text edits (#280, #278) no longer roll back earlier changes; a drag released off the canvas ends at the pointer's last canvas position. Numbers unchanged |
+| 2026-10-15 | minor | Rollback (#282, #301; #196): a failed command rolls back during a drag or other gesture too; a failed batch keeps the redo steps. Numbers unchanged |
+| 2026-10-15 | minor | Atomic save and export (#284): staging files are uniquely named and created exclusively, so a file or link already at the old fixed staging name is never written through, and two writers of one file no longer share one. Numbers unchanged |
+| 2026-10-15 | minor | Alt-drag copies (#283) snap to their original, and Duplicate (Cmd+D) then repeats the last copy's offset. Numbers unchanged |
+| 2026-10-15 | minor | The pen (#277) shows its Bezier handles while a point is dragged out. Numbers unchanged |
+| 2026-10-15 | minor | Corner handles (#293, #292): a press on a corner handle resizes instead of picking the corner-radius handle. Numbers unchanged |
+| 2026-10-15 | minor | New text (#372, #362) takes a readable colour from the frame it is drawn in, not only the page (text drawn in a white frame on a dark page was white). Numbers unchanged |
+| 2026-10-15 | minor | Outline stroke (#386) works on every selected layer. Numbers unchanged |
+| 2026-10-15 | minor | Send to back (#444) counts per parent when the selection spans frames. Numbers unchanged |
+| 2026-10-15 | minor | Align buttons (#276) are off when the selection has nothing to align to. Numbers unchanged |
+| 2026-10-15 | minor | Gradient type icons (#275) show their gradient. Numbers unchanged |
+| 2026-10-15 | minor | Corner resize cursors (#388) stay diagonal at any proportions; the text selection highlight (#390) stays inside the box on the last line. Numbers unchanged |
+| 2026-10-15 | minor | New pages (#311, #295) take the current page's background; the theme still decides a new file's page. Numbers unchanged |
+| 2026-10-15 | minor | A slice's export preview (#265) shows the content under it. Numbers unchanged |
+| 2026-10-15 | minor | SVG export (#327, #325) keeps a nested frame's fill and stroke inside its parent's clip. Numbers unchanged |
+| 2026-10-15 | minor | Home screen (#318, #324): recent files notice files deleted while it is open; a long path no longer draws over the file name. Numbers unchanged |
+| 2026-10-15 | minor | The Small caps sample in Type settings (#355) draws from capitals, no longer a box where the UI font lacks the small-capital letter. Numbers unchanged |
+| 2026-10-15 | minor | Web clipboard (#375): copy and paste in the browser go through the system clipboard, so a paste after a copy brings the copied layers instead of whatever text the clipboard held. Numbers unchanged |
+| 2026-10-15 | minor | Zoom previews (#312): when renders from scratch are slow, a new zoom first shows the whole view coarsely instead of the page colour, then the refined image; images of another file or page never show. Numbers unchanged |
+| 2026-10-15 | minor | Hidden windows (#313, #332; #269): a minimised or covered window answers control and MCP requests (commands, inspection, `ui.render`) at once, each window on its own; screenshots and input still wait for it to be on screen. Numbers unchanged |
+| 2026-10-15 | minor | Server (#340, #302): a compaction cut short closes the file instead of confirming lost edits (#183); each team library version is kept in its own file (#206). Numbers unchanged |
+| 2026-10-15 | minor | Counters (#343, #344, #353; #309): collab sequence numbers, layer name counters and opacity digits can't overflow. Numbers unchanged |
+| 2026-10-15 | minor | Commands refuse bad indexes and ids (#475, #384, #310): `page.select` and `doc.switch`, `effect.set` and `export.update` / `export.remove`, `page.move` with a non-page id. Numbers unchanged |
+| 2026-10-15 | minor | Find and replace (#358, #361) changes every occurrence, case-insensitively, also when the replacement contains the search text. Numbers unchanged |
+| 2026-10-15 | minor | The gradient shorthand (#254, #252) is read by the engine, so the CLI, control channel and MCP share it. Numbers unchanged |
+| 2026-10-15 | minor | .fig import (#279, #281): resized instances lay out their layers by their constraints (#266); explicit variable modes whose collection is named by its asset key, as library collections are, come across (#267). Numbers unchanged |
+| 2026-10-15 | minor | Colour emoji (#300, #268) draw from their own colour tables (sbix and CBDT/EBDT bitmap strikes, COLR v0 layers), a colour face tried first; COLR v1 still draws outlines. Numbers unchanged |
+| 2026-10-15 | minor | macOS (#290, #289): `.figcraft` files open from Finder, Open With and the Dock. Numbers unchanged |
+| 2026-10-15 | minor | Windows (#294, #291): the first preferred language alone picks the UI language. Numbers unchanged |
+| 2026-10-15 | minor | Unix font discovery (#474) follows `XDG_DATA_HOME`. Numbers unchanged |
+| 2026-10-15 | minor | Linux packaging (#346, #328): the window id matches the desktop entry (FreeBSD keeps its class); the RPM requires glibc 2.35. Numbers unchanged |
+| 2026-10-15 | minor | Tests (#472, #471, #339): the rename shortcut test, the hanging punctuation test and the font-scanning tests no longer depend on the platform, font or test order. Numbers unchanged |
+| 2026-10-15 | minor | Languages (#257, #263, #469, #477, #288): Russian (with one/few/many plural forms) and Turkish catalogs, reviewed by native speakers; Czech and Indonesian drafts; the Japanese draft completed. 2,177 entries now (1,587 UI strings, 559 command labels, 31 menu wordings); strings added since a catalog was written read English there. Localization 39% and 29–51 h unchanged at this rounding (Indonesian is now a draft, while the five older drafts lack 88 newer entries) |
| 2026-10-20 | minor | A document dropped on the canvas opens (#916): a `.figcraft`, `.fig` or file JSON dropped on the canvas opens as a file of its own, as on the home screen, in the browser too; it used to add its pages to the file in front. Images and SVG still import at the drop point, File ▸ Import still adds pages, and dragging only documents over the canvas says "Drop to open" (not in the browser, which names no file until the drop). Numbers unchanged |
| 2026-10-20 | minor | Duplicating a main component makes an instance (#892): Duplicate and Alt-drag copied a main component as a second main; within its file the copy is now an instance of it, as Copy then Paste already was (a variant duplicated in its set stays a variant). Numbers unchanged. |
| 2026-10-20 | minor | Readable disabled and selected text (#890): the dim text colour (disabled buttons, placeholders, hints) is at least 3:1 against panels, fields and selected rows in both themes (it was 2.1:1 in the light theme), a disabled button is grey with that text instead of fading to 40%, and selected text (renaming a page or layer, any text box) takes the theme's readable green on the highlight (1.4:1 in the dark theme before, now 4.2:1 or more); checked with the colour contrast helper (`theme::tests`). Numbers unchanged |
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index adf0b0f2..a701cf6b 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File format parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (REST import keeps slot layers and instances' slot content (#792); REST import reads grid track sizes (#465); `.fig` import fidelity from the community batches, budgets for large files, the import report, a `.fig` copy from Save as, paste from another design app; instance layers' size and resizing and Hug on import (#731, #732); SVG/PDF export depth refusal (#208); `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; `.fig` export: written files checked by opening them in other software; experimental `.fig` export; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; embedded image colour profiles; `.fig` import, best effort; animated GIF fills and TIFF images; last major: created, formats from the installed Figma's Info.plist and help center, ours from source) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (`.fig` import: resized instances and variable modes by asset key; atomic saves; auto-save; SVG export clip of nested frames; SVG/PDF export depth refusal (#208); `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; `.fig` export: written files checked by opening them in other software; experimental `.fig` export; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; embedded image colour profiles; `.fig` import, best effort; animated GIF fills and TIFF images; last major: created, formats from the installed Figma's Info.plist and help center, ours from source; REST import keeps slot layers and instances' slot content (#792); REST import reads grid track sizes (#465); `.fig` import fidelity from the community batches, budgets for large files, the import report, a `.fig` copy from Save as, paste from another design app; instance layers' size and resizing and Hug on import (#731, #732); SVG/PDF export depth refusal (#208); `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; `.fig` export: written files checked by opening them in other software; experimental `.fig` export; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; embedded image colour profiles; `.fig` import, best effort; animated GIF fills and TIFF images; last major: created, formats from the installed Figma's Info.plist and help center, ours from source) · **Target:** Figma Design (desktop app 126.10.7)
Every format Figma reads or writes, with FigCraft's support. Sources: `Info.plist` of
`/Applications/Figma.app` (document types only; nothing inside the bundle's code was read), Figma's
@@ -20,7 +20,7 @@ and prototype interactions are still unchecked there.
| `.fig` (Figma Design, `com.figma.document`, `application/x-figma`) | native (cloud; "Save local copy") | **yes, best effort** (`file.open`, `file.import`, drop, CLI, MCP) | **experimental** ([below](#export-to-fig-experimental)) | `.fig` files open (best effort): the zip, its deflate/zstd chunks and the kiwi schema are decoded generically and mapped by field name onto the REST importer, so pages, the layer tree, geometry, paints (styles resolved), strokes, effects, text with styled runs, vectors as editable vector networks (points, curved segments, filled areas with their winding, per-point corner radius and handle mirroring, end caps; outlines when the network is missing or damaged), auto layout (grid included; a flow that records no primary-axis sizing hugs on that axis, an instance that records no auto layout has its main's), constraints, ellipse arcs, boolean operations, components, sets (with their descriptions), instances (expanded from their main with overrides, derived layout and property values; the size and resizing their layers override stay overrides), styles, variables with modes and bindings, prototyping (set-variable, set-variable-mode and conditional actions included) and image fills from the archive come across; sticky notes, shapes with text, connectors, tables, code blocks, slides and similar layers come in as the closest frames, text layers and vectors, with a warning; anything else is a warning. Since 2026-10-17 (community batches #727, #728): an instance's own identity and the cached library components a file carries, overrides applied by key and order, local text values and instance overrides over a shared text style, grid track sizes (fixed, content-sized, fill), slot content, labels of connectors saved with their drawn path (a static snapshot; the ends aren't live), skip ink, paragraph options and hanging lists, list start numbers, vertical trim, per-point stroke joins, editable text on a path, image adjustments and images carried in the message. Budgets come from the file's own size (one value per compressed byte, 20M–128M, lower ceilings on 32-bit targets; the layer cap follows), so a 15.4 MB synthetic file with 300,000 layers opens whole; the file's bytes stay out of the command journal; an import report lists what was left out or changed once the file opens. Not read: elbowed or curved connectors without a saved path (drawn straight) and labels of connectors without a saved snapshot, table cells beyond their own layers, filled areas with their own fills, variables bound to fields the editor can't bind, video fills. Tested on fixtures generated in code (`crates/format/src/fig/tests.rs`, `tail_tests.rs` and the per-feature `*_tests.rs` beside them, fuzzed) and by reading back what the export writes; no real-world files yet | read tail 5–10, write: checks against real files 5–15 |
| `.jam` (FigJam), `.deck` (Slides) | native to other Figma products | no | no | out of scope | — |
| REST API file JSON (`GET /v1/files/:key`) + local variables JSON + `images/` folder | the API's output | **yes** (`file.open`, `file.import`, CLI) | no | pages, layer tree, geometry, paints, strokes, effects, text runs, vectors, auto layout (sizing modes left out read as hug, as documented; grid track sizes from `gridColumnsSizing` / `gridRowsSizing`: px, fr, auto, `minmax(0, 1fr)`, `repeat()`), constraints, grids, components, sets, instances with overrides (sizes and resizing included), component properties, slots (`SLOT` layers bound to their slot property; an instance's slot keeps its content as the instance's own unless its property value is the main's default content; slot limits and preferred components are warnings), styles, prototyping (incl. conditionals and variable modes), variables with modes, aliases, scopes and bindings, image adjustments (the same tint sign as `.fig`); the import report after opening; warnings for what's skipped (video triggers and actions, modifier keys). Unit tests in `crates/format/src/rest/*_tests.rs` | — |
-| `.figcraft` (ours: zip of `document.json` + images, versions inside) | — | yes | yes | streamed JSON, 50k layers save ~0.09 s / load ~0.16 s (`cargo xtask bench`); old files keep opening (`large_tests.rs`) | — |
+| `.figcraft` (ours: zip of `document.json` + images, versions inside) | — | yes | yes | streamed JSON, 50k layers save ~0.09 s / load ~0.16 s (`cargo xtask bench`); old files keep opening (`large_tests.rs`); saves write a unique staging file and rename it into place (#284); optional auto-save of files with a path (`pref.autoSave`, #305) | — |
| Local library files | team libraries in the cloud | yes (enable a `.figcraft` as a library) | yes (publish) | per-asset versions, updates with overrides kept | see [collaboration-parity](collaboration-parity.md) |
## Import (place / paste / drop)
@@ -51,7 +51,7 @@ export limit, not a native document nesting limit.
|---|---|---|---|---|
| PNG | yes, scales/suffixes | yes | export settings per layer, presets (`2x`, `512w`, `512h`), preview, "Export N layers"; contents only (off: every layer showing in the area) and include bounding box (the layer's own box); slashes in layer names export into folders. The exported area is what the layer paints: shadows towards their offset, outside and centre strokes, unclipped children, a mask group's mask, nothing for hidden layers; slices export everything under them; sides round up to whole pixels | — |
| JPG | yes | yes | white where transparent; fixed quality (90) | — |
-| SVG | yes (outline text option, ids) | yes | alpha/luminance masks kept; noise, texture, progressive and background blur, glass embedded as images; outline text (off: `` with one `` per line, one style per layer), unique id attributes from layer names, explicit depth-limit refusal, simplified strokes (stroke attributes for centred strokes and for inside and outside strokes on boxes and ellipses) | — |
+| SVG | yes (outline text option, ids) | yes | alpha/luminance masks kept; noise, texture, progressive and background blur, glass embedded as images; outline text (off: `` with one `` per line, one style per layer), unique id attributes from layer names, explicit depth-limit refusal, nested frames clipped by their parent's clip (#327), simplified strokes (stroke attributes for centred strokes and for inside and outside strokes on boxes and ellipses) | — |
| PDF | yes | yes | one page per frame, real selectable text in subset fonts, links, vectors and gradients as vectors, effects as images; bleed, crop/bleed marks, page boxes, naive CMYK; checked by rendering the PDF back against PNG exports; explicit depth-limit refusal | CMYK output intent 2–4 |
| WebP | — | yes (ours) | | — |
| Copy as CSS / SVG / PNG / text / link | yes | yes | Copy as PNG: the whole selection at 2x | — |
@@ -165,6 +165,7 @@ each.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | `.fig` import (#279, #281; #266, #267): resized instances lay out their layers by their constraints, and explicit variable modes whose collection is named by its asset key come across (before, they were dropped and bound layers resolved in the default mode); fixture-tested, real files still owed. `.figcraft`: atomic saves and exports through unique staging files (#284), optional auto-save (#305). SVG export keeps a nested frame's fill and stroke inside its parent's clip (#327). Numbers unchanged |
| 2026-10-18 | minor | REST file JSON import keeps `SLOT` layers (#792): they were dropped with everything placed in them, which emptied every instance's slot. A slot in a main component becomes a slot frame bound to its `SLOT` property (the one it references, else the one named like it, else the only one left), and an instance's slot holds the instance's own content, kept across syncs, moves of the mains and saving, unless the instance's property value is the main's default content (without values, a slot that holds layers keeps them). Instances in slot content link to their own mains. Slot content limits, preferred-only and preferred components are warnings. Synthetic files only. Numbers unchanged |
| 2026-10-17 | minor | REST file JSON import reads grid track sizes from the CSS track strings `gridColumnsSizing` / `gridRowsSizing` (fixed px, fill fr, hug `auto`, `minmax(0, 1fr)`, `repeat()`; other tracks stay equal) (#465). Numbers unchanged |
| 2026-10-17 | minor | The community batches #727 and #728 in the `.fig` row: instance identity and cached library components, overrides by key, text style precedence, grid track sizes, slot content, labels of connectors saved with their path, skip ink, paragraph options, list start numbers, vertical trim, per-point stroke joins, text on a path, image adjustments (also REST), images in the message; budgets from the file's size; the journal keeps no file bytes; the import report. Not read cut to what's left. A `.fig` copy from Save as. Pasted content: layers copied from another design app, best effort (tested only with clipboard HTML made from our own export), and images under Wayland (not run there). All on synthetic files: summary and hours unchanged |
diff --git a/docs/gaps.md b/docs/gaps.md
index 9b1a770c..936d2047 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Where FigCraft falls short of Figma
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail) · **Target:** Figma Design (desktop app 126.10.7)
Every known shortfall against Figma, one entry each, ranked by how much it stops a Figma user from
doing real work in FigCraft. Agents: pick work from the top unless the owner says otherwise. The
@@ -18,7 +18,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
| 2 | Multiplayer and sharing are a preview, without accounts (**beta blocker**) | Feature | 42–84 | [collaboration-parity](collaboration-parity.md) |
| 3 | Nothing checked against real Figma files | Fidelity | 15–30 | [target-app-parity](target-app-parity.md) |
| 4 | Interaction fidelity not compared tool by tool | UI/UX | 40–60 | [ui-parity](ui-parity.md) |
-| 5 | Localization: English, reviewed Russian, plus unreviewed Spanish (and Latin American Spanish), French, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese, Indonesian and Czech drafts; Turkish and Swedish catalogs | Localization | 29–51 | [localization-parity](localization-parity.md) |
+| 5 | Localization: English, reviewed Russian and Turkish, plus unreviewed Spanish (and Latin American Spanish), French, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese, Indonesian and Czech drafts; Turkish and Swedish catalogs | Localization | 29–51 | [localization-parity](localization-parity.md) |
| 6 | Plugins: widgets take clicks only, a self-hosted directory but no public catalogue; Figma's plugins don't run | Ecosystem | 8–26 | [target-app-parity](target-app-parity.md) |
| 7 | CPU canvas where Figma uses the GPU | Hardware/performance | 30–60 | [hardware-parity](hardware-parity.md) |
| 8 | Platform QA: Linux and the browser left (Windows pass done 2026-10-11) | Stability/platforms | 10–20 | [hardware-parity](hardware-parity.md) |
@@ -178,7 +178,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
- **Impact:** Figma users notice the feel within minutes; it decides whether they stay.
- **Estimate:** 40–60 h. Detail in [`ui-parity.md`](ui-parity.md).
-### 5. Localization: English, reviewed Russian, plus unreviewed drafts
+### 5. Localization: English, reviewed Russian and Turkish, plus unreviewed drafts
- **Missing:** native reviews of the Spanish, French, German, Brazilian Portuguese, Japanese,
Korean, Simplified Chinese, Indonesian and Czech drafts and the Latin American Spanish
overlay, the strings added since each catalog was drafted (1–5% of each), Hindi, Arabic and
@@ -444,6 +444,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Gap 5: Turkish reviewed by a native speaker (#263), Czech (#469) and Indonesian (#477) drafts, the Japanese draft caught up (#288); Indonesian is no longer missing; counts re-measured (2,177 entries) and corrected: only Spanish is held to completeness, Russian included. Estimate unchanged at this rounding |
| 2026-10-17 | minor | The 2026-10-17 landings. Gap 1: a new Landed entry (community batches #727 and #728, then #745: instance identity and cached library components, overrides by key, text style precedence, grid track sizes, slot content, labels of connectors saved with their path, skip ink, paragraph options, list start numbers, vertical trim, per-point stroke joins, text on a path, image adjustments, images in the message, instance layers' size and resizing overrides, Hug where nothing is recorded; budgets from the file's size; the import report; a `.fig` copy from Save as; paste from another design app), its Missing list cut to what is still left, and the wrong "whether other apps open its files is unknown" replaced by what was checked; all on synthetic files, so the beta blocker and hours stand. Gap 2: server limits, log recovery and web join links in the evidence. Gap 4: menus, the Actions palette and the editor fixes (#733, #735, #736, #729), then Selection colors and smart-selection spacing (#753) landed, none compared side by side. Gap 5: catalog counts re-measured (2,272 entries; drafts at 95–99%; Indonesian, Czech, Turkish and Swedish listed). Gap 8: the Linux and BSD clipboard changes and Wayland window controls, not run there by the maintainers. Ranking and hours unchanged |
| 2026-10-15 | minor | Gap 7: bounded canvas overscan for smoother panning. Estimates and ranking unchanged. |
| 2026-10-14 | minor | Russian catalog (M9), reviewed and approved by VanTan: all 2,165 current entries, Русский in Preferences and regional ru tags. Russian integer plurals use one/few/many; contributor display name VanTan added. Existing estimates unchanged. |
diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md
index df822981..f5be7263 100644
--- a/docs/hardware-parity.md
+++ b/docs/hardware-parity.md
@@ -1,6 +1,6 @@
# Hardware and platform parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (macOS: quitting ends the process once everything is kept, avoiding the Touch Bar teardown crash (#781); Linux and BSD clipboard: images under Wayland, reads time out; minimised windows under Wayland; window controls on Wayland without server decorations; canvas textures on device pixels; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (zoom previews; hidden windows answer control requests; macOS file opening, the Windows start-up message, Linux packaging; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses; macOS: quitting ends the process once everything is kept, avoiding the Touch Bar teardown crash (#781); Linux and BSD clipboard: images under Wayland, reads time out; minimised windows under Wayland; window controls on Wayland without server decorations; canvas textures on device pixels; copy and paste in the browser; Windows QA pass; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; pen pressure for the Pencil and brushes on Windows and from browser styluses) · **Target:** Figma Design (desktop app 126.10.7)
How FigCraft uses hardware and which platforms it runs on, against Figma. Figma's desktop app is
Electron with a GPU helper process; its canvas renders on the GPU (WebGL, with WebGPU rolling out
@@ -12,13 +12,13 @@ since 2025). FigCraft renders the canvas on the CPU and presents it through wgpu
| Feature | Figma | FigCraft (macOS / Windows / Linux / web) | Hours |
|---|---|---|---|
-| Canvas rendering | GPU | CPU (tiny-skia), banded across cores, retained (re-renders only what an edit or pan touches), levels of detail below 50% zoom; shown through wgpu (WebGPU or WebGL2 in the browser) | 30–60 for a GPU path |
+| Canvas rendering | GPU | CPU (tiny-skia), banded across cores, retained (re-renders only what an edit or pan touches), levels of detail below 50% zoom; when renders from scratch are slow, a new zoom shows the whole view coarsely first, then refines it (#312); shown through wgpu (WebGPU or WebGL2 in the browser) | 30–60 for a GPU path |
| Effects (blurs, glass, noise) | GPU | CPU | in the above |
| HiDPI / Retina | yes | yes (all); a canvas image rendered at the screen's density is placed on whole device pixels, so fractional pans, zooms and display scales don't blur it (#359; geometry tests, the snapping not judged by eye) | — |
| Wide-gamut display (Display P3) | yes, on capable displays | colours stored and exported in P3; the screen shows sRGB: eframe/egui-wgpu 0.36 configure an 8-bit sRGB surface with no colour space option, although wgpu 30 can present Display P3 or extended sRGB on Metal, DX12, Vulkan and WebGPU (see gaps #18). The colour picker warns about colours outside sRGB and View ▸ Soft-proof sRGB stripes them on the canvas | 2–5 |
| Trackpad pinch zoom and two-finger pan | yes | yes (egui zoom delta, smooth scroll) | — |
| Pen tablet pressure (pencil, Figma Draw brushes) | yes (forum reports of regressions in 2025) | Windows pens (winit pointer input) and browser styluses that send touch events with a force (an Apple Pencil in Safari); the Pencil records it as the stroke's width profile. A mouse, macOS and Linux tablets and pens sending only pointer events in a browser report none: constant width | 1–3 |
-| Several windows / multi-monitor | yes (a window per file; presenter in its own window) | desktop: File ▸ New window, a tab's Open in new window or a tab dragged off the strip; each window has its own tabs, panels and canvas, draws only when it needs to and asks about unsaved changes when it closes. Only the main window has a screen-reader tree (eframe 0.36), so files stay tabs while a screen reader runs; positions aren't restored at the next start; the presenter stays inside its window; one window in the browser | 1–2 |
+| Several windows / multi-monitor | yes (a window per file; presenter in its own window) | desktop: File ▸ New window, a tab's Open in new window or a tab dragged off the strip; each window has its own tabs, panels and canvas, draws only when it needs to and asks about unsaved changes when it closes; a minimised or covered window still answers control and MCP requests, while screenshots and input fail at once until it is on screen (#313, #332, #720). Only the main window has a screen-reader tree (eframe 0.36), so files stay tabs while a screen reader runs; positions aren't restored at the next start; the presenter stays inside its window; one window in the browser | 1–2 |
| Screen readers | partial | AccessKit tree on desktop (names, roles, states), never tested with a real screen reader; none in the browser | 4–8 + human QA |
| Keyboard layouts (non-US) | yes | keymap uses logical keys; not checked on AZERTY/QWERTZ/JIS | 1–2 |
@@ -50,6 +50,7 @@ Nothing has been timed against Figma on the same document (needs `.fig` import).
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Community fixes (#290, #306, #312, #313, #328, #332, #346, #474): coarse zoom previews when renders from scratch are slow; a minimised or covered window answers control and MCP requests (screenshots and input fail at once while it is hidden); `.figcraft` files open from Finder on macOS; a message box when the window can't open on Windows; on Linux the window id matches the desktop entry, the RPM requires glibc 2.35 and user fonts under `XDG_DATA_HOME` are found. Numbers unchanged |
| 2026-10-18 | minor | macOS quit crash (#781): on Macs with a Touch Bar the app could crash as it quit (an exception in AppKit's Touch Bar support while the window's content view, which the accessibility adapter subclasses, was torn down). Quitting now keeps everything (preferences, this run's recovery copies, live sessions ended) and then ends the process before that teardown. Quit from the menu bar ends the app without the unsaved-changes question, so unsaved files' recovery copies now stay and reopen at the next start instead of being removed. Numbers unchanged |
| 2026-10-17 | minor | Linux row: clipboard reads on Linux and the BSDs time out after 2 s on a helper thread, images copied in other apps paste under Wayland (arboard's data-control feature, #693), a minimised window can't be detected under Wayland, so frame-only control requests may still wait there (#720), and Wayland compositors without server-side decorations give the window Adwaita controls (#592, checked by its author on GNOME, not by the maintainers; KDE not run); compiled in CI, not run on a Linux desktop. HiDPI row: native-density canvas images placed on whole device pixels (#359, geometry tests; not judged by eye). Numbers unchanged |
| 2026-10-14 | minor | Copy and paste in the browser: the web build never wrote to the system clipboard, so Cmd+V after Cmd+C pasted whatever text the clipboard held before (as a text layer) instead of the copied layers. Copies (layers, Copy as SVG/CSS/text/PNG, links) now go out through egui's output, which eframe writes during the copy event (`web_clipboard_tests`). Numbers unchanged. |
diff --git a/docs/localization-parity.md b/docs/localization-parity.md
index 50fcd4ec..44e35f39 100644
--- a/docs/localization-parity.md
+++ b/docs/localization-parity.md
@@ -1,6 +1,6 @@
# Localization parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (macOS finds its downloadable CJK system fonts (#406); string counts re-measured: 2,272 entries, the drafts at 95–99%; Swedish command labels and menu wordings; Russian, Swedish, Turkish, Czech and Indonesian listed; a duplicated paragraph removed; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (Russian and Turkish catalogs reviewed by native speakers, Russian one/few/many plurals; Czech and Indonesian drafts; the Japanese draft completed; counts re-measured; Windows UI language from the first preferred language; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog; macOS finds its downloadable CJK system fonts (#406); string counts re-measured: 2,272 entries, the drafts at 95–99%; Swedish command labels and menu wordings; Russian, Swedish, Turkish, Czech and Indonesian listed; a duplicated paragraph removed; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog) · **Target:** Figma Design (desktop app 126.10.7)
FigCraft's interface has a localization layer with an English catalog, a Russian catalog reviewed
by a native speaker, and Spanish (with a Latin American overlay), French, German, Brazilian
@@ -37,7 +37,8 @@ supported by both apps (CJK, Arabic and Devanagari shaping, IME); Figma has no v
only the first preferred language counts, since that list also holds the languages added for a
keyboard; macOS AppleLanguages, `LANGUAGE` then the locale variables on Linux and BSD; a regional
tag falls back to its language, pt-PT or pt to pt-BR, and es-419, es-MX, es-AR, es-CO and the
- other Latin American and US Spanish tags to es-419; zh, zh-CN, zh-SG and zh-Hans read zh-Hans,
+ other Latin American and US Spanish tags to es-419; regional ru, tr, cs and id tags (ru-RU,
+ tr-TR, cs-CZ, id-ID) to their catalogs; zh, zh-CN, zh-SG and zh-Hans read zh-Hans,
while Traditional Chinese (zh-Hant, zh-TW, zh-HK, zh-MO) has no catalog and reads English or the
next OS language, never Simplified) or the browser's language on the web.
`pref.language {language}` sets it from the CLI, MCP and the control channel.
@@ -63,7 +64,8 @@ supported by both apps (CJK, Arabic and Devanagari shaping, IME); Figma has no v
- **Script support in the UI:** menus widen to their longest label; dropdowns, the two-column
labels of the right panel and the home screen's cards keep a long translation on one line with an
ellipsis and show it in full on hover (checked in German, the longest); no mirrored
- (right-to-left) layout of panels. CJK translations are shorter than English; the same ellipsis
+ (right-to-left) layout of panels. Cyrillic, Turkish and Czech letters draw from the UI fonts
+ (no font added; Russian checked in screenshots). CJK translations are shorter than English; the same ellipsis
and tooltip cover the few that don't fit (the sizing dropdowns).
- **CJK UI fonts:** egui's fonts and Inter have no CJK glyphs. Once the UI language, the open
file's names or comments, typed text or the language picker needs Japanese kana, Hangul or Han,
@@ -120,6 +122,7 @@ Hindi, Vietnamese and Arabic. Traditional Chinese is not planned (no catalog; it
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Community catalogs (#257, #263, #469, #477, #288): Russian (`ru`, Русский, reviewed and approved by VanTan) and Turkish (`tr`, Türkçe, reviewed by a native speaker), Czech (`cs`, Čeština) and Indonesian (`id`, Bahasa Indonesia) drafts, and the Japanese draft caught up; Preferences ▸ Language lists them and System maps their regional tags. Catalogs may give few and many plural forms; Russian picks one, few or many by its integer rule (11–14 take many), the catalog supplying the text choosing the rule. Only Spanish is held to completeness. Counts re-measured: 1,587 UI keys (38 plural), 559 command labels and 31 menu wordings, 2,177 entries; Spanish 100%, Japanese 2,176, Czech and Indonesian 2,166, Russian and Turkish 2,165, the five older drafts 2,088–2,089 (95%). Localization 39% and 29–51 h unchanged at this rounding |
| 2026-10-17 | minor | Chinese showed as boxes on macOS (#406): the font scan also walks the system's downloaded font assets (`/System/Library/AssetsV2` and the older `/System/Library/Assets`, only their `com_apple_MobileAsset_Font*` folders), where current versions keep PingFang SC, and Hiragino Sans GB and Heiti SC join the Chinese UI faces and the text fallbacks. Tested with a folder laid out the same way; not yet run on a Mac |
| 2026-10-17 | minor | String counts re-measured from the catalogs: 1,680 UI keys, 561 command labels and 31 menu wordings (2,272 entries); Spanish complete, the other drafts at 95.3–99.2% (strings added since 2026-10-12 show English), es-419 101 entries. Indonesian has a draft (98.8%; it was listed as none); Russian (98.8%, reviewed), Swedish (99.6%, command labels and menu wordings from #599), Turkish (98.7%) and Czech (98.8%) listed with counts; the language picker's list updated; a paragraph repeated by a merge removed. Grade and hours unchanged (Indonesian's draft is offset by the drafts' new gaps) |
| 2026-10-14 | minor | Windows UI language (#291): the interface language comes from Windows' first preferred language alone; that list is also the input-language list (a German keyboard on a Polish system adds Deutsch), and taking the first entry with a catalog turned the interface German there. A first preferred language without a catalog reads English; macOS AppleLanguages and gettext's `LANGUAGE` still take the first language with a catalog |
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 8d63a469..b18b7b68 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -1,6 +1,6 @@
# FigCraft roadmap: milestones and what's next
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (community batch #753: Selection colors, smart-selection spacing, a Present tab; community fixes from #524 up (55 PRs: `.fig` import fidelity, paste from other apps, the Actions palette, editor fixes, server limits) and a boolean-op crash guard; community fixes from #478 up and a control-channel fix (#589); recent files as cards with thumbnails on the home screen; community fixes: lost images reported on loading, SVG import budgets, Leptos code, full screen, server snapshots, owner-only preferences, ruzstd 0.9.1, layer cycle repair, batch rollback, Direct3D 12 on Windows, plugin metering; vector edit mode regions: hover hatch, selection and drag; repeat command recursion fix; the Layout panel's constrain-proportions link scales the other side, #220; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; `.fig` import, best effort; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~79%) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (community fixes in #507, #510, #529 and #530: auto-save, a text box by dragging, batch step references, removing someone from a live session, Russian and Turkish catalogs reviewed, Czech and Indonesian drafts, the Japanese draft completed, zoom previews, the web clipboard, Alt-drag snapping and Cmd+D repeat, recovery copies, crash and rollback fixes, colour emoji, `.fig` import fixes; earlier changes are in the revision history below) · **Target:** Figma Design (desktop app 126.10.7)
Forward-looking plan. Where FigCraft stands today: [`ROADMAP.md`](../ROADMAP.md) and
[`target-app-parity.md`](target-app-parity.md); the full ranked list: [`gaps.md`](gaps.md). Hours
@@ -16,8 +16,9 @@ are one Opus 5.5 agent; most milestones split across 4–6 agents on disjoint cr
3. **Tool-by-tool interaction pass** against the running Figma ([`ui-parity.md`](ui-parity.md)):
40–60 h, parallel by tool.
4. **Languages** on the landed localization layer: native reviews of the es, fr, de, pt-BR, ja,
- ko and zh-Hans drafts and the es-419 overlay (people), then the other key languages: 3–7 h per language
- plus native review.
+ ko, zh-Hans, id and cs drafts and the es-419 overlay (people; Russian and Turkish are reviewed),
+ the entries added since each catalog was written, then the other key languages (Hindi,
+ Vietnamese, Arabic): 3–7 h per language plus native review.
5. **Multiplayer M9**: accounts and teams on top of the live sessions and the standalone server (the WebSocket transport, hosting from the app, invite links that open the app, document sync, live cursors, selections, text carets, avatars and follow, per-user undo, reconnect with offline edits, collision-free ids for styles, variables, collections and comments, joining from the browser, and `figcraft-server` with persistence, publishing from the app and share links to edit or view landed), per [`collab-protocol.md`](collab-protocol.md) and [`server.md`](server.md): 45–90 h.
## Alpha gate
@@ -57,7 +58,7 @@ blockers.
| M7 Release & fidelity (signed builds, look & feel, shortcuts) | builds done; fidelity pass started | tool-by-tool pass | 40–60 |
| M8 Hardening & performance (bench, retained canvas, accessibility, idle) | ~60% | real-file corpus, platform QA, GPU canvas, screen readers | 60–110 |
| M9 Real-time collaboration | core done (#103: ids, change sets, server ordering, convergence); live sessions (WebSocket transport with limits and reconnect, hosting from the app, invite links, document sync between apps, cursors, selections, avatars, follow, `collab.*` commands); per-user undo, rejection handling, offline queue and resuming after a reconnect; styles, variables, collections, modes and comments created in a session get ids from their creator's space; others' text carets and selections on the canvas; the browser client (joins desktop-hosted sessions); `figcraft://` links open the app and join (Windows registers per user; macOS and Linux packages declare the scheme); the standalone `figcraft-server` (persistence with compaction, restarts that lose nothing confirmed, publishing from the app, share links to edit or view, revocable); team libraries kept on the server and enabled by a share link, with usage counts, and swapping a library; `wss://` from the desktop app, server releases and a deployment guide | accounts, teams | 45–90 |
-| M10 Localization (new) | not started | layer + 11 languages | 60–100 |
+| M10 Localization | ~39%: the layer, English, Russian and Turkish reviewed by native speakers; Spanish (with a Latin American overlay), French, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese, Indonesian and Czech drafts | native reviews, Hindi, Vietnamese, Arabic (with mirrored panels), engine messages and number formatting ([localization-parity](localization-parity.md)) | 29–51 |
| M11 Plugins | runtime, API, menu, manager and SDK done (#101); plugin panels and settings (ABI v2); widgets (API 3), panels side by side, colour picker on plugin fields; a plugin directory on `figcraft-server` (publish, browse, install, update) | a public catalogue, publisher accounts and signatures, the directory in the browser, richer widget events; Figma plugin compatibility is an owner decision | 8–26 |
| M12 AI features (new, owner decision) | not started | local models | 30–60 |
@@ -73,6 +74,55 @@ blockers.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Auto-save (#305, #296): Preferences ▸ Save files automatically (`pref.autoSave`, off by default; desktop only, the browser has no files to save to) saves each open file that has a path 3 s after its last change, so steady editing doesn't save every few seconds, and never during a gesture, a live text preview or while a version is shown. The file is encoded on a thread of its own and written as of that moment (edits made meanwhile stay unsaved); a failed save says why in a toast and is tried again a minute later, and version history checkpoints keep coming with it on. Numbers unchanged |
+| 2026-10-15 | minor | A text box by dragging (#363, #360): a drag with the Text tool makes a fixed-size text box the size of the drag (at least one line tall); a click, or a drag shorter than the drag threshold, still makes auto-width text. Numbers unchanged |
+| 2026-10-15 | minor | Batch step references (#400): inside `command.batch` (MCP `batch`), `{"$step": n}` anywhere in a step's params stands for the `id` step n returned (`{"$step": n, "field": …}` for another field; `$step` is a reserved key), so a frame with its children takes one batch and one undo step; a malformed reference fails the batch, which rolls back, and a nested batch keeps references to its own steps. Numbers unchanged |
+| 2026-10-15 | minor | Removing someone from a live session (#338): right-click a person's avatar ▸ Remove *name* from session, or `collab.removePerson {client}`, when you host the session or own the file on a server; the session ends for them (they keep their copy), the code or link they hold no longer gets them back in while it runs, and everyone else stays. Numbers unchanged |
+| 2026-10-15 | minor | Pages list (#272, #258): a long pages list scrolls in its own area, so the layers below stay in view; page and layer drops count only inside the list's visible rows. Numbers unchanged |
+| 2026-10-15 | minor | Variables export in the browser (#368): Export… ▸ Variables JSON / CSS custom properties did nothing in the web build and now arrives as a download; importing there still needs a file picker. Numbers unchanged |
+| 2026-10-15 | minor | Font picker keys (#352, #345): Up and Down step through the font families from the current one, keeping the highlight in view and previewing it on the canvas; Enter applies it, Escape leaves the text as it was. Numbers unchanged |
+| 2026-10-15 | minor | Leaving Design ends the pen path (#308, #307): switching to Prototype or Inspect while the Pen draws ends the path and goes back to Move (pressing Design again keeps drawing), and a click on the toolbar no longer reaches the canvas under it. Numbers unchanged |
+| 2026-10-15 | minor | Vector edit mode keeps the canvas still (#322): the edit mode hints in the Design panel wrap, so entering edit mode and picking a region no longer shift the canvas by about 25 points in the middle of the click (which dragged the region picked). Numbers unchanged |
+| 2026-10-15 | minor | Drop shadows under a background blur (#317, #255): a layer with both casts its shadows from what it paints (a translucent fill casts a lighter shadow than an opaque one) and reads the backdrop only after drawing them, so a shadow shown behind transparent areas is seen through the blur. Numbers unchanged |
+| 2026-10-15 | minor | When the window can't open (#306, #261): Windows release builds have no console, so a graphics failure at start quit without a word; the error is now logged and shown in a message box in the interface language, with what to try (unset `WGPU_BACKEND`, update the driver, OpenGL) and where to report it, skipped with `--control`. Numbers unchanged |
+| 2026-10-15 | minor | Crashes on Windows (#271, #314, #337; #224 and two more): a text field focused before it was drawn aborted the screen-reader layer; double-clicking a page, creating a variable collection and renaming a style folder no longer close the app. Numbers unchanged |
+| 2026-10-15 | minor | Deeply nested layers (#330, #210): one depth guard (256) on the three recursive layout paths, so a deep file can't run the layout out of stack. Numbers unchanged |
+| 2026-10-15 | minor | Image memory budgets (#326; #203, #189): decoded images and a file's images have budgets; the decode cache evicts its least recently used entries. Numbers unchanged |
+| 2026-10-15 | minor | macOS file dialogs (#253, #250) no longer re-enter the event loop; a dialog's result goes to the file and window it was opened for, and dialogs are parented to the main window. Numbers unchanged |
+| 2026-10-15 | minor | Recovery copies (#297, #303, #331, #336; #202, #185, #187): a copy counts only after its write succeeds and a failed one is retried; saves and closes wait for the write in flight; copies keep version history and branches; a recovered copy stays until this run has its own. Numbers unchanged |
+| 2026-10-15 | minor | Text edits (#280, #278) no longer roll back earlier changes; a drag released off the canvas ends at the pointer's last canvas position. Numbers unchanged |
+| 2026-10-15 | minor | Rollback (#282, #301; #196): a failed command rolls back during a drag or other gesture too; a failed batch keeps the redo steps. Numbers unchanged |
+| 2026-10-15 | minor | Atomic save and export (#284): staging files are uniquely named and created exclusively, so a file or link already at the old fixed staging name is never written through, and two writers of one file no longer share one. Numbers unchanged |
+| 2026-10-15 | minor | Alt-drag copies (#283) snap to their original, and Duplicate (Cmd+D) then repeats the last copy's offset. Numbers unchanged |
+| 2026-10-15 | minor | The pen (#277) shows its Bezier handles while a point is dragged out. Numbers unchanged |
+| 2026-10-15 | minor | Corner handles (#293, #292): a press on a corner handle resizes instead of picking the corner-radius handle. Numbers unchanged |
+| 2026-10-15 | minor | New text (#372, #362) takes a readable colour from the frame it is drawn in, not only the page (text drawn in a white frame on a dark page was white). Numbers unchanged |
+| 2026-10-15 | minor | Outline stroke (#386) works on every selected layer. Numbers unchanged |
+| 2026-10-15 | minor | Send to back (#444) counts per parent when the selection spans frames. Numbers unchanged |
+| 2026-10-15 | minor | Align buttons (#276) are off when the selection has nothing to align to. Numbers unchanged |
+| 2026-10-15 | minor | Gradient type icons (#275) show their gradient. Numbers unchanged |
+| 2026-10-15 | minor | Corner resize cursors (#388) stay diagonal at any proportions; the text selection highlight (#390) stays inside the box on the last line. Numbers unchanged |
+| 2026-10-15 | minor | New pages (#311, #295) take the current page's background; the theme still decides a new file's page. Numbers unchanged |
+| 2026-10-15 | minor | A slice's export preview (#265) shows the content under it. Numbers unchanged |
+| 2026-10-15 | minor | SVG export (#327, #325) keeps a nested frame's fill and stroke inside its parent's clip. Numbers unchanged |
+| 2026-10-15 | minor | Home screen (#318, #324): recent files notice files deleted while it is open; a long path no longer draws over the file name. Numbers unchanged |
+| 2026-10-15 | minor | System theme on first run (#262): the first frame follows the system theme, and going back to System from a manual theme works. Numbers unchanged |
+| 2026-10-15 | minor | Web clipboard (#375): copy and paste in the browser go through the system clipboard, so a paste after a copy brings the copied layers instead of whatever text the clipboard held. Numbers unchanged |
+| 2026-10-15 | minor | Zoom previews (#312): when renders from scratch are slow, a new zoom first shows the whole view coarsely instead of the page colour, then the refined image; images of another file or page never show. Numbers unchanged |
+| 2026-10-15 | minor | Hidden windows (#313, #332; #269): a minimised or covered window answers control and MCP requests (commands, inspection, `ui.render`) at once, each window on its own; screenshots and input still wait for it to be on screen. Numbers unchanged |
+| 2026-10-15 | minor | Server (#340, #302): a compaction cut short closes the file instead of confirming lost edits (#183); each team library version is kept in its own file (#206). Numbers unchanged |
+| 2026-10-15 | minor | Counters (#343, #344, #353; #309): collab sequence numbers, layer name counters and opacity digits can't overflow. Numbers unchanged |
+| 2026-10-15 | minor | Commands refuse bad indexes and ids (#475, #384, #310): `page.select` and `doc.switch`, `effect.set` and `export.update` / `export.remove`, `page.move` with a non-page id. Numbers unchanged |
+| 2026-10-15 | minor | Find and replace (#358, #361) changes every occurrence, case-insensitively, also when the replacement contains the search text. Numbers unchanged |
+| 2026-10-15 | minor | The gradient shorthand (#254, #252) is read by the engine, so the CLI, control channel and MCP share it. Numbers unchanged |
+| 2026-10-15 | minor | .fig import (#279, #281): resized instances lay out their layers by their constraints (#266); explicit variable modes whose collection is named by its asset key, as library collections are, come across (#267). Numbers unchanged |
+| 2026-10-15 | minor | Colour emoji (#300, #268) draw from their own colour tables (sbix and CBDT/EBDT bitmap strikes, COLR v0 layers), a colour face tried first; COLR v1 still draws outlines. Numbers unchanged |
+| 2026-10-15 | minor | macOS (#290, #289): `.figcraft` files open from Finder, Open With and the Dock. Numbers unchanged |
+| 2026-10-15 | minor | Windows (#294, #291): the first preferred language alone picks the UI language. Numbers unchanged |
+| 2026-10-15 | minor | Unix font discovery (#474) follows `XDG_DATA_HOME`. Numbers unchanged |
+| 2026-10-15 | minor | Linux packaging (#346, #328): the window id matches the desktop entry (FreeBSD keeps its class); the RPM requires glibc 2.35. Numbers unchanged |
+| 2026-10-15 | minor | Tests (#472, #471, #339): the rename shortcut test, the hanging punctuation test and the font-scanning tests no longer depend on the platform, font or test order. Numbers unchanged |
+| 2026-10-15 | minor | Languages (#257, #263, #469, #477, #288): Russian (with one/few/many plural forms) and Turkish catalogs, reviewed by native speakers; Czech and Indonesian drafts; the Japanese draft completed. 2,177 entries now (1,587 UI strings, 559 command labels, 31 menu wordings); strings added since a catalog was written read English there. Localization 39% and 29–51 h unchanged at this rounding (Indonesian is now a draft, while the five older drafts lack 88 newer entries) |
| 2026-10-17 | minor | Community batch #753 (10 PRs): Selection colors for mixed selections (#403); smart-selection spacing fields and canvas handles (#402); a Present tab with device and scale controls (#537); adding auto layout to an empty frame keeps its size (#369); `node.set` applies auto layout keys to frames only and warns about font styles a family lacks (#603); canvas images on whole device pixels (#359); Adwaita window controls on Wayland without server decorations (#592, not run on GNOME or KDE by the maintainers); the keyboard shortcuts panel closes on the home screen (#548); macOS paste modifiers in tests (#750); credits column tests (#347). Numbers unchanged. |
| 2026-10-17 | minor | Community fixes from #524 up (batches #727, #728, #733, #735, #736 and #729; 55 PRs) and a crash guard. `.fig` import: explicit instance identity, overrides by key, text style precedence, grid track sizes, slot content, connector labels, skip ink, paragraph options and hanging lists, list start numbers, vertical trim, per-point stroke joins, text on a path, image adjustments and embedded images; large files open within budgets from the file's own size; an import report after opening; imported bytes stay out of the command journal. Files and paste: save a copy as `.fig`; Cmd/Ctrl+V pastes images copied in other apps and layers copied from another design app (`edit.pasteDesignLayers`); paste over and paste properties; clipboard reads on Linux and the BSDs time out after 2 s. Editor: live font preview on hover; Shift+I and Resources open Assets; Shift-drag moves the selection; thin strokes take a nearby double-click; dropped points merge; Flatten keeps open paths; the Actions palette gets tabs, ranked search, a keyboard highlight and recents; the colour picker opens on a new fill or stroke; text strokes follow their alignment; selection highlights after line breaks; a draggable pages/layers divider; variant properties reorder by drag; submenus keep their hover with a safe triangle; menu actions that need a value ask for it; File ▸ Rename edits the name in place. Engine: bad paint indexes, non-finite geometry and pages in copy/cut are refused; a param naming a layer says so when it isn't one; a CLI script is one undo step and resolves `$step`. Server and collaboration: message limits follow `max_file_mb` (client capped at 1 GiB); a damaged generation field no longer drops flushed edits; the web build joins a session from a `#join=` link. Also Swedish command labels, Nix CI through the shared workflow, paint bounds once per render, and a guard that turns a panic inside the boolean-op library into bad input (the stroke draws unclipped). Numbers unchanged. |
| 2026-10-16 | minor | Community fixes from #478 up (batches #591, #598, #602; 69 PRs) and a control-channel fix: a line that isn't JSON now ends a `--control` connection, so a web page can't drive the app through a browser request (#589). Highlights: page copies keep navigation, flows, prototype settings and guides; Find and Replace keeps line endings and case-insensitive matches; text hyperlinks survive import and export; recent colours record only what was picked; MCP screenshots respect `maxSize`; Swedish catalog (UI strings), Czech plurals; bounded canvas overscan while panning; Korean fallback at the run's weight; many vector-edit, guide, page and .fig round-trip fixes. Numbers unchanged |
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index a1a5bf12..7531a455 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1,6 +1,6 @@
# FigCraft parity with Figma
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719); reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7) · **Target:** Figma Design (desktop app 126.10.7, macOS)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (Turkish reviewed, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7; rows for the community batches: Selection colors, smart-selection spacing and a Present tab (#753), `.fig` import fidelity, paste from another design app, a `.fig` copy from Save as; control requests while the window is minimised (#720); catalog counts re-measured; automation roots (#715); number variables in the text content picker (#629); frames and sections convert into each other (#719); reviewed Russian catalog and integer plurals; vector edit mode regions: hover hatch, selection and drag; plugin log byte/count limits (#191); core editor leftovers: component playground, auto gap handles, variables inside styles, inner shadows and background blur on groups, command-made text readable on dark pages, a one-step frame/group convert, delays on mouse triggers and manual overlay offsets, wrapped-line alignment; starter templates, a Templates tab and Getting started tips on the home screen: essentials ~57% → ~59%; everyday editing partials: number fields, outline options, Hide when publishing, cursors, panel widths, dark pages, numbers unchanged but menu breadth 211/211; text box sizes measured against documents re-saved by other software: whole-pixel line heights, advances on a 1024-per-em grid, letter spacing between glyphs only, numbers unchanged; .fig export checked by opening written files in other software, numbers unchanged; a public figcraft-server: open hosting, owner tokens, per-address limits, idle expiry, moderation, install.sh; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; headline percentages recomputed from the area table: feature breadth ~84%, core ~94%, mainstream ~50%; text lists, hanging punctuation and decoration styles; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; export and inspect behaviour suite and fixes; .fig import: editable vector networks and more layer kinds; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; styles and variables behaviour suite and fixes; prototyping behaviour suite and fixes; components behaviour suite and fixes; embedded image colour profiles; layers panel keyboard: F2 rename, Shift+F10 context menu, keyboard box selection, 10k-layer QA; per-side stroke weight variables; text behaviour suite: CJK line breaking, metrics, vertical trim; selection and transform behaviour suite and fixes; `.fig` import, best effort; auto layout behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings; feature breadth ~80%; ready ~49%; last major: full re-measure against Figma desktop 126.10.7) · **Target:** Figma Design (desktop app 126.10.7, macOS)
The authoritative assessment of how close FigCraft is to Figma Design. [`ROADMAP.md`](../ROADMAP.md)
summarizes it; [`gaps.md`](gaps.md) is the ranked work list; the measured menu checklist is
@@ -638,6 +638,7 @@ Carried over from the ROADMAP's "Shipped so far" (2026-10-10). The test count th
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Localization (#263, #469, #477, #288): Turkish reviewed by a native speaker, Czech and Indonesian drafts, the Japanese draft caught up; coverage re-measured (2,177 entries; the five older drafts at 95%). Localization 39% and 29–51 h unchanged at this rounding (see [localization-parity](localization-parity.md)) |
| 2026-10-20 | minor | Layer data reads back (#879): `node.get` (the command, the control method and MCP `get_node`) and `document.inspect` report a layer's or page's `pluginData` as `{key: value}` when it has any, so a tool that keeps state in a file with `node.set {props: {pluginData}}` can read it on its next run (`plugin_data_tests`). Numbers unchanged |
| 2026-10-17 | minor | Menu breadth re-run with `cargo xtask parity`: 212 / 212 (100%; the catalog gained View ▸ Full screen with #227 on 2026-10-14), 561 commands. Rows for the 2026-10-17 landings: import/export (area 14) and the file formats dimension name the `.fig` import's new fidelity (instance identity, overrides by key, text style precedence, grid tracks, slots, connector labels, per-point joins, text on a path, image adjustments, list start numbers, vertical trim), budgets from the file's size, the import report, a `.fig` copy from Save as and paste from another design app; the localization evidence takes the re-measured catalog counts (2,272 entries, drafts at 95–99%, Indonesian and Czech drafts, Swedish and Turkish catalogs); the Automation line adds control requests answered while the window is minimised (#720); batch #753's Selection colors, smart-selection spacing, Present tab and auto layout on empty frames are in ui-parity, prototyping-parity and auto-layout-parity. Numbers unchanged: every `.fig` and paste change is checked on synthetic files or clipboard HTML made from our own export, and real files are what gap 1's blocker and the file-exchange discounts wait for; the UI changes (menus, the Actions palette, editor fixes) are not compared side by side, so UI/UX stays at 58%; the localization grade and hours stay (Indonesian's draft is offset by the drafts' new gaps) |
| 2026-10-17 | minor | Automation roots (M8, #715, #481): `figcraft-cli mcp --automation-read-root DIR --automation-write-root DIR` (each repeatable, existing folders) and the desktop app with the same flags confine every file a command reads to the read and write roots and every file it writes to the write roots; paths are resolved (links followed, `..`, Windows `\\?\` and UNC paths, case) and compared by whole folder names, anything else is an ordinary error. The engine reaches the file system through one module (enforced by `crates/engine/clippy.toml`), and a sweep runs every command with paths outside the roots. `--attach` refuses the flags (the app confines itself); `ui.screenshot` and `ui.render` return PNG data without a `path`, so the attached MCP server writes no temporary files. Numbers unchanged. |
diff --git a/docs/ui-parity.md b/docs/ui-parity.md
index d87103f0..6e509859 100644
--- a/docs/ui-parity.md
+++ b/docs/ui-parity.md
@@ -1,6 +1,6 @@
# UI and interaction parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths) · **Target:** Figma Design UI3 (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-18 · **Change:** minor (community fixes: the text box by dragging, the font picker keys, the pen path on leaving Design, a still canvas in vector edit mode, a scrolling pages list, colour emoji, readable new text in frames, system theme on first run; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths; a rename selects the whole name, so typing replaces it; Escape or Enter after a pen path stays on the same vector (#760); IME composition kept on through idle frames of a text edit, candidates at the caret (#747); Selection colors for mixed selections and smart-selection spacing (#753); submenus with a hover delay and a safe triangle; the Actions palette's tabs, ranked search, highlight and recents; menu items that ask for a value; editor fixes from the community batches; fields select their text on focus; Typography spacing icons support scrubbing (#373); CSS colour names in hex fields; the Small caps sample in Type settings drawn from capitals; recent files as cards; vector edit mode: hovering, hatching, selecting and dragging filled regions; home screen: Templates tab, first-run templates and Getting started tips; number fields: scrub rates, arrow steps, arithmetic with brackets, relative edits of mixed values; outline mode's hidden layers and object bounds; Hide when publishing; cursors per tool and modifier; panel widths; dark pages for files made in the dark theme; drag threshold and double-clicks into text in groups; rotation origin on Alt+R and placing with Enter: no documented shortcut missing; keyboard shortcut parity suite and bindings; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and the vector edit tail; canvas navigation, guides and grids behaviour suite and fixes; shapes and vector behaviour suite and fixes; paint and effects behaviour suite and fixes; frames, groups, sections and masks behaviour suite and fixes; layers panel keyboard: F2 rename, Shift+F10 context menu, F8 box selection; selection and transform behaviour suite and fixes; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; boolean hit testing on the result, group drags, frame outlines and slices; outlines for the selection, mask outlines; arc fields, live boolean editing, shape builder on strokes, one-sided widths) · **Target:** Figma Design UI3 (desktop app 126.10.7)
Fine canvas control is what Figma users feel first: handles, snapping, nudging, modifier keys,
drag behaviour, numeric precision. This checklist covers the tools, gestures and panels. Status:
@@ -41,7 +41,7 @@ interaction feel not yet compared.
| Eye and padlock: click, or drag across rows to set several in one step; layers in a locked frame show a faint padlock | done | the toggles no longer vanish under the pointer (clicks on them could miss) |
| Rename: double click, F2 / Cmd+R, Tab to the next row; several layers open Rename layers (match, regular expressions, current name and number codes, start value, preview) | done | numbered in stacking order, pinned |
| Find layers (filter by name) | done | not covered by the documentation |
-| Pages: add, rename, drag to reorder, duplicate ("Copy of"), delete, dividers (a blank page named with a hyphen) | done | the line between Pages and Layers drags to size the pages list, kept in the preferences (`layers_behaviour_tests`) |
+| Pages: add, rename, drag to reorder, duplicate ("Copy of"), delete, dividers (a blank page named with a hyphen) | done | the line between Pages and Layers drags to size the pages list, kept in the preferences; a long list scrolls in its own area and a page dropped outside the visible list stays put (#272) (`layers_behaviour_tests`) |
| Assets panel: folders from page, frames and slash names (fold away), search, thumbnails, drag onto the canvas or into frames and auto layout, Alt-drop swap, enabled libraries | done | Shift+I (Quick insert) and the toolbar's Resources open it (they didn't, #710) |
| Hide when publishing from the Assets panel's context menu | done | a right-click on one of this file's components (also Libraries ▸ Hide when publishing for the selection, `component.hideWhenPublishing {ids?, on?}`): the model's sign of it is the name, so hiding puts a `.` before the name and showing takes the leading `.` and `_` away (one undo step, saved and synced like a rename; a variant or a layer inside hides its whole component or set); a hidden component shows a crossed eye on its tile and a dimmer name, the menu item its check mark; the next publish leaves it out and brings it back when shown again (`hide_publishing_tests`). Library components (read-only here) have no such menu |
@@ -81,11 +81,11 @@ interaction feel not yet compared.
| Frame (presets panel, swap orientation), section, slice | done | |
| Rectangle, ellipse (arc handles and Design panel arc fields), polygon, star, line, arrow; Shift/Alt | done | Alt draws lines from the centre too (`shapes_behaviour_tests`) |
| Corner radius handles (inside each corner of a rectangle or frame, a polygon's or star's top point; Alt: one corner), star ratio handle; Count and Ratio fields | done | handles hide under 48 px on screen; no count handle on the canvas (the Count field instead); corner smoothing rounds rectangles and frames only |
-| Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape or Enter ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`) |
-| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a double-click a few pixels off a thin stroke enters edit mode (#646); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`). Not yet: the transform box around points of several layers; areas of other layers edited at once |
+| Pen: vector networks, branch, close, bend; pencil | done | pen pressure on Windows and from browser styluses only; outside edit mode the Pen closes on its first point, connects to its other points and continues a selected open path from an end point (`vector_multi_behaviour_tests`); Escape or Enter ends the path and keeps its layer in edit mode with the pen, so the next path joins the same vector and another Escape leaves edit mode (#760, `pen_end_tests`); switching from Design to Prototype or Inspect ends the path and returns to Move (#308) |
+| Vector edit mode: bend, paint bucket, lasso, cut, eraser, transform box, point snapping, mirroring | done | a double-click a few pixels off a thin stroke enters edit mode (#646); entering edit mode and picking a region keep the canvas still (#322); a point dropped on another point merges with it, and dropping one end of an open path on the other closes it (a 2-point line's end just moves, #401); Flatten keeps open paths open (#377); paint bucket drags across areas; cut drags divide a shape into layers; delete and heal follows the curve; rounded points are drawn; Shift-click deselects a point at a corner of the box (`vector_behaviour_tests`); several vectors edited at once, Shift-click handles to drag them together, a cap and join per point, rounded points beside curves (`vector_multi_behaviour_tests`); filled regions with the Move tool: the area under the pointer is hatched ("/" lines in the selection colour, clipped by the area's own fill rule, holes left out, gone 3.5 px from a point or 2 px from a segment at any zoom), the line spacing follows octave folding (fitted to measurements at several zoom levels: 8 px at every power-of-two zoom, growing with the zoom and stepping back at √2 · 2ⁿ) and stays fixed to the shape when panning; a click selects the area and its points (moved with it but drawn unselected), Shift adds or removes an area, a press on a selected area drags the whole selection, no hover hatch during drags, a click on an empty spot (a hole) clears it and stays in edit mode; `vector.edit.select {regions}` (`regions_tests`, `vector_regions_tests`). Not yet: the transform box around points of several layers; areas of other layers edited at once |
| Shape builder (Shift+M) on fills, strokes and open paths; variable width (Shift+W), one side with Alt | done | |
| Boolean groups: clicked where the result is, double-click or Cmd/Ctrl-click into operands, live results while dragging or editing points, per-operand operations | done | |
-| Text: point, auto height, fixed; caret, words, lines, IME | done | the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; no spell check |
+| Text: point, auto height, fixed; caret, words, lines, IME | done | the font picker previews a family on the canvas while hovered (no undo step; Escape restores, #653) and Up/Down step through it (#352); a selection highlight after a line break starts at that line's start and an empty last line shows its mark (#665); carets step over whole emoji and accented letters; colour emoji draw from their colour tables (#300); IME composition replayed in tests as macOS sends it, not yet checked on a Mac (#747); CJK words by script run (no dictionary); vertical trim in Type settings; no spell check |
| Eyedropper (I) | done | picks the colour seen under the pointer (opaque) into the selection's fill and the recent colours, one undo step (`fx_behaviour_tests`) |
| Comment (C), Shift+C to show/hide | done | local only |
| Text on a path (Figma Draw) | done | put on from the Design panel or `text.onPath`, not by clicking a path with the Text tool; the path is edited by resizing only |
@@ -172,6 +172,7 @@ in the table. `crates/ui-egui/src/shortcut_keys_tests.rs` drives the keys a look
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Community fixes (#262, #272, #277, #300, #308, #311, #322, #352, #363, #372, #390): first runs follow the system theme; new text is readable on the frame it is drawn in; a long pages list scrolls on its own and new pages take the current page's colour; the pen shows its handles while dragging a point out and ends its path when you leave Design; vector edit mode keeps the canvas still; a drag with the Text tool makes a fixed-size box; colour emoji; the selection highlight on the last line; Up and Down in the font picker with a live preview. Numbers unchanged |
| 2026-10-20 | minor | Readable disabled and selected text (#890): the dim text colour (disabled buttons, placeholders, hints) is at least 3:1 against panels, fields and selected rows in both themes (it was 2.1:1 in the light theme), a disabled button is grey with that text instead of fading to 40%, and selected text (renaming a page or layer, any text box) takes the theme's readable green on the highlight (1.4:1 in the dark theme before, now 4.2:1 or more); checked with the colour contrast helper (`theme::tests`). Numbers unchanged |
| 2026-10-20 | minor | Measuring while nudging (#894): with Alt held over another layer, the arrows nudge the selection (Shift: the big step) and the distances follow every nudge (Alt+arrows used to do nothing); while measuring, the selection's handles and size label hide and both layers keep their outlines (`measure_nudge_tests`). Numbers unchanged |
| 2026-10-18 | minor | A rename (layers double-click, F2, File ▸ Rename, a page) selects the whole name in the frame its field first draws, so the first key replaces the name instead of being appended. Checked in the app on Windows over the control channel |
From 70f702ca170f1c44e439a5965e8f57090e39dd3f Mon Sep 17 00:00:00 2001
From: aiongg <67543387+aiongg@users.noreply.github.com>
Date: Fri, 23 Oct 2026 15:43:21 -0400
Subject: [PATCH 20/23] i18n: a missing translation fails no check; cargo xtask
i18n-report lists them (#1228)
---
crates/ui-egui/src/i18n_tests.rs | 108 +++++++++++++------------------
docs/localization-parity.md | 13 ++--
docs/translating.md | 20 +++---
xtask/src/main.rs | 14 +++-
4 files changed, 72 insertions(+), 83 deletions(-)
diff --git a/crates/ui-egui/src/i18n_tests.rs b/crates/ui-egui/src/i18n_tests.rs
index 046212c1..3921cb1b 100644
--- a/crates/ui-egui/src/i18n_tests.rs
+++ b/crates/ui-egui/src/i18n_tests.rs
@@ -1,13 +1,11 @@
//! The catalog checks: every key the code looks up is in the English catalog, no catalog has keys
-//! the code doesn't use, placeholders match English, and complete languages translate everything.
+//! the code doesn't use, and placeholders match English. A missing translation reads English and
+//! fails nothing: [`missing_translations_report`] lists them (`cargo xtask i18n-report`).
use std::collections::BTreeSet;
use super::*;
-/// Languages that must translate every UI string and command label.
-const COMPLETE: &[&str] = &["es"];
-
/// Keys looked up from data rather than written as `tr("…")` in the code: the main menu's
/// submenu names (the engine's menu catalog) and labels of engine and document enums.
fn dynamic_keys() -> BTreeSet {
@@ -274,14 +272,19 @@ fn english_text_is_its_key_except_plurals() {
assert!(english().commands.is_empty() && english().menu.is_empty(), "English command labels come from the engine");
}
-#[test]
-fn catalogs_have_known_keys_and_matching_placeholders() {
- let en = english();
- let ids: BTreeSet<&str> = figcraft_engine::all_commands()
+/// The ids `[commands]` entries translate: every command and every main-menu item.
+fn command_ids() -> BTreeSet<&'static str> {
+ figcraft_engine::all_commands()
.iter()
.map(|c| c.id)
.chain(figcraft_engine::catalog::MENU.iter().map(|m| m.id).filter(|id| !id.is_empty()))
- .collect();
+ .collect()
+}
+
+#[test]
+fn catalogs_have_known_keys_and_matching_placeholders() {
+ let en = english();
+ let ids = command_ids();
for lang in LANGS {
assert!(!lang.name.is_empty(), "{}: [meta] name is missing", lang.code);
for (k, t) in lang.ui {
@@ -302,13 +305,29 @@ fn catalogs_have_known_keys_and_matching_placeholders() {
for (id, _) in lang.menu {
assert!(menu_worded_differently().contains(id), "{}: [menu] {id:?} reads like the command; [commands] covers it", lang.code);
}
- if COMPLETE.contains(&lang.code) {
- let missing: Vec<_> = en.ui.iter().filter(|(k, _)| find(lang.ui, k).is_none()).map(|(k, _)| k).collect();
- assert!(missing.is_empty(), "{}: untranslated: {missing:?}", lang.code);
- let missing: Vec<_> = ids.iter().filter(|id| find(lang.commands, id).is_none()).collect();
- assert!(missing.is_empty(), "{}: untranslated commands: {missing:?}", lang.code);
- let missing: Vec<_> = menu_worded_differently().into_iter().filter(|id| find(lang.menu, id).is_none()).collect();
- assert!(missing.is_empty(), "{}: menu items worded unlike their command, missing from [menu]: {missing:?}", lang.code);
+ }
+}
+
+/// What each language lacks: UI strings, command labels and menu wordings that read as in English
+/// because neither its catalog nor the one it overlays has them. It prints them and always passes.
+#[test]
+fn missing_translations_report() {
+ let ids = command_ids();
+ let worded = menu_worded_differently();
+ for (i, lang) in LANGS.iter().enumerate().filter(|(_, l)| l.code != "en") {
+ let own = || chain(i).filter(|l| l.code != "en");
+ let ui: Vec<_> = english().ui.iter().map(|(k, _)| *k).filter(|k| own().all(|l| find(l.ui, k).is_none())).collect();
+ let commands: Vec<_> = ids.iter().filter(|id| own().all(|l| find(l.commands, id).is_none())).collect();
+ let menu: Vec<_> = worded.iter().filter(|id| own().all(|l| find(l.menu, id).is_none())).collect();
+ println!("{}: {} UI strings, {} command labels, {} menu wordings missing", lang.code, ui.len(), commands.len(), menu.len());
+ for k in ui {
+ println!(" {k:?}");
+ }
+ for id in commands {
+ println!(" [commands] {id}");
+ }
+ for id in menu {
+ println!(" [menu] {id}");
}
}
}
@@ -344,8 +363,6 @@ fn system_languages_pick_the_first_one_with_a_catalog() {
assert_eq!(code("system", Some("cs_CZ.UTF-8")), "cs");
assert_eq!(code("system", Some("cs-CZ,en-US")), "cs");
assert_eq!(code("cs", None), "cs");
- assert_eq!(LANGS[resolve("cs", None)].name, "Čeština");
- assert!(LANGS[resolve("cs", None)].draft);
assert_eq!(code("system", Some("pt-BR")), "pt-BR");
assert_eq!(code("system", Some("tr_TR.UTF-8")), "tr");
assert_eq!(code("system", Some("id_ID.UTF-8")), "id");
@@ -368,8 +385,6 @@ fn swedish_is_picked_for_swedish_locales() {
assert_eq!(code("system", Some(tag)), "sv", "{tag}");
}
let sv = LANGS.iter().position(|l| l.code == "sv").unwrap();
- assert_eq!(LANGS[sv].name, "Svenska");
- assert!(!LANGS[sv].draft);
assert!(!plural_one(sv, 0) && plural_one(sv, 1) && !plural_one(sv, 2));
}
@@ -387,10 +402,11 @@ fn latin_american_spanish_overlays_spanish() {
assert_eq!(LANGS[la].parent, es);
assert!(es < la, "the picker lists Español first");
// Its own wording, else Spanish's, else English's.
- assert!(matches!(lookup(la, "Add fill"), Some(Text::Plain("Agregar relleno"))));
- assert!(matches!(lookup(la, "Fill"), Some(Text::Plain("Relleno"))));
+ for (k, _) in LANGS[es].ui.iter().filter(|(k, _)| find(LANGS[la].ui, k).is_none()) {
+ assert!(lookup(la, k).is_some_and(|t| std::ptr::eq(t, find(LANGS[es].ui, k).unwrap())), "{k:?}");
+ }
let undo = |i: usize| chain(i).find_map(|l| find(l.commands, "edit.undo")).map(forms);
- assert!(undo(es).is_some() && undo(la) == undo(es), "command labels fall back too");
+ assert_eq!(undo(la), undo(es), "command labels fall back too");
// An overlay lists only what differs from the catalog under it.
for lang in LANGS.iter().filter(|l| l.parent != 0) {
let under = &LANGS[lang.parent];
@@ -431,19 +447,11 @@ fn japanese_korean_and_chinese_have_no_plural_forms() {
}
#[test]
-fn georgian_is_a_draft_with_count_neutral_plurals() {
+fn georgian_is_picked_for_georgian_locales() {
let code = |pref: &str, system: Option<&str>| LANGS[resolve(pref, system)].code;
for tag in ["ka", "ka-GE", "ka_GE.UTF-8"] {
assert_eq!(code("system", Some(tag)), "ka", "{tag}");
}
- let ka = LANGS.iter().position(|l| l.code == "ka").unwrap();
- assert!(LANGS[ka].draft && LANGS[ka].name == "ქართული");
- // A noun stays singular after a numeral: both forms read the same where English counts in both.
- for (k, t) in LANGS[ka].ui {
- if let (Text::Plural { one: Some(one), other, .. }, Some(Text::Plural { one: Some(en_one), .. })) = (t, find(english().ui, k)) {
- assert!(!en_one.contains("{n}") || one == other, "ka: {k:?}");
- }
- }
}
/// Release builds embed craft-fonts' Noto Sans Georgian (`theme::install_fonts`' built-in faces),
@@ -477,7 +485,6 @@ fn chinese_reads_simplified_and_traditional_has_no_catalog() {
assert_eq!(code(tag, None), "en", "{tag}");
}
assert_eq!(code("system", Some("zh-TW,ja-JP")), "ja");
- assert_eq!(LANGS[resolve("zh-Hans", None)].name, "简体中文");
}
#[test]
@@ -491,28 +498,18 @@ fn the_key_scanner_reads_rust_literals() {
#[test]
fn czech_integer_plurals() {
- let cs = LANGS.iter().position(|l| l.code == "cs").unwrap();
assert_eq!(plural("cs", 1), Plural::One);
- assert_eq!(fill(counted(cs, "{n} layers", 1), &[("n", &1)]), "1 vrstva");
for n in [2, 3, 4] {
assert_eq!(plural("cs", n), Plural::Few, "{n}");
- assert_eq!(fill(counted(cs, "{n} layers", n), &[("n", &n)]), format!("{n} vrstvy"));
}
for n in [0, 5, 11, 12, 21, 22, 100, 1_000_000] {
assert_eq!(plural("cs", n), Plural::Other, "{n}");
- assert_eq!(fill(counted(cs, "{n} layers", n), &[("n", &n)]), format!("{n} vrstev"));
- }
- for (key, text) in LANGS[cs].ui {
- if let Text::Plural { one, few, .. } = text {
- assert!(one.is_some() && few.is_some(), "{key}: missing Czech plural forms");
- }
}
}
#[test]
fn russian_language_tags_and_integer_plurals() {
let ru = LANGS.iter().position(|l| l.code == "ru").unwrap();
- assert_eq!(LANGS[ru].name, "Русский");
for tag in ["ru", "ru-RU", "ru_RU.UTF-8", "RU", "ru-BY", "ru-Cyrl-RU"] {
assert_eq!(resolve(tag, None), ru, "{tag}");
assert_eq!(resolve("system", Some(tag)), ru, "{tag}");
@@ -520,49 +517,34 @@ fn russian_language_tags_and_integer_plurals() {
assert_eq!(resolve("system", Some("hi,ru-RU,en-US")), ru);
for n in [1, 21, 31, 101, 1_001] {
assert_eq!(plural("ru", n), Plural::One, "{n}");
- assert_eq!(fill(counted(ru, "{n} layers", n), &[("n", &n)]), format!("{n} слой"));
}
for n in [2, 3, 4, 22, 23, 24, 102, 104, 1_002] {
assert_eq!(plural("ru", n), Plural::Few, "{n}");
- assert_eq!(fill(counted(ru, "{n} layers", n), &[("n", &n)]), format!("{n} слоя"));
}
for n in [0, 5, 10, 11, 12, 13, 14, 19, 20, 25, 100, 111, 112, 114, 1_000_000] {
assert_eq!(plural("ru", n), Plural::Many, "{n}");
- assert_eq!(fill(counted(ru, "{n} layers", n), &[("n", &n)]), format!("{n} слоёв"));
- }
- for (key, text) in LANGS[ru].ui {
- if let Text::Plural { one, few, many, .. } = text {
- assert!(one.is_some() && few.is_some() && many.is_some(), "{key}: missing Russian plural forms");
- }
}
}
#[test]
fn polish_integer_plurals() {
- let pl = LANGS.iter().position(|l| l.code == "pl").unwrap();
- assert_eq!(LANGS[pl].name, "Polski");
assert_eq!(plural("pl", 1), Plural::One);
- assert_eq!(fill(counted(pl, "{n} layers", 1), &[("n", &1)]), "1 warstwa");
for n in [2, 3, 4, 22, 23, 24, 102, 104, 1_002] {
assert_eq!(plural("pl", n), Plural::Few, "{n}");
- assert_eq!(fill(counted(pl, "{n} layers", n), &[("n", &n)]), format!("{n} warstwy"));
}
for n in [0, 5, 10, 11, 12, 13, 14, 19, 20, 21, 25, 31, 100, 101, 111, 112, 114, 1_000_000] {
assert_eq!(plural("pl", n), Plural::Many, "{n}");
- assert_eq!(fill(counted(pl, "{n} layers", n), &[("n", &n)]), format!("{n} warstw"));
- }
- for (key, text) in LANGS[pl].ui {
- if let Text::Plural { one, few, many, .. } = text {
- assert!(one.is_some() && few.is_some() && many.is_some(), "{key}: missing Polish plural forms");
- }
}
}
#[test]
fn plural_fallback_uses_the_language_of_its_catalog() {
+ // A plural es-419 doesn't overlay reads Spanish's entry under Spanish's rule.
+ let es = LANGS.iter().position(|l| l.code == "es").unwrap();
let la = LANGS.iter().position(|l| l.code == "es-419").unwrap();
- assert_eq!(counted(la, "{n} layers", 1), "{n} capa");
- assert_eq!(counted(la, "{n} layers", 21), "{n} capas");
+ for n in [1, 21] {
+ assert_eq!(counted(la, "{n} layers", n), counted(es, "{n} layers", n), "{n}");
+ }
// Unsupported optional categories use other; existing one/other languages are unchanged.
for code in ["en", "es", "de"] {
for n in [0, 2, 11, 21, 1_000_000] {
diff --git a/docs/localization-parity.md b/docs/localization-parity.md
index 44e35f39..aa4cbb52 100644
--- a/docs/localization-parity.md
+++ b/docs/localization-parity.md
@@ -1,6 +1,6 @@
# Localization parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (Russian and Turkish catalogs reviewed by native speakers, Russian one/few/many plurals; Czech and Indonesian drafts; the Japanese draft completed; counts re-measured; Windows UI language from the first preferred language; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog; macOS finds its downloadable CJK system fonts (#406); string counts re-measured: 2,272 entries, the drafts at 95–99%; Swedish command labels and menu wordings; Russian, Swedish, Turkish, Czech and Indonesian listed; a duplicated paragraph removed; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-23 · **Change:** minor (a missing translation fails no check: `cargo xtask i18n-report` lists them; Russian and Turkish catalogs reviewed by native speakers, Russian one/few/many plurals; Czech and Indonesian drafts; the Japanese draft completed; counts re-measured; Windows UI language from the first preferred language; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog; macOS finds its downloadable CJK system fonts (#406); string counts re-measured: 2,272 entries, the drafts at 95–99%; Swedish command labels and menu wordings; Russian, Swedish, Turkish, Czech and Indonesian listed; a duplicated paragraph removed; draft catalogs catch up: every draft translates every string again; Simplified Chinese draft catalog) · **Target:** Figma Design (desktop app 126.10.7)
FigCraft's interface has a localization layer with an English catalog, a Russian catalog reviewed
by a native speaker, and Spanish (with a Latin American overlay), French, German, Brazilian
@@ -46,11 +46,11 @@ supported by both apps (CJK, Arabic and Devanagari shaping, IME); Figma has no v
(`es-419.toml` over `es.toml`); its UI strings, command labels and menu wordings read the
overlay, then the base language, then English.
- **Check:** `cargo test -p figcraft-ui-egui i18n` fails on keys the code uses that `en.toml`
- lacks, keys no code uses, unknown command ids, placeholders that differ from English, overlay
- entries that read as in their base language and, for complete languages (Spanish), anything
- untranslated. The other catalogs are not held to it: a string added later shows English there
- until someone translates it. Every draft translated every string on 2026-10-12; by 2026-10-17
- the strings added since left them at 95–99% (table below).
+ lacks, keys no code uses, unknown command ids, placeholders that differ from English and overlay
+ entries that read as in their base language. No language is held to full coverage: a string
+ added later shows English until someone translates it, and `cargo xtask i18n-report` (part of
+ `cargo xtask ci`) lists what each language lacks. Every draft translated every string on
+ 2026-10-12; by 2026-10-17 the strings added since left them at 95–99% (table below).
- **Not yet localized:** messages the engine writes (errors, a few toasts, Dev Mode property values
such as "inside"), number formatting (decimal points stay `.`), and decimal plural rules
(`trn` takes integers: Czech uses one/few/other and Russian one/few/many; French and Brazilian
@@ -122,6 +122,7 @@ Hindi, Vietnamese and Arabic. Traditional Chinese is not planned (no catalog; it
| Date | Change | Summary |
|---|---|---|
+| 2026-10-23 | minor | A missing translation fails no check: Spanish is no longer held to full coverage, and the tests of one language's wording, names and plural forms are gone (the plural rules and language-tag tests stay). `cargo xtask i18n-report`, run by `cargo xtask ci`, lists each language's missing UI strings, command labels and menu wordings. Grade unchanged |
| 2026-10-15 | minor | Community catalogs (#257, #263, #469, #477, #288): Russian (`ru`, Русский, reviewed and approved by VanTan) and Turkish (`tr`, Türkçe, reviewed by a native speaker), Czech (`cs`, Čeština) and Indonesian (`id`, Bahasa Indonesia) drafts, and the Japanese draft caught up; Preferences ▸ Language lists them and System maps their regional tags. Catalogs may give few and many plural forms; Russian picks one, few or many by its integer rule (11–14 take many), the catalog supplying the text choosing the rule. Only Spanish is held to completeness. Counts re-measured: 1,587 UI keys (38 plural), 559 command labels and 31 menu wordings, 2,177 entries; Spanish 100%, Japanese 2,176, Czech and Indonesian 2,166, Russian and Turkish 2,165, the five older drafts 2,088–2,089 (95%). Localization 39% and 29–51 h unchanged at this rounding |
| 2026-10-17 | minor | Chinese showed as boxes on macOS (#406): the font scan also walks the system's downloaded font assets (`/System/Library/AssetsV2` and the older `/System/Library/Assets`, only their `com_apple_MobileAsset_Font*` folders), where current versions keep PingFang SC, and Hiragino Sans GB and Heiti SC join the Chinese UI faces and the text fallbacks. Tested with a folder laid out the same way; not yet run on a Mac |
| 2026-10-17 | minor | String counts re-measured from the catalogs: 1,680 UI keys, 561 command labels and 31 menu wordings (2,272 entries); Spanish complete, the other drafts at 95.3–99.2% (strings added since 2026-10-12 show English), es-419 101 entries. Indonesian has a draft (98.8%; it was listed as none); Russian (98.8%, reviewed), Swedish (99.6%, command labels and menu wordings from #599), Turkish (98.7%) and Czech (98.8%) listed with counts; the language picker's list updated; a paragraph repeated by a merge removed. Grade and hours unchanged (Indonesian's draft is offset by the drafts' new gaps) |
diff --git a/docs/translating.md b/docs/translating.md
index eaa59755..9dfca60c 100644
--- a/docs/translating.md
+++ b/docs/translating.md
@@ -91,13 +91,9 @@ picker leaves Georgian out. A new CJK or other non-Latin language also needs its
three forms. Czech's CLDR `many` applies only to decimals; `trn` takes integer counts.
Polish uses `one` for 1 only, `few` like Russian (2–4, 22–24… except 12–14) and `many` for
the other integers, including 0 and 21 (e.g. `{n} warstwa`, `{n} warstwy`, `{n} warstw`).
-4. To require full coverage, add the code to `COMPLETE` in
- [`crates/ui-egui/src/i18n_tests.rs`](../crates/ui-egui/src/i18n_tests.rs). Every later PR that
- adds a string then has to translate it into each complete language, so only Spanish is there:
- French, German, Brazilian Portuguese, Japanese, Korean, Simplified Chinese, Czech, Indonesian and
- Georgian are registered as drafts, Russian and Turkish are reviewed but not required, and a string added
- later shows English in them until it is translated. To list what a draft lacks,
- add its code to `COMPLETE` locally and run the check.
+4. A string added later shows English in every language until someone translates it; a missing
+ translation never fails a check or a build. `cargo xtask i18n-report` lists what each language
+ lacks (UI strings, command labels, menu wordings), and `cargo xtask ci` prints the same list.
5. Run the check and look at the panels in the app (longer words must fit the right panel):
cargo test -p figcraft-ui-egui i18n
@@ -106,9 +102,9 @@ picker leaves Georgian out. A new CJK or other non-Latin language also needs its
with "…" and show it in full on hover; elsewhere, look for clipped or wrapped text.
The check fails on keys the code uses that `en.toml` lacks (it prints the lines to paste), keys no
-code uses, unknown command ids, placeholders that don't match English, and, for complete languages,
-anything untranslated. Machine-drafted catalogs stay marked as drafts until a native speaker has
-reviewed them; a reviewed catalog stays a draft until a maintainer approves it (its `status` says which).
+code uses, unknown command ids and placeholders that don't match English. Machine-drafted catalogs
+stay marked as drafts until a native speaker has reviewed them; a reviewed catalog stays a draft
+until a maintainer approves it (its `status` says which).
## Adding strings in code
@@ -116,11 +112,11 @@ Wrap every string a user sees or a screen reader hears: `tr` for plain text, `tr
placeholders, `trn` for counts, `tr_noop` for literals in `const` tables that are looked up later
with `tr(label)`. The key must be a string literal as the first argument (the check reads the
source). Don't wrap ids, command ids, JSON, log messages, file extensions or document content. Then
-add the key to `en.toml` and to each complete language (Spanish and Russian); the drafts may follow later.
+add the key to `en.toml`; translations may follow later.
Labels from the engine and document crates (tool names, blend modes, easing curves…) are looked up
at display with `tr(x.label())`; they are listed in `dynamic_labels` in `i18n_tests.rs`.
The importers' fixed notes (the string literals passed to `warn` in `crates/format/src/fig` and
`crates/format/src/rest`) are keys too: the import report shows them in the UI language, so a new
-note goes into `en.toml` and each complete language. Notes built with `format!` show in English.
+note goes into `en.toml`. Notes built with `format!` show in English.
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 81d48471..6c09c921 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -1,7 +1,9 @@
//! Project tasks: `cargo xtask `.
//!
-//! - `ci` fmt check, clippy -D warnings, tests, layers, assets, wasm check
+//! - `ci` fmt check, clippy -D warnings, tests, the translation report, layers, assets, wasm check
//! - `test` the workspace tests (nextest when installed) and doctests
+//! - `i18n-report` the UI strings, command labels and menu wordings each language lacks (never fails
+//! on them: a missing translation reads English)
//! - `layers` crate dependency layering check
//! - `assets` every file under assets/ and docs/ has a row in ATTRIBUTION.md
//! - `parity` menu-catalog coverage → docs/parity-checklist.md
@@ -38,6 +40,7 @@ fn main() -> ExitCode {
let ok = match task {
"ci" => ci(),
"test" => test(),
+ "i18n-report" => i18n_report(),
"layers" => layers::check(&root()),
"assets" => assets(),
"parity" => parity(),
@@ -47,7 +50,7 @@ fn main() -> ExitCode {
"plugins" => plugins(),
"bench" => bench(args.get(1).map_or("1000,10000,50000", String::as_str)),
_ => {
- eprintln!("tasks: ci, test, layers, assets, parity, version [set X.Y.Z], icon, wasm, plugins, bench [SIZES]");
+ eprintln!("tasks: ci, test, i18n-report, layers, assets, parity, version [set X.Y.Z], icon, wasm, plugins, bench [SIZES]");
task == "help"
}
};
@@ -58,6 +61,7 @@ fn ci() -> bool {
run(cargo().args(["fmt", "--all", "--check"]))
&& run(cargo().args(["clippy", "--workspace", "--all-targets", "--keep-going", "--", "-D", "warnings"]))
&& test()
+ && i18n_report()
&& layers::check(&root())
&& assets()
&& wasm()
@@ -77,6 +81,12 @@ fn test() -> bool {
units && run(cargo().args(["test", "--workspace", "--doc"]))
}
+/// Prints what each language's catalog lacks, from the test that lists it. `--workspace --lib`
+/// reuses the binaries `test` built.
+fn i18n_report() -> bool {
+ run(cargo().args(["test", "-q", "--workspace", "--lib", "--", "--exact", "i18n::tests::missing_translations_report", "--nocapture"]))
+}
+
fn wasm() -> bool {
run(cargo().args([
"check",
From 17ed21d1285192bc12eb9fe4c07e0fa602d7a4c6 Mon Sep 17 00:00:00 2001
From: BFlat
Date: Sat, 24 Oct 2026 02:56:55 +0700
Subject: [PATCH 21/23] M6: Dev Mode tail: imports in layer trees, compare with
versions, an inspect-only canvas (#538)
Import lines for connected components inside generated layer trees; Compare changes against any saved version; a Dev Mode behaviour suite with an inspect-only canvas (menus, shortcuts, paste and Revert to saved refuse design edits; a drag under way is dropped on entering), Changed in the ready list, statuses only on top-level frames and sections; read-only plugins' panels from the Inspect tab.
---
ROADMAP.md | 4 +-
crates/engine/src/annotations_tests.rs | 2 +-
crates/engine/src/cmd/file.rs | 2 +-
crates/engine/src/cmd/props.rs | 6 +-
crates/engine/src/cmd/section.rs | 28 ++-
crates/engine/src/code_connect.rs | 119 +++++++++-
crates/engine/src/codegen.rs | 2 +-
crates/engine/src/component_codegen.rs | 10 +-
crates/engine/src/devcompare.rs | 51 +++--
crates/engine/src/devfocus_tests.rs | 5 +-
crates/engine/src/devinspect.rs | 31 ++-
crates/engine/src/devinspect_tests.rs | 2 +-
crates/engine/src/devmode_behaviour_tests.rs | 224 +++++++++++++++++++
crates/engine/src/devmode_tail_tests.rs | 163 ++++++++++++++
crates/engine/src/lib.rs | 4 +
crates/engine/src/tools.rs | 63 ++++--
crates/ui-egui/locales/de.toml | 8 +
crates/ui-egui/locales/en.toml | 8 +
crates/ui-egui/locales/es.toml | 8 +
crates/ui-egui/locales/fr.toml | 8 +
crates/ui-egui/locales/ja.toml | 8 +
crates/ui-egui/locales/ko.toml | 8 +
crates/ui-egui/locales/pt-BR.toml | 8 +
crates/ui-egui/locales/zh-Hans.toml | 8 +
crates/ui-egui/src/canvas.rs | 5 +-
crates/ui-egui/src/control.rs | 8 +-
crates/ui-egui/src/dev_compare.rs | 149 +++++++++---
crates/ui-egui/src/dev_mode.rs | 42 ++--
crates/ui-egui/src/devmode_tail_tests.rs | 110 +++++++++
crates/ui-egui/src/lib.rs | 25 ++-
crates/ui-egui/src/menus.rs | 54 ++++-
crates/ui-egui/src/plugin_panel_tests.rs | 2 +-
crates/ui-egui/src/shortcuts.rs | 11 +-
crates/ui-egui/src/toolbar.rs | 16 +-
docs/control-protocol.md | 9 +-
docs/dev-mode-parity.md | 22 +-
docs/gaps.md | 26 ++-
docs/mcp.md | 33 ++-
38 files changed, 1117 insertions(+), 175 deletions(-)
create mode 100644 crates/engine/src/devmode_behaviour_tests.rs
create mode 100644 crates/engine/src/devmode_tail_tests.rs
create mode 100644 crates/ui-egui/src/devmode_tail_tests.rs
diff --git a/ROADMAP.md b/ROADMAP.md
index b3edc4ee..cb45e6af 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -86,7 +86,7 @@ native speakers' reviews of the nine language drafts need people.
| Styles & variables | 95% | 76% | 2–4 | [components-parity](docs/components-parity.md) |
| Prototyping | 92% | 74% | 2–5 | [prototyping-parity](docs/prototyping-parity.md) |
| Import/export | 86% | 58% | 5–10 | [file-format-parity](docs/file-format-parity.md) |
-| Dev Mode / inspect | 96% | 72% | 0–1 | [dev-mode-parity](docs/dev-mode-parity.md) |
+| Dev Mode / inspect | 97% | 76% | 2–4 | [dev-mode-parity](docs/dev-mode-parity.md) |
| Comments, versions, misc | 87% | 63% | 1–3 | [collaboration-parity](docs/collaboration-parity.md) |
| Multiplayer & sharing | 17% | 5% | 42–84 | [collaboration-parity](docs/collaboration-parity.md) |
| Plugins & widgets | 60% | 35% | 8–26 | [plugins](docs/plugins.md) |
@@ -142,6 +142,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
- **2026-10-17** · Control channel while the window is minimised (M8, #720): a minimised or covered window answers every request that acts on the app's state (edits, `ui.inspect`, `ui.pointer`, `ui.key`, `ui.type`, `ui.set`, `app.quit`…) without drawing, and what needs a drawn frame (`ui.screenshot`, `ui.input`, `window.new`) is an error at once; before, those waited up to 60 s and held up every later request on the connection (an attached agent's `inspect_ui` or window screenshot stalled until the window came back). Measured on Windows 11, minimised: requests ~100 ms each (eframe wakes a minimised window at most ten times a second; ~2 ms on screen), a window screenshot fails in ~100 ms instead of 60 s, idle CPU 0. Numbers unchanged.
- **2026-10-17** · Number variables on text content (M3, #629): the Typography section's variable picker also lists number variables for a text layer's content, as the engine already accepted (the text shows the number, e.g. 42.5, and follows the variable). Other text fields keep their own types. Numbers unchanged.
- **2026-10-17** · Frames and sections convert into each other (M1, #719): `object.convertToSection` turns a frame on the page or in a section into a section in place (same box, name, fill and layers, which stay where they are; what only a frame has goes: auto layout, clipping, layout grids, guides, scrolling), and `object.convertToFrame` now also turns a section into a frame that keeps its fill and doesn't clip, so the look stays. Nested frames, instances, main components and sections holding sections are refused with the reason; one undo step each. Both are in the canvas context menu (Convert to section / Convert to frame) and in Spanish. Numbers unchanged.
+- **2026-10-15** · Dev Mode tail (M6, gap 16): generated layer trees start with the import lines of the connected components they call, once each per language; Compare changes takes any saved version as the before; a behaviour suite made the Dev Mode canvas inspect-only (no moving, resizing, drawing or editing; menus and shortcuts refuse design edits with a note), added Changed to the ready list and refused statuses on layers inside frames; read-only plugins show their panels from the Inspect tab. Dev Mode 97% / 76%.
- **2026-10-14** · Corner handles win over the corner-radius handles (M1, #292): a press on the inner half of a corner handle's square picked the radius handle 10 px in, so the drag neither resized nor (dragging outward) rounded anything. Inside the drawn square the corner now resizes both sides (in ratio with Shift or the link); further in the radius handle still answers. Regression test in the transform behaviour suite. Numbers unchanged.
- **2026-10-14** · Home screen recent files as cards (M7): each card shows the picture its file carries on its first page's colour, the file's icon, name and "Edited ... ago"; sort by name, creation or last change either way; a table view; a click selects, a double-click or Enter opens, arrow keys move; Open, Show in folder and Remove from recents on right-click. Numbers unchanged.
- **2026-10-13** · Vector edit mode regions (M4): with the Move tool, the filled area under the pointer is hatched with "/" lines in the selection colour, clipped by the area's own fill rule so holes stay clear; the hatch goes near points (3.5 px) and segments (2 px), and its spacing follows octave folding (8 px at every power-of-two zoom), fixed to the shape. A click selects the area with its points (they move with it but keep the unselected look), Shift adds or removes one, a press on a selected area drags the whole selection as one undo step, and a click on an empty spot clears the areas and stays in edit mode. `vector.edit.select {regions}` and `vector.edit.state` (`regions`, `regionVertices`, `regionHover`); `vector_regions_tests` and `regions_tests`. Numbers unchanged.
@@ -388,6 +389,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
| 2026-10-15 | minor | Drop files anywhere to open them (M7): dragging files over the window shows a "Drop to open" (home) or "Drop to import" (canvas) overlay. On the home screen each supported file opens as a document of its own and other files are turned away with a toast; on the canvas the files import at the drop point. Both wait behind a small card that is on screen before a large file blocks the window. A canvas import stays with the document and page that received the drop even if the tab or page changes meanwhile, and is cancelled with a message if that document or page is gone. Numbers unchanged. |
| 2026-10-15 | minor | M7: system font discovery skips entries observed as non-regular files before opening them, avoiding the reproduced named-pipe stall. Regular-file symlinks remain supported; directory depth, font limits and priorities are unchanged. Numbers unchanged. |
| 2026-10-15 | minor | Canvas retains a bounded margin while panning so newly exposed strips can reuse the previous render. Numbers unchanged. |
+| 2026-10-15 | minor | Dev Mode tail (M6, gap 16): import lines for connected components inside generated layer trees (definitions, slots and swapped-in instances too); `dev.compare {version}` and the compare view's Compare with menu compare with any saved version; behaviour suite (5 tests; 4 failed before the fixes): an inspect-only Dev Mode canvas with menus, shortcuts, nudges, opacity keys and paste refusing design edits, toolbar drawing tools returning to the design, Changed in the ready list (`inspect.readyForDev {status: changed}`), statuses only on sections and top-level frames; read-only plugins' panels from the Inspect tab. Dev Mode 96%/72% → 97%/76%, 0–1 h → 2–4 h (measurements kept on the canvas and a read-only layers panel counted as missing); header totals not recomputed |
| 2026-10-15 | minor | Typography spacing icons scrub with the shared number-field gesture, modifier rates and one Undo step per drag (#373). Units and selected-character targeting are preserved. Numbers unchanged. |
| 2026-10-14 | minor | System theme on first run (M7): preferences without a theme default to System; the first frame reads the OS appearance directly, including when returning from a manual theme. Saved Light/Dark choices stay explicit; unavailable OS appearance falls back to Light. Numbers unchanged. |
| 2026-10-14 | minor | Home screen recent files as cards (M7): each card shows the picture its file carries on its first page's colour, the file's icon, name and "Edited ... ago"; sort by name, creation or last change either way; a table view; a click selects, a double-click or Enter opens, arrow keys move; Open, Show in folder and Remove from recents on right-click. Numbers unchanged. |
diff --git a/crates/engine/src/annotations_tests.rs b/crates/engine/src/annotations_tests.rs
index 7fc7376f..00065049 100644
--- a/crates/engine/src/annotations_tests.rs
+++ b/crates/engine/src/annotations_tests.rs
@@ -171,7 +171,7 @@ fn ready_for_dev_lists_frames_by_status() {
};
let ready = ex(&mut s, "inspect.readyForDev", json!({}));
assert_eq!(names(&ready), vec!["Login", "Onboarding", "Profile"], "every page, page and layer order");
- assert_eq!(ready["items"][0], json!({"id": a.0, "name": "Login", "page": page.0, "status": "readyForDev"}));
+ assert_eq!(ready["items"][0], json!({"id": a.0, "name": "Login", "page": page.0, "status": "readyForDev", "changed": false}));
assert_eq!(names(&ex(&mut s, "inspect.readyForDev", json!({"status": "completed"}))), vec!["Signup"]);
assert_eq!(names(&ex(&mut s, "inspect.readyForDev", json!({"status": "any", "page": page}))), vec!["Login", "Signup", "Onboarding"]);
assert!(s.execute("inspect.readyForDev", &json!({"status": "none"})).is_err());
diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs
index 7380711f..60784750 100644
--- a/crates/engine/src/cmd/file.rs
+++ b/crates/engine/src/cmd/file.rs
@@ -366,7 +366,7 @@ fn version_index(cmd: &str, ds: &DocState, p: &Value) -> Result {
if i < ds.versions.len() { Ok(i) } else { Err(bad(cmd, format!("no version at index {i}"))) }
}
-fn read_version(v: &Version) -> Result> {
+pub(crate) fn read_version(v: &Version) -> Result> {
v.document().map_err(|e| EngineError::Other(format!("version “{}” can't be read: {e}", v.name)))
}
diff --git a/crates/engine/src/cmd/props.rs b/crates/engine/src/cmd/props.rs
index f180b53c..3ed0f9b0 100644
--- a/crates/engine/src/cmd/props.rs
+++ b/crates/engine/src/cmd/props.rs
@@ -533,8 +533,12 @@ pub fn apply(cmd: &str, doc: &mut Document, id: NodeId, props: &Map Vec {
spec!(
"dev.compare",
"Compare changes",
- "{id? (default the first selected layer), show? (open the compare view in the app)} → {id, name, changed, snapshot, added, removed, modified, truncated, changes: [{id, name, type, change: added|removed|changed, depth, layers, properties?: [{section, property, before, after, text}]}]} what changed in a ready-for-dev frame or section since it was marked (`snapshot` is false when that isn't known: a file from before snapshots were kept)",
+ "{id? (default the first selected layer), version? (a version id from version.list: compare with that saved version instead; any top-level frame or section), show? (open the compare view in the app)} → {id, name, changed, snapshot, added, removed, modified, truncated, version: {id, name, time} | null, changes: [{id, name, type, change: added|removed|changed, depth, layers, properties?: [{section, property, before, after, text}]}]} what changed in a ready-for-dev frame or section since it was marked, or since the version (`snapshot` is false when that isn't known: a file from before snapshots were kept)",
false,
compare
),
@@ -104,14 +104,30 @@ fn resolve_change(s: &mut Session, p: &Value) -> Result {
fn compare(s: &mut Session, p: &Value) -> Result {
let cmd = "dev.compare";
let id = targets(s, p).first().copied().ok_or_else(|| bad(cmd, "select a frame or section or pass `id`"))?;
- let doc = s.doc()?;
+ let version = match get(p, "version") {
+ None | Some(Value::Null) => None,
+ Some(Value::String(v)) => Some(v.clone()),
+ Some(_) => return Err(bad(cmd, "version: a version id (version.list)")),
+ };
+ let ds = s.ds()?;
+ let doc = &ds.doc;
let n = doc.node(id).ok_or_else(|| bad(cmd, "no such layer"))?;
- if !has_status(doc, id) || n.dev_status != DevStatus::ReadyForDev {
- return Err(bad(cmd, "compare a frame or section marked ready for dev"));
+ if !has_status(doc, id) {
+ return Err(bad(cmd, "compare a top-level frame or a section"));
}
- let v = serde_json::to_value(crate::devcompare::compare(doc, id)).unwrap_or(Value::Null);
+ let (cmp, against) = match &version {
+ Some(v) => {
+ let ver = ds.versions.iter().find(|x| x.id == *v).ok_or_else(|| bad(cmd, format!("no version `{v}`")))?;
+ let before = crate::cmd::file::read_version(ver)?;
+ (crate::devcompare::compare_with(&before, doc, id), json!({"id": ver.id, "name": ver.name, "time": ver.time}))
+ }
+ None if n.dev_status != DevStatus::ReadyForDev => return Err(bad(cmd, "compare a frame or section marked ready for dev, or pass `version`")),
+ None => (crate::devcompare::compare(doc, id), Value::Null),
+ };
+ let mut v = serde_json::to_value(cmp).unwrap_or(Value::Null);
+ v["version"] = against;
if boolean(p, "show") == Some(true) {
- s.request_ui("view.devCompare", json!({"id": id}));
+ s.request_ui("view.devCompare", json!({"id": id, "version": version}));
}
Ok(v)
}
diff --git a/crates/engine/src/code_connect.rs b/crates/engine/src/code_connect.rs
index 46340636..08b3af02 100644
--- a/crates/engine/src/code_connect.rs
+++ b/crates/engine/src/code_connect.rs
@@ -14,9 +14,9 @@ use figcraft_doc::*;
use serde_json::{Value, json};
use crate::cmd::CommandSpec;
-use crate::codegen::CodeLang;
+use crate::codegen::{CodeLang, Ctx};
use crate::component_codegen::{Component, Param, ParamKind, describe, instance_values, js_string, main_of, value_expr};
-use crate::components::variant_set;
+use crate::components::{slots_of, variant_set};
use crate::params::*;
use crate::{EngineError, Result, Session, bad, spec};
@@ -70,14 +70,106 @@ pub fn import_line(link: &CodeLink, lang: CodeLang) -> String {
}
}
-/// Layer `id`'s code with `link`: the import line and the snippet (an instance's values, else the
-/// defaults). `None` when `id` isn't a component, set or instance.
+/// Layer `id`'s code with `link`: the import lines (its own and those of connected components its
+/// instance swaps place) and the snippet (an instance's values, else the defaults). `None` when
+/// `id` isn't a component, set or instance.
pub fn connected_code(doc: &Document, id: NodeId, lang: CodeLang, link: &CodeLink) -> Option {
let c = main_of(doc, id).and_then(|m| describe(doc, m))?;
let values = instance_values(doc, id, &c).unwrap_or_else(|| c.params.iter().map(|p| (p.prop.clone(), p.default.clone())).collect());
- let snippet = render(doc, &c, &values, link, lang, "");
- let import = import_line(link, lang);
- Some(if import.is_empty() { snippet } else { format!("{import}\n\n{snippet}") })
+ let mut imports = Vec::new();
+ snippet_imports(doc, &c, &values, link, lang, &mut imports);
+ Some(with_imports(&imports, render(doc, &c, &values, link, lang, "")))
+}
+
+/// `code` with `imports` at the top: joined to the import block it starts with, else apart.
+pub fn with_imports(imports: &[String], code: String) -> String {
+ match imports.join("\n") {
+ i if i.is_empty() => code,
+ i if code.starts_with("import ") || code.starts_with("use ") => format!("{i}\n{code}"),
+ i => format!("{i}\n\n{code}"),
+ }
+}
+
+/// Adds `line` to `out` unless it's empty or already there.
+fn add(out: &mut Vec, line: String) {
+ if !line.is_empty() && !out.contains(&line) {
+ out.push(line);
+ }
+}
+
+/// The import lines a connected snippet needs: its own and those of the connected components its
+/// instance swaps place (the ones its template shows).
+fn snippet_imports(doc: &Document, c: &Component, values: &[(String, Value)], link: &CodeLink, lang: CodeLang, out: &mut Vec) {
+ add(out, import_line(link, lang));
+ for piece in pieces(&link.template) {
+ if let Piece::Value { name, .. } = piece
+ && let Some((p, v)) = find(c, values, name)
+ && p.kind == ParamKind::InstanceSwap
+ && let Some(l) = id_of(v).and_then(|i| self::link(doc, i, lang))
+ {
+ add(out, import_line(l, lang));
+ }
+ }
+}
+
+/// The import lines of the connected components the generated code of layer `id` calls
+/// (instances in its tree, in a component's definition and in the slots an instance fills), once
+/// each in tree order. A connected `id` shows its snippet ([`connected_code`]) instead.
+pub fn tree_imports(doc: &Document, id: NodeId, lang: CodeLang) -> Vec {
+ let mut out = Vec::new();
+ let Some(n) = doc.node(id) else { return out };
+ let c = main_of(doc, id).and_then(|m| describe(doc, m));
+ match (&n.kind, &c) {
+ // Its call (the slots it fills), then its component's definition.
+ (NodeKind::Instance { .. }, Some(c)) => {
+ call_imports(doc, id, lang, 0, &mut out);
+ tree(&Ctx { doc, root: c.comp, comp: Some(c), base: 0 }, c.comp, lang, 0, &mut out);
+ }
+ (NodeKind::Component { .. } | NodeKind::ComponentSet { .. }, Some(c)) => {
+ tree(&Ctx { doc, root: c.comp, comp: Some(c), base: 0 }, c.comp, lang, 0, &mut out)
+ }
+ _ => tree(&Ctx::new(doc, id), id, lang, 0, &mut out),
+ }
+ out
+}
+
+/// Imports under layer `id` as the code walk sees it: its visible children, instances as calls
+/// (one an instance swap parameter places is that parameter). shortcut: the depth cap counts from
+/// the tree's root, not from each slot's; align them if a deep slot tree shows a stray import.
+fn tree(ctx: &Ctx, id: NodeId, lang: CodeLang, depth: usize, out: &mut Vec) {
+ let Some(n) = ctx.doc.node(id) else { return };
+ if ctx.too_deep(depth) {
+ return;
+ }
+ for k in ctx.kids(n) {
+ let Some(kn) = ctx.doc.node(k) else { continue };
+ let call = matches!(kn.kind, NodeKind::Instance { .. }) && main_of(ctx.doc, k).is_some();
+ match (call, ctx.param(kn, "mainComponent")) {
+ (true, Some(_)) => {}
+ (true, None) => call_imports(ctx.doc, k, lang, depth + 1, out),
+ (false, _) => tree(ctx, k, lang, depth + 1, out),
+ }
+ }
+}
+
+/// The imports instance `id` placed as a call brings: a connected one's snippet's, else those of
+/// the content it puts in its slots.
+fn call_imports(doc: &Document, id: NodeId, lang: CodeLang, depth: usize, out: &mut Vec) {
+ let Some(c) = main_of(doc, id).and_then(|m| describe(doc, m)) else { return };
+ let Some(values) = instance_values(doc, id, &c) else { return };
+ if let Some(l) = link(doc, id, lang) {
+ return snippet_imports(doc, &c, &values, l, lang, out);
+ }
+ let slots = slots_of(doc, id);
+ for (p, (_, v)) in c.params.iter().zip(&values) {
+ if p.kind == ParamKind::Slot
+ && v.as_bool() == Some(true)
+ && let Some((slot, _)) = slots.iter().find(|(_, name)| *name == p.prop)
+ {
+ // The same depth base as the slot's generated content, so its connected children count.
+ tree(&Ctx { doc, root: *slot, comp: None, base: depth }, *slot, lang, depth + 1, out);
+ }
+ }
}
// ------------------------------------------------------------------ templates
@@ -180,14 +272,17 @@ fn expr(doc: &Document, c: &Component, p: &Param, v: &Value, lang: CodeLang) ->
}
}
+/// Template `t` as pieces. One that doesn't parse, or that skipped `check` (a hand-edited file)
+/// and is far too long, stays as written: parsing rescans after each literal brace.
+fn pieces(t: &str) -> Vec> {
+ let checkable = t.len() <= MAX_TEMPLATE * 4;
+ checkable.then(|| parse(t).ok()).flatten().unwrap_or_else(|| vec![Piece::Text(t)])
+}
+
/// `link`'s template with `values` (one per parameter of `c`), every line prefixed by `pad`.
pub(crate) fn render(doc: &Document, c: &Component, values: &[(String, Value)], link: &CodeLink, lang: CodeLang, pad: &str) -> String {
- // A template that skipped `check` (a hand-edited file) and is far too long stays as written:
- // parsing rescans after each literal brace.
- let checkable = link.template.len() <= MAX_TEMPLATE * 4;
- let pieces = checkable.then(|| parse(&link.template).ok()).flatten().unwrap_or_else(|| vec![Piece::Text(&link.template)]);
let mut out = String::new();
- for piece in pieces {
+ for piece in pieces(&link.template) {
match piece {
Piece::Text(t) => out.push_str(t),
Piece::Value { name, inner } => match find(c, values, name) {
diff --git a/crates/engine/src/codegen.rs b/crates/engine/src/codegen.rs
index 0871f886..7ed81b30 100644
--- a/crates/engine/src/codegen.rs
+++ b/crates/engine/src/codegen.rs
@@ -231,7 +231,7 @@ impl<'a> Ctx<'a> {
.collect()
}
- fn too_deep(&self, depth: usize) -> bool {
+ pub(crate) fn too_deep(&self, depth: usize) -> bool {
depth > self.base + MAX_DEPTH
}
diff --git a/crates/engine/src/component_codegen.rs b/crates/engine/src/component_codegen.rs
index 1416b15f..a8217be1 100644
--- a/crates/engine/src/component_codegen.rs
+++ b/crates/engine/src/component_codegen.rs
@@ -109,14 +109,14 @@ pub fn specs() -> Vec {
/// Code for any layer in React, Leptos, SwiftUI or Compose: an instance's call and its component's
/// definition, a component's (or set's) definition, or the layer tree (React and Leptos wrap it
-/// in a function component).
+/// in a function component), with the imports of the connected components it calls at the top.
pub fn code(doc: &Document, id: NodeId, lang: CodeLang) -> String {
let Some(n) = doc.node(id) else { return String::new() };
if let Some(code) = crate::code_connect::link(doc, id, lang).and_then(|l| crate::code_connect::connected_code(doc, id, lang, l)) {
return code;
}
let comp = main_of(doc, id).and_then(|m| describe(doc, m));
- match (&n.kind, comp) {
+ let code = match (&n.kind, comp) {
(NodeKind::Instance { .. }, Some(c)) => format!("{}\n{}", usage(doc, id, lang, 0).unwrap_or_default(), definition(doc, &c, lang)),
(NodeKind::Component { .. } | NodeKind::ComponentSet { .. }, Some(c)) => definition(doc, &c, lang),
_ => match lang {
@@ -135,7 +135,8 @@ pub fn code(doc: &Document, id: NodeId, lang: CodeLang) -> String {
out
}
},
- }
+ };
+ crate::code_connect::with_imports(&crate::code_connect::tree_imports(doc, id, lang), code)
}
fn is_component(doc: &Document, id: NodeId) -> bool {
@@ -521,8 +522,7 @@ pub fn usage(doc: &Document, id: NodeId, lang: CodeLang, depth: usize) -> Option
let c = main_of(doc, id).and_then(|m| describe(doc, m))?;
let values = instance_values(doc, id, &c)?;
let pad = if lang == CodeLang::React { " ".repeat(depth) } else { indent(depth) };
- // A connected component: its real snippet. shortcut: inside a layer tree it brings no import
- // line; collect them at the top of the tree's code when people ask for it.
+ // A connected component: its real snippet (its import is at the top of the code: `code`).
if let Some(link) = crate::code_connect::link(doc, id, lang) {
return Some(crate::code_connect::render(doc, &c, &values, link, lang, &pad));
}
diff --git a/crates/engine/src/devcompare.rs b/crates/engine/src/devcompare.rs
index 58cf9aa8..ef40a2fb 100644
--- a/crates/engine/src/devcompare.rs
+++ b/crates/engine/src/devcompare.rs
@@ -1,6 +1,7 @@
//! Dev Mode "Compare changes": what changed in a ready-for-dev frame or section since it was
-//! marked. The document keeps a snapshot of the layer from just before its first change
-//! ([`figcraft_doc::handoff`]); this compares it with the layer as it is now, layer by layer
+//! marked, or in any frame or section since a saved version. The document keeps a snapshot of a
+//! ready-for-dev layer from just before its first change ([`figcraft_doc::handoff`]); this compares
+//! it (or the layer in the version) with the layer as it is now, layer by layer
//! (matched by id): layers added and removed, and for the others their properties formatted the
//! way Inspect shows them (`width 120 → 136`, `fill #FF0000 → #E03030`).
@@ -93,20 +94,25 @@ pub struct Comparison {
pub truncated: bool,
}
-/// The changes to layer `id` since it was marked ready for dev (empty when it hasn't changed).
-pub fn compare(doc: &Document, id: NodeId) -> Comparison {
- let n = doc.node(id);
- let mut out = Comparison {
+/// Nothing compared yet for layer `id` of `doc` (`snapshot` false: the before isn't known).
+pub fn empty(doc: &Document, id: NodeId) -> Comparison {
+ Comparison {
id,
- name: n.map(|n| n.name.clone()).unwrap_or_default(),
- changed: n.is_some_and(|n| n.dev_status == DevStatus::ReadyForDev && n.dev_changed),
+ name: doc.node(id).map(|n| n.name.clone()).unwrap_or_default(),
+ changed: false,
snapshot: false,
changes: Vec::new(),
added: 0,
removed: 0,
modified: 0,
truncated: false,
- };
+ }
+}
+
+/// The changes to layer `id` since it was marked ready for dev (empty when it hasn't changed).
+pub fn compare(doc: &Document, id: NodeId) -> Comparison {
+ let mut out = empty(doc, id);
+ out.changed = doc.node(id).is_some_and(|n| n.dev_status == DevStatus::ReadyForDev && n.dev_changed);
if !out.changed {
return out;
}
@@ -117,6 +123,21 @@ pub fn compare(doc: &Document, id: NodeId) -> Comparison {
out
}
+/// The changes to layer `id` of `now` since `before` (a saved version of the same file: layers
+/// match by id). A layer the version doesn't have was added as a whole.
+pub fn compare_with(before: &Document, now: &Document, id: NodeId) -> Comparison {
+ let mut out = empty(now, id);
+ out.snapshot = true;
+ let mut w = Walk { before, now, now_ids: bounded_set(now, id), before_ids: bounded_set(before, id), out: &mut out };
+ if before.contains(id) {
+ w.layer(id, 0);
+ } else {
+ w.whole(now, id, 0, ChangeKind::Added);
+ }
+ out.changed = !out.changes.is_empty();
+ out
+}
+
/// The before and after documents of layer `id` (the snapshot's copy and the document), for
/// rendering the two side by side.
pub fn before_doc(doc: &Document, id: NodeId) -> Option {
@@ -127,17 +148,7 @@ pub fn before_doc(doc: &Document, id: NodeId) -> Option {
/// Every layer that changed between two versions of a whole document, page by page (pages added
/// or removed as a whole), for reviewing a branch.
pub fn compare_docs(before: &Document, now: &Document) -> Comparison {
- let mut out = Comparison {
- id: NodeId(0),
- name: now.name.clone(),
- changed: false,
- snapshot: true,
- changes: Vec::new(),
- added: 0,
- removed: 0,
- modified: 0,
- truncated: false,
- };
+ let mut out = Comparison { name: now.name.clone(), snapshot: true, ..empty(now, NodeId(0)) };
let mut w = Walk { before, now, now_ids: now.ids().collect(), before_ids: before.ids().collect(), out: &mut out };
for p in &now.pages {
if before.contains(*p) {
diff --git a/crates/engine/src/devfocus_tests.rs b/crates/engine/src/devfocus_tests.rs
index 1607ce56..0801746d 100644
--- a/crates/engine/src/devfocus_tests.rs
+++ b/crates/engine/src/devfocus_tests.rs
@@ -99,8 +99,9 @@ fn nested_frames_stay_out_of_the_ready_list_and_its_navigation() {
let mut s = Session::new();
let screen = frame(&mut s, 0.0, "Screen");
let card = idv(&ex(&mut s, "frame.create", json!({"parent": screen, "width": 100, "height": 50, "name": "Card"})));
- // A status a nested frame already stores (an older file, or set through node.set) is ignored.
- ex(&mut s, "node.set", json!({"id": card, "props": {"devStatus": "readyForDev"}}));
+ // node.set refuses a status on a nested frame, and one an older file already stores is ignored.
+ assert!(s.execute("node.set", &json!({"id": card, "props": {"devStatus": "readyForDev"}})).is_err());
+ s.doc_mut().unwrap().node_mut(card).unwrap().dev_status = DevStatus::ReadyForDev;
assert_eq!(ex(&mut s, "inspect.readyForDev", json!({"status": "any"}))["items"], json!([]));
assert!(s.execute("dev.focus", &json!({"direction": "next"})).is_err(), "nothing is ready");
ex(&mut s, "node.set", json!({"id": screen, "props": {"devStatus": "readyForDev"}}));
diff --git a/crates/engine/src/devinspect.rs b/crates/engine/src/devinspect.rs
index fe400989..16f4bbdc 100644
--- a/crates/engine/src/devinspect.rs
+++ b/crates/engine/src/devinspect.rs
@@ -214,6 +214,21 @@ pub struct DevItem {
pub name: String,
pub page: NodeId,
pub status: DevStatus,
+ /// Ready for dev and changed since it was marked.
+ pub changed: bool,
+}
+
+/// Whether Dev Mode runs command `id` from the menus and shortcuts: commands that don't edit the
+/// document, and Dev Mode's own edits (annotations, statuses, dev resources, code connections,
+/// comments). Choosing a tool other than moving around and commenting is refused too, and so is
+/// Revert to saved, which isn't an undo step but throws the design's unsaved edits away.
+pub fn dev_mode_allows(id: &str) -> bool {
+ const OWN: [&str; 5] = ["annotation.", "dev.", "devResource.", "codeConnect.", "comment."];
+ match id.strip_prefix("tool.") {
+ Some(t) => matches!(t, "move" | "hand" | "comment"),
+ None if id == "file.revert" => false,
+ None => OWN.iter().any(|p| id.starts_with(p)) || crate::cmd::find_command(id).is_none_or(|c| !c.history),
+ }
}
/// Most items listed.
@@ -244,7 +259,8 @@ pub fn dev_items(doc: &Document, status: Option, page: Option
}
let Some(n) = doc.node(id) else { continue };
if !n.dev_status.is_none() && status.is_none_or(|s| s == n.dev_status) && has_status(doc, id) {
- out.push(DevItem { id, name: n.name.clone(), page: pg, status: n.dev_status });
+ let changed = n.dev_status == DevStatus::ReadyForDev && n.dev_changed;
+ out.push(DevItem { id, name: n.name.clone(), page: pg, status: n.dev_status, changed });
}
stack.extend(n.children.iter().rev().copied());
}
@@ -257,18 +273,21 @@ pub fn specs() -> Vec {
spec!(
"inspect.readyForDev",
"Ready for dev",
- "{status?: readyForDev|completed|any (default readyForDev), page? (page id; default every page)} → {items: [{id, name, page, status}]} frames and sections by handoff status (set it with `node.set {devStatus}`)",
+ "{status?: readyForDev|changed|completed|any (default readyForDev; changed: ready for dev and changed since marked), page? (page id; default every page)} → {items: [{id, name, page, status, changed}]} frames and sections by handoff status (set it with `node.set {devStatus}`)",
false,
|s, p| {
let cmd = "inspect.readyForDev";
- let status = match string(p, "status").as_deref() {
+ let wanted = string(p, "status");
+ let changed_only = wanted.as_deref().is_some_and(|v| v.eq_ignore_ascii_case("changed"));
+ let status = match wanted.as_deref() {
None => Some(DevStatus::ReadyForDev),
+ _ if changed_only => Some(DevStatus::ReadyForDev),
Some(v) if v.eq_ignore_ascii_case("any") || v.eq_ignore_ascii_case("all") => None,
Some(v) => Some(
DevStatus::ALL
.into_iter()
.find(|d| !d.is_none() && d.id().eq_ignore_ascii_case(v))
- .ok_or_else(|| crate::bad(cmd, "status: readyForDev|completed|any"))?,
+ .ok_or_else(|| crate::bad(cmd, "status: readyForDev|changed|completed|any"))?,
),
};
let doc = s.doc()?;
@@ -276,7 +295,9 @@ pub fn specs() -> Vec {
Some(v) => Some(id_of(v).filter(|pg| doc.pages.contains(pg)).ok_or_else(|| crate::bad(cmd, "page: a page id"))?),
None => None,
};
- Ok(json!({"items": serde_json::to_value(dev_items(doc, status, page)).unwrap_or(Value::Null)}))
+ let mut items = dev_items(doc, status, page);
+ items.retain(|i| i.changed || !changed_only);
+ Ok(json!({"items": serde_json::to_value(items).unwrap_or(Value::Null)}))
}
),
spec!(
diff --git a/crates/engine/src/devinspect_tests.rs b/crates/engine/src/devinspect_tests.rs
index be25e02c..5ee590cc 100644
--- a/crates/engine/src/devinspect_tests.rs
+++ b/crates/engine/src/devinspect_tests.rs
@@ -79,7 +79,7 @@ fn redlines_measure_on_hover_without_alt() {
s.tool.overlay.guides.len()
};
assert_eq!(hover(&mut s), 0, "plain hover doesn't measure");
- s.tool.redlines = true;
+ s.tool.dev_mode = true;
assert!(hover(&mut s) > 0, "Inspect measures on hover");
}
diff --git a/crates/engine/src/devmode_behaviour_tests.rs b/crates/engine/src/devmode_behaviour_tests.rs
new file mode 100644
index 00000000..3d85fdb1
--- /dev/null
+++ b/crates/engine/src/devmode_behaviour_tests.rs
@@ -0,0 +1,224 @@
+//! Dev Mode behaviour suite, written from the public documentation of handoff tools (in our own
+//! words): the canvas inspects and never edits, what the menus and shortcuts may run there, the
+//! list of what's ready for development, statuses (ready, changed, completed) and the focus view.
+
+use crate::Session;
+use crate::components::tests::{ex, idv};
+use crate::devinspect::dev_mode_allows;
+use crate::tools::{PointerEvent, PointerKind, ToolId};
+use figcraft_doc::{DevStatus, NodeId};
+use serde_json::{Value, json};
+
+fn ev(kind: PointerKind, x: f64, y: f64) -> PointerEvent {
+ PointerEvent::at(kind, x, y, 1.0)
+}
+
+fn drag(s: &mut Session, from: (f64, f64), to: (f64, f64)) {
+ s.pointer(&ev(PointerKind::Down, from.0, from.1)).unwrap();
+ for k in 1..=4 {
+ let t = f64::from(k) / 4.0;
+ s.pointer(&ev(PointerKind::Move, from.0 + (to.0 - from.0) * t, from.1 + (to.1 - from.1) * t)).unwrap();
+ }
+ s.pointer(&ev(PointerKind::Up, to.0, to.1)).unwrap();
+}
+
+fn frame(s: &mut Session, x: f64, name: &str) -> NodeId {
+ idv(&ex(s, "frame.create", json!({"x": x, "y": 0, "width": 200, "height": 200, "name": name})))
+}
+
+fn rect(s: &mut Session, parent: NodeId, x: f64) -> NodeId {
+ idv(&ex(s, "shape.rectangle", json!({"x": x, "y": 20, "width": 40, "height": 40, "parent": parent})))
+}
+
+fn names(v: &Value) -> Vec {
+ v["items"].as_array().map(|a| a.iter().filter_map(|i| i["name"].as_str().map(String::from)).collect()).unwrap_or_default()
+}
+
+fn status(s: &mut Session, ids: &[NodeId], st: &str) {
+ ex(s, "node.set", json!({"ids": ids, "props": {"devStatus": st}}));
+}
+
+#[test]
+fn the_dev_mode_canvas_selects_and_pans_but_never_edits() {
+ let mut s = Session::new();
+ let f = frame(&mut s, 0.0, "Screen");
+ let r = rect(&mut s, f, 20.0);
+ let t = idv(&ex(&mut s, "text.create", json!({"text": "Hello", "x": 100, "y": 120, "parent": f})));
+ s.tool.dev_mode = true;
+ let before = s.doc().unwrap().clone();
+ let steps = s.undo_labels(100).len();
+ // A press selects; dragging it moves nothing.
+ drag(&mut s, (40.0, 40.0), (140.0, 90.0));
+ assert_eq!(s.selection(), vec![r]);
+ // Nor do its resize handles.
+ drag(&mut s, (60.0, 60.0), (120.0, 120.0));
+ // Drawing tools only select there.
+ for tool in [ToolId::Rectangle, ToolId::Frame, ToolId::Text, ToolId::Pen, ToolId::Pencil, ToolId::Scale] {
+ s.set_tool(tool);
+ drag(&mut s, (300.0, 300.0), (360.0, 360.0));
+ }
+ s.set_tool(ToolId::Move);
+ // A double-click on text doesn't start typing; on a frame's layer it selects into it.
+ ex(&mut s, "select.set", json!({"ids": [t]}));
+ s.pointer(&ev(PointerKind::DoubleClick, 110.0, 128.0)).unwrap();
+ assert!(s.ds().unwrap().text_edit.is_none(), "no text editing");
+ ex(&mut s, "select.set", json!({"ids": [r]}));
+ s.pointer(&ev(PointerKind::DoubleClick, 40.0, 40.0)).unwrap();
+ assert!(s.ds().unwrap().vector_edit.is_none(), "no vector editing");
+ assert!(*s.doc().unwrap() == before, "the design is untouched");
+ assert_eq!(s.undo_labels(100).len(), steps, "nothing to undo");
+ // Keys that edit with a tool (a selected guide's Delete) go to the commands instead.
+ assert!(!s.tool_key("Delete", false, false, false).unwrap());
+ // The hand still pans; comments still start.
+ s.set_tool(ToolId::Hand);
+ let cx = s.ds().unwrap().view.cx;
+ s.pointer(&ev(PointerKind::Down, 500.0, 500.0)).unwrap();
+ s.pointer(&PointerEvent { sx: 550.0, ..ev(PointerKind::Move, 500.0, 500.0) }).unwrap();
+ s.pointer(&ev(PointerKind::Up, 500.0, 500.0)).unwrap();
+ assert_ne!(s.ds().unwrap().view.cx, cx, "panned");
+ s.set_tool(ToolId::Comment);
+ s.pointer(&ev(PointerKind::Down, 500.0, 500.0)).unwrap();
+ assert!(s.ui_requests.iter().any(|u| u.kind == "comment.new"));
+ // Back in the design: the same drag moves.
+ s.tool.dev_mode = false;
+ s.set_tool(ToolId::Move);
+ drag(&mut s, (40.0, 40.0), (140.0, 90.0));
+ assert!(s.doc().unwrap().node(r).is_some_and(|n| n.transform.as_coeffs()[4] > 100.0), "moved");
+}
+
+#[test]
+fn dev_mode_runs_its_own_edits_and_refuses_design_edits_from_menus_and_shortcuts() {
+ for id in [
+ "annotation.add",
+ "annotation.edit",
+ "dev.resolveChange",
+ "dev.focus",
+ "devResource.add",
+ "codeConnect.set",
+ "comment.add",
+ "edit.undo",
+ "edit.redo",
+ "edit.copy",
+ "edit.copyAsCss",
+ "select.all",
+ "view.zoomIn",
+ "view.devMode",
+ "file.export",
+ "file.save",
+ "tool.move",
+ "tool.hand",
+ "tool.comment",
+ "inspect.code",
+ ] {
+ assert!(dev_mode_allows(id), "{id} runs in Dev Mode");
+ }
+ for id in [
+ "edit.delete",
+ "edit.paste",
+ "edit.cut",
+ "edit.duplicate",
+ "transform.nudge",
+ "object.group",
+ "tool.rectangle",
+ "tool.text",
+ "tool.place",
+ "file.import",
+ "file.revert",
+ ] {
+ assert!(!dev_mode_allows(id), "{id} edits the design");
+ }
+}
+
+#[test]
+fn the_ready_list_shows_frames_and_sections_with_a_status_across_pages() {
+ let mut s = Session::new();
+ let a = frame(&mut s, 0.0, "Login");
+ let b = frame(&mut s, 300.0, "Signup");
+ let nested = idv(&ex(&mut s, "frame.create", json!({"x": 10, "y": 10, "width": 50, "height": 50, "parent": a, "name": "Card"})));
+ status(&mut s, &[a], "readyForDev");
+ status(&mut s, &[b], "completed");
+ // A layer inside a frame takes no status of its own (its frame's covers it).
+ assert!(s.execute("node.set", &json!({"id": nested, "props": {"devStatus": "readyForDev"}})).is_err());
+ assert!(s.execute("node.set", &json!({"ids": [a, nested], "props": {"devStatus": "completed"}})).is_err(), "all or nothing");
+ assert_eq!(s.doc().unwrap().node(a).map(|n| n.dev_status), Some(DevStatus::ReadyForDev));
+ // Clearing one is always fine.
+ ex(&mut s, "node.set", json!({"id": nested, "props": {"devStatus": null}}));
+ let pg2 = idv(&ex(&mut s, "page.add", json!({"name": "Settings"})));
+ ex(&mut s, "page.select", json!({"id": pg2}));
+ let c = frame(&mut s, 0.0, "Profile");
+ status(&mut s, &[c], "readyForDev");
+ assert_eq!(names(&ex(&mut s, "inspect.readyForDev", json!({}))), vec!["Login", "Profile"]);
+ assert_eq!(names(&ex(&mut s, "inspect.readyForDev", json!({"status": "completed"}))), vec!["Signup"]);
+ assert_eq!(names(&ex(&mut s, "inspect.readyForDev", json!({"status": "any"}))), vec!["Login", "Signup", "Profile"]);
+ // Statuses are undoable.
+ s.undo().unwrap();
+ assert_eq!(names(&ex(&mut s, "inspect.readyForDev", json!({}))), vec!["Login"]);
+}
+
+#[test]
+fn ready_frames_edited_after_marking_show_as_changed_until_resolved_or_completed() {
+ let mut s = Session::new();
+ let a = frame(&mut s, 0.0, "Login");
+ let b = frame(&mut s, 300.0, "Signup");
+ let r = rect(&mut s, a, 20.0);
+ let outside = idv(&ex(&mut s, "shape.rectangle", json!({"x": 900, "y": 0, "width": 10, "height": 10})));
+ status(&mut s, &[a, b], "readyForDev");
+ let changed = |s: &mut Session| names(&ex(s, "inspect.readyForDev", json!({"status": "changed"})));
+ assert!(changed(&mut s).is_empty(), "marking isn't a change");
+ // Edits elsewhere don't count; an edit inside does.
+ ex(&mut s, "node.set", json!({"id": outside, "props": {"width": 30}}));
+ assert!(changed(&mut s).is_empty());
+ ex(&mut s, "node.set", json!({"id": r, "props": {"width": 60}}));
+ assert_eq!(changed(&mut s), vec!["Login"]);
+ let items = ex(&mut s, "inspect.readyForDev", json!({}));
+ assert_eq!(items["items"][0]["changed"], true, "the list says which changed: {items}");
+ assert_eq!(items["items"][1]["changed"], false);
+ // Still ready for dev (the status itself stays).
+ assert_eq!(names(&items), vec!["Login", "Signup"]);
+ // Resolving goes back to plain ready; so does marking it again, or completing it.
+ ex(&mut s, "dev.resolveChange", json!({"ids": [a]}));
+ assert!(changed(&mut s).is_empty());
+ ex(&mut s, "node.set", json!({"id": r, "props": {"width": 70}}));
+ status(&mut s, &[a], "completed");
+ assert!(changed(&mut s).is_empty());
+ let all = ex(&mut s, "inspect.readyForDev", json!({"status": "any"}));
+ assert_eq!(all["items"][0]["changed"], false, "a completed frame isn't changed: {all}");
+ // Completed frames don't turn changed when edited.
+ ex(&mut s, "node.set", json!({"id": r, "props": {"width": 80}}));
+ assert!(!s.doc().unwrap().node(a).unwrap().dev_changed);
+}
+
+#[test]
+fn the_focus_view_steps_through_what_is_ready_and_skips_completed_frames() {
+ let mut s = Session::new();
+ let a = frame(&mut s, 0.0, "Login");
+ let b = frame(&mut s, 300.0, "Signup");
+ let c = frame(&mut s, 600.0, "Profile");
+ let r = rect(&mut s, c, 620.0);
+ status(&mut s, &[a, c], "readyForDev");
+ status(&mut s, &[b], "completed");
+ ex(&mut s, "node.set", json!({"id": r, "props": {"width": 60}}));
+ let step = |s: &mut Session, d: &str| ex(s, "dev.focus", json!({"direction": d}));
+ let v = ex(&mut s, "dev.focus", json!({"id": a}));
+ assert_eq!((v["index"].clone(), v["count"].clone()), (json!(0), json!(2)));
+ assert_eq!(step(&mut s, "next")["id"], json!(c), "completed ones are skipped, changed ones aren't");
+ assert_eq!(step(&mut s, "previous")["id"], json!(a));
+ // Any top-level frame opens in it, even one that's completed.
+ assert_eq!(ex(&mut s, "dev.focus", json!({"id": b}))["index"], json!(null));
+}
+
+#[test]
+fn a_drag_under_way_when_dev_mode_starts_moves_nothing() {
+ let mut s = Session::new();
+ let f = frame(&mut s, 0.0, "Screen");
+ let r = rect(&mut s, f, 20.0);
+ ex(&mut s, "select.set", json!({"ids": [r]}));
+ let before = s.doc().unwrap().world_bounds(r);
+ s.pointer(&ev(PointerKind::Down, 40.0, 40.0)).unwrap();
+ s.pointer(&ev(PointerKind::Move, 90.0, 40.0)).unwrap();
+ s.drop_gesture().unwrap();
+ s.tool.dev_mode = true;
+ s.pointer(&ev(PointerKind::Move, 120.0, 40.0)).unwrap();
+ s.pointer(&ev(PointerKind::Up, 120.0, 40.0)).unwrap();
+ assert_eq!(s.doc().unwrap().world_bounds(r), before, "the drag was dropped, not committed");
+}
diff --git a/crates/engine/src/devmode_tail_tests.rs b/crates/engine/src/devmode_tail_tests.rs
new file mode 100644
index 00000000..b8f1b019
--- /dev/null
+++ b/crates/engine/src/devmode_tail_tests.rs
@@ -0,0 +1,163 @@
+//! Dev Mode, the tail: import lines for the connected components a layer tree calls.
+
+use crate::Session;
+use crate::components::tests::{ex, idv};
+use figcraft_doc::NodeId;
+use serde_json::json;
+
+fn code(s: &mut Session, id: NodeId, lang: &str) -> String {
+ ex(s, "inspect.code", json!({"id": id, "language": lang}))["code"].as_str().unwrap_or_default().to_string()
+}
+
+/// A component named `name` (an empty frame) at `x`.
+fn component(s: &mut Session, name: &str, x: f64) -> NodeId {
+ let f = idv(&ex(s, "frame.create", json!({"x": x, "y": 1000, "width": 40, "height": 20, "name": name})));
+ idv(&ex(s, "component.create", json!({"ids": [f]})))
+}
+
+fn instance(s: &mut Session, c: NodeId, parent: NodeId) -> NodeId {
+ idv(&ex(s, "instance.create", json!({"component": c, "x": 0, "y": 0, "parent": parent})))
+}
+
+fn frame(s: &mut Session, name: &str, parent: Option) -> NodeId {
+ idv(&ex(s, "frame.create", json!({"x": 0, "y": 0, "width": 400, "height": 300, "name": name, "parent": parent})))
+}
+
+fn count(code: &str, line: &str) -> usize {
+ code.lines().filter(|l| *l == line).count()
+}
+
+#[test]
+fn layer_trees_import_the_connected_components_they_call_once_at_the_top() {
+ let mut s = Session::new();
+ let badge = component(&mut s, "Badge", 0.0);
+ let button = component(&mut s, "Button", 100.0);
+ let toast = component(&mut s, "Toast", 200.0);
+ let divider = component(&mut s, "Divider", 300.0);
+ for (lang, path) in [("react", "@acme/ui"), ("swiftui", "AcmeUI"), ("leptos", "crate::ui"), ("compose", "com.acme.ui.Badge")] {
+ ex(&mut s, "codeConnect.set", json!({"id": badge, "language": lang, "importPath": path}));
+ }
+ ex(&mut s, "codeConnect.set", json!({"id": button, "importPath": "@acme/buttons"}));
+ ex(&mut s, "codeConnect.set", json!({"id": toast, "importPath": "@acme/toast"}));
+ let screen = frame(&mut s, "Screen", None);
+ let row = frame(&mut s, "Row", Some(screen));
+ for (c, parent) in [(badge, screen), (button, screen), (badge, screen), (divider, screen), (badge, row)] {
+ instance(&mut s, c, parent);
+ }
+ let hidden = instance(&mut s, toast, row);
+ ex(&mut s, "node.set", json!({"id": hidden, "props": {"visible": false}}));
+
+ let react = code(&mut s, screen, "react");
+ assert!(react.starts_with("import { Badge } from \"@acme/ui\";\nimport { Button } from \"@acme/buttons\";\nimport \"./"), "{react}");
+ assert_eq!(count(&react, "import { Badge } from \"@acme/ui\";"), 1, "once each: {react}");
+ assert!(!react.contains("@acme/toast"), "hidden layers aren't in the code: {react}");
+ let swift = code(&mut s, screen, "swiftui");
+ assert!(swift.starts_with("import AcmeUI\n\n") && count(&swift, "import AcmeUI") == 1, "per language: {swift}");
+ assert!(!swift.contains("acme/buttons"), "{swift}");
+ let leptos = code(&mut s, screen, "leptos");
+ assert!(leptos.starts_with("use crate::ui::Badge;\nuse leptos::prelude::*;\n"), "joined to the code's own imports: {leptos}");
+ assert!(code(&mut s, screen, "compose").starts_with("import com.acme.ui.Badge\n\n"));
+ assert!(!code(&mut s, screen, "css").contains("import"), "CSS has no imports");
+ // The Inspect panel shows inspect.code's text (the same function).
+ let doc = s.doc().unwrap();
+ assert_eq!(crate::codegen::code_for(doc, screen, crate::codegen::CodeLang::React), react);
+
+ // A connected layer itself: its import and snippet, unchanged.
+ assert_eq!(code(&mut s, badge, "react"), "import { Badge } from \"@acme/ui\";\n\n\n");
+
+ // A component's definition, and an instance of it (its call, then the definition).
+ let card_frame = frame(&mut s, "Card", None);
+ instance(&mut s, badge, card_frame);
+ let card = idv(&ex(&mut s, "component.create", json!({"ids": [card_frame]})));
+ assert!(
+ code(&mut s, card, "react").starts_with("import { Badge } from \"@acme/ui\";\nimport \"./card.css\";"),
+ "{}",
+ code(&mut s, card, "react")
+ );
+ let page = frame(&mut s, "Page", None);
+ let card_i = instance(&mut s, card, page);
+ assert!(code(&mut s, card_i, "react").starts_with("import { Badge } from \"@acme/ui\";\n\n"), "{}", code(&mut s, card_i, "react"));
+ assert!(code(&mut s, page, "react").starts_with("import \"./"), "an unconnected call's insides aren't in the code");
+}
+
+#[test]
+fn slots_and_instance_swaps_bring_their_connected_imports() {
+ let mut s = Session::new();
+ let badge = component(&mut s, "Badge", 0.0);
+ ex(&mut s, "codeConnect.set", json!({"id": badge, "importPath": "@acme/ui"}));
+ // A panel whose slot an instance fills with a badge.
+ let f = frame(&mut s, "Panel", None);
+ let content = frame(&mut s, "Content", Some(f));
+ let panel = idv(&ex(&mut s, "component.create", json!({"ids": [f]})));
+ ex(&mut s, "component.makeSlot", json!({"id": content}));
+ let screen = frame(&mut s, "Screen", None);
+ let p = instance(&mut s, panel, screen);
+ assert!(!code(&mut s, screen, "react").contains("@acme/ui"), "an empty slot");
+ ex(&mut s, "instance.slotInsert", json!({"id": p, "slot": "Content", "component": badge, "replace": true}));
+ assert!(code(&mut s, screen, "react").starts_with("import { Badge } from \"@acme/ui\";\n"), "{}", code(&mut s, screen, "react"));
+ assert!(code(&mut s, p, "react").starts_with("import { Badge } from \"@acme/ui\";\n\n"}));
+ let c = instance(&mut s, chip, screen);
+ ex(&mut s, "instance.setProperties", json!({"ids": [c], "properties": {"Icon": badge}}));
+ assert_eq!(code(&mut s, c, "react"), "import { Chip } from \"@acme/chip\";\nimport { Badge } from \"@acme/ui\";\n\n} />\n");
+ let tree = code(&mut s, screen, "react");
+ assert!(tree.starts_with("import { Badge } from \"@acme/ui\";\nimport { Chip } from \"@acme/chip\";\nimport \"./"), "{tree}");
+ // An unconnected swap target brings nothing; the default (Heart) isn't connected.
+ ex(&mut s, "instance.setProperties", json!({"ids": [c], "properties": {"Icon": heart}}));
+ assert_eq!(code(&mut s, c, "react"), "import { Chip } from \"@acme/chip\";\n\n} />\n");
+}
+
+#[test]
+fn compare_changes_takes_any_saved_version_as_the_before() {
+ let mut s = Session::new();
+ let screen = frame(&mut s, "Screen", None);
+ let button =
+ idv(&ex(&mut s, "shape.rectangle", json!({"x": 20, "y": 20, "width": 120, "height": 40, "parent": screen, "props": {"name": "Button"}})));
+ let old = idv(&ex(&mut s, "shape.ellipse", json!({"x": 200, "y": 20, "width": 20, "height": 20, "parent": screen, "props": {"name": "Dot"}})));
+ let v1 = ex(&mut s, "file.saveVersion", json!({"name": "Kickoff"}))["id"].as_str().unwrap().to_string();
+ ex(&mut s, "node.set", json!({"id": button, "props": {"width": 136}}));
+ ex(&mut s, "edit.delete", json!({"ids": [old]}));
+ let added = idv(&ex(&mut s, "text.create", json!({"text": "Hi", "x": 20, "y": 100, "parent": screen, "props": {"name": "Note"}})));
+ let v2 = ex(&mut s, "file.saveVersion", json!({"name": "Review"}))["id"].as_str().unwrap().to_string();
+ ex(&mut s, "node.set", json!({"id": button, "props": {"width": 150}}));
+
+ // Any frame, ready for dev or not.
+ let c = ex(&mut s, "dev.compare", json!({"id": screen, "version": v1}));
+ assert_eq!(c["version"]["name"], "Kickoff");
+ assert_eq!(
+ (c["changed"].as_bool(), c["added"].as_u64(), c["removed"].as_u64(), c["modified"].as_u64()),
+ (Some(true), Some(1), Some(1), Some(1)),
+ "{c}"
+ );
+ let change =
+ |c: &serde_json::Value, id: NodeId| c["changes"].as_array().unwrap().iter().find(|l| l["id"] == json!(id)).cloned().unwrap_or_default();
+ assert_eq!(change(&c, button)["properties"][0]["text"], "width 120 → 150");
+ assert_eq!(change(&c, old)["change"], "removed");
+ assert_eq!(change(&c, added)["change"], "added");
+ // A later version: only what changed since then.
+ let c = ex(&mut s, "dev.compare", json!({"id": screen, "version": v2}));
+ assert_eq!(c["changes"].as_array().map(Vec::len), Some(1), "{c}");
+ assert_eq!(change(&c, button)["properties"][0]["text"], "width 136 → 150");
+ // A frame the version doesn't have was added as a whole.
+ let fresh = frame(&mut s, "Settings", None);
+ let c = ex(&mut s, "dev.compare", json!({"id": fresh, "version": v1}));
+ assert_eq!(c["changes"][0]["change"], "added");
+ // The snapshot from when it was marked stays the default, for ready-for-dev layers only.
+ assert!(s.execute("dev.compare", &json!({"id": screen})).is_err(), "not ready for dev");
+ ex(&mut s, "node.set", json!({"id": screen, "props": {"devStatus": "readyForDev"}}));
+ let c = ex(&mut s, "dev.compare", json!({"id": screen}));
+ assert_eq!((c["changed"].as_bool(), c["version"].is_null()), (Some(false), true), "{c}");
+ for bad in [json!({"id": screen, "version": "nope"}), json!({"id": screen, "version": 5}), json!({"id": button, "version": v1})] {
+ assert!(s.execute("dev.compare", &bad).is_err(), "{bad}");
+ }
+ // The app opens on the version asked for.
+ ex(&mut s, "dev.compare", json!({"id": screen, "version": v2, "show": true}));
+ assert!(s.ui_requests.iter().any(|u| u.kind == "view.devCompare" && u.data["version"] == json!(v2)));
+}
diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs
index 79e7be0d..0e5b34bb 100644
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@ -1653,6 +1653,10 @@ mod devfocus_tests;
#[cfg(test)]
mod devinspect_tests;
#[cfg(test)]
+mod devmode_behaviour_tests;
+#[cfg(test)]
+mod devmode_tail_tests;
+#[cfg(test)]
mod doc_urls_tests;
#[cfg(test)]
mod double_click_tests;
diff --git a/crates/engine/src/tools.rs b/crates/engine/src/tools.rs
index f0115e1f..dc28d73e 100644
--- a/crates/engine/src/tools.rs
+++ b/crates/engine/src/tools.rs
@@ -447,8 +447,10 @@ pub struct ToolState {
/// removes; Alt merges).
pub shape_builder: Option>,
pub builder_remove: bool,
- /// Show distances from the selection on hover without holding Alt (Dev mode inspection).
- pub redlines: bool,
+ /// Dev Mode: the canvas inspects. Hovering shows distances from the selection without Alt, and
+ /// presses select, pan and comment but never edit the design (no moving, resizing, drawing,
+ /// or editing text or vectors).
+ pub dev_mode: bool,
/// Pen snap targets, kept while hovering (see `vectoredit::point_snap`).
pub(crate) pen_targets: Option,
/// The Scale tool's anchor: column and row (0 start, 1 middle, 2 end) of the point of the
@@ -940,6 +942,21 @@ impl Session {
}
}
+ /// The tool pointer events go to: in Dev Mode every tool but the hand and comments selects.
+ fn acting_tool(&self) -> ToolId {
+ match self.tool.tool {
+ t if self.tool.dev_mode && !matches!(t, ToolId::Hand | ToolId::Comment) => ToolId::Move,
+ t => t,
+ }
+ }
+
+ /// Drop the gesture under way (a drag, a resize, a shape being drawn), restoring the document
+ /// as Escape does; the UI calls it when Dev Mode starts, where nothing may move.
+ pub fn drop_gesture(&mut self) -> Result<()> {
+ self.tool.gesture = Gesture::None;
+ self.cancel_interaction()
+ }
+
/// Feed one pointer event to the current tool.
pub fn pointer(&mut self, ev: &PointerEvent) -> Result<()> {
// A held button sends the same move every frame: running the gesture again would only
@@ -952,11 +969,12 @@ impl Session {
}
self.tool.last_move = Some(ev.clone());
}
- let tool = self.tool.tool;
- if matches!(tool, ToolId::Move | ToolId::Scale) && self.origin_pointer(ev)? {
+ let tool = self.acting_tool();
+ let edits = matches!(tool, ToolId::Move | ToolId::Scale) && !self.tool.dev_mode;
+ if edits && self.origin_pointer(ev)? {
return Ok(());
}
- if matches!(tool, ToolId::Move | ToolId::Scale) && self.ds().is_ok_and(|d| d.vector_edit.is_some()) && self.vector_pointer(ev)? {
+ if edits && self.ds().is_ok_and(|d| d.vector_edit.is_some()) && self.vector_pointer(ev)? {
return Ok(());
}
if tool == ToolId::ShapeBuilder {
@@ -1016,7 +1034,7 @@ impl Session {
}
fn hover(&mut self, ev: &PointerEvent) -> Result<()> {
- let tool = self.tool.tool;
+ let tool = self.acting_tool();
let ds = self.ds()?;
let (doc, sel, page) = (ds.doc.clone(), ds.selection.clone(), ds.page);
let mut cursor = tool.cursor();
@@ -1045,7 +1063,7 @@ impl Session {
if matches!(tool, ToolId::Move | ToolId::Scale) && on_edited {
cursor = Cursor::Text;
} else if matches!(tool, ToolId::Move | ToolId::Scale) && arc_hover.is_none() && shape_hover.is_none() {
- if let Some(h) = handle_at(&doc, &sel, ev.p(), ev.zoom) {
+ if let Some(h) = handle_at(&doc, &sel, ev.p(), ev.zoom).filter(|_| !self.tool.dev_mode) {
cursor = resize_cursor(&doc, &sel, h);
} else {
let leaf = self.hit(&doc, page, ev.p(), ev.tol() * 2.0);
@@ -1054,10 +1072,10 @@ impl Session {
}
hover = label_at(&doc, page, &self.tool.labels, ev.p()).or_else(|| leaf.map(|leaf| select_target(&doc, leaf, &sel, ev.cmd)));
// Alt over a selected layer: a drag from here duplicates it.
- if ev.alt && tool == ToolId::Move && hover.is_some_and(|h| sel.contains(&h) && !locked_in(&doc, h)) {
+ if ev.alt && !self.tool.dev_mode && tool == ToolId::Move && hover.is_some_and(|h| sel.contains(&h) && !locked_in(&doc, h)) {
cursor = Cursor::Copy;
}
- if ev.alt || self.tool.redlines {
+ if ev.alt || self.tool.dev_mode {
use crate::distance::{Hover, guide_at, hover_lines, padding_frame, parent_of};
// Shift+Alt over an auto layout frame: its padding and gaps. Otherwise from the
// selection to a ruler guide, the hovered layer or (over empty canvas) the parent.
@@ -1138,6 +1156,7 @@ impl Session {
textedit::end(self)?;
}
// Handles first: a selected ellipse's arc handles (drawn over the box), then the box's.
+ let edits = !self.tool.dev_mode;
if self.arc_handles_shown()
&& let Some((id, handle)) = crate::arc_handles::hit(&doc, &sel, ev.p(), ev.zoom)
&& let Some(arc) = crate::arc_handles::arc_of(&doc, id)
@@ -1157,7 +1176,7 @@ impl Session {
self.tool.overlay.shape = shape_hint(&doc, id, handle, ev.zoom);
return Ok(());
}
- if let Some(h) = handle_at(&doc, &sel, ev.p(), ev.zoom) {
+ if let Some(h) = handle_at(&doc, &sel, ev.p(), ev.zoom).filter(|_| edits) {
let ids = roots(&doc, &sel);
if let Handle::Rotate(_) = h {
let Some(b) = selection_box(&doc, &ids) else { return Ok(()) };
@@ -1216,6 +1235,13 @@ impl Session {
vec![target]
};
self.set_selection(new_sel.clone());
+ // Dev Mode only selects (Shift-click still deselects): nothing moves.
+ if !edits {
+ if deselect.is_some() {
+ self.set_selection(without_target());
+ }
+ return Ok(());
+ }
// Locked layers selected in the layers panel stay put.
let ids: Vec = roots(&doc, &new_sel).into_iter().filter(|i| !locked_in(&doc, *i)).collect();
if new_sel.is_empty() || doc.node(target).is_some_and(|n| n.locked) || ids.is_empty() {
@@ -1862,9 +1888,11 @@ impl Session {
if self.tool.tool == ToolId::Pen {
return self.pen_finish();
}
+ let edits = !self.tool.dev_mode;
// A frame's or section's name label: rename it there (the canvas puts a field over it).
// Labels come before widgets, as on a press; the second press began a move: undo it.
- if matches!(self.tool.tool, ToolId::Move | ToolId::Scale)
+ if edits
+ && matches!(self.tool.tool, ToolId::Move | ToolId::Scale)
&& !(ev.shift || ev.cmd || ev.alt)
&& let Some(id) = label_at(&doc, page, &self.tool.labels, ev.p())
{
@@ -1877,7 +1905,8 @@ impl Session {
return Ok(());
}
// Quick clicks on a widget's clickable part are clicks, one by one.
- if matches!(self.tool.tool, ToolId::Move | ToolId::Scale)
+ if edits
+ && matches!(self.tool.tool, ToolId::Move | ToolId::Scale)
&& !(ev.shift || ev.cmd || ev.alt)
&& self.hit(&doc, page, ev.p(), ev.tol() * 2.0).and_then(|hit| crate::widgets::target_at(&doc, hit, ev.p())).is_some()
{
@@ -1895,7 +1924,8 @@ impl Session {
let Some(leaf) = self.hit(&doc, page, ev.p(), ev.tol() * 2.0) else { return Ok(()) };
let target = select_target(&doc, leaf, &sel, true);
// Text: edit at the click.
- if doc.node(target).is_some_and(|n| matches!(n.kind, NodeKind::Text(_)))
+ if edits
+ && doc.node(target).is_some_and(|n| matches!(n.kind, NodeKind::Text(_)))
&& (sel.contains(&target) || select_target(&doc, leaf, &sel, false) == target)
{
// Entering a text selects all of it; in the text being edited, the word.
@@ -1910,7 +1940,7 @@ impl Session {
return Ok(());
}
// Shapes and vectors: enter vector edit mode (every selected shape, the clicked one active).
- if doc.node(target).is_some_and(|n| n.kind.is_shape()) && sel.contains(&target) {
+ if edits && doc.node(target).is_some_and(|n| n.kind.is_shape()) && sel.contains(&target) {
let mut ids = crate::vectoredit::enter_targets(&doc, &sel).unwrap_or_default();
ids.retain(|i| *i != target);
ids.insert(0, target);
@@ -2263,6 +2293,10 @@ impl Session {
/// Keys the current mode handles before menu shortcuts (vector edit mode's tools and point
/// keys, Enter to finish the shape builder). Returns whether the key was used.
pub fn tool_key(&mut self, name: &str, shift: bool, alt: bool, cmd: bool) -> Result {
+ // Dev Mode edits nothing: keys go to the commands (which it refuses in the app).
+ if self.tool.dev_mode {
+ return Ok(false);
+ }
if self.ds().is_ok_and(|d| d.vector_edit.is_some()) {
return crate::vectoredit::key(self, name, shift, alt, cmd);
}
@@ -2404,6 +2438,7 @@ impl Session {
fn arc_handles_shown(&self) -> bool {
let arc_drag = matches!(self.tool.gesture, Gesture::Arc { .. } | Gesture::Shape { .. });
self.tool.tool == ToolId::Move
+ && !self.tool.dev_mode
&& (arc_drag || !self.tool.busy())
&& self.ds().is_ok_and(|ds| ds.vector_edit.is_none() && ds.text_edit.is_none())
}
diff --git a/crates/ui-egui/locales/de.toml b/crates/ui-egui/locales/de.toml
index f61464b8..d429e9a8 100644
--- a/crates/ui-egui/locales/de.toml
+++ b/crates/ui-egui/locales/de.toml
@@ -262,6 +262,7 @@ status = "draft — needs native review"
"Commits" = "Commits"
"Company" = "Unternehmen"
"Compare changes" = "Änderungen vergleichen"
+"Compare with" = "Vergleichen mit"
"Compatibility notes" = "Hinweise zur Kompatibilität"
"Completed" = "Abgeschlossen"
"Component" = "Komponente"
@@ -371,6 +372,7 @@ status = "draft — needs native review"
"Detach variable" = "Variable lösen"
"Details" = "Details"
"Dev Mode" = "Entwicklermodus"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "Der Entwicklermodus prüft nur: Wechseln Sie zu Design (Shift+D), um zu bearbeiten"
"Dev resources" = "Entwicklerressourcen"
"Development" = "Entwicklung"
"Device" = "Gerät"
@@ -833,6 +835,7 @@ status = "draft — needs native review"
"Not read yet" = "Noch nicht gelesen"
"Not shared" = "Nicht geteilt"
"Note {n}" = "Notiz {n}"
+"Nothing changed since this version." = "Seit dieser Version hat sich nichts geändert."
"Nothing changed since this was marked ready for dev." = "Seit der Markierung als bereit für die Entwicklung hat sich nichts geändert."
"Nothing here yet. Set a frame's status to list it." = "Noch nichts hier. Legen Sie den Status eines Rahmens fest, um ihn aufzulisten."
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "Noch nichts online. Stellen Sie eine Datei über „Teilen“ online, dann erscheint sie hier."
@@ -1033,6 +1036,7 @@ status = "draft — needs native review"
"Removed" = "Entfernt"
"Removed from the server" = "Vom Server entfernt"
"Removed since it was marked" = "Seit der Markierung entfernt"
+"Removed since this version" = "Seit dieser Version entfernt"
"Rename" = "Umbenennen"
"Rename duplicated layers" = "Duplizierte Ebenen umbenennen"
"Rename folder" = "Ordner umbenennen"
@@ -1314,6 +1318,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "Dieser Server ist öffentlich zugänglich: kein Schlüssel nötig."
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "Dieser Server braucht seinen Schlüssel: Fügen Sie der Adresse ?key=… hinzu (`figcraft-server key` gibt ihn auf dem Rechner des Servers aus)."
"This server takes files only with its key: see Advanced." = "Dieser Server nimmt Dateien nur mit seinem Schlüssel an: siehe Erweitert."
+"This version can't be read." = "Diese Version kann nicht gelesen werden."
+"This version doesn't have it: all of it is new." = "Diese Version enthält es nicht: alles daran ist neu."
"Tidy up" = "Aufräumen"
"Tile" = "Kachel"
"Tile type" = "Kacheltyp"
@@ -1415,10 +1421,12 @@ status = "draft — needs native review"
"WebSocket URL copied" = "WebSocket-URL kopiert"
"Wedge" = "Keil"
"Weight" = "Stärke"
+"What changed since a saved version" = "Was sich seit einer gespeicherten Version geändert hat"
"What changed since it was marked ready for dev" = "Was sich seit der Markierung als bereit für die Entwicklung geändert hat"
"What is wrong with this file? The server's operator gets your report." = "Was stimmt mit dieser Datei nicht? Der Betreiber des Servers erhält Ihre Meldung."
"What it's for" = "Wofür sie gedacht ist"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "Der Ausgangsstand dieser Änderung ist unbekannt: Sie erfolgte, bevor FigCraft Kopien von Rahmen mit dem Status „Bereit für Entwicklung“ aufbewahrte. Erledigen Sie die Änderung (oder markieren Sie den Rahmen erneut als bereit), um ab jetzt zu vergleichen."
+"When marked ready" = "Beim Markieren als bereit"
"While hovering" = "Beim Überfahren"
"While pressing" = "Beim Drücken"
"White" = "Weiß"
diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml
index ae566fc8..162d7b3e 100644
--- a/crates/ui-egui/locales/en.toml
+++ b/crates/ui-egui/locales/en.toml
@@ -276,6 +276,7 @@ name = "English"
"Commits" = "Commits"
"Company" = "Company"
"Compare changes" = "Compare changes"
+"Compare with" = "Compare with"
"Compatibility notes" = "Compatibility notes"
"Completed" = "Completed"
"Component" = "Component"
@@ -390,6 +391,7 @@ name = "English"
"Detach variable" = "Detach variable"
"Details" = "Details"
"Dev Mode" = "Dev Mode"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "Dev Mode only inspects: switch to Design (Shift+D) to edit"
"Dev resources" = "Dev resources"
"Development" = "Development"
"Device" = "Device"
@@ -883,6 +885,7 @@ name = "English"
"Not read yet" = "Not read yet"
"Not shared" = "Not shared"
"Note {n}" = "Note {n}"
+"Nothing changed since this version." = "Nothing changed since this version."
"Nothing changed since this was marked ready for dev." = "Nothing changed since this was marked ready for dev."
"Nothing here yet. Set a frame's status to list it." = "Nothing here yet. Set a frame's status to list it."
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "Nothing online yet. Use Share on a file to put it online and it is listed here."
@@ -1096,6 +1099,7 @@ name = "English"
"Removed" = "Removed"
"Removed from the server" = "Removed from the server"
"Removed since it was marked" = "Removed since it was marked"
+"Removed since this version" = "Removed since this version"
"Rename" = "Rename"
"Rename duplicated layers" = "Rename duplicated layers"
"Rename folder" = "Rename folder"
@@ -1401,6 +1405,8 @@ name = "English"
"This server is open to the public: no key needed." = "This server is open to the public: no key needed."
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)."
"This server takes files only with its key: see Advanced." = "This server takes files only with its key: see Advanced."
+"This version can't be read." = "This version can't be read."
+"This version doesn't have it: all of it is new." = "This version doesn't have it: all of it is new."
"Tidy up" = "Tidy up"
"Tile" = "Tile"
"Tile type" = "Tile type"
@@ -1509,11 +1515,13 @@ name = "English"
"WebSocket URL copied" = "WebSocket URL copied"
"Wedge" = "Wedge"
"Weight" = "Weight"
+"What changed since a saved version" = "What changed since a saved version"
"What you try here changes this preview and the code below, not the file" = "What you try here changes this preview and the code below, not the file"
"What changed since it was marked ready for dev" = "What changed since it was marked ready for dev"
"What is wrong with this file? The server's operator gets your report." = "What is wrong with this file? The server's operator gets your report."
"What it's for" = "What it's for"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on."
+"When marked ready" = "When marked ready"
"While hovering" = "While hovering"
"While pressing" = "While pressing"
"White" = "White"
diff --git a/crates/ui-egui/locales/es.toml b/crates/ui-egui/locales/es.toml
index 596feda6..96666c42 100644
--- a/crates/ui-egui/locales/es.toml
+++ b/crates/ui-egui/locales/es.toml
@@ -277,6 +277,7 @@ status = "draft — needs native review"
"Commits" = "Commits"
"Company" = "Empresa"
"Compare changes" = "Comparar cambios"
+"Compare with" = "Comparar con"
"Completed" = "Completado"
"Component" = "Componente"
"Component name" = "Nombre del componente"
@@ -391,6 +392,7 @@ status = "draft — needs native review"
"Detach variable" = "Separar variable"
"Details" = "Detalles"
"Dev Mode" = "Modo desarrollo"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "El modo desarrollo solo inspecciona: cambia a Diseño (Shift+D) para editar"
"Dev resources" = "Recursos de desarrollo"
"Development" = "Desarrollo"
"Device" = "Dispositivo"
@@ -884,6 +886,7 @@ status = "draft — needs native review"
"Not read yet" = "Aún no leída"
"Not shared" = "Sin compartir"
"Note {n}" = "Nota {n}"
+"Nothing changed since this version." = "Nada cambió desde esta versión."
"Nothing changed since this was marked ready for dev." = "Nada cambió desde que se marcó como listo para desarrollo."
"Nothing here yet. Set a frame's status to list it." = "Aún no hay nada. Asigna un estado a un marco para verlo aquí."
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "Aún no hay nada en línea. Usa Compartir en un archivo para ponerlo en línea y aparecerá aquí."
@@ -1097,6 +1100,7 @@ status = "draft — needs native review"
"Removed" = "Eliminado"
"Removed from the server" = "Quitado del servidor"
"Removed since it was marked" = "Eliminada desde que se marcó"
+"Removed since this version" = "Eliminado desde esta versión"
"Rename" = "Cambiar nombre"
"Rename duplicated layers" = "Renombrar capas duplicadas"
"Rename folder" = "Cambiar nombre de la carpeta"
@@ -1402,6 +1406,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "Este servidor está abierto al público: no hace falta clave."
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "Este servidor necesita su clave: añade ?key=… a la dirección (`figcraft-server key` la muestra en el equipo del servidor)."
"This server takes files only with its key: see Advanced." = "Este servidor solo acepta archivos con su clave: mira Avanzado."
+"This version can't be read." = "No se puede leer esta versión."
+"This version doesn't have it: all of it is new." = "Esta versión no lo tiene: todo es nuevo."
"Tidy up" = "Ordenar"
"Tile" = "Mosaico"
"Tile type" = "Tipo de mosaico"
@@ -1510,11 +1516,13 @@ status = "draft — needs native review"
"WebSocket URL copied" = "URL de WebSocket copiada"
"Wedge" = "Cuña"
"Weight" = "Grosor"
+"What changed since a saved version" = "Qué cambió desde una versión guardada"
"What you try here changes this preview and the code below, not the file" = "Lo que pruebes aquí cambia esta vista previa y el código de abajo, no el archivo"
"What changed since it was marked ready for dev" = "Qué cambió desde que se marcó como listo para desarrollo"
"What is wrong with this file? The server's operator gets your report." = "¿Qué tiene de malo este archivo? El operador del servidor recibirá tu denuncia."
"What it's for" = "Para qué sirve"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "No se sabe desde qué cambió: cambió antes de que FigCraft guardara copias de los marcos listos para desarrollo. Resuelve el cambio (o vuelve a marcarlo como listo) para comparar a partir de ahora."
+"When marked ready" = "Al marcarlo como listo"
"While hovering" = "Mientras se pasa el puntero"
"While pressing" = "Mientras se presiona"
"White" = "Blanco"
diff --git a/crates/ui-egui/locales/fr.toml b/crates/ui-egui/locales/fr.toml
index b038b335..0eb2a5f1 100644
--- a/crates/ui-egui/locales/fr.toml
+++ b/crates/ui-egui/locales/fr.toml
@@ -272,6 +272,7 @@ status = "draft — needs native review"
"Commits" = "Commits"
"Company" = "Entreprise"
"Compare changes" = "Comparer les modifications"
+"Compare with" = "Comparer avec"
"Compatibility notes" = "Notes de compatibilité"
"Completed" = "Terminé"
"Component" = "Composant"
@@ -388,6 +389,7 @@ status = "draft — needs native review"
"Detach variable" = "Détacher la variable"
"Details" = "Détails"
"Dev Mode" = "Mode Dev"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "Le mode Dev sert seulement à inspecter : passez en Design (Shift+D) pour modifier"
"Dev resources" = "Ressources de développement"
"Development" = "Développement"
"Device" = "Appareil"
@@ -877,6 +879,7 @@ status = "draft — needs native review"
"Not read yet" = "Pas encore lu"
"Not shared" = "Non partagé"
"Note {n}" = "Note {n}"
+"Nothing changed since this version." = "Rien n’a changé depuis cette version."
"Nothing changed since this was marked ready for dev." = "Rien n’a changé depuis que ceci a été marqué prêt pour le dev."
"Nothing here yet. Set a frame's status to list it." = "Rien pour l’instant. Attribuez un statut à un cadre pour le lister ici."
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "Rien en ligne pour l’instant. Utilisez Partager sur un fichier pour le mettre en ligne et il apparaîtra ici."
@@ -1090,6 +1093,7 @@ status = "draft — needs native review"
"Removed" = "Supprimé"
"Removed from the server" = "Retiré du serveur"
"Removed since it was marked" = "Supprimé depuis le marquage"
+"Removed since this version" = "Supprimé depuis cette version"
"Rename" = "Renommer"
"Rename duplicated layers" = "Renommer les calques dupliqués"
"Rename folder" = "Renommer le dossier"
@@ -1388,6 +1392,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "Ce serveur est ouvert au public : aucune clé nécessaire."
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "Ce serveur exige sa clé : ajoutez ?key=… à l’adresse (`figcraft-server key` l’affiche sur la machine du serveur)."
"This server takes files only with its key: see Advanced." = "Ce serveur n’accepte les fichiers qu’avec sa clé : voir Avancé."
+"This version can't be read." = "Cette version est illisible."
+"This version doesn't have it: all of it is new." = "Cette version ne le contient pas : tout est nouveau."
"Tidy up" = "Ranger"
"Tile" = "Mosaïque"
"Tile type" = "Type de mosaïque"
@@ -1494,10 +1500,12 @@ status = "draft — needs native review"
"Websites" = "Sites web"
"Wedge" = "Coin"
"Weight" = "Graisse"
+"What changed since a saved version" = "Ce qui a changé depuis une version enregistrée"
"What changed since it was marked ready for dev" = "Ce qui a changé depuis le marquage prêt pour le dev"
"What is wrong with this file? The server's operator gets your report." = "Qu’est-ce qui ne va pas avec ce fichier ? L’opérateur du serveur reçoit votre signalement."
"What it's for" = "À quoi il sert"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "L’état d’origine de cette modification est inconnu : elle date d’avant que FigCraft ne conserve une copie des cadres prêts pour le dev. Résolvez la modification (ou marquez-la à nouveau comme prête) pour comparer à partir de maintenant."
+"When marked ready" = "Au marquage prêt"
"What you try here changes this preview and the code below, not the file" = "Ce que vous essayez ici change cet aperçu et le code ci-dessous, pas le fichier"
"While hovering" = "Pendant le survol"
"While pressing" = "Pendant l’appui"
diff --git a/crates/ui-egui/locales/ja.toml b/crates/ui-egui/locales/ja.toml
index c42790f3..e5ec0a0b 100644
--- a/crates/ui-egui/locales/ja.toml
+++ b/crates/ui-egui/locales/ja.toml
@@ -273,6 +273,7 @@ status = "draft — needs native review"
"Commits" = "コミット"
"Company" = "会社"
"Compare changes" = "変更を比較"
+"Compare with" = "比較対象"
"Compatibility notes" = "互換性に関する注記"
"Completed" = "完了"
"Component" = "コンポーネント"
@@ -386,6 +387,7 @@ status = "draft — needs native review"
"Detach variable" = "変数を切り離す"
"Details" = "詳細"
"Dev Mode" = "開発モード"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "開発モードは検査専用です。編集するにはデザイン (Shift+D) に切り替えてください"
"Dev resources" = "開発リソース"
"Development" = "開発"
"Device" = "デバイス"
@@ -870,6 +872,7 @@ status = "draft — needs native review"
"Not read yet" = "未読"
"Not shared" = "共有していない"
"Note {n}" = "メモ {n}"
+"Nothing changed since this version." = "このバージョンから変更なし。"
"Nothing changed since this was marked ready for dev." = "開発準備完了にしてから変更なし。"
"Nothing here yet. Set a frame's status to list it." = "まだ何もない。フレームのステータスを設定すると一覧に表示される。"
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "オンラインのファイルはまだない。ファイルの「共有」からオンラインにすると、ここに表示される。"
@@ -1077,6 +1080,7 @@ status = "draft — needs native review"
"Removed" = "削除"
"Removed from the server" = "サーバーから削除済み"
"Removed since it was marked" = "マーク後に削除"
+"Removed since this version" = "このバージョン以降に削除"
"Rename" = "名前を変更"
"Rename duplicated layers" = "複製したレイヤーの名前を変更"
"Rename folder" = "フォルダー名を変更"
@@ -1371,6 +1375,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "このサーバーは一般公開されている:キーは不要。"
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "このサーバーにはキーが必要:アドレスに ?key=… を追加(サーバーのマシンで `figcraft-server key` を実行すると表示)。"
"This server takes files only with its key: see Advanced." = "このサーバーはキーがないとファイルを受け付けない:「詳細設定」を参照。"
+"This version can't be read." = "このバージョンを読み込めません。"
+"This version doesn't have it: all of it is new." = "このバージョンにはありません。すべて新規です。"
"Tidy up" = "整列"
"Tile" = "タイル"
"Tile type" = "タイルの種類"
@@ -1476,11 +1482,13 @@ status = "draft — needs native review"
"Websites" = "Webサイト"
"Wedge" = "くさび"
"Weight" = "太さ"
+"What changed since a saved version" = "保存したバージョンからの変更"
"What changed since it was marked ready for dev" = "開発準備完了にしてからの変更内容"
"What is wrong with this file? The server's operator gets your report." = "このファイルの何が問題ですか? 報告はサーバーの運営者に届く。"
"What it's for" = "用途"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "変更前の状態は不明:FigCraft が開発準備完了フレームのコピーを保存するようになる前に変更された。変更を解決する(または再度準備完了にする)と、今後はそこから比較する。"
"What you try here changes this preview and the code below, not the file" = "ここでの操作はプレビューと下のコードに反映。ファイルは変更されない"
+"When marked ready" = "準備完了にした時点"
"While hovering" = "ホバー中"
"While pressing" = "押している間"
"White" = "白"
diff --git a/crates/ui-egui/locales/ko.toml b/crates/ui-egui/locales/ko.toml
index b33b36b9..f87e56d3 100644
--- a/crates/ui-egui/locales/ko.toml
+++ b/crates/ui-egui/locales/ko.toml
@@ -262,6 +262,7 @@ status = "draft — needs native review"
"Commits" = "커밋"
"Company" = "회사"
"Compare changes" = "변경 사항 비교"
+"Compare with" = "비교 대상"
"Compatibility notes" = "호환성 참고 사항"
"Completed" = "완료됨"
"Component" = "컴포넌트"
@@ -370,6 +371,7 @@ status = "draft — needs native review"
"Detach variable" = "변수 분리"
"Details" = "세부 정보"
"Dev Mode" = "개발 모드"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "개발 모드는 검사 전용입니다. 편집하려면 디자인(Shift+D)으로 전환하세요"
"Dev resources" = "개발 리소스"
"Development" = "개발"
"Device" = "기기"
@@ -829,6 +831,7 @@ status = "draft — needs native review"
"Not read yet" = "아직 읽지 않음"
"Not shared" = "공유 안 함"
"Note {n}" = "메모 {n}"
+"Nothing changed since this version." = "이 버전 이후 변경된 내용 없음."
"Nothing changed since this was marked ready for dev." = "개발 준비 완료로 표시된 뒤 변경된 내용 없음."
"Nothing here yet. Set a frame's status to list it." = "아직 아무것도 없음. 프레임의 상태를 설정하면 목록에 표시됨."
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "아직 온라인에 올린 파일이 없음. 파일에서 공유를 사용해 온라인에 올리면 여기에 표시됨."
@@ -1027,6 +1030,7 @@ status = "draft — needs native review"
"Removed" = "제거됨"
"Removed from the server" = "서버에서 제거됨"
"Removed since it was marked" = "표시된 뒤 제거됨"
+"Removed since this version" = "이 버전 이후 삭제됨"
"Rename" = "이름 바꾸기"
"Rename duplicated layers" = "복제한 레이어 이름 바꾸기"
"Rename folder" = "폴더 이름 바꾸기"
@@ -1305,6 +1309,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "이 서버는 누구에게나 열려 있음: 키가 필요 없음."
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "이 서버는 키가 필요함: 주소에 ?key=…를 추가하세요(서버 컴퓨터에서 `figcraft-server key`로 확인)."
"This server takes files only with its key: see Advanced." = "이 서버는 키가 있어야만 파일을 받음: 고급을 참고하세요."
+"This version can't be read." = "이 버전을 읽을 수 없습니다."
+"This version doesn't have it: all of it is new." = "이 버전에는 없습니다. 모두 새 항목입니다."
"Tidy up" = "정돈"
"Tile" = "타일"
"Tile type" = "타일 유형"
@@ -1406,10 +1412,12 @@ status = "draft — needs native review"
"WebSocket URL copied" = "WebSocket URL 복사됨"
"Wedge" = "쐐기"
"Weight" = "굵기"
+"What changed since a saved version" = "저장된 버전 이후 변경된 내용"
"What changed since it was marked ready for dev" = "개발 준비 완료로 표시된 뒤 변경된 내용"
"What is wrong with this file? The server's operator gets your report." = "이 파일에 어떤 문제가 있나요? 신고는 서버 운영자에게 전달됨."
"What it's for" = "용도"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "무엇에서 바뀌었는지 알 수 없음: FigCraft가 개발 준비 완료 프레임의 사본을 보관하기 전에 변경됨. 변경을 해결(또는 다시 준비 완료로 표시)하면 이후부터 비교함."
+"When marked ready" = "준비 완료로 표시한 시점"
"While hovering" = "마우스를 올린 동안"
"While pressing" = "누르는 동안"
"White" = "흰색"
diff --git a/crates/ui-egui/locales/pt-BR.toml b/crates/ui-egui/locales/pt-BR.toml
index d8f857e0..35ebf52e 100644
--- a/crates/ui-egui/locales/pt-BR.toml
+++ b/crates/ui-egui/locales/pt-BR.toml
@@ -260,6 +260,7 @@ status = "draft — needs native review"
"Commits" = "Commits"
"Company" = "Empresa"
"Compare changes" = "Comparar alterações"
+"Compare with" = "Comparar com"
"Compatibility notes" = "Notas de compatibilidade"
"Completed" = "Concluído"
"Component" = "Componente"
@@ -369,6 +370,7 @@ status = "draft — needs native review"
"Detach variable" = "Desvincular variável"
"Details" = "Detalhes"
"Dev Mode" = "Modo Dev"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "O modo Dev só inspeciona: mude para Design (Shift+D) para editar"
"Dev resources" = "Recursos de desenvolvimento"
"Development" = "Desenvolvimento"
"Device" = "Dispositivo"
@@ -828,6 +830,7 @@ status = "draft — needs native review"
"Not read yet" = "Ainda não lido"
"Not shared" = "Não compartilhado"
"Note {n}" = "Nota {n}"
+"Nothing changed since this version." = "Nada mudou desde esta versão."
"Nothing changed since this was marked ready for dev." = "Nada mudou desde que isto foi marcado como pronto para dev."
"Nothing here yet. Set a frame's status to list it." = "Ainda não há nada aqui. Defina o status de um quadro para listá-lo."
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "Nada online ainda. Use Compartilhar em um arquivo para colocá-lo online e ele aparecerá aqui."
@@ -1026,6 +1029,7 @@ status = "draft — needs native review"
"Removed" = "Removido"
"Removed from the server" = "Removido do servidor"
"Removed since it was marked" = "Removido desde a marcação"
+"Removed since this version" = "Removido desde esta versão"
"Rename" = "Renomear"
"Rename duplicated layers" = "Renomear camadas duplicadas"
"Rename folder" = "Renomear pasta"
@@ -1304,6 +1308,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "Este servidor é aberto ao público: não precisa de chave."
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "Este servidor precisa da própria chave: adicione ?key=… ao endereço (`figcraft-server key` a mostra na máquina do servidor)."
"This server takes files only with its key: see Advanced." = "Este servidor só aceita arquivos com a própria chave: veja Avançado."
+"This version can't be read." = "Não é possível ler esta versão."
+"This version doesn't have it: all of it is new." = "Esta versão não o tem: tudo é novo."
"Tidy up" = "Organizar"
"Tile" = "Mosaico"
"Tile type" = "Tipo de mosaico"
@@ -1405,10 +1411,12 @@ status = "draft — needs native review"
"WebSocket URL copied" = "URL do WebSocket copiada"
"Wedge" = "Cunha"
"Weight" = "Espessura"
+"What changed since a saved version" = "O que mudou desde uma versão salva"
"What changed since it was marked ready for dev" = "O que mudou desde que foi marcado como pronto para dev"
"What is wrong with this file? The server's operator gets your report." = "O que há de errado com este arquivo? O operador do servidor recebe a sua denúncia."
"What it's for" = "Para que serve"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "Não se sabe de onde esta alteração partiu: ela ocorreu antes de o FigCraft guardar cópias dos quadros prontos para dev. Resolva a alteração (ou marque-o como pronto de novo) para comparar daqui em diante."
+"When marked ready" = "Ao marcar como pronto"
"While hovering" = "Enquanto passa o cursor"
"While pressing" = "Enquanto pressiona"
"White" = "Branco"
diff --git a/crates/ui-egui/locales/zh-Hans.toml b/crates/ui-egui/locales/zh-Hans.toml
index 94c91942..1942bd74 100644
--- a/crates/ui-egui/locales/zh-Hans.toml
+++ b/crates/ui-egui/locales/zh-Hans.toml
@@ -263,6 +263,7 @@ status = "draft — needs native review"
"Commits" = "提交"
"Company" = "公司"
"Compare changes" = "比较更改"
+"Compare with" = "比较对象"
"Compatibility notes" = "兼容性说明"
"Completed" = "已完成"
"Component" = "组件"
@@ -371,6 +372,7 @@ status = "draft — needs native review"
"Detach variable" = "分离变量"
"Details" = "详细"
"Dev Mode" = "开发模式"
+"Dev Mode only inspects: switch to Design (Shift+D) to edit" = "开发模式仅用于检查:切换到设计 (Shift+D) 进行编辑"
"Dev resources" = "开发资源"
"Development" = "开发"
"Device" = "设备"
@@ -830,6 +832,7 @@ status = "draft — needs native review"
"Not read yet" = "尚未读取"
"Not shared" = "未分享"
"Note {n}" = "备注 {n}"
+"Nothing changed since this version." = "自此版本以来没有任何更改。"
"Nothing changed since this was marked ready for dev." = "自标记为可供开发以来没有任何更改。"
"Nothing here yet. Set a frame's status to list it." = "这里还没有内容。设置画框的状态即可将其列出。"
"Nothing online yet. Use Share on a file to put it online and it is listed here." = "还没有在线文件。对文件使用“分享”将其放到网上后,它会列在这里。"
@@ -1028,6 +1031,7 @@ status = "draft — needs native review"
"Removed" = "已删除"
"Removed from the server" = "已从服务器移除"
"Removed since it was marked" = "标记后已删除"
+"Removed since this version" = "自此版本以来已移除"
"Rename" = "重命名"
"Rename duplicated layers" = "重命名副本图层"
"Rename folder" = "重命名文件夹"
@@ -1306,6 +1310,8 @@ status = "draft — needs native review"
"This server is open to the public: no key needed." = "此服务器对公众开放:无需密钥。"
"This server needs its key: add ?key=… to the address (`figcraft-server key` prints it on the server's machine)." = "此服务器需要密钥:请在地址后加上 ?key=…(在服务器所在的机器上运行 `figcraft-server key` 可显示)。"
"This server takes files only with its key: see Advanced." = "此服务器只接受带密钥的文件:请查看“高级”。"
+"This version can't be read." = "无法读取此版本。"
+"This version doesn't have it: all of it is new." = "此版本中没有它:全部是新的。"
"Tidy up" = "整理"
"Tile" = "平铺"
"Tile type" = "平铺类型"
@@ -1407,10 +1413,12 @@ status = "draft — needs native review"
"WebSocket URL copied" = "已复制 WebSocket URL"
"Wedge" = "楔形"
"Weight" = "粗细"
+"What changed since a saved version" = "自已保存版本以来的更改"
"What changed since it was marked ready for dev" = "自标记为可供开发以来的更改"
"What is wrong with this file? The server's operator gets your report." = "此文件有什么问题?你的举报会发送给服务器的运营者。"
"What it's for" = "用途"
"What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on." = "无法得知更改前的状态:它在 FigCraft 开始保存可供开发画框的副本之前就已更改。请解决此更改(或重新标记为可供开发),以便今后进行比较。"
+"When marked ready" = "标记为就绪时"
"While hovering" = "悬停时"
"While pressing" = "按住时"
"White" = "白"
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 46451ae0..5b36af79 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -1044,8 +1044,9 @@ fn overlays(app: &FigApp, painter: &egui::Painter, t: &Tokens) -> Vec<(NodeId, [
let tiny = figcraft_engine::tools::box_sides_px(&b, zoom).1 < figcraft_engine::tools::SMALL_BOX_PX;
// Measuring to another layer (Alt held) shows just the outlines: no handles or size.
let measuring = app.session.tool.overlay.measure_box.is_some();
- // Locked layers (selected in the layers panel) can't be resized: no handles either.
- let handles = if measuring || sel.iter().any(|i| figcraft_engine::tools::locked_in(&doc, *i)) {
+ // Locked layers (selected in the layers panel) can't be resized, nor anything in Dev
+ // Mode: no handles either.
+ let handles = if measuring || app.session.tool.dev_mode || sel.iter().any(|i| figcraft_engine::tools::locked_in(&doc, *i)) {
0
} else if is_line {
2
diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs
index 2d35609a..4daea00b 100644
--- a/crates/ui-egui/src/control.rs
+++ b/crates/ui-egui/src/control.rs
@@ -633,12 +633,16 @@ pub fn handle(app: &mut FigApp, ctx: &Context, method: &str, p: &Value) -> Resul
if let Some(v) = p.get("exportPreview").and_then(Value::as_bool) {
app.ui.export_thumb = v;
}
- // Dev Mode's compare view: a ready-for-dev frame or section opens it, null closes it;
+ // Dev Mode's compare view: a frame or section opens it, null closes it; `devCompareVersion`
+ // the saved version it compares with (null: when it was marked ready for dev),
// `devCompareMode` is sideBySide or overlay, `devCompareSplit` the overlay slider (0–1).
if let Some(v) = p.get("devCompare") {
- app.ui.dev.compare = figcraft_engine::params::id_of(v).map(crate::dev_compare::CompareView::new);
+ app.ui.dev.compare = figcraft_engine::params::id_of(v).map(|id| crate::dev_compare::CompareView::new(id, None));
}
if let Some(c) = app.ui.dev.compare.as_mut() {
+ if let Some(v) = p.get("devCompareVersion") {
+ c.version = v.as_str().map(str::to_string);
+ }
match p.get("devCompareMode").and_then(Value::as_str) {
Some("overlay") => c.mode = crate::dev_compare::Mode::Overlay,
Some("sideBySide") => c.mode = crate::dev_compare::Mode::SideBySide,
diff --git a/crates/ui-egui/src/dev_compare.rs b/crates/ui-egui/src/dev_compare.rs
index 2e21eb54..0fd57aa7 100644
--- a/crates/ui-egui/src/dev_compare.rs
+++ b/crates/ui-egui/src/dev_compare.rs
@@ -1,12 +1,13 @@
-//! Dev Mode's compare view: a ready-for-dev frame or section as it was when it was marked next to
-//! how it is now (side by side, or one over the other with a slider), the changed layers outlined,
-//! and the list of what changed (`dev.compare`). Rendered once per document version. The branch
-//! review ([`crate::branch_ui`]) shows two versions with the same pieces.
+//! Dev Mode's compare view: a frame or section as it was when it was marked ready for dev, or in
+//! a saved version picked at the bottom, next to how it is now (side by side, or one over the
+//! other with a slider), the changed layers outlined, and the list of what changed
+//! (`dev.compare`). Rendered once per document version. The branch review ([`crate::branch_ui`])
+//! shows two versions with the same pieces.
use std::sync::Arc;
use egui::{Align2, Color32, CornerRadius, Id, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2};
-use figcraft_doc::{Document, NodeId};
+use figcraft_doc::{DevStatus, Document, NodeId};
use figcraft_engine::devcompare::{self, ChangeKind, Comparison, LayerChange};
use serde_json::json;
@@ -38,25 +39,41 @@ pub struct CompareView {
pub mode: Mode,
/// Where the overlay slider is (0 = all new, 1 = all old).
pub split: f32,
+ /// The saved version compared with (its id); `None`: the snapshot from when it was marked
+ /// ready for dev.
+ pub version: Option,
/// The change row under the pointer (its layer is highlighted).
hovered: Option,
cache: Option,
}
impl CompareView {
- pub fn new(id: NodeId) -> Self {
- Self { id, mode: Mode::default(), split: 0.5, hovered: None, cache: None }
+ pub fn new(id: NodeId, version: Option) -> Self {
+ Self { id, mode: Mode::default(), split: 0.5, version, hovered: None, cache: None }
+ }
+
+ /// The view `dev.compare {show}` (or `ui.set`) asks for: `data` holds the layer's `id` and the
+ /// `version` to compare with.
+ pub fn requested(data: &serde_json::Value) -> Option {
+ let id = data.get("id").and_then(figcraft_engine::params::id_of)?;
+ Some(Self::new(id, data.get("version").and_then(serde_json::Value::as_str).map(str::to_string)))
}
}
-/// What the view shows, built for one version of the document.
+/// What the view shows, built for one version of the document and one "before".
struct Cached {
doc: Arc,
+ version: Option,
+ /// The version's document (read once per version picked).
+ version_doc: Option>,
cmp: Comparison,
before: Option,
after: Option,
}
+/// A saved version as the picker lists it: (id, name, when).
+type VersionRow = (String, String, u64);
+
/// One version rendered: its texture, the page area it shows and where each listed layer is.
pub(crate) struct Shot {
tex: egui::TextureHandle,
@@ -129,15 +146,33 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) {
let Some(mut view) = app.ui.dev.compare.take() else { return };
let Ok(ds) = app.session.ds() else { return };
let doc = ds.doc.clone();
- if doc.node(view.id).is_none() {
+ let Some(node) = doc.node(view.id) else { return };
+ let ready = node.dev_status == DevStatus::ReadyForDev;
+ // Newest first; a version deleted meanwhile falls back to the ready-for-dev snapshot (or the
+ // newest version, for a layer that isn't ready for dev).
+ let versions: Vec = ds.versions.iter().rev().map(|v| (v.id.clone(), v.name.clone(), v.time)).collect();
+ if view.version.as_ref().is_some_and(|v| !versions.iter().any(|(id, ..)| id == v)) || (!ready && view.version.is_none()) {
+ view.version = if ready { None } else { versions.first().map(|(id, ..)| id.clone()) };
+ }
+ if view.version.is_none() && !ready {
return;
}
- if view.cache.as_ref().is_none_or(|c| !Arc::ptr_eq(&c.doc, &doc)) {
- let cmp = devcompare::compare(&doc, view.id);
- let before = devcompare::before_doc(&doc, view.id).and_then(|b| Shot::of_changes(ctx, &b, view.id, &cmp.changes, true));
+ if view.cache.as_ref().is_none_or(|c| !Arc::ptr_eq(&c.doc, &doc) || c.version != view.version) {
+ let kept = view.cache.take().filter(|c| c.version == view.version).and_then(|c| c.version_doc);
+ let version_doc = match &view.version {
+ Some(v) => kept.or_else(|| ds.versions.iter().find(|x| x.id == *v).and_then(|x| x.document().ok())),
+ None => None,
+ };
+ let (cmp, before) = match &version_doc {
+ Some(b) => (devcompare::compare_with(b, &doc, view.id), Some(b.clone())),
+ None if view.version.is_some() => (devcompare::empty(&doc, view.id), None),
+ None => (devcompare::compare(&doc, view.id), devcompare::before_doc(&doc, view.id).map(Arc::new)),
+ };
+ let before = before.and_then(|b| Shot::of_changes(ctx, &b, view.id, &cmp.changes, true));
let after = Shot::of_changes(ctx, &doc, view.id, &cmp.changes, false);
- view.cache = Some(Cached { doc: doc.clone(), cmp, before, after });
+ view.cache = Some(Cached { doc: doc.clone(), version: view.version.clone(), version_doc, cmp, before, after });
}
+ let version_name = view.version.as_ref().and_then(|v| versions.iter().find(|(id, ..)| id == v)).map(|(_, name, _)| name.clone());
let t = Tokens::get(ctx);
let screen = ctx.content_rect();
let size = vec2(1120.0_f32.min(screen.width() - 64.0).max(560.0), 700.0_f32.min(screen.height() - 96.0).max(320.0));
@@ -162,27 +197,16 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) {
ui.horizontal_top(|ui| {
let images_w = size.x - LIST_W - 1.0;
let (r, _) = ui.allocate_exact_size(vec2(images_w, body_h), Sense::hover());
- if !cache.cmp.snapshot {
- let msg = if cache.cmp.changed {
- tr(
- "What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on.",
- )
- } else {
- tr("Nothing changed since this was marked ready for dev.")
- };
- message(ui, &t, r, msg);
- } else if let (Some(before), Some(after)) = (&cache.before, &cache.after) {
- images(ui, &t, r, [(before, tr("Before")), (after, tr("Now"))], view.mode, &mut view.split, view.hovered);
- }
+ compared(ui, r, cache, version_name.as_deref(), view.mode, &mut view.split, view.hovered);
let (line, _) = ui.allocate_exact_size(vec2(1.0, body_h), Sense::hover());
ui.painter().rect_filled(line, CornerRadius::ZERO, t.border);
ui.allocate_ui_with_layout(vec2(LIST_W, body_h), top_down, |ui| {
- if let Some(a) = list(ui, &t, &cache.cmp, &mut view.hovered) {
+ if let Some(a) = list(ui, &t, &cache.cmp, view.version.is_some(), &mut view.hovered) {
action = Some(a);
}
});
});
- if let Some(a) = footer(ui, &t, &cache.cmp) {
+ if let Some(a) = footer(ui, &t, &cache.cmp, ready, &versions, view.version.as_deref()) {
action = Some(a);
}
});
@@ -197,6 +221,7 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) {
}
}
Some(Action::Close) => open = false,
+ Some(Action::Against(v)) => view.version = v,
None => {}
}
if open {
@@ -204,10 +229,37 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) {
}
}
+/// The images area: before and after, or a note saying why there is nothing to show.
+/// `version_name`: the saved version compared with (`None`: the ready-for-dev snapshot).
+fn compared(ui: &mut Ui, r: Rect, cache: &Cached, version_name: Option<&str>, mode: Mode, split: &mut f32, hovered: Option) {
+ let t = &Tokens::get(ui.ctx());
+ let against = version_name.is_some();
+ if !cache.cmp.snapshot {
+ let msg = if against {
+ tr("This version can't be read.")
+ } else if cache.cmp.changed {
+ tr(
+ "What this changed from isn't known: it changed before FigCraft kept a copy of ready-for-dev frames. Resolve the change (or mark it ready again) to compare from now on.",
+ )
+ } else {
+ tr("Nothing changed since this was marked ready for dev.")
+ };
+ message(ui, t, r, msg);
+ } else if !cache.cmp.changed && against {
+ message(ui, t, r, tr("Nothing changed since this version."));
+ } else if let (Some(before), Some(after)) = (&cache.before, &cache.after) {
+ images(ui, t, r, [(before, version_name.unwrap_or(tr("Before"))), (after, tr("Now"))], mode, split, hovered);
+ } else if against {
+ message(ui, t, r, tr("This version doesn't have it: all of it is new."));
+ }
+}
+
enum Action {
Select(NodeId),
Resolve,
Close,
+ /// Compare with this saved version (`None`: the snapshot from when it was marked ready).
+ Against(Option),
}
/// The title row: `title` and `name`, the side by side / overlay switch and the close button.
@@ -325,7 +377,7 @@ fn pane(p: &egui::Painter, t: &Tokens, place: Place, shot: &Shot, hovered: Optio
}
/// The changed layers with their property changes; a click on a layer selects it.
-fn list(ui: &mut Ui, t: &Tokens, cmp: &Comparison, hovered: &mut Option) -> Option {
+fn list(ui: &mut Ui, t: &Tokens, cmp: &Comparison, from_version: bool, hovered: &mut Option) -> Option {
let mut out = None;
let summary = if !cmp.snapshot {
tr("Changes unknown").to_string()
@@ -345,7 +397,11 @@ fn list(ui: &mut Ui, t: &Tokens, cmp: &Comparison, hovered: &mut Option)
egui::ScrollArea::vertical().id_salt("compare_list").auto_shrink([false, false]).show(ui, |ui| {
ui.spacing_mut().item_spacing = vec2(0.0, 0.0);
for c in &cmp.changes {
- let tip = if c.change == ChangeKind::Removed { tr("Removed since it was marked") } else { tr("Select layer") };
+ let tip = match (c.change, from_version) {
+ (ChangeKind::Removed, false) => tr("Removed since it was marked"),
+ (ChangeKind::Removed, true) => tr("Removed since this version"),
+ _ => tr("Select layer"),
+ };
let resp = change_row(ui, t, c.change, &c.name, c.depth, c.layers, false, tip);
if resp.hovered() {
now_hovered = Some(c.id);
@@ -419,17 +475,42 @@ pub(crate) fn property_lines<'a>(ui: &mut Ui, t: &Tokens, depth: usize, lines: i
}
}
-fn footer(ui: &mut Ui, t: &Tokens, cmp: &Comparison) -> Option {
+/// Resolve and Close, and left of them what it compares with: the snapshot from when it was
+/// marked ready for dev (`ready`) or one of the saved `versions` (`version`, the one picked).
+fn footer(ui: &mut Ui, t: &Tokens, cmp: &Comparison, ready: bool, versions: &[VersionRow], version: Option<&str>) -> Option {
let (r, _) = ui.allocate_exact_size(vec2(ui.available_width(), BAR_H + 1.0), Sense::hover());
ui.painter().rect_filled(Rect::from_min_size(r.min, vec2(r.width(), 1.0)), CornerRadius::ZERO, t.border);
let mut out = None;
let inner = Rect::from_min_max(pos2(r.min.x + 16.0, r.min.y + 1.0), pos2(r.max.x - 16.0, r.max.y));
+ ui.scope_builder(egui::UiBuilder::new().max_rect(inner).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
+ ui.spacing_mut().item_spacing.x = 8.0;
+ if !versions.is_empty() {
+ widgets::label(ui, tr("Compare with"), t.text_secondary);
+ let picked = version.and_then(|v| versions.iter().find(|(id, ..)| id == v));
+ let label = picked.map_or_else(|| tr("When marked ready").to_string(), |(_, name, _)| name.clone());
+ let resp = widgets::dropdown(ui, &label, 220.0, Some(Icon::Clock));
+ crate::right::menu_popup(&resp).show(|ui| {
+ if ready && crate::right::menu_check(ui, version.is_none(), tr("When marked ready"), "") {
+ out = Some(Action::Against(None));
+ ui.close();
+ }
+ for (id, name, time) in versions {
+ if crate::right::menu_check(ui, version == Some(id.as_str()), name, &crate::comments::ago_long(*time)) {
+ out = Some(Action::Against(Some(id.clone())));
+ ui.close();
+ }
+ }
+ });
+ }
+ });
ui.scope_builder(egui::UiBuilder::new().max_rect(inner).layout(egui::Layout::right_to_left(egui::Align::Center)), |ui| {
ui.spacing_mut().item_spacing.x = 8.0;
- let resolve = widgets::button(ui, tr("Resolve change"), true, cmp.changed)
- .on_hover_text(tr("Back to Ready for dev: the next change compares with how it is now"));
- if resolve.clicked() {
- out = Some(Action::Resolve);
+ if version.is_none() {
+ let resolve = widgets::button(ui, tr("Resolve change"), true, cmp.changed)
+ .on_hover_text(tr("Back to Ready for dev: the next change compares with how it is now"));
+ if resolve.clicked() {
+ out = Some(Action::Resolve);
+ }
}
if widgets::button(ui, tr("Close"), false, true).clicked() {
out = Some(Action::Close);
diff --git a/crates/ui-egui/src/dev_mode.rs b/crates/ui-egui/src/dev_mode.rs
index 0b429820..1b21ded2 100644
--- a/crates/ui-egui/src/dev_mode.rs
+++ b/crates/ui-egui/src/dev_mode.rs
@@ -29,8 +29,12 @@ const CALLOUT_W: f32 = 220.0;
const CALLOUT_GAP: f32 = 24.0;
/// The status filters of the ready-for-dev list.
-const FILTERS: [(Option, &str); 3] =
- [(Some(DevStatus::ReadyForDev), tr_noop("Ready for dev")), (Some(DevStatus::Completed), tr_noop("Completed")), (None, tr_noop("Any status"))];
+const FILTERS: [(Option, bool, &str); 4] = [
+ (Some(DevStatus::ReadyForDev), false, tr_noop("Ready for dev")),
+ (Some(DevStatus::ReadyForDev), true, tr_noop("Changed")),
+ (Some(DevStatus::Completed), false, tr_noop("Completed")),
+ (None, false, tr_noop("Any status")),
+];
/// Which annotations the canvas shows.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
@@ -500,18 +504,18 @@ pub fn status(app: &mut FigApp, ui: &mut Ui, doc: &Document, sel: &[NodeId]) {
row(ui, 32.0, |ui| crate::section_panel::status_dropdown(app, ui, doc, sel, w));
if let [id] = sel {
let changed = doc.node(*id).is_some_and(|n| n.dev_status == DevStatus::ReadyForDev && n.dev_changed);
- let focused = app.session.ds().ok().and_then(figcraft_engine::DocState::focused) == Some(*id);
+ let ds = app.session.ds().ok();
+ let focused = ds.and_then(figcraft_engine::DocState::focused) == Some(*id);
+ // Unchanged since it was marked (or not ready for dev): compared with the newest saved version.
+ let newest = ds.and_then(|d| d.versions.last()).map(|v| v.id.clone()).filter(|_| !changed);
row(ui, 32.0, |ui| {
ui.spacing_mut().item_spacing.x = 8.0;
if !focused && widgets::button(ui, tr("Focus view"), false, true).on_hover_text(tr("Show only this on the canvas")).clicked() {
app.run("dev.focus", json!({"id": id}));
}
- if changed
- && widgets::button(ui, tr("Compare changes"), true, true)
- .on_hover_text(tr("What changed since it was marked ready for dev"))
- .clicked()
- {
- app.run("dev.compare", json!({"id": id, "show": true}));
+ let tip = if changed { tr("What changed since it was marked ready for dev") } else { tr("What changed since a saved version") };
+ if (changed || newest.is_some()) && widgets::button(ui, tr("Compare changes"), changed, true).on_hover_text(tip).clicked() {
+ app.run("dev.compare", json!({"id": id, "version": newest, "show": true}));
}
});
}
@@ -819,7 +823,9 @@ pub fn ready_list(app: &mut FigApp, ui: &mut Ui) {
let filter = app.ui.dev.filter.min(FILTERS.len() - 1);
let key = (ds.uid, ds.revision, filter);
if app.ui.dev.ready_key != Some(key) {
- app.ui.dev.ready = devinspect::dev_items(&ds.doc, FILTERS.get(filter).and_then(|f| f.0), None);
+ let (status, changed_only) = FILTERS.get(filter).map_or((None, false), |f| (f.0, f.1));
+ app.ui.dev.ready = devinspect::dev_items(&ds.doc, status, None);
+ app.ui.dev.ready.retain(|i| i.changed || !changed_only);
app.ui.dev.ready_key = Some(key);
}
let doc = ds.doc.clone();
@@ -827,9 +833,9 @@ pub fn ready_list(app: &mut FigApp, ui: &mut Ui) {
widgets::section_header(ui, tr("Ready for dev"), &[], app.ui.dev.ready.is_empty());
let w = ui.available_width() - PAD * 2.0;
row(ui, 32.0, |ui| {
- let resp = widgets::dropdown(ui, FILTERS.get(filter).map_or("", |f| tr(f.1)), w, Some(Icon::Code));
+ let resp = widgets::dropdown(ui, FILTERS.get(filter).map_or("", |f| tr(f.2)), w, Some(Icon::Code));
menu_popup(&resp).show(|ui| {
- for (i, (_, label)) in FILTERS.iter().enumerate() {
+ for (i, (_, _, label)) in FILTERS.iter().enumerate() {
if menu_check(ui, i == filter, tr(label), "") {
app.ui.dev.filter = i;
ui.close();
@@ -848,15 +854,21 @@ pub fn ready_list(app: &mut FigApp, ui: &mut Ui) {
if resp.hovered() {
ui.painter().rect_filled(r.shrink2(vec2(8.0, 0.0)), CornerRadius::same(5), t.hover);
}
- let dot = if item.status == DevStatus::ReadyForDev { t.success } else { t.text_tertiary };
+ // The status colours the canvas badges use; a changed one also says so after its name.
+ let n = doc.node(item.id);
+ let dot = n.and_then(crate::canvas::status_label).map_or(t.text_tertiary, |(_, c)| c);
ui.painter().circle_filled(pos2(r.min.x + PAD + 4.0, r.center().y), 4.0, dot);
let page = doc.node(item.page).map(|p| p.name.clone()).unwrap_or_default();
let page_w = ui.painter().layout_no_wrap(page.clone(), regular(10.0), t.text_secondary).size().x.min(90.0);
let page_r = Rect::from_min_max(pos2(r.max.x - PAD - page_w, r.min.y), pos2(r.max.x - PAD, r.max.y));
ui.painter().with_clip_rect(page_r).text(page_r.right_center(), Align2::RIGHT_CENTER, page, regular(10.0), t.text_secondary);
let name_r = Rect::from_min_max(pos2(r.min.x + PAD + 14.0, r.min.y), pos2(page_r.min.x - 8.0, r.max.y));
- let name = widgets::elide(ui, &item.name, name_r.width());
- ui.painter().text(name_r.left_center(), Align2::LEFT_CENTER, name, regular(11.0), t.text);
+ // Room for the "Changed" badge (about 60 points) after the name.
+ let name = widgets::elide(ui, &item.name, name_r.width() - if item.changed { 64.0 } else { 0.0 });
+ let name_end = ui.painter().text(name_r.left_center(), Align2::LEFT_CENTER, name, regular(11.0), t.text).max.x;
+ if let Some(n) = n.filter(|_| item.changed) {
+ crate::canvas::status_badge(&ui.painter().with_clip_rect(name_r), n, pos2(name_end + 6.0, r.center().y));
+ }
// Hovered: a button to open it in the focus view, over the page name.
let focus_r = Rect::from_center_size(pos2(r.max.x - PAD - 10.0, r.center().y), vec2(22.0, 22.0));
let over_focus = ui.rect_contains_pointer(focus_r);
diff --git a/crates/ui-egui/src/devmode_tail_tests.rs b/crates/ui-egui/src/devmode_tail_tests.rs
new file mode 100644
index 00000000..7008e9e5
--- /dev/null
+++ b/crates/ui-egui/src/devmode_tail_tests.rs
@@ -0,0 +1,110 @@
+//! Dev Mode in the UI, the tail: the compare view compares with a saved version picked at its
+//! bottom, and falls back when that version goes away.
+
+use figcraft_engine::Session;
+use serde_json::json;
+
+use crate::dev_compare::CompareView;
+use crate::present_tests::{Ui, id};
+
+#[test]
+fn compare_view_compares_with_a_saved_version() {
+ let mut s = Session::new();
+ let f = id(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 300, "height": 400, "name": "Login"})).unwrap());
+ let r = id(&s.execute("shape.rectangle", &json!({"x": 20, "y": 300, "width": 120, "height": 40, "parent": f})).unwrap());
+ let mut u = Ui::new(s);
+ u.app.ui.right_tab = crate::RightTab::Inspect;
+ u.frame(vec![]);
+ // Neither ready for dev nor any version: nothing to compare with, the view doesn't stay.
+ u.app.ui.dev.compare = Some(CompareView::new(f, None));
+ u.frames(2, Vec::new);
+ assert!(u.app.ui.dev.compare.is_none());
+ let v = u.run("file.saveVersion", json!({"name": "Kickoff"}));
+ let v = v["id"].as_str().unwrap().to_string();
+ u.run("node.set", json!({"id": r, "props": {"width": 160}}));
+ u.run("dev.compare", json!({"id": f, "version": v, "show": true}));
+ u.frames(2, Vec::new);
+ assert_eq!(u.app.inspect()["devCompare"]["version"], json!(v));
+ // Opened without one, a layer that isn't ready compares with the newest version.
+ u.app.ui.dev.compare = Some(CompareView::new(f, None));
+ u.frames(2, Vec::new);
+ assert_eq!(u.app.inspect()["devCompare"]["version"], json!(v));
+ // Ready for dev: the snapshot from when it was marked is there too, and a deleted version
+ // falls back to it.
+ u.run("node.set", json!({"id": f, "props": {"devStatus": "readyForDev"}}));
+ u.run("node.set", json!({"id": r, "props": {"height": 48}}));
+ u.run("version.delete", json!({"id": v}));
+ u.frames(2, Vec::new);
+ assert_eq!(u.app.inspect()["devCompare"]["version"], json!(null));
+ assert!(u.app.ui.dev.compare.is_some());
+}
+
+#[test]
+fn dev_mode_keys_refuse_design_edits_and_say_why() {
+ let mut s = Session::new();
+ let f = id(&s.execute("frame.create", &json!({"x": 0, "y": 0, "width": 300, "height": 400, "name": "Login"})).unwrap());
+ let r = id(&s.execute("shape.rectangle", &json!({"x": 20, "y": 30, "width": 120, "height": 40, "parent": f})).unwrap());
+ s.execute("select.set", &json!({"ids": [r]})).unwrap();
+ let mut u = Ui::new(s);
+ u.app.ui.right_tab = crate::RightTab::Inspect;
+ u.frame(vec![]);
+ let at = egui::pos2(700.0, 450.0);
+ let x = |u: &Ui| u.app.session.doc().unwrap().node(r).map(|n| n.transform.as_coeffs()[4]);
+ for key in [egui::Key::Delete, egui::Key::ArrowRight, egui::Key::Num5, egui::Key::R] {
+ u.key(at, key);
+ }
+ assert!(u.app.session.doc().unwrap().contains(r), "not deleted");
+ assert_eq!(x(&u), Some(20.0), "not nudged");
+ assert_eq!(u.app.session.doc().unwrap().node(r).map(|n| n.opacity), Some(1.0), "opacity kept");
+ assert_eq!(u.app.session.tool.tool, figcraft_engine::tools::ToolId::Move, "no drawing tool");
+ assert!(u.app.ui.toast.as_ref().is_some_and(|(m, _)| m.contains("Shift+D")));
+ // In the design the same keys edit.
+ u.app.ui.right_tab = crate::RightTab::Design;
+ u.frame(vec![]);
+ u.key(at, egui::Key::ArrowRight);
+ assert_eq!(x(&u), Some(21.0));
+}
+
+#[test]
+fn read_only_plugins_run_from_the_inspect_tab_show_their_panel() {
+ use base64::Engine as _;
+ let wasm = base64::engine::general_purpose::STANDARD.encode(crate::plugin_panel_tests::panel_module());
+ let manifest = json!({"id": "org.test.inspect", "name": "Inspect panel", "main": "p.wasm", "api": 2, "permissions": {"access": "read"}});
+ let mut s = Session::new();
+ s.execute("plugin.import", &json!({"manifest": manifest, "wasm": wasm})).unwrap();
+ let mut u = Ui::new(s);
+ u.app.ui.right_tab = crate::RightTab::Inspect;
+ u.frame(vec![]);
+ // What the Inspect tab's Plugins row runs.
+ crate::plugins_ui::start(&mut u.app, "org.test.inspect", "run");
+ u.frame(vec![]);
+ assert_eq!(u.app.session.plugins.panels.len(), 1, "its panel shows");
+ // Its callbacks only read: the button that would draw is refused and the design stays.
+ let layers = |u: &Ui| u.app.session.doc().unwrap().ids().count();
+ let before = layers(&u);
+ assert!(u.app.session.execute("plugin.event", &json!({"id": "org.test.inspect", "control": "go"})).is_err());
+ assert_eq!(layers(&u), before);
+}
+
+/// A clipboard holding only text.
+struct TextClip(String);
+
+impl crate::Services for TextClip {
+ fn clipboard_get_text(&mut self) -> Option {
+ Some(self.0.clone())
+ }
+}
+
+#[test]
+fn dev_mode_pastes_only_a_comments_link() {
+ let mut s = Session::new();
+ let c = s.execute("comment.add", &json!({"x": 10, "y": 10, "text": "Check the spacing"})).unwrap()["id"].as_u64().unwrap();
+ let layers = |app: &crate::FigApp| app.session.doc().unwrap().node(app.session.page().unwrap()).unwrap().children.len();
+ let mut app = crate::FigApp::new(s, Box::new(TextClip("Pasted words".into())));
+ app.ui.right_tab = crate::RightTab::Inspect;
+ crate::menus::paste(&mut app, None, None);
+ assert_eq!(layers(&app), 0, "text doesn't paste into the design in Dev Mode");
+ app.services = Box::new(TextClip(format!("figcraft://comment/{c}")));
+ crate::menus::paste(&mut app, None, None);
+ assert_eq!(app.ui.comments.open, Some(c), "the link opens its thread");
+}
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index c93333b3..b123f6e5 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -99,6 +99,8 @@ mod design_paste_tests;
#[cfg(test)]
mod dev_mode_tests;
#[cfg(test)]
+mod devmode_tail_tests;
+#[cfg(test)]
mod duplicate_paint_tests;
#[cfg(test)]
mod export_preview_tests;
@@ -937,6 +939,22 @@ impl FigApp {
}
}
+ /// Dev Mode (the Inspect tab): the canvas measures on hover without Alt and edits nothing;
+ /// entering it ends editing text or vectors.
+ fn sync_dev_mode(&mut self) {
+ let dev = self.ui.right_tab == RightTab::Inspect;
+ if dev && !self.session.tool.dev_mode {
+ let _ = self.session.drop_gesture();
+ let editing = self.session.ds().map(|d| (d.text_edit.is_some(), d.vector_edit.is_some())).unwrap_or_default();
+ for (on, cmd) in [(editing.0, "text.edit.end"), (editing.1, "vector.edit.end")] {
+ if on {
+ self.run(cmd, json!({}));
+ }
+ }
+ }
+ self.session.tool.dev_mode = dev;
+ }
+
/// Leaving Design ends a pen path as Escape does and goes back to Move: Prototype and Inspect
/// don't draw (#307). Checked as the frame starts (the control channel) and after the panels
/// and shortcuts (the mode switcher, the tabs, Shift+E/Shift+D), before the canvas sees more.
@@ -1009,7 +1027,7 @@ impl FigApp {
}
"panel.versionHistory" => versions::open(self),
"view.devCompare" => {
- self.ui.dev.compare = r.data.get("id").and_then(figcraft_engine::params::id_of).map(dev_compare::CompareView::new);
+ self.ui.dev.compare = dev_compare::CompareView::requested(&r.data);
}
"panel.libraries" => {
self.ui.left_tab = LeftTab::Assets;
@@ -1575,8 +1593,7 @@ impl FigApp {
}
theme::set_doc_profile(&ctx, self.session.doc().map_or(figcraft_color::ColorProfile::Srgb, |d| d.color_profile));
widgets::set_nudge(&ctx, self.session.prefs.nudge_small, self.session.prefs.nudge_big);
- // The Inspect tab measures on hover without Alt.
- self.session.tool.redlines = self.ui.right_tab == RightTab::Inspect;
+ self.sync_dev_mode();
self.end_pen_outside_design();
tabs::tab_bar(self, ui);
if self.ui.present.is_some() {
@@ -1772,7 +1789,7 @@ impl FigApp {
"variables": self.ui.variables.is_some(),
"versionHistory": self.ui.versions.open,
"branchReview": self.ui.branch_review.as_ref().map(|r| json!({"id": r.id, "picks": r.picks, "mode": if r.mode == dev_compare::Mode::Overlay { "overlay" } else { "sideBySide" }})),
- "devCompare": self.ui.dev.compare.as_ref().map(|c| json!({"id": c.id, "mode": if c.mode == dev_compare::Mode::Overlay { "overlay" } else { "sideBySide" }, "split": c.split})),
+ "devCompare": self.ui.dev.compare.as_ref().map(|c| json!({"id": c.id, "mode": if c.mode == dev_compare::Mode::Overlay { "overlay" } else { "sideBySide" }, "split": c.split, "version": c.version})),
"devFocus": self.session.ds().ok().and_then(figcraft_engine::DocState::focused),
"annotationFilter": self.ui.dev.categories.id(),
"colorProfileDialog": self.ui.color_profile.map(|p| p.id()),
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 9659c6b3..db0c0458 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -35,9 +35,13 @@ pub const UI_COMMANDS: &[&str] = &[
/// `event_text` is the text the platform handed over with the paste event (the browser has no
/// other way to read it). `at`: the page point to paste at (Paste here); `None` pastes in the
/// middle of the view.
+/// In Dev Mode only a comment's link pastes (it opens the thread); everything else would edit.
pub fn paste(app: &mut FigApp, event_text: Option<&str>, at: Option<(f64, f64)>) {
// Only HTML that holds readable design data takes this path; other HTML pastes as before.
if let Some(html) = app.services.clipboard_get_html().filter(|h| figcraft_engine::cmd::edit::design_clipboard_buffer(h).is_some()) {
+ if dev_mode_refuses(app, "edit.paste") {
+ return;
+ }
let mut params = json!({"html": html});
if let Some((x, y)) = at {
params["x"] = json!(x);
@@ -58,6 +62,9 @@ pub fn paste(app: &mut FigApp, event_text: Option<&str>, at: Option<(f64, f64)>)
let (cx, cy) = at.or_else(|| app.session.ds().ok().map(|d| (d.view.cx, d.view.cy))).unwrap_or((0.0, 0.0));
if !ours {
if let Some((png, w, h)) = clipboard_png(app) {
+ if dev_mode_refuses(app, "edit.paste") {
+ return;
+ }
use base64::Engine as _;
let b64 = base64::engine::general_purpose::STANDARD.encode(png);
// Centred in the view; Paste here puts its top-left at the point, as it does layers.
@@ -67,20 +74,28 @@ pub fn paste(app: &mut FigApp, event_text: Option<&str>, at: Option<(f64, f64)>)
}
// Text from elsewhere when it's newer than our copy, or when we have nothing to paste.
if let Some(text) = sys_text.filter(|_| app.ui.last_copy.is_some() || app.session.clipboard.nodes.is_empty()) {
- // A comment's link opens its thread.
- if text.trim().starts_with("figcraft://comment/") {
- app.run("comment.open", json!({"link": text.trim()}));
- } else if figcraft_engine::looks_like_svg(&text) {
- use base64::Engine as _;
- let b64 = base64::engine::general_purpose::STANDARD.encode(text.as_bytes());
- app.run_user("file.import", json!({"data": b64, "name": "Pasted SVG.svg", "x": cx, "y": cy, "center": at.is_none()}));
- } else {
- app.run("text.create", json!({"text": text, "x": cx, "y": cy}));
- }
- return;
+ return paste_text(app, &text, (cx, cy), at.is_none());
}
}
- app.run("edit.paste", at.map_or(json!({}), |(x, y)| json!({"x": x, "y": y})));
+ if !dev_mode_refuses(app, "edit.paste") {
+ app.run("edit.paste", at.map_or(json!({}), |(x, y)| json!({"x": x, "y": y})));
+ }
+}
+
+/// Paste text from another app at `(cx, cy)` (`center`: centred there): a comment's link opens its
+/// thread, SVG imports, anything else becomes a text layer.
+fn paste_text(app: &mut FigApp, text: &str, (cx, cy): (f64, f64), center: bool) {
+ if text.trim().starts_with("figcraft://comment/") {
+ app.run("comment.open", json!({"link": text.trim()}));
+ } else if dev_mode_refuses(app, "edit.paste") {
+ // Dev Mode: the note says why nothing was pasted.
+ } else if figcraft_engine::looks_like_svg(text) {
+ use base64::Engine as _;
+ let b64 = base64::engine::general_purpose::STANDARD.encode(text.as_bytes());
+ app.run_user("file.import", json!({"data": b64, "name": "Pasted SVG.svg", "x": cx, "y": cy, "center": center}));
+ } else {
+ app.run("text.create", json!({"text": text, "x": cx, "y": cy}));
+ }
}
/// The system clipboard's image as PNG bytes, with its size.
@@ -92,6 +107,18 @@ fn clipboard_png(app: &mut FigApp) -> Option<(Vec, u32, u32)> {
Some((out.into_inner(), w, h))
}
+/// Dev Mode (the Inspect tab) refuses command `id` from the menus, shortcuts and clipboard: it
+/// edits the design ([`figcraft_engine::devinspect::dev_mode_allows`]). Says so when it does.
+/// shortcut: the layers panel (rename, reorder, hide, lock) and files dropped on the canvas still
+/// edit in Dev Mode; route them through here if people trip over it.
+pub fn dev_mode_refuses(app: &mut FigApp, id: &str) -> bool {
+ let refused = app.ui.right_tab == crate::RightTab::Inspect && !figcraft_engine::devinspect::dev_mode_allows(id);
+ if refused {
+ app.toast(tr("Dev Mode only inspects: switch to Design (Shift+D) to edit"));
+ }
+ refused
+}
+
/// The Actions palette's tab.
#[derive(Clone, Copy, PartialEq, Eq, Default)]
pub enum PaletteTab {
@@ -115,6 +142,9 @@ pub fn record_recent(app: &mut FigApp, key: &str) {
/// Run a menu, shortcut or palette action by id: actions that need the UI (dialogs, panels, the
/// clipboard) are handled here, the rest go to the engine.
pub fn invoke(app: &mut FigApp, id: &str) {
+ if dev_mode_refuses(app, id) {
+ return;
+ }
match id {
// Edit ▸ Delete (and the Delete binding) with an interaction open in the Prototype tab
// removes that interaction, not the layer (#767).
diff --git a/crates/ui-egui/src/plugin_panel_tests.rs b/crates/ui-egui/src/plugin_panel_tests.rs
index f154c629..e4bc6d4f 100644
--- a/crates/ui-egui/src/plugin_panel_tests.rs
+++ b/crates/ui-egui/src/plugin_panel_tests.rs
@@ -13,7 +13,7 @@ use crate::layers_drag_tests::Ui;
/// A plugin whose first call shows a panel with every kind of control and whose later calls (the
/// panel's events) make a rectangle.
-fn panel_module() -> Vec {
+pub(crate) fn panel_module() -> Vec {
let spec = json!({"title": "Test panel", "controls": [
{"type": "note", "label": "Hello from the plugin"},
{"type": "number", "name": "size", "label": "Size", "value": 10},
diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs
index c86cfdf1..a5af6a9c 100644
--- a/crates/ui-egui/src/shortcuts.rs
+++ b/crates/ui-egui/src/shortcuts.rs
@@ -210,6 +210,8 @@ pub fn swallowed_paste(app: &mut FigApp, ctx: &Context) -> Swallowed {
/// Run the command a shortcut is bound to, with the keyboard's own twists (Escape steps out
/// before it deselects, Delete ends a pen path, Enter edits the selected text or vector).
pub fn run_binding(app: &mut FigApp, id: &str) {
+ // Dev Mode places and edits nothing: Enter selects children.
+ let dev = app.ui.right_tab == crate::RightTab::Inspect;
match id {
"select.none" => {
if let Some(ctx) = &app.ui_context
@@ -226,10 +228,10 @@ pub fn run_binding(app: &mut FigApp, id: &str) {
let _ = app.session.pen_finish();
}
// Enter with a shape or frame tool chosen places one in the middle of the view.
- "select.children" if app.session.tool.tool.draws_shape() => {
+ "select.children" if !dev && app.session.tool.tool.draws_shape() => {
app.run("tool.place", json!({}));
}
- "select.children" if enter_text(app) => {}
+ "select.children" if !dev && enter_text(app) => {}
_ => crate::menus::invoke(app, id),
}
}
@@ -291,6 +293,8 @@ fn key_event(app: &mut FigApp, key: Key, physical: Option, m: Modifiers, re
if (dx, dy) != (0.0, 0.0) {
if app.session.selection().is_empty() {
app.run("view.pan", json!({"dx": dx, "dy": dy, "big": m.shift}));
+ } else if crate::menus::dev_mode_refuses(app, "transform.nudge") {
+ // Dev Mode: said so, nothing moves.
} else if m.command {
// Cmd/Ctrl+arrows resize: right/down grow, left/up shrink.
app.run("transform.nudgeSize", json!({"dw": dx, "dh": dy, "big": m.shift}));
@@ -387,6 +391,9 @@ pub fn opacity_digit(app: &mut FigApp, key: Key, now: f64) -> bool {
if !app.session.prefs.number_keys_opacity || app.session.selection().is_empty() {
return false;
}
+ if crate::menus::dev_mode_refuses(app, "object.opacityKeys") {
+ return true;
+ }
let first = app.ui.opacity_digit.take().filter(|(_, t)| now - t <= OPACITY_CHAIN_SECS).map(|(d, _)| d);
let digits = match first {
Some(f) => format!("{f}{d}"),
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index d92cdf06..a5ff426b 100644
--- a/crates/ui-egui/src/toolbar.rs
+++ b/crates/ui-egui/src/toolbar.rs
@@ -115,11 +115,12 @@ fn main_toolbar(app: &mut FigApp, ui: &mut Ui, canvas: Rect, t: &Tokens) {
if resp.clicked() {
// Enter (a keyboard click) on the shape or frame tool already chosen places one; the
// canvas takes the keyboard.
- if in_group && shown.draws_shape() && ui.input(|i| i.key_pressed(egui::Key::Enter)) {
+ // In Dev Mode the tool goes through `choose`, which returns to the design first.
+ if in_group && shown.draws_shape() && app.ui.right_tab != crate::RightTab::Inspect && ui.input(|i| i.key_pressed(egui::Key::Enter)) {
app.run("tool.place", json!({}));
app.ui.nav.go(Region::Canvas);
} else {
- app.run("tool.set", json!({"tool": shown.id()}));
+ choose(app, shown);
}
}
x += cell;
@@ -452,11 +453,20 @@ fn flyout(app: &mut FigApp, ui: &mut Ui, g: &Group, bottom_left: egui::Pos2) {
if let Some(i) = ToolId::ALL.iter().position(|x| *x == tid) {
ui.data_mut(|d| d.insert_temp(egui::Id::new(("tb_last", g.key)), i as u8));
}
- app.run("tool.set", json!({"tool": tid.id()}));
+ choose(app, tid);
app.ui.tool_flyout = None;
}
}
+/// Choose `tool` from the toolbar. Dev Mode only inspects: a tool that edits leaves it for the
+/// design.
+fn choose(app: &mut FigApp, tool: ToolId) {
+ if app.ui.right_tab == crate::RightTab::Inspect && !matches!(tool, ToolId::Move | ToolId::Hand | ToolId::Comment) {
+ app.ui.right_tab = crate::RightTab::Design;
+ }
+ app.run("tool.set", json!({"tool": tool.id()}));
+}
+
/// A tool group's flyout (an egui area).
fn flyout_id(key: &str) -> egui::Id {
egui::Id::new(("flyout_area", key))
diff --git a/docs/control-protocol.md b/docs/control-protocol.md
index c9ae5331..3941bd8a 100644
--- a/docs/control-protocol.md
+++ b/docs/control-protocol.md
@@ -256,7 +256,7 @@ separate calls. Returns `{queued}`.
Invoke a menu item exactly like clicking it (this may open a dialog). Returns `{ok, lastError}`.
-### `ui.set {rightTab?, leftTab?, theme?, home?, homeSection?, homeSearch?, homeRecentsView?, homeRecentsSort?, homeRecentsOrder?, palette?, mainMenu?, focusRegion?, colorPicker?, variables?, layerFilter?, collapseLayers?, exportPreview?, preview?, presentScroll?, colorProfileDialog?, stylePicker?, stylePickerEdit?, stylePickerView?, iconGallery?, protoEditor?, contextMenu?, contextSelectLayer?, commentOpen?, commentDraft?, commentFilter?, commentSort?, commentSearch?, commentReply?, commentEdit?, presentComments?, devCompare?, devCompareMode?, devCompareSplit?, annotationFilter?, resetFrameStats?, pluginsWindow?, pluginsTab?, pluginConfirm?, pluginForm?}`
+### `ui.set {rightTab?, leftTab?, theme?, home?, homeSection?, homeSearch?, homeRecentsView?, homeRecentsSort?, homeRecentsOrder?, palette?, mainMenu?, focusRegion?, colorPicker?, variables?, layerFilter?, collapseLayers?, exportPreview?, preview?, presentScroll?, colorProfileDialog?, stylePicker?, stylePickerEdit?, stylePickerView?, iconGallery?, protoEditor?, contextMenu?, contextSelectLayer?, commentOpen?, commentDraft?, commentFilter?, commentSort?, commentSearch?, commentReply?, commentEdit?, presentComments?, devCompare?, devCompareMode?, devCompareSplit?, annotationFilter?, resetFrameStats?, pluginsWindow?, pluginsTab?, pluginConfirm?, pluginForm?, devCompareVersion?}`
Switch panels and modes: `rightTab` `design|prototype|inspect`, `leftTab` `file|assets`, `theme`,
`home` (bool), `homeSection` (`recents`, `online` or `templates`: which section the home screen shows, as `ui.inspect` reports it; opening
@@ -293,13 +293,14 @@ closes it), `commentDraft` (`{x, y}`: start a new comment there), `commentFilter
text, focused with the cursor at its end: an `@` there shows the mention picker), `commentEdit` (a
message index of the open thread to edit, 0 for the first; `null` stops), `presentComments` (bool:
the presenter shows the presented frame's comments, also Shift+C there). Dev Mode: `devCompare` (a
-ready-for-dev frame or section id opens the Compare changes view, like `dev.compare {id, show:
-true}`; `null` closes it) with `devCompareMode` (`sideBySide|overlay`) and `devCompareSplit` (the
+frame or section id opens the Compare changes view, like `dev.compare {id, show:
+true}`; `null` closes it) with `devCompareVersion` (a version id to compare with; `null`: when it
+was marked ready for dev), `devCompareMode` (`sideBySide|overlay`) and `devCompareSplit` (the
overlay slider, 0–1), `annotationFilter` (`all`, `none` for uncategorised, or a category id or name:
the annotations the canvas shows). `resetFrameStats` (true: start `framesDrawn` and
`repaintCauses` over). Returns `ui.inspect` (which reports `stylePicker`,
`stylePickerView`, `comments`: `open`, `draft`, `filter`, `sort`, `search`, `editing` and the
-`mentions` the picker offers, `devCompare` (`{id, mode, split}` or `null`), `devFocus` (the frame the
+`mentions` the picker offers, `devCompare` (`{id, mode, split, version}` or `null`), `devFocus` (the frame the
focus view shows, or `null`) and `annotationFilter`).
### `ui.screenshot {path?}`
diff --git a/docs/dev-mode-parity.md b/docs/dev-mode-parity.md
index cba5e81d..bf3cc737 100644
--- a/docs/dev-mode-parity.md
+++ b/docs/dev-mode-parity.md
@@ -1,23 +1,26 @@
# Dev Mode parity
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (dev resources links; inspect behaviour suite and fixes: colour formats, rem, blend, positions from the frame, CSS for rotation, gradients and text, icons and images as assets; code connect and Dev Mode plugins) · **Target:** Figma Design Dev Mode (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (import lines in generated layer trees; compare with any saved version; Dev Mode behaviour suite: an inspect-only canvas, Changed in the ready list, statuses only on frames and sections; plugin panels from the Inspect tab) · **Target:** Figma Design Dev Mode (desktop app 126.10.7)
-**Breadth ~96%, ready ~72% (estimated).** The inspect surface is broad, components connect
-to the code components of a repository and layers carry dev resources links; left: import lines
-inside generated layer trees. Remaining: 0–1 h.
+**Breadth ~97%, ready ~76% (estimated).** The inspect surface is broad, components connect
+to the code components of a repository (with their imports, also inside generated layer trees),
+changes compare with any saved version and the canvas only inspects in Dev Mode. Left: measurements
+kept on the canvas, a read-only layers panel in Dev Mode, publishing mappings from the code
+repository. Remaining: 2–4 h.
| Feature | Status | Notes |
|---|---|---|
-| Dev Mode toggle (Shift+D), Inspect panel | done | |
+| Dev Mode toggle (Shift+D), Inspect panel | done | the canvas only inspects: presses select, pan and comment but never move, resize, draw or edit text and vectors; menus and shortcuts refuse design edits with a note (Dev Mode's annotations, statuses, dev resources, code connections and comments still work); a drawing tool chosen in the toolbar goes back to the design. The layers panel and dropped files still edit (ours to tighten) |
| Properties with their styles and variables; redlines on hover | done | positions from the frame around the layer (groups aren't frames), rotation, radius (CSS corner order), opacity, blend; colours in hex, RGB, CSS, HSL or HSB (`inspect.properties {colorFormat}`, the Inspect tab's Color format) |
| Code: CSS, iOS (SwiftUI), Android (Compose) | done | plus HTML, React and Leptos (ours; Leptos: `#[component]` functions with `#[prop]` defaults, variant enums and `view!` markup); components take properties as parameters, instances are calls; CSS in px or rem (`inspect.code {unit, rootFontSize}`), with rotation, blend modes, gradient directions and kinds (linear, radial, conic), text alignment, case and decoration |
| Assets list with export | done | layers with export settings, icons (small, vector shapes only: SVG) and images (PNG); the icon rule is ours |
| Annotations: pinned properties, categories, coloured callouts, filter | done | |
-| Ready for dev list, statuses, "Changed" after edits | done | |
+| Ready for dev list, statuses, "Changed" after edits | done | the list filters Ready for dev, Changed, Completed or any, and badges changed ones (`inspect.readyForDev {status: changed}`, `changed` per item); only sections and frames at the top of a page or section take a status (others are refused) |
| Focus view (one frame, previous / next) | done | |
-| Compare changes (before/after side by side or overlaid, property diffs) | done | only against the snapshot taken when a frame was marked ready; not against any named version |
-| Code connect (map components to repository code) | done | per language (React, Leptos, SwiftUI, Compose): import path, name and a template with `{property}` and `{property ? "a" : "b"}` placeholders; instances (also inside generated layer trees) show the snippet with their values; edited in the Inspect panel with a live preview; `figcraft.connect.json` export/import. Inside a generated layer tree, connected instances' imports aren't collected |
-| Plugins in Dev Mode (Jira, GitHub, etc.) | partial | FigCraft's own WASM plugins that only read run from the Inspect tab; no plugin UI at run time, no third-party integrations |
+| Compare changes (before/after side by side or overlaid, property diffs) | done | against the snapshot taken when a frame was first changed after it was marked ready, or any saved version (`dev.compare {version}`; the view's Compare with menu); a frame that isn't ready for dev compares with versions |
+| Code connect (map components to repository code) | done | per language (React, Leptos, SwiftUI, Compose): import path, name and a template with `{property}` and `{property ? "a" : "b"}` placeholders; instances (also inside generated layer trees) show the snippet with their values; edited in the Inspect panel with a live preview; `figcraft.connect.json` export/import; generated layer trees bring the import lines of the connected components they call (also in definitions, slots and swapped-in instances) once each at the top, per language. No CLI publishing mappings from the code repository |
+| Plugins in Dev Mode (Jira, GitHub, etc.) | partial | FigCraft's own WASM plugins that only read run from the Inspect tab, with their panels (callbacks can only read); no third-party integrations |
+| Measurements (redlines on hover, Alt in the design) | partial | distances between the selection and the hovered layer, its parent or a guide, auto layout padding and gaps (Shift+Alt); measurements kept on the canvas for others aren't there |
| VS Code extension | out of scope | FigCraft's MCP server and control channel already serve design data, code and connected snippets to agents and editors |
| Dev resources links on layers | done | a URL and a name per link on any layer (`devResource.*`, saved, synced, undoable); instances list their main component's (and its set's) read-only; URLs checked as http/https and never fetched (no page titles: a link without a name is named after its URL); the Inspect tab lists, adds, edits and removes them; `get_node` returns them |
@@ -25,6 +28,7 @@ inside generated layer trees. Remaining: 0–1 h.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Dev Mode tail (gap 16): generated layer trees (React, Leptos, SwiftUI, Compose) start with the import lines of the connected components they call, once each, also those in a component's definition, in slots an instance fills and placed by a connected template's instance swaps; Compare changes takes any saved version as the before (`dev.compare {version}`, the view's Compare with menu; frames that aren't ready for dev compare with versions). Behaviour suite (5 tests; 4 failed before the fixes): the Dev Mode canvas only inspects (no moving, resizing, drawing, text or vector editing; menus, shortcuts, nudges, opacity keys and paste refuse design edits with a note; toolbar drawing tools go back to the design), the ready list filters and badges Changed items, statuses are refused on layers inside frames. Read-only plugins run from the Inspect tab show their panels (the runtime's panels, reused). Breadth 96% → 97% (measurements kept on the canvas and the read-only layers panel counted as missing), ready 72% → 76%, 0–1 h → 2–4 h |
| 2026-10-12 | minor | Dev resources (gap 16): links for developers (a URL and a name) on any layer: `devResource.add` / `edit` / `remove` / `list`, undoable, saved and synced; an instance also lists its main component's (and that component's set's) links read-only with where they come from, and layers inside an instance show their main layer's; URLs are checked as web links (http or https, a host, no spaces, at most 2,048 characters) and never fetched (a link added without a name is named after its URL), opened only when clicked; the Inspect tab lists, adds, edits and removes them; `get_node` and `inspect_document` return them as `devResources`. The editor extension stays out of scope (the MCP server serves agents and editors). Dev Mode breadth 93% → 96%, ready 70% → 72%, 1–3 h → 0–1 h; feature breadth (~82%) and ready for real work (~51%) unchanged at this rounding; full parity ~304–593 h → ~303–591 h |
| 2026-10-11 | minor | Export and inspect behaviour suite written from the public documentation (139 cases in 19 tests; 47 failed before the fixes) and its fixes: an export covers what the layer paints, so a drop shadow adds room only where it falls, strokes on boxes and ellipses reach their real width (they added up to four times as much), hidden layers take no room and a mask group exports the mask's area; a slice exports everything under it; slashes in layer names export into folders; Copy as PNG copies the whole selection. Added: the export settings' contents only and include bounding box, and for SVG outline text (off writes ``), unique id attributes and simplified strokes (stroke attributes where exact); Inspect colour formats (hex, RGB, CSS, HSL, HSB), CSS in rem, a Blend row, positions measured from the frame around a layer (groups aren't frames), CSS for rotation, blend modes, gradient directions and kinds, text alignment, case and decoration; icons and images in the asset list (`file.exportLayers {assets}`). Dev Mode breadth 90% → 93%, ready 64% → 70%, hours unchanged (1–3, dev resources); feature breadth and ready for real work unchanged at this rounding |
| 2026-10-11 | minor | Code connect and Dev Mode plugins (gap 16): a component or set links to its code component per language (import path, name, a template with `{property}` and `{property ? "a" : "b"}` placeholders); `inspect.code`, `inspect.componentCode` and the Inspect panel show that snippet with the instance's values (also inside generated layer trees), edited in Connect to code with a live preview; links are saved, synced and undoable, and travel as `figcraft.connect.json` (`codeConnect.export` / `codeConnect.import`). Plugins that only read run from the Inspect tab. Dev Mode breadth 80% → 90%, ready 62% → 64%, 4–8 h → 1–3 h; feature breadth (~79%) and ready for real work (~47%) unchanged; full parity ~380–725 h → ~375–720 h |
diff --git a/docs/gaps.md b/docs/gaps.md
index 936d2047..7b89cc20 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Where FigCraft falls short of Figma
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail) · **Target:** Figma Design (desktop app 126.10.7)
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-17 · **Change:** minor (Dev Mode tail: import lines in layer trees, compare with versions, an inspect-only canvas; gap 5: reviewed Turkish, Czech and Indonesian drafts, the Japanese draft completed; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail; the 2026-10-17 landings: `.fig` import fidelity, budgets for large files, the import report, a `.fig` copy from Save as and paste from another design app (gap 1); menus, the Actions palette, editor fixes, Selection colors and smart-selection spacing (gap 4); catalog counts re-measured (gap 5); bounded canvas pan overscan; reviewed Russian catalog and integer plurals; `.fig` export: instance sizes, variables with modes, shared styles, variable-width strokes; sharing with a join code; text box sizes measured against documents re-saved by other software; live sessions per document; .fig export checked by opening written files in other software; experimental .fig export; keyboard shortcut parity suite and bindings; Simplified Chinese draft catalog; Latin American Spanish overlay; prototyping tail: gamepad triggers, widgets in prototypes, mode lookups; plugin directory on figcraft-server; Japanese and Korean draft catalogs and CJK UI fonts; plugin widgets and the plugin panel tail; French, German and Brazilian Portuguese draft catalogs; cursor chat and spotlight in live sessions; layers and assets panels behaviour suite and fixes; vector multi-edit and edit tail; dev resources links; extended collections tail; branch version history and finer list merges; comments and version history behaviour suite and fixes; canvas navigation, guides and grids behaviour suite and fixes; `.fig` import: editable vector networks, more layer kinds, variable prototype actions; `.fig` import, best effort: gap 1 down to its tail; Windows QA pass: everyday workflows on Windows 11, eight fixes incl. unsaved work kept after a crash or a forced quit; Display P3: gamut warning and soft-proof (true P3 blocked upstream); several windows; localization layer with a draft Spanish catalog; hosting figcraft-server: wss in the desktop app, server releases, deployment guide; plugin panels and settings; canvas fixes: boolean hit testing on the result, group drags, frame outlines and slices; code connect; stretch and scatter brushes, pen pressure; text on a path and pattern fills; team libraries on the server and swap library; branches: create, update from main, review and merge; animated GIF fills and TIFF images; Open recent, outlines for the selection and mask outlines: menu breadth 100%; extended collections, variables import/export, gradient stop and variant bindings: gap 14 down to its tail) · **Target:** Figma Design (desktop app 126.10.7)
Every known shortfall against Figma, one entry each, ranked by how much it stops a Figma user from
doing real work in FigCraft. Agents: pick work from the top unless the owner says otherwise. The
@@ -29,7 +29,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
| 13 | Vector tail: none left (boolean hit testing on the result landed 2026-10-11) | Feature | — | [target-app-parity](target-app-parity.md) |
| 14 | Variables: extended collections checked on real libraries (the tail landed 2026-10-12) | Feature | 0–1 | [components-parity](components-parity.md) |
| 15 | Prototyping: media triggers and actions; controllers on macOS, Linux and FreeBSD (controller buttons on key/gamepad triggers, widgets in prototypes landed) | Feature | 2–5 | [prototyping-parity](prototyping-parity.md) |
-| 16 | Dev Mode: import lines inside generated layer trees; the editor extension is left to the MCP server (code connect, Dev Mode plugins and dev resources landed) | Feature | 0–1 | [dev-mode-parity](dev-mode-parity.md) |
+| 16 | Dev Mode: measurements kept on the canvas, a read-only layers panel, publishing mappings from the code repository; the editor extension is left to the MCP server (import lines, compare with versions and an inspect-only canvas landed 2026-10-15) | Feature | 2–4 | [dev-mode-parity](dev-mode-parity.md) |
| 17 | Branching: branches in live sessions, lists other than fills, strokes and effects merged whole (a branch's own version history and per-item list merges landed 2026-10-12) | Feature | 1–2 | [collaboration-parity](collaboration-parity.md) |
| 18 | Display P3 on screen: blocked upstream (egui-wgpu picks an 8-bit sRGB surface); gamut warning and soft-proof sRGB landed, as did several windows | Hardware | 4–8 | [hardware-parity](hardware-parity.md) |
| 19 | AI features | AI | 30–60 | [target-app-parity](target-app-parity.md) |
@@ -371,11 +371,22 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
host, no spaces, capped) and never fetched: a link added without a name is named after its URL,
and a link opens only when clicked. The Inspect tab lists, adds, edits and removes them;
`get_node` / `inspect_document` return them as `devResources`.
-- **Missing:** import lines for connected instances inside a
- generated layer tree (only the selected layer's own import is shown); publishing mappings from
- the code repository with a CLI. An editor extension is out of scope: the MCP server already
- serves design data, code and the connected snippets to agents and editors.
-- **Estimate:** 0–1 h.
+- **Landed (2026-10-15):** generated layer trees (React, Leptos, SwiftUI, Compose) start with the
+ import lines of the connected components they call, once each, also those in a component's
+ definition, in the slots an instance fills and placed by a connected template's instance swaps.
+ Compare changes takes any saved version as the before (`dev.compare {version}`; the view's
+ Compare with menu), for any top-level frame or section. A Dev Mode behaviour suite: the canvas
+ only inspects (presses select, pan and comment; no moving, resizing, drawing, text or vector
+ editing), the menus, shortcuts, nudges, opacity keys and paste refuse design edits with a note
+ while Dev Mode's own edits still run, drawing tools from the toolbar return to the design; the
+ ready list filters and badges Changed items (`inspect.readyForDev {status: changed}`); statuses
+ are refused on layers inside frames. Read-only plugins run from the Inspect tab show their
+ panels.
+- **Missing:** measurements kept on the canvas for others (only hover redlines); the layers panel
+ and files dropped on the canvas still edit in Dev Mode; publishing mappings from the code
+ repository with a CLI. An editor extension is out of scope: the MCP server already serves design
+ data, code and the connected snippets to agents and editors.
+- **Estimate:** 2–4 h.
### 17. Branching and merging
- **Landed (2026-10-11):** branches of a file (`branch.*`): File ▸ Create branch… (or the Branches
@@ -447,6 +458,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
| 2026-10-15 | minor | Gap 5: Turkish reviewed by a native speaker (#263), Czech (#469) and Indonesian (#477) drafts, the Japanese draft caught up (#288); Indonesian is no longer missing; counts re-measured (2,177 entries) and corrected: only Spanish is held to completeness, Russian included. Estimate unchanged at this rounding |
| 2026-10-17 | minor | The 2026-10-17 landings. Gap 1: a new Landed entry (community batches #727 and #728, then #745: instance identity and cached library components, overrides by key, text style precedence, grid track sizes, slot content, labels of connectors saved with their path, skip ink, paragraph options, list start numbers, vertical trim, per-point stroke joins, text on a path, image adjustments, images in the message, instance layers' size and resizing overrides, Hug where nothing is recorded; budgets from the file's size; the import report; a `.fig` copy from Save as; paste from another design app), its Missing list cut to what is still left, and the wrong "whether other apps open its files is unknown" replaced by what was checked; all on synthetic files, so the beta blocker and hours stand. Gap 2: server limits, log recovery and web join links in the evidence. Gap 4: menus, the Actions palette and the editor fixes (#733, #735, #736, #729), then Selection colors and smart-selection spacing (#753) landed, none compared side by side. Gap 5: catalog counts re-measured (2,272 entries; drafts at 95–99%; Indonesian, Czech, Turkish and Swedish listed). Gap 8: the Linux and BSD clipboard changes and Wayland window controls, not run there by the maintainers. Ranking and hours unchanged |
| 2026-10-15 | minor | Gap 7: bounded canvas overscan for smoother panning. Estimates and ranking unchanged. |
+| 2026-10-15 | minor | Gap 16: import lines inside generated layer trees, compare with any saved version, an inspect-only Dev Mode canvas (menus and shortcuts refuse design edits), Changed in the ready list, statuses only on sections and top-level frames, read-only plugins' panels from the Inspect tab. Left: measurements kept on the canvas, a read-only layers panel, publishing mappings with a CLI; 0–1 h → 2–4 h |
| 2026-10-14 | minor | Russian catalog (M9), reviewed and approved by VanTan: all 2,165 current entries, Русский in Preferences and regional ru tags. Russian integer plurals use one/few/many; contributor display name VanTan added. Existing estimates unchanged. |
| 2026-10-13 | minor | Gap 1: the experimental `.fig` export writes instance sizes (resized, filling an auto layout, scaled), variables with modes and bindings, shared styles and variable-width strokes, and the import reads them back. Checked by opening written files in other software: resized and scaled instances keep their size and lay their layers out for it, variables with their modes and colour bindings resolve there (a frame set to another mode shows that mode's colours, also inside instances), colour, text, effect and grid styles are listed, and variable-width strokes that are the same on both sides of the path draw with their width; number, string and boolean bindings and bindings on effects, layout guides and gradient stops come across as the values they give but did not show as bound there (their entries now also name the layer field they set, not yet checked there), and strokes wider on one side of the path are written as filled outlines, no longer editable strokes there (the stroke itself is kept as plugin data and our own import puts it back; not yet checked there). Hours and the ranking unchanged |
| 2026-10-12 | minor | Gap 2: your online files landed (the app records the files it put on a server with their owner tokens, Home ▸ Online lists them and opens them again as their owner, with sharing, rename, removal and forget from the list; one request per server tells which are still there; tabs mark files in a live session). What is left is unchanged: accounts, teams and per-person permissions, shared comments and versions. Hours unchanged |
diff --git a/docs/mcp.md b/docs/mcp.md
index 211b98d8..1b235b49 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -1302,7 +1302,9 @@ permissions: without it nothing is downloaded); `plugin.directory.publish {path
strings, any other `{…}` stays as written (`unknown` lists placeholder names that aren't
properties). Then `inspect.code` on an instance or the component returns the import line and the
snippet instead of generated code (`connected: true`), connected instances inside a generated
- layer tree are their snippet, and `inspect.componentCode` returns `connected: {importPath, name,
+ layer tree (also in a component's definition, in the content an instance puts in its slots, and
+ the components a connected template's instance swaps place) are their snippet with their import
+ lines once each at the top of the code, per language, and `inspect.componentCode` returns `connected: {importPath, name,
template, import, code}` with the snippet as `usage`. Example: template `` with import path
`@acme/ui` gives `import { Button } from "@acme/ui";` then `