Skip to content
Open
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
22 changes: 22 additions & 0 deletions .changeset/button-corner-radius-exclude-from-legacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@adobe/spectrum-design-data": minor
---

Add an `excludeFromLegacy` token field so new tokens without Tokens Studio
precedent can be authored directly in design-data without publishing to the
legacy flat-key mirror, and use it to fix SPEC-027 dangling `button.json`
corner-radius bindings (bead spectrum-design-data-vpk.1).

- **packages/design-data-spec/schemas/token.schema.json**: new optional
`excludeFromLegacy: boolean` on both token shapes.
- **sdk/core/src/legacy.rs**: `convert_array` skips any token with
`excludeFromLegacy: true` before it's grouped into legacy output.
- **packages/design-data/tokens/layout.tokens.json**: add
`button`/`corner-radius` tokens for `small`/`medium`/`large`/`extra-large`
(desktop + mobile), literal pixel values derived from
`component-height-*` ÷ 2, marked `excludeFromLegacy` — no legacy output
change.
- **packages/design-data/components/button.json**: rebind the three
corner-radius entries from the non-existent literal strings
`corner-radius-button-{small,large,extra-large}` to the new tokens'
resolved key `button-corner-radius-{small,large,extra-large}`.
12 changes: 12 additions & 0 deletions .changeset/vpk1-fix-workflow-icon-400-gap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@adobe/spectrum-design-data": patch
---

Fix SPEC-027 dangling `component-top-to-workflow-icon-400` tokenBindings
(bead spectrum-design-data-vpk.1, group A).

