Skip to content

feat: unify custom properties and themes/tokens - #103

Open
janis-me wants to merge 5 commits into
mainfrom
feat/unify-custom-properties
Open

janis-me wants to merge 5 commits into
mainfrom
feat/unify-custom-properties

Conversation

@janis-me

@janis-me janis-me commented Oct 4, 2026

Copy link
Copy Markdown
Member

Fixes a set of different custom property / theme issues:

  • --fooBar was emitted as --foo-bar while var(--fooBar) stayed, so
    camelCase vars never matched. null values were silently dropped.
  • use() was not working with all targets
  • initial value typed by syntax, checked at runtime
  • throw on invalid names, unknown data types, var() initial values
  • register: false no longer accepts an initial value
  • names are the path joined with -, no kebab-casing
  • token() values typed and checked by syntax, also in createTheme
  • throw on conflicting defaults across defineTokens calls

janis-me and others added 4 commits October 4, 2026 10:14
--fooBar was emitted as --foo-bar while var(--fooBar) stayed, so
camelCase vars never matched. null values were silently dropped.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- initial value typed by syntax, checked at runtime
- throw on invalid names, unknown data types, var() initial values
- register: false no longer accepts an initial value

Co-authored-by: Cursor <cursoragent@cursor.com>
- names are the path joined with -, no kebab-casing
- token() values typed and checked by syntax, also in createTheme
- throw on conflicting defaults across defineTokens calls

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI balanced review requested due to automatic review settings October 4, 2026 09:18
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
surimi c1ec5c0 Commit Preview URL

Branch Preview URL
Oct 04 2026, 05:42 PM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Syntax validation gaps and non-transactional token registration can accept invalid values or leave state behind after failed calls.

Review effort: Balanced
Findings: 6 Medium severity

Open (6)
What changed in this PR

Unifies custom property and theme token behavior, adding syntax-aware typing, runtime validation, preserved naming, and consistent reuse across builders.

Changes:

  • Adds typed custom-property syntax validation and token/theme propagation.
  • Preserves custom-property casing and detects conflicting token defaults.
  • Extends conditional selectors with reusable use() support.
File Description
packages/​theme/​test/​theme.spec.ts Tests naming, conflicts, and typed tokens.
packages/​theme/​src/​types.ts Propagates token value types.
packages/​theme/​src/​token.ts Types token definitions by syntax.
packages/​theme/​src/​define-tokens.ts Preserves names and detects default conflicts.
packages/​surimi/​test/​utils/​css.utils.spec.ts Tests custom-property casing and null handling.
packages/​surimi/​test/​builders/​custom-property-builder.spec.ts Tests registration and syntax validation.
packages/​surimi/​src/​api.ts Adds syntax-aware property API types.
packages/​docs/​src/​pages/​docs/​guides/​theme.mdx Documents updated token behavior.
packages/​core/​src/​utils/​css.utils.ts Preserves custom-property names and rejects nulls.
packages/​core/​src/​builders/​index.ts Exports styling mixins.
packages/​core/​src/​builders/​custom-property.builder.ts Implements validation and registration deduplication.
packages/​conditional/​test/​conditional.spec.ts Tests conditional use().
packages/​conditional/​src/​api.ts Adopts reusable styling support.
packages/​common/​src/​types/​syntax.types.ts Defines syntax-to-value mappings.
packages/​common/​src/​types/​index.ts Exports syntax types.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/theme/src/define-tokens.ts Resolved
- remove syntax parsing and SyntaxValue types, CSS errors are left to the browser
- defineTokens validates everything before emitting

This branch has not been deployed

No deployments
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.

2 participants