Skip to content

refactor: update to version 30.0.0 of Ignite UI Theming - #17766

Open
simeonoff wants to merge 8 commits into
masterfrom
simeonoff/theming/version-30.0.0
Open

simeonoff wants to merge 8 commits into
masterfrom
simeonoff/theming/version-30.0.0

Conversation

@simeonoff

Copy link
Copy Markdown
Member

Description

Prepares Ignite UI for Angular 23.0.0 for Ignite UI Theming 30.0.0, and rebuilds the Sass ng update migrations on a shared, scanner-based engine.

Ignite UI Theming 30.0.0

  • The deprecated theme wrappers (light-theme, dark-theme and the Indigo, Fluent and Bootstrap variants) build their palettes with the legacy generator, so their colors don't change.
  • The grid toolbar and the dark Bootstrap checkbox read the base surface role instead of --ig-surface-500.
  • The predefined palettes and the pre-built themes compile to the same CSS as with Ignite UI Theming 29.0.0, apart from var(--ig-surface-500) becoming var(--ig-surface-base).

23.0.0 migration

  • Adds $generator: 'legacy' to existing palette() function calls, so they keep their colors under the new fitted default.
  • Leaves the palette mixin, members with similar names, and stylesheets that declare their own palette function alone.
  • Reports calls that spread their arguments for manual review.
  • Implemented as a theme-changes.json entry on top of the new engine.

Sass migration engine (migrations/common/sass/)

  • Scanning, and the rename, remove and add operations for members, arguments, variables and @use/@forward rules, move out of UpdateChanges into a shared module. All Sass changes now run in one pass per stylesheet.
  • Property changes gain four options: add, exactOwner, ownerType and parameterIndex.
  • Changes a migration can't make safely are logged at the end of ng update as path:line - what to do.
  • Fixes existing bugs in the older code paths:
  • Removing a mixin include could delete unrelated code, or corrupt a file when an argument string contained ).
  • Renames also rewrote longer names (my-toast became my-tokens), stylesheets' own declarations, and comments.
  • Renaming a variable threw when the variable was the file's first character, which aborted the migration.
  • @use changes missed with (...), repeated rules, @forward and .sass syntax.

Demos

  • The color sample shows the surface roles, plus the numbered surface shades for legacy palettes, based on the generator that built the palette. Translucent colors show as 8-digit hex.

Motivation / Context

Ignite UI Theming 30.0.0 switches palette() to a new fitted generator by default and addresses the surface by role (base, sunken, raised, overlay, container) instead of by shade number. Its release is aligned with Ignite UI for Angular 23.0.0, so existing apps need a migration that keeps their palettes unchanged.

Writing that migration showed that the older Sass migration paths relied on substring and regex matching, which could edit the wrong code or none at all. The shared engine fixes them, and makes adding an argument a reusable, config-driven operation.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

Theming (core theme generators), Grid (toolbar theme), Checkbox (dark Bootstrap theme), ng update migrations (shared Sass engine, 23.0.0 migration), dev demos (color sample)

How Has This Been Tested?

  • Unit tests

  • Manual testing

  • Automated e2e tests

  • Unit tests: npm run test:schematics passes, 603 specs. That covers all existing migration specs unchanged, plus new ones:

    • an edge-case table run against every Sass operation: comments, strings, url(), Windows line endings, unbalanced brackets
    • focused cases per operation
    • end-to-end specs for the new config options and the manual-review log, including line numbers after earlier edits
    • 16 specs for the 23.0.0 migration
  • Compiled themes: the 13 prebuilt themes compile against Ignite UI Theming 30.0.0. Diffing their CSS against Ignite UI Theming 29.0.0 shows only the surface change described above.

  • Manual: ran the old and new migration code against crafted stylesheets to confirm each fixed bug. Checked the color sample's generator detection in Chrome.

Test Configuration:

  • Angular version: 22.2
  • Browser(s): Chrome (color sample only; the migrations run in Node.js 24)
  • OS: macOS 27

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
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Depends on Ignite UI Theming 30.0.0. The deprecated theme wrappers now pass $generator, which Ignite UI Theming 29.0.0 rejects. The igniteui-theming dependency goes to ^30.0.0 once it's published.

…scanner

Move Sass scanning and the style change operations into common/sass, and
run every Sass change in one pass per stylesheet.

Fixes:
- Removing a mixin include no longer deletes unrelated code, breaks on
brackets in strings, or removes mixins with longer names.
- Renaming a function or mixin matches the exact name only and leaves
declarations, comments and strings alone.
- Renaming a variable no longer throws at the start of a file, and
covers interpolations.
- @use changes handle `with`, repeated rules, @forward and .sass syntax.

Adds `add`, `exactOwner`, `ownerType` and `parameterIndex` to property
changes, and logs what a migration cannot change as path:line entries.
…3.0.0

Ignite UI Theming 30.0.0 generates palettes with the fitted generator by
default. Add $generator: 'legacy' to existing palette() calls so they
keep their colors, and report calls that spread their arguments.
List the surface roles, plus the numbered shades for legacy palettes,
based on the generator that built the palette. Show translucent colors
as 8-digit hex.
- The deprecated theme wrappers build palettes with the legacy
generator.
- The grid toolbar and the dark Bootstrap checkbox read the base surface
role instead of surface 500.

BREAKING CHANGE: palette() uses the fitted generator by default, and
component themes read --ig-surface-base instead of --ig-surface-500.
@simeonoff
simeonoff requested review from ChronosSF and a balanced review from Copilot October 12, 2026 12:08
Comment thread projects/igniteui-angular/migrations/common/sass/changes.ts Fixed

Copilot AI left a comment

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.

