Skip to content

Commit cddb9a8

Browse files
committed
refactor(*): depend on element selector being present in theming package
1 parent 6d44995 commit cddb9a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+58
-294
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@types/source-map": "0.5.2",
7676
"express": "^5.1.0",
7777
"fflate": "^0.8.1",
78-
"igniteui-theming": "^21.0.0-beta.2",
78+
"igniteui-theming": "^21.0.0-beta.3",
7979
"igniteui-trial-watermark": "^3.1.0",
8080
"lodash-es": "^4.17.21",
8181
"rxjs": "^7.8.2",

projects/igniteui-angular-elements/src/themes/_util.scss

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ $elements-selector-prefix: 'igc';
2929
$prefix: 'ig';
3030
$result: $theme_schema;
3131

32-
@if map.has-key($theme_schema, 'name') {
33-
$name: map.get($theme_schema, 'name');
34-
$element-prefix: map.get($theme_schema, '_meta', 'element-prefix');
32+
@if map.has-key($theme_schema, "name") {
33+
$name: map.get($theme_schema, "name");
34+
$selector: map.get($theme_schema, "selector") or $name;
3535
$modified: ();
3636

3737
// @debug "name: #{$name}";
@@ -40,54 +40,29 @@ $elements-selector-prefix: 'igc';
4040
$name: list.nth(string.split($name, 'igx-'), -1);
4141
$name: '#{$elements-var-prefix}-#{$name}';
4242
// @debug "name after: #{$name}";
43-
$modified: map.merge(
44-
$modified,
45-
(
46-
name: $name,
47-
)
48-
);
43+
$modified: map.merge($modified, (name: $name));
4944
}
5045

5146
// For exposed components also modify selector with updated element prefix:
52-
@if list.index(vars.$allowed, map.get($theme_schema, 'name')) {
53-
// @debug "selector before: #{$element-prefix}";
54-
$element-prefix: $elements-selector-prefix;
55-
// @debug "selector after: #{$element-prefix}";
47+
@if list.index(vars.$allowed, map.get($theme_schema, "name")) {
48+
// @debug "selector before: #{$selector}";
49+
$selector: updateSelectors($selector);
50+
// @debug "selector after: #{$selector}";
5651
}
5752

58-
$modified: map.merge(
59-
$modified,
60-
(
61-
_meta: map.merge(
62-
map.get($theme_schema, '_meta'),
63-
(
64-
'element-prefix': $element-prefix,
65-
)
66-
),
67-
)
68-
);
53+
$modified: map.merge($modified, (selector: $selector));
6954

7055
@if map.has-key($theme_schema, 'themes') {
7156
$themes: map.get($theme_schema, 'themes');
7257
$newThemes: ();
7358
@each $name, $sub_schema in $themes {
74-
$newThemes: map.set(
75-
$newThemes,
76-
$name,
77-
updateElementName($sub_schema)
78-
);
59+
$newThemes: map.set($newThemes, $name, updateElementName($sub_schema));
7960
}
80-
$modified: map.merge(
81-
$modified,
82-
(
83-
themes: $newThemes,
84-
)
85-
);
61+
$modified: map.merge($modified, (themes: $newThemes));
8662
}
8763

8864
$result: map.merge($result, $modified);
8965
}
90-
9166
@return $result;
9267
}
9368

@@ -97,7 +72,6 @@ $elements-selector-prefix: 'igc';
9772
/// @return {String} - Updated selector(s) with `igc-` prefixed equivalents
9873
@function updateSelectors($selector) {
9974
$result: ();
100-
// $selectors: string.split($selector, ", ");
10175

10276
@each $sel in $selector {
10377
$result: list.append($result, $sel, comma);
@@ -109,7 +83,7 @@ $elements-selector-prefix: 'igc';
10983
}
11084
}
11185

112-
@return '#{$result}';
86+
@return "#{$result}";
11387
}
11488

11589
/// Generates an Ignite UI for Angular Elements global theme.
@@ -134,6 +108,6 @@ $elements-selector-prefix: 'igc';
134108
$palette: $palette,
135109
$exclude: $exclude,
136110
$schema: $schema,
137-
$theme-handler: meta.get-function('updateElementName')
111+
$theme-handler: meta.get-function("updateElementName")
138112
);
139113
}

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"tslib": "^2.3.0",
7474
"igniteui-trial-watermark": "^3.1.0",
7575
"lodash-es": "^4.17.21",
76-
"igniteui-theming": "^21.0.0-beta.2",
76+
"igniteui-theming": "^21.0.0-beta.3",
7777
"@igniteui/material-icons-extended": "^3.1.0"
7878
},
7979
"peerDependencies": {

projects/igniteui-angular/src/lib/core/styles/base/_functions.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,3 @@
6363
}
6464
@return $items;
6565
}
66-
67-
/// Prefixes a CSS selector with the given string.
68-
/// @access private
69-
/// @param {String} $prefix - The prefix to add.
70-
/// @param {String} $selector - The selector to be prefixed.
71-
/// @return {String} - The prefixed selector.
72-
@function prefix-selector($prefix, $selector) {
73-
@return string.insert($selector, #{$prefix}-, 1);
74-
}

projects/igniteui-angular/src/lib/core/styles/components/avatar/_avatar-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
/// @see {mixin} css-vars
77
/// @param {Map} $theme - The theme used to style the component.
88
@mixin avatar($theme) {
9-
$prefix: map.get($theme, '_meta', 'element-prefix');
10-
$selectors: (
11-
prefix-selector($prefix, 'avatar'),
12-
);
13-
14-
@include css-vars($theme, $selectors);
9+
@include css-vars($theme);
1510

1611
$variant: map.get($theme, '_meta', 'theme');
1712

projects/igniteui-angular/src/lib/core/styles/components/badge/_badge-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
/// @see {mixin} css-vars
66
/// @param {Map} $theme - The theme used to style the component.
77
@mixin badge($theme) {
8-
$prefix: map.get($theme, '_meta', 'element-prefix');
9-
$selectors: (
10-
prefix-selector($prefix, 'badge'),
11-
);
12-
13-
@include css-vars($theme, $selectors);
8+
@include css-vars($theme);
149

1510
$variant: map.get($theme, '_meta', 'theme');
1611

projects/igniteui-angular/src/lib/core/styles/components/banner/_banner-theme.scss

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@
55
/// @see {mixin} css-vars
66
/// @param {Map} $theme - The theme used to style the component.
77
@mixin banner($theme) {
8-
$prefix: map.get($theme, '_meta', 'element-prefix');
9-
$selectors: (
10-
prefix-selector($prefix, 'banner'),
11-
#{'.' + prefix-selector($prefix, 'banner')},
12-
);
13-
14-
15-
@include css-vars($theme, $selectors);
8+
@include css-vars($theme);
169
$variant: map.get($theme, '_meta', 'theme');
1710

1811
%igx-banner-host {

projects/igniteui-angular/src/lib/core/styles/components/bottom-nav/_bottom-nav-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
/// @see {mixin} css-vars
77
/// @param {Map} $theme - The theme used to style the component.
88
@mixin bottom-nav($theme) {
9-
$prefix: map.get($theme, '_meta', 'element-prefix');
10-
$selectors: (
11-
prefix-selector($prefix, 'bottom-nav'),
12-
);
13-
14-
@include css-vars($theme, $selectors);
9+
@include css-vars($theme);
1510

1611
$variant: map.get($theme, '_meta', 'theme');
1712
$menu-height: rem(56px);

projects/igniteui-angular/src/lib/core/styles/components/button-group/_button-group-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
/// @see {mixin} css-vars
77
/// @param {Map} $theme - The theme used to style the component.
88
@mixin button-group($theme) {
9-
$prefix: map.get($theme, '_meta', 'element-prefix');
10-
$selectors: (
11-
prefix-selector($prefix, 'buttongroup'),
12-
);
13-
14-
@include css-vars($theme, $selectors);
9+
@include css-vars($theme);
1510

1611
$group-item-border-thickness: rem(1px);
1712
$group-items-margin: rem(10px, 16px);

0 commit comments

Comments
 (0)