Skip to content

perf: slim down SolidElement base class to reduce bundle size#2953

Open
AaronWeber90 wants to merge 2 commits intosolid-design-system:mainfrom
AaronWeber90:perf/slim-down-solid-element
Open

perf: slim down SolidElement base class to reduce bundle size#2953
AaronWeber90 wants to merge 2 commits intosolid-design-system:mainfrom
AaronWeber90:perf/slim-down-solid-element

Conversation

@AaronWeber90
Copy link
Copy Markdown

@AaronWeber90 AaronWeber90 commented Apr 27, 2026

Title: [skip chromatic] perf: slim down SolidElement base class to reduce bundle size

Description:

  • Removed rarely-used features from the SolidElement base class (inherited by all 59 components) and moved them to opt-in modules, significantly reducing the bundle size for consumers who import individual components.

What changed:

  • Removed dir and lang reactive properties (unused by any component; native HTML attributes still work)
  • Removed token() method and animate.ts import — moved to standalone token() utility in src/internal/token.ts (used by 3 components: tag, video, audio)
  • Removed onThemeChange lifecycle hook — moved to self-managed listeners in the 2 consuming components (icon, audio)
  • Removed CSS @import for interactive.css, headline.css, paragraph.css — moved to importable modules in src/internal/shared-styles.ts (only added by the ~14 components that actually use them)
  • Updated Storybook Vite config to process the new shared-styles.ts file with Tailwind

What remains in SolidElement:

  • Tailwind --tw-* CSS variable resets (needed by all components)
  • box-sizing reset and [hidden] rule
  • emit() method (used by 20+ components)

Definition of Reviewable:

  • Documentation is created/updated (no public API change — internal refactor only)
  • Migration Guide is created/updated (no breaking change — dir/lang were unused, other features moved to opt-in imports)
  • E2E tests (features, a11y, bug fixes) are created/updated
  • Stories (features, a11y) are created/updated (no new features or visual changes)
  • relevant tickets are linked

Closes #2971

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

🦋 Changeset detected

Latest commit: 7a18277

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@solid-design-system/components Minor
@solid-design-system/styles Minor
@solid-design-system/tokens Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@smfonseca smfonseca requested review from mariohamann and removed request for mariohamann April 28, 2026 11:33
@smfonseca smfonseca moved this from 📋 Backlog to 👀 In review in Solid Design System Project Board Apr 28, 2026
@AaronWeber90 AaronWeber90 marked this pull request as ready for review April 29, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

perf: ⚡ Slim down SolidElement base class to reduce bundle size

7 participants