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

Fix: Typescript syntax, typos #13

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Fix: Typescript syntax, typos #13

merged 1 commit into from
Oct 2, 2024

Conversation

black7375
Copy link
Contributor

@black7375 black7375 commented Oct 2, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced guidance for expressing CSS in TypeScript using the css() API.
    • Introduced nesting and referencing techniques for CSS, including attribute selectors and nested properties.
    • Added a new rules() API for declarative style definitions, supporting static and dynamic styling.
  • Documentation

    • Comprehensive updates and examples for CSS features, ensuring backward compatibility and clarity in usage.

Copy link

changeset-bot bot commented Oct 2, 2024

⚠️ No Changeset found

Latest commit: 55ab16a

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.

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

Copy link

graphite-app bot commented Oct 2, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link

coderabbitai bot commented Oct 2, 2024

Walkthrough

The pull request introduces extensive revisions to documentation on CSS handling in TypeScript, focusing on the css() API and its alias style(). Key enhancements include the addition of new features for CSS nesting, rules, and styling methodologies. The updates emphasize type safety, backward compatibility, and the integration of Vanilla Extract. New methods and updated signatures are introduced, along with comprehensive examples to illustrate the transition from traditional CSS to the new syntax. The changes aim to clarify and improve the structure of CSS in TypeScript.

Changes

File Change Summary
text/000-css-literals.md Revised to enhance guidance on CSS in TypeScript, added examples for object styles, vendor prefixes, etc.
text/001-css-nesting.md Restructured to introduce new features for CSS nesting and referencing, with detailed examples and syntax.
text/002-css-rules.md Introduced rules() API for declarative styling, expanded on variants, and included examples for usage.

Possibly related PRs

  • Improved backward compatibility #11: The changes in this PR introduce an alias for the cssVariants() function, which is directly related to the modifications made in the main PR regarding the cssVariants() method signature update.

Poem

In the land of styles where rabbits play,
New methods hop in, brightening the day.
With css() and rules(), we dance and we twirl,
Crafting our styles in a whimsical whirl.
Type safety's here, and nesting's a breeze,
With Vanilla Extract, we style with ease! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Oct 2, 2024

Triggered from #13 by @​black7375.

Checking if we can fast forward main (a9f6f1b) to ts-compile (55ab16a).

Target branch (main):

commit a9f6f1b38bb1c84d4c8ae75660f91271994453ee (HEAD -> main, origin/main, origin/HEAD)
Author: MS_Y <[email protected]>
Date:   Thu Sep 26 19:28:07 2024 +0900

    Fix: Compiled css syntax

Pull request (ts-compile):

commit 55ab16a3f934c059b4b4d7dd3953ebca290bb93c (pull_request/ts-compile)
Author: alstjr7375 <[email protected]>
Date:   Wed Oct 2 17:44:44 2024 +0900

    Fix: Typescript syntax, typos

It is possible to fast forward main (a9f6f1b) to ts-compile (55ab16a). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to ts-compile.

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: 0

🧹 Outside diff range and nitpick comments (14)
text/000-css-literals.md (2)

522-524: LGTM: Backward compatibility measures are well-considered.

The backward compatibility approach is well-thought-out, ensuring a smooth transition for existing Vanilla Extract users. Aliasing css() to style() and cssVariants() to styleVariants() maintains API consistency.

For consistency with the rest of the document, consider removing the backticks around vars: and selectors: on line 523:

-- Should be support [`vars: `](https://vanilla-extract.style/documentation/styling#css-variables) and [`selectors: `](https://vanilla-extract.style/documentation/styling#complex-selectors) properties
+- Should be support [vars:](https://vanilla-extract.style/documentation/styling#css-variables) and [selectors:](https://vanilla-extract.style/documentation/styling#complex-selectors) properties
🧰 Tools
🪛 Markdownlint

523-523: null
Spaces inside code span elements

(MD038, no-space-in-code)


523-523: null
Spaces inside code span elements

(MD038, no-space-in-code)


Line range hint 1-651: Excellent RFC: Comprehensive and well-structured proposal for CSS-in-TypeScript syntax.

This RFC presents a thorough and well-considered proposal for a new CSS-in-TypeScript syntax. The document is well-structured, providing clear motivation, detailed explanations with examples, and a thoughtful discussion of drawbacks and future possibilities.

Consider the following minor improvements for clarity and completeness:

  1. Add a table of contents at the beginning of the document for easier navigation.
  2. In the "Unresolved questions" section, consider adding a brief discussion on the performance implications of the proposed syntax compared to existing solutions.
  3. In the "Future possibilities" section, you might want to mention potential integration with existing TypeScript tooling and IDE support for the new syntax.

These additions would further enhance the already comprehensive nature of the RFC.

text/001-css-nesting.md (6)

Line range hint 584-615: LGTM! Clear explanation of nesting order.

The proposed order for stabilizing nested structures is well-reasoned, considering both performance and readability. The explanation for each level (At-Rules and selectors) is clear and justified.

Consider adding a brief summary table or diagram at the end of this section to visually represent the nesting order. This could help readers quickly grasp the concept.


Line range hint 616-664: LGTM! Clear demonstration of nesting order application.

The example effectively shows how the proposed nesting order is applied in practice. The conversion to Vanilla Extract correctly follows the established order, providing a clear illustration of the concept.

Consider adding brief comments within the Vanilla Extract example to explain each nesting level. This could help readers understand how each part of the nested structure corresponds to the proposed order.


Line range hint 666-667: Consider expanding the Drawbacks section.

While the mentioned drawback is valid, this section could benefit from more elaboration. Consider discussing:

  1. Potential performance implications of deep nesting.
  2. Challenges in debugging deeply nested styles.
  3. Learning curve for developers new to this syntax.
  4. Possible mitigation strategies for each drawback.

Expanding this section would provide a more balanced view of the proposal and help address potential concerns.


Line range hint 669-778: LGTM! Comprehensive comparison with alternatives.

This section effectively compares the proposed syntax to existing preprocessors and provides well-explained alternatives. The examples for Partial Reference and Path-like Reference are particularly helpful in understanding the design decisions.

Consider adding a brief summary at the end of this section that clearly states why the proposed approach was chosen over the alternatives. This would help reinforce the rationale behind the design decisions.


Line range hint 780-783: Consider expanding the Unresolved questions section.

While the concern about type-safety is valid, this section could benefit from more specific questions or areas of uncertainty. Consider adding:

  1. Specific challenges in implementing type-safety for nested syntax.
  2. Potential edge cases that need further investigation.
  3. Questions about performance implications of the proposed syntax.
  4. Compatibility concerns with existing tools or workflows.

Expanding this section would help identify areas that need further research or discussion before implementation.


Line range hint 784-791: Consider expanding the Future possibilities section.

While this section provides a glimpse into future developments, it could benefit from more details. Consider adding:

  1. A brief overview of how props handling might work in this context.
  2. Potential benefits of implementing SCSS @mixin-like and Stitches Variants-like features.
  3. How these future features might integrate with the current proposal.
  4. Any potential challenges or considerations for implementing these features.

Expanding this section would give readers a clearer picture of the long-term vision for this proposal and how it fits into the broader ecosystem.

text/002-css-rules.md (6)

495-496: Good addition to demonstrate composition!

The example effectively shows how myRule can be composed with other styles using the css() function. This is a crucial demonstration of how the new rules() API integrates with existing patterns.

To further improve clarity, consider adding a brief comment explaining the purpose of this composition, e.g.:

const myCSS = css([
  myRule({ color: "red", background: "blue", size: "5px" }),
  { borderRadius: 999 } // Additional styles can be composed directly
]);

725-726: Improved clarity in compound variants example

The use of actual string values ("brand" and "small") instead of placeholders makes the example more concrete and easier to understand. This change enhances the readability of the document.

For consistency, consider using the same format for all examples in this section. For instance, you could update the second method example to use string values as well:

compoundVariants: ({ color, size }) => [
  {
    condition: [color["brand"], size["small"]],
    style: {
      fontSize: "16px"
    }
  }
]

895-896: Enhanced rulesVariants example with more comprehensive styling options

The additions and modifications in this section significantly improve the rulesVariants example:

  1. Adding a 'medium' size variant provides a more complete set of size options.
  2. The new properties for the 'image' variant make it more realistic.
  3. The modifications to the 'detail' style variant offer more specific styling.

These changes make the example more representative of real-world usage, which is excellent for documentation purposes.

For consistency and to further improve the example, consider adding a 'medium' option to the 'style' variant of the 'image' as well. This would provide a complete set of options across all variants:

style: {
  thumbnail: { width: "50px" },
  medium: { width: "65%" },
  detail: {
    width: "80%",
    marginBottom: "10px"
  }
}

Also applies to: 905-906, 915-916


1001-1001: Valuable reference to default implementation added

The addition of the reference to the Vanilla Extract's recipes package as the starting point for the default implementation is excellent. This information is crucial for developers who might want to contribute or understand the internals of the proposed API.

To enhance this further, consider adding a brief explanation of why this particular implementation was chosen as the starting point. For example:

The default implementation starts with the [Vanilla Extract's recipes package](https://vanilla-extract.style/documentation/packages/recipes/) [code](https://github.com/vanilla-extract-css/vanilla-extract/tree/master/packages/recipes) due to its robust foundation and alignment with our goals for static extraction and type safety.

1050-1050: Excellent addition addressing programmatically generated styles

The new subsection on programmatically generated styles is a valuable addition to the "Drawbacks" section. It addresses a common use case that could be challenging with the proposed API and provides a clear example and solution.

To make this even more helpful, consider adding a brief explanation of the performance implications of using props for dynamic styles. For example:

Note: While using `props` solves the issue of programmatically generated styles, be aware that it may have performance implications for highly dynamic scenarios with frequent updates. In such cases, consider batching updates or using alternative approaches for extremely dynamic content.

This addition would help developers make informed decisions when dealing with highly dynamic styling scenarios.


Line range hint 1-1173: Excellent RFC structure and content

The overall structure and content of this RFC are commendable. It provides a comprehensive overview of the proposed rules() API, including:

  1. Clear motivation and benefits
  2. Detailed explanations with numerous code examples
  3. Honest discussion of drawbacks and limitations
  4. Exploration of future possibilities

This thorough approach will greatly aid developers in understanding and implementing the proposed API.

To further enhance the document's usability, consider adding a table of contents at the beginning. This would improve navigation, especially given the length and depth of the RFC. For example:

# Table of Contents

1. [Summary](#summary)
2. [Motivation](#motivation)
3. [Guide-level explanation](#guide-level-explanation)
4. [Reference-level explanation](#reference-level-explanation)
5. [Drawbacks](#drawbacks)
6. [Rationale and alternatives](#rationale-and-alternatives)
7. [Unresolved questions](#unresolved-questions)
8. [Future possibilities](#future-possibilities)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a9f6f1b and 55ab16a.

📒 Files selected for processing (3)
  • text/000-css-literals.md (2 hunks)
  • text/001-css-nesting.md (2 hunks)
  • text/002-css-rules.md (8 hunks)
🧰 Additional context used
🪛 Markdownlint
text/000-css-literals.md

523-523: null
Spaces inside code span elements

(MD038, no-space-in-code)


523-523: null
Spaces inside code span elements

(MD038, no-space-in-code)

🔇 Additional comments (2)
text/001-css-nesting.md (1)

Line range hint 1-791: LGTM! Comprehensive and well-structured proposal.

This proposal for CSS nesting and referencing in a CSS-in-JS context is thorough and well-explained. The document covers various features with clear examples and justifications. The nesting order stabilization is particularly well-thought-out and explained.

Key strengths:

  1. Clear examples for each proposed feature.
  2. Thoughtful consideration of performance and readability in nesting order.
  3. Comparison with existing solutions and alternatives.

Suggestions for improvement:

  1. Expand the Drawbacks, Unresolved questions, and Future possibilities sections for more comprehensive coverage.
  2. Consider adding visual aids (e.g., diagrams) to illustrate complex concepts like nesting order.
  3. Provide more context on how this proposal fits into the broader ecosystem of CSS-in-JS solutions.

Overall, this is a strong proposal that, with minor expansions, would provide a clear roadmap for implementing advanced CSS nesting and referencing features.

text/002-css-rules.md (1)

Line range hint 1-1173: Excellent RFC with valuable improvements

This RFC for the new rules() API is exceptionally well-crafted and comprehensive. The document effectively communicates the motivation, implementation details, and potential drawbacks of the proposed API. The changes reviewed in this pull request significantly enhance the quality and clarity of the RFC:

  1. Improved code examples in the Composition and Compound Variants sections make the concepts more concrete and easier to understand.
  2. Enhanced rulesVariants example provides a more realistic representation of real-world usage.
  3. Added reference to the default implementation offers valuable context for developers.
  4. New subsection on programmatically generated styles addresses an important edge case.

These improvements contribute to making the RFC more robust and developer-friendly. The thorough exploration of future possibilities also sets a clear roadmap for potential enhancements.

Overall, this RFC provides an excellent foundation for implementing and adopting the proposed rules() API. The attention to detail and consideration of various use cases demonstrate a well-thought-out approach to enhancing CSS-in-JS capabilities.

@black7375
Copy link
Contributor Author

/fast-forward

Copy link

github-actions bot commented Oct 2, 2024

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

Trying to fast forward main (a9f6f1b) to ts-compile (55ab16a).

Target branch (main):

commit a9f6f1b38bb1c84d4c8ae75660f91271994453ee (HEAD -> main, origin/main, origin/HEAD)
Author: MS_Y <[email protected]>
Date:   Thu Sep 26 19:28:07 2024 +0900

    Fix: Compiled css syntax

Pull request (ts-compile):

commit 55ab16a3f934c059b4b4d7dd3953ebca290bb93c (pull_request/ts-compile)
Author: alstjr7375 <[email protected]>
Date:   Wed Oct 2 17:44:44 2024 +0900

    Fix: Typescript syntax, typos

Fast forwarding main (a9f6f1b) to ts-compile (55ab16a).

$ git push origin 55ab16a3f934c059b4b4d7dd3953ebca290bb93c:main
To https://github.com/mincho-js/working-group.git
   a9f6f1b..55ab16a  55ab16a3f934c059b4b4d7dd3953ebca290bb93c -> main

@github-actions github-actions bot merged commit 55ab16a into main Oct 2, 2024
1 check passed
@github-actions github-actions bot deleted the ts-compile branch October 2, 2024 08:57
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.

1 participant