Skip to content

Commit

Permalink
fix(cdk): missing migration schematic for createStackingContext mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov committed Nov 20, 2024
1 parent e9b43ca commit bb0c684
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions projects/cdk/schematics/ng-update/v4/steps/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {getActiveProject, saveActiveProject} from 'ng-morph';

import {migrateLessSCSSConstants} from './migrate-less-scss-constants';
import {migrateScrollbarBehavior} from './migrate-scrollbar-behavior';
import {migrateMixins} from './migrate-mixins';
import {migrateShadowMixins} from './migrate-shadow-mixins';
import {migrateSpaceMixins} from './migrate-space-mixins';
import {migrateTextMixins} from './migrate-text-mixins';
Expand Down Expand Up @@ -48,7 +48,7 @@ export function migrateStyles(): void {
migrateTextMixins,
migrateShadowMixins,
migrateLessSCSSConstants,
migrateScrollbarBehavior,
migrateMixins,
].reduce((text, migrate) => migrate(text), fullText);

sourceFile.replaceWithText(newFileContent);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const MAPPING = {
createStackingContext: ['isolation: isolate'],
'scroll-behavior': ['scroll-behavior: var(--tui-scroll-behavior)'],
};

export function migrateMixins(fileContent: string): string {
if (!fileContent.includes('@taiga-ui/core/styles/taiga-ui-local')) {
return fileContent;
}

return Object.keys(MAPPING).reduce((file, outdatedMixin) => {
const MIXIN_RE = new RegExp(
String.raw`(?:@include\s|\.)(${outdatedMixin})\(\)(\s?!important)?;`,
'g',
);

return file.replaceAll(
MIXIN_RE,
(_, mixinName: keyof typeof MAPPING, important = '') =>
`${MAPPING[mixinName].map((newValue) => `${newValue}${important};`).join('\n')}`,
);
}, fileContent);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ const STYLES_BEFORE = `
.tui-space(horizontal, -4);
.text-body-m-bold(1);
.shadow(3);
.createStackingContext() !important;
}
.hack {
.tui-space(top, 0) !important;
.tui-space(horizontal, -4) !important;
.createStackingContext();
}
.t-scrollbar {
Expand Down Expand Up @@ -85,12 +87,14 @@ margin-bottom: 1rem;
margin-right: -1rem;
.text-body-m-bold(1); // TODO: this mixin was deleted. Replace it with inline styles. Find it source code in https://github.com/taiga-family/taiga-ui/blob/v3.x/projects/core/styles/mixins/text.less
box-shadow: var(--tui-shadow-popup);
isolation: isolate !important;
}
.hack {
margin-top: 0rem !important;
margin-left: -1rem !important;
margin-right: -1rem !important;
isolation: isolate;
}
.t-scrollbar {
Expand Down

0 comments on commit bb0c684

Please sign in to comment.