- From: Ryan Johnson via GitHub <sysbot+gh@w3.org>
- Date: Wed, 08 Jun 2022 22:24:21 +0000
- To: public-design-tokens-log@w3.org
To piggyback off of the "private" vs "internal" discussion...
- **private**: exist after parsing
- **internal**: do not exist after parsing
## Private
A private token is one that is still included in code after transformation has taken place (see my [previous comment](https://github.com/design-tokens/community-group/issues/110#issuecomment-1148941702)). The responsibility lies with the translation tool to identify "private" members, regardless of how private content is defined by the spec (whether it be `_` convention or explicit configuration).
## Internal
An internal token is one that is not explicitly defined in code _after_ transformation has taken place.
If the spec allowed it, I'd be inclined to define internals using `$defs` (similar to how SVG `<defs>` behaves) and apply them using `$ref` (similar to SVG `<use>`).
```javascript
{
// $defs will NOT be used for token _discovery_, but
// will be used for token property _resolution_
"$defs": {
"colors": {
"$type": "color",
"green": {
"$value": "#00ff00"
}
}
},
"red": {
"$type": "color",
"$value": "#ff0000"
},
"blue": {
"$type": "color",
"$value": "#0000ff"
},
"grass": {
// alias of an "internal" token
"$ref": "#/$defs/colors.green"
}
}
```
This would resolve to the following flattened hierarchy...
```json
```
### Internal Examples
If `_green` were an "internal" token in my previous comment, you'd never see any reference to it in generated code, you'd only have the resolved value.
_example (JavaScript: ESM format)_
```javascript
export const red = '#ff0000';
export const blue = '#0000ff';
export const grass = '#00ff00';
```
_example (CSS)_
```css
:root {
--red: #ff0000;
--blue: #0000ff;
--grass: #00ff00;
}
```
--
GitHub Notification of comment by CITguy
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/110#issuecomment-1150473756 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 8 June 2022 22:24:22 UTC