Skip to content

chore(deps): tailwind-variants 4.0.2 on its lite runtime - #438

Merged
sydevs-bot merged 6 commits into
mainfrom
chore/tailwind-variants-4
Nov 19, 2026
Merged

sydevs-bot merged 6 commits into
mainfrom
chore/tailwind-variants-4

Conversation

@sydevs-bot

Copy link
Copy Markdown
Contributor

Summary

This upgrades tailwind-variants from 3.3.1 to 4.0.2, the current latest, pinned exactly. Every recipe now takes tv from a new src/styles/tv.ts: the package's lite runtime (createTV({ twMerge }) from tailwind-variants/lite), merging through tailwind-merge 3.7.0, which package.json already listed. Every recipe's class strings are unchanged, and every gate passes at the existing budgets.

What changed and why it matters

  • The upgrade itself. 4.0 makes these changes:

    • the tailwind-merge and tailwindcss peers are gone
    • twMergeConfig moved to /config
    • experimentalParseClassName was removed
    • empty class lists return ""
    • types got stricter
    • lite now calls a twMerge function you pass it

    Only the empty-string change shows up in this codebase.

  • Why the lite route. A plain upgrade that keeps importing tv from the package entry bundles v4's own merge engine and its compiled tables. That pushed both eager graphs over budget: standalone 337.4 and embed 338.5 KiB shipped, against 336. The lite runtime with an injected merger is the setup v4's migration guide documents for an app that keeps its own merger. It costs +1.3 KiB per graph instead.

  • 17 modules now import tv from @/styles/tv.

  • Lint refuses every tailwind-variants entry in src/, through a no-restricted-imports pattern covering the package and every subpath. src/styles/tv.ts is the one importer, with one narrow, commented disable. Covering /lite matters: bare lite's tv merges nothing, so a variant's or caller's px-6 would ship beside the base px-2, with size and typecheck both green.

  • tailwind-merge is pinned exactly to 3.7.0. tailwind-variants 3.3.1 shipped its own copy of the merge engine, so the old caret had no runtime effect. tailwind-merge now resolves conflicts for every recipe, and a routine minor bump could change that across the UI with no gate noticing. The lockfile diff is the specifier only.

  • Docs. DESIGN_SYSTEM.md (Styling) and src/components/AGENTS.md now name the import path. Neither stated a version or an API that 4.0 changed.

  • No CHANGELOG or docs/embedding.md entry. Nothing host- or visitor-observable changed: no origin, CSP, attribute or class output.

