Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
67fe2d4
feat(dev-validation): add reusable dev-mode validation helpers and docs
rubencarvalho Jul 14, 2026
bf43016
docs(dev-validation): say Gen2 instead of 2nd-gen in the consumer guide
rubencarvalho Jul 15, 2026
7e1a810
docs(dev-validation): add per-bundler production-stripping recipes
rubencarvalho Jul 15, 2026
4f2a314
feat(dev-validation): retrofit Badge, Tabs, IllustratedMessage onto h…
rubencarvalho Jul 15, 2026
2dc721c
refactor(badge): drop constructor lookup for the non-abstract static
rubencarvalho Jul 15, 2026
dc7b09e
Revert "refactor(badge): drop constructor lookup for the non-abstract…
rubencarvalho Jul 15, 2026
85b6e8f
feat(dev-validation): retrofit ProgressCircle, LinearProgressMixin, M…
rubencarvalho Jul 15, 2026
51af7cf
feat(dev-validation): retrofit Button, Card, Tooltip, ActionButton
rubencarvalho Jul 15, 2026
eaebb05
feat(dev-validation): retrofit Asset, AlertBanner, StatusLight, Popover
rubencarvalho Jul 15, 2026
a0fa407
feat(dev-validation): retrofit Divider, Avatar, ButtonGroup
rubencarvalho Jul 15, 2026
96b4d20
feat(dev-validation): add missing density enum check to Accordion
rubencarvalho Jul 15, 2026
e7f6de9
feat(dev-validation): gate helpers on the literal NODE_ENV, not just …
rubencarvalho Jul 15, 2026
653c133
Merge branch 'ruben/feat-dev-warning-validation-foundation' into rube…
rubencarvalho Jul 15, 2026
2b02150
docs(dev-validation): trim over-justification of the residual call-si…
rubencarvalho Jul 15, 2026
017ab27
Merge branch 'ruben/feat-dev-warning-validation-foundation' into rube…
rubencarvalho Jul 15, 2026
94904f4
fix(dev-warning): remove em-dash
miwha-adobe Jul 23, 2026
ba43186
refactor(dev-validation): centralize the dev warn gate in emitWarning
miwha-adobe Jul 24, 2026
402a757
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Jul 24, 2026
ab817c4
test(dev-validation): cover DEBUG gate, dedup key, and helper edge cases
miwha-adobe Jul 24, 2026
0939a81
test(dev-validation): cover DEBUG gate, dedup key, and helper edge ca…
miwha-adobe Jul 24, 2026
75bd986
fix(debug-validation): prettier format char width limit
miwha-adobe Jul 24, 2026
0ab5a9f
fix(dev-warning): additional text wrapping
miwha-adobe Jul 24, 2026
ce10af4
fix(docs): update the known limitations to be less verbose
miwha-adobe Jul 24, 2026
b45b7b3
Merge branch 'main' into ruben/feat-dev-warning-validation-foundation
miwha-adobe Jul 24, 2026
0532ec5
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Jul 24, 2026
ca3d45a
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Jul 24, 2026
f4f6ad4
Merge branch 'ruben/feat-dev-warning-validation-foundation' of https:…
miwha-adobe Jul 24, 2026
45b1e85
Merge branch 'ruben/feat-dev-warning-validation-foundation' into rube…
miwha-adobe Jul 24, 2026
83af7fe
fix(dev-warning): fix the import path for helpers
miwha-adobe Jul 27, 2026
e37cd37
feat(dev-validation): add isDebug() gate for expensive call-site checks
miwha-adobe Jul 27, 2026
f4bef58
Merge branch 'ruben/feat-dev-warning-validation-foundation' into rube…
miwha-adobe Jul 27, 2026
cf4efb8
test(dev-warning): add isDebug test
miwha-adobe Jul 27, 2026
9931fe1
Merge branch 'ruben/feat-dev-warning-validation-foundation' into rube…
miwha-adobe Jul 27, 2026
814d725
chore(dev-warning): add instances of isDebug
miwha-adobe Jul 28, 2026
5c1c5ce
chore(dev-warning): add group warnings and a count
miwha-adobe Jul 29, 2026
ae96d85
fix(dev-warning): refine conditional to be exclusive
miwha-adobe Jul 29, 2026
9944fee
test(status-light): name the warning message in the variant assertion
miwha-adobe Jul 29, 2026
397d9ec
Merge branch 'main' into ruben/feat-dev-warning-validation-foundation
miwha-adobe Jul 29, 2026
93b36cc
Merge branch 'ruben/feat-dev-warning-validation-foundation' of https:…
miwha-adobe Jul 29, 2026
b04ddb6
fix(dev-warning): restore dropped level
miwha-adobe Jul 29, 2026
121b9e0
test(illustrated-message): add slot warnings
miwha-adobe Jul 29, 2026
5c8b610
refactor(dev-validation): retrofit Dropzone and modernize style-guide…
miwha-adobe Jul 29, 2026
453e87c
fix(dev-warning): return warnMissingAccessible name, and add debug check
miwha-adobe Aug 3, 2026
4efeab9
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Aug 3, 2026
48b8604
Merge branch 'ruben/feat-dev-warning-validation-foundation' of https:…
miwha-adobe Aug 3, 2026
3c07ec7
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Aug 7, 2026
ca302e2
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Aug 10, 2026
c97829f
Merge branch 'ruben/feat-dev-warning-validation-foundation' of https:…
miwha-adobe Aug 10, 2026
473a20c
Merge branch 'main' of https://github.com/adobe/spectrum-web-componen…
miwha-adobe Aug 11, 2026
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
10 changes: 10 additions & 0 deletions 2nd-gen/packages/core/components/accordion/Accordion.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import { property } from 'lit/decorators.js';
import { LiveSelectionController } from '@adobe/spectrum-wc-core/controllers/index.js';
import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';
import { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';

import {
ACCORDION_DENSITIES,
ACCORDION_VALID_SIZES,
type AccordionDensity,
type AccordionHeadingLevel,
Expand Down Expand Up @@ -132,6 +134,14 @@ export abstract class AccordionBase extends SizedMixin(SpectrumElement, {
}

protected override update(changedProperties: PropertyValues): void {
if (changedProperties.has('density')) {
validateEnum(this, {
prop: 'density',
value: this.density,
valid: ACCORDION_DENSITIES,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-accordion--docs',
});
}
if (changedProperties.has('level')) {
const clamped = Math.min(
6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { CSSResultArray, PropertyValues, TemplateResult } from 'lit';
import { property } from 'lit/decorators.js';

import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';

import {
ALERT_BANNER_VALID_VARIANTS,
Expand Down Expand Up @@ -67,16 +68,12 @@ export abstract class AlertBannerBase extends SpectrumElement {
this.removeAttribute('variant');
this._variant = '';

if (window.__swc?.DEBUG) {
window.__swc.warn(
this,
`<${this.localName}> element expects the "variant" attribute to be one of the following:`,
'https://opensource.adobe.com/spectrum-web-components/components/alert-banner/#variants',
{
issues: [...ALERT_BANNER_VALID_VARIANTS],
}
);
}
validateEnum(this, {
prop: 'variant',
value: variant,
valid: ALERT_BANNER_VALID_VARIANTS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-alert-banner--docs',
});
}
this.requestUpdate('variant', oldValue);
}
Expand Down
22 changes: 8 additions & 14 deletions 2nd-gen/packages/core/components/asset/Asset.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { PropertyValues } from 'lit';
import { property } from 'lit/decorators.js';

import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';

import { ASSET_VARIANTS, type AssetVariant } from './Asset.types.js';

Expand Down Expand Up @@ -53,21 +54,14 @@ export abstract class AssetBase extends SpectrumElement {

protected override updated(changes: PropertyValues): void {
super.updated(changes);
if (window.__swc?.DEBUG) {
if (typeof this.variant !== 'undefined') {
const constructor = this.constructor as typeof AssetBase;
if (
typeof this.variant !== 'undefined' &&
!constructor.VARIANTS.includes(this.variant)
) {
window.__swc.warn(
this,
`<${this.localName}> element expects the "variant" attribute to be one of the following:`,
'https://opensource.adobe.com/spectrum-web-components/components/asset/',
{
issues: [...constructor.VARIANTS],
}
);
}
validateEnum(this, {
prop: 'variant',
value: this.variant,
valid: constructor.VARIANTS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-asset--docs',
});
}
}
}
47 changes: 27 additions & 20 deletions 2nd-gen/packages/core/components/avatar/Avatar.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { PropertyValues } from 'lit';
import { property } from 'lit/decorators.js';

import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { warnIf } from '@adobe/spectrum-wc-core/utils/index.js';

import {
AVATAR_DEFAULT_SIZE,
Expand Down Expand Up @@ -73,12 +74,21 @@ export abstract class AvatarBase extends SpectrumElement {
}

public set size(value: AvatarSize) {
const validSize = (AVATAR_VALID_SIZES as readonly number[]).includes(
const isValid = (AVATAR_VALID_SIZES as readonly number[]).includes(
Number(value)
)
);
const validSize = isValid
? (Number(value) as AvatarSize)
: AVATAR_DEFAULT_SIZE;

warnIf(
this,
!isValid,
`<${this.localName}> expects "size" to be one of: ${AVATAR_VALID_SIZES.join(', ')}. Received "${value}".`,
'https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs',
{ issues: [`size="${value}"`] }
);

if (this._size === validSize) {
return;
}
Expand Down Expand Up @@ -126,17 +136,15 @@ export abstract class AvatarBase extends SpectrumElement {
this.setAttribute('size', String(this.size));
}
this._syncAriaHidden();
if (window.__swc?.DEBUG) {
this._warnMissingAlt();
}
this._warnMissingAlt();
}

protected override updated(changes: PropertyValues): void {
super.updated(changes);
if (changes.has('decorative')) {
this._syncAriaHidden();
}
if (changes.has('alt') && window.__swc?.DEBUG) {
if (changes.has('alt')) {
this._warnMissingAlt();
}
}
Expand All @@ -150,19 +158,18 @@ export abstract class AvatarBase extends SpectrumElement {
}

private _warnMissingAlt(): void {
if (this.alt === undefined && !this.decorative) {
window.__swc?.warn(
this,
`<${this.localName}> is missing an \`alt\` attribute. Provide a text description or pass \`alt=""\` and mark it as \`decorative\`.`,
'https://opensource.adobe.com/spectrum-web-components/components/avatar/#accessibility',
{
type: 'accessibility',
issues: [
'Provide an `alt` attribute with meaningful alternative text, or',
'Set `alt=""` and mark the image as `decorative` (hidden from screen readers).',
],
}
);
}
warnIf(
this,
this.alt === undefined && !this.decorative,
`<${this.localName}> is missing an \`alt\` attribute. Provide a text description or pass \`alt=""\` and mark it as \`decorative\`.`,
'https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs',
{
type: 'accessibility',
issues: [
'Provide an `alt` attribute with meaningful alternative text, or',
'Set `alt=""` and mark the image as `decorative` (hidden from screen readers).',
],
}
);
}
}
44 changes: 17 additions & 27 deletions 2nd-gen/packages/core/components/badge/Badge.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot
import { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';
import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';
import { validateEnum, warnIf } from '@adobe/spectrum-wc-core/utils/index.js';

import {
BADGE_VALID_SIZES,
Expand Down Expand Up @@ -170,34 +171,23 @@ export abstract class BadgeBase extends SizedMixin(SpectrumElement, {
}

protected override update(changedProperties: PropertyValues): void {
if (window.__swc?.DEBUG) {
const constructor = this.constructor as typeof BadgeBase;
if (!constructor.VARIANTS.includes(this.variant)) {
window.__swc.warn(
this,
`<${this.localName}> element expects the "variant" attribute to be one of the following:`,
'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',
{
issues: [...constructor.VARIANTS],
}
);
}
// Check outline property if it exists (S2 only)
if (
'outline' in this &&
const constructor = this.constructor as typeof BadgeBase;
validateEnum(this, {
prop: 'variant',
value: this.variant,
valid: constructor.VARIANTS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs',
});
// Check outline property if it exists (S2 only)
warnIf(
this,
'outline' in this &&
(this as { outline: boolean }).outline === true &&
!constructor.VARIANTS_SEMANTIC.includes(this.variant)
) {
window.__swc.warn(
this,
`<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,
'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',
{
issues: [...constructor.VARIANTS_SEMANTIC],
}
);
}
}
!constructor.VARIANTS_SEMANTIC.includes(this.variant),
`<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,
'https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs',
{ issues: [...constructor.VARIANTS_SEMANTIC] }
);
super.update(changedProperties);
}
}
33 changes: 14 additions & 19 deletions 2nd-gen/packages/core/components/button-group/ButtonGroup.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { property, queryAssignedElements } from 'lit/decorators.js';
import type { ButtonBase } from '@adobe/spectrum-wc-core/components/button';
import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';
import { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';

import { SlotAttributePropagationController } from '../../controllers/slot-attribute-propagation-controller/index.js';
import {
Expand Down Expand Up @@ -122,25 +123,19 @@ export abstract class ButtonGroupBase extends SizedMixin(SpectrumElement, {
}

protected override update(changedProperties: PropertyValues): void {
if (window.__swc?.DEBUG) {
const constructor = this.constructor as typeof ButtonGroupBase;
if (!constructor.ORIENTATIONS.includes(this.orientation)) {
window.__swc.warn(
this,
`<${this.localName}> element expects the "orientation" attribute to be one of the following:`,
'https://opensource.adobe.com/spectrum-web-components/components/button-group/',
{ issues: [...constructor.ORIENTATIONS] }
);
}
if (!constructor.ALIGNMENTS.includes(this.align)) {
window.__swc.warn(
this,
`<${this.localName}> element expects the "align" attribute to be one of the following:`,
'https://opensource.adobe.com/spectrum-web-components/components/button-group/',
{ issues: [...constructor.ALIGNMENTS] }
);
}
}
const constructor = this.constructor as typeof ButtonGroupBase;
validateEnum(this, {
prop: 'orientation',
value: this.orientation,
valid: constructor.ORIENTATIONS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-button-group--docs',
});
validateEnum(this, {
prop: 'align',
value: this.align,
valid: constructor.ALIGNMENTS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-button-group--docs',
});
super.update(changedProperties);
}

Expand Down
18 changes: 8 additions & 10 deletions 2nd-gen/packages/core/components/button/Button.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot
import { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';
import { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';
import { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';
import { warnIf } from '@adobe/spectrum-wc-core/utils/index.js';

import { BUTTON_VALID_SIZES, type ButtonSize } from './Button.types.js';

Expand Down Expand Up @@ -140,15 +141,12 @@ export abstract class ButtonBase extends SizedMixin(SpectrumElement, {

protected override update(changedProperties: PropertyValues): void {
super.update(changedProperties);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm still trying to make sure I follow the docs correctly, but super.update(changedProperties) is called first, then the check. Per the docs the check should run before super.update()?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My understanding is that it depends on when we want to call the warning. This one is on hasIcon, which are slot derived and so they aren't reliable until the slot is rendered, which is why it is after super.update()

if (window.__swc?.DEBUG) {
if (this.hasIcon && !this.hasLabel && !this.accessibleLabel) {
window.__swc.warn(
this,
`<${this.localName}> with an icon and no label must have an "accessible-label" attribute to be accessible.`,
'https://opensource.adobe.com/spectrum-web-components/components/button/#icon-only',
{ issues: ['accessible-label'] }
);
}
}
warnIf(
this,
this.hasIcon && !this.hasLabel && !this.accessibleLabel,
`<${this.localName}> with an icon and no label must have an "accessible-label" attribute to be accessible.`,
'https://spectrum-web-components.adobe.com/?path=/docs/components-button--docs',
{ type: 'accessibility', issues: ['accessible-label'] }
);
}
}
Loading
Loading