- **packages/design-data/components/combo-box.json**, **number-field.json**,
**text-area.json**, **text-field.json**: rebind the leading-icon spacing
entry from `component-top-to-workflow-icon-400` — a step that doesn't
exist in the token family (which caps at `-300`) and isn't referenced
anywhere else — to the existing `component-top-to-workflow-icon-300`.
8 changes: 8 additions & 0 deletions packages/design-data-spec/schemas/token.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@
"private": {
"type": "boolean"
},
"excludeFromLegacy": {
"type": "boolean",
"description": "When true, this token is omitted from the generated packages/tokens/src legacy output."
},
"description": {
"type": "string",
"description": "Plain text describing the token's purpose (aligns with DTCG $description)."
Expand Down Expand Up @@ -273,6 +277,10 @@
"private": {
"type": "boolean"
},
"excludeFromLegacy": {
"type": "boolean",
"description": "When true, this token is omitted from the generated packages/tokens/src legacy output."
},
"description": {
"type": "string",
"description": "Plain text describing the token's purpose (aligns with DTCG $description)."
Expand Down
6 changes: 3 additions & 3 deletions packages/design-data/components/button.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@
{ "token": "component-height-300", "context": "Minimum height" },
{ "token": "corner-radius-full", "context": "Rounding" },
{
"token": "corner-radius-button-small",
"token": "button-corner-radius-small",
"context": "Rounding (with wrapping)"
},
{
"token": "corner-radius-extra-large-default",
"context": "Rounding (with wrapping)"
},
{
"token": "corner-radius-button-large",
"token": "button-corner-radius-large",
"context": "Rounding (with wrapping)"
},
{
"token": "corner-radius-button-extra-large",
"token": "button-corner-radius-extra-large",
"context": "Rounding (with wrapping)"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/design-data/components/combo-box.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
"context": "S2 Leading icon (top/bottom edge to leading icon) position: inline"
},
{
"token": "component-top-to-workflow-icon-400",
"token": "component-top-to-workflow-icon-300",
"context": "S2 Leading icon (top/bottom edge to leading icon) position: inline"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/design-data/components/number-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
"context": "Spacing (top/bottom edge to text)"
},
{
"token": "component-top-to-workflow-icon-400",
"token": "component-top-to-workflow-icon-300",
"context": "Leading icon (top/bottom edge to leading icon)"
},
{ "token": "positive-visual-color", "context": "Positive icon" }
Expand Down
2 changes: 1 addition & 1 deletion packages/design-data/components/text-area.json
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
"context": "Leading icon (top/bottom edge to leading icon)"
},
{
"token": "component-top-to-workflow-icon-400",
"token": "component-top-to-workflow-icon-300",
"context": "Leading icon (top/bottom edge to leading icon)"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/design-data/components/text-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
"context": "Leading icon (top/bottom edge to leading icon)"
},
{
"token": "component-top-to-workflow-icon-400",
"token": "component-top-to-workflow-icon-300",
"context": "Leading icon (top/bottom edge to leading icon)"
},
{
Expand Down
112 changes: 112 additions & 0 deletions packages/design-data/tokens/layout.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,118 @@
"set_uuid": "fbdf2291-b332-4436-9e57-430c0a81d526",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json"
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "small",
"scale": "desktop"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "12px",
"uuid": "375c1ab1-bee4-499b-b257-931bb4bc56d0",
"set_uuid": "6f73478a-407b-45fb-ac13-44f3911515cb",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "small",
"scale": "mobile"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "15px",
"uuid": "fae7af5b-4754-4031-b070-c644e172450a",
"set_uuid": "6f73478a-407b-45fb-ac13-44f3911515cb",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "medium",
"scale": "desktop"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "16px",
"uuid": "903865b1-0c75-41c6-84f3-efd6b5205f29",
"set_uuid": "5c0d060f-7ab0-4c40-a907-4006ae45a0d7",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "medium",
"scale": "mobile"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "20px",
"uuid": "d1bcb014-35ee-47a1-baf1-6d55d908cb20",
"set_uuid": "5c0d060f-7ab0-4c40-a907-4006ae45a0d7",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "large",
"scale": "desktop"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "20px",
"uuid": "e86a15c7-9715-42b5-9cc5-1f438c278df1",
"set_uuid": "9f45a388-c93b-41da-8ab3-cb1145bd613b",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "large",
"scale": "mobile"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "25px",
"uuid": "12f28a62-a19c-401c-b65b-d746c9dfcc75",
"set_uuid": "9f45a388-c93b-41da-8ab3-cb1145bd613b",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "extra-large",
"scale": "desktop"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "24px",
"uuid": "1850a55a-9e06-406d-b3db-ccc1c3adf7da",
"set_uuid": "8b7938de-34f9-4b5f-ad13-3cf01149814b",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"component": "button",
"property": "corner-radius",
"size": "extra-large",
"scale": "mobile"
},
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/dimension.json",
"value": "30px",
"uuid": "06240f78-2979-458a-83cf-46e2476d68e1",
"set_uuid": "8b7938de-34f9-4b5f-ad13-3cf01149814b",
"set_schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/scale-set.json",
"excludeFromLegacy": true
},
{
"name": {
"property": "component-padding-vertical-100",
Expand Down
18 changes: 18 additions & 0 deletions sdk/core/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ fn convert_array(
let Some(tok) = item.as_object() else {
continue;
};
if tok.get("excludeFromLegacy").and_then(Value::as_bool) == Some(true) {
continue;
}
// extract_legacy_key handles both object names (decomposed or thin) and
// string names (SPEC-017 escape hatch).
let Some(key) = tok.get("name").and_then(extract_legacy_key) else {
Expand Down Expand Up @@ -871,6 +874,21 @@ mod tests {
assert_eq!(entry["value"], "8px");
}

#[test]
fn exclude_from_legacy_flag_skips_token() {
let arr = json!([
{"name": {"property": "spacing-100"}, "value": "8px", "uuid": "excl-0001"},
{"name": {"component": "button", "property": "corner-radius", "size": "small"},
"value": "12px", "uuid": "excl-0002", "excludeFromLegacy": true}
]);
let mut summary = LegacySummary::default();
let out = convert_array(arr.as_array().unwrap(), &mut summary, &HashMap::new()).unwrap();

assert!(out.contains_key("spacing-100"));
assert!(!out.contains_key("button-corner-radius-small"));
assert_eq!(out.len(), 1);
}

#[test]
fn color_set_reconstructed_from_three_cascade_tokens() {
let arr = json!([
Expand Down
Loading