fix(ui): restore SDK styles under host CSS via revert-layer (A2) - EXPERIMENT - #363
Open
cameronapak wants to merge 2 commits into
Open
fix(ui): restore SDK styles under host CSS via revert-layer (A2) - EXPERIMENT#363cameronapak wants to merge 2 commits into
cameronapak wants to merge 2 commits into
Conversation
Unlayered host button/preflight rules were flattening SDK controls because yv-sdk-* layers lose to unlayered author CSS. Ship one unlayered revert-layer rule on [data-yv-sdk] descendants so Cascade 5 pops those shorthands back to the SDK layers. Light-DOM isolation only — not Shadow DOM.
🦋 Changeset detectedLatest commit: 9096129 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A2 margin: revert-layer would zero the unlayered @Utility margin. Put margin-inline: auto on the layered .yv:card-content rule so one class still centers, and drop the call-site yv:mx-auto split.
cameronapak
marked this pull request as ready for review
August 26, 2026 15:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Experiment sent by Cam to his Grok Bots to grill and align and implement an experiment based on Tim Watson's feedback:
Summary
SDK v2 puts styles in
@layer yv-sdk-*. Host CSS that is not in a layer always wins. Tailwind v3 preflight and a hostbutton {}flatten version buttons and list rows. Theyv:prefix only stops name clashes.This change is not Shadow DOM. This change is not PR 348. Austin continues Shadow DOM on a different branch.
Change
The SDK ships one CSS rule that is not in a layer. Partners do not paste this rule.
The selector is
[data-yv-sdk] *,[data-yv-sdk] *::before, and[data-yv-sdk] *::after.The rule sets these shorthands to
revert-layer:box-sizing,padding,margin,border,background,font,color,line-height,letter-spacing,appearance,-webkit-appearance,text-decoration,list-style, andtext-transform.The rule is not on the
[data-yv-sdk]root. The rule does not useall. The rest of the SDK stays in layers. Custom properties that start with--yvstay.@utility card-contentkeeps width and max-width. A layered.yv:card-content { margin-inline: auto }rule sets the center margin. Thenmargin: revert-layerreturns to that value, not to preflight 0.lightningcss removes
-webkit-appearanceduring minify.scripts/preserve-host-revert-layer.jswrites that declaration back.Tests
jsdom cannot prove cascade layers. A Storybook play story in Chromium is the proof.
button,a,p,h1, andinput. Inherited body font and color also apply.[data-yv-sdk]stays flat. This shows that the hostile sheet is active.[data-yv-sdk]get SDK box and type again (8px 16px,#121212, Inter).host-revert-layer.test.tsmakes sure that the rule is for descendants only and that it does not useall.verify-styles.jsmakes sure that the compiled sheet stays out of a layer.Out of scope
PR 348 and Shadow DOM.
revert-rule. Removal of layers from the SDK.all: revert. Host!important.Greptile Summary
This PR adds an unlayered, descendant-only
revert-layerrule to restore SDK presentation when unlayered host element resets otherwise override layered SDK styles.-webkit-appearanceand expands build-time style verification.Confidence Score: 5/5
The PR appears safe to merge, with focused browser and build-time guards covering the new CSS isolation behavior.
The changed stylesheet, post-processing step, build order, and verification paths remain aligned, and no concrete current runtime, build, release, or security failure was established.
Important Files Changed
allrollback.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[global.css] --> B[Tailwind CSS build] B --> C[preserve-host-revert-layer.js] C --> D[dist/tailwind.css] D --> E[tsup embeds CSS] E --> F[YouVersionProvider style resource] D --> G[Published styles.css export] D --> H[verify-styles.js]Reviews (1): Last reviewed commit: "fix(ui): keep card-content centering in ..." | Re-trigger Greptile
Context used (3)