Skip to content

Conversation

@alexgrozav
Copy link
Contributor

This pull request introduces comprehensive support for dot notation in variable and reference names throughout the codebase. The changes ensure that names containing dots (e.g., color.primary) are consistently converted to double dash notation (e.g., color--primary) for CSS variable output, and adds extensive test coverage for these cases. It also updates the default variable naming function to handle edge cases such as consecutive, leading, and trailing dots.

Dot notation support and conversion:

  • Updated defaultVariableNameFn in engine/transpiler/src/defaults.ts to convert dots in variable names to double dashes, and to handle consecutive, leading, and trailing dots.
  • Added and expanded tests in engine/transpiler/src/defaults.test.ts to cover dot notation conversion, edge cases (multiple, leading, trailing dots), and mixed dot/dash notation. [1] [2]

Reference and variable consumption enhancements:

  • Added tests in engine/transpiler/src/consume/ref.test.ts to verify correct conversion of dot notation in references to double dashes, including fallback values and custom naming functions.
  • Added tests in engine/transpiler/src/consume/variable.test.ts to ensure variables and references with dot notation are consumed and output with the correct double dash format, including nested paths and fallback scenarios.

Core reference handling:

  • Expanded tests in engine/core/src/tokens/ref.test.ts to validate creation and chaining of references and variables using dot notation, including mixed dot/dash cases and complex fallbacks. [1] [2]

@alexgrozav alexgrozav requested a review from Copilot December 4, 2025 14:34
@alexgrozav alexgrozav self-assigned this Dec 4, 2025
@alexgrozav alexgrozav linked an issue Dec 4, 2025 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 1e6c7e9

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

This PR includes changesets to release 4 packages
Name Type
@styleframe/transpiler Minor
@styleframe/core Minor
@styleframe/theme Minor
styleframe Minor

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

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
app-styleframe-dev-production Ready Ready Preview Comment Dec 4, 2025 3:58pm
styleframe-dev-production Ready Ready Preview Comment Dec 4, 2025 3:58pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces comprehensive support for dot notation in variable and reference names throughout the Styleframe engine. The implementation allows developers to use more natural, hierarchical naming conventions (e.g., color.primary) which are automatically converted to CSS-compatible double-dash notation (e.g., color--primary) for variable output.

Key Changes

  • Enhanced the default variable naming function to automatically convert dots to double dashes while handling edge cases like consecutive, leading, and trailing dots
  • Added extensive test coverage across multiple layers (defaults, variable consumption, reference consumption, and core token creation)
  • Maintained backward compatibility with existing dash-based naming conventions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
engine/transpiler/src/defaults.ts Updated defaultVariableNameFn to convert dot notation to double-dash notation using regex pattern replacement
engine/transpiler/src/defaults.test.ts Added comprehensive test cases for dot notation conversion including edge cases (multiple dots, leading/trailing dots, mixed notation)
engine/transpiler/src/consume/variable.test.ts Added tests verifying variable consumption correctly handles dot notation in variable names and references with various scenarios
engine/transpiler/src/consume/ref.test.ts Added tests ensuring reference consumption properly converts dot notation to double dashes in reference names and with custom naming functions
engine/core/src/tokens/ref.test.ts Added tests validating core reference token creation preserves dot notation internally and handles it correctly in reference chains

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@alexgrozav alexgrozav closed this Dec 5, 2025
@alexgrozav alexgrozav reopened this Dec 5, 2025
@alexgrozav alexgrozav merged commit 653d1fc into main Dec 5, 2025
13 checks passed
@alexgrozav alexgrozav deleted the 67-make-the-and----values-in-variables-interchangeable branch December 5, 2025 08:37
@github-actions github-actions bot mentioned this pull request Dec 5, 2025
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.

Make the . and -- values in variables interchangeable

2 participants