Doc conflicts only (docs/components-parity.md, docs/ui-parity.md): kept main's header and changelog rows and added this PR's #2090 Scale tool clause and row next to them.
Copying a main component in a library file and pasting it into another
file made a copy of the main there: a new component of that file, not
linked to the library. Copy then Paste of a main in its own file already
makes an instance, and pasting an instance from the library file already
uses the main from the library. Now a main the source file publishes is
an instance of it from that library too, which gets enabled the same way,
as Figma does with a published component. A variant is an instance of that
variant.
A main the library doesn't offer (hidden from publishing, added since the
last publish) and a main from a file that publishes no library still paste
as a copy. Making those an instance as well was rejected: their main would
stay in the other file, so the instance would show a missing main.
The part of adopt_pasted that brings published components in is now
from_published, shared with the new published_main.
Switching an instance to another variant matched its old layers to the
new variant's by source and then by name path. When the two variants nest
the same text layer differently (text > Label in one, div > text > Label
in the other), the path differs, the typed layer matched nothing, and the
new variant's own text came back.
A text layer of the new variant that nothing else matched now takes the
old text layer of the same name, when exactly one layer on each side has
that name. Two of one name stay unmatched, since either could be the one
typed into. Layers inside nested instances are left to their own mains'
rebuild, so a text layer never moves between instances.
Matching every layer kind by name alone was left out: a fill or size kept
from another place in the tree would land on a layer that only shares a
name, while text is what was typed and the layer most likely to be the
same one.
The swap removes the old library's copies that nothing uses before it
starts (a component imported but not placed, a variable imported but not
bound), and its result said nothing about them. It now lists them in
`dropped`, apart from copies that went because what used them moved.
library.swap re-pointed style links and variable bindings only on layers
outside the read-only library copies. A copy the swap keeps (no match in
the other library, or another library's component using the swapped
style) kept the old style and variable, so instances placed after the
swap showed the old colours. The copies' own layers are re-pointed too.
Enabled libraries were read from disk only by the Assets panel
(refresh_libraries ran from its show). After a file with enabled
libraries was opened, the Design panel's style pickers found none in
the cache, and a library's text styles weren't offered ("No text styles
yet") until the Assets tab had been opened once.
refresh_libraries now runs from the app's background tick, whichever
tab shows, and reads a local library not read yet at once instead of
waiting out the 2 s throttle. A library the read refuses (too large, or
not on this computer) is never cached, so the tick remembers the paths
it last tried and tries those again only after the throttle; otherwise
it would read again every frame. The periodic repaint that picks up a
library changed on disk stays with the Assets panel, so an idle window
isn't woken every 2 s; the panel's doc comment now describes that
repaint.
The style picker gets Figma's source menu under the search field when
the file has enabled libraries: All libraries (the default, the list as
before), This file, or one library, kept while the picker is open. A
library that goes away falls back to All libraries.
With a group selected in the Local variables window, + Create variable
named the new variable after its type alone ("Number"), so it went to
the collection's top level. The table, showing the group, didn't show
it; only All variables did. In Figma it's made in the group shown.
Duplicate already kept the group (the copy is "space/sm copy").
The new variable's name now starts with the group shown. Its name opens
for editing right away, and the row's field edited the whole name while
the row shows only the last part, so typing a name over the new grouped
variable would have moved it straight back out of the group. The field
now edits the part shown and keeps the group; the Edit variable window
still edits the whole name, which is where a variable moves between
groups by typing.
A name typed there with nothing but slashes and spaces is ignored, as an
empty one is: under the group it would clean up to the group's own name
and drop the variable out of it. Creating a collection clears the group
shown, as picking another collection does, so its first variable isn't
named after a group of the collection shown before.
With two or more instances selected the Design panel showed no instance
properties, so changing a variant or a property meant selecting each
instance in turn. instance.setProperties already took several ids.
The panel now shows the variant, boolean, text and instance-swap
properties the selected instances share, matched by name and type. A
variant property lists only the values every one of their sets has, so
the command can't be refused for one of them. Where the values differ
the row reads Mixed (a dropdown's label, the text field's placeholder,
the checkbox's third state), and a value chosen there is set on every
selected instance in one step. A selection with any layer that isn't an
instance shows none of this. Slots are filled one instance at a time,
so their rows show only for one.
A single instance goes through the same code with one id. One
difference: a single instance's slot property whose slot can't be
found now shows no row, where it showed a label with nothing beside it.
swap_dropdown takes `mixed` to label such a row.
A text field that reads Mixed changes nothing when committed empty: the
field reports its text on every Enter or focus loss, edited or not, so
an empty commit there can't be told from a click in and out.
Linking imported instances to their mains (and detaching an outer
instance, or restoring a main) finds overrides by comparing each layer
with its main layer, and compared values only. A layer bound to a
variable its main layer doesn't bind, resolving to the main's colour,
therefore wasn't an override. The next copy or edit of the main reset it
to the main's unbound paint: in a file using a library, a button's icon
lost the colour variable the library's button gave it, while the label
next to it, whose main binds the variable, kept it.
rebase_instance now adds the groups whose bindings differ from the main
layer's (diff::rebound_groups), as record_overrides already did for a
binding made in an instance. record_overrides no longer clears such an
override when an edit sets the value back to the main's (hiding and
showing the fill). Bindings are compared by what they bind, so `fill`
and `fills/0/color` are one binding.
Copying a variant and pasting with that variant, a layer in it or its set
selected pasted an instance on the page: the set was not a place paste
could put layers, and a copied main component pastes as an instance of
it. Copied variants of one set now paste into that set as new variants
(deep copies, like Duplicate makes), under the copied variants where they
are now and below the lowest variant with a gap of 20 as Add variant
places one, and the set grows to hold them.
Only a plain edit.paste with the copied variants' own set, or a layer in
it, selected does this: paste decides it and passes it to paste_into's
worker, which also checks the target is that set. Inferring it from the
parent being a component set made copies of the mains for every other
paste into a set too. Those keep making instances: a variant pasted with
another set selected, a main that is no variant pasted with a set
selected, Paste over and Paste to replace on a sibling variant, and an
explicit parent, even the variant's own set. Each has a test.
copying_a_variant_pastes_an_instance_but_copying_its_set_keeps_the_components
now pastes with nothing selected for its instance case.
Publishing keeps the variables its styles bind and where its copies of other libraries' assets came
from; importing files such a copy under that library when the file links it.
Applying a style or variable, 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 over the chosen period.
A property added to a set goes to all its variants (component.addProperty), but
Combine as variants kept each component's own definitions, so a property made
on one component before combining was missing from the others: their layers
couldn't be bound to it ("the component has no property") and an instance
switched to one of them dropped its value. make_variant_set now gives every
variant the properties any of them has (share_props, through the give_prop step
addProperty uses too); a variant with a property of that name keeps its own.
Tests: variant_shared_props_tests.
In a hugging parent, Fill on the other axis follows the line the way
Figma does, instead of forcing the parent Fixed. This also covers item 2
of #2090 on both axes: a hugging main that becomes Fixed is followed by
its instances' roots.
Fixes#2091 item 3. Fixes#2034. Fixes item 2 of #2090.
A text field that isn't being edited painted its whole value clipped to the field, so the variant value "Down left" read "Down lef". It now paints the value shortened with an ellipsis to fit, and hovering shows the whole value (not for a secret field). Editing and screen readers keep the whole value.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
At 480 points the table was 279 wide, leaving 11 points next to the 220-point search field for a library collection's Extend collection button. The minimum is now 600 x 240 (table 399 wide); the default size's clamp uses the same minimum. variables 43 passed, clippy clean (CodeRabbit on #2363).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window was fixed at 880 x 480. It now resizes from every edge and corner, down to 480 x 240 and up to the screen less a margin, and its header, sidebar and table follow its current size. Egui's memory keeps the size and place while the app runs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
Renaming a group in the Local variables window replaced every slash in the
typed name with a hyphen, so "Palette/Orange" gave a flat Palette-Orange
group and there was no way to move a group under a new parent.
The typed path now replaces the group's last part, so a slash nests the
group as in Figma: Orange/100 becomes Palette/Orange/100 and the sidebar
shows Orange under Palette. Each part is trimmed and empty parts are
dropped; a name that comes out empty or unchanged does nothing. The
renames go deepest name first, so a group moved into its own new subgroup
(Orange to Orange/Warm) never collides with a variable that is still to
move. A rename onto a variable name that stays is refused by
variable.update and the batch rolls back; it stays one undo step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium