From 6b0fcac695aa7a5517f6f53cec50da493acc4582 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 22 Jun 2024 19:30:00 +0200 Subject: Update --- src/.old/objects/_badge.scss | 173 --------------------------------- src/.old/objects/_button.scss | 179 ----------------------------------- src/.old/objects/_emoji.scss | 74 --------------- src/.old/objects/_icon.scss | 26 ----- src/.old/scopes/_blockquotes.scss | 35 ------- src/.old/scopes/_lists.scss | 67 ------------- src/_base.scss | 9 +- src/_config.scss | 110 ++++++++++++++------- src/_declare-vars.scss | 29 +++--- src/_functions.scss | 16 +++- src/_objects.scss | 8 +- src/_scopes.scss | 4 +- src/_utils.scss | 24 ++--- src/layouts/_container.scss | 6 +- src/layouts/_media.scss | 6 +- src/layouts/_message-group.scss | 14 +-- src/objects/_badge.scss | 194 ++++++++++++++++++++++++++++++++++++++ src/objects/_button.scss | 173 +++++++++++++++++++++++++++++++++ src/objects/_divider.scss | 16 ++-- src/objects/_emoji.scss | 73 ++++++++++++++ src/objects/_icon.scss | 26 +++++ src/objects/_palette.scss | 22 ++++- src/scopes/_blockquotes.scss | 34 +++++++ src/scopes/_code.scss | 2 +- src/scopes/_links.scss | 27 +++--- src/scopes/_lists.scss | 66 +++++++++++++ 26 files changed, 751 insertions(+), 662 deletions(-) delete mode 100644 src/.old/objects/_badge.scss delete mode 100644 src/.old/objects/_button.scss delete mode 100644 src/.old/objects/_emoji.scss delete mode 100644 src/.old/objects/_icon.scss delete mode 100644 src/.old/scopes/_blockquotes.scss delete mode 100644 src/.old/scopes/_lists.scss create mode 100644 src/objects/_badge.scss create mode 100644 src/objects/_button.scss create mode 100644 src/objects/_emoji.scss create mode 100644 src/objects/_icon.scss create mode 100644 src/scopes/_blockquotes.scss create mode 100644 src/scopes/_lists.scss (limited to 'src') diff --git a/src/.old/objects/_badge.scss b/src/.old/objects/_badge.scss deleted file mode 100644 index 0f73382..0000000 --- a/src/.old/objects/_badge.scss +++ /dev/null @@ -1,173 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('badge') { - @include iro.props-store(( - --dims: ( - --pad-x: fn.px-to-em(4px), - --pad-y: 0, - --rounding: 3px, - --fixed-100: 1em, - --fixed-200: 1.5em, - - --200: ( - --pad-x: fn.px-to-em(6px), - --pad-y: fn.px-to-em(2px), - ), - --300: ( - --pad-x: fn.px-to-em(10px), - --pad-y: fn.px-to-em(6px), - ), - - --pill: ( - --pad-x: fn.px-to-em(9px), - - --200: ( - --pad-x: fn.px-to-em(10px), - ), - --300: ( - --pad-x: fn.px-to-em(16px), - ), - ), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-lo), - --hover: ( - --bg: fn.global-color(--obj), - ), - --active: ( - --bg: fn.global-color(--obj-lo), - ), - --key-focus: ( - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - - --primary: ( - --bg: fn.global-color(--fg-lo), - --label: fn.global-color(--bg), - --hover: ( - --bg: fn.global-color(--fg), - ), - --active: ( - --bg: fn.global-color(--fg), - ), - ), - - --accent: ( - --bg: fn.global-color(--accent --primary --solid --bg), - --label: fn.global-color(--accent --primary --solid --fg), - --hover: ( - --bg: fn.global-color(--accent --primary --solid --obj), - ), - --active: ( - --bg: fn.global-color(--accent --primary --solid --obj-lo), - ), - ), - - --accent-quiet: ( - --bg: fn.global-color(--accent --primary --quiet --bg), - --label: fn.global-color(--accent --primary --quiet --fg), - --hover: ( - --bg: fn.global-color(--accent --primary --quiet --obj), - ), - --active: ( - --bg: fn.global-color(--accent --primary --quiet --obj-lo), - ), - ) - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - margin-top: -.5em; - margin-bottom: -.5em; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - color: fn.color(--label); - line-height: fn.global-dim(--font --standard --line-height); - text-align: center; - text-decoration: none; - - &:link, - &:visited, - &:enabled { - &:hover { - background-color: fn.color(--hover --bg); - } - - &:active { - background-color: fn.color(--active --bg); - } - } - - @each $variant in 'primary' 'accent' 'accent-quiet' { - @include iro.bem-modifier($variant) { - background-color: fn.color(--#{$variant} --bg); - color: fn.color(--#{$variant} --label); - - &:link, - &:visited, - &:enabled { - &:hover { - background-color: fn.color(--#{$variant} --hover --bg); - } - - &:active { - background-color: fn.color(--#{$variant} --active --bg); - } - } - } - } - - &:link, - &:visited, - &:enabled { - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: transparent; - box-shadow: inset 0 0 0 2px fn.color(--key-focus --border), fn.color(--key-focus --shadow); - color: currentColor; - } - } - } - - @include iro.bem-modifier('pill') { - padding-right: fn.dim(--pill --pad-x); - padding-left: fn.dim(--pill --pad-x); - border-radius: 10em; - } - - @each $size in '200' '300' { - @include iro.bem-modifier($size) { - padding: fn.dim(--#{$size} --pad-y) fn.dim(--#{$size} --pad-x); - - @include iro.bem-modifier('pill') { - padding-right: fn.dim(--pill --#{$size} --pad-x); - padding-left: fn.dim(--pill --#{$size} --pad-x); - } - } - } - - @include iro.bem-modifier('fixed-100') { - width: fn.dim(--fixed-100); - } - - @include iro.bem-modifier('fixed-200') { - width: fn.dim(--fixed-200); - } - - @include iro.bem-modifier('sm') { - font-size: fn.global-dim(--font-size --75); - } - - @include iro.bem-modifier('xs') { - font-size: fn.global-dim(--font-size --50); - } - } -} diff --git a/src/.old/objects/_button.scss b/src/.old/objects/_button.scss deleted file mode 100644 index 7cc24fa..0000000 --- a/src/.old/objects/_button.scss +++ /dev/null @@ -1,179 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@mixin button-variant($variant) { - &:link, - &:visited, - &:enabled { - border-color: fn.color(--#{$variant} --bg); - background-color: fn.color(--#{$variant} --bg); - box-shadow: fn.color(--#{$variant} --shadow); - color: fn.color(--#{$variant} --label); - } - - @include iro.bem-modifier('outline') { - &:link, - &:visited, - &:enabled { - background-color: transparent; - box-shadow: none; - color: fn.color(--#{$variant} --outline-label); - } - } - - &:link, - &:visited, - &:enabled { - &:hover { - border-color: fn.color(--#{$variant} --hover --bg); - background-color: fn.color(--#{$variant} --hover --bg); - box-shadow: fn.color(--#{$variant} --hover --shadow); - color: fn.color(--#{$variant} --hover --label); - } - - &:active { - border-color: fn.color(--#{$variant} --active --bg); - background-color: fn.color(--#{$variant} --active --bg); - box-shadow: fn.color(--#{$variant} --active --shadow); - color: fn.color(--#{$variant} --active --label); - } - } -} - -@include iro.props-namespace('button') { - @include iro.props-store(( - --dims: ( - --line-height: 1.4, - --pad-x: fn.global-dim(--size --225), - --pad-y: fn.global-dim(--size --65), - --rounding: 10em, - - --lg: ( - --pad-x: fn.global-dim(--size --300), - --pad-y: fn.global-dim(--size --100), - ), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --any: ( - --disabled: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-hi3), - --shadow: 0 0 0 0 transparent, - ), - --key-focus: ( - --bg: transparent, - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - ), - --accent: ( - --bg: fn.global-color(--accent --primary --solid --bg), - --label: fn.global-color(--accent --primary --solid --fg), - --outline-label: fn.global-color(--accent --primary --solid --obj), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --bg: fn.global-color(--accent --primary --solid --obj), - --label: fn.global-color(--accent --primary --solid --fg), - --shadow: 0 0 0 0 transparent, - ), - --active: ( - --bg: fn.global-color(--accent --primary --solid --obj-lo), - --label: fn.global-color(--accent --primary --solid --fg), - --shadow: 0 0 0 0 transparent, - ), - ), - --primary: ( - --bg: fn.global-color(--fg), - --label: fn.global-color(--bg-hi2), - --outline-label: fn.global-color(--fg), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --bg: fn.global-color(--fg-lo), - --label: fn.global-color(--bg-hi2), - --shadow: 0 0 0 0 transparent, - ), - --active: ( - --bg: fn.global-color(--fg-lo), - --label: fn.global-color(--bg-hi2), - --shadow: 0 0 0 0 transparent, - ), - ), - --secondary: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg), - --outline-label: fn.global-color(--fg), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --bg: fn.global-color(--obj), - --label: fn.global-color(--fg-lo), - --shadow: 0 0 0 0 transparent, - ), - --active: ( - --bg: fn.global-color(--obj-lo), - --label: fn.global-color(--fg-lo), - --shadow: 0 0 0 0 transparent, - ), - ), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border: 2px solid transparent; - border-radius: fn.dim(--rounding); - border-color: fn.color(--any --disabled --bg); - background-color: fn.color(--any --disabled --bg); - box-shadow: fn.color(--any --disabled --shadow); - color: fn.color(--any --disabled --label); - font-weight: 500; - line-height: fn.dim(--line-height); - text-align: center; - text-decoration: none; - vertical-align: top; - - @include iro.bem-modifier('block') { - display: block; - } - - @include iro.bem-modifier('outline') { - background-color: transparent; - box-shadow: none; - } - - @include iro.bem-modifier('lg') { - padding: fn.dim(--lg --pad-y) fn.dim(--lg --pad-x); - } - - @include button-variant('secondary'); - - @each $mod in 'accent' 'primary' { - @include iro.bem-modifier($mod) { - @include button-variant($mod); - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - border-color: fn.color(--any --key-focus --border); - background-color: fn.color(--any --key-focus --bg); - box-shadow: fn.color(--any --key-focus --shadow); - color: fn.color(--any --key-focus --label); - } - } - - @include iro.bem-modifier('round') { - width: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-y)); - padding-right: 0; - padding-left: 0; - border-radius: 100em; - } - } -} diff --git a/src/.old/objects/_emoji.scss b/src/.old/objects/_emoji.scss deleted file mode 100644 index 8d17212..0000000 --- a/src/.old/objects/_emoji.scss +++ /dev/null @@ -1,74 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use 'sass:math'; - -@include iro.props-namespace('emoji') { - @include iro.props-store(( - --dims: ( - --size: calc(1 / 14 * 18em), - --pad: .3em, - --rounding: 3px, - --zoom: 3, - --valign: -.25em, - - --125: ( - --size: calc(1 / 14 * 23em), - --valign: -.45em, - ), - - --150: ( - --size: calc(1 / 14 * 28em), - --valign: -.65em, - ), - - --200: ( - --size: calc(1 / 14 * 38em), - --valign: -1em, - ) - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--obj-hi), - ) - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - width: calc(fn.dim(--size)); - height: calc(fn.dim(--size)); - margin: calc(-1 * fn.dim(--pad)); - padding: calc(fn.dim(--pad)); - vertical-align: fn.dim(--valign); - object-fit: contain; - - @include iro.bem-modifier('icon') { - margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--size) - fn.foreign-dim(--icon, --size))); - vertical-align: fn.foreign-dim(--icon, --valign); - } - - @each $size in '125' '150' '200' { - @include iro.bem-modifier($size) { - width: fn.dim(--#{$size} --size); - height: fn.dim(--#{$size} --size); - vertical-align: fn.dim(--#{$size} --valign); - - @include iro.bem-modifier('icon') { - margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--#{$size} --size) - fn.foreign-dim(--icon, --size))); - } - } - } - - @include iro.bem-modifier('zoomable') { - transition: transform .2s ease, background-color .2s ease; - border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom)); - - &:hover { - transform: scale(fn.dim(--zoom)); - background-color: fn.color(--bg); - } - } - } -} diff --git a/src/.old/objects/_icon.scss b/src/.old/objects/_icon.scss deleted file mode 100644 index 5c4bfab..0000000 --- a/src/.old/objects/_icon.scss +++ /dev/null @@ -1,26 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('icon') { - @include iro.props-store(( - --dims: ( - --stroke: 1.5px, - --size: calc(1 / 14 * 16em), - --valign: -.2em, - ) - ), 'dims'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline; - width: fn.dim(--size); - height: fn.dim(--size); - stroke-width: fn.dim(--stroke); - stroke-linecap: round; - stroke-linejoin: round; - vertical-align: fn.dim(--valign); - - @include iro.bem-modifier('block') { - display: block; - } - } -} diff --git a/src/.old/scopes/_blockquotes.scss b/src/.old/scopes/_blockquotes.scss deleted file mode 100644 index 5383bd7..0000000 --- a/src/.old/scopes/_blockquotes.scss +++ /dev/null @@ -1,35 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('blockquotes') { - @include iro.props-store(( - --dims: ( - --indent: fn.global-dim(--list --indent), - --margin-top: fn.global-dim(--paragraph --margin-top), - - --compact: ( - --indent: fn.global-dim(--list --compact-indent), - ), - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --border: fn.global-color(--obj), - ) - ), 'colors'); - - @include iro.bem-scope(iro.props-namespace()) { - blockquote { - margin: fn.dim(--margin-top) 0 0 1px; - padding-left: calc(fn.dim(--indent) - 3px); - border-left: 3px solid fn.color(--border); - } - - @include iro.bem-modifier('compact') { - blockquote { - padding-left: calc(fn.dim(--compact --indent) - 3px); - } - } - } -} diff --git a/src/.old/scopes/_lists.scss b/src/.old/scopes/_lists.scss deleted file mode 100644 index 1322f2d..0000000 --- a/src/.old/scopes/_lists.scss +++ /dev/null @@ -1,67 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('lists') { - @include iro.props-store(( - --dims: ( - --indent: calc(fn.global-dim(--list --indent) + 1em), - --margin-top: fn.global-dim(--paragraph --margin-top), - - --compact: ( - --indent: fn.global-dim(--list --compact-indent), - ), - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --border: fn.global-color(--obj-hi), - ) - ), 'colors'); - - @include iro.bem-scope(iro.props-namespace()) { - ul, - ol { - margin-top: fn.dim(--margin-top); - padding-left: fn.dim(--indent); - - ul, - ol { - margin-top: 0; - } - } - - ul { - list-style: disc; - } - - ol { - list-style: decimal; - } - - dl { - margin: fn.dim(--margin-top) 0 0; - padding: 0; - } - - dt { - color: fn.global-color(--fg-lo); - font-weight: bold; - } - - dd { - margin: 0 0 0 fn.dim(--indent); - } - - @include iro.bem-modifier('compact') { - ul, - ol { - padding-left: calc(fn.dim(--compact --indent) - 3px); - } - - dd { - margin-left: calc(fn.dim(--compact --indent) - 3px); - } - } - } -} diff --git a/src/_base.scss b/src/_base.scss index b4ce1ae..f55e94b 100644 --- a/src/_base.scss +++ b/src/_base.scss @@ -10,7 +10,7 @@ html { html, body { - height: 100%; + block-size: 100%; } body { @@ -90,7 +90,8 @@ li { padding: 0; } -:focus { +:focus, +:focus-visible { outline: 0; } @@ -137,11 +138,11 @@ textarea { } textarea { - height: calc(1em * fn.dim(--font --standard --line-height)); + block-size: calc(1em * fn.dim(--font --standard --line-height)); } hr { - height: fn.dim(--border --thin); + block-size: fn.dim(--border --thin); margin-block: calc(.5 * (fn.dim(--heading --margin-bs) + fn.dim(--paragraph --margin-bs))) 0; border: 0; background-color: fn.color(--border); diff --git a/src/_config.scss b/src/_config.scss index be01a69..3cffbfd 100644 --- a/src/_config.scss +++ b/src/_config.scss @@ -25,6 +25,34 @@ res.$named-viewports: media.$breakpoints; $palette-precision: 5 !default; +$static-colors: ( + --base: hsl(0, 0%, 97%), + + --contrasts: ( + --100: -1.08, + --200: -1.20, + --300: -1.33, + --400: -1.58, + --500: -1.92, + --600: -2.39, + --700: -3.01, + --800: -3.87, + --900: -5.07, + --1000: -6.72, + --1100: -8.84, + --1200: -11.31, + --1300: -13.94, + ), + + --palettes: ( + --blue: blend.lch(48% 50 279), + --purple: blend.lch(48% 50 308), + --red: blend.lch(48% 50 23), + --green: blend.lch(63% 50 147), + --yellow: blend.lch(68% 50 80), + ), +) !default; + $theme-light: ( --contrasts: ( --grays: ( @@ -74,23 +102,30 @@ $theme-light: ( --yellow: blend.lch(68% 50 80) --colors --muted, ), - --semantic-colors: ( - --accent: --blue, - --focus: --yellow-static, - - --bg-l2: --base --50, - --bg-l1: --base --100, - --bg-base: --base --200, - - --border-mute: --base --200, - --border: --base --300, - --border-strong: --base --400, - - --text-disabled: --base --500, - --text-mute-more: --base --600, - --text-mute: --base --700, - --text: --base --800, - --heading: --base --900, + --semantic: ( + --accent: --blue, + --positive: --green, + --negative: --red, + --warning: --yellow, + + --accent-static: --blue-static, + --positive-static: --green-static, + --negative-static: --red-static, + --warning-static: --yellow-static, + + --bg-l2: --base --50, + --bg-l1: --base --100, + --bg-base: --base --200, + + --border-mute: --base --200, + --border: --base --300, + --border-strong: --base --400, + + --text-disabled: --base --500, + --text-mute-more: --base --600, + --text-mute: --base --700, + --text: --base --800, + --heading: --base --900, ), ) !default; @@ -143,23 +178,30 @@ $theme-dark: ( --yellow: blend.lch(68% 50 80) --colors --muted, ), - --semantic-colors: ( - --accent: --blue, - --focus: --yellow-static, - - --bg-base: --base --50, - --bg-l1: --base --75, - --bg-l2: --base --100, - - --border-mute: --base --200, - --border: --base --300, - --border-strong: --base --400, - - --text-disabled: --base --500, - --text-mute-more: --base --600, - --text-mute: --base --700, - --text: --base --800, - --heading: --base --900, + --semantic: ( + --accent: --blue, + --positive: --green, + --negative: --red, + --warning: --yellow, + + --accent-static: --blue-static, + --positive-static: --green-static, + --negative-static: --red-static, + --warning-static: --yellow-static, + + --bg-base: --base --50, + --bg-l1: --base --75, + --bg-l2: --base --100, + + --border-mute: --base --200, + --border: --base --300, + --border-strong: --base --400, + + --text-disabled: --base --500, + --text-mute-more: --base --600, + --text-mute: --base --700, + --text: --base --800, + --heading: --base --900, ), ) !default; diff --git a/src/_declare-vars.scss b/src/_declare-vars.scss index 2084905..4574333 100644 --- a/src/_declare-vars.scss +++ b/src/_declare-vars.scss @@ -100,7 +100,7 @@ --thin: 1px, ), - --rounding: 3px, + --rounding: 4px, --focus: ( --outline-width: 3px, @@ -176,6 +176,20 @@ // +@each $palette-name, $palette in map.get(config.$static-colors, --palettes) { + @include iro.props-store(( + --colors: ( + #{$palette-name}-static: fn.palette( + $palette, + map.get(config.$static-colors, --contrasts), + 1, + false, + map.get(config.$static-colors, --base), + ), + ), + )); +} + @each $theme-name, $theme in config.$themes { $tree: if($theme-name == config.$theme-default, iro.$props-default-tree, $theme-name); @@ -190,21 +204,14 @@ $base-color, map.get($theme, --contrasts, $contrasts), map.get($theme, --ranges, $ranges), - nth(map.get($theme, --palettes, --base), 1), + true, + list.nth(map.get($theme, --palettes, --base), 1), ), ), ), $tree); - - @if $theme-name == config.$theme-default { - @include iro.props-store(( - --colors: ( - #{$palette-name}-static: iro.props-get-static(--colors $palette-name, $tree), - ), - ), $tree); - } } - @each $color, $ref in map.get($theme, --semantic-colors) { + @each $color, $ref in map.get($theme, --semantic) { @include iro.props-store(( --colors: ( $color: fn.color($ref), diff --git a/src/_functions.scss b/src/_functions.scss index 7c0ded3..8553833 100644 --- a/src/_functions.scss +++ b/src/_functions.scss @@ -107,21 +107,29 @@ @return $result; } -@function palette($base-color, $contrasts, $range: 1, $reference-color: $base-color) { +@function palette($base-color, $contrasts, $range: 1, $desaturate: true, $reference-color: $base-color) { $palette: (); @if list.nth(list.nth($contrasts, 1), 2) > list.nth(list.nth($contrasts, list.length($contrasts)), 2) { $contrasts: iro.fn-list-reverse($contrasts); } + $reference-lightness: blend.lightness($reference-color); $i: -100%; @while $i <= 100% { - $palette: list.append($palette, blend.scale($base-color, $l: $range * $i, $c: -.8 * math.abs($i))); - $i: $i + config.$palette-precision; + $c: if($desaturate, .8 * if($reference-lightness >= 50%, -1 * math.clamp(0%, $i, 100%), math.clamp(-100%, $i, 0%)), 0%); + $palette: list.append($palette, blend.scale($base-color, $l: $range * $i, $c: $c)); + $i: $i + config.$palette-precision; } - @return multi-contrast($base-color, $palette, $contrasts, $reference-color); + $palette: multi-contrast($base-color, $palette, $contrasts, $reference-color); + + @each $key, $color in $palette { + $palette: map.set($palette, #{$key}-text, blend.contrast($color)) + } + + @return $palette; } @function px-to-em($size, $base: iro.$vars-root-size) { diff --git a/src/_objects.scss b/src/_objects.scss index aaace92..68bf3a7 100644 --- a/src/_objects.scss +++ b/src/_objects.scss @@ -1,9 +1,9 @@ -// @use 'objects/icon'; -// @use 'objects/emoji'; +@use 'objects/icon'; +@use 'objects/emoji'; @use 'objects/heading'; @use 'objects/divider'; -// @use 'objects/badge'; -// @use 'objects/button'; +@use 'objects/badge'; +@use 'objects/button'; // @use 'objects/text-field'; // @use 'objects/field-label'; // @use 'objects/radio'; diff --git a/src/_scopes.scss b/src/_scopes.scss index fc1f89d..6df12e1 100644 --- a/src/_scopes.scss +++ b/src/_scopes.scss @@ -1,6 +1,6 @@ @use 'scopes/links'; @use 'scopes/code'; -// @use 'scopes/blockquotes'; -// @use 'scopes/lists'; +@use 'scopes/blockquotes'; +@use 'scopes/lists'; @use 'scopes/headings'; // @use 'scopes/tables'; diff --git a/src/_utils.scss b/src/_utils.scss index e551136..8ba2581 100644 --- a/src/_utils.scss +++ b/src/_utils.scss @@ -125,28 +125,28 @@ $dirs: ( } } -@include iro.bem-utility('w-100') { - width: 100%; +@include iro.bem-utility('is-100') { + inline-size: 100%; } -@include iro.bem-utility('w-75') { - width: 75%; +@include iro.bem-utility('is-75') { + inline-size: 75%; } -@include iro.bem-utility('w-50') { - width: 50%; +@include iro.bem-utility('is-50') { + inline-size: 50%; } -@include iro.bem-utility('w-25') { - width: 25%; +@include iro.bem-utility('is-25') { + inline-size: 25%; } -@include iro.bem-utility('w-1px') { - width: 1px; +@include iro.bem-utility('is-1px') { + inline-size: 1px; } -@include iro.bem-utility('w-0') { - width: 0; +@include iro.bem-utility('is-0') { + inline-size: 0; } @include iro.bem-utility('elp') { diff --git a/src/layouts/_container.scss b/src/layouts/_container.scss index b28eea2..fcc4837 100644 --- a/src/layouts/_container.scss +++ b/src/layouts/_container.scss @@ -29,9 +29,9 @@ @include iro.bem-layout(iro.props-namespace()) { @each $size in 'narrow-125' 'narrow' 'narrow-75' { @include iro.bem-modifier($size) { - max-width: fn.dim(--#{$size}); - margin-right: auto; - margin-left: auto; + max-inline-size: fn.dim(--#{$size}); + margin-right: auto; + margin-left: auto; } } diff --git a/src/layouts/_media.scss b/src/layouts/_media.scss index fa90975..953c8c0 100644 --- a/src/layouts/_media.scss +++ b/src/layouts/_media.scss @@ -62,9 +62,9 @@ flex: 0 0 auto; @include iro.bem-modifier('main') { - flex-shrink: 1; - width: 100%; - min-width: 0; + flex-shrink: 1; + inline-size: 100%; + min-inline-size: 0; } } } diff --git a/src/layouts/_message-group.scss b/src/layouts/_message-group.scss index f977b61..235e242 100644 --- a/src/layouts/_message-group.scss +++ b/src/layouts/_message-group.scss @@ -26,16 +26,16 @@ gap: 0 fn.dim(--spacing-x); @include iro.bem-elem('avatar') { - grid-area: avatar; - height: 0; + grid-area: avatar; + block-size: 0; } @include iro.bem-elem('message') { - grid-column: message; - position: relative; - box-sizing: border-box; - min-width: 0; - max-width: 100%; + grid-column: message; + position: relative; + box-sizing: border-box; + min-inline-size: 0; + max-inline-size: 100%; &::before { content: ''; diff --git a/src/objects/_badge.scss b/src/objects/_badge.scss new file mode 100644 index 0000000..0d95751 --- /dev/null +++ b/src/objects/_badge.scss @@ -0,0 +1,194 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$themes: accent positive negative warning; + +@include iro.props-namespace('badge') { + @include iro.props-store(( + --dims: ( + --pad-b: fn.global-dim(--size --100), + --pad-i: fn.global-dim(--size --150), + --pad-i-pill: fn.global-dim(--size --200), + --rounding: fn.global-dim(--rounding), + --font-size: fn.global-dim(--font-size --100), + + --50: ( + --pad-b: fn.global-dim(--size --50), + --pad-i: fn.global-dim(--size --115), + --pad-i-pill: fn.global-dim(--size --150), + --font-size: fn.global-dim(--font-size --75), + ), + --200: ( + --pad-b: fn.global-dim(--size --125), + --pad-i: fn.global-dim(--size --175), + --pad-i-pill: fn.global-dim(--size --225), + --font-size: fn.global-dim(--font-size --150), + ), + --300: ( + --pad-b: fn.global-dim(--size --160), + --pad-i: fn.global-dim(--size --225), + --pad-i-pill: fn.global-dim(--size --300), + --font-size: fn.global-dim(--font-size --200), + ), + ), + --colors: ( + --bg: fn.global-color(--heading), + --label: fn.global-color(--bg-l2), + --hover: ( + --bg: fn.global-color(--text), + ), + --active: ( + --bg: fn.global-color(--text), + ), + --key-focus: ( + --bg: fn.global-color(--base --50), + --label: fn.global-color(--heading), + --border: fn.global-color(--yellow-static --400), + ), + + --quiet: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--heading), + --hover: ( + --bg: fn.global-color(--border), + ), + --active: ( + --bg: fn.global-color(--border-strong), + ), + ), + ), + )); + + @each $theme in $themes { + @include iro.props-store(( + --colors: ( + --#{$theme}: ( + --bg: fn.global-color(--#{$theme} --800), + --label: fn.global-color(--#{$theme} --800-text), + --hover: ( + --bg: fn.global-color(--#{$theme} --900), + ), + --active: ( + --bg: fn.global-color(--#{$theme} --900), + ), + ), + + --#{$theme}-quiet: ( + --bg: fn.global-color(--#{$theme} --200), + --label: fn.global-color(--#{$theme} --1100), + --hover: ( + --bg: fn.global-color(--#{$theme} --300), + ), + --active: ( + --bg: fn.global-color(--#{$theme} --300), + ), + ) + ), + )); + } + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + color: fn.color(--label); + font-size: fn.dim(--font-size); + line-height: fn.global-dim(--font --standard --line-height); + text-align: center; + text-decoration: none; + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--hover --bg); + } + + &:active { + background-color: fn.color(--active --bg); + } + } + + @include iro.bem-modifier('quiet') { + background-color: fn.color(--quiet --bg); + color: fn.color(--quiet --label); + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--quiet --hover --bg); + } + + &:active { + background-color: fn.color(--quiet --active --bg); + } + } + } + + @each $theme in $themes { + @include iro.bem-modifier($theme) { + background-color: fn.color(--#{$theme} --bg); + color: fn.color(--#{$theme} --label); + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--#{$theme} --hover --bg); + } + + &:active { + background-color: fn.color(--#{$theme} --active --bg); + } + } + + @include iro.bem-modifier('quiet') { + background-color: fn.color(--#{$theme}-quiet --bg); + color: fn.color(--#{$theme}-quiet --label); + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--#{$theme}-quiet --hover --bg); + } + + &:active { + background-color: fn.color(--#{$theme}-quiet --active --bg); + } + } + } + } + } + + &:link, + &:visited, + &:enabled { + &:focus-visible { + background-color: fn.color(--key-focus --bg); + box-shadow: 0 0 0 fn.global-dim(--border --thick) fn.color(--key-focus --border); + color: fn.color(--key-focus --label); + } + } + + @include iro.bem-modifier('pill') { + padding-inline: fn.dim(--pad-i-pill); + border-radius: 10em; + } + + @each $size in '50' '200' '300' { + @include iro.bem-modifier($size) { + padding-block: fn.dim(--#{$size} --pad-b); + padding-inline: fn.dim(--#{$size} --pad-i); + font-size: fn.dim(--#{$size} --font-size); + + @include iro.bem-modifier('pill') { + padding-inline: fn.dim(--#{$size} --pad-i-pill); + } + } + } + } +} diff --git a/src/objects/_button.scss b/src/objects/_button.scss new file mode 100644 index 0000000..d3588f6 --- /dev/null +++ b/src/objects/_button.scss @@ -0,0 +1,173 @@ +@use 'sass:list'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$themes: primary accent positive negative warning; + +@mixin button-variant($theme: null) { + $key: if($theme == null, (), --#{$theme}); + + &:link, + &:visited, + &:enabled { + border-color: fn.color(list.join($key, --bg)); + background-color: fn.color(list.join($key, --bg)); + color: fn.color(list.join($key, --label)); + } + + @include iro.bem-modifier('outline') { + &:link, + &:visited, + &:enabled { + background-color: transparent; + color: fn.color(list.join($key, --outline-label)); + } + } + + &:link, + &:visited, + &:enabled { + &:hover { + border-color: fn.color(list.join($key, --hover --bg)); + background-color: fn.color(list.join($key, --hover --bg)); + color: fn.color(list.join($key, --hover --label)); + } + + &:active { + border-color: fn.color(list.join($key, --active --bg)); + background-color: fn.color(list.join($key, --active --bg)); + color: fn.color(list.join($key, --active --label)); + } + } +} + +@include iro.props-namespace('button') { + @include iro.props-store(( + --dims: ( + --line-height: 1.4, + --pad-i: fn.global-dim(--size --225), + --pad-b: fn.global-dim(--size --65), + --rounding: 10em, + + --lg: ( + --pad-i: fn.global-dim(--size --300), + --pad-b: fn.global-dim(--size --100), + ), + ), + --colors: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--text), + --outline-label: fn.global-color(--text), + + --hover: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--heading), + ), + --active: ( + --bg: fn.global-color(--border-strong), + --label: fn.global-color(--heading), + ), + --disabled: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--text-disabled), + ), + --key-focus: ( + --bg: fn.global-color(--base --50), + --label: fn.global-color(--heading), + --border: fn.global-color(--yellow-static --400), + ), + + --primary: ( + --bg: fn.global-color(--base --800), + --label: fn.global-color(--base --800-text), + --outline-label: fn.global-color(--text), + + --hover: ( + --bg: fn.global-color(--base --900), + --label: fn.global-color(--base --900-text), + ), + --active: ( + --bg: fn.global-color(--base --900), + --label: fn.global-color(--base --900-text), + ), + ), + ), + )); + + @each $theme in $themes { + @if $theme != primary { + @include iro.props-store(( + --colors: ( + --#{$theme}: ( + --bg: fn.global-color(--#{$theme} --900), + --label: fn.global-color(--#{$theme} --900-text), + --outline-label: fn.global-color(--#{$theme} --1000), + + --hover: ( + --bg: fn.global-color(--#{$theme} --1000), + --label: fn.global-color(--#{$theme} --1000-text), + ), + --active: ( + --bg: fn.global-color(--#{$theme} --1100), + --label: fn.global-color(--#{$theme} --1100-text), + ), + ), + ), + )); + } + } + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border: 2px solid transparent; + border-radius: fn.dim(--rounding); + border-color: fn.color(--disabled --bg); + background-color: fn.color(--disabled --bg); + color: fn.color(--disabled --label); + font-weight: 500; + line-height: fn.dim(--line-height); + text-align: center; + text-decoration: none; + vertical-align: top; + + @include iro.bem-modifier('block') { + display: block; + } + + @include iro.bem-modifier('outline') { + background-color: transparent; + box-shadow: none; + } + + @include iro.bem-modifier('lg') { + padding-block: fn.dim(--lg --pad-b); + padding-inline: fn.dim(--lg --pad-i); + } + + @include button-variant(); + + @each $theme in $themes { + @include iro.bem-modifier($theme) { + @include button-variant($theme); + } + } + + &:link, + &:visited, + &:enabled { + &:focus-visible { + border-color: fn.color(--key-focus --border); + background-color: fn.color(--key-focus --bg); + color: fn.color(--key-focus --label); + } + } + + @include iro.bem-modifier('round') { + inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-b)); + padding-inline: 0; + border-radius: 100em; + } + } +} diff --git a/src/objects/_divider.scss b/src/objects/_divider.scss index 3332331..5e80de4 100644 --- a/src/objects/_divider.scss +++ b/src/objects/_divider.scss @@ -42,7 +42,7 @@ @include iro.props-store(( --colors: ( $color: ( - --bg: fn.global-color($color --700), + --bg: fn.global-color($color --800), --label: fn.global-color($color --1000), ) ), @@ -54,7 +54,7 @@ display: flex; flex-direction: row; align-items: center; - height: 1em; + block-size: 1em; margin-block: fn.dim(--margin-b); color: fn.color(--strong --label); font-size: fn.dim(--strong --label-font-size); @@ -67,8 +67,8 @@ &::after { content: ''; flex: 1 1 auto; - width: 100%; - height: fn.dim(--strong --border); + inline-size: 100%; + block-size: fn.dim(--strong --border); background-color: fn.color(--strong --bg); } @@ -82,8 +82,8 @@ @include iro.bem-modifier('vertical') { align-self: stretch; - width: 1px; - height: auto; + inline-size: 1px; + block-size: auto; margin-block: 0; background-color: fn.color(--faint --bg); @@ -100,7 +100,7 @@ &::before, &::after { - height: fn.dim(--medium --border); + block-size: fn.dim(--medium --border); background-color: fn.color(--medium --bg); } } @@ -112,7 +112,7 @@ &::before, &::after { - height: fn.dim(--faint --border); + block-size: fn.dim(--faint --border); background-color: fn.color(--faint --bg); } } diff --git a/src/objects/_emoji.scss b/src/objects/_emoji.scss new file mode 100644 index 0000000..d8d1289 --- /dev/null +++ b/src/objects/_emoji.scss @@ -0,0 +1,73 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use 'sass:math'; + +@use 'icon'; + +@include iro.props-namespace('emoji') { + @include iro.props-store(( + --dims: ( + --size: calc(1 / 14 * 18em), + --pad: .3em, + --rounding: fn.global-dim(--rounding), + --zoom: 3, + --valign: -.25em, + + --125: ( + --size: calc(1 / 14 * 23em), + --valign: -.45em, + ), + + --150: ( + --size: calc(1 / 14 * 28em), + --valign: -.65em, + ), + + --200: ( + --size: calc(1 / 14 * 38em), + --valign: -1em, + ) + ), + --colors: ( + --bg: fn.global-color(--border-mute), + ) + )); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + inline-size: calc(fn.dim(--size)); + block-size: calc(fn.dim(--size)); + margin: calc(-1 * fn.dim(--pad)); + padding: calc(fn.dim(--pad)); + vertical-align: fn.dim(--valign); + object-fit: contain; + + @include iro.bem-modifier('icon') { + margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--size) - fn.foreign-dim(--icon, --size))); + vertical-align: fn.foreign-dim(--icon, --valign); + } + + @each $size in '125' '150' '200' { + @include iro.bem-modifier($size) { + inline-size: fn.dim(--#{$size} --size); + block-size: fn.dim(--#{$size} --size); + vertical-align: fn.dim(--#{$size} --valign); + + @include iro.bem-modifier('icon') { + margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--#{$size} --size) - fn.foreign-dim(--icon, --size))); + } + } + } + + @include iro.bem-modifier('zoomable') { + transition: transform .2s ease, background-color .2s ease; + border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom)); + + &:hover { + transform: scale(fn.dim(--zoom)); + background-color: fn.color(--bg); + } + } + } +} diff --git a/src/objects/_icon.scss b/src/objects/_icon.scss new file mode 100644 index 0000000..1491dd9 --- /dev/null +++ b/src/objects/_icon.scss @@ -0,0 +1,26 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('icon') { + @include iro.props-store(( + --dims: ( + --stroke: 1.5px, + --size: calc(1 / 14 * 16em), + --valign: -.2em, + ) + )); + + @include iro.bem-object(iro.props-namespace()) { + display: inline; + inline-size: fn.dim(--size); + block-size: fn.dim(--size); + stroke-width: fn.dim(--stroke); + stroke-linecap: round; + stroke-linejoin: round; + vertical-align: fn.dim(--valign); + + @include iro.bem-modifier('block') { + display: block; + } + } +} diff --git a/src/objects/_palette.scss b/src/objects/_palette.scss index 9ecdfac..19f282f 100644 --- a/src/objects/_palette.scss +++ b/src/objects/_palette.scss @@ -7,8 +7,8 @@ @include iro.props-namespace('palette') { @include iro.bem-object(iro.props-namespace()) { - display: flex; - height: 3em; + display: flex; + block-size: 3em; @include iro.bem-elem('item') { flex: 1 1 auto; @@ -40,5 +40,23 @@ } } } + + @include iro.bem-modifier('static') { + @each $palette-name, $palette in map.get(config.$static-colors, --palettes) { + $contrasts: map.get(config.$static-colors, --contrasts); + + @include iro.bem-modifier(string.slice($palette-name, 3)) { + @include iro.bem-elem('item') { + @for $i from 1 through list.length($contrasts) { + $key: list.nth(map.keys($contrasts), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color(#{$palette-name}-static $key); + } + } + } + } + } + } } } diff --git a/src/scopes/_blockquotes.scss b/src/scopes/_blockquotes.scss new file mode 100644 index 0000000..f6a13fe --- /dev/null +++ b/src/scopes/_blockquotes.scss @@ -0,0 +1,34 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('blockquotes') { + @include iro.props-store(( + --dims: ( + --indent: fn.global-dim(--list --indent), + --margin-bs: fn.global-dim(--paragraph --margin-bs), + --border: fn.global-dim(--border --thick), + + --compact: ( + --indent: fn.global-dim(--list --compact-indent), + ), + ), + --colors: ( + --border: fn.global-color(--border), + ) + )); + + @include iro.bem-scope(iro.props-namespace()) { + blockquote { + margin-block: fn.dim(--margin-bs); + margin-inline: 1px 0; + padding-inline-start: calc(fn.dim(--indent) - fn.dim(--border)); + border-inline-start: fn.dim(--border) solid fn.color(--border); + } + + @include iro.bem-modifier('compact') { + blockquote { + padding-inline-start: calc(fn.dim(--compact --indent) - fn.dim(--border)); + } + } + } +} diff --git a/src/scopes/_code.scss b/src/scopes/_code.scss index a6905a3..0ff3a2c 100644 --- a/src/scopes/_code.scss +++ b/src/scopes/_code.scss @@ -23,7 +23,7 @@ ), --block: ( --fg: fn.global-color(--text), - --bg: fn.global-color(--bg-l2), + --bg: fn.global-color(--base --50), ) ) )); diff --git a/src/scopes/_links.scss b/src/scopes/_links.scss index d0c47ef..a9de8b5 100644 --- a/src/scopes/_links.scss +++ b/src/scopes/_links.scss @@ -4,10 +4,11 @@ @include iro.props-namespace('links') { @include iro.props-store(( --dims: ( + --rounding: fn.global-dim(--rounding), --underline: fn.global-dim(--border --thin), --hover: ( - --underline: fn.global-dim(--border --medium), + --underline: fn.global-dim(--border --medium), ) ), --colors: ( @@ -15,7 +16,7 @@ --idle: ( --text: fn.global-color(--accent --1000), - --underline: fn.global-color(--accent --1000), + --underline: fn.global-color(--accent --600), --hover: ( --text: fn.global-color(--accent --1200), @@ -24,16 +25,16 @@ --visited: ( --text: fn.global-color(--purple --1000), - --underline: fn.global-color(--purple --1000), + --underline: fn.global-color(--purple --600), --hover: ( --text: fn.global-color(--purple --1200), ), ), - --focus: ( + --key-focus: ( --bg: fn.global-color(--yellow-static --400), - --text: #000, + --text: fn.global-color(--yellow-static --400-text), ) ) )); @@ -41,7 +42,7 @@ @include iro.bem-scope(iro.props-namespace()) { :link, :visited { - border-radius: .5px; + border-radius: fn.dim(--rounding); color: currentColor; text-decoration: underline; text-decoration-color: fn.color(--underline); @@ -53,13 +54,13 @@ text-decoration-skip-ink: none; } - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: fn.color(--focus --bg); - color: fn.color(--focus --text); - text-decoration: none; - border-block-end: fn.dim(--hover --underline) solid currentColor; - } + &:focus-visible { + background-color: fn.color(--key-focus --bg); + box-shadow: 0 0 0 fn.global-dim(--border --thick) fn.color(--key-focus --bg); + color: fn.color(--key-focus --text); + text-decoration: underline; + text-decoration-thickness: fn.dim(--hover --underline); + text-decoration-skip-ink: none; } } diff --git a/src/scopes/_lists.scss b/src/scopes/_lists.scss new file mode 100644 index 0000000..bad9731 --- /dev/null +++ b/src/scopes/_lists.scss @@ -0,0 +1,66 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('lists') { + @include iro.props-store(( + --dims: ( + --indent: calc(fn.global-dim(--list --indent) + 1em), + --margin-bs: fn.global-dim(--paragraph --margin-bs), + + --compact: ( + --indent: fn.global-dim(--list --compact-indent), + ), + ), + --colors: ( + --border: fn.global-color(--border-mute), + ) + )); + + @include iro.bem-scope(iro.props-namespace()) { + ul, + ol { + margin-block-start: fn.dim(--margin-bs); + padding-inline-start: fn.dim(--indent); + + ul, + ol { + margin-block-start: 0; + } + } + + ul { + list-style: disc; + } + + ol { + list-style: decimal; + } + + dl { + margin-block: fn.dim(--margin-bs) 0; + margin-inline: 0; + padding: 0; + } + + dt { + color: fn.global-color(--heading); + font-weight: bold; + } + + dd { + margin-block: 0; + margin-inline: fn.dim(--indent) 0; + } + + @include iro.bem-modifier('compact') { + ul, + ol { + padding-inline-start: calc(fn.dim(--compact --indent) - 3px); + } + + dd { + margin-inline-start: calc(fn.dim(--compact --indent) - 3px); + } + } + } +} -- cgit v1.2.3-70-g09d2