22 Commits

Author SHA1 Message Date
alonso.torres
312a3ce6f0 🐛 Move combined mains into the variant one at a time in combine order
Combining same-name components as variants gives each one the first
unused "Value N", in the order the mains enter the variant container.
`generate-combine-as-variants` moved all the remaining mains in one
relocation, which takes them in layer order, so the values followed the
layers and not the combine order. It now moves them one at a time, in
the order of the ids, as the frontend combine on develop does.

Test: `test-combine-as-variants-same-name-values-follow-combine-order`.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |   :now |  :mean | :ratio |
|------------------------------------+-----------+--------+--------+--------|
|  deepest-edit-through-three-levels |    35.215 | 20.749 | 21.213 |   0.59 |
| edit-through-a-chain-of-dependents |    68.931 | 40.771 | 41.457 |   0.59 |
|         library-update-into-copies |    83.083 | 50.674 | 51.835 |   0.61 |
|        main-edit-among-many-shapes |     4.837 |  1.967 |  2.133 |   0.41 |
|           main-edit-into-10-copies |      1.79 |  1.039 |  1.059 |   0.58 |
|          main-edit-into-100-copies |    15.415 |  9.153 |  9.626 |   0.59 |
|         main-edit-into-1000-copies |   153.086 | 93.347 | 99.626 |   0.61 |
|         variant-switch-into-copies |    32.052 |  21.86 |  22.36 |   0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:47 +01:00
alonso.torres
0ca00b7286 🐛 Keep a variant's name when its main is updated from a renamed copy
Updating a main from a copy with a name override renamed the component
and its main to the copy's name. A variant takes its name from its
set, though, and every member carries it, so a renamed copy of a
variant left the file failing validation (a variant main and component
with a name other than their set's). Updating the main of a variant
copy now pushes everything but the name, and the copy keeps its name as
an override. The component model and its update-main check expect the
same.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  20.618 |  0.59 |
| edit-through-a-chain-of-dependents |   68.931 |  40.714 |  0.59 |
| library-update-into-copies         |   83.083 |  49.993 |  0.60 |
| main-edit-among-many-shapes        |    4.837 |   2.112 |  0.44 |
| main-edit-into-10-copies           |    1.790 |   1.105 |  0.62 |
| main-edit-into-100-copies          |   15.415 |   9.427 |  0.61 |
| main-edit-into-1000-copies         |  153.086 | 101.540 |  0.66 |
| variant-switch-into-copies         |   32.052 |  21.918 |  0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:47 +01:00
alonso.torres
9cf5af4aaf 🐛 Keep a component deleted, not gone, when its creation is undone
Undoing the creation of a component removed it from the file. A copy
another file had made of it in the meantime, as a consumer of a library
can after a variant is added there, then pointed at a component that
did not exist: the file failed validation, and the copy could not find
its main shapes or be restored. Undoing the creation now marks the
component deleted and keeps its main's shapes in it, as deleting it
does; redoing it adds it again.

The undo and redo checks of the component tests compare files without
their deleted components, since an undone creation leaves one where
there was none.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  19.745 |  0.56 |
| edit-through-a-chain-of-dependents |   68.931 |  37.914 |  0.55 |
| library-update-into-copies         |   83.083 |  48.026 |  0.58 |
| main-edit-among-many-shapes        |    4.837 |   1.944 |  0.40 |
| main-edit-into-10-copies           |    1.790 |   1.047 |  0.58 |
| main-edit-into-100-copies          |   15.415 |  10.179 |  0.66 |
| main-edit-into-1000-copies         |  153.086 |  91.854 |  0.60 |
| variant-switch-into-copies         |   32.052 |  21.546 |  0.67 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:46 +01:00
alonso.torres
564caf7cf2 🐛 Count a new variant's value among its own property's values
Adding a variant, or duplicating a variant main into its set, gives the
new member a "Value n" in its last property. The values came from the
last entry of the properties grouped by name, which is a hash map once
a set has nine properties, so the count could come from another
property: with eight empty properties before "Property 9", the new
member took "Value 2", its source's value, and duplicated it.

Both actions now take, through one function, the first "Value n" no
member has at the position the value goes to, n counting up from one
more than the values there. Duplicating a variant main into its set
could also repeat a value in use after a member was deleted, as adding
a variant did.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  20.529 |  0.58 |
| edit-through-a-chain-of-dependents |   68.931 |  40.136 |  0.58 |
| library-update-into-copies         |   83.083 |  45.708 |  0.55 |
| main-edit-among-many-shapes        |    4.837 |   1.972 |  0.41 |
| main-edit-into-10-copies           |    1.790 |   0.920 |  0.51 |
| main-edit-into-100-copies          |   15.415 |   9.714 |  0.63 |
| main-edit-into-1000-copies         |  153.086 |  96.513 |  0.63 |
| variant-switch-into-copies         |   32.052 |  21.386 |  0.67 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:46 +01:00
alonso.torres
a64c20465f 🐛 Give an added variant a value no member of its set has
Adding a variant names the new member's last value "Value n", n one
more than the number of values that property has. Once a member is
deleted, that count can repeat a value still in use: after adding
"Value 3" and "Value 4" and deleting "Value 3", the next member added
from "Value 4" got "Value 4" again, the same properties as its source.
The new member takes the first "Value n" from that number up that no
member has.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  21.352 |  0.61 |
| edit-through-a-chain-of-dependents |   68.931 |  39.364 |  0.57 |
| library-update-into-copies         |   83.083 |  46.730 |  0.56 |
| main-edit-among-many-shapes        |    4.837 |   1.943 |  0.40 |
| main-edit-into-10-copies           |    1.790 |   1.051 |  0.59 |
| main-edit-into-100-copies          |   15.415 |   9.726 |  0.63 |
| main-edit-into-1000-copies         |  153.086 | 101.415 |  0.66 |
| variant-switch-into-copies         |   32.052 |  20.744 |  0.65 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:46 +01:00
alonso.torres
591cdda9ed ♻️ Split app.common.logic.libraries by concern
The namespace held 3,300 lines: component sync, instance creation and
detach, swap and the variant switch's attribute carry, duplication,
and the sync of library colors and typographies. Each now has its own
namespace:

- app.common.logic.libraries (cll): component sync, reset, update
  main, attribute and placement sync, and the sync of a file with its
  libraries;
- app.common.logic.instances (cli): create, instantiate and restore a
  component, detach a copy;
- app.common.logic.swap (clsw): swap a copy head, carry overrides
  across a variant switch;
- app.common.logic.duplicate (cld): duplicate components and shapes;
- app.common.logic.library-assets (clla): sync of library colors and
  typographies, which the asset multimethods delegate to.

Each new namespace may require libraries, never the reverse; the
helpers they share became public there (attr-operations,
reposition-shape, orient-like, swap-content-root-id, ...). Callers use
the new aliases. The functions move as they were.

No behavior change: the golden masters and the suites are unchanged.

Benchmark (lower quantile, ms; baseline / now / ratio):
  deepest-edit-through-three-levels    35.2 /  37.3 / 1.06
  edit-through-a-chain-of-dependents   68.9 /  69.7 / 1.01
  library-update-into-copies           83.1 /  79.8 / 0.96
  main-edit-into-10-copies              1.8 /   1.6 / 0.92
  main-edit-into-100-copies            15.4 /  15.4 / 1.00
  main-edit-into-1000-copies          153.1 / 156.0 / 1.02
  variant-switch-into-copies           32.1 /  27.0 / 0.84

AI-assisted-by: claude-opus-5-5
2026-11-10 20:21:16 +01:00
Alonso Torres
4fb0ea9eee
🐛 Give unique values to same-name components combined as variants (#12881)
When components whose name matches the variant container are moved into
it, removing the container name leaves an empty value. Combining several
components named the same produced "Value 1" for the first variant and
empty values for the rest, so variants shared the same combination.

Assign the first unused "Value N" to the last property when all computed
values are blank, tracking values given within the same batch.

Combine moves the remaining mains into the container one at a time, in
the combine order, so the generated values follow that order instead of
the layer order.

Closes #12878
2026-11-10 09:16:08 +01:00
Pablo Alba
7666d7d500 🐛 Fix Creating or combining a variant set renames the component first 2026-11-04 21:44:44 +01:00
Pablo Alba
eeda9c1d18 🐛 Fix renaming a variant set saves half-finished steps 2026-11-04 21:44:44 +01:00
Pablo Alba
11c2292ac6
🐛 Fix variant changed from another page (#12693) 2026-10-30 14:45:19 +01:00
Pablo Alba
9dc222c642
🐛 Fix bad characters allowed on variants properties (#12688) 2026-10-29 10:13:33 +01:00
Andrey Antukh
81c3b3cd56
📎 Update copyright name on file header (#11346) 2026-08-25 11:55:10 +02:00
alonso.torres
b9dfa0c607 🐛 Fix problem when adding a variant children 2026-06-18 14:24:40 +02:00
Yamila Moreno
ddba2ffa75
📎 Update Kaleidos Copyright (#9929) 2026-05-29 11:24:58 +02:00
Andrey Antukh
0ab126748f
💄 Add format rule for code comments (#8211)
* 💄 Add format rule for code comments

* ⬆️ Update linter and formatter on devenv
2026-01-27 15:07:18 +01:00
Luis de Dios
a3557a81e4
🐛 Fix add space between the name and the index of new properties (#7068) 2025-08-07 07:41:33 +02:00
luisδμ
ff1d26294a
🐛 Fix create properties with a default value instead of an empty one (#7033) 2025-07-31 15:01:51 +02:00
Pablo Alba
fe003d7496
✨ Add removal of variant container when it becomes empty (#6311) 2025-04-22 09:22:18 +02:00
Pablo Alba
f04229d8cb
🎉 Allow duplicate/copy-paste/cut-paste variants 2025-04-01 11:07:22 +02:00
Pablo Alba
b6c4376217
🐛 Fix bugs from varaints design review 2025-03-28 11:20:10 +01:00
Pablo Alba
9653e72e47
♻️ Refactor variants
* ♻️ Refactor variants

* ✨ Add MR changes
2025-03-24 13:15:02 +01:00
Pablo Alba
014c297458
🎉 Add drag components in or out a variant container 2025-02-20 10:05:01 +01:00