Skip to content

Commit

Permalink
Adds extensions to groups (#202)
Browse files Browse the repository at this point in the history
* Adds extensions to groups

* Remove suggestion about vendor-specific inheritence
  • Loading branch information
c1rrus committed Jul 16, 2023
1 parent 923f14d commit 321f925
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions technical-reports/format/groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ Suggested ways tools MAY use this property are:
- A GUI tool that lets users browse or select tokens could display this info alongside the corresponding group or as a tooltip
- Translation tools could output this as a source code comment

<div class="issue" data-number="72">

Groups may support additional properties like type and description. Should other properties be supported at the group level?

</div>

### Type

Groups MAY include an optional `$type` property so a type property does not need to be manually added to every token. [See supported "Types"](#types) for more information.
Expand Down Expand Up @@ -172,6 +166,46 @@ For example:

</aside>

### Extensions

Groups MAY include an optional `$extensions` property where tools MAY add proprietary, user-, team- or vendor-specific data to a group. When doing so, each tool MUST use a vendor-specific key whose value MAY be any valid JSON data.

Group extensions follow the same rules as [design token extensions](#extensions), the only difference is that they relate to the group itself.

- The keys SHOULD be chosen such that they avoid the likelihood of a naming clash with another vendor's data. The [reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) is recommended for this purpose.
- Tools that process design token files MUST preserve any extension data they do not themselves understand. For example, if a group contains extension data from tool A and the file containing that data is opened by tool B, then tool B MUST include the original tool A extension data whenever it saves a new design token file containing that group.

Note that, since a group's `$extensions` only relate to that group, they do not have any effect on nested groups or tokens.

<aside class="example">

```json
{
"brand": {
"$extensions": {
"org.example.tool-a": 42,
"org.example.tool-b": {
"turn-up-to-11": true
}
},
"color": {
"acid green": {
"$value": "#00ff66",
"$type": "color"
},
"hot pink": {
"$value": "#dd22cc",
"$type": "color"
}
}
}
}
```

In this example, the "brand" group has 2 extensions: `org.example.tool-a` and `org.example.tool-b`.

</aside>

## Use-cases

### File authoring & organization
Expand Down

0 comments on commit 321f925

Please sign in to comment.