Merge pull request #2575 from ljkx/fix/2568-library-swap-copies

M3: Swap library re-points the styles and variables of the copies it keeps (#2568)
This commit is contained in:
BFlat authored and GitHub committed 2026-11-27 16:10:29 +07:00
commit cd046d74cb
3 files changed
+168 -11

No files matched your search

+44 -9
View File
@@ -101,6 +101,36 @@ fn copies_of(doc: &Document, from: &str) -> Vec<(String, String)> {
components.chain(styles).chain(variables).chain(collections).collect()
}
/// A layer's explicit modes after a swap: a mode of A's collection becomes B's mode of the same
/// name (`colls`: A's collection → B's, and A's mode ids → B's), and stays as well while that
/// collection still has a variable on A (`still_a`). A mode the layer already chose of B's
/// collection wins over one moved from A's.
fn move_modes(
old: BTreeMap<String, String>,
colls: &BTreeMap<String, (String, BTreeMap<String, String>)>,
still_a: &BTreeSet<String>,
) -> BTreeMap<String, String> {
let mut out = BTreeMap::new();
let mut moved = Vec::new();
for (c, mode) in old {
match colls.get(&c).and_then(|(b, modes)| modes.get(&mode).map(|bm| (b.clone(), bm.clone()))) {
Some(to) => {
moved.push(to);
if still_a.contains(&c) {
out.insert(c, mode);
}
}
None => {
out.insert(c, mode);
}
}
}
for (c, mode) in moved {
out.entry(c).or_insert(mode);
}
out
}
/// Swap the copies of library `from` in `doc` to library `to` by names (see the module docs).
pub fn swap_library(doc: &mut Document, from: &str, to: &PublishedLibrary) -> Result<Swapped> {
let m = &to.manifest;
@@ -245,8 +275,19 @@ pub fn swap_library(doc: &mut Document, from: &str, to: &PublishedLibrary) -> Re
out.unmatched.push(format!("extended collection {}", c.name));
}
// Re-point layers outside the library copies, and local variables aliasing A's.
let ids: Vec<NodeId> = doc.nodes().filter(|n| outside(doc, n.id)).map(|n| n.id).collect();
// Re-point the layers, and local variables aliasing A's. The library copies' own layers too:
// a copy B has no match for stays (A's, or another library's), and instances placed from it
// later must link what the ones re-pointed here link (#2568).
// A's collections that keep a variable on A (one B has no match for): a layer choosing a mode
// of one keeps that choice next to B's, so what still reads the A variable keeps its mode.
let still_a: BTreeSet<String> = doc
.libraries
.variables
.iter()
.filter(|r| r.library == from && !vars.contains_key(&r.local))
.filter_map(|r| doc.variables.get_by_id(&r.local).map(|v| v.collection.clone()))
.collect();
let ids: Vec<NodeId> = doc.nodes().map(|n| n.id).collect();
for id in ids {
let Ok(n) = doc.get_mut(id) else { continue };
for r in [&mut n.styles.fill, &mut n.styles.stroke, &mut n.styles.effect, &mut n.styles.grid, &mut n.styles.text] {
@@ -262,13 +303,7 @@ pub fn swap_library(doc: &mut Document, from: &str, to: &PublishedLibrary) -> Re
*v = b.clone();
}
}
n.var_modes = std::mem::take(&mut n.var_modes)
.into_iter()
.map(|(c, mode)| match colls.get(&c).and_then(|(b, modes)| modes.get(&mode).map(|bm| (b.clone(), bm.clone()))) {
Some(moved) => moved,
None => (c, mode),
})
.collect();
n.var_modes = move_modes(std::mem::take(&mut n.var_modes), &colls, &still_a);
}
for v in doc.variables.variables.iter_mut().filter(|v| !remote.contains(&v.id)) {
for r in v.values.values_mut().flat_map(VariableValue::references_mut) {
+121 -1
View File
@@ -31,6 +31,12 @@ impl Drop for Scratch {
/// A library file at `path` with "Button" (filled `color`, a "Label" text), a "Brand" paint style,
/// a "Theme" collection with an `accent` colour, and `extra` components; returns its id.
fn library(path: &str, color: &str, extra: &[&str]) -> String {
library_with(path, color, extra, false)
}
/// [`library`], and with `linked` also "Badge", filled by the Brand style, and "Dot", its fill
/// bound to `accent`: components whose own layers link the library's style and variable.
fn library_with(path: &str, color: &str, extra: &[&str], linked: bool) -> String {
let mut s = Session::new();
let f = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 100, "height": 40, "name": "Button"})));
ex(&mut s, "text.create", json!({"text": "OK", "x": 10, "y": 10, "parent": f, "props": {"name": "Label"}}));
@@ -41,6 +47,17 @@ fn library(path: &str, color: &str, extra: &[&str]) -> String {
ex(&mut s, "style.create", json!({"type": "paint", "name": "Brand", "from": r}));
ex(&mut s, "variable.createCollection", json!({"name": "Theme", "modes": ["Light", "Dark"]}));
ex(&mut s, "variable.create", json!({"collection": "Theme", "name": "accent", "type": "color", "value": color}));
if linked {
let badge = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 300, "width": 30, "height": 30, "name": "Badge"})));
ex(&mut s, "style.apply", json!({"ids": [badge], "style": "Brand"}));
let dot = idv(&ex(&mut s, "frame.create", json!({"x": 50, "y": 300, "width": 30, "height": 30, "name": "Dot"})));
ex(&mut s, "variable.bind", json!({"ids": [dot], "field": "fill", "variable": "accent"}));
ex(&mut s, "component.create", json!({"ids": [badge]}));
ex(&mut s, "component.create", json!({"ids": [dot]}));
// A Theme variable no other library has, with a value of its own in Dark.
ex(&mut s, "variable.create", json!({"collection": "Theme", "name": "glow", "type": "color", "value": "#111111"}));
ex(&mut s, "variable.set", json!({"variable": "glow", "mode": "Dark", "value": "#222222"}));
}
for (i, name) in extra.iter().enumerate() {
let e = idv(&ex(&mut s, "frame.create", json!({"x": 200 + 50 * i, "y": 0, "width": 20, "height": 20, "name": name})));
ex(&mut s, "component.create", json!({"ids": [e]}));
@@ -60,10 +77,15 @@ fn main_of(s: &Session, inst: NodeId) -> NodeId {
/// A session with libraries A (blue, plus `extra_a` components) and B (green) enabled, files in a
/// scratch directory named by `tag`; returns the directory guard, the session and both library ids.
fn two_libraries(tag: &str, extra_a: &[&str]) -> (Scratch, Session, String, String) {
two_libraries_with(tag, extra_a, false)
}
/// [`two_libraries`], with A made by [`library_with`] and `linked_a`.
fn two_libraries_with(tag: &str, extra_a: &[&str], linked_a: bool) -> (Scratch, Session, String, String) {
let dir = Scratch(std::env::temp_dir().join(format!("figcraft-libswap-{tag}-{}", std::process::id())));
std::fs::create_dir_all(&dir.0).unwrap();
let (pa, pb) = (dir.0.join("a.figcraft").to_string_lossy().into_owned(), dir.0.join("b.figcraft").to_string_lossy().into_owned());
let a = library(&pa, "#0000ff", extra_a);
let a = library_with(&pa, "#0000ff", extra_a, linked_a);
let b = library(&pb, "#00ff00", &[]);
let mut s = Session::new();
ex(&mut s, "library.add", json!({"path": pa}));
@@ -215,3 +237,101 @@ fn swap_lists_the_unused_copies_it_removes() {
assert_eq!((&r["unmatched"], &r["removed"]), (&json!(["component Only in A"]), &json!(false)), "{r}");
assert_eq!(library_of(s.doc().unwrap(), main_of(&s, kept)), Some(a.as_str()));
}
/// A component B has no match for stays on A, but the Brand style and `accent` variable its own
/// layers link do have matches (#2568). The swap re-points them in A's read-only copy as on the
/// placed instances, so an instance placed after the swap looks like the ones placed before it,
/// and A's style and variable copies nothing links any more go.
#[test]
fn swap_repoints_the_styles_and_variables_of_component_copies_it_keeps() {
let (_dir, mut s, a, b) = two_libraries_with("copies", &[], true);
let badge = idv(&ex(&mut s, "library.place", json!({"library": a, "component": "Badge", "x": 0, "y": 0})));
let dot = idv(&ex(&mut s, "library.place", json!({"library": a, "component": "Dot", "x": 100, "y": 0})));
let fill = |s: &Session, id: NodeId| s.doc().unwrap().node(id).unwrap().fills[0].solid_color().unwrap().to_hex();
assert_eq!((fill(&s, badge), fill(&s, dot)), ("0000FF".to_string(), "0000FF".to_string()));
let r = ex(&mut s, "library.swap", json!({"from": a, "to": b}));
assert_eq!((r["components"].as_u64(), r["styles"].as_u64(), r["variables"].as_u64()), (Some(0), Some(1), Some(1)), "{r}");
assert_eq!(r["unmatched"], json!(["component Badge", "component Dot"]), "{r}");
let (badge_main, dot_main) = (main_of(&s, badge), main_of(&s, dot));
let doc = s.doc().unwrap();
assert_eq!((library_of(doc, badge_main), library_of(doc, dot_main)), (Some(a.as_str()), Some(a.as_str())), "no match: still A's");
// The copies link B's style and variable, as the instances do.
for (id, what) in [(badge_main, "the Badge copy"), (badge, "the Badge instance")] {
let style = doc.node(id).unwrap().styles.fill.clone().unwrap_or_default();
assert!(doc.libraries.style_import(&style).is_some_and(|i| i.library == b), "{what} links {style}");
}
for (id, what) in [(dot_main, "the Dot copy"), (dot, "the Dot instance")] {
let bound = doc.node(id).unwrap().bound.get("fill").cloned().unwrap_or_default();
assert!(doc.libraries.variable_import(&bound).is_some_and(|i| i.library == b), "{what} binds {bound}");
}
assert!(doc.libraries.styles.iter().all(|i| i.library == b), "A's Brand copy is linked by nothing: {:?}", doc.libraries.styles);
assert!(doc.libraries.variables.iter().all(|i| i.library == b), "A's accent copy is bound by nothing: {:?}", doc.libraries.variables);
assert!(doc.validate().is_empty(), "{:?}", doc.validate());
// Instances placed after the swap show B's colours, as those placed before it.
let late_badge = idv(&ex(&mut s, "instance.create", json!({"component": badge_main, "x": 0, "y": 100})));
let late_dot = idv(&ex(&mut s, "instance.create", json!({"component": dot_main, "x": 100, "y": 100})));
let shown: Vec<String> = [badge, dot, late_badge, late_dot].iter().map(|i| fill(&s, *i)).collect();
assert_eq!(shown, ["00FF00"; 4]);
// One undo of each instance and the swap puts the copies back on A's style and variable.
s.undo().unwrap();
s.undo().unwrap();
s.undo().unwrap();
let doc = s.doc().unwrap();
let style = doc.node(badge_main).unwrap().styles.fill.clone().unwrap_or_default();
assert!(doc.libraries.style_import(&style).is_some_and(|i| i.library == a), "{style}");
let bound = doc.node(dot_main).unwrap().bound.get("fill").cloned().unwrap_or_default();
assert!(doc.libraries.variable_import(&bound).is_some_and(|i| i.library == a), "{bound}");
assert_eq!((fill(&s, badge), fill(&s, dot)), ("0000FF".to_string(), "0000FF".to_string()));
}
/// A frame choosing A's Theme mode Dark holds a layer bound to `accent` (B has it) and one bound
/// to `glow` (only A has it). The swap gives the frame B's Dark for `accent` and keeps A's Dark for
/// `glow`, which stays on A, so it doesn't fall back to Light.
#[test]
fn swap_keeps_the_mode_of_a_collection_that_still_has_a_variable_on_the_old_library() {
let (_dir, mut s, a, b) = two_libraries_with("modes", &[], true);
let frame = idv(&ex(&mut s, "frame.create", json!({"x": 0, "y": 0, "width": 100, "height": 100})));
let rect = |s: &mut Session, x: f64| idv(&ex(s, "shape.rectangle", json!({"x": x, "y": 0, "width": 10, "height": 10, "parent": frame})));
let (accent, glow) = (rect(&mut s, 0.0), rect(&mut s, 20.0));
ex(&mut s, "library.bindVariable", json!({"library": a, "variable": "accent", "field": "fill", "ids": [accent]}));
ex(&mut s, "library.bindVariable", json!({"library": a, "variable": "glow", "field": "fill", "ids": [glow]}));
ex(&mut s, "library.setVariableMode", json!({"library": a, "collection": "Theme", "mode": "Dark", "ids": [frame]}));
let fill = |s: &Session, id: NodeId| s.doc().unwrap().node(id).unwrap().fills[0].solid_color().unwrap().to_hex();
assert_eq!(fill(&s, glow), "222222", "Dark before the swap");
let r = ex(&mut s, "library.swap", json!({"from": a, "to": b}));
assert_eq!((r["variables"].as_u64(), &r["unmatched"]), (Some(1), &json!(["variable Theme/glow"])), "{r}");
let doc = s.doc().unwrap();
let modes = &doc.node(frame).unwrap().var_modes;
let lib = |c: &str| doc.libraries.collection_import(c).map(|r| r.library.clone());
let mut owners: Vec<Option<String>> = modes.keys().map(|c| lib(c)).collect();
owners.sort();
let mut expected = vec![Some(a.clone()), Some(b.clone())];
expected.sort();
assert_eq!(owners, expected, "B's Theme mode, and A's kept: {modes:?}");
assert_eq!((fill(&s, accent), fill(&s, glow)), ("00FF00".to_string(), "222222".to_string()), "glow stays on A's Dark");
// A mode chosen of B's Theme since wins over A's Dark moved onto it by a second swap.
ex(&mut s, "library.setVariableMode", json!({"library": b, "collection": "Theme", "mode": "Light", "ids": [frame]}));
ex(&mut s, "library.swap", json!({"from": a, "to": b}));
assert_eq!(fill(&s, accent), "00FF00", "B's Light kept");
let doc = s.doc().unwrap();
let b_mode = doc
.node(frame)
.unwrap()
.var_modes
.iter()
.find(|(c, _)| doc.libraries.collection_import(c).is_some_and(|r| r.library == b))
.map(|(c, m)| (c.clone(), m.clone()));
let (b_coll, mode) = b_mode.unwrap();
assert_eq!(doc.variables.collection_by_id(&b_coll).and_then(|c| c.mode_by_id(&mode)).map(|m| m.name.as_str()), Some("Light"));
// With nothing left on A's Theme, its mode goes with it.
ex(&mut s, "edit.delete", json!({"ids": [glow]}));
ex(&mut s, "library.swap", json!({"from": a, "to": b}));
let doc = s.doc().unwrap();
assert!(doc.node(frame).unwrap().var_modes.keys().all(|c| doc.libraries.collection_import(c).is_some_and(|r| r.library == b)));
}
+3 -1
View File
@@ -1,6 +1,6 @@
# Components, variants, styles and variables parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-27 · **Change:** minor (the Local variables window reorders variables: Move up and Move down (Alt+↑ / Alt+↓) on a row, Sort A to Z and Z to A on a collection or group, numbers by value (#2633); `library.swap` lists the unused copies of the old library it removes in `dropped` (#2569); with several instances selected, the Design panel shows the properties they share, Mixed where their values differ, and sets a value on all of them; an enabled library's styles are offered in the style pickers without opening the Assets tab first, and the picker filters its list by source (All libraries, This file, one library); with a variable group shown in the Local variables window, Create variable makes the variable in that group, and renaming a variable in its row changes the part shown and keeps its group; a layer inside an instance bound to a variable its main layer doesn't bind keeps that binding as an override when instances are relinked after an import, a detach or a restore, and when its value is set back to the main's, so a library copy or an edit of the main no longer drops it; switching variants keeps the text typed into an instance when the other variant nests that text layer in other frames, matched by its name; a main component copied from a library file and pasted into another file is an instance of it from that library, instead of a new main; copied variants pasted with their own set, or a layer in it, selected join the set as new variants; the Scale tool keeps variable-bound lengths scaled: a scaled instance keeps its bindings and draws them at the variable's value times its scale factor, other scaled layers keep the scaled value and drop the binding (#2090); a style of one library that reaches a file through another library's component is, in a file linking both, the first library's own bound copy, so its modes colour it (#2414); with a variant selected, its property dropdowns show its own values and choosing one renames only that variant, instead of setting the set's default and moving the variants (#2349); library analytics count insertions and detachments of styles and variables; combining components gives every variant the properties any of them had; renaming a variable group to a path with `/` nests it under a parent group instead of turning the slash into a hyphen (#2353); a group's context menu in the Local variables window has Duplicate group, a copy named after it plus " 2" holding a copy of every variable, in one undo step (#2084); pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215); a text style binds a number variable to its weight (#2174); an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; Delete on a layer inside an instance hides it as an override instead of being refused, as the help center says: "Figma will only toggle the layer's visibility instead of removing it"; library analytics list how many layers and files use each style and variable; SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; a typed or stored variable, collection or mode id names only the object with that id (#1613); colour variables can be calculated from other colours per mode — `{alpha}` replaces a colour's alpha, `{mix}` blends two — and follow them (#1280); stored variable and collection references keep their identity when another object is named like their id (follow-up to #1542); a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; opening a file contacts no team library server it names until you check it (#1097); an explicit variables file pLine truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-27 · **Change:** minor (Swap library re-points the styles and variables of the library copies that stay, so instances placed after a swap follow it too (#2568); the Local variables window reorders variables: Move up and Move down (Alt+↑ / Alt+↓) on a row, Sort A to Z and Z to A on a collection or group, numbers by value (#2633); `library.swap` lists the unused copies of the old library it removes in `dropped` (#2569); with several instances selected, the Design panel shows the properties they share, Mixed where their values differ, and sets a value on all of them; an enabled library's styles are offered in the style pickers without opening the Assets tab first, and the picker filters its list by source (All libraries, This file, one library); with a variable group shown in the Local variables window, Create variable makes the variable in that group, and renaming a variable in its row changes the part shown and keeps its group; a layer inside an instance bound to a variable its main layer doesn't bind keeps that binding as an override when instances are relinked after an import, a detach or a restore, and when its value is set back to the main's, so a library copy or an edit of the main no longer drops it; switching variants keeps the text typed into an instance when the other variant nests that text layer in other frames, matched by its name; a main component copied from a library file and pasted into another file is an instance of it from that library, instead of a new main; copied variants pasted with their own set, or a layer in it, selected join the set as new variants; the Scale tool keeps variable-bound lengths scaled: a scaled instance keeps its bindings and draws them at the variable's value times its scale factor, other scaled layers keep the scaled value and drop the binding (#2090); a style of one library that reaches a file through another library's component is, in a file linking both, the first library's own bound copy, so its modes colour it (#2414); with a variant selected, its property dropdowns show its own values and choosing one renames only that variant, instead of setting the set's default and moving the variants (#2349); library analytics count insertions and detachments of styles and variables; combining components gives every variant the properties any of them had; renaming a variable group to a path with `/` nests it under a parent group instead of turning the slash into a hyphen (#2353); a group's context menu in the Local variables window has Duplicate group, a copy named after it plus " 2" holding a copy of every variable, in one undo step (#2084); pages take a variable mode: with nothing selected the Design panel's Page section shows a Variable modes section, Auto or a mode of each collection that has more than one, as the help center says ("Apply variable mode" in the Page section of the right sidebar) (#2215); a text style binds a number variable to its weight (#2174); an instance lists only the properties its variant's layers use and long property names are cut to one line (#2022); with several layers selected the Design panel header's component button offers Create multiple components (#2088); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); text styles carry paragraph spacing and indent, the list style and the OpenType features, as the Supported in text styles table of Create and apply text styles says (#1829); a layer's effect binding takes only a field its effect has; Go to main component on an instance of a library component opens the library file in a tab and selects the main there; glass effects take variables; Delete on a layer inside an instance hides it as an override instead of being refused, as the help center says: "Figma will only toggle the layer's visibility instead of removing it"; library analytics list how many layers and files use each style and variable; SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; a typed or stored variable, collection or mode id names only the object with that id (#1613); colour variables can be calculated from other colours per mode — `{alpha}` replaces a colour's alpha, `{mix}` blends two — and follow them (#1280); stored variable and collection references keep their identity when another object is named like their id (follow-up to #1542); a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every Line truncated
Design systems are why teams adopt Figma. **Components: breadth ~96%, ready ~72%. Styles and
variables: breadth ~95%, ready ~76% (estimated).** QA'd with a synthetic design system of ~300
@@ -57,6 +57,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`.
| Team libraries: publish to a `figcraft-server` under the file, enable by a share link (a view link reads it), background update checks | done | [server.md](server.md#team-libraries); no team-wide library list or accounts ([gaps](gaps.md) #10) |
| Library analytics | partial | instances per component and the files using them, and the instances each file detached (per component and per file), as apps report them; insertions and detachments week by week for a year (Show usage: the past 30 days, 90 days or year), for components; the layers and files using each style and variable, with their insertions and detachments over the same periods, no modes; no chart |
| Swap library (instances, styles and variables to another library's of the same names, overrides kept) | done | what has no match stays and is listed; one undo step; copies nothing used before the swap (imported, never placed or bound) are removed and listed in `dropped` (#2569) |
| Swap library (instances, styles and variables to another library's of the same names, overrides kept) | done | what has no match stays and is listed; one undo step; a library copy that stays (no match, or another library's) links the swapped styles and variables too, so instances placed after the swap look like those placed before it (`library_swap/tests.rs`, #2568) |
## Styles and variables
@@ -90,6 +91,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`.
| 2026-11-18 | patch | M3: enabled libraries were read only while the Assets panel showed, so after a file was opened the Design panel's style pickers offered none of their styles (a library's text styles read "No text styles yet") until the Assets tab had been opened. They are refreshed from the app's background tick now, a local library not read yet at once. The style picker has a source menu under its search field, as in Figma: All libraries (the default), This file, or one enabled library. Test: `style_picker::tests::a_reopened_files_text_styles_picker_lists_its_librarys_styles_without_the_assets_tab` |
| 2026-11-23 | patch | M3, #2569: `library.swap {from, to}` removes `from`'s copies that nothing in the file uses before it starts (a component imported with `library.import` but not placed, a variable imported but not bound), as `library.remove` does, but its result didn't say so: `{"components": 0, "unmatched": [], "removed": true}` after an imported component had been deleted. The result now names them in `dropped` (`component auth-button`, `variable Theme/accent`, `collection Theme`), apart from copies that went because what used them moved to `to`. Test: `library_swap/tests.rs` (`swap_lists_the_unused_copies_it_removes`) |
| 2026-11-27 | minor | M3, #2633: variables in the Local variables window stayed in creation order. A row's menu has Move up and Move down (Alt+↑ / Alt+↓ with one row selected), moving it past its neighbour in its group; a collection's and a group's menus have Sort A to Z and Sort Z to A, by name with each run of digits compared as a number, so `50, 100, 200 … 950` come in that order. The order is the stored one, so files, exports and the variable pickers follow it. New commands `variable.move {variables, before?}` and `variable.sort {collection, group?, descending?}`, one undo step each. Drag to reorder is not built. Tests: `variables_editor_tests::moving_variables_reorders_their_collection_only_and_undoes`, `variables_editor_tests::sorting_orders_numbers_by_value_within_the_group_asked`. Grade unchanged. |
| 2026-11-23 | patch | M3, #2568: `library.swap {from, to}` re-pointed style links and variable bindings only on layers outside the read-only library copies. A copy the swap keeps (a component of `from` that `to` has no match for, or another library's component using `from`'s style) kept `from`'s style and variable, so instances placed after the swap showed the old colours while those placed before showed the new ones. The swap now re-points the copies' own layers too, with the same maps, and `from`'s style and variable copies that nothing links any more go. A layer's explicit mode for one of `from`'s collections stays next to `to`'s while a variable of that collection is left on `from` (no match), so that variable keeps its mode instead of falling back to the default. Tests: `library_swap/tests.rs` (`swap_repoints_the_styles_and_variables_of_component_copies_it_keeps`, `swap_keeps_the_mode_of_a_collection_that_still_has_a_variable_on_the_old_library`) |
| 2026-11-19 | patch | M3, #2414: a kit's style used by a component of a second library reached a file linking both as a second, unbound copy (`<auth>:<kit>:S:1`) frozen in the kit's default mode, so a mode set on the kit's collection didn't colour it (from two hops on, every such style). Publishing now keeps the variables the published styles bind and where the file's copies of other libraries' styles, variables and collections came from; importing files such a copy under that library when the file links it, so it is the file's own bound copy. Test: `library_style_hops_tests::a_kit_style_through_another_library_is_the_kits_bound_copy`; the issue's four-file chain renders Brand and Alt everywhere. Grade unchanged. |
| 2026-11-19 | patch | M3, #2349: with one variant of a set selected, the Design panel's variant property dropdowns showed the set's default values, and choosing a value set the default, so the variants swapped places. They now show the selected variant's own values (hover: "This variant's value"), and choosing one renames that variant only; with the set selected they still set its default. Test: `variant_own_value_tests::a_selected_variants_dropdown_shows_and_sets_its_own_value`. Grade unchanged. |
| 2026-11-18 | minor | M3, gap 10: library analytics count insertions and detachments of styles and variables. Applying one, or copying or duplicating content that uses it, inserts it; the Detach button detaches it; an instance counts as its component alone. Show usage and `library.usage` give them per style and variable over the chosen period. Modes aren't counted. Numbers unchanged. Tests: `library_asset_counts_tests`, `library_assets_tests`. |