Verification

  • Full gate, .claude/skills/pr-prep/check.sh --full: PASS.
    • Lint, typecheck, and the unit lane (173 files / 2110 tests).
    • Build. assert:css reports 1213 rules, 62 @property and 775 var() refs, the same as main. assert:maps and assert:classic pass.
    • pnpm size.
  • pnpm ladle:build: PASS (168 files, no source maps).
  • pnpm check:wrangler: PASS (both configs, dry run).
  • Size, shipped, main → branch:
    • standalone 333.4 → 334.7 KiB (budget 336)
    • embed 334.5 → 335.8 KiB (budget 336, 0.2 spare)
    • loader 3.3 → 3.3 KiB (budget 3.6)
  • Recipe outputs. A scratch recorder imported all 21 tv() recipes and recorded every variant combination, each value plus unset, for every slot: 6,748 lines.
    • Against main, the only difference is 351 empty slots returning "" instead of undefined. No call site renders any of them.
    • A reviewer's independent recorder agrees. It also probed caller classNames: 73,759 outputs.
    • Re-run at the branch head, the recorder's output is byte-identical to the earlier lite run.
  • Browser, Chromium, against main. Each pass collected every element's class attribute on both sides and diffed them. Every pass found 0 class differences; the only differences were noise that main reproduces against itself.
    • All 52 Ladle stories in light and dark: 104 renders, 19,494 elements.
    • An independent pass at 1280×800 and 390×844, light and dark: 208 render pairs, 28,730 elements.
    • Interaction passes over 35 stories, about 1,000 steps: popovers, menus, the SettingsMenu submenu, drawers, the modal and form controls.
  • Merge engine. tailwind-merge 3.7.0 and 3.3.1's own engine were compared on 83.6M ordered pairs of this codebase's class tokens. They disagree on 42, all of them a later px/mx/inset-x dropping an earlier ps/pe/ms/me/start/end. No recipe or call site puts them in that order today.
  • Lint guard, watched failing. Before the fix, tailwind-variants/lite, /config and /merge imports linted clean; after it, they error. The bare entry, type-only imports and export … from are refused too. The readdirSync restriction (test(build): one source walker for the nine specs that inventory src/ #286) still fires.
  • Stray import cost. With one default-entry import beside the lite pairing, standalone measured 346.7 and embed 347.7 KiB shipped: +12.0 KiB each, and pnpm size fails.
  • Types. VariantProps for Button and Drawer stay exact unions on v4.

Not done / not verified

  • The browser class diff was not re-run after the last three commits. They touch only lint config, docs, an import statement and a package.json specifier. The recipe recorder shows byte-identical output, and the bundle size is unchanged.
  • Initial-render and interaction passes cover up to 10 controls per story. They do not cover vaul drag/snap gestures, or the review:embed host pages, which need a SahajCloud backend that accepts the key.
  • A caller px-* on the left Drawer's content slot now drops its ps-[env(safe-area-inset-left,0px)]; under 3.3.1, only a caller p-* or ps-* did. ToggleGroupItem's -ms-px against a caller mx-* is the same case. No caller passes either today. Fixing it means changing the Drawer's class strings, which is out of scope for an upgrade that must keep them unchanged.
  • "tailwind-variants": "4.0.2" was published 2026-11-10. CI's Dependency Review will see it.

Follow-ups for the maintainer

  • Embed headroom on today's main is 0.2 KiB of 336, so the next small eager addition trips pnpm size. The tech-debt PR from claude/lucid-brahmagupta-0v1c16 frees roughly 45 KiB of eager payload; landing it first removes the squeeze.
  • Consider moving the left Drawer's safe-area inset off a padding utility, as the body slot's spacer already does for pb-*. A caller p-*/px-* could then never erase it.
  • Commit 8d979f6 still quotes a misleading 2.7 KiB figure, which later commits correct in the code and docs. Word the squash message from this description.
  • The branch is based on 3d9c45d. main has since gained 5ce0f21 (chore(contracts): re-sync copied contracts from SahajCloud #434, payload-types.ts only, no overlap). The lockfile change is limited to tailwind-variants and the tailwind-merge specifier, so other dependency PRs may conflict on those lines only.
  • No .claude/ change is needed.

Generated by Claude Code

4.0 drops the tailwind-merge peer and bundles its own merge engine with
compiled tables in the default entry. Imported as before, that entry put
both eager graphs 4.0 KiB gzipped over main (standalone 337.4, embed 338.5
shipped, against a 336 budget). Every recipe now takes `tv` from
`src/styles/tv.ts` instead: the lite runtime, merging through the
tailwind-merge 3.7.0 already in the tree, which the migration guide
documents for an app that keeps its merger. That costs +1.3 KiB per graph
(334.7 / 335.8 shipped; loader unchanged at 3.3).

Every recipe's class strings are unchanged. Checked by recording all 21
recipes over every variant combination and slot (6,726 outputs) before and
after: the only difference is that a slot with no classes now returns ""
where 3.3.1 returned undefined, and no rendered slot is empty. Every Ladle
story, light and dark, renders the same class attribute on all 19,494
elements in Chromium. tailwind-merge 3.7.0 and 3.3.1's built-in engine
agree on 83.6M ordered pairs of this codebase's class tokens except 42,
where a later px/mx/inset-x now drops an earlier ps/pe/ms/me/start/end;
no recipe or call site puts those in that order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
The package entry bundles a second merge engine, 2.7 KiB gzipped on both
eager graphs, and a recipe built on it would also resolve conflicts with a
different engine from every other recipe. `src/styles/tv.ts` is the one
import; its `tailwind-variants/lite` path is not restricted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
…e one

The guard named only the package entry, so `tailwind-variants/lite`, the
specifier `src/styles/tv.ts` itself uses, linted clean everywhere. Bare
lite's `tv` merges nothing: a recipe built on it ships a variant's or a
caller's `px-6` beside its base `px-2`, and size and typecheck stay green.
A pattern over the package and every subpath now refuses all of them, with
one narrow disable on the sanctioned import.

The old message priced the default entry at 2.7 KiB. That is the gap
between the two whole-app setups; one stray default-entry import beside
the lite pairing measured +12.0 KiB on both eager graphs (standalone 346.7,
embed 347.7 shipped), so the message drops the number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
tailwind-variants 3.3.1 shipped its own frozen copy of the merge engine,
so the caret on tailwind-merge moved nothing at runtime. Through
`src/styles/tv.ts` it is now the engine for every recipe, and a routine
minor bump could change conflict resolution across the UI with every gate
green: the step from 3.3.1's copy to 3.7.0 alone changed 42 token pairs.
The pin matches tailwind-variants and tailwindcss beside it. Only the
importer specifier changes in the lockfile; 3.7.0 stays resolved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
The bullet priced the default entry at 2.7 KiB, which is the gap between
two whole-app setups, not the cost of the stray import it warns against
(about 12 KiB beside the lite pairing). It also missed that bare `lite`
merges nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVeNzer8ue5c7JRsZk
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 19, 2026
@sydevs-bot

sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

Written by the sydevs dispatcher. Sessions never edit this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants