Skip to content

Commit 562396e

Browse files
authored
build: postcss plugin updates and fixes (#3502)
1 parent c8194b0 commit 562396e

File tree

330 files changed

+2562
-3937
lines changed

Some content is hidden

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

330 files changed

+2562
-3937
lines changed

.changeset/cuddly-dragons-yell.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@spectrum-tools/stylelint-no-unknown-custom-properties": patch
3+
"@spectrum-tools/stylelint-no-unused-custom-properties": patch
4+
---
5+
6+
Update package dependencies.
7+
8+
Specific to `stylelint-no-unknown-custom-properties`, the assumption that only CSS files will be parsed is removed to allow support for JSON assets as well. Additionally, this package will now evaluate dependencies beyond just `@spectrum-css`.

.changeset/cuddly-ravens-repair.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@spectrum-tools/postcss-add-theming-layer": major
3+
---
4+
5+
The PostCSS plugin previously published as `postcss-splitinator`. This new package creates a polyfill for style queries by creating a layer of `--system` prefixed custom properties to be loaded by attaching a unique selector. This allows the toggling of component-level property definitions by theme or context. There are many options available to customize the output that are documented in the package [README](plugins/postcss-add-theming-layer/README.md).

.changeset/large-ways-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@spectrum-tools/stylelint-theme-alignment": minor
3+
---
4+
5+
Fixes a bug where the source file is expected to be "spectrum-two" instead of "spectrum".

.changeset/rotten-cars-ring.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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/alertdialog": major
10+
"@spectrum-css/buttongroup": major
11+
"@spectrum-css/colorhandle": major
12+
"@spectrum-css/colorslider": major
13+
"@spectrum-css/inlinealert": major
14+
"@spectrum-css/logicbutton": major
15+
"@spectrum-css/progressbar": major
16+
"@spectrum-css/statuslight": major
17+
"@spectrum-css/swatchgroup": major
18+
"@spectrum-css/breadcrumb": major
19+
"@spectrum-css/colorloupe": major
20+
"@spectrum-css/colorwheel": major
21+
"@spectrum-css/fieldgroup": major
22+
"@spectrum-css/fieldlabel": major
23+
"@spectrum-css/pagination": major
24+
"@spectrum-css/typography": major
25+
"@spectrum-css/accordion": major
26+
"@spectrum-css/actionbar": major
27+
"@spectrum-css/assetlist": major
28+
"@spectrum-css/coachmark": major
29+
"@spectrum-css/colorarea": major
30+
"@spectrum-css/splitview": major
31+
"@spectrum-css/thumbnail": major
32+
"@spectrum-css/calendar": major
33+
"@spectrum-css/dropzone": major
34+
"@spectrum-css/helptext": major
35+
"@spectrum-css/steplist": major
36+
"@spectrum-css/taggroup": major
37+
"@spectrum-css/treeview": major
38+
"@spectrum-css/underlay": major
39+
"@spectrum-css/divider": major
40+
"@spectrum-css/sidenav": major
41+
"@spectrum-css/avatar": major
42+
"@spectrum-css/dialog": major
43+
"@spectrum-css/miller": major
44+
"@spectrum-css/swatch": major
45+
"@spectrum-css/asset": major
46+
"@spectrum-css/badge": major
47+
"@spectrum-css/modal": major
48+
"@spectrum-css/table": major
49+
"@spectrum-css/card": major
50+
"@spectrum-css/dial": major
51+
"@spectrum-css/icon": major
52+
"@spectrum-css/link": major
53+
"@spectrum-css/menu": major
54+
"@spectrum-css/tray": major
55+
"@spectrum-css/well": major
56+
---
57+
58+
Remove empty theme references to reduce complexity for components that don't need to define any mappings. This involves removing the source `themes` directories with the empty `spectrum.css` and `express.com` files as well as removing the following empty or unnecessary exports:
59+
60+
- `index-base.css`
61+
- `index-theme.css`
62+
- `themes/spectrum.css`
63+
- `themes/express.css`

.changeset/sixty-cats-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@spectrum-tools/postcss-rgb-mapping": major
3+
---
4+
5+
Migrated the `postcss-rgb-mapping` package into the new `@spectrum-tools` namespace so updates may shipped and shared among other projects.

.changeset/tame-hairs-grow.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
"@spectrum-css/infieldbutton": minor
3+
"@spectrum-css/actionbutton": minor
4+
"@spectrum-css/pickerbutton": minor
5+
"@spectrum-css/actiongroup": minor
6+
"@spectrum-css/alertbanner": minor
7+
"@spectrum-css/clearbutton": minor
8+
"@spectrum-css/closebutton": minor
9+
"@spectrum-css/datepicker": minor
10+
"@spectrum-css/assetcard": minor
11+
"@spectrum-css/textfield": minor
12+
"@spectrum-css/checkbox": minor
13+
"@spectrum-css/combobox": minor
14+
"@spectrum-css/popover": minor
15+
"@spectrum-css/stepper": minor
16+
"@spectrum-css/tooltip": minor
17+
"@spectrum-css/button": minor
18+
"@spectrum-css/picker": minor
19+
"@spectrum-css/rating": minor
20+
"@spectrum-css/search": minor
21+
"@spectrum-css/slider": minor
22+
"@spectrum-css/switch": minor
23+
"@spectrum-css/radio": minor
24+
"@spectrum-css/toast": minor
25+
"@spectrum-css/tabs": minor
26+
"@spectrum-css/tag": minor
27+
---
28+
29+
Simplify how the `--system` properties are mapped. By updating the logic in the `postcss-add-theming-layer`, we are now shipping cleaner, more readable `--system` property names. These custom properties are documented as _NOT_ a part of the component API so although these result in a change to the custom property names, it does not impact the properties that are in the API and so do not constitute a breaking change. Expect to see no change to how component theming works or any visual regressions as a result of this change.

.storybook/guides/develop.mdx

Lines changed: 113 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Each component has the following files:
4040

4141
Each component outputs the following assets to `dist`:
4242

43-
- `index.css`: This asset includes the base CSS and the `themes/spectrum-two.css` definitions (without the system mapping layer). This asset is meant to be used in a environment where only the current Spectrum theme is supported.
43+
- `index.css`: This asset includes the base CSS and the `themes/spectrum.css` definitions (without the system mapping layer). This asset is meant to be used in a environment where only the current Spectrum theme is supported.
4444
- `index-base.css`: This asset includes only the base CSS; that is, the CSS without any custom property definitions. This can be used in conjunction with `index-theme.css` and the desired `themes/*.css` file to render a themed component.
4545
- `index-theme.css`: This asset includes only the custom property definitions for the component as mapped to the system variables. This can be used in conjunction with `index-base.css` and the desired `themes/*.css` file to render a themed component.
4646

@@ -54,7 +54,7 @@ Each component outputs theme-specific assets to `dist/themes`. These assets incl
5454
1. Generate a new component using the `yarn new component` command. The generator will prompt you to answer questions about your component.
5555
2. Edit the `dependencies` within the `package.json` file to use only the dependencies your component needs. All components rely on `@spectrum-css/tokens`, and most rely on `@spectrum-css/icon`.
5656
3. Once your folder has been generated, you can run `yarn start` in the root of the project to begin developing.
57-
4. The `index.css` file is where most of your styles will be added. Add any custom property mappings to the global token library in the `themes/spectrum-two.css` asset.
57+
4. The `index.css` file is where most of your styles will be added. Add any custom property mappings to the global token library in the `themes/spectrum.css` asset.
5858
5. Inside the `stories` directory you will find a `template.js`, `*.stories.js`, and `*.mdx` file.
5959
- In the `*.stories.js` file, define the available knobs and properties for your component, as well as any standard variations you want to surface in [Storybook](https://storybook.js.org/docs/react/writing-stories/introduction).
6060
- Update the `template.js` file with the markup, using [lit-html syntax](https://lit.dev/docs/templates/overview/) to adjust results based on the provided settings from the Storybook knobs.
@@ -175,28 +175,28 @@ To import shared types into your story, use the following syntax:
175175

176176
```js
177177
import {
178-
isActive,
179-
isDisabled,
180-
isFocused,
181-
isHovered,
182-
isSelected,
178+
isActive,
179+
isDisabled,
180+
isFocused,
181+
isHovered,
182+
isSelected,
183183
} from "@spectrum-css/preview/types";
184184

185185
export default {
186-
argTypes: {
187-
isDisabled,
188-
isSelected,
189-
isHovered,
190-
isFocused,
191-
isActive,
192-
},
193-
args: {
194-
isDisabled: false,
195-
isSelected: false,
196-
isHovered: false,
197-
isFocused: false,
198-
isActive: false,
199-
},
186+
argTypes: {
187+
isDisabled,
188+
isSelected,
189+
isHovered,
190+
isFocused,
191+
isActive,
192+
},
193+
args: {
194+
isDisabled: false,
195+
isSelected: false,
196+
isHovered: false,
197+
isFocused: false,
198+
isActive: false,
199+
},
200200
};
201201
```
202202

@@ -348,80 +348,80 @@ import "../themes/express.css";
348348
import "../themes/spectrum.css";
349349

350350
export const Template = (
351-
{
352-
rootClass = "spectrum-Tag",
353-
size = "m",
354-
iconName,
355-
avatarUrl,
356-
label,
357-
isSelected = false,
358-
isEmphasized = false,
359-
isDisabled = false,
360-
isInvalid = false,
361-
hasClearButton = false,
362-
id,
363-
customClasses = [],
364-
customStyles = {},
365-
},
366-
context,
351+
{
352+
rootClass = "spectrum-Tag",
353+
size = "m",
354+
iconName,
355+
avatarUrl,
356+
label,
357+
isSelected = false,
358+
isEmphasized = false,
359+
isDisabled = false,
360+
isInvalid = false,
361+
hasClearButton = false,
362+
id,
363+
customClasses = [],
364+
customStyles = {},
365+
},
366+
context,
367367
) => {
368-
return html`
369-
<div
370-
class=${classMap({
371-
[rootClass]: true,
372-
[`${rootClass}--size${size?.toUpperCase()}`]:
373-
typeof size !== "undefined",
374-
"is-emphasized": isEmphasized,
375-
"is-disabled": isDisabled,
376-
"is-invalid": isInvalid,
377-
"is-selected": isSelected,
378-
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
379-
})}
380-
style=${styleMap(customStyles)}
381-
id=${ifDefined(id)}
382-
tabindex="0"
383-
>
384-
${when(avatarUrl && !iconName, () =>
385-
Avatar(
386-
{
387-
image: avatarUrl,
388-
size: "50",
389-
},
390-
context,
391-
),
392-
)}
393-
${when(iconName, () =>
394-
Icon(
395-
{
396-
iconName,
397-
customClasses: [`${rootClass}s-itemIcon`],
398-
},
399-
context,
400-
),
401-
)}
402-
<span
403-
class=${classMap({
404-
[`${rootClass}s-itemLabel`]: true,
405-
})}
406-
>${label}</span
407-
>
408-
${when(hasClearButton, () =>
409-
ClearButton(
410-
{
411-
customClasses: [`${rootClass}-clearButton`],
412-
onclick: (evt) => {
413-
const el = evt.target;
414-
if (!el) return;
415-
416-
const wrapper = el.closest(rootClass);
417-
wrapper.parentNode.removeChild(wrapper);
418-
},
419-
},
420-
context,
421-
),
422-
)}
423-
</div>
424-
`;
368+
return html`
369+
<div
370+
class=${classMap({
371+
[rootClass]: true,
372+
[`${rootClass}--size${size?.toUpperCase()}`]:
373+
typeof size !== "undefined",
374+
"is-emphasized": isEmphasized,
375+
"is-disabled": isDisabled,
376+
"is-invalid": isInvalid,
377+
"is-selected": isSelected,
378+
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
379+
})}
380+
style=${styleMap(customStyles)}
381+
id=${ifDefined(id)}
382+
tabindex="0"
383+
>
384+
${when(avatarUrl && !iconName, () =>
385+
Avatar(
386+
{
387+
image: avatarUrl,
388+
size: "50",
389+
},
390+
context,
391+
),
392+
)}
393+
${when(iconName, () =>
394+
Icon(
395+
{
396+
iconName,
397+
customClasses: [`${rootClass}s-itemIcon`],
398+
},
399+
context,
400+
),
401+
)}
402+
<span
403+
class=${classMap({
404+
[`${rootClass}s-itemLabel`]: true,
405+
})}
406+
>${label}</span
407+
>
408+
${when(hasClearButton, () =>
409+
ClearButton(
410+
{
411+
customClasses: [`${rootClass}-clearButton`],
412+
onclick: (evt) => {
413+
const el = evt.target;
414+
if (!el) return;
415+
416+
const wrapper = el.closest(rootClass);
417+
wrapper.parentNode.removeChild(wrapper);
418+
},
419+
},
420+
context,
421+
),
422+
)}
423+
</div>
424+
`;
425425
};
426426
```
427427
@@ -438,24 +438,24 @@ import { Variants } from "@spectrum-css/preview/decorators";
438438
import { Template } from "./template.js";
439439

440440
export const AccordionGroup = Variants({
441-
Template,
442-
testData: [
443-
{
444-
testHeading: "Standard",
445-
},
446-
{
447-
testHeading: "Compact",
448-
density: "compact",
449-
collapseAll: true,
450-
withStates: false,
451-
},
452-
],
453-
stateData: [
454-
{
455-
testHeading: "Disabled",
456-
disableAll: true,
457-
},
458-
],
441+
Template,
442+
testData: [
443+
{
444+
testHeading: "Standard",
445+
},
446+
{
447+
testHeading: "Compact",
448+
density: "compact",
449+
collapseAll: true,
450+
withStates: false,
451+
},
452+
],
453+
stateData: [
454+
{
455+
testHeading: "Disabled",
456+
disableAll: true,
457+
},
458+
],
459459
});
460460
```
461461
@@ -474,7 +474,7 @@ In the event that you don't want a story to be tested in Chromatic, you can use
474474
475475
```js
476476
Default.parameters = {
477-
chromatic: { disableSnapshot: true },
477+
chromatic: { disableSnapshot: true },
478478
};
479479
```
480480

0 commit comments

Comments
 (0)