Skip to content

Feat: cx.multiple() for declare multiple classes#291

Merged
github-actions[bot] merged 1 commit intomainfrom
cx-fn
Jan 17, 2026
Merged

Feat: cx.multiple() for declare multiple classes#291
github-actions[bot] merged 1 commit intomainfrom
cx-fn

Conversation

@black7375
Copy link
Contributor

@black7375 black7375 commented Jan 16, 2026

Description

Related Issue

Summary by CodeRabbit

  • New Features

    • Added cx.multiple() to process multiple class mappings at once and return a mapped object of class strings.
    • Enhanced typing for the multi-mapping API so results are strongly typed per input keys.
  • Tests

    • Added test coverage for multiple-mapping scenarios (various inputs, empty cases, and key handling).

✏️ Tip: You can customize this high-level summary in your review settings.

Additional context

Checklist

@changeset-bot
Copy link

changeset-bot bot commented Jan 16, 2026

⚠️ No Changeset found

Latest commit: 7aa2c45

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Added a typed cx.multiple helper and new types so cx (built on clsx) can accept a map of class inputs and return an object with the same keys and resolved class strings.

Changes

Cohort / File(s) Summary
Type Definitions
packages/css/src/classname/types.ts
Added ClassMultipleInput = Record<string, ClassValue> and ClassMultipleResult<T> mapped output type.
Core Implementation
packages/css/src/classname/cx.ts
Added import type { ClassMultipleInput, ClassMultipleResult }; implemented cxMultiple<T>(map: T): ClassMultipleResult<T>; changed export to Object.assign(clsx, { multiple: cxMultiple }).
Tests
(updated tests in same package)
Added test suite covering cx.multiple scenarios (map processing, mixed inputs, empty map, empty values, type assertions).

Sequence Diagram(s)

(omitted — change is an internal API feature without multi-component sequential interactions)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Nose twitch, I hop and fiddle,
Keys and classes in my middle.
Map them, flatten every tangle,
cx.multiple — a joyful wrangle,
Hooray — the rabbit did the handle! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description follows the required template structure but lacks substantive implementation details, only providing a related issue reference without explaining the feature or changes. Add a clear explanation of what cx.multiple() does, why it's needed, and how it works. Provide implementation details and testing considerations to help reviewers understand the feature.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature addition: a new cx.multiple() method for declaring multiple classes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Triggered from #291 by @​black7375.

Checking if we can fast forward main (e9ebbb2) to cx-fn (469d698).

Target branch (main):

commit e9ebbb2bf988240c5b70bcfc97820bbfdfb27d96 (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sun Nov 23 00:00:00 2025 +0900

    Chore: yarn audit config

Pull request (cx-fn):

commit 469d698de56d770278c9051fd79dcf943c4282a1 (pull_request/cx-fn)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Mon Nov 24 00:00:00 2025 +0900

    Feat: `cx.multiple()` for declare multiple classes

It is possible to fast forward main (e9ebbb2) to cx-fn (469d698). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to cx-fn.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/css/src/classname/cx.ts`:
- Around line 118-121: The skipped test "handles bigint inputs" in cx.ts creates
a mismatch with the ClassValue type (which includes bigint) and upstream clsx
behavior; either re-enable the test by changing it.skip to it (to verify BigInt
handling in the cx function), or if BigInt support is intentionally unsupported,
remove bigint from the ClassValue union/type and delete the test, or add a clear
comment above the test explaining why it is skipped and referencing the
decision; search for the test title "handles bigint inputs" and the ClassValue
type to make the corresponding change so types and tests remain consistent.
🧹 Nitpick comments (1)
packages/css/src/classname/cx.ts (1)

30-32: Avoid mutating the clsx export.

Object.assign(clsx, …) mutates a third‑party function object, which can leak side effects to other imports of clsx. Prefer wrapping clsx and attaching multiple to the wrapper instead.

♻️ Proposed change
-export const cx = Object.assign(clsx, {
-  multiple: cxMultiple
-});
+const cxBase: typeof clsx = (...inputs) => clsx(...inputs);
+export const cx = Object.assign(cxBase, {
+  multiple: cxMultiple
+});
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e9ebbb2 and 469d698.

📒 Files selected for processing (2)
  • packages/css/src/classname/cx.ts
  • packages/css/src/classname/types.ts
🧰 Additional context used
🧬 Code graph analysis (2)
packages/css/src/classname/cx.ts (1)
packages/css/src/classname/types.ts (2)
  • ClassMultipleInput (28-28)
  • ClassMultipleResult (30-32)
packages/css/src/classname/types.ts (2)
packages/css/src/classname/index.ts (1)
  • ClassValue (3-3)
packages/css/src/index.ts (1)
  • ClassValue (63-63)
🔇 Additional comments (4)
packages/css/src/classname/types.ts (1)

27-31: Confirm public re-exports for new types.

If ClassMultipleInput / ClassMultipleResult are meant to be part of the public API, please ensure they’re re-exported from the public barrels (e.g., packages/css/src/classname/index.ts and/or packages/css/src/index.ts) so consumers can import them consistently.

packages/css/src/classname/cx.ts (3)

2-2: No concerns.


34-45: LGTM for cxMultiple implementation.

Iteration + hasOwnProperty guard is fine, and the result shape matches the declared types.


153-201: Nice coverage for cx.multiple.

The tests cover mixed inputs, empty map, and type assertions well.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions
Copy link
Contributor

Triggered from #291 by @​black7375.

Checking if we can fast forward main (e9ebbb2) to cx-fn (7aa2c45).

Target branch (main):

commit e9ebbb2bf988240c5b70bcfc97820bbfdfb27d96 (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sun Nov 23 00:00:00 2025 +0900

    Chore: yarn audit config

Pull request (cx-fn):

commit 7aa2c457f83bb006b3f4391a9ec0fcaf3ce9bb94 (pull_request/cx-fn)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Mon Nov 24 00:00:00 2025 +0900

    Feat: `cx.multiple()` for declare multiple classes #291

It is possible to fast forward main (e9ebbb2) to cx-fn (7aa2c45). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to cx-fn.

@black7375
Copy link
Contributor Author

/fast-forward

@github-actions
Copy link
Contributor

Triggered from #291 (comment) by @​black7375.

Trying to fast forward main (e9ebbb2) to cx-fn (7aa2c45).

Target branch (main):

commit e9ebbb2bf988240c5b70bcfc97820bbfdfb27d96 (HEAD -> main, origin/main)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sun Nov 23 00:00:00 2025 +0900

    Chore: yarn audit config

Pull request (cx-fn):

commit 7aa2c457f83bb006b3f4391a9ec0fcaf3ce9bb94 (pull_request/cx-fn)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Mon Nov 24 00:00:00 2025 +0900

    Feat: `cx.multiple()` for declare multiple classes #291

Fast forwarding main (e9ebbb2) to cx-fn (7aa2c45).

$ git push origin 7aa2c457f83bb006b3f4391a9ec0fcaf3ce9bb94:main
To https://github.com/mincho-js/mincho.git
   e9ebbb2..7aa2c45  7aa2c457f83bb006b3f4391a9ec0fcaf3ce9bb94 -> main

@github-actions github-actions bot merged commit 7aa2c45 into main Jan 17, 2026
11 of 12 checks passed
@github-actions github-actions bot deleted the cx-fn branch January 17, 2026 04:34
@coderabbitai coderabbitai bot mentioned this pull request Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant