mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-03 02:27:57 +09:00
## Summary - recover from every standard HTML/SVG and React attribute alias collision during generated JSX export - keep the last persisted value for non-class collisions, matching existing duplicate-prop recovery - merge distinct class aliases with generated atomic classes - keep shared collision validation strict in authoring, import, MDX, and instance-conversion paths ## Implementation The React SDK generator now normalizes safe instance props before generating JSX. One map keyed by the final JSX name provides deterministic last-value recovery for exact duplicates and non-class aliases. A second map keyed by the original class spelling preserves one value per class alias so those composable values can be merged into the single emitted `className` attribute. Projected resource props use the same normalized-name set, avoiding a second route to duplicate generated JSX properties. ## Checklist - [x] Reproduce the reported `class`/`className` failure on unchanged `main` - [x] Reproduce non-class failures including `tabindex`/`tabIndex`, `for`/`htmlFor`, and `readonly`/`readOnly` - [x] Cover every current standard-to-React alias pair in both persistence orders - [x] Preserve exact duplicate-prop last-value behavior - [x] Merge distinct class aliases with atomic classes - [x] Keep strict shared validation outside generated JSX recovery - [x] Review documentation impact; no user-facing documentation changes are required - [x] Review fixture impact; no fixture inputs or generated fixture outputs are affected - [x] Run targeted tests, typecheck, lint, build, and direct generator reproducers - [ ] Run `pnpm evaluations` if explicitly approved ## Verification - `pnpm --filter @webstudio-is/react-sdk exec vitest run src/component-generator.test.tsx --pool=forks` — 156 passed - `pnpm --filter @webstudio-is/content-engine exec vitest run src/jsx-attributes.test.ts --pool=forks` — 3 passed - `pnpm --filter @webstudio-is/react-sdk typecheck` - `pnpm --filter @webstudio-is/react-sdk build` - `pnpm exec oxlint --deny-warnings packages/react-sdk/src/component-generator.ts packages/react-sdk/src/component-generator.test.tsx` - direct generator reproducers now emit one normalized property for `tabIndex`, `htmlFor`, and `readOnly` The exhaustive regression test is derived from the shared attribute mapping, currently covering 105 non-class pairs in both orders; the separate class test covers exact duplicate recovery, distinct alias merging, and atomic classes. Agent evaluations were not run because they require explicit approval. Closes #6299