Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions .changeset/repoint-duplicate-relationships.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@adobe/spectrum-design-data": patch
---

Point the second duplicate relationship at the mobile token in 17 components.

103 relationship records referenced the desktop token twice, so the mobile token was never
reachable through the relationship. The second record of each pair now references the token with
the same name and the mobile scale.

Components: accordion, combo-box, date-picker, drop-zone, list-view, menu, number-field, picker,
search-field, segmented-control, side-navigation, tag, tag-field, text-area, text-field, tooltip
and tree-view.
11 changes: 11 additions & 0 deletions .changeset/spec-072-duplicate-relationship-ref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@adobe/design-data-spec": patch
"@adobe/design-data-wasm": patch
---

Add SPEC-072, a warning for a relationship that duplicates another record's `$ref`.

Two relationship records with the same scope, context and `$ref` leave the token's other scale
unreachable when the token has a scale counterpart. Validation now reports the second record and
names the counterpart. A repeated record on a token with no scale counterpart is not reported.
The current data has no such duplicates after the repoint in this PR.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"tokens": [
{
"name": {
"component": "accordion",
"property": "gap",
"scale": "desktop"
},
"value": "8px",
"uuid": "aaaaaaaa-0072-4000-8000-000000000001"
},
{
"name": {
"component": "accordion",
"property": "gap",
"scale": "mobile"
},
"value": "10px",
"uuid": "aaaaaaaa-0072-4000-8000-000000000002"
}
],
"relationships": [
{
"scope": {
"component": "accordion",
"property": "gap"
},
"context": "Spacing",
"$ref": "aaaaaaaa-0072-4000-8000-000000000001"
},
{
"scope": {
"component": "accordion",
"property": "gap"
},
"context": "Spacing",
"$ref": "aaaaaaaa-0072-4000-8000-000000000001"
}
],
"components": [
{
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/components/accordion.json",
"name": "accordion",
"displayName": "Accordion",
"meta": {
"category": "actions"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"layer": 2,
"errors": [
{
"rule_id": "SPEC-072",
"severity": "warning",
"message_pattern": ".*twice.*mobile counterpart.*aaaaaaaa-0072-4000-8000-000000000002.*"
}
]
}
15 changes: 15 additions & 0 deletions packages/design-data-spec/rules/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -724,3 +724,18 @@ rules:
message: "Alias {token} sets {field}={ownValue} but its $ref chain resolves to a token with {field}={leafValue}"
spec_ref: spec/cascade.md#alias-resolution
introduced_in: "1.0.0-draft"
- id: SPEC-072
name: relationship-duplicate-ref-scale-counterpart
severity: warning
layer: 2
category: relationship
note: >
Typically a desktop and a mobile record where the second was copied without repointing it,
so the other scale's token is never reachable through the relationship. A repeated record
on a token with no scale counterpart is not reported.
assert: >
Two relationship records with the same scope, context and `$ref` SHOULD NOT both point at
a token that has a scale counterpart (the same name with another `scale` value).
message: "Relationship {scope} references {ref} twice, but the token has a {scale} counterpart ({counterpart}); point one record at it"
spec_ref: spec/relationship-format.md
introduced_in: "1.0.0-draft"
8 changes: 4 additions & 4 deletions packages/design-data/relationships/accordion.json
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
"property": "space-between"
},
"context": "Spacing (end edge to disclosure icon)",
"$ref": "ba072414-2cdd-4773-86a5-11ca47c08e23"
"$ref": "6b43633d-8f29-4c24-b26e-687d6f161bce"
},
{
"scope": {
Expand All @@ -821,7 +821,7 @@
"property": "space-between"
},
"context": "Spacing (end edge to disclosure icon)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand All @@ -837,7 +837,7 @@
"property": "space-between"
},
"context": "Spacing (end edge to disclosure icon)",
"$ref": "ece70425-e509-45cc-8336-76fc8afdb921"
"$ref": "38e5af78-cb3e-4ff4-9849-28f9d4c56a38"
},
{
"scope": {
Expand All @@ -853,7 +853,7 @@
"property": "space-between"
},
"context": "Spacing (end edge to disclosure icon)",
"$ref": "b32fb20b-31a7-43da-ba38-b9a177d0cffa"
"$ref": "698fa3d4-32dc-4cd2-bb79-d320effd8674"
},
{
"scope": {
Expand Down
16 changes: 8 additions & 8 deletions packages/design-data/relationships/combo-box.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
"property": "component-edge-to-text-75"
},
"context": "Spacing (start/end edge to value)",
"$ref": "ba072414-2cdd-4773-86a5-11ca47c08e23"
"$ref": "6b43633d-8f29-4c24-b26e-687d6f161bce"
},
{
"scope": {
Expand All @@ -301,7 +301,7 @@
"property": "component-edge-to-text-100"
},
"context": "Spacing (start/end edge to value)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand All @@ -317,7 +317,7 @@
"property": "component-edge-to-text-200"
},
"context": "Spacing (start/end edge to value)",
"$ref": "ece70425-e509-45cc-8336-76fc8afdb921"
"$ref": "38e5af78-cb3e-4ff4-9849-28f9d4c56a38"
},
{
"scope": {
Expand All @@ -333,7 +333,7 @@
"property": "component-edge-to-text-300"
},
"context": "Spacing (start/end edge to value)",
"$ref": "b32fb20b-31a7-43da-ba38-b9a177d0cffa"
"$ref": "698fa3d4-32dc-4cd2-bb79-d320effd8674"
},
{
"scope": {
Expand Down Expand Up @@ -573,7 +573,7 @@
"property": "space-between"
},
"context": "Leading icon (leading icon to end edge)",
"$ref": "ba072414-2cdd-4773-86a5-11ca47c08e23"
"$ref": "6b43633d-8f29-4c24-b26e-687d6f161bce"
},
{
"scope": {
Expand All @@ -589,7 +589,7 @@
"property": "space-between"
},
"context": "Leading icon (leading icon to end edge)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand All @@ -605,7 +605,7 @@
"property": "space-between"
},
"context": "Leading icon (leading icon to end edge)",
"$ref": "ece70425-e509-45cc-8336-76fc8afdb921"
"$ref": "38e5af78-cb3e-4ff4-9849-28f9d4c56a38"
},
{
"scope": {
Expand All @@ -621,7 +621,7 @@
"property": "space-between"
},
"context": "Leading icon (leading icon to end edge)",
"$ref": "b32fb20b-31a7-43da-ba38-b9a177d0cffa"
"$ref": "698fa3d4-32dc-4cd2-bb79-d320effd8674"
},
{
"scope": {
Expand Down
4 changes: 2 additions & 2 deletions packages/design-data/relationships/date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
"property": "component-edge-to-text-100"
},
"context": "Spacing (start edge to value) ",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand Down Expand Up @@ -589,7 +589,7 @@
"property": "space-between"
},
"context": "Spacing (value to alert icon)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand Down
2 changes: 1 addition & 1 deletion packages/design-data/relationships/drop-zone.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"property": "component-edge-to-text-300"
},
"context": "Text area (filled, hover)",
"$ref": "b32fb20b-31a7-43da-ba38-b9a177d0cffa"
"$ref": "698fa3d4-32dc-4cd2-bb79-d320effd8674"
},
{
"scope": {
Expand Down
4 changes: 2 additions & 2 deletions packages/design-data/relationships/list-view.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"property": "component-edge-to-text-100"
},
"context": "Spacing (edge to checkbox, edge to visual, edge to text)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand Down Expand Up @@ -333,7 +333,7 @@
"property": "component-edge-to-text-100"
},
"context": "Spacing (horizontal)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand Down
8 changes: 4 additions & 4 deletions packages/design-data/relationships/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
"property": "component-edge-to-text-75"
},
"context": "Spacing (start/end edges to content)",
"$ref": "ba072414-2cdd-4773-86a5-11ca47c08e23"
"$ref": "6b43633d-8f29-4c24-b26e-687d6f161bce"
},
{
"scope": {
Expand All @@ -293,7 +293,7 @@
"property": "component-edge-to-text-100"
},
"context": "Spacing (start/end edges to content)",
"$ref": "52a75511-eb1b-4de2-a1bb-959365d8dc1a"
"$ref": "71731484-e759-4a5f-89ed-9fe04ac19aed"
},
{
"scope": {
Expand All @@ -309,7 +309,7 @@
"property": "component-edge-to-text-200"
},
"context": "Spacing (start/end edges to content)",
"$ref": "ece70425-e509-45cc-8336-76fc8afdb921"
"$ref": "38e5af78-cb3e-4ff4-9849-28f9d4c56a38"
},
{
"scope": {
Expand All @@ -325,7 +325,7 @@
"property": "component-edge-to-text-300"
},
"context": "Spacing (start/end edges to content)",
"$ref": "b32fb20b-31a7-43da-ba38-b9a177d0cffa"
"$ref": "698fa3d4-32dc-4cd2-bb79-d320effd8674"
},
{
"scope": {
Expand Down
Loading
Loading