chore(2nd-gen): review and apply code standards across all components#6091
chore(2nd-gen): review and apply code standards across all components#6091caseyisonit merged 3 commits intomainfrom
Conversation
Audit and standardize patterns across all 2nd-gen base classes and SWC components, using Badge as the canonical reference implementation. - Add section headers to DividerBase and AlertBannerBase - Fix Asset CSS class prefix from spectrum- to swc- - Standardize Divider styles declaration to use getter - Add JSDoc tags (@slot, @Attribute, @fires) to base classes - Remove incorrect @element from DividerBase - Standardize as const satisfies in all types files - Pass STATUSLIGHT_VALID_SIZES explicitly to SizedMixin - Extract AlertBanner.types.ts from inline module constants - Fix @param JSDoc to standard property docs in AlertBanner - Fix typo ("exisit" -> "exist") in observe-slot-text.ts - Update copyright years from 2025 to 2026 - Fix extra space in StatusLight JSDoc @example tag Made-with: Cursor
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
…ions Replace nested ternary with Lit's choose directive for variant-based rendering, aligning with conventions established in PR #6067. Made-with: Cursor
Summary
Audited and standardized code patterns across all 2nd-gen base classes and SWC components, using Badge as the canonical reference implementation. This brings consistency to section headers, JSDoc tags, type patterns, CSS class naming, and other conventions.
Changes by category
Structural consistency
API TO OVERRIDE/SHARED API/IMPLEMENTATIONsection headers toDividerBaseandAlertBannerBasestylesdeclaration from static property to getter (matching Badge, StatusLight, ProgressCircle, Asset)CSS class naming
spectrum-*toswc-*prefix (matching all other 2nd-gen components)JSDoc standardization
@slot,@attribute, and@firestags toDividerBaseandAlertBannerBase@elementtag fromDividerBase(belongs only on SWC subclass)@paramJSDoc tags with standard property docs inAlertBannerBase@examplein StatusLightType patterns
: ElementSize[]type annotations fromSTATUSLIGHT_VALID_SIZESandPROGRESS_CIRCLE_VALID_SIZES(keepas const satisfiesonly)as const satisfies readonly string[]toDIVIDER_STATIC_COLORSandASSET_VARIANTSAlertBanner.types.tsfrom inline module-level constants, with deprecatedAlertBannerVariantsalias for 1st-gen compatibilityMixin usage
STATUSLIGHT_VALID_SIZESexplicitly toSizedMixininStatusLightBase(matching Badge and Divider patterns)Cleanup
observe-slot-text.tspostcss-token/index.d.tsandscreen-reader-addon/register.tsxFiles changed (16)
core/components/alert-banner/AlertBanner.base.tscore/components/alert-banner/AlertBanner.types.tscore/components/alert-banner/index.tscore/components/asset/Asset.types.tsas const satisfiescore/components/divider/Divider.base.ts@elementcore/components/divider/Divider.types.tsas const satisfiescore/components/progress-circle/ProgressCircle.types.tscore/components/status-light/StatusLight.base.tsvalidSizesin SizedMixin,@attributetagcore/components/status-light/StatusLight.types.tscore/mixins/observe-slot-text.tsswc/components/asset/Asset.tsspectrum-*→swc-*class prefixswc/components/asset/asset.cssspectrum-*→swc-*selectorsswc/components/divider/Divider.tsstylesproperty → getterswc/components/status-light/StatusLight.ts@examplespacingtools/postcss-token/index.d.ts.storybook/addons/screen-reader-addon/src/register.tsxTest plan
yarn build:2nd-gen)yarn build:1st-gen) — backward-compatible AlertBanner type alias verified