design: tokens admin diff and export - #561
Open
Dubemtopsite wants to merge 1 commit into
Open
Conversation
|
@Dubemtopsite Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #497
Description
Designers iterating on tokens need to see what changed between saves and export the diff. This PR adds a token diff & export section to the Design Tokens admin page with a three-column diff layout highlighting added, changed, and removed tokens, plus per-format export (JSON, CSS variables, Sass) with copy-to-clipboard and download affordances.
What changed
TokenDiffcomponent (src/pages/DesignTokens/TokenDiff.tsx)Token | Before | After, with status badges (Added / Changed / Removed / Unchanged) on every rowsrc/pages/DesignTokens/tokenDiff.ts)computeTokenDiff(before, after)classifies added/changed/removed/unchanged by CSS variable across groupsformatDiffJSON→{ added, changed, removed };formatDiffCSS→:root { /* added */ ... }with removed tokens commented out;formatDiffSass→$var: value;grouped under commentsTOKEN_DIFF_BEFORE/TOKEN_DIFF_AFTERsnapshot data demonstrating every change type (including binary icon tokens)DesignTokensPage.tsx) renders the section after the token groupsjest-axerole="row"/role="table"usage on token rows and chart swatch grid (rows contained non-cell children)<main>landmarks and non-unique<nav>landmarks inDevicePreviewdocs/uiux/ux497-token-diff-export.mddocuments the anatomy, behavior, large-diff readability, WCAG 2.1 AA notes, responsive/RTL behavior, and implementation pointersvite.config.tsAccessibility (axe)
jest-axeruns on both the newTokenDiffcomponent and the fullDesignTokensPage— 0 violationsaria-labelon rows)role="tablist"/"tab"witharia-selected,aria-pressedtoggles,aria-livestatus regions, visible focus indicatorspadding-inline,border-inline-end,text-align: start); code preview forcesdirection: ltrEdge cases covered
[binary asset]in exportsTests
src/pages/DesignTokens/TokenDiff.test.tsx— 27 unit + interaction testssrc/pages/DesignTokens/DesignTokensPage.test.tsx— updated for new section + axe testTokenDiff.tsx95.94% lines / 96% functions / 96.77% branches / 100% statements,tokenDiff.ts100% lines / 97.43% branches / 100% functions / 100% statements (≥95% threshold enforced)npm run lintclean on all changed files;npm run buildsucceedsScreenshots
Not included — this repo has no visual test harness. The rendered diff section can be previewed at
/design-tokenslocally (e.g.npm run dev), and the design rationale is documented indocs/uiux/ux497-token-diff-export.md.Note:
npm testfull-suite failures in unrelated files (e.g.KycSelfieCapture,AuditTrail,DistributionDashboard,TwoFactorSetup.test,Tabs.tsx) are pre-existing onmaster(parse/syntax errors in files untouched by this PR) and verified as such.