Skip to content

Commit 57d14a4

Browse files
authored
Merge branch 'master' into dmdimitrov/query-builder-improvements
2 parents 7b1add2 + 1d8368f commit 57d14a4

File tree

27 files changed

+187
-99
lines changed

27 files changed

+187
-99
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,32 @@ All notable changes for each version of this project will be documented in this
3232
- A new optional property called `conditionName` has been introduced. This would generally be equal to the existing `condition.name`.
3333
3434
35+
### Themes
36+
- `Palettes`
37+
- All palette colors have been migrated to the [CSS relative colors syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/Relative_colors). This means that color consumed as CSS variables no longer need to be wrapped in an `hsl` function.
38+
39+
Example:
40+
```css
41+
/* 18.1.x and before: */
42+
background: hsl(var(--igx-primary-600));
43+
44+
/* 18.2.0+: */
45+
background: var(--igx-primary-600);
46+
```
47+
48+
This change also opens up the door for declaring the base (500) variants of each color in CSS from any color, including other CSS variables, whereas before the Sass `palette` function was needed to generate color shades from a base color.
49+
50+
Example:
51+
```scss
52+
/* 18.1.x and before: */
53+
$my-palette: palette($primary: #09f, ...);
54+
55+
/* 18.2.0+: */
56+
--ig-primary-500: #09f;
57+
```
58+
59+
This change adds to our continuous effort to make theming configurable in CSS as much as it is in Sass.
60+
3561
#### Scrollbar: New CSS variables
3662
3763
We have introduced new CSS variables to allow for more customizable scrollbars. This enhancement utilizes the available WebKit pseudo-selectors such as `::-webkit-scrollbar-track`. However, please note that these pseudo-selectors are prefixed with `-webkit-` and are only supported in WebKit-based browsers (e.g., Chrome, Safari).

projects/igniteui-angular/migrations/update-18_2_0/index.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,38 @@ describe(`Update to ${version}`, () => {
8888
);
8989
});
9090

91+
it('should remove hsla and hsl functions', async () => {
92+
appTree.create(
93+
`/testSrc/appPrefix/component/test.component.scss`,
94+
`.custom-body {
95+
color: hsla(var(--ig-primary-A100));
96+
background: hsla(var(--ig-gray-100));
97+
}
98+
99+
.custom-header {
100+
color: hsl(var(--ig-secondary-100));
101+
background: hsl(var(--ig-gray-900));
102+
}`
103+
);
104+
105+
const tree = await schematicRunner
106+
.runSchematic(migrationName, {}, appTree);
107+
108+
expect(
109+
tree.readContent('/testSrc/appPrefix/component/test.component.scss')
110+
).toEqual(
111+
`.custom-body {
112+
color: var(--ig-primary-A100);
113+
background: var(--ig-gray-100);
114+
}
115+
116+
.custom-header {
117+
color: var(--ig-secondary-100);
118+
background: var(--ig-gray-900);
119+
}`
120+
);
121+
});
122+
91123
it('should remove the $border-width property from the badge-theme', async () => {
92124
appTree.create(
93125
`/testSrc/appPrefix/component/test.component.scss`,

projects/igniteui-angular/migrations/update-18_2_0/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,48 @@ const version = '18.2.0';
99

1010
export default (): Rule => async (host: Tree, context: SchematicContext) => {
1111
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
12+
1213
const update = new UpdateChanges(__dirname, host, context);
1314

1415
update.addValueTransform('fields_to_entities', (args: BoundPropertyObject): void => {
1516
args.bindingType = InputPropertyType.EVAL;
1617
args.value = `[{ name: '', fields: ${args.value}}]`;
1718
});
1819

20+
const IG_COLORS = [
21+
'primary-',
22+
'primary-A',
23+
'secondary-',
24+
'secondary-A',
25+
'gray-',
26+
'surface-',
27+
'surface-A',
28+
'info-',
29+
'info-A',
30+
'success-',
31+
'success-A',
32+
'warn-',
33+
'warn-A',
34+
'error-',
35+
'error-A'
36+
];
37+
38+
const hslaColor = 'hsla?\\(var\\(--ig-attr(\\d)00\\)\\)';
39+
40+
for (const entryPath of update.sassFiles) {
41+
let content = host.read(entryPath).toString();
42+
IG_COLORS.forEach(color => {
43+
let prop = hslaColor.replace('attr', color);
44+
const regex = new RegExp(prop, 'g');
45+
if (regex.test(content)) {
46+
let newColor = prop.replace(/hsla\?\\\(var\\\(--ig-/g, 'var\(--ig-');
47+
newColor = newColor.replace('(\\d)', '$1');
48+
newColor = newColor.replace('\\)\\)', ')');
49+
content = content.replace(regex, newColor);
50+
host.overwrite(entryPath, content);
51+
}
52+
});
53+
}
54+
1955
update.applyChanges();
2056
};

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"igniteui-trial-watermark": "^3.0.2",
7575
"lodash-es": "^4.17.21",
7676
"uuid": "^9.0.0",
77-
"igniteui-theming": "^14.2.0-beta.2",
77+
"igniteui-theming": "^14.2.0-beta.3",
7878
"@igniteui/material-icons-extended": "^3.0.0"
7979
},
8080
"peerDependencies": {

projects/igniteui-angular/src/lib/services/overlay/overlay.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,7 +3239,7 @@ describe('igxOverlay', () => {
32393239
expect(wrapperElement).toBeDefined();
32403240
const styles = css(wrapperElement);
32413241
expect(styles.findIndex(
3242-
(e) => e.includes('--background-color: var(--igx-overlay-background-color, hsla(var(--ig-gray-500), 0.54));')))
3242+
(e) => e.includes('--background-color: var(--igx-overlay-background-color, hsl(from var(--ig-gray-500) h s l/0.54));')))
32433243
.toBeGreaterThan(-1);
32443244
expect(styles.findIndex(
32453245
(e) => e.includes('background: var(--background-color);')))
@@ -3265,7 +3265,7 @@ describe('igxOverlay', () => {
32653265
.parentElement.getElementsByClassName(CLASS_OVERLAY_WRAPPER_MODAL)[0] as HTMLElement;
32663266
expect(wrapperElement).toBeDefined();
32673267
const styles = css(wrapperElement);
3268-
expect(styles.findIndex((e) => e.includes('--background-color: var(--igx-overlay-background-color, hsla(var(--ig-gray-500), 0.54));'))).toBeGreaterThan(-1);
3268+
expect(styles.findIndex((e) => e.includes('--background-color: var(--igx-overlay-background-color, hsl(from var(--ig-gray-500) h s l/0.54));'))).toBeGreaterThan(-1);
32693269
expect(styles.findIndex((e) => e.includes('background: var(--background-color);'))).toBeGreaterThan(-1);
32703270

32713271
fixture.componentInstance.overlay.detachAll();

src/app/action-strip/action-strip.sample.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
width: 400px;
2020
height: 200px;
2121
position: relative;
22-
background-color: hsl(var(--ig-gray-200));
22+
background-color: var(--ig-gray-200);
2323
}
2424

2525
.my-action-strip {

src/app/autocomplete/autocomplete.sample.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
max-width: 400px;
77
margin: 0 auto;
88
padding: 16px;
9-
background: hsl(var(--ig-gray-50));
9+
background: var(--ig-gray-50);
1010
border-radius: 4px;
1111
}
1212

src/app/chips/chips.sample.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $padding: 32px;
1717
display: flex;
1818
align-items: center;
1919
justify-content: space-between;
20-
border: 1px solid hsla(var(--ig-gray-300));
20+
border: 1px solid var(--ig-gray-300);
2121
gap: $padding;
2222
margin: 0 auto;
2323

@@ -35,8 +35,8 @@ $padding: 32px;
3535
display: flex;
3636
flex-direction: column;
3737
gap: 8px;
38-
background: hsla(var(--ig-gray-50));
39-
border-left: 1px solid hsla(var(--ig-gray-300));
38+
background: var(--ig-gray-50);
39+
border-left: 1px solid var(--ig-gray-300);
4040
padding: $padding;
4141
}
4242

@@ -58,12 +58,12 @@ $padding: 32px;
5858
justify-content: center;
5959
gap: 4px;
6060
text-decoration: none;
61-
color: hsla(var(--ig-secondary-600));
61+
color: var(--ig-secondary-600);
6262
outline: none;
6363

6464
&:focus,
6565
&:hover {
66-
color: hsla(var(--ig-secondary-300));
66+
color: var(--ig-secondary-300);
6767
}
6868
}
6969
}

src/app/combo/combo.sample.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
&__section {
2424
flex-direction: column;
2525
padding: 16px;
26-
border: 1px dashed hsla(var(--ig-gray-300));
26+
border: 1px dashed var(--ig-gray-300);
2727
}
2828

2929
&__form {
@@ -51,6 +51,6 @@
5151
.custom-combo-header {
5252
text-align: center;
5353
padding: 8px 16px;
54-
background: hsla(var(--ig-gray-100));
54+
background: var(--ig-gray-100);
5555
}
5656

src/app/divider/divider.component.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $padding: 32px;
2828
.preview {
2929
display: flex;
3030
justify-content: space-between;
31-
border: 1px solid hsla(var(--ig-gray-300));
31+
border: 1px solid var(--ig-gray-300);
3232
gap: $padding;
3333
margin: 0 auto;
3434
}
@@ -58,8 +58,8 @@ $padding: 32px;
5858
display: flex;
5959
flex-direction: column;
6060
gap: 16px;
61-
background: hsla(var(--ig-gray-50));
62-
border-left: 1px solid hsla(var(--ig-gray-300));
61+
background: var(--ig-gray-50);
62+
border-left: 1px solid var(--ig-gray-300);
6363
padding: $padding;
6464
min-width: 320px;
6565
}
@@ -71,15 +71,15 @@ $padding: 32px;
7171
text-decoration: none;
7272
outline: none;
7373
margin-top: 1rem;
74-
color: hsla(var(--ig-primary-600));
74+
color: var(--ig-primary-600);
7575

7676
&:focus,
7777
&:hover {
78-
color: hsla(var(--ig-primary-300));
78+
color: var(--ig-primary-300);
7979
}
8080
}
8181

8282
.preview__warning {
83-
color: hsla(var(--ig-warn-600));
83+
color: var(--ig-warn-600);
8484
}
8585

0 commit comments

Comments
 (0)