Skip to content

refactor(*): bundle styles with components#15125

Draft
simeonoff wants to merge 257 commits into
masterfrom
simeonoff/scoped-styles
Draft

refactor(*): bundle styles with components#15125
simeonoff wants to merge 257 commits into
masterfrom
simeonoff/scoped-styles

Conversation

@simeonoff

@simeonoff simeonoff commented Dec 2, 2024

Copy link
Copy Markdown
Collaborator

Closes #13770, #16794

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

simeonoff and others added 30 commits January 20, 2025 14:29
didimmova and others added 15 commits April 16, 2026 11:16
* feat(chips-area): add separate theme + grid sample and chips-area changes

* chore(): fix spacings
Replace four identical per-component stylesheets with a single shared
grid-base.styles.scss compiled to a TS string export. The base directive
registers it once into document.adoptedStyleSheets on first instantiation,
guarded by platform.isBrowser. All grid variants drop their redundant styleUrl.

Note: SSR renders without grid styles (no <style> tag injection); full SSR
support is a follow-up.
… build

- Clean up scripts/sass.mjs: drop dead code (compileSass,
  buildComponentStyles, buildBaseStyles, _postProcessor), consolidate
  shared sass config, use async mkdir, write external source maps for
  theme presets, throw instead of process.exit on theme failures.
- Move incremental rebuild logic into createStylesBuilder with a
  reverse + forward dep map for O(deps) rebuilds.
- watch-styles: use the builder for incremental rebuilds and accept
  --no-initial via scripts/get-args.mjs to skip the initial full build.
- package.json: pass --no-initial to watch:styles in `npm start` so
  styles aren't built twice on startup.
@adrianptrv

Copy link
Copy Markdown
Contributor

In the Time Picker and Date Picker components, after adding encapsulation: ViewEncapsulation.None, the component inline style styles: [':host { display: block; }'] is no longer being applied. As a result, the components falls back to the default display: inline property.

This also breaks some of the samples. The issue is most noticeable in the "Reactive Forms Overview" sample.

Component
Sample

@adrianptrv

Copy link
Copy Markdown
Contributor

For the Button-group

We have to remove the display: inline-block property from the horizontal samples because it causes issues with the scoped-styles version of the Button Group component.

Samples

@adrianptrv

adrianptrv commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Card component

On the elevated version of the Card, only the box-shadow is applied, while the master version has both the box-shadow and border applied. We should make the scoped-styles version of the Card the same way as the master version by applying both the box-shadow and the border.

Sample

@adrianptrv

adrianptrv commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Calendar component

The ::after elements of the selected dates in the Calendar range selection do not have any border styles defined. They inherit the border styles from the Tailwind default styles, which results in white borders being displayed at both ends of the selected range.

Sample
Tailwind CSS

@adrianptrv

adrianptrv commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Date Range Picker component:

There are grid-template-columns styles intended specifically for the two-input configuration, but currently are also applying to the single-input picker. This breaks the single-input layout.

We should scope these styles to a two-input-specific selector like &:has(igx-date-range-start, igx-date-range-end){}:

Sample
Code

@adrianptrv

adrianptrv commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Simple Combo component

The Combo styling CSS variables are currently declared only for igx-combo and not for igx-simple-combo. As a result, the styles are not applied to igx-simple-combo.

Scoped Sample
Master samples

@adrianptrv

Copy link
Copy Markdown
Contributor

Chat component

The igx-avatar styles are missing in the Chat component, causing the avatar not to be displayed.

Scoped sample
Master sample

@adrianptrv

Copy link
Copy Markdown
Contributor

Dropdown component

However, the component also uses encapsulation: ViewEncapsulation.None, which prevents style from being applied to the igx-drop-down.

The position: absolute style is required for the component to function correctly. Without it, the dropdown items auto width does not always match the width of the trigger element and can sometimes expand to the full page width, as it currently does in the scoped-styles samples. I would suggest that we move this style to the scss files and apply it directly to igx-drop-down.

Scoped sample
Component

@adrianptrv

Copy link
Copy Markdown
Contributor

Grid Cell Merging

All Grid cell bottom borders are missing when there are merged cells. There is a selector that is overriding the intended border styles.

Sample

These files and themes have been superseeded by the scoped styles for
each component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Themes: Scope component styles to component

6 participants