mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-01 22:36:51 -06:00
M3: component properties keep their order on rename; Make slot asks for the name (#1536, #1537) (#1565)
Properties were listed by name, so a rename moved one. Components now keep prop_order (the names as they were made; a rename keeps the place) and every listing follows it. Make slot opens a name field under the frame's Slot row; Enter makes the slot, Escape cancels, a taken name keeps the field open.
This commit is contained in:
@@ -469,7 +469,7 @@ fn components_sets_instances_and_properties() {
|
||||
assert_eq!(set.stroke.dashes, vec![10.0, 5.0]);
|
||||
let def = named(&doc, "State=Default");
|
||||
let icon = named(&doc, "Icon");
|
||||
let NodeKind::Component { description, props } = &def.kind else { panic!() };
|
||||
let NodeKind::Component { description, props, .. } = &def.kind else { panic!() };
|
||||
assert_eq!(description, "Primary button");
|
||||
assert_eq!(props.get("Label"), Some(&PropDef::Text { default: "OK".into() }), "{props:?}");
|
||||
assert_eq!(props.get("Icon"), Some(&PropDef::InstanceSwap { default: icon.id, preferred: Vec::new() }));
|
||||
@@ -477,7 +477,7 @@ fn components_sets_instances_and_properties() {
|
||||
let NodeKind::Component { props: hover_props, .. } = &named(&doc, "State=Hover").kind else { panic!() };
|
||||
assert!(hover_props.contains_key("Label"), "variants share the set's definitions");
|
||||
assert!(
|
||||
matches!(&icon.kind, NodeKind::Component { description, props } if description == "An icon" && props.get("Show") == Some(&PropDef::Boolean { default: true }))
|
||||
matches!(&icon.kind, NodeKind::Component { description, props, .. } if description == "An icon" && props.get("Show") == Some(&PropDef::Boolean { default: true }))
|
||||
);
|
||||
let label = doc.node(def.children[0]).unwrap();
|
||||
assert_eq!(label.prop_refs.get("characters").map(String::as_str), Some("Label"));
|
||||
|
||||
Reference in New Issue
Block a user