Repository navigation
fix(core): join a dynamic class with scope classes as each target renders it - #1232
Merged
jonkwheeler merged 19 commits intoNov 12, 2026
Merged
Conversation
…ope classes merge_spread_class(props, scope_class, key, alias?) returns a bag without a class as itself. Otherwise it returns a copy that reads the bag through getters and carries the bag's class followed by the scope classes under `key`. A class under `alias` moves to `key`, for runtimes that read either prop. The bag is never written to, and Solid's lazy spread still tracks each prop. A class object or list keeps its shape, as Solid's `class` accepts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Scoped styles stamped their class attribute after every spread, so the attribute overwrote a class the spread passed. An authored class before a spread kept the hash, and the spread overwrote both. Now, on a platform with `jsx.hostSpreadClassProps`, the style pre-pass puts the stamped attribute ahead of the spreads and wraps each spread after it in merge_spread_class. The spread's class replaces only the authored class, as in plain JSX, and the scope classes stay. React reads `className`, Solid `class`, and Preact and Hono either one. Vue's mergeProps already joins `class` across spreads, so Vue leaves its spreads as written. Elements without a spread after the class attribute compile as before, and so does the type-only output. Fixes tsrx-org#722 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Solid
Review follow-ups for the host spread class merge:
- A bag with both class props reads the last one that has a value, as
Preact and Hono render it. `{ class: 'x', className: undefined }` used
to drop `x`.
- Only Solid, through the new `jsx.hostSpreadClassList`, joins a
non-string class as `[class, scope]`. Elsewhere such a class applies
unchanged, so Hono's `css` promise keeps working and React, Preact, and
Hono no longer print `a,b,tsrx-…`.
- On Preact and Hono, a spread written before the class attribute drops
its class props, so its `className` can no longer print a second class
attribute in Hono SSR or replace the scope hash.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ttribute
Outside Solid, a spread's non-string class now joins the scope classes as
`${class} ${scope}`, as the authored class attribute's template literal
does. Hono DOM's `css` object then keeps the scope hash, and a React list
class renders `a,b tsrx-…` either way. Only a thenable class, such as the
promise Hono's server `css` returns, still applies unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sses It joins an element's authored class with its scope classes the way a runtime whose class is text renders it: a `null`, `undefined`, `false` or empty class is left out, a thenable applies unchanged, and any other value joins as text. It shares `merge_spread_class`'s join. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…renders it
Scoped styles joined an authored class expression into a template literal,
so `className={props.c}` rendered `undefined tsrx-…` when `c` was unset, and
Solid's and Vue's object and list classes rendered `[object Object] tsrx-…`
and `a,false tsrx-…`. A class that may not be a string now joins through
`join_scope_class` on React, Preact and Hono, and as `[class, scope]` on
Solid and Vue, which set the new `jsx.classAttrList`. A class that is always
a string, and the type-only print, keep the template literal.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Vue sets a spread's `className` as a DOM property, which replaces the class,
so beside scoped styles `{ className: 'mine' }` rendered only the scope hash
or only `mine`, depending on key order. Vue now sets
`hostSpreadClassProps: ['className']`, so `merge_spread_class` appends the
scope classes to it. A spread before the class attribute is wrapped too when
its class prop has another name than the attribute, since that prop can
replace the class wherever it is written. Vue's `mergeProps` still joins a
spread's `class` itself.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts d14ab95. Wrapping a Vue spread in `merge_spread_class` for its `className` printed a second `class` attribute in Vue SSR, caused a hydration class mismatch for `{ className: undefined }` beside a later `class`, and froze the keys of a `reactive()` bag. A spread bag's `className` is runtime data, so it is left to Vue again; `mergeProps` still joins a spread's `class`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`join_scope_class` takes a kind for how the runtime renders a class value: `'text'` leaves out `true` as well as `null`, `undefined` and `false` (React, Hono DOM), `'text-true'` renders `true` as text (Preact), `'text-both'` renders both booleans as text (Hono's server), and `'list'` keeps only an object or a list beside a string (Solid, Vue), leaving out numbers, `true` and functions, which Solid renders as class names in a list. `merge_spread_class`'s list mode gets the same `'list'` rule; its text join is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new `jsx.classValue` platform option names how the runtime renders a host
element's class, and a class that may not be a string joins the scope
classes through `join_scope_class` with that kind: `'text'` on React and Hono
DOM, `'text-true'` on Preact, `'text-both'` on Hono's server, and `'list'` on
Solid and Vue, which replaces `classAttrList` and its inline array. So
`class={true}` no longer renders `true tsrx-…` on React, and `class={1}` or a
function class no longer becomes a class name on Solid. The runtime tests
compare each value with the target's own rendering, now including `true` and
`0`, and the Hono SSR test compares with plain Hono.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lass Solid ignores `className`, and Vue renders a static one as a `classname` attribute, so React-style source lost its class (and, beside scoped styles, its scope hash). A new `jsx.rewriteClassNameAttr` option, set by Solid and Vue, renames a host element's `className` to `class` before style scopes stamp it. With both attributes, they join into one `class`: one string when both are string literals, otherwise `[class, className]`. Component props, spread bags and the type-only print keep `className` as written. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The type-only print kept `className`, which Solid's and Vue's JSX types don't have, so the editor reported TS2322 on source that now compiles. It renames a host element's `className` to `class` too, and gives the name a `source_name` so the generated `class` maps back to the authored `className` with every editor feature. An element with both attributes type-checks as the runtime merge does. Component props and spread bags keep `className`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`merge_spread_class` joined a spread's class with a fixed rule that kept `true` as text and dropped `false`, so on Hono's server a spread's `class: false` lost the `false` that plain Hono prints, and React kept a `true` it leaves out. Its last argument is now the platform's `classValue` kind, as for the class attribute, and replaces `hostSpreadClassList`: Solid's spreads get `'list'` from `classValue`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pe import
`ensure_named_import` added the helper to the first import of its module. A
namespace import printed `import * as r{ … }`, and a type-only import was
erased from the build with the helper in it. Scoped classes now import
`join_scope_class` through it, so it only joins a named value import and
otherwise adds an import of its own.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three review fixes to the Solid and Vue `className` rewrite:
- Only an intrinsic element (a lowercase or namespaced tag) is renamed. A
dynamic `<{Tag}>` may be a component, so `const Tag = Inner; <{Tag}
className="x" />` passes `className` to `Inner` again, at runtime and in
the editor.
- With a spread between `class` and `className`, the runtime output renames
`className` in place instead of joining it before the spread, so the last
class written still wins. The type-only print still joins them, since
TypeScript reports two `class` attributes even across a spread. Two
`className` attributes stay two attributes, keeping TypeScript's
duplicate-attribute error.
- In a joined `class`, the second attribute's name maps to it as well, so
hover and go-to-definition work on both authored names.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tely With a spread between `class` and `className`, the runtime handles them as two `class` attributes as written: Solid keeps the last one and Vue's `mergeProps` joins them, so "the last class still wins" held only for Solid. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Solid, `class` and `className` around a spread (or two `className`s) stay
two `class` attributes, and Solid applies the last one, but scoped styles
stamped the first: `<p class="a" {...bag} className="b" />` rendered
`class="b"` without the scope hash. A runtime that reads a spread's class
itself (`hostSpreadClassProps`) now gets the hash on the last class
attribute. Vue, whose `mergeProps` joins them, keeps it on the first
(`a tsrx-… fromBag b`).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d385b0e. Configure here.
jonkwheeler
marked this pull request as ready for review
October 28, 2026 12:37
This was referenced Oct 28, 2026
Hono's server renderer prints `class` and `className` as two `class` attributes, and a browser reads the first. Since d385b0e the scope hash went on the last class attribute on every target that reads a spread's class, so beside a `<style>`, `<span class="a" className="b" />` printed `class="a" class="b tsrx-…"` and the browser applied `a` without the hash. A new `jsx.classPropsPrintedApart` platform option, set by Hono's server mode, puts the hash on the last attribute named like the first one: `class="a tsrx-…" class="b"`. Two attributes of one name still stamp the last, which Hono prints (`class="a" {...bag} class="b"` gives `class="b tsrx-…"`). Hono DOM applies the last attribute and keeps d385b0e's choice. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 11, 2026
Brings in tsrx-org#1232's head f113350, which carries the fixes for Cursor Bugbot's findings from the 2026-11-10 sweep. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
main now has tsrx-org#1168's squash commit; merged against the parent commit this branch has so git doesn't redo that work. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 12, 2026
main now has tsrx-org#1232's squash commit; merged against the parent commit this branch has so git doesn't redo that work. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
to jonkwheeler/tsrx
that referenced
this pull request
Nov 12, 2026
… now defers Since main's tsrx-org#1232, Solid TSRX compiles a host element's className to class, which babel-preset-solid sets in an effect. Since tsrx-org#1107, it wraps a host spread in a normalize_spread_props call, so in a ternary arm (tsrx-org#246's shape) the compiler creates the element in an immediately called arrow. A yield in either place now leaves its generator, so TSRX2034 is right there. The downstream probes against the installed babel-preset-solid already agree. Move both shapes to the reported list. The runtime test keeps a yield beside a host spread and a ref, on the returned element, which the compiler still evaluates in place. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
jonkwheeler
added a commit
that referenced
this pull request
Nov 12, 2026
* fix(solid, vue): report a yield in a template as TSRX2034
babel-preset-solid and vue-jsx-vapor move template expressions into
reactive effect callbacks. A `yield` there no longer runs in its
generator, so the build failed later with `A 'yield' expression is only
allowed in a generator body.` (or, for `yield*`, `The keyword 'yield' is
reserved`), pointing at compiled code.
Solid and Vue now set `validation.templateYieldUnsupported`, and core
reports each `yield` in a template as TSRX2034
(TARGET_TEMPLATE_YIELD_UNSUPPORTED) at the authored `yield`, in source
order: attribute values, children, spread values, component props,
directive heads and bodies, including `yield*`. A `yield` in a nested
function, or in the setup statements of a function's own `@{ … }` body,
stays allowed.
A reported `yield` is recorded so the shared checks for a `yield` in a
generated callback (TSRX2022) and for the `super` such a callback can't
read (TSRX2023) don't report it a second time. React, Preact and Hono
evaluate templates eagerly and don't set the flag.
The error gets a Solid example in `@tsrx/content-mapper`'s error
examples, and a line in the specification's code list.
Fixes #259
* fix(solid, vue): report TSRX2034 only where the target's compiler moves the yield
The previous commit reported every `yield` in a Solid or Vue template.
Some of them build today, because the target's JSX compiler leaves the
value in place, so the check now mirrors each compiler on TSRX's final
output, which is what that compiler reads.
Core runs the target's new `findDeferredTemplateYields` hook after the
generated closures are suspended, and reports what it returns. A
`yield*` that delegates to a generator made from a generated closure
now carries that generator in `metadata.generated_delegation`, and
stands for the authored `yield`s inside it. A `yield` that already has
an error at or inside it (TSRX2022, TSRX2023) gets no second one. The
source-level walk, the `templateYieldUnsupported` flag and the
`rejected_yields` set are gone.
- Solid (`template-yield.js`) follows babel-preset-solid's JSX compiler.
An element returned or assigned as a whole, and the elements nested in
it, are created in place; any other host element is created in an
immediately called arrow. A dynamic value is evaluated in an effect,
an inserted arrow or a prop getter, and a static one in place, using
the compiler's own test (a member access, call, spread or `in`).
`class` and `style` are always in an effect unless the value is an
object literal. An array `ref` goes in an arrow; event handlers and
other refs stay in place. An assignable component `ref` goes in a
callback, and other component refs are passed on or dropped.
Component children are passed in a getter when there are several, or
one is an element or dynamic.
- Vue (`template-yield.js`) reports any `yield` in an element or
fragment. vue-jsx-vapor creates every element in an immediately called
arrow, but a host spread TSRX evaluates into a variable before the
element stays allowed.
Checked against babel-preset-solid and vue-jsx-vapor on 4009 shapes per
target (contexts, positions, value kinds and TSRX directives): TSRX2034
appears exactly when the compiled output fails to parse. Exempt shapes
build and run in the Solid and Vue Vite runtime tests.
Related: #259
* test(core): skip only #246's no-error check on Solid and Vue
The previous commit skipped #246's whole shared block on Solid and Vue.
Only its check that the shapes compile without errors depends on the
target, since those targets report some of them as TSRX2034. The
mapping check and the `@for` body check still apply there. Keeping
the block's `describe` line as it was also lets this merge cleanly
with #1220's tests next to it.
Related: #259
* test(solid, vue): check TSRX2034 against the installed JSX compilers
The Solid rule mirrors dom-expressions' choices about which template
values it evaluates in place, and consumers get whatever compiler
their vite-plugin-solid brings. Two probe tests now run reported and
exempt shapes through TSRX, then the installed babel-preset-solid (as
vite-plugin-solid calls it) or vue-jsx-vapor, then Vite's TypeScript
strip. They assert that TSRX2034 appears exactly when the result fails
a strict module parse. The probes cover each branch of the rules: 43
for Solid and 17 for Vue. A compiler release that diverges now fails
CI instead of giving a false error.
The rules record the compiler versions they follow:
@dom-expressions/babel-plugin-jsx 0.50.0-next.44 (babel-preset-solid
2.0.0-rc.2) and vue-jsx-vapor 3.2.14.
Related: #259
* fix(solid): read TypeScript wrappers and ref calls as babel-preset-solid does
vite-plugin-solid hands babel the TypeScript as written, so
dom-expressions sees `as`, `satisfies` and `!` as ordinary expressions.
The Solid rule looked through them. As a result, it left out a returned
or declared element behind one (`return (<input title={yield t} />) as
any`), which the compiler creates in an immediately called arrow, and a
class or style object behind one, which goes in an effect. Both failed
the DOM build with no TSRX2034. The rule now looks through parentheses
only. The exceptions are where the compiler strips a wrapper itself: `as`
and `!` on a host ref, and `satisfies` too on a component ref.
A component whose `ref` is a call is created inside an immediately
called arrow, so every value on it is now deferred too. An optional
member ref, which the compiler drops, is left alone.
New guard probes: the TypeScript-wrapped elements and objects, the
component ref forms, and the Bugbot shapes (an assigned element, `open`,
`one` and a fragment inside the returned element). 6 of them fail on the
previous head.
Related: #259
* fix(solid): follow dom-expressions for spreads, select values and folded values
Four false reports and two misses in #1280's DOM rule, each checked
against the installed babel-preset-solid's DOM output:
- Beside a host spread, every attribute but `ref` is a prop of the
spread: a dynamic one in a getter, any other in place. So
`<div {...bag} class={yield t} />` builds and is no longer reported,
and `<button {...bag} onClick={yield bag.onClick} />` fails and is.
- A `<select>`'s value, unless it's a literal, is assigned in a
microtask as well as in place, so `<select value={yield t} />` is
reported.
- The compiler folds a host attribute value, or a value in an object
there, into a literal when it evaluates to a string, number or
boolean, and a host child into text when it evaluates to a string or
number. `title={{ a: yield t, b: 'x'.length }}` is static after that,
and the `yield` in `title={false && (yield bag.x)}` is dropped. The
rule reads only literals for this: templates, members of string and
number literals, unary operators and short circuits on them.
- dom-expressions counts a tagged template as dynamic only as the whole
value, so `title={(yield t) + tag`x`}` builds and is no longer
reported.
* docs(changeset): describe the spread, select and folding rules
* fix(solid): split class and style objects as dom-expressions does
Codex found more false reports in the DOM rule's class and style
handling, each checked against the installed babel-preset-solid:
- dom-expressions splits a `class` object, and a `['static', { … }]`
array, into one attribute per key, drops a key whose value it can
evaluate, and sets each remaining key in an effect only if its value
is dynamic. So `class={{ active: yield t, big: bag.big }}` builds.
A computed key, or one with a space or colon, keeps the object
whole, set in an effect, which the rule missed.
- It inlines a `style` key whose value is a string or number, drops a
`null` or `undefined` one, and splits off the rest the same way; a
computed key or a spread keeps the object whole.
- `className` is a plain attribute to it, set in an effect only when
dynamic.
- babel evaluates a sequence to its last value, so
`title={(yield bag.x, 'a')}` folds into a literal.
* fix(solid): read evaluated class and style values as dom-expressions does
A second Codex pass found false reports where dom-expressions sets a
`class` or `style` value in place because babel can evaluate it:
`class={null && (yield t)}`, a computed key like
`[(yield t, 'active')]`, and a class key holding an array it
evaluates. A whole `class` or `style` value, or what stays in a style
object, is now set in an effect only when it is dynamic or can't be
evaluated, and literal values cover arrays and objects. An object's
nested values are checked as part of the object, so a tagged template
inside one isn't dynamic.
* refactor(solid): drop a fold check that changes no result
A value that folds into a literal keeps no `yield`, since
`collect_folded_yields` drops them, so only an object's values need
folding in the dynamic test. Turning the check off failed no test.
* fix(solid): drop duplicate attributes and fold typeof a class
A third Codex pass found two more false reports: without a spread,
dom-expressions keeps only the last attribute of a name (but every
`ref`), so a `yield` in an earlier one is dropped; and babel evaluates
`typeof` a function or class to `'function'` without running it.
* fix(solid): rename stateful properties before dropping duplicates
dom-expressions renames a stateful property set to something other than
a literal (`value`, `checked`, …) to `prop:…` before it drops duplicate
attributes, so `<input value={yield bag.value} value="kept" />` keeps
both and moves the `yield` into an effect. The previous commit dropped
the first one and missed it (found by Codex).
* docs(changeset): describe the class, style and duplicate rules
* fix(solid): read stateful properties exactly as the compiler does
A fifth Codex pass found edge cases in the stateful-property names: the
compiler looks the tag up in upper case, doesn't count a RegExp or
BigInt as a literal, and folds a textarea's literal value into its
content, which removes that attribute before duplicates are dropped.
* fix(solid): skip children the compiler drops or replaces
Two false reports from the re-review, each checked against the DOM
build: a textarea's literal `value` or `defaultValue` (or a bare
`value`) replaces its children, so `<textarea value="x">{yield bag.t}</textarea>`
builds; and without a spread, a `children` attribute is dropped when
the element has children of its own, so
`<div children={yield bag.t}>x</div>` builds too.
* fix(solid): drop a children attribute on a void element
dom-expressions never writes children for a void element, so a
`children` attribute there is dropped too:
`<input children={yield bag.t} />` builds.
* test(solid): cover a children attribute on a void element
* fix(solid): report yields in kept class objects and listener data
Two misses from the re-review, each checked against the DOM build:
- A `class` object with a method or accessor keeps the whole object,
which dom-expressions sets in an effect beside the split keys, so
`class={{ a: yield t, b() { return 1; } }}` fails to build.
- On an event it doesn't delegate (`onScroll`, `on:click`), a
`[handler, data]` array becomes `e => handler(data, e)`, so both
elements move into a new listener; a third element is dropped.
Delegated events keep both in place.
* docs(changeset): note the children and listener rules for TSRX2034
* fix(solid): skip void and noscript children, split any listener data
From a Codex pass on 0740ad7..6a35169, each checked against the
DOM build:
- dom-expressions writes no children for a void element or a
`<noscript>`, so `<input>{yield bag.t}</input>` builds.
- A `[handler, data]` array on an event it doesn't delegate keeps only
the first two elements whatever follows, so
`onScroll={[bag.h, yield t, ...bag.e]}` fails; a spread for the data
is passed as is. A hole or a spread handler, or a hole for the data,
makes the compiler throw, so those stay unreported.
The changeset now names `defaultValue` and a bare `value` too.
* fix(solid): apply the drop rules to elements created in an arrow
From a second Codex pass, on 8b4cacc, each checked against the DOM
build:
- A host element the compiler creates in an immediately called arrow
(a ternary arm, a fragment, a dynamic child) was reported whole, so
what it drops was reported too: `t ? <input>{yield bag.t}</input> : null`
builds. It's now walked like an inline element, with everything it
keeps moved.
- A `children` attribute is also dropped on a `<noscript>` and beside a
textarea's literal value, which writes its own children.
The exempt-shape test title now says the DOM output leaves the `yield`
in place or drops it.
* fix(solid): skip delegated event tails, $key and shadowed children props
From a third Codex pass, on bf62582, each checked against the DOM
build:
- The compiler keeps only the first two elements of an event array on
a delegated event too, so `t ? <button onClick={[h, d, yield x]} /> : null`
builds.
- A component's `children` prop is dropped when the component has
children: `<Comp children={yield bag.t}>x</Comp>` builds.
- The DOM output removes an element's first `$key`:
`<div $key={yield bag.k} />` builds.
A top-level `<svg xmlns={yield …}>` is left as a known gap.
* test(solid): report the className and spread-in-a-ternary yields main now defers
Since main's #1232, Solid TSRX compiles a host element's className to class, which babel-preset-solid sets in an effect. Since #1107, it wraps a host spread in a normalize_spread_props call, so in a ternary arm (#246's shape) the compiler creates the element in an immediately called arrow. A yield in either place now leaves its generator, so TSRX2034 is right there. The downstream probes against the installed babel-preset-solid already agree.
Move both shapes to the reported list. The runtime test keeps a yield beside a host spread and a ref, on the returned element, which the compiler still evaluates in place.
* fix(vue): evaluate a host spread that yields before the element
Main's #1108 binds Vue host spreads in place, as `{...(X = normalize(expr))}`, so vue-jsx-vapor's render effect reads the bag again when it changes. A `yield` in that bag would then run inside the effect, outside its generator, so TSRX2034 reported it and the runtime test's yielding spread stopped compiling.
A generator yields a value once, so an effect could never read a yielded bag again anyway. On a target that reports deferred template yields, a host spread whose bag yields keeps its setup declaration, evaluated before the element where the generator runs it, as every Vue spread was before #1108. Every other spread, including one beside it, is still bound in place, and React, Preact and Hono are unchanged. A new Vue test pins both forms.
* test(solid): report a yield in a static @for iterable now that main wraps it
Since main's #1134, Solid TSRX passes an @for iterable to `for_items(...)`, so `each={__for_items(yield t)}` is a call. babel-preset-solid reads such a <For> prop in a getter, where the `yield` no longer runs in its generator. The compiled output fails to parse, and the downstream probe against the installed babel-preset-solid agrees. TSRX2034 is right there now.
Move the case from "allows" to "reports", as with the className and #246 shapes. A yield in a static @if test still runs in place.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRKmwAwuyPbGQ1ejNqiJ46
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.

