Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to w3c standard #230

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ This format is based on the current spec draft of the [Design Tokens W3C Communi
It is much simpler and makes it easier to define custom transformers for amazon style dictionary.

Every token follows this structure ([learn more](https://github.com/lukasoppermann/design-tokens/blob/main/types/standardToken.d.ts)):
```js
type StandardTokenInterface = {
name: string,
$description?: string,
$value: StandardTokenValueType | StandardCompositeTokenValueType,
$type: StandardTokenTypes,
$extensions?: StandardTokenExtensionsInterface
}
```

#### Standard deprecated (previous W3C draft)
The standard format has been updated. To make migration easier, the old version was moved into standard deprecated.
This version will be removed in the future, we highly encourage to update to the `standard` version.

The only difference between this and the updated standard version is that the property keys of `value`, `type`,`description` and `extension` haven beend prefixed with a `$` in the new version.

```js
type StandardTokenInterface = {
name: string,
Expand Down
27 changes: 27 additions & 0 deletions src/config/format.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export type formatKeysType = {
VALUE: '$value' | 'value',
lukasoppermann marked this conversation as resolved.
Show resolved Hide resolved
DESCRIPTION: '$description' | 'description',
TYPE: '$type' | 'type',
EXTENSIONS: '$extensions' | 'extensions',
NAME: 'name'
}

export const formatKeys: {
standardDeprecated: formatKeysType,
standard: formatKeysType
} = {
standardDeprecated: {
VALUE: 'value',
DESCRIPTION: 'description',
TYPE: 'type',
EXTENSIONS: 'extensions',
NAME: 'name'
},
standard: {
VALUE: '$value',
DESCRIPTION: '$description',
TYPE: '$type',
EXTENSIONS: '$extensions',
NAME: 'name'
}
}
Loading