From 6bfbd9ccf4bbf970f4a47718abe33cb5719344df Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 6 Dec 2026 02:11:22 +0700 Subject: [PATCH] M3: a publish refusal gives each left-out asset's id beside its name A name can be shared, or read as a style or collection id, so listing it in include or exclude could select another asset. The id selects only it. --- crates/engine/src/assets/library/tests.rs | 15 ++++++++++----- crates/engine/src/cmd/library.rs | 16 ++++++++-------- docs/components-parity.md | 4 ++-- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/crates/engine/src/assets/library/tests.rs b/crates/engine/src/assets/library/tests.rs index 0023049cf..306c7005d 100644 --- a/crates/engine/src/assets/library/tests.rs +++ b/crates/engine/src/assets/library/tests.rs @@ -837,8 +837,8 @@ fn an_include_that_leaves_out_offered_assets_is_refused() { ex(&mut s, "library.publish", json!({"include": [k.card]})); } -/// The refusal names a left-out asset as it is called now, so that name works in `include` or -/// `exclude`: a component renamed since the last version is not named by its old name. +/// The refusal names a left-out asset as it is called now, not by its name in the last version, +/// and gives the id that selects only it: a name can be shared, or read as a style's id. #[test] fn a_refusal_names_a_renamed_asset_by_its_current_name() { let mut s = Session::new(); @@ -846,8 +846,13 @@ fn a_refusal_names_a_renamed_asset_by_its_current_name() { ex(&mut s, "library.publish", json!({})); ex(&mut s, "node.set", json!({"id": k.button, "props": {"name": "Primary button"}})); let e = s.execute("library.publish", &json!({"include": [k.card, "Brand"]})).unwrap_err().to_string(); - assert!(e.contains("\"Primary button\""), "{e}"); + assert!(e.contains(&format!("\"Primary button\" ({})", k.button.0)), "{e}"); assert!(!e.contains("\"Button\""), "{e}"); - let r = ex(&mut s, "library.publish", json!({"include": [k.card, "Brand"], "exclude": ["Primary button"]})); - assert_eq!(r["components"], 1, "{r}"); + // Renamed to the style's id, the component's name would select the style; its id selects it. + let style = s.doc().unwrap().styles[0].id.clone(); + ex(&mut s, "node.set", json!({"id": k.button, "props": {"name": style}})); + let e = s.execute("library.publish", &json!({"include": [k.card, style]})).unwrap_err().to_string(); + assert!(e.contains(&format!("\"{style}\" ({})", k.button.0)), "{e}"); + let r = ex(&mut s, "library.publish", json!({"include": [k.card, style], "exclude": [k.button.0]})); + assert_eq!((r["components"].as_u64(), r["styles"].as_u64()), (Some(1), Some(1)), "{r}"); } diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rs index 92d0d0363..d42ccf501 100644 --- a/crates/engine/src/cmd/library.rs +++ b/crates/engine/src/cmd/library.rs @@ -339,7 +339,7 @@ fn publish_args(cmd: &str, doc: &Document, p: &Value, prev: Option<&LibraryManif return Err(bad( cmd, format!( - "the last version offered {} that `include` leaves out: add them to `include` to keep offering them, or name them in `exclude` to stop", + "the last version offered {} that `include` leaves out: add their ids (in brackets) to `include` to keep offering them, or to `exclude` to stop", left_out.join(", ") ), )); @@ -352,26 +352,26 @@ fn publish_args(cmd: &str, doc: &Document, p: &Value, prev: Option<&LibraryManif Ok((sel, description)) } -/// The names, as `doc` has them now, of the assets `prev` offered that are still publishable (`all`) -/// and not hidden, but neither `sel` nor `exclude` lists. Current names, since `include` and -/// `exclude` resolve names in `doc`: an asset renamed since `prev` is named as it can be listed. +/// The assets `prev` offered that are still publishable (`all`) and not hidden, but neither `sel` +/// nor `exclude` lists: each `"name" (id)`, its name as `doc` has it now and its id as `include` and +/// `exclude` take it. The id, since a name can be shared or read as a style or collection id. fn withdrawn(doc: &Document, prev: &LibraryManifest, all: &Selection, sel: &Selection, exclude: &Selection) -> Vec { - let shown = |name: Option<&str>| name.filter(|n| !crate::library::hidden_name(n)).map(|n| format!("\"{n}\"")); + let shown = |name: Option<&str>, id: Value| name.filter(|n| !crate::library::hidden_name(n)).map(|n| format!("\"{n}\" ({id})")); let components = prev .components .iter() .filter(|a| a.published && all.components.contains(&a.id) && !sel.components.contains(&a.id) && !exclude.components.contains(&a.id)) - .filter_map(|a| shown(doc.node(a.id).map(|n| n.name.as_str()))); + .filter_map(|a| shown(doc.node(a.id).map(|n| n.name.as_str()), json!(a.id.0))); let styles = prev .styles .iter() .filter(|st| st.published && all.styles.contains(&st.id) && !sel.styles.contains(&st.id) && !exclude.styles.contains(&st.id)) - .filter_map(|st| shown(doc.style(&st.id).map(|x| x.name.as_str()))); + .filter_map(|st| shown(doc.style(&st.id).map(|x| x.name.as_str()), json!(st.id))); let collections = prev .collections .iter() .filter(|c| c.published && all.collections.contains(&c.id) && !sel.collections.contains(&c.id) && !exclude.collections.contains(&c.id)) - .filter_map(|c| shown(doc.variables.collection_by_id(&c.id).map(|x| x.name.as_str()))); + .filter_map(|c| shown(doc.variables.collection_by_id(&c.id).map(|x| x.name.as_str()), json!(c.id))); components.chain(styles).chain(collections).collect() } diff --git a/docs/components-parity.md b/docs/components-parity.md index 1b89f3cd1..3377b61a2 100644 --- a/docs/components-parity.md +++ b/docs/components-parity.md @@ -1,6 +1,6 @@ # Components, variants, styles and variables parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-05 · **Change:** patch (a publish refusal names a renamed asset by its current name; a publish no longer stops offering assets its `include` merely leaves out; deleting this file's variables, a collection or a mode works when a library component's hidden copy, as a Figma import keeps them, is bound to them (#3030); a selected variant's Current variant section also lists the set's boolean, text and instance swap properties at their defaults (#3020); a scaled instance keeps its scale in another variant; a "+" under a selected variant adds a copy beside it, named after its value with " copy", to type a new value for; the Local variables window sorts its table as a view: a sort dropdown beside the search field and sortable Name and mode column headers, the stored order kept; the Collections header and a collection's Sort A to Z / Z to A sort the collections, not their variables, `variable.sortCollections` (#3000); variables export as Uno Platform theme resources, #2170; frames a REST import made of instances of library components link to an enabled library's component of the same key with Link instances to library, `library.relink` (#2442); a text or instance swap property's default follows its bound layer on the main and the main follows a new default, and a new instance of a variant shows that variant's own text and icon (#2179); variables export and import as DTCG design tokens (#1687); one variant selected shows a Current variant section, a dropdown of each variant property at its value, and a button that selects the set, which has the property editor (#2346); `node.set` warns when a variant reaches past a component set that clips it and has no auto layout (#2182); a page's background can follow a colour variable in the page's own mode, set from the Page section's variable button or `page.setBackground {color: {$var}}` (#2343); 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; the local variables JSON carries the file's text styles (`textStyles` in `variable.export`, read back by `variable.import` with their variable bindings re-pointed; a file's own export leaves its text styles alone) (#2173); 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 path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); component properties keep the order they were made in when one is renamed, and Make slot asks for the slot's name first (#1536, #1537); components can't contain their own instances, directly or through others (#1084); the instance-swap menus have a search field (#1338); an instance-swap property's default menu scrolls (#1338); variables on a text style's fields from the style editor; instance-swap properties in the component playground; duplicating or Alt-dragging a main component makes an instance of it (#892); a bound colour variable's alpha applies once (#802); variables import reads `variables` outside `meta` and warns when it imports none (#790); variant properties reorder by drag; library files saved right after a read are read again; Hide when publishing note corrected; size and resizing overrides of layers inside instances (#731); variables export in the browser as a download; core editor leftovers: component playground, variables inside styles; layers and assets panels behaviour suite and fixes; extended collections tail; styles and variables behaviour suite and fixes; components behaviour suite and fixes; team libraries on the server, library usage and swapping a library; extended collections, variables import/export, gradient stops and variant properties bound to variables) · **Target:** Figma Design (desktop app 126.10.7) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-05 · **Change:** patch (a publish refusal names a renamed asset by its current name and gives each asset's id; a publish no longer stops offering assets its `include` merely leaves out; deleting this file's variables, a collection or a mode works when a library component's hidden copy, as a Figma import keeps them, is bound to them (#3030); a selected variant's Current variant section also lists the set's boolean, text and instance swap properties at their defaults (#3020); a scaled instance keeps its scale in another variant; a "+" under a selected variant adds a copy beside it, named after its value with " copy", to type a new value for; the Local variables window sorts its table as a view: a sort dropdown beside the search field and sortable Name and mode column headers, the stored order kept; the Collections header and a collection's Sort A to Z / Z to A sort the collections, not their variables, `variable.sortCollections` (#3000); variables export as Uno Platform theme resources, #2170; frames a REST import made of instances of library components link to an enabled library's component of the same key with Link instances to library, `library.relink` (#2442); a text or instance swap property's default follows its bound layer on the main and the main follows a new default, and a new instance of a variant shows that variant's own text and icon (#2179); variables export and import as DTCG design tokens (#1687); one variant selected shows a Current variant section, a dropdown of each variant property at its value, and a button that selects the set, which has the property editor (#2346); `node.set` warns when a variant reaches past a component set that clips it and has no auto layout (#2182); a page's background can follow a colour variable in the page's own mode, set from the Page section's variable button or `page.setBackground {color: {$var}}` (#2343); 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; the local variables JSON carries the file's text styles (`textStyles` in `variable.export`, read back by `variable.import` with their variable bindings re-pointed; a file's own export leaves its text styles alone) (#2173); 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 path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); component properties keep the order they were made in when one is renamed, and Make slot asks for the slot's name first (#1536, #1537); components can't contain their own instances, directly or through others (#1084); the instance-swap menus have a search field (#1338); an instance-swap property's default menu scrolls (#1338); variables on a text style's fields from the style editor; instance-swap properties in the component playground; duplicating or Alt-dragging a main component makes an instance of it (#892); a bound colour variable's alpha applies once (#802); variables import reads `variables` outside `meta` and warns when it imports none (#790); variant properties reorder by drag; library files saved right after a read are read again; Hide when publishing note corrected; size and resizing overrides of layers inside instances (#731); variables export in the browser as a download; core editor leftovers: component playground, variables inside styles; layers and assets panels behaviour suite and fixes; extended collections tail; styles and variables behaviour suite and fixes; components behaviour suite and fixes; team libraries on the server, library usage and swapping a library; extended collections, variables import/export, gradient stops and variant properties bound to variables) · **Target:** Figma Design (desktop app 126.10.7) 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 @@ -85,7 +85,7 @@ updates with overrides kept: `library_tests.rs`, `components_scale_tests.rs`. | Date | Change | Summary | |---|---|---| -| 2026-12-05 | patch | M3, #3039 follow-up: a publish refused for leaving out assets the last version offered named them as that version did, so a component renamed since then was named by its old name, which `include` and `exclude` don't resolve, and the suggested way on failed. The refusal names them as the file has them now. Tests: `library::tests::a_refusal_names_a_renamed_asset_by_its_current_name`. Numbers unchanged | +| 2026-12-05 | patch | M3, #3039 follow-up: a publish refused for leaving out assets the last version offered named them as that version did, so a component renamed since then was named by its old name, which `include` and `exclude` don't resolve, and the suggested way on failed. The refusal names them as the file has them now, each with the id that selects only it, since a name can be shared or read as a style or collection id. Tests: `library::tests::a_refusal_names_a_renamed_asset_by_its_current_name`. Numbers unchanged | | 2026-12-04 | minor | M3: `library.publish {include}` took the list as everything the library offers, so an agent publishing the one component it had changed (`include: [cart-line]`) stopped offering the other 20 components, all 9 styles and both variable collections, silently, and the next default publish kept that choice. Pasting one of those components into another file then made a new component instead of a library instance. A publish whose `include` leaves out a component, style or collection the last version offered (and still publishable, not hidden by a `.` or `_` name) is now refused, naming them, unless `exclude` names them: listing them keeps them offered, excluding them withdraws them. The publish form, to this file or to its server, sends what it has unchecked as `exclude`. Tests: `library::tests::an_include_that_leaves_out_offered_assets_is_refused`, `publish_withdraw_tests::unchecking_an_offered_style_publishes_without_it`; `publishing_collections_hides_and_versions_variables` now names the collection it withdraws. Numbers unchanged | | 2026-12-04 | patch | M3, #3020: the Create component property menu offers Boolean first and says that Variant creates a component set when used on a lone component. Test: `component_set_narrow_tests::the_create_property_menu_offers_boolean_first_and_leaves_the_component_on_its_own`. | | 2026-12-04 | patch | M3, #3030: a file imported from Figma keeps the mains of library components on its hidden library page, bound to the file's own variables. Deleting such a variable, its collection or a mode was refused as an edit of a library copy, so the variables couldn't be removed. Those three deletions now also drop the copies' references to what they delete; the copies keep the values they show, and every other edit of a library copy, or of a library variable, stays refused. Test: `variables_editor_tests::deleting_local_variables_reaches_library_copies_using_them`. |