tokens: isTokenRef accepts brand token names (digits)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-01 09:51:32 -08:00
1 parent c388be7fe7
commit 1190a98265
2 files changed
+9 -1

No files matched your search

+8
View File
@@ -111,3 +111,11 @@ describe('list operations', () => {
expect(findSwatchByHex(l, '#000')).toBeUndefined();
});
});
describe('isTokenRef accepts brand refs (digits in the name)', () => {
test('brand refs are token refs but not fixed-slot keys', async () => {
const { isTokenRef, tokenKeyOf } = await import('./tokens');
expect(isTokenRef('var(--wsb-brand-2)')).toBe(true);
expect(tokenKeyOf('var(--wsb-brand-2)')).toBeNull();
});
});
+1 -1
View File
@@ -64,7 +64,7 @@ export const COLOR_TOKENS: ReadonlyArray<{ key: TokenKey; label: string }> = [
{ key: 'error', label: 'Error' },
];
const TOKEN_REF_RE = /^var\(--wsb-([a-z-]+)\)$/;
const TOKEN_REF_RE = /^var\(--wsb-([a-z0-9-]+)\)$/;
// TokenKey -> SiteDesign key, derived from TOKEN_VARS so there is one source.
const DESIGN_KEY_BY_TOKEN = new Map<string, keyof SiteDesign>(