mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
The Builder was stalling when selecting instances because Tag selector resolution repeatedly scanned and parsed project styles for every displayed property. This PR indexes that data when styles change, reuses style source suggestions, and avoids an unnecessary stylesheet rebuild on multi-selection. It also restores the documented `:hover .button` and `:hover > .icon` selectors, fixes their editing preview, and adds sharp light and dark Tag styles screenshots. Ref #5657 Closes #6678 ### Plan and tools - [x] Reproduce the selector rejection in shared validator and runtime tests. - [x] Restore one shared validation path for new and saved selectors. Keep CSS parsing through css-tree. - [x] Update Tag styles and States and selectors docs, navigation emoji, and paired Storybook screenshots. - [x] Measure the instance selection slowdown and remove repeated full scans while preserving source order. - [x] Audit the full selection path and reuse existing style indexes in state matching and style controls. - [x] Avoid redundant Tag CSS rebuild on multi-selection and test that real preview styles still clear. - [x] Fix descendant state previews for Token, Local, and Tag styles; verify live Tag editing. - [x] Run targeted tests, typechecks, lint, formatting, and inspect both screenshot themes. - [ ] Monitor PR checks and address failures. - [ ] Approve the new Storybook baseline after user review. Verification: CSS data 62 tests; project build styles 167 tests; Builder style panel/model 113 targeted tests; canvas selection and styles 89 targeted tests; CSS data/project build/Builder typechecks; lint; formatting. A local benchmark with 5,100 styles, 5,001 instance selections, and 100 property reads fell from 99 ms to 6 ms for reads after the second fix, plus 6 ms to build indexes when data changed. The original repeated style scan measured 716 ms for 100 reads with no instance selection map. These measure the affected calculation, not total Builder selection time. Two older selection-time style scans remain and cost about 0.1 ms each per 5,100 declarations in a synthetic Node scan; their output ordering needs a separate check before changing them. Previewing an unrelated Token or Local edit still rebuilds the Tag stylesheet, an editing-time cost outside the reported selection path. No fixture inputs or generated fixture bundles changed. Agent evaluations were not run because they require separate approval.
CSS Data
Generated configs and collections from mdn-data into consumable form.