Skip to content

Add duplicate style name detection across categories in configurator#7

Merged
rozd merged 2 commits into
mainfrom
claude/fix-issue-5
Feb 20, 2026
Merged

Add duplicate style name detection across categories in configurator#7
rozd merged 2 commits into
mainfrom
claude/fix-issue-5

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Feb 20, 2026

When tokens across different categories resolve to the same effective style name (style ?? name), the generated Swift code produces duplicate static properties on ShapeStyle, causing compiler errors. The configurator now detects and warns about these conflicts.

Changes

  • validation.js: Added findDuplicateStyleName() to compare effective style names across all enabled categories, returning the conflicting category name
  • state.svelte.js: Exported getAllStyles() to provide validation access to all token data
  • TokenTag.svelte: Integrated duplicate detection using Svelte 5's $derived for reactive updates; shows warning icon and tooltip identifying the conflicting category
  • TokenPopover.svelte: Displays inline warning message when duplicates detected: "Style name .{name} is already used by another token in {Category}. This will cause a compiler error."
  • TokenField.svelte: Passes category context to enable proper duplicate detection

All conflicts (both SwiftUI built-ins and cross-category duplicates) use the same visual treatment: red outline/background with warning icon.

Example conflict scenario that now shows warnings:

{
  "colors": ["surface"],
  "gradients": [{"name": "vibrant", "style": "surface"}]
}

Both tokens now highlight with warnings since they both resolve to .surface.

Co-authored-by: rozd <158493+rozd@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Fix issue related to feature in #5 Add duplicate style name detection across categories in configurator Feb 20, 2026
@Claude Claude AI requested a review from rozd February 20, 2026 23:08
@rozd rozd marked this pull request as ready for review February 20, 2026 23:19
@rozd rozd merged commit e7cb664 into main Feb 20, 2026
1 check passed
@rozd rozd deleted the claude/fix-issue-5 branch February 20, 2026 23:24
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.30%. Comparing base (8d7ff17) to head (4cb7f9c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main       #7   +/-   ##
=======================================
  Coverage   99.30%   99.30%           
=======================================
  Files          28       28           
  Lines        1154     1154           
=======================================
  Hits         1146     1146           
  Misses          8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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