-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(exporter-tokens): Export only Theme tokens collection
- Filter out primitives from the generated tokens and leave only color theme tokens - solves #DS-1543
- Loading branch information
1 parent
d691cc5
commit 3f224f1
Showing
6 changed files
with
213 additions
and
41 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
127 changes: 127 additions & 0 deletions
127
exporters/tokens/tests/fixtures/exampleCollectionTokens.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { ColorToken, StringToken, Token, TokenType } from '@supernovaio/sdk-exporters'; | ||
|
||
export const exampleCollectionTokens = new Map<string, Token>(); | ||
exampleCollectionTokens.set('colorCollectionRef1', { | ||
id: 'colorCollectionRef1', | ||
name: 'Theme Color', | ||
tokenType: TokenType.color, | ||
properties: [ | ||
{ | ||
name: 'Collection', | ||
options: [ | ||
{ | ||
id: 'theme-tokens-id', | ||
name: 'Theme tokens', | ||
}, | ||
{ | ||
id: 'primitives-id', | ||
name: 'Primitives', | ||
}, | ||
{ | ||
id: 'global-tokens-id', | ||
name: 'Global tokens', | ||
}, | ||
], | ||
}, | ||
], | ||
propertyValues: { Collection: 'theme-tokens-id' }, | ||
} as unknown as ColorToken); | ||
|
||
exampleCollectionTokens.set('colorCollectionRef2', { | ||
id: 'colorCollectionRef2', | ||
name: 'Primitive Color', | ||
tokenType: TokenType.color, | ||
properties: [ | ||
{ | ||
name: 'Collection', | ||
options: [ | ||
{ | ||
id: 'theme-tokens-id', | ||
name: 'Theme tokens', | ||
}, | ||
{ | ||
id: 'primitives-id', | ||
name: 'Primitives', | ||
}, | ||
{ | ||
id: 'global-tokens-id', | ||
name: 'Global tokens', | ||
}, | ||
], | ||
}, | ||
], | ||
propertyValues: { Collection: 'primitives-id' }, | ||
} as unknown as ColorToken); | ||
|
||
exampleCollectionTokens.set('colorCollectionRef3', { | ||
id: 'colorCollectionRef3', | ||
name: 'Global Color', | ||
tokenType: TokenType.color, | ||
properties: [ | ||
{ | ||
name: 'Collection', | ||
options: [ | ||
{ | ||
id: 'theme-tokens-id', | ||
name: 'Theme tokens', | ||
}, | ||
{ | ||
id: 'primitives-id', | ||
name: 'Primitives', | ||
}, | ||
{ | ||
id: 'global-tokens-id', | ||
name: 'Global tokens', | ||
}, | ||
], | ||
}, | ||
], | ||
propertyValues: { Collection: 'global-tokens-id' }, | ||
} as unknown as ColorToken); | ||
|
||
exampleCollectionTokens.set('stringRef', { | ||
id: 'stringRef', | ||
name: 'Columns', | ||
tokenType: TokenType.string, | ||
parentGroupId: '2', | ||
origin: { | ||
name: 'Grid/Columns', | ||
}, | ||
value: 'value', | ||
} as unknown as StringToken); | ||
|
||
export const expectedCollectionValue = [ | ||
{ | ||
id: 'colorCollectionRef1', | ||
name: 'Theme Color', | ||
properties: [ | ||
{ | ||
name: 'Collection', | ||
options: [ | ||
{ | ||
id: 'theme-tokens-id', | ||
name: 'Theme tokens', | ||
}, | ||
{ | ||
id: 'primitives-id', | ||
name: 'Primitives', | ||
}, | ||
{ | ||
id: 'global-tokens-id', | ||
name: 'Global tokens', | ||
}, | ||
], | ||
}, | ||
], | ||
propertyValues: { Collection: 'theme-tokens-id' }, | ||
tokenType: 'Color', | ||
}, | ||
{ | ||
id: 'stringRef', | ||
name: 'Columns', | ||
origin: { name: 'Grid/Columns' }, | ||
parentGroupId: '2', | ||
tokenType: 'String', | ||
value: 'value', | ||
}, | ||
]; |