perf(primitives): place the select panel in one layout pass
Publish to NPM / Check version changes and publish (push) Successful in 9m38s

`position()` interleaved geometry reads with inline-style writes: the horizontal
branch wrote `minWidth`/`left` and the vertical branch then read `scrollHeight`,
`getComputedStyle`, `offsetHeight` and `offsetTop`, and a second write of
`bottom` was followed by a read of `clientHeight`. Each read after a write
forces a synchronous layout, so a single placement cost at least two — and
placement runs on mount, on resize and while scrolling an expanding panel.

Split it into measure, compute and commit: every read now happens before the
first write, and the result is applied as one object rather than nine separate
property assignments.

The commit also always writes both edges of each axis. A resize can flip the
vertical branch from `bottom` to `top`, and the previous code left the old edge
in place, over-constraining the box.

No behavioural change — the arithmetic is untouched, and the placement tests
pass unchanged.
This commit is contained in:
2026-08-10 04:37:43 +07:00
parent 6da5ecaa83
commit ea96d720f2
3 changed files with 87 additions and 48 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@robonen/primitives",
"version": "0.0.4",
"version": "0.0.5",
"license": "Apache-2.0",
"description": "Collection of UI primitives",
"keywords": [