9 Commits

Author SHA1 Message Date
alonso.torres
e0bbc50c32 🐛 Leave hidden children out before deriving a layout from them
Adding a flex or grid layout derives its direction, gaps and paddings
from the board's children, leaving out the hidden ones, but it checked
for children before leaving them out. A board whose children were all
hidden then failed: flex reduced an empty list of points and grid read
the bounds of no shapes. Making a variant of a hidden main reaches it,
since the new variant board gets a flex layout around the main. Hidden
children are now left out first; with none left, the layout gets the
parameters of a board with no children.

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

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  20.267 |  0.58 |
| edit-through-a-chain-of-dependents |   68.931 |  39.871 |  0.58 |
| library-update-into-copies         |   83.083 |  45.985 |  0.55 |
| main-edit-among-many-shapes        |    4.837 |   1.943 |  0.40 |
| main-edit-into-10-copies           |    1.790 |   1.036 |  0.58 |
| main-edit-into-100-copies          |   15.415 |   9.998 |  0.65 |
| main-edit-into-1000-copies         |  153.086 |  97.836 |  0.64 |
| variant-switch-into-copies         |   32.052 |  19.658 |  0.61 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:47 +01:00
alonso.torres
c73b30cb56 🚑 Lay out a single-line flex board aligned by space-between
A wrapped flex board whose content is aligned by space-between shares its
free space between its lines, dividing it by the number of lines minus
one. With a single line and integer sizes that is a division by zero,
which throws in Clojure. The gap after a single line goes unused, so it
now takes the layout's own gap.

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

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |   20.49 |  0.58 |
| edit-through-a-chain-of-dependents |   68.931 |  41.045 |  0.60 |
| library-update-into-copies         |   83.083 |  51.057 |  0.61 |
| main-edit-among-many-shapes        |    4.837 |   2.253 |  0.47 |
| main-edit-into-10-copies           |     1.79 |   1.055 |  0.59 |
| main-edit-into-100-copies          |   15.415 |   9.948 |  0.65 |
| main-edit-into-1000-copies         |  153.086 | 108.962 |  0.71 |
| variant-switch-into-copies         |   32.052 |  21.743 |  0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:46 +01:00
alonso.torres
a23b37fa47 🐛 Bound flex free-space distribution
Cross-axis fill sizing reaches distribution before the current line size
is initialized. Count eligible items from the minimum fallback, as the
update loop already does. Use zero increments when every item is at its
maximum, avoiding division by zero.

Add portable controls for minimum initialization, redistribution at a cap
and fully saturated items. All three raise arithmetic errors before the
fix and pass afterward. Generated vertical-fill histories cover the full
layout and component pipeline too.

Validate the final continuation on common JVM (2004 tests / 32919
assertions), common JS (1940 / 31522), frontend (1745 / 13569), backend
(1793 / 9007) and exporter (16 / 40). All four modules pass lint and format.
All six generated properties pass 40 programs at seed 712 in both runtimes.
Golden data is unchanged.

The final continuation benchmark passes with no regression flags. Lower
quantile ratios against Phase 1e: main 10/100/1000 0.51/0.58/0.57, three
levels 0.57, chain 0.53, library 0.57, many shapes 0.45, variant switch 0.66.
Machine/JVM differences make these rough comparisons; baseline unchanged.

AI-assisted-by: gpt-6
2026-11-10 20:21:42 +01:00
alonso.torres
80278698f7 🐛 Keep single-child flex spacing finite
Compute a space-between gap only when a line has at least two children.
A one-child line keeps its configured gap instead of dividing by zero.

Cover both row and column directions, including reversed layouts, finite
spacing fields and unchanged two-child distribution.

AI-assisted-by: GPT-6
2026-11-10 20:21:41 +01:00
alonso.torres
099af03d7d 🐛 Handle empty flex layouts when calculating line positions
Skip per-line stretch division and baseline placement when a flex layout
has no lines. Removing a component's final child then resizing a copy
could divide by zero on the JVM (F169).

The public layout regression fails four assertions before the fix. It
covers row and column layouts with six content alignments. Fresh flex,
swap and variant suites pass 125 tests and 596 assertions, and the shrunk
structure program passes. Pure goldens match all 1149 assertions.

AI-assisted-by: GPT-6
2026-11-10 20:21:33 +01:00
alonso.torres
e58850d425 🐛 Initialize flex line arithmetic before placing the first child
The first layout line starts as nil. JavaScript arithmetic treated its
missing count and bounds as zero, while the JVM threw. Give those three
values zero defaults before calculating gaps and the next line bounds.

A regression failed on the JVM before the fix. Six combinations of row
and column layout with start, around and even spacing now pass. Existing
flex tests pass too; the layout oracle fixtures pass on the JVM.

AI-assisted-by: GPT-6
2026-11-10 20:21:17 +01:00
Eva Marco
fcbb8f1fc0
🐛 Keep derived layout paddings non-negative (#12129)
Adding a flex or grid layout to a board with children derives the
paddings from the distance between the board and its children. A child
that overflows the board, or floating point noise after "Resize board
to fit content", gave negative paddings. The shape schema rejects them
since paddings must be non-negative, so update-file failed and autosave
stopped. Clamp the derived paddings to 0, as the derived gaps already
are.

Closes #12107

AI-assisted-by: claude-opus-5-5
2026-10-06 16:34:28 +02:00
Andrey Antukh
81c3b3cd56
📎 Update copyright name on file header (#11346) 2026-08-25 11:55:10 +02:00
Andrey Antukh
146219a439 ✨ Add tests for app.common.geom namespaces 2026-04-15 23:37:53 +02:00