@siemens/element-theme 49.15.0 → 49.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/styles/_accessibility.scss +4 -2
- package/src/styles/_reboot-shadow-dom.scss +5 -0
- package/src/styles/_root-font-size.scss +4 -2
- package/src/styles/_selectors.scss +3 -0
- package/src/styles/_themes.scss +15 -3
- package/src/styles/bootstrap/_reboot.scss +3 -2
- package/src/styles/bootstrap/_root.scss +2 -1
- package/src/styles/components/_drag_drop.scss +2 -1
- package/src/styles/components/_scrollbar.scss +2 -1
- package/src/theme-shadow-dom.scss +17 -0
- package/src/theme.scss +11 -3
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
@use 'selectors';
|
|
2
|
+
|
|
1
3
|
$element-root-font-size: initial !default;
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
#{selectors.$document} {
|
|
4
6
|
// defines the default with low specificity, i.e. easy overridable with :root
|
|
5
7
|
--element-root-font-size: #{$element-root-font-size};
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
#{selectors.$root} {
|
|
9
11
|
font-size: var(--element-root-font-size);
|
|
10
12
|
}
|
|
11
13
|
|
package/src/styles/_themes.scss
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
$_theme-default: 'element';
|
|
4
4
|
$_themes: () !default;
|
|
5
|
+
$_root-selector: ':root';
|
|
5
6
|
|
|
6
|
-
@mixin configure($defaultTheme: null, $themes: ()) {
|
|
7
|
+
@mixin configure($defaultTheme: null, $themes: (), $rootSelector: null) {
|
|
7
8
|
@if $defaultTheme {
|
|
8
9
|
$_theme-default: $defaultTheme !global;
|
|
9
10
|
}
|
|
@@ -11,11 +12,17 @@ $_themes: () !default;
|
|
|
11
12
|
@if $themes {
|
|
12
13
|
$_themes: $themes !global;
|
|
13
14
|
}
|
|
15
|
+
|
|
16
|
+
@if $rootSelector {
|
|
17
|
+
$_root-selector: $rootSelector !global;
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
|
|
16
|
-
@mixin make-theme($vars, $name, $dark: false, $force-generate: false) {
|
|
21
|
+
@mixin make-theme($vars, $name, $dark: false, $force-generate: false, $root-selector: null) {
|
|
17
22
|
$theme-name: '';
|
|
18
23
|
$mode: '';
|
|
24
|
+
$actual-root-selector: $root-selector or $_root-selector;
|
|
25
|
+
$selector: '';
|
|
19
26
|
|
|
20
27
|
@if list.index($_themes, $name) or $name == $_theme-default or $force-generate {
|
|
21
28
|
@if $name != $_theme-default {
|
|
@@ -26,7 +33,12 @@ $_themes: () !default;
|
|
|
26
33
|
$mode: '.app--dark';
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
:root#{$theme-name}#{$mode}
|
|
36
|
+
$selector: '#{$actual-root-selector}#{$theme-name}#{$mode}';
|
|
37
|
+
@if $actual-root-selector == ':host' and ($theme-name != '' or $mode != '') {
|
|
38
|
+
$selector: ':host(#{$theme-name}#{$mode})';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#{$selector} {
|
|
30
42
|
@each $token, $val in $vars {
|
|
31
43
|
--#{$token}: #{$val};
|
|
32
44
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use '../variables/typography';
|
|
2
|
+
@use '../selectors';
|
|
2
3
|
@use './variables';
|
|
3
4
|
|
|
4
5
|
// stylelint-disable declaration-no-important, selector-no-qualifying-type, property-no-vendor-prefix
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
// Ability to the value of the root font sizes, affecting the value of `rem`.
|
|
26
27
|
// null by default, thus nothing is generated.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
#{selectors.$root} {
|
|
29
30
|
@if variables.$enable-smooth-scroll {
|
|
30
31
|
@media (prefers-reduced-motion: no-preference) {
|
|
31
32
|
scroll-behavior: smooth;
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
// 4. Change the default tap highlight to be completely transparent in iOS.
|
|
42
43
|
|
|
43
44
|
// scss-docs-start reboot-body-rules
|
|
44
|
-
body {
|
|
45
|
+
#{selectors.$body} {
|
|
45
46
|
margin: 0; // 1
|
|
46
47
|
font-family: var(--#{variables.$variable-prefix}body-font-family);
|
|
47
48
|
font-size: var(--#{variables.$variable-prefix}body-font-size);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
@use './variables';
|
|
2
|
+
@use '../selectors';
|
|
2
3
|
|
|
3
4
|
@use 'sass:meta';
|
|
4
5
|
|
|
5
6
|
// this is _root.scss without the automatic `to-rgb` brain damage
|
|
6
|
-
|
|
7
|
+
#{selectors.$root} {
|
|
7
8
|
// Note: Use `inspect` for lists so that quoted items keep the quotes.
|
|
8
9
|
// See https://github.com/sass/sass/issues/2383#issuecomment-336349172
|
|
9
10
|
--#{variables.$variable-prefix}font-sans-serif: #{meta.inspect(variables.$font-family-sans-serif)};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
@use '../variables';
|
|
2
|
+
@use '../selectors';
|
|
2
3
|
|
|
3
4
|
/* stylelint-disable declaration-no-important */
|
|
4
5
|
|
|
5
|
-
body:has(.cdk-drag-preview, .ui-draggable-dragging) {
|
|
6
|
+
#{selectors.$body}:has(.cdk-drag-preview, .ui-draggable-dragging) {
|
|
6
7
|
cursor: grabbing !important;
|
|
7
8
|
|
|
8
9
|
.cdk-drop-list:not(.cdk-drop-list-dragging) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uses :host selector to apply styles to the shadow DOM root element.
|
|
3
|
+
*
|
|
4
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
|
|
5
|
+
**/
|
|
6
|
+
$element-theme-default: null !default;
|
|
7
|
+
$element-themes: null !default;
|
|
8
|
+
|
|
9
|
+
@use 'styles/reboot-shadow-dom';
|
|
10
|
+
|
|
11
|
+
@use 'theme' with (
|
|
12
|
+
$element-theme-default: $element-theme-default,
|
|
13
|
+
$element-themes: $element-themes,
|
|
14
|
+
$element-theme-root-selector: ':host',
|
|
15
|
+
$element-theme-document-selector: ':host',
|
|
16
|
+
$element-theme-body-selector: ':host'
|
|
17
|
+
);
|
package/src/theme.scss
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
$element-theme-default: null !default;
|
|
2
2
|
$element-themes: null !default;
|
|
3
|
+
$element-theme-root-selector: ':root' !default;
|
|
4
|
+
$element-theme-document-selector: 'html' !default;
|
|
5
|
+
$element-theme-body-selector: 'body' !default;
|
|
3
6
|
|
|
4
7
|
// Defines the default root font size. Change to 'none' at some point.
|
|
5
8
|
$element-root-font-size: 16px !default;
|
|
@@ -7,6 +10,11 @@ $element-root-font-size: 16px !default;
|
|
|
7
10
|
$_theme-default: 'element';
|
|
8
11
|
$_themes: () !default;
|
|
9
12
|
|
|
13
|
+
@use 'styles/selectors' with (
|
|
14
|
+
$root: $element-theme-root-selector,
|
|
15
|
+
$document: $element-theme-document-selector,
|
|
16
|
+
$body: $element-theme-body-selector
|
|
17
|
+
);
|
|
10
18
|
@use 'styles/root-font-size' with (
|
|
11
19
|
$element-root-font-size: $element-root-font-size
|
|
12
20
|
);
|
|
@@ -40,11 +48,11 @@ $_themes: () !default;
|
|
|
40
48
|
@use 'styles/themes';
|
|
41
49
|
@use 'theme/theme-element';
|
|
42
50
|
|
|
43
|
-
@include themes.configure($element-theme-default, $element-themes);
|
|
51
|
+
@include themes.configure($element-theme-default, $element-themes, $element-theme-root-selector);
|
|
44
52
|
@include themes.make-theme(theme-element.$theme-element-light, 'element');
|
|
45
53
|
@include themes.make-theme(theme-element.$theme-element-dark, 'element', true);
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
body {
|
|
55
|
+
#{selectors.$document},
|
|
56
|
+
#{selectors.$body} {
|
|
49
57
|
block-size: 100%;
|
|
50
58
|
}
|