Repository navigation
fix(tsrx): keep sibling-combinator rules at the top of a style scope - #73
Merged
Merged
Conversation
Pruning found an element's siblings only under its nearest ancestor element, so the items of a scope's root list (which has no element parent by design) and the items of a branch fragment had no siblings, and their `+` / `~` rules were commented out as unused although both elements carry the scope hash at runtime. - prune_css reads the element's actual children list (element or fragment) for sibling combinators; ancestor combinators still only see elements, so a scope's container stays unmatched - the style pre-pass seeds each scope's ancestor paths with a root fragment (createScopeRoot, exported for consumer compilers) - conformance fixture sibling-combinators pins the kept and pruned rules for every target Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
leonidaz
added a commit
to Ripple-TS/ripple
that referenced
this pull request
Sep 6, 2026
…uning Picks up tsrx-org/tsrx#73: sibling combinators between the items of a scope are kept. Ripple's own element collector now roots each scope's ancestor paths at a fragment holding the list's items (createScopeRoot), so `+` and `~` between top-level items find their siblings while the container stays unmatched; the shared sibling-combinators fixture passes. Co-Authored-By: Claude Fable 5.1 <[email protected]>
leonidaz
added a commit
to Ripple-TS/ripple
that referenced
this pull request
Sep 6, 2026
…1441) * feat(tsrx-ripple): sibling-scoped style blocks, $class, and apply (TSRX RFC #1) Implement RFC tsrx-org/RFCs#1 for the Ripple target on @tsrx/core 0.1.66: - style-scopes pre-pass: scope discovery per children list, per-scope pruning, lexical CSS emission order, class stamping (enclosing hashes outer first, then applied themes), apply resolution, and assigned-block preparation in the analyzer's theme/class-map mode - client and server transforms read the stamped chain; runtime reads of imported themes concatenate at render time; the server registers applied themes before the scopes that apply them and groups a scope's sheets - $class on class maps, self-closing apply bundles, type-only apply checks - runtime: multi-token #class spreads; output_register_css outside a render - fix: a @{ } block as the child of a DOM element rendered nothing on the client - tests: shared conformance fixtures, diagnostics, type-level, and client and server runtime suites - docs: styling guide, syntax guide, README, llms.txt, agent rules, and a scoped styles & themes playground example; website-new components moved to @{ } bodies Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(styling): add the which-one-to-use table for :global Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(tsrx-ripple): keep scope classes when a spread brings its own class A static class with a scope chain on an element that also spreads props rides through the spread: as `#class` on the client, which the runtime adds after every other attribute, and through spread_attrs on the server, so a `class` in the spread cannot drop the scope hashes or an applied theme, and the server writes one class attribute. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: bump @tsrx packages to core 0.1.67 and seed scope roots for pruning Picks up tsrx-org/tsrx#73: sibling combinators between the items of a scope are kept. Ripple's own element collector now roots each scope's ancestor paths at a fragment holding the list's items (createScopeRoot), so `+` and `~` between top-level items find their siblings while the container stays unmatched; the shared sibling-combinators fixture passes. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
11 tasks done
1 task done
This branch was successfully deployed
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.
.a + .band.a ~ .cbetween the items of a style scope (or of a control-flow branch fragment) were pruned as unused by every target, although both elements carry the scope hash and the rule matches at runtime.Cause.
prune_csslooked up siblings throughget_element_parent, the nearest ancestor element on the path. The RFC #1 pre-pass prunes each scope against its items with an empty root path (the container must stay invisible to ancestor combinators), so top-level items had no element parent and no siblings. Items of a<>…</>inside a branch had the same problem, since the fragment was skipped too.Fix.
prune_cssreads the element's actual children list (element or fragment) for+/~, via a newget_sibling_container. Ancestor combinators keep usingget_element_parent, so a scope's container is still never matched.createScopeRootis exported so consumer compilers with their own collectors (Ripple, Octane) can seed the same root.sibling-combinators(kept rules at the scope root, inside.wrap, and inside an@iffragment;.f + .gwith no.fsibling still pruned), run by every JSX target.Before, for the fixture:
/* (unused) .a + .b … */. After:.a.tsrx-… + .b:where(.tsrx-…).Follow-ups once released: Ripple-TS/ripple#1441 seeds the root in its own collector; Octane's
collectPrunableElementsneeds the same one-line seed.🤖 Generated with Claude Code
Note
Medium Risk
Changes core CSS prune matching for
+/~and scope path seeding; behavior is localized but affects all scoped-style targets and downstream compilers that collect prunable elements.Overview
Fixes incorrect pruning of
.a + .band.a ~ .cwhen both sides are top-level items in a scoped template or siblings inside a control-flow fragment. Those rules were marked unused because sibling lookup used the nearest ancestor element’s children, so scope-root and fragment children had no discoverable siblings.prune_cssnow resolves siblings viaget_sibling_container, walkingmetadata.pathto the list that actually contains the node (parent element, authored fragment, or synthetic scope root). Ancestor combinators still useget_element_parent, so scope containers stay invisible to descendant selectors.The style-scope pre-pass seeds each scope’s element paths with
createScopeRoot(exported from@tsrx/corefor other compilers). A newsibling-combinatorsfixture asserts kept rules at scope root, under.wrap, and in an@iffragment, while.f + .gstays pruned when.fis absent.Reviewed by Cursor Bugbot for commit 434db4c. Bugbot is set up for automated code reviews on this repo. Configure here.