Repository navigation
chore(react): drop build config left over from CSS modules - #2639
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the basic catalog components (Button, ChoicePicker, Text, and TextField) from CSS modules to literal, stable 'a2ui-*' class names to resolve issues with unstyled rendering in the published package. The styles are now injected at runtime using constructable stylesheets (adoptedStyleSheets). The feedback suggests adding a fallback mechanism, such as injecting a <style> tag, for environments like JSDOM that do not support constructable stylesheets.
|
A note for whoever closes this out: A2UI Composer currently works around this in its React sample renderer, in a2ui-project/composer#119. That's a Yarn patch on |
|
@ditman Gental ping for review. Thanks! |
ditman
left a comment
There was a problem hiding this comment.
Thanks for the fix!
A few requests inline. The main one is keeping page-author overrides working (see the comment on BASIC_CATALOG_CSS).
Since this removes the last CSS modules in the package, could you also fold in some small build cleanup (these files aren't in the diff, so noting them here):
renderers/react/tsconfig.json~L3: drop"vite/client"fromtypes. It only supplied*.module.css/import.meta.envtypings, and neither is used insrc/ortests/anymore.renderers/react/package.jsonL73L75:"sideEffects": ["*.css"]can become"sideEffects": false, since no CSS ships and injection happens inside hooks.renderers/react/package.json~L68: as you pointed out, the"./styles/structural.css": "./dist/structural.css"export points at a file nothing generates. Happy for it to be removed here, or in a follow-up if you'd rather keep this PR focused.
036af42 to
cc426e2
Compare
|
Thanks for the thorough review, @ditman! I looked up your review comments and resolved them in recent commits. Also build cleanup is in separate commit cc426e2 in this PR:
|
|
Thanks for the update. Awaiting for another round of review from @ditman . |
|
#2630 has landed and removed the React basic catalog, including the four components this PR fixed, so the styling fix no longer applies. I rebased onto
#1307 still shows as open, but its bug went away with those components, since the basic catalog now comes from @jerelvelarde re your note on the Composer workaround (a2ui-project/composer#119): the fix now lands through #2630 rather than this PR, so the comment on composer#119 should follow the first release that includes #2630. |
cc426e2 to
c03cda4
Compare
With the React basic catalog removed in a2ui-project#2630, nothing in the package uses CSS modules or ships CSS. Remove the *.module.css declaration in src/global.d.ts, drop "vite/client" from the tsconfig types, declare "sideEffects": false, and remove the ./styles/structural.css export, which points at a file the build never generates.
c03cda4 to
38fec99
Compare
Description
With the React basic catalog removed in #2630, nothing in
@a2ui/reactuses CSS modules or emits.cssfiles. Clean up the leftover build configuration:src/global.d.ts(*.module.cssambient type declaration)."vite/client"fromcompilerOptions.typesintsconfig.json."sideEffects": falseinpackage.json."./styles/structural.css"export frompackage.json, which pointed to./dist/structural.css(never generated by the build).Pre-launch Checklist
One time:
For this PR: