atlassian-labs / compiled

A familiar and performant compile time CSS-in-JS library for React.
https://compiledcssinjs.com
Apache License 2.0
1.99k stars 67 forks source link

Allow `ax()` to handle non-string classnames when collected. #1696

Closed kylorhall-atlassian closed 3 months ago

kylorhall-atlassian commented 3 months ago

I want to allow our ax() collection to better handle arbitrary values. The example being passing using our pass-through styles with cssMap like <Component xcss={cx(…)} /> or <Component xcss={[…]} /> results in ax capturing things like this:

[
  '_1bah1yb4',
  undefined,
  ['_16jlkb7n', undefined],
  AtomicGroups {
    values: Map(2) { '_1bsb' => '_1bsb1osq', '_16jl' => '_16jlkb7n' }
  }
]

I don't know if it's the best way to handle this, but internally we've just been invoking toString() via a wrapper, and we're trying to get to native Compiled. Makes sense (and works) to me!

PR checklist

I have...

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 7835fd8196096b6c85455efb95199558365b96d8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------------- | ----- | | @compiled/react | Patch |

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](https://github.com/atlassian-labs/compiled/new/handle-non-string-classnames?filename=.changeset/moody-otters-play.md&value=---%0A%22%40compiled%2Freact%22%3A%20patch%0A---%0A%0AAllow%20%60ax()%60%20to%20handle%20non-string%20classnames%20when%20collected.%0A)

netlify[bot] commented 3 months ago

Deploy Preview for compiled-css-in-js canceled.

Name Link
Latest commit 7835fd8196096b6c85455efb95199558365b96d8
Latest deploy log https://app.netlify.com/sites/compiled-css-in-js/deploys/6698946c7fa37b0008030827
kylorhall-atlassian commented 3 months ago

Closing as I think https://github.com/atlassian-labs/compiled/pull/1697 is just a better approach.