Refactor styles to match new CSS nesting behavior

This commit refactors SCSS to resolve deprecation warnings related to
mixed declaration after nested rules.

Sass is changing how it processes declarations that appear after nested
rules to align with CSS standards. Previously, Sass would hoist
declarations to avoid duplicating selectors, However, this behavior will
soon change to make declarations apply in the order they appear, as per
CSS standards.
This commit is contained in:
undergroundwires
2024-07-20 11:56:31 +02:00
parent dd7239b8c1
commit abe03cef3f
10 changed files with 43 additions and 28 deletions

View File

@@ -29,9 +29,9 @@
for interactive elements during hover or touch interactions. for interactive elements during hover or touch interactions.
*/ */
@mixin clickable($cursor: 'pointer') { @mixin clickable($cursor: 'pointer') {
cursor: #{$cursor};
user-select: none; user-select: none;
-webkit-tap-highlight-color: transparent; // Removes blue tap highlight -webkit-tap-highlight-color: transparent; // Removes blue tap highlight
cursor: #{$cursor};
} }
@mixin fade-transition($name) { @mixin fade-transition($name) {
@@ -120,13 +120,13 @@
} }
@mixin set-property-ch-value-with-fallback($property, $value-in-ch) { @mixin set-property-ch-value-with-fallback($property, $value-in-ch) {
@supports (width: 1ch) { // For browsers that do not support `ch` unit (e.g., Opera Mini):
#{$property}: #{$value-in-ch}ch;
}
// For browsers that does not support `ch` unit (e.g., Opera Mini):
$estimated-width-per-character-in-em: calc(1em / 2); // 1 character is approximately half the font size $estimated-width-per-character-in-em: calc(1em / 2); // 1 character is approximately half the font size
$calculated-width-in-em: calc(#{$estimated-width-per-character-in-em} * #{$value-in-ch}); $calculated-width-in-em: calc(#{$estimated-width-per-character-in-em} * #{$value-in-ch});
#{$property}: $calculated-width-in-em; #{$property}: $calculated-width-in-em;
@supports (width: 1ch) {
#{$property}: #{$value-in-ch}ch; // Override `em` value if `ch` is supported.
}
} }
@mixin base-font-style { @mixin base-font-style {

View File

@@ -78,15 +78,17 @@ function getOptionalDevToolkitComponent(): Component | undefined {
margin-right: auto; margin-right: auto;
margin-left: auto; margin-left: auto;
max-width: 1600px; max-width: 1600px;
.app__wrapper { .app__wrapper {
display:flex;
flex-direction: column;
background-color: $color-surface; background-color: $color-surface;
color: $color-on-surface; color: $color-on-surface;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.06); box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.06);
@include responsive-spacing; @include responsive-spacing;
display:flex;
flex-direction: column;
.app__row { .app__row {
margin-bottom: $spacing-absolute-large; margin-bottom: $spacing-absolute-large;
} }

View File

@@ -79,12 +79,12 @@ export default defineComponent({
box-shadow: 0 3px 9px $color-primary-darkest; box-shadow: 0 3px 9px $color-primary-darkest;
border-radius: 4px; border-radius: 4px;
@include clickable;
.button__icon { .button__icon {
font-size: $font-size-absolute-x-large; font-size: $font-size-absolute-x-large;
} }
@include clickable;
@include hover-or-touch { @include hover-or-touch {
background: $color-surface; background: $color-surface;
box-shadow: 0px 2px 10px 5px $color-secondary; box-shadow: 0px 2px 10px 5px $color-secondary;

View File

@@ -110,8 +110,9 @@ export default defineComponent({
@include apply-icon-color($color-danger); @include apply-icon-color($color-danger);
} }
.recommendation { .recommendation {
align-items: center;
@include horizontal-stack; @include horizontal-stack;
@include apply-icon-color($color-caution); @include apply-icon-color($color-caution);
align-items: center;
} }
</style> </style>

View File

@@ -68,9 +68,11 @@ export default defineComponent({
@include horizontal-stack; @include horizontal-stack;
@include apply-icon-color($color-caution); @include apply-icon-color($color-caution);
} }
.description { .description {
align-items: center;
@include horizontal-stack; @include horizontal-stack;
@include apply-icon-color($color-success); @include apply-icon-color($color-success);
align-items: center;
} }
</style> </style>

View File

@@ -58,8 +58,19 @@ $color-hover : $color-primary;
$cursor : v-bind(cursorCssValue); $cursor : v-bind(cursorCssValue);
.handle { .handle {
cursor: $cursor;
@include reset-button; @include reset-button;
display: flex;
flex-direction: column;
align-items: center;
margin-right: $spacing-absolute-small;
margin-left: $spacing-absolute-small;
@include clickable($cursor: $cursor); @include clickable($cursor: $cursor);
@include hover-or-touch { @include hover-or-touch {
.line { .line {
background: $color-hover; background: $color-hover;
@@ -68,11 +79,7 @@ $cursor : v-bind(cursorCssValue);
color: $color-hover; color: $color-hover;
} }
} }
cursor: $cursor;
display: flex;
flex-direction: column;
align-items: center;
.line { .line {
flex: 1; flex: 1;
background: $color; background: $color;
@@ -81,7 +88,5 @@ $cursor : v-bind(cursorCssValue);
.icon { .icon {
color: $color; color: $color;
} }
margin-right: $spacing-absolute-small;
margin-left: $spacing-absolute-small;
} }
</style> </style>

View File

@@ -78,17 +78,20 @@ export default defineComponent({
} }
} }
.docs { .docs {
color: $color-on-primary;
background: $color-primary-darkest; background: $color-primary-darkest;
margin-left: $spacing-absolute-small; margin-left: $spacing-absolute-small;
margin-top: $spacing-relative-x-small; margin-top: $spacing-relative-x-small;
color: $color-on-primary;
text-transform: none;
padding: $spacing-absolute-medium; padding: $spacing-absolute-medium;
text-transform: none;
cursor: auto;
user-select: text;
&-collapsed { &-collapsed {
display: none; display: none;
} }
cursor: auto;
user-select: text;
} }
} }
</style> </style>

View File

@@ -133,14 +133,14 @@ export default defineComponent({
.expansible-node { .expansible-node {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center;
.leaf-node { .leaf-node {
flex: 1; // Expands the node horizontally, allowing its content to utilize full width for child item alignment, such as icons and text. flex: 1; // Expands the node horizontally, allowing its content to utilize full width for child item alignment, such as icons and text.
overflow: auto; // Prevents horizontal expansion of inner content (e.g., when a code block is shown) overflow: auto; // Prevents horizontal expansion of inner content (e.g., when a code block is shown)
} }
flex-direction: row;
align-items: center;
.expand-collapse-caret { .expand-collapse-caret {
$caret-size: 24px; $caret-size: 24px;
$padding-right: $spacing-absolute-small; $padding-right: $spacing-absolute-small;

View File

@@ -220,9 +220,6 @@ $color-tooltip-background: $color-primary-darkest;
} }
.tooltip__overlay { .tooltip__overlay {
@include set-visibility(false);
@include fixed-fullscreen;
/* /*
The z-index is set for both visible and invisible states to ensure it maintains its stacking order The z-index is set for both visible and invisible states to ensure it maintains its stacking order
above other elements during transitions. This approach prevents the tooltip from falling behind other above other elements during transitions. This approach prevents the tooltip from falling behind other
@@ -235,6 +232,9 @@ $color-tooltip-background: $color-primary-darkest;
This prevents unintentional layout issues or overflow. This prevents unintentional layout issues or overflow.
*/ */
white-space: normal; white-space: normal;
@include set-visibility(false);
@include fixed-fullscreen;
} }
.tooltip__trigger { .tooltip__trigger {

View File

@@ -116,6 +116,8 @@ export default defineComponent({
} }
&__section { &__section {
display: flex; display: flex;
flex-wrap: wrap;
@media screen and (max-width: $media-screen-big-width) { @media screen and (max-width: $media-screen-big-width) {
justify-content: space-around; justify-content: space-around;
width: 100%; width: 100%;
@@ -124,7 +126,7 @@ export default defineComponent({
margin-top: $spacing-relative-small; margin-top: $spacing-relative-small;
} }
} }
flex-wrap: wrap;
&__item:not(:first-child) { &__item:not(:first-child) {
&::before { &::before {
content: "|"; content: "|";