Skip to content

Commit 4ae59ec

Browse files
castastrophepfultoncdransfAziz Ramosjawinn
committed
feat: migration of tokens to support spectrum foundations
Expanding the existing themes system to support the new S2 mappings. --- Co-authored-by: castastrophe <castastrophe@users.noreply.github.com> Co-authored-by: Patrick Fulton <pfulton@adobe.com> Co-authored-by: Cory Dransfeldt <cdransfeldt@adobe.com> Co-authored-by: Aziz Ramos <azizramos@Azizs-MBP.lan> Co-authored-by: Josh Winn <965114+jawinn@users.noreply.github.com> Co-authored-by: Rise Erpelding <rise@heysparkbox.com> Co-authored-by: Marissa Huysentruyt <marissa.huysentruyt@heysparkbox.com> Co-authored-by: Rajdeep Chandra <rajdeepc@adobe.com> Co-authored-by: TarunAdobe <ttomar@adobe.com> Co-authored-by: Dragan Eror<el22or@users.noreply.github.com>
1 parent 7a47c22 commit 4ae59ec

File tree

739 files changed

+24117
-19262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

739 files changed

+24117
-19262
lines changed

.changeset/dull-ears-change.md

Lines changed: 2386 additions & 0 deletions
Large diffs are not rendered by default.

.changeset/metal-walls-scream.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
"@spectrum-css/preview": major
3+
---
4+
5+
## Breaking change
6+
7+
This update removes the previously deprecated component documentation for **cyclebutton**, **quickaction**, **searchwithin**, and **splitbutton**.
8+
9+
To support the Spectrum 2 (S2) Foundations release, Storybook has been updated to toggle token packages to connect the following labels with their appropriate data sources:
10+
11+
- **Spectrum 1**: Flagged as the "legacy" context, this version is no longer the default for the component contexts. When selected, Storybook will load the `@spectrum-css/tokens` at release `v14.6.0` and attach the `.spectrum--legacy` class to the container.
12+
- **Spectrum 2**: The new default context, this version represents the "S2 Foundations" release which serves as a bridge between S1 and S2. Components in this context are not fully S2 and will not exactly match specifications but they do reflect a significant move toward the S2 designs. For full details, see the token and component-level changelogs.
13+
- **Express**: This now deprecated context is still rendered in Storybook by leveraging the `@spectrum-css/tokens` at release `v14.6.0`. Please note that Express and S1 will be removed in the next major release.
14+
15+
This release also includes:
16+
17+
- New migration documentation for S1 -> S2 updates
18+
- Fix for the duplicate line numbers in the code preview plugin
19+
- Updated styles to integrate Spectrum styling into the Storybook UI

