Re: [community-group] Reference composite type attributes individually (#148)

+1 this would be useful for us as well. Just to give a real-world example we just hit with shadows, we wanted to get more use out of our base shadow:

```json
{
  "elevation": {
    "$type": "shadow",
    "near": {
      "$value": {
        "offsetX": "0",
        "offsetY": "3px",
        "blur": "5px",
        "spread": "0",
        "color": "#4f4b9326"
      }
    }
  }
}
```

The shadow as defined uses a top light source, but we had a scroll container we wanted to apply an inner shadow to, and we wanted to apply the same shadow to the left or right edge to create consistency. This would involve extracting the `offsetX` and `offsetY` values separately and swapping those (or inverting them) while keeping the other values the same.

In the meantime, we could create 1 shadow for each direction (up, down, left, right), but that’s much more unwieldy.

---

As to the proposed syntax, I like it. A keyword paired with the alias syntax seems great.

I do wonder if the current syntax of using `.` to separate groups/tokens would be confusing to reference a specific property on a token. Are there any thoughts around using another character there? e.g.

```
"{type styles.base#fontFamily}"
```

I’m not necessarily stuck on the `#` character, but it would clarify `base` is a token and `fontFamily` is a composite property. I’m not advocating for this syntax necessarily, just some distinction between token & property.

-- 
GitHub Notification of comment by drwpow
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/148#issuecomment-1164369345 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 23 June 2022 12:50:47 UTC