Stacked on #1168; review the commits after aac95f5; merge after #1168.
Summary
Beside scoped styles, an element's class now renders the way its target renders it without them, plus the scope classes. Solid and Vue also accept React-style
className(#1216 cases 1–3; case 4 stays open, see below).className={props.c},cunset (ornull,false)undefined tsrx-…tsrx-…className={true}true tsrx-…tsrx-…class={{ active: on }}[object Object] tsrx-…active tsrx-…class={['a', off && 'b', 'c']}a,false,c tsrx-…a c tsrx-…class={1}, or a function1 tsrx-…, function sourcetsrx-…<div className="x" />classname="x", with or without stylesclass="x"<div className={props.c} />classnameattribute (Vue static)class={props.c}How:
jsx.classValueplatform option names how the runtime renders a class value. A class that may not be a string joins the scope classes throughjoin_scope_class(value, scope, kind)from@tsrx/runtime/ref:'text'(React, Hono DOM) leaves outnull,undefined,trueandfalse.'text-true'(Preact) renderstrueas text.'text-both'(Hono's server) renders both booleans as text.'list'(Solid, Vue) keeps an object or a list and leaves out other values that are not strings.merge_spread_class's last argument, which replaceshostSpreadClassList), so a Hono server spread'sclass: falseprintsfalseas plain Hono does.$classread) still joins in the template literal, and the type-only print is unchanged.classNameon Solid and Vue (your decision on case 3). A newjsx.rewriteClassNameAttroption, set by Solid and Vue, renames an intrinsic element'sclassNametoclassbefore style scopes stamp it. This applies to static and dynamic values, with and without scoped styles.<{Tag}>or member tag may be a component, so it keepsclassName;const Tag = Inner; <{Tag} className="x" />passesclassNametoInner.classand oneclassName, they become oneclass: one string when both are string literals, otherwise[class, className].classNamewhere it is written instead of joining it ahead of the spread. Each target then handles the twoclassattributes as written: Solid keeps the later one (bforclass="a" {...{ class: 'bag' }} className="b"), and Vue'smergePropsjoins them (a bag b).classNameattributes stay two attributes, keeping TypeScript's duplicate-attribute error.classandclassNameapart; there it's the last one named like the first (a newjsx.classPropsPrintedApartoption, set for Hono's server only).<p class="a" {...bag} className="b" />beside a<style>rendersb tsrx-…on Solid. On Vue, whosemergePropsjoins them, it stays on the first:a tsrx-… fromBag b.class. It gives the name asource_name, so the generatedclassmaps back to the authoredclassNamewith every editor feature (hover, rename, go-to-definition, diagnostics).classattributes even across a spread.class, the second attribute's name maps to it as well, so hover and go-to-definition work on both authored names.className, as at runtime. The targets' element types are unchanged.className) stays open. The previous head wrapped a Vue spread inmerge_spread_classfor itsclassName, which broke SSR and reactivity. It printed a secondclassin Vue SSR, caused a hydration class mismatch for{ className: undefined }beside a laterclass, and frozereactive()bags' keys. It is reverted (77a9cf3), and your decision covers authored attributes, not runtime bags.{ className: 'mine' }still renders onlytsrx-…on the client, where plain Vue rendersmine, and Vue SSR prints twoclassattributes.mergePropsstill joins a spread'sclass.ensure_named_importadded the helper to the first import of its module. That printedimport * as r{ … }beside a namespace import, and put the helper in animport typethat the build erases. It now joins only a named value import and otherwise adds an import of its own. (This predates the PR, but scoped classes now reach it.)Output change: a class-map read such as
class={theme.dark}is a string at runtime, but the compiler can't tell. It now compiles to__join_scope_class(theme.dark, "tsrx-…")(with"list"on Solid and Vue) and renders the same as before. The shared scoped-style tests, the conformance harness and the fixture README describe this; the fixture JSON is unchanged.Known differences and follow-ups
className={false}rendersfalsenatively and the scoped join leaves it out.class={false}is left out natively too. The kind is per target, not per attribute, so this one stays.cssthenable keeps its own class but gets no scope hash, the same gap as fix(core): keep a host spread's class beside scoped style classes #1168's spread path. Joining it would need to resolve the promise; this is a follow-up.<{tag} className="x" />withtag = 'div') keepsclassName, which Solid renders as aclassnameattribute. A dynamic tag may be a component, so the compiler can't rename it. This was already true on main.classandclassName: in 4 of the 21 SSR shapes tested, the applied class still differs from plain Hono's, though it carries the hash. fix(core): keep a host spread's class beside scoped style classes #1168'smerge_spread_classmoves the bag's other-named class, and the order Hono prints depends on the bag's keys at runtime.Verification
class={value}with and without a<style>sibling on all five targets.undefined,null,false,true,0,''and a string on every target; objects, lists,1and a function on Solid and Vue; a list on React.classNamewith the matchingclassfor a string,undefinedand an object, alone, besideclassand beside scoped styles, and check that noclassnameattribute remains. With the rewrite disabled, those 6 tests fail.undefined,null,false,true,'',0and a string.tsrx-tsc(TS 5.9) and nativetsc(TS 7) on Solid and Vue projects. They useclassName="x",className={props.c},classwithclassName(also across a spread), a component'sclassNameprop, and a dynamic tag's.className, and the dynamic tag and spread cases failed too.className={Symbol()}reports TS2322 at the authoredclassName(line 14, column 6) under both compilers.classandclassNamearound a spread,classNamefirst, and twoclassNames with the same element written natively, and expect one scope hash. On Solid they fail before d385b0e. Vue's output staysa tsrx-… fromBag b.classNameas written.class="a" {...bag} className="b"renders asclass="a" {...bag} class="b"does on each target.classandclassName(f113350): a new SSR test checks that the hash goes on the class Hono prints first, and fails before; a Hono DOM test keeps it on the last attribute. Over 21 SSR shapes, the applied class has the hash in all 21 (3 before), and no shape that matched plain Hono stops matching. Hono DOM is unchanged (12 of 12).@tsrx/vue/ref; both fail without the fix.className→classand the merged forms;classNameattributes;classNametoclassand its editor features.merge_spread_classdropping numbers,trueand functions in list mode.tsrx-utils,content-mapperandtypescript-plugin: 105 files, 6555 passed. The review's SSR probe still matches in all 88 cases.pnpm typecheckclean,prettier --checkclean,pnpm changeset:checkpasses.tsrx-utilsand the five targets' compile and runtime projects plus the Hono plugins, 5838 passed, 65 skipped; the other plugin projects, 100 passed.tsc(tsrx, tsrx-hono, tsrx-react, tsrx-solid, vite-plugin-hono,typecheck:tests) and Prettier are clean.Related
Related: #1216 (cases 1–3; case 4, a Vue spread bag's
className, stays open)Related: #1168, #722
Cursor Bugbot
hostSpreadClassProps: ['className']comes from fix(core): keep a host spread's class beside scoped style classes #1168 (beab99b). Beside a<style>,<span {...{ class: 'x' }} />rendersclass="x"with no scope hash on both fix(core): keep a host spread's class beside scoped style classes #1168 and this PR, where plain React rendersx. A TSRX wrapper that spreads a forwardedclassloses the hash the same way. It isn't fixed yet, here or in fix(core): keep a host spread's class beside scoped style classes #1168.classandclassNameas twoclassattributes and a browser reads the first, so<span class="a" className="b" />beside a<style>printedclass="a" class="b tsrx-…"and lost the hash. A newjsx.classPropsPrintedApartoption, set for Hono's server only, puts the hash on the last attribute named like the first (f113350), which keeps the hash in all 21 SSR shapes tested (3 before). Hono DOM still gets it on the last attribute.merge_spread_class: the hash goes on the first-named class attribute, and a later spread's other-named class is folded onto it.<span class="a" {...{ className: 'x' }} className="b" />appliesx tsrx-…where plain Hono appliesa, as does theclassName="a" … class="b"form; these are two of the bag shapes under the Hono server difference above. A change that kept such a class apart was tried and dropped: it matched plain Hono in 18 more of 109 shapes, but rendered worse than this head with two spreads after the class (80 of 1,764 cases).🤖 Generated with Claude Code
Note
Medium Risk
Cross-cutting JSX compile and runtime behavior for every first-party target; edge cases (booleans, objects, multiple class attributes, Hono SSR) change rendered output despite broad test coverage.
Overview
Scoped CSS class stamping now follows how each JSX runtime renders
class/className, instead of always concatenating strings. The compiler routes non-trivial class values throughjoin_scope_classand spread props throughmerge_spread_class, with per-targetjsx.classValue(text,text-true,text-both,list) and spread options such ashostSpreadClassPropsandclassPropsPrintedApart(Hono server vs DOM).That fixes cases where scoped output showed
undefined tsrx-…,[object Object] tsrx-…, or dropped spread classes beside a<style>block; spreads after an authored class now keep spread class + scope hash on React, Preact, Solid, Hono, and Vue (Vue still relies onmergePropsfor spreads rather thanmerge_spread_class).Solid and Vue gain
jsx.rewriteClassNameAttr: intrinsic elements compile authoredclassNametoclass, including type-only output and source maps so the editor still understandsclassName. Components, dynamic tags, and spread bags keepclassNameas written; Vue spread bags with onlyclassNamebeside scoped styles remain a known gap.Platform transforms, the style-scope pre-pass, shared conformance tests, and Vite plugin runtime/SSR suites are updated to lock in the new join semantics and imports for the helpers.
Reviewed by Cursor Bugbot for commit f113350. Bugbot is set up for automated code reviews on this repo. Configure here.