.changeset/wise-otters-burn.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
"@spectrum-css/floatingactionbutton": major
3+
"@spectrum-css/opacitycheckerboard": major
4+
"@spectrum-css/illustratedmessage": major
5+
"@spectrum-css/coachindicator": major
6+
"@spectrum-css/contextualhelp": major
7+
"@spectrum-css/progresscircle": major
8+
"@spectrum-css/dropindicator": major
9+
"@spectrum-css/infieldbutton": major
10+
"@spectrum-css/actionbutton": major
11+
"@spectrum-css/pickerbutton": major
12+
"@spectrum-css/actiongroup": major
13+
"@spectrum-css/alertbanner": major
14+
"@spectrum-css/alertdialog": major
15+
"@spectrum-css/buttongroup": major
16+
"@spectrum-css/clearbutton": major
17+
"@spectrum-css/closebutton": major
18+
"@spectrum-css/colorhandle": major
19+
"@spectrum-css/colorslider": major
20+
"@spectrum-css/inlinealert": major
21+
"@spectrum-css/logicbutton": major
22+
"@spectrum-css/progressbar": major
23+
"@spectrum-css/statuslight": major
24+
"@spectrum-css/swatchgroup": major
25+
"@spectrum-css/actionmenu": major
26+
"@spectrum-css/breadcrumb": major
27+
"@spectrum-css/colorloupe": major
28+
"@spectrum-css/colorwheel": major
29+
"@spectrum-css/datepicker": major
30+
"@spectrum-css/fieldgroup": major
31+
"@spectrum-css/fieldlabel": major
32+
"@spectrum-css/pagination": major
33+
"@spectrum-css/typography": major
34+
"@spectrum-css/accordion": major
35+
"@spectrum-css/actionbar": major
36+
"@spectrum-css/assetcard": major
37+
"@spectrum-css/assetlist": major
38+
"@spectrum-css/coachmark": major
39+
"@spectrum-css/colorarea": major
40+
"@spectrum-css/splitview": major
41+
"@spectrum-css/textfield": major
42+
"@spectrum-css/thumbnail": major
43+
"@spectrum-css/calendar": major
44+
"@spectrum-css/checkbox": major
45+
"@spectrum-css/combobox": major
46+
"@spectrum-css/dropzone": major
47+
"@spectrum-css/helptext": major
48+
"@spectrum-css/steplist": major
49+
"@spectrum-css/taggroup": major
50+
"@spectrum-css/treeview": major
51+
"@spectrum-css/underlay": major
52+
"@spectrum-css/commons": major
53+
"@spectrum-css/divider": major
54+
"@spectrum-css/popover": major
55+
"@spectrum-css/sidenav": major
56+
"@spectrum-css/stepper": major
57+
"@spectrum-css/tooltip": major
58+
"@spectrum-css/avatar": major
59+
"@spectrum-css/button": major
60+
"@spectrum-css/dialog": major
61+
"@spectrum-css/miller": major
62+
"@spectrum-css/picker": major
63+
"@spectrum-css/rating": major
64+
"@spectrum-css/search": major
65+
"@spectrum-css/slider": major
66+
"@spectrum-css/swatch": major
67+
"@spectrum-css/switch": major
68+
"@spectrum-css/asset": major
69+
"@spectrum-css/badge": major
70+
"@spectrum-css/meter": major
71+
"@spectrum-css/modal": major
72+
"@spectrum-css/radio": major
73+
"@spectrum-css/table": major
74+
"@spectrum-css/toast": major
75+
"@spectrum-css/card": major
76+
"@spectrum-css/dial": major
77+
"@spectrum-css/form": major
78+
"@spectrum-css/icon": major
79+
"@spectrum-css/link": major
80+
"@spectrum-css/menu": major
81+
"@spectrum-css/page": major
82+
"@spectrum-css/tabs": major
83+
"@spectrum-css/tray": major
84+
"@spectrum-css/well": major
85+
"@spectrum-css/tag": major
86+
---
87+
88+
## Breaking change
89+
90+
This major update creates a bridge between the Spectrum 1 (S1) and Spectrum 2 (S2) designs, dubbed "Spectrum 2 Foundations". These do _NOT_ reflect a fully migrated S2 component. This approach allows consumers to swap the appearance of their components between S1, Express, and S2 by leveraging a "system" layer that remaps the necessary component-level tokens to the appropriate token dataset.
91+
92+
For these components to appear S2, you must load the assets with the `@spectrum-css/tokens` at `v16` or higher.
93+
94+
For S1 or Express, load assets with the `@spectrum-css/tokens` at `v14.x` or `v15.x`.
95+
96+
If you are looking to implement a fully S2 design, please explore the `next` tag releases instead of using this foundations release. **This release is used in Spectrum Web Components 1.x**.
97+
98+
### Deprecations
99+
100+
The `metadata` folder containing the `mods.md` and `metadata.json` assets has been removed from source. To find information about the components including what selectors, modifiers, and passthroughs are used, please see the `dist/metadata.json` asset shipped with every component containing CSS.
101+
102+
The `index-vars.css` asset has been removed in this release as it was previously deprecated and is no longer maintained. Please use the `index.css` or `index-base.css`
103+
104+
### File usage
105+
106+
If you are rendering components and need **only** the S2 Foundations styles, you can make use of the `index.css` asset which contains all the base styles plus the system mappings for S2 Foundations.
107+
108+
If you are using this version to publish **only** an S1 or Express component, you can use the `index-base.css` plus the desired `themes/(spectrum|express).css` file.
109+
110+
To render a component that can be easily swapped between the S2 Foundations, S1, or Express contexts, load `index-base.css` with the `index-theme.css` file and leverage the appropriate context classes (`.spectrum--legacy` for S1 and `.spectrum--express` for Express).

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
dist
2-
!tokens/dist/index.css
3-
!tokens/dist/css/*.css
4-
!tokens/dist/css/express/*.css
5-
!tokens/dist/css/spectrum/*.css
2+
!dist/metadata.json
3+
!tokens/dist/**
64

75
# Not committing the map assets, these are dev-only
86
*.map

.storybook/assets/base.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@ body {
3030

3131
.spectrum {
3232
color: var(--spectrum-neutral-content-color-default);
33-
background-color: var(--spectrum-background-layer-1-color);
33+
background-color: var(--spectrum-background-base-color);
3434
-webkit-tap-highlight-color: rgba(0, 0, 0, 0%);
3535
}
3636

37+
.spectrum.spectrum--legacy {
38+
color: var(--spectrum-neutral-content-color-default);
39+
background-color: var(--spectrum-background-layer-1-color);
40+
}
41+
3742
/* Hide the SVG elements that only include references */
3843
svg:has(symbol):not(:has(use)) {
3944
display: none;
Loading

.storybook/decorators/context.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { makeDecorator, useEffect } from "@storybook/preview-api";
22
import { fetchContainers, toggleStyles } from "./helpers.js";
33

4-
import tokens from "@spectrum-css/tokens/dist/index.css?inline";
4+
import legacyTokens from "@spectrum-css/tokens-legacy/dist/index.css?inline";
5+
import tokens from "@spectrum-css/tokens/dist/css/index.css?inline";
56

67
/**
78
* @type import('@storybook/csf').DecoratorFunction<import('@storybook/web-components').WebComponentsFramework>
@@ -18,7 +19,7 @@ export const withContextWrapper = makeDecorator({
1819
} = {},
1920
globals: {
2021
color = "light",
21-
context = "legacy",
22+
context = "spectrum",
2223
scale = "medium",
2324
} = {},
2425
parameters: {
@@ -52,14 +53,14 @@ export const withContextWrapper = makeDecorator({
5253
const isModern = Boolean(context === "spectrum");
5354
const isExpress = Boolean(context === "express");
5455

55-
// Start by attaching the appropriate tokens to the container
56-
toggleStyles(document.body, "tokens", tokens, !isRaw);
57-
5856
if (!isRaw) {
5957
// add the default classes to the body to ensure labels, headings, and borders are styled correctly
6058
document.body.classList.add("spectrum", "spectrum--light", "spectrum--medium");
6159
}
6260

61+
// Start by attaching the appropriate tokens to the container
62+
toggleStyles(document.body, "tokens", isModern ? tokens : legacyTokens, !isRaw, context);
63+
6364
for (const container of fetchContainers(id, isDocs, isTesting)) {
6465
// Check if the container is a testing wrapper to prevent applying colors around the testing grid
6566
const isTestingWrapper = isTesting ? container.matches("body:has([data-testing-preview]),[data-testing-preview]") : false;
@@ -127,7 +128,7 @@ export const withContextWrapper = makeDecorator({
127128
}
128129
}
129130

130-
}, [context, viewMode, original, staticColor, color, scale, rootClass, tokens, staticColorSettings, showTestingGrid]);
131+
}, [context, color, scale, viewMode, original, staticColor, rootClass, tokens, legacyTokens, staticColorSettings, showTestingGrid]);
131132

132133
return StoryFn(data);
133134
},

.storybook/deprecated/cyclebutton/cyclebutton.stories.js

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)