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
5 changes: 5 additions & 0 deletions .changeset/calm-taxes-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/styles': patch
---

Remove unnecessary system theme references to reduce complexity for components that don't need the additional mapping layer.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters:
# 3. Commit this change to the PR branch where the changes exist.
current_golden_images_hash:
type: string
default: 728676ad885db988eb369dac901e9904bf6b79d2
default: b3342a5f378ee473443510bcbd28f80c10e29460
wireit_cache_name:
type: string
default: wireit
Expand Down
11 changes: 3 additions & 8 deletions packages/card/src/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import '@spectrum-web-components/checkbox/sp-checkbox.js';
import '@spectrum-web-components/popover/sp-popover.js';
import '@spectrum-web-components/divider/sp-divider.js';
import cardStyles from './card.css.js';
import headingStyles from '@spectrum-web-components/styles/heading.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicative - the card styles provide the typography needed for the heading and subtitle sections.

import detailStyles from '@spectrum-web-components/styles/detail.js';

/**
* @element sp-card
Expand All @@ -62,7 +60,7 @@ export class Card extends LikeAnchor(
)
) {
public static override get styles(): CSSResultArray {
return [headingStyles, detailStyles, cardStyles];
return [cardStyles];
}

@property()
Expand Down Expand Up @@ -209,10 +207,7 @@ export class Card extends LikeAnchor(

protected get renderHeading(): TemplateResult {
return html`
<div
class="title spectrum-Heading spectrum-Heading--sizeXS"
id="heading"
>
<div class="title" id="heading">
<slot name="heading">${this.heading}</slot>
</div>
`;
Expand Down Expand Up @@ -263,7 +258,7 @@ export class Card extends LikeAnchor(

private get renderSubtitleAndDescription(): TemplateResult {
return html`
<div class="subtitle spectrum-Detail spectrum-Detail--sizeS">
<div class="subtitle">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where im seeing the issue in VRT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@castastrophe looooks so much closer, seems like letter-spacing is the only thing off in the VRTs but I personally like the actual over the baseline. is this an acceptable difference?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I kind of like the updated letter spacing for readability.

<slot name="subheading">${this.subheading}</slot>
</div>
<slot name="description"></slot>
Expand Down
31 changes: 15 additions & 16 deletions packages/card/src/card.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

@import url('./spectrum-card.css');
@import url('./card-overrides.css');
@import url("./spectrum-card.css");
@import url("./card-overrides.css");

:host([href]:not([href=''])) {
:host([href]:not([href=""])) {
cursor: pointer;
}

Expand All @@ -27,29 +27,26 @@ governing permissions and limitations under the License.
flex-grow: 0;
}

:host([dir='ltr']) .action-button {
:host([dir="ltr"]) .action-button {
margin-left: auto;
}

:host([dir='rtl']) .action-button {
:host([dir="rtl"]) .action-button {
margin-right: auto;
}

/* The description slot has a psuedo-element that also needs to receive the font styling.
/* The description slot has a psuedo-element that also needs to receive the font styling.
We need to add the declaration to the slot as well */
slot[name='description'] {
font-size: var(
--spectrum-card-subtitle-text-size,
var(--spectrum-font-size-50)
);
slot[name="description"] {
font-size: var(--spectrum-card-subtitle-text-size, var(--spectrum-font-size-50));
}

#preview + #cover-photo {
display: none;
}

#cover-photo ::slotted(*),
:host(:not([variant='quiet'])) #preview ::slotted(*) {
:host(:not([variant="quiet"])) #preview ::slotted(*) {
width: 100%;
display: block;

Expand All @@ -59,7 +56,7 @@ slot[name='description'] {
object-fit: cover;
}

:host(:not([variant='gallery'])) #preview ::slotted(*) {
:host(:not([variant="gallery"])) #preview ::slotted(*) {
height: 100%;
}

Expand All @@ -81,16 +78,18 @@ sp-popover {
}

/**
* Allow that the heading element will take specified use of the available width whether
* Allow that the heading element will take specified use of the available width whether
* "actions" are supplied to the element or not.
**/
.title {
width: var(--spectrum-card-title-width);
}

.subtitle {
/* Override until https://github.com/adobe/spectrum-css/issues/1054 is fixed */
text-transform: none;
font-family: var(--spectrum-sans-font-family-stack);
font-size: var(--spectrum-detail-size-s);
font-weight: var(--spectrum-detail-sans-serif-font-weight);
line-height: var(--spectrum-detail-line-height);
}