🟡 Changes recommended

The migration engine can corrupt variable removals and interpolated arguments, misses nested palette calls, and remains tested against a beta dependency.

5 open findings
What changed in this PR

Prepares Ignite UI for Angular 23.0.0 for Theming 30.0.0 and adds a scanner-based Sass migration engine.

Changes:

  • Adds the legacy palette-generator migration.
  • Updates surface roles, theme wrappers, and color demos.
  • Centralizes Sass migration operations and diagnostics.
File Description
src/​app/​styleguide/​colors/​color.sample.ts Adds generator detection and surface roles.
src/​app/​styleguide/​colors/​color.sample.scss Styles the generator label.
src/​app/​styleguide/​colors/​color.sample.html Displays generator and role-based surface title.
projects/​igniteui-angular/​package.json Targets Theming 30.0.0.
projects/​igniteui-angular/​migrations/​update-23_0_0_palette-generator/​index.ts Adds the migration entry point.
projects/​igniteui-angular/​migrations/​update-23_0_0_palette-generator/​index.spec.ts Tests palette migration scenarios.
projects/​igniteui-angular/​migrations/​update-23_0_0_palette-generator/​changes/​theme-changes.json Configures the generator argument addition.
projects/​igniteui-angular/​migrations/​migration-collection.json Registers migration 63.
projects/​igniteui-angular/​migrations/​common/​UpdateChanges.ts Integrates the shared Sass engine.
projects/​igniteui-angular/​migrations/​common/​UpdateChanges.spec.ts Tests integration and diagnostics.
projects/​igniteui-angular/​migrations/​common/​schema/​theme-changes.schema.json Defines new migration options.
projects/​igniteui-angular/​migrations/​common/​schema/​index.ts Types the new options.
projects/​igniteui-angular/​migrations/​common/​sass/​stylesheet.ts Adds stylesheet parsing and discovery.
projects/​igniteui-angular/​migrations/​common/​sass/​scanner.ts Adds low-level Sass scanning.
projects/​igniteui-angular/​migrations/​common/​sass/​changes.ts Implements shared Sass edits.
projects/​igniteui-angular/​migrations/​common/​sass/​changes.spec.ts Tests Sass operations and edge cases.
projects/​igniteui-angular/​grids/​themes/​_base.scss Uses the base surface role.
projects/​igniteui-angular/​core/​src/​core/​styles/​themes/​generators/​_indigo.scss Pins Indigo wrappers to legacy generation.
projects/​igniteui-angular/​core/​src/​core/​styles/​themes/​generators/​_fluent.scss Pins Fluent wrappers to legacy generation.
projects/​igniteui-angular/​core/​src/​core/​styles/​themes/​generators/​_bootstrap.scss Pins Bootstrap wrappers to legacy generation.
projects/​igniteui-angular/​core/​src/​core/​styles/​themes/​generators/​_base.scss Pins deprecated base wrappers.
projects/​igniteui-angular/​checkbox/​src/​checkbox/​themes/​dark/​_bootstrap.scss Uses the base surface role.
package.json Adds the beta Theming dependency.
package-lock.json Locks Theming 30.0.0-beta.1.
CHANGELOG.md Documents the 23.0.0 theme changes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread package.json
Comment thread projects/igniteui-angular/migrations/common/UpdateChanges.ts Outdated
Comment thread projects/igniteui-angular/migrations/common/sass/changes.ts Outdated
Comment thread projects/igniteui-angular/migrations/common/sass/scanner.ts
Comment thread CHANGELOG.md Outdated

Copilot AI left a comment

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.

Comment thread projects/igniteui-angular/migrations/common/sass/changes.ts Outdated
Comment thread projects/igniteui-angular/migrations/common/sass/stylesheet.ts
… removing variables

- Recognize a declaration at the start of a line in the indented syntax.
- Skip the braces of an interpolation when finding where a statement
  ends, so they are not taken for a content block.

Copilot AI left a comment

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.

🟡 Changes recommended

The new Sass engine has unresolved regressions involving legacy variable names, multiline comments, and wildcard module imports.

1 open finding
2 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Avoid inserting generator inside trailing multiline comments

projects/​igniteui-angular/​migrations/​common/​sass/​changes.ts:309

The insertion anchor is the first newline after the last argument, even when that newline is inside a trailing block comment. For palette(\n $surface: white /* explanation\n continues */\n), this inserts $generator between the comment delimiters, so the migration reports success but the call remains unpinned. Locate the end of trailing comments before choosing the new-line anchor, and cover a multiline block comment.

Medium severity Normalize Sass variable tokens in legacy migration renames

projects/​igniteui-angular/​migrations/​common/​sass/​changes.ts:353

Legacy migration 13.1.0 stores its variable changes without a leading $ (for example, igx-background-color → background-color in update-13_1_0/changes/theme-changes.json:850-867). This comparison therefore never matches the $igx-background-color token, and even a match would emit a replacement without $, so migration-23 no longer performs those four renames. Normalize both configured names to Sass variable tokens and add a regression case for the legacy config.

🧠 Review effort: Balanced

Comment thread projects/igniteui-angular/migrations/common/sass/changes.ts

Copilot AI left a comment

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.

🟡 Changes recommended

Legacy variable migrations regress, and the root build still targets the beta theming dependency.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment on lines +432 to +438
...theme.filter(change => change.type === ThemeType.Variable && !('owner' in change)).map(change => ({
mention: change.name.substring(1),
// a variable without a replacement is gone from the library
apply: (sheet: SassStylesheet) => change.remove || !change.replaceWith
? removeVariable(sheet, change.name)
: renameVariable(sheet, change.name, change.replaceWith)
})),

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants