From 1b494d4f600d7991738b3e5f459a3d1dda5ad632 Mon Sep 17 00:00:00 2001 From: Louis Chenais Date: Wed, 19 Apr 2023 09:12:37 +0000 Subject: [PATCH] Make whitesapce invalid in token names --- .gitignore | 1 + technical-reports/format/aliases.md | 4 ++-- technical-reports/format/design-token.md | 10 +++++---- technical-reports/format/groups.md | 28 ++++++++++++------------ technical-reports/format/types.md | 8 +++---- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index fd4f2b0..607ab29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .DS_Store +.history diff --git a/technical-reports/format/aliases.md b/technical-reports/format/aliases.md index dddff0d..13dc1c5 100644 --- a/technical-reports/format/aliases.md +++ b/technical-reports/format/aliases.md @@ -16,12 +16,12 @@ For example: ```json { "group name": { - "token name": { + "token-name": { "$value": 1234, "$type": "number" } }, - "alias name": { + "alias-name": { "$value": "{group name.token name}" } } diff --git a/technical-reports/format/design-token.md b/technical-reports/format/design-token.md index 6055683..972e320 100644 --- a/technical-reports/format/design-token.md +++ b/technical-reports/format/design-token.md @@ -6,7 +6,7 @@ ```json { - "token name": { + "token-name": { "$value": "#fff000", "$type": "color" } @@ -17,6 +17,8 @@ Note: The `$type` property has been added to ensure this example is valid. Pleas +The name of your design token must not include any whitespace. Otherwise your design token is considered as invalid. + An object with a **`$value`** property is a token. Thus, `$value` is a reserved word in our spec, meaning you can't have a token whose name is "$value". The parent object's key is the token name. The example above therefore defines 1 design token with the following properties: @@ -98,7 +100,7 @@ The value of the `$description` property MUST be a plain JSON string, for exampl ```json { - "Button background": { + "button-background": { "$value": "#777777", "$type": "color", "$description": "The background color for buttons in their normal state." @@ -133,7 +135,7 @@ For example: ```json { - "Button background": { + "button-background": { "$value": "#777777", "$type": "color" } @@ -153,7 +155,7 @@ The optional **`$extensions`** property is an object where tools MAY add proprie ```json { - "Button background": { + "button-background": { "$value": "#777777", "$type": "color", "$extensions": { diff --git a/technical-reports/format/groups.md b/technical-reports/format/groups.md index 40e05f7..bf106f3 100644 --- a/technical-reports/format/groups.md +++ b/technical-reports/format/groups.md @@ -11,16 +11,16 @@ A file MAY contain many tokens and they MAY be nested arbitrarily in groups like "$type": "color" }, "token group": { - "token dos": { + "token-dos": { "$value": "2rem", "$type": "dimension" }, "nested token group": { - "token tres": { + "token-tres": { "$value": 33, "$type": "number" }, - "Token cuatro": { + "Token-cuatro": { "$value": 444, "$type": "fontWeight" } @@ -78,7 +78,7 @@ Group keys without a dollar sign (`$`) prefix denote: { "Group of tokens": { "$description": "This is an example of a group containing a single token", - "Token name": { + "token-name": { "$value": "#000000" } } @@ -92,10 +92,10 @@ Group keys without a dollar sign (`$`) prefix denote: "Group of tokens": { "$description": "This is an example of a group containing a nested group", "Subgroup of tokens": { - "Token 1 name": { + "token-1-name": { "$value": "#aabbcc" }, - "Token 2 name": { + "token-2-name": { "$value": "#ddeeff" } } @@ -119,10 +119,10 @@ For example: "$description": "Design tokens from our brand guidelines", "color": { "$description": "Our brand's primary color palette", - "acid green": { + "acid-green": { "$value": "#00ff66" }, - "hot pink": { + "hot-pink": { "$value": "#dd22cc" } } @@ -159,10 +159,10 @@ For example: "brand": { "$type": "color", "color": { - "acid green": { + "acid-green": { "$value": "#00ff66" }, - "hot pink": { + "hot-pink": { "$value": "#dd22cc" } } @@ -187,10 +187,10 @@ For example: "brand": { "color": { "$type": "color", - "acid green": { + "acid-green": { "$value": "#00ff66" }, - "hot pink": { + "hot-pink": { "$value": "#dd22cc" } }, @@ -258,10 +258,10 @@ For example, a [=translation tool=] like [Style Dictionary](https://amzn.github. "brand": { "color": { "$type": "color", - "acid green": { + "acid-green": { "$value": "#00ff66" }, - "hot pink": { + "hot-pink": { "$value": "#dd22cc" } }, diff --git a/technical-reports/format/types.md b/technical-reports/format/types.md index d6573d2..389a9ff 100644 --- a/technical-reports/format/types.md +++ b/technical-reports/format/types.md @@ -20,11 +20,11 @@ For example, initially the color tokens MAY be defined as such: ```json { - "Majestic magenta": { + "majestic-magenta": { "$value": "#ff00ff", "$type": "color" }, - "Translucent shadow": { + "translucent-shadow": { "$value": "#00000080", "$type": "color" } @@ -93,11 +93,11 @@ For example: ```json { - "Primary font": { + "primary-font": { "$value": "Comic Sans MS", "$type": "fontFamily" }, - "Body font": { + "body-font": { "$value": ["Helvetica", "Arial", "sans-serif"], "$type": "fontFamily" }