:host:before,
Expand Down
3 changes: 0 additions & 3 deletions projects/documentation/src/components/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ governing permissions and limitations under the License.
@import '@spectrum-web-components/styles/tokens/spectrum/custom-vars.css';
@import '@spectrum-web-components/styles/tokens/spectrum/system-theme-bridge.css';
@import '@spectrum-web-components/styles/src/spectrum-heading.css';
@import '@spectrum-web-components/styles/src/heading-overrides.css';
@import '@spectrum-web-components/styles/src/spectrum-body.css';
@import '@spectrum-web-components/styles/src/body-overrides.css';
@import '@spectrum-web-components/styles/src/spectrum-code.css';
@import '@spectrum-web-components/styles/src/code-overrides.css';
@import '@spectrum-web-components/opacity-checkerboard/src/spectrum-opacity-checkerboard.css';
@import './inline-alert.css';
@import './fonts.css';
Expand Down
17 changes: 3 additions & 14 deletions scripts/spectrum-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,12 @@ const processCSS = async (

const processTypography = async (
baseSrcPath,
overridesSrcPath,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No overrides are needed for the typography package anymore.

dstPath,
identifier,
from,
usedVariables = undefined
) => {
const baseData = fs.readFileSync(baseSrcPath, 'utf8');
const overridesData = fs.readFileSync(overridesSrcPath, 'utf8');
const data = baseData + overridesData;
const data = fs.readFileSync(baseSrcPath, 'utf8');
const result = await processCSSData(data, identifier, from, usedVariables);
fs.writeFileSync(dstPath, result, 'utf8');

Expand Down Expand Up @@ -214,20 +211,12 @@ async function processSpectrumVars() {
'typography',
'dist'
);
const baseSrcPath = path.join(typographyPath, 'index-base.css');
const overridesSrcPath = path.join(typographyPath, 'index-theme.css');
const baseSrcPath = path.join(typographyPath, 'index.css');
const dstPath = path.resolve(
path.join(__dirname, '..', 'tools', 'styles', 'typography.css')
);
console.log(`processing typography`);
processes.push(
processTypography(
baseSrcPath,
overridesSrcPath,
dstPath,
'typography'
)
);
processes.push(processTypography(baseSrcPath, dstPath, 'typography'));
}

await Promise.all(processes).then(() => {
Expand Down
19 changes: 9 additions & 10 deletions tasks/process-spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,18 @@ async function processComponent(componentPath) {
* @type { import('./spectrum-css-converter').SpectrumCSSConverter}
*/
for await (const conversion of conversions) {
// The default package file is index.css but index-base.css contains the base styles compatible with theme switching.
let sourcePath = require
.resolve(conversion.inPackage)
.replace('index.css', 'index-base.css');

// The default package file is index.css
const sourcePath = require.resolve(conversion.inPackage);
let sourceCSS = '';

// try to find the index-base.css file
try {
sourceCSS = fs.readFileSync(sourcePath, 'utf-8');
} catch (error) {
Comment on lines -173 to -175
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try catch is not an optimal way to check if a file exists - swapped this for fs.existsSync

// index-base.css contains the base styles compatible with theme switching
if (fs.existsSync(sourcePath.replace('index.css', 'index-base.css'))) {
sourceCSS = fs.readFileSync(
sourcePath.replace('index.css', 'index-base.css'),
'utf-8'
);
} else {
// if failed, try to find the index.css file
sourcePath = require.resolve(conversion.inPackage);
sourceCSS = fs.readFileSync(sourcePath, 'utf-8');
}

Expand Down
20 changes: 2 additions & 18 deletions tools/styles/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,7 @@ governing permissions and limitations under the License.
*/

import baseStyles from './src/spectrum-base.css.js';
import langBaseStyles from './src/spectrum-lang.css.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the *-overrides files were necessary for typography so this reduces that complexity. Note the files are not removed because they're being shipped in the exports object and thus could be used by customers downstream without us knowing. The files will now be empty but present.

import langOverrides from './src/lang-overrides.css.js';
import bodyBaseStyles from './src/spectrum-body.css.js';
import bodyOverrides from './src/body-overrides.css.js';

import { css } from 'lit';

// bodyStyles is a combination of bodyBaseStyles and bodyOverrides
const bodyStyles = css`
${bodyBaseStyles}
${bodyOverrides}
`;

// langStyles is a combination of langBaseStyles and langOverrides
const langStyles = css`
${langBaseStyles}
${langOverrides}
`;
import langStyles from './src/spectrum-lang.css.js';
import bodyStyles from './src/spectrum-body.css.js';

export default [baseStyles, langStyles, bodyStyles];
18 changes: 2 additions & 16 deletions tools/styles/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@ governing permissions and limitations under the License.
*/

import baseStyles from './src/spectrum-base.css.js';
import langBaseStyles from './src/spectrum-lang.css.js';
import langOverrides from './src/lang-overrides.css.js';
import codeBaseStyles from './src/spectrum-code.css.js';
import codeOverrides from './src/code-overrides.css.js';

import { css } from 'lit';

const langStyles = css`
${langBaseStyles}
${langOverrides}
`;

const codeStyles = css`
${codeBaseStyles}
${codeOverrides}
`;
import langStyles from './src/spectrum-lang.css.js';
import codeStyles from './src/spectrum-code.css.js';

export default [baseStyles, langStyles, codeStyles];
18 changes: 2 additions & 16 deletions tools/styles/detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@ governing permissions and limitations under the License.
*/

import baseStyles from './src/spectrum-base.css.js';
import langBaseStyles from './src/spectrum-lang.css.js';
import langOverrides from './src/lang-overrides.css.js';
import detailBaseStyles from './src/spectrum-detail.css.js';
import detailOverrides from './src/detail-overrides.css.js';

import { css } from 'lit';

const langStyles = css`
${langBaseStyles}
${langOverrides}
`;

const detailStyles = css`
${detailBaseStyles}
${detailOverrides}
`;
import langStyles from './src/spectrum-lang.css.js';
import detailStyles from './src/spectrum-detail.css.js';

export default [baseStyles, langStyles, detailStyles];
Loading
Loading