Update menu and message

This commit is contained in:
Jeremy Thomas 2024-09-18 23:53:25 +01:00
parent 04d86325e8
commit 23feb10a7d
2 changed files with 90 additions and 128 deletions

View File

@ -3,20 +3,33 @@
@use "../utilities/extends"; @use "../utilities/extends";
@use "../utilities/mixins" as mx; @use "../utilities/mixins" as mx;
$menu-item-h: cv.getVar("scheme-h"); $menu-item-background-color: cv.getVar("scheme-main") !default;
$menu-item-s: cv.getVar("scheme-s"); $menu-item-color: cv.getVar("text") !default;
$menu-item-l: cv.getVar("scheme-main-l"); $menu-item-hover-background-color: hsl(
$menu-item-background-l: cv.getVar("scheme-main-l"); from #{cv.getVar("menu-item-background-color")} h s calc(l + #{cv.getVar(
$menu-item-background-l-delta: 0%; "hover-background-l-delta"
$menu-item-hover-background-l-delta: cv.getVar("hover-background-l-delta"); )})
$menu-item-active-background-l-delta: cv.getVar("active-background-l-delta"); ) !default;
$menu-item-color-l: cv.getVar("text-l"); $menu-item-hover-color: cv.getVar("text-strong") !default;
$menu-item-active-background-color: hsl(
from #{cv.getVar("menu-item-background-color")} h s calc(l + #{cv.getVar(
"active-background-l-delta"
)})
) !default;
$menu-item-active-color: cv.getVar("text-strong") !default;
$menu-item-selected-background-color: cv.getVar("link") !default;
$menu-item-selected-color: cv.getVar("link-invert") !default;
$menu-item-selected-hover-background-color: hsl(
from #{cv.getVar("menu-item-selected-background-color")} h s calc(l + #{cv.getVar(
"hover-background-l-delta"
)})
) !default;
$menu-item-selected-active-background-color: hsl(
from #{cv.getVar("menu-item-selected-background-color")} h s calc(l + #{cv.getVar(
"active-background-l-delta"
)})
) !default;
$menu-item-radius: cv.getVar("radius-small") !default; $menu-item-radius: cv.getVar("radius-small") !default;
$menu-item-selected-h: cv.getVar("link-h");
$menu-item-selected-s: cv.getVar("link-s");
$menu-item-selected-l: cv.getVar("link-l");
$menu-item-selected-background-l: cv.getVar("link-l");
$menu-item-selected-color-l: cv.getVar("link-invert-l");
$menu-list-border-left: 1px solid cv.getVar("border") !default; $menu-list-border-left: 1px solid cv.getVar("border") !default;
$menu-list-line-height: 1.25 !default; $menu-list-line-height: 1.25 !default;
@ -32,20 +45,17 @@ $menu-label-spacing: 1em !default;
.#{iv.$class-prefix}menu { .#{iv.$class-prefix}menu {
@include cv.register-vars( @include cv.register-vars(
( (
"menu-item-h": #{$menu-item-h}, "menu-item-background-color": #{$menu-item-background-color},
"menu-item-s": #{$menu-item-s}, "menu-item-color": #{$menu-item-color},
"menu-item-l": #{$menu-item-l}, "menu-item-hover-background-color": #{$menu-item-hover-background-color},
"menu-item-background-l": #{$menu-item-background-l}, "menu-item-hover-color": #{$menu-item-hover-color},
"menu-item-background-l-delta": #{$menu-item-background-l-delta}, "menu-item-active-background-color": #{$menu-item-active-background-color},
"menu-item-hover-background-l-delta": #{$menu-item-hover-background-l-delta}, "menu-item-active-color": #{$menu-item-active-color},
"menu-item-active-background-l-delta": #{$menu-item-active-background-l-delta}, "menu-item-selected-background-color": #{$menu-item-selected-background-color},
"menu-item-color-l": #{$menu-item-color-l}, "menu-item-selected-color": #{$menu-item-selected-color},
"menu-item-selected-hover-background-color": #{$menu-item-selected-hover-background-color},
"menu-item-selected-active-background-color": #{$menu-item-selected-active-background-color},
"menu-item-radius": #{$menu-item-radius}, "menu-item-radius": #{$menu-item-radius},
"menu-item-selected-h": #{$menu-item-selected-h},
"menu-item-selected-s": #{$menu-item-selected-s},
"menu-item-selected-l": #{$menu-item-selected-l},
"menu-item-selected-background-l": #{$menu-item-selected-background-l},
"menu-item-selected-color-l": #{$menu-item-selected-color-l},
"menu-list-border-left": #{$menu-list-border-left}, "menu-list-border-left": #{$menu-list-border-left},
"menu-list-line-height": #{$menu-list-line-height}, "menu-list-line-height": #{$menu-list-line-height},
"menu-list-link-padding": #{$menu-list-link-padding}, "menu-list-link-padding": #{$menu-list-link-padding},
@ -83,60 +93,41 @@ $menu-label-spacing: 1em !default;
button, button,
.#{iv.$class-prefix}menu-item { .#{iv.$class-prefix}menu-item {
@extend %reset; @extend %reset;
background-color: hsl( background-color: cv.getVar("menu-item-background-color");
#{cv.getVar("menu-item-h")},
#{cv.getVar("menu-item-s")},
calc(
#{cv.getVar("menu-item-background-l")} + #{cv.getVar(
"menu-item-background-l-delta"
)}
)
);
border-radius: cv.getVar("menu-item-radius"); border-radius: cv.getVar("menu-item-radius");
color: hsl( color: cv.getVar("menu-item-color");
#{cv.getVar("menu-item-h")},
#{cv.getVar("menu-item-s")},
#{cv.getVar("menu-item-color-l")}
);
display: block; display: block;
padding: cv.getVar("menu-list-link-padding"); padding: cv.getVar("menu-list-link-padding");
text-align: left; text-align: left;
width: 100%; width: 100%;
&:hover { &:hover {
@include cv.register-vars( background-color: cv.getVar("menu-item-hover-background-color");
( color: cv.getVar("menu-item-hover-color");
"menu-item-background-l-delta": #{cv.getVar(
"menu-item-hover-background-l-delta"
)},
)
);
} }
&:active { &:active {
@include cv.register-vars( background-color: cv.getVar("menu-item-active-background-color");
( color: cv.getVar("menu-item-active-color");
"menu-item-background-l-delta": #{cv.getVar(
"menu-item-active-background-l-delta"
)},
)
);
} }
// Modifiers // Modifiers
&.#{iv.$class-prefix}is-active, &.#{iv.$class-prefix}is-active,
&.#{iv.$class-prefix}is-selected { &.#{iv.$class-prefix}is-selected {
@include cv.register-vars( background-color: cv.getVar("menu-item-selected-background-color");
( color: cv.getVar("menu-item-selected-color");
"menu-item-h": #{cv.getVar("menu-item-selected-h")},
"menu-item-s": #{cv.getVar("menu-item-selected-s")}, &:hover {
"menu-item-l": #{cv.getVar("menu-item-selected-l")}, background-color: cv.getVar(
"menu-item-background-l": #{cv.getVar( "menu-item-selected-hover-background-color"
"menu-item-selected-background-l" );
)}, }
"menu-item-color-l": #{cv.getVar("menu-item-selected-color-l")},
) &:active {
); background-color: cv.getVar(
"menu-item-selected-active-background-color"
);
}
} }
} }

View File

@ -4,26 +4,24 @@
@use "../utilities/extends"; @use "../utilities/extends";
@use "../utilities/mixins" as mx; @use "../utilities/mixins" as mx;
$message-h: cv.getVar("scheme-h"); $message-background-color: cv.getVar("background");
$message-s: cv.getVar("scheme-s");
$message-background-l: cv.getVar("background-l"); $message-background-l: cv.getVar("background-l");
$message-border-l: cv.getVar("border-l"); $message-color: cv.getVar("text") !default;
$message-border-l-delta: -20% !default; $message-border-color: cv.getVar("border");
$message-border-style: solid; $message-border-style: solid;
$message-border-width: 0.25em; $message-border-width: 0.25em;
$message-color-l: cv.getVar("text-l"); $message-header-background-color: cv.getVar("text");
$message-header-background-l: cv.getVar("dark-l"); $message-header-color: cv.getVar("text-invert");
$message-header-color-l: cv.getVar("text-dark-invert-l"); $message-radius: cv.getVar("radius-large") !default;
$message-radius: cv.getVar("radius") !default;
$message-header-weight: cv.getVar("weight-semibold") !default; $message-header-weight: cv.getVar("weight-semibold") !default;
$message-header-padding: 1em 1.25em !default; $message-header-padding: 1em 1.25em !default;
$message-header-radius: cv.getVar("radius") !default; $message-header-radius: cv.getVar("radius-large") !default;
$message-body-border-width: 0 0 0 4px !default; $message-body-border-width: 0 0 0 4px !default;
$message-body-color: cv.getVar("text") !default; $message-body-color: cv.getVar("text") !default;
$message-body-padding: 1.25em 1.5em !default; $message-body-padding: 1.25em 1.5em !default;
$message-body-radius: cv.getVar("radius-small") !default; $message-body-radius: cv.getVar("radius-medium") !default;
$message-body-pre-code-background-color: transparent !default; $message-body-pre-code-background-color: transparent !default;
@ -33,7 +31,10 @@ $message-colors: dv.$colors !default;
.#{iv.$class-prefix}message { .#{iv.$class-prefix}message {
@include cv.register-vars( @include cv.register-vars(
( (
"message-border-l-delta": #{$message-border-l-delta}, "message-background-color": #{$message-background-color},
"message-background-l": #{$message-background-l},
"message-color": #{$message-color},
"message-border-color": #{$message-border-color},
"message-radius": #{$message-radius}, "message-radius": #{$message-radius},
"message-header-weight": #{$message-header-weight}, "message-header-weight": #{$message-header-weight},
"message-header-padding": #{$message-header-padding}, "message-header-padding": #{$message-header-padding},
@ -44,15 +45,10 @@ $message-colors: dv.$colors !default;
"message-body-radius": #{$message-body-radius}, "message-body-radius": #{$message-body-radius},
"message-body-pre-code-background-color": #{$message-body-pre-code-background-color}, "message-body-pre-code-background-color": #{$message-body-pre-code-background-color},
"message-header-body-border-width": #{$message-header-body-border-width}, "message-header-body-border-width": #{$message-header-body-border-width},
"message-h": #{$message-h},
"message-s": #{$message-s},
"message-background-l": #{$message-background-l},
"message-border-l": #{$message-border-l},
"message-border-style": #{$message-border-style}, "message-border-style": #{$message-border-style},
"message-border-width": #{$message-border-width}, "message-border-width": #{$message-border-width},
"message-color-l": #{$message-color-l}, "message-header-background-color": #{$message-header-background-color},
"message-header-background-l": #{$message-header-background-l}, "message-header-color": #{$message-header-color},
"message-header-color-l": #{$message-header-color-l},
) )
); );
} }
@ -60,11 +56,7 @@ $message-colors: dv.$colors !default;
.#{iv.$class-prefix}message { .#{iv.$class-prefix}message {
@extend %block; @extend %block;
border-radius: cv.getVar("message-radius"); border-radius: cv.getVar("message-radius");
color: hsl( color: cv.getVar("message-color");
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-color-l")}
);
font-size: cv.getVar("size-normal"); font-size: cv.getVar("size-normal");
strong { strong {
@ -96,17 +88,11 @@ $message-colors: dv.$colors !default;
&.#{iv.$class-prefix}is-#{$name} { &.#{iv.$class-prefix}is-#{$name} {
@include cv.register-vars( @include cv.register-vars(
( (
"message-h": #{cv.getVar($name, "", "-h")}, "message-background-color": #{cv.getVar($name, "", "-light")},
"message-s": #{cv.getVar($name, "", "-s")}, "message-border-color": #{cv.getVar($name)},
"message-border-l": "message-color": #{cv.getVar($name, "", "-on-scheme")},
calc( "message-header-background-color": #{cv.getVar($name)},
#{cv.getVar($name, "", "-l")} + #{cv.getVar( "message-header-color": #{cv.getVar($name, "", "-invert")},
"message-border-l-delta"
)}
),
"message-color-l": #{cv.getVar($name, "", "-on-scheme-l")},
"message-header-background-l": #{cv.getVar($name, "", "-l")},
"message-header-color-l": #{cv.getVar($name, "", "-invert-l")},
) )
); );
} }
@ -115,18 +101,10 @@ $message-colors: dv.$colors !default;
.#{iv.$class-prefix}message-header { .#{iv.$class-prefix}message-header {
align-items: center; align-items: center;
background-color: hsl( background-color: cv.getVar("message-header-background-color");
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-background-l")}
);
border-start-start-radius: cv.getVar("message-header-radius"); border-start-start-radius: cv.getVar("message-header-radius");
border-start-end-radius: cv.getVar("message-header-radius"); border-start-end-radius: cv.getVar("message-header-radius");
color: hsl( color: cv.getVar("message-header-color");
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-color-l")}
);
display: flex; display: flex;
font-weight: cv.getVar("message-header-weight"); font-weight: cv.getVar("message-header-weight");
justify-content: space-between; justify-content: space-between;
@ -144,37 +122,30 @@ $message-colors: dv.$colors !default;
border-width: cv.getVar("message-header-body-border-width"); border-width: cv.getVar("message-header-body-border-width");
border-start-start-radius: 0; border-start-start-radius: 0;
border-start-end-radius: 0; border-start-end-radius: 0;
border-end-end-radius: cv.getVar("message-radius");
border-end-start-radius: cv.getVar("message-radius");
} }
} }
.#{iv.$class-prefix}message-body { .#{iv.$class-prefix}message-body {
background-color: hsl( background-color: hsl(
#{cv.getVar("message-h")}, from #{cv.getVar("message-background-color")} h s #{cv.getVar(
#{cv.getVar("message-s")}, "message-background-l"
#{cv.getVar("message-background-l")} )}
);
border-inline-start-color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-border-l")}
); );
border-inline-start-color: cv.getVar("message-border-color");
border-inline-start-style: #{cv.getVar("message-border-style")}; border-inline-start-style: #{cv.getVar("message-border-style")};
border-inline-start-width: #{cv.getVar("message-border-width")}; border-inline-start-width: #{cv.getVar("message-border-width")};
border-radius: cv.getVar("message-body-radius"); border-start-start-radius: 0;
border-start-end-radius: cv.getVar("message-radius");
border-end-end-radius: cv.getVar("message-radius");
border-end-start-radius: 0;
padding: cv.getVar("message-body-padding"); padding: cv.getVar("message-body-padding");
code, code,
pre { pre {
background-color: hsl( background-color: cv.getVar("message-header-color");
#{cv.getVar("message-h")}, color: cv.getVar("message-header-background-color");
#{cv.getVar("message-s")},
#{cv.getVar("message-header-color-l")}
);
color: hsl(
#{cv.getVar("message-h")},
#{cv.getVar("message-s")},
#{cv.getVar("message-header-background-l")}
);
} }
pre code { pre code {