Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(atomic): string serialization of atoms #934

Merged
merged 3 commits into from Mar 21, 2022

Conversation

jpnelson
Copy link
Contributor

Motivation

Addresses #912

Summary

Should be fairly straightforward after reading the reason why we might want this. I've also updated the documentation to reflect what's going.

Test plan

Tested with snapshot tests and unit tests. Docs should render the same way

@jpnelson
Copy link
Contributor Author

Hi @Anber , thanks so much for looking at the other PR's I've put up!

This one addresses some issues we've come across when using atomic styles in Linaria – namely, it's confusing for people that cx(a, cx(b, c)) !== cx(a, b, c). This should fix that by just providing strings. Another advantage is you don't (strictly) need to use cx with atomic styles if you're not merging – you could apply the class string directly.

Would love to get your thoughts! The issue linked provides more detailed rationale. Thanks again!

@@ -2,6 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": { "paths": {}, "rootDir": "src/" },
"references": [
{ "path": "../atomic" },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like it's unneeded here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realized this is being added because there's a dev dependency @linaria/atomic. We can keep it removed it but I think that's why it's being re-added.

@Anber
Copy link
Collaborator

Anber commented Feb 24, 2022

Hi @jpnelson!
It looks good to me but I don't have enough experience with atomic styles, so all decisions about it are up to you :)

@jpnelson
Copy link
Contributor Author

jpnelson commented Mar 4, 2022

@Anber I added another commit to this PR, to add property priorities to address #902 . It depends on this PR so I added it to this one.

Do you think you'd be able to do a release when this goes in? (I think we'd need new versions of @linaria/babel-preset and @linaria/atomic). Thanks again for your reviews!

@jpnelson
Copy link
Contributor Author

@Anber sorry to ping again on this – do you think a merge / release is possible?

We're also testing and iterating on these features in our project. I'm hopeful this is the last major change, but if the frequency of releases is inconvenient, we could create a fork for our project and try and contribute back later in a larger chunk.

Thanks again for your time! 🙏

@Anber
Copy link
Collaborator

Anber commented Mar 18, 2022

@jpnelson sorry for the delay, I was in mountains for the last two weeks almost without all communications. I'll merge it and release in a couple of days.

@jpnelson
Copy link
Contributor Author

Haha that's very understandable, thank you! 🙏

@Anber Anber merged commit ef19ccb into callstack:master Mar 21, 2022
@@ -1,6 +1,26 @@
import postcss, { Document, AtRule, Container, Rule } from 'postcss';
import { slugify } from '@linaria/utils';
import stylis from 'stylis';
import { all as knownProperties } from 'known-css-properties';
import { getPropertyPriority } from './propertyPriority';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @jpnelson
Looks like you didn't add this file to the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my mistake, sorry @Anber ! I've added it back in #950 . I think this was missing because it was originally a separate PR.

Sorry I missed that too – the precommit hooks seem extensive, but let me know if there's anything else I can run before merging – CI doesn't seem to start for me when I create PR's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants