From 50f6acc739f24bfa2ca080d08e90d82f8fa83543 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 17 Oct 2024 16:45:00 +0200 Subject: Revamped variable management --- src_old/.old/layouts/_message-group.scss | 139 ++++++++++++ src_old/.old/objects/_dialog.scss | 152 +++++++++++++ src_old/.old/objects/_icon-nav.scss | 20 ++ src_old/.old/objects/_list-group.scss | 61 +++++ src_old/.old/objects/_message.scss | 51 +++++ src_old/.old/objects/_overflow-button.scss | 243 ++++++++++++++++++++ src_old/_base.scss | 145 ++++++++++++ src_old/_config.scss | 234 ++++++++++++++++++++ src_old/_functions.scss | 135 ++++++++++++ src_old/_layouts.scss | 8 + src_old/_mixins.scss | 38 ++++ src_old/_objects.scss | 28 +++ src_old/_scopes.scss | 6 + src_old/_themes.scss | 86 ++++++++ src_old/_utils.scss | 233 ++++++++++++++++++++ src_old/_vars.scss | 298 +++++++++++++++++++++++++ src_old/functions/colors/_apca.scss | 127 +++++++++++ src_old/functions/colors/_index.scss | 1 + src_old/index.scss | 10 + src_old/layouts/_button-group.scss | 16 ++ src_old/layouts/_card-list.scss | 96 ++++++++ src_old/layouts/_container.scss | 45 ++++ src_old/layouts/_flex.scss | 27 +++ src_old/layouts/_form.scss | 62 ++++++ src_old/layouts/_media.scss | 47 ++++ src_old/layouts/_overflow.scss | 9 + src_old/objects/_action-button.scss | 343 +++++++++++++++++++++++++++++ src_old/objects/_alert.scss | 43 ++++ src_old/objects/_avatar.scss | 167 ++++++++++++++ src_old/objects/_backdrop.scss | 26 +++ src_old/objects/_badge.scss | 300 +++++++++++++++++++++++++ src_old/objects/_button.scss | 301 +++++++++++++++++++++++++ src_old/objects/_card.scss | 170 ++++++++++++++ src_old/objects/_checkbox.scss | 261 ++++++++++++++++++++++ src_old/objects/_divider.scss | 203 +++++++++++++++++ src_old/objects/_emoji.scss | 73 ++++++ src_old/objects/_field-label.scss | 86 ++++++++ src_old/objects/_heading.scss | 118 ++++++++++ src_old/objects/_icon.scss | 26 +++ src_old/objects/_lightbox.scss | 313 ++++++++++++++++++++++++++ src_old/objects/_menu.scss | 137 ++++++++++++ src_old/objects/_palette.scss | 62 ++++++ src_old/objects/_popover.scss | 51 +++++ src_old/objects/_radio.scss | 185 ++++++++++++++++ src_old/objects/_side-nav.scss | 122 ++++++++++ src_old/objects/_status-indicator.scss | 39 ++++ src_old/objects/_switch.scss | 222 +++++++++++++++++++ src_old/objects/_table.scss | 168 ++++++++++++++ src_old/objects/_text-field.scss | 213 ++++++++++++++++++ src_old/scopes/_blockquotes.scss | 34 +++ src_old/scopes/_code.scss | 59 +++++ src_old/scopes/_headings.scss | 116 ++++++++++ src_old/scopes/_links.scss | 143 ++++++++++++ src_old/scopes/_lists.scss | 66 ++++++ src_old/scopes/_tables.scss | 115 ++++++++++ 55 files changed, 6479 insertions(+) create mode 100644 src_old/.old/layouts/_message-group.scss create mode 100644 src_old/.old/objects/_dialog.scss create mode 100644 src_old/.old/objects/_icon-nav.scss create mode 100644 src_old/.old/objects/_list-group.scss create mode 100644 src_old/.old/objects/_message.scss create mode 100644 src_old/.old/objects/_overflow-button.scss create mode 100644 src_old/_base.scss create mode 100644 src_old/_config.scss create mode 100644 src_old/_functions.scss create mode 100644 src_old/_layouts.scss create mode 100644 src_old/_mixins.scss create mode 100644 src_old/_objects.scss create mode 100644 src_old/_scopes.scss create mode 100644 src_old/_themes.scss create mode 100644 src_old/_utils.scss create mode 100644 src_old/_vars.scss create mode 100644 src_old/functions/colors/_apca.scss create mode 100644 src_old/functions/colors/_index.scss create mode 100644 src_old/index.scss create mode 100644 src_old/layouts/_button-group.scss create mode 100644 src_old/layouts/_card-list.scss create mode 100644 src_old/layouts/_container.scss create mode 100644 src_old/layouts/_flex.scss create mode 100644 src_old/layouts/_form.scss create mode 100644 src_old/layouts/_media.scss create mode 100644 src_old/layouts/_overflow.scss create mode 100644 src_old/objects/_action-button.scss create mode 100644 src_old/objects/_alert.scss create mode 100644 src_old/objects/_avatar.scss create mode 100644 src_old/objects/_backdrop.scss create mode 100644 src_old/objects/_badge.scss create mode 100644 src_old/objects/_button.scss create mode 100644 src_old/objects/_card.scss create mode 100644 src_old/objects/_checkbox.scss create mode 100644 src_old/objects/_divider.scss create mode 100644 src_old/objects/_emoji.scss create mode 100644 src_old/objects/_field-label.scss create mode 100644 src_old/objects/_heading.scss create mode 100644 src_old/objects/_icon.scss create mode 100644 src_old/objects/_lightbox.scss create mode 100644 src_old/objects/_menu.scss create mode 100644 src_old/objects/_palette.scss create mode 100644 src_old/objects/_popover.scss create mode 100644 src_old/objects/_radio.scss create mode 100644 src_old/objects/_side-nav.scss create mode 100644 src_old/objects/_status-indicator.scss create mode 100644 src_old/objects/_switch.scss create mode 100644 src_old/objects/_table.scss create mode 100644 src_old/objects/_text-field.scss create mode 100644 src_old/scopes/_blockquotes.scss create mode 100644 src_old/scopes/_code.scss create mode 100644 src_old/scopes/_headings.scss create mode 100644 src_old/scopes/_links.scss create mode 100644 src_old/scopes/_lists.scss create mode 100644 src_old/scopes/_tables.scss (limited to 'src_old') diff --git a/src_old/.old/layouts/_message-group.scss b/src_old/.old/layouts/_message-group.scss new file mode 100644 index 0000000..235e242 --- /dev/null +++ b/src_old/.old/layouts/_message-group.scss @@ -0,0 +1,139 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +// @use '../objects/message'; + +@include iro.props-namespace('message-group') { + @include iro.props-store(( + --dims: ( + --spacing-x: fn.global-dim(--size --225), + --spacing-y: fn.global-dim(--size --150), + --arrow-size: fn.global-dim(--size --100), + + --compact: ( + --spacing-x: fn.global-dim(--size --225), + --spacing-y: fn.global-dim(--size --50), + ) + ) + )); + + @include iro.bem-layout(iro.props-namespace()) { + display: grid; + grid-template-columns: auto 1fr; + grid-auto-rows: auto; + grid-template-areas: 'avatar message' 'avatar .'; + align-items: flex-start; + gap: 0 fn.dim(--spacing-x); + + @include iro.bem-elem('avatar') { + grid-area: avatar; + block-size: 0; + } + + @include iro.bem-elem('message') { + grid-column: message; + position: relative; + box-sizing: border-box; + min-inline-size: 0; + max-inline-size: 100%; + + &::before { + content: ''; + display: none; + position: absolute; + top: 0; + left: calc(-1 * fn.dim(--arrow-size)); + border: fn.dim(--arrow-size) solid fn.global-color(--bg-l2); + border-bottom-color: transparent; + border-left-color: transparent; + } + + @include iro.bem-next-twin-elem { + margin-top: fn.dim(--spacing-y); + } + } + + @include iro.bem-modifier('right') { + @include iro.bem-elem('message') { + &::before { + right: calc(-1 * fn.dim(--arrow-size)); + left: auto; + border-right-color: transparent; + border-left-color: fn.global-color(--bg-l2); + } + } + } + + @include iro.bem-modifier('compact') { + gap: 0 fn.dim(--compact --spacing-x); + + @include iro.bem-modifier('left') { + justify-items: start; + } + + @include iro.bem-modifier('right') { + justify-items: end; + } + + @include iro.bem-elem('message') { + @include iro.bem-next-twin-elem { + margin-top: fn.dim(--compact --spacing-y); + } + } + } + + @include iro.bem-modifier('right') { + grid-template-columns: 1fr auto; + grid-template-areas: 'message avatar' '. avatar'; + } + + @include iro.bem-modifier('no-avatar') { + grid-template-columns: 1fr; + grid-template-areas: 'message'; + + @include iro.bem-elem('avatar') { + display: none; + } + } + + @include iro.bem-modifier('arrow') { + @include iro.bem-elem('message') { + &::before { + display: block; + } + + @include iro.bem-next-twin-elem { + &::before { + display: none; + } + } + } + } + + & + & { + @include iro.bem-modifier('merge') { + margin-top: fn.dim(--spacing-y); + + @include iro.bem-elem('avatar') { + visibility: hidden; + } + + @include iro.bem-modifier('compact') { + margin-top: fn.dim(--compact --spacing-y); + } + + @include iro.bem-elem('merge-hide') { + display: none; + } + + @include iro.bem-modifier('arrow') { + @include iro.bem-elem('message') { + &::before { + display: none; + } + } + } + } + } + } +} diff --git a/src_old/.old/objects/_dialog.scss b/src_old/.old/objects/_dialog.scss new file mode 100644 index 0000000..9333ce6 --- /dev/null +++ b/src_old/.old/objects/_dialog.scss @@ -0,0 +1,152 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('dialog') { + @include iro.props-store(( + --dims: ( + --width-sm: iro.fn-px-to-rem(500px), + --width-md: iro.fn-px-to-rem(800px), + --width-lg: iro.fn-px-to-rem(1100px), + --rounding: 4px, + --border: 1px, + + --header: ( + --pad-x: fn.global-dim(--size --75), + --pad-y: fn.global-dim(--size --75), + ), + + --sidebar: ( + --pad-x: fn.global-dim(--size --75), + --pad-y: fn.global-dim(--size --75), + ), + + --body: ( + --pad-x: fn.global-dim(--size --200), + --pad-y: fn.global-dim(--size --200), + ) + ), + ), 'dims'); + + @include iro.props-store(( + --dims: ( + --pad-x: fn.global-dim(--size --300), + --pad-y: fn.global-dim(--size --300), + ), + ), 'md'); + + @include iro.props-store(( + --colors: ( + --border: fn.global-color(--border --stable), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: grid; + grid-template-rows: auto auto 1fr auto auto; + grid-template-columns: auto 1fr; + grid-template-areas: + 'sidebar-header header' + 'sidebar top' + 'sidebar body' + 'sidebar bottom' + 'sidebar footer'; + position: relative; + box-sizing: border-box; + flex: 0 0 auto; + width: 100%; + max-width: fn.dim(--width-md); + margin: 0 auto; + overflow: hidden; + border-radius: fn.dim(--rounding); + background-clip: padding-box; + background-color: fn.global-color(--bg); + color: fn.global-color(--fg); + + @include iro.bem-modifier('sm') { + max-width: fn.dim(--width-sm); + } + + @include iro.bem-modifier('lg') { + max-width: fn.dim(--width-lg); + } + + @include iro.bem-elem('header') { + grid-area: sidebar-header / sidebar-header / header / header; + padding: fn.dim(--header --pad-y) fn.dim(--header --pad-x); + + @include iro.bem-modifier('sidebar') { + grid-area: sidebar-header; + border-right: 1px solid fn.color(--border); + + @include iro.bem-sibling-elem('header') { + grid-area: header; + } + } + } + + @include iro.bem-elem('title') { + margin-top: 0; + padding-right: calc(fn.dim(--body --pad-x) - fn.dim(--header --pad-x)); + padding-left: calc(fn.dim(--body --pad-x) - fn.dim(--header --pad-x)); + } + + @include iro.bem-elem('close-btn') { + margin-left: auto; + } + + @include iro.bem-elem('sidebar') { + grid-area: sidebar; + padding: fn.dim(--sidebar --pad-y) fn.dim(--sidebar --pad-x); + overflow: auto; + border-right: 1px solid fn.color(--border); + } + + @include iro.bem-elem('top') { + grid-area: top; + min-width: 0; + padding: fn.dim(--body --pad-y) fn.dim(--body --pad-x); + + @include iro.bem-sibling-elem('body') { + padding-top: 0; + } + } + + @include iro.bem-elem('bottom') { + grid-area: bottom; + min-width: 0; + padding: fn.dim(--body --pad-y) fn.dim(--body --pad-x); + + @include iro.bem-sibling-elem('body') { + padding-bottom: 0; + } + } + + @include iro.bem-elem('body') { + grid-area: body; + min-width: 0; + min-height: 0; + padding: fn.dim(--body --pad-y) fn.dim(--body --pad-x); + } + + @include iro.bem-elem('footer') { + grid-area: footer; + justify-content: flex-end; + padding: fn.dim(--body --pad-y) fn.dim(--body --pad-x); + } + + @include iro.bem-modifier('scrollable') { + flex-shrink: 1; + + @include iro.bem-elem('body') { + overflow: auto; + scrollbar-color: fn.global-color(--obj-lo) transparent; + } + } + + @include iro.bem-modifier('flat') { + @include iro.bem-elem('body') { + padding-top: 0; + } + } + } +} diff --git a/src_old/.old/objects/_icon-nav.scss b/src_old/.old/objects/_icon-nav.scss new file mode 100644 index 0000000..d1c6539 --- /dev/null +++ b/src_old/.old/objects/_icon-nav.scss @@ -0,0 +1,20 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('icon-nav') { + @include iro.props-store(( + --dims: ( + --spacing: fn.global-dim(--size --100), + ) + ), 'dims'); + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + align-items: center; + gap: fn.dim(--spacing); + + @include iro.bem-modifier('vertical') { + flex-direction: column; + } + } +} diff --git a/src_old/.old/objects/_list-group.scss b/src_old/.old/objects/_list-group.scss new file mode 100644 index 0000000..a346828 --- /dev/null +++ b/src_old/.old/objects/_list-group.scss @@ -0,0 +1,61 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('list-group') { + @include iro.props-store(( + --dims: ( + --pad-i: fn.global-dim(--size --175), + --pad-b: fn.global-dim(--size --125), + --rounding: fn.global-dim(--rounding), + --border: fn.global-dim(--border --thin), + ), + --colors: ( + --bg: fn.global-color(--base --75), + --border: fn.global-color(--border), + --hover: fn.global-color(--border-mute), + --active: fn.global-color(--border), + ) + )); + + @include iro.bem-object(iro.props-namespace()) { + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + + @include iro.bem-elem('item') { + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + + @include iro.bem-next-twin-elem { + border-width: 0; + border-block-start-width: fn.dim(--border); + border-style: solid; + border-color: fn.color(--border); + } + + @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { + &:hover, + &:focus-visible { + background-color: fn.color(--hover); + } + + &:active { + background-color: fn.color(--active); + } + } + } + + @include iro.bem-modifier('horizontal') { + display: flex; + + @include iro.bem-elem('item') { + flex: 1 0 auto; + + @include iro.bem-next-twin-elem { + border-block-start-width: 0; + border-inline-start-width: fn.dim(--border); + } + } + } + } +} diff --git a/src_old/.old/objects/_message.scss b/src_old/.old/objects/_message.scss new file mode 100644 index 0000000..283ce26 --- /dev/null +++ b/src_old/.old/objects/_message.scss @@ -0,0 +1,51 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('message') { + @include iro.props-store(( + --dims: ( + --bubble: ( + --pad-x: fn.global-dim(--size --200), + --pad-y: fn.global-dim(--size --150), + --rounding: 0, + + --75: ( + --pad-x: fn.global-dim(--size --150), + --pad-y: fn.global-dim(--size --85), + ), + ), + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --highlight: fn.global-color(--fg-lo), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + @include iro.bem-elem('suffix') { + margin-left: 1em; + float: right; + } + + @include iro.bem-modifier('bubble') { + padding: fn.dim(--bubble --pad-y) fn.dim(--bubble --pad-x); + border-radius: fn.dim(--bubble --rounding); + background-color: fn.global-color(--bg); + color: fn.global-color(--fg); + + @include iro.bem-elem('suffix') { + transform: translate(.2em, .2em); + } + + @include iro.bem-modifier('highlight') { + box-shadow: -3px 0 0 0 fn.color(--highlight); + } + + @include iro.bem-modifier('75') { + padding: fn.dim(--bubble --75 --pad-y) fn.dim(--bubble --75 --pad-x); + } + } + } +} diff --git a/src_old/.old/objects/_overflow-button.scss b/src_old/.old/objects/_overflow-button.scss new file mode 100644 index 0000000..b15ea1f --- /dev/null +++ b/src_old/.old/objects/_overflow-button.scss @@ -0,0 +1,243 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('overflow-button') { + @include iro.props-store(( + --dims: ( + --pad-x: calc(fn.global-dim(--size --125) - 1px), + --pad-y: calc(fn.global-dim(--size --125) - 1px), + --spacing: fn.global-dim(--size --50) + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --label: fn.global-color(--fg), + + --hover: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-lo), + ), + --active: ( + --bg: fn.global-color(--obj), + --label: fn.global-color(--fg-lo), + ), + --selected: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg), + + --hover: ( + --bg: fn.global-color(--obj), + --label: fn.global-color(--fg-lo), + ), + ), + --disabled: ( + --label: fn.global-color(--fg-hi3), + ), + --key-focus: ( + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + + --red: ( + --hover: ( + --bg: fn.global-color(--red --quiet --bg), + --label: fn.global-color(--red --quiet --fg), + ), + --active: ( + --bg: fn.global-color(--red --quiet --obj), + --label: fn.global-color(--red --quiet --fg-lo), + ), + + --selected: ( + --bg: fn.global-color(--red --quiet --bg), + --label: fn.global-color(--red --quiet --fg), + + --hover: ( + --bg: fn.global-color(--red --quiet --obj), + --label: fn.global-color(--red --quiet --fg-lo), + ), + ), + ), + + --blue: ( + --hover: ( + --bg: fn.global-color(--blue --quiet --bg), + --label: fn.global-color(--blue --quiet --fg), + ), + --active: ( + --bg: fn.global-color(--blue --quiet --obj), + --label: fn.global-color(--blue --quiet --fg-lo), + ), + + --selected: ( + --bg: fn.global-color(--blue --quiet --bg), + --label: fn.global-color(--blue --quiet --fg), + + --hover: ( + --bg: fn.global-color(--blue --quiet --obj), + --label: fn.global-color(--blue --quiet --fg-lo), + ), + ), + ), + + --green: ( + --hover: ( + --bg: fn.global-color(--green --quiet --bg), + --label: fn.global-color(--green --quiet --fg), + ), + --active: ( + --bg: fn.global-color(--green --quiet --obj), + --label: fn.global-color(--green --quiet --fg-lo), + ), + + --selected: ( + --bg: fn.global-color(--green --quiet --bg), + --label: fn.global-color(--green --quiet --fg), + + --hover: ( + --bg: fn.global-color(--green --quiet --obj), + --label: fn.global-color(--green --quiet --fg-lo), + ), + ), + ) + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + color: fn.color(--disabled --label); + + @include iro.bem-elem('outside') { + display: inline-block; + margin-right: fn.dim(--spacing); + } + + @include iro.bem-elem('inside') { + display: inline-block; + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border: 2px solid transparent; + border-radius: 100em; + line-height: 1; + text-align: center; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + + @include iro.bem-next-elem('outside') { + margin-right: 0; + margin-left: fn.dim(--spacing); + } + } + + &:link, + &:visited, + &:enabled { + color: fn.color(--label); + + &:hover { + @include iro.bem-elem('inside') { + background-color: fn.color(--hover --bg); + color: fn.color(--hover --label); + } + } + + &:active { + @include iro.bem-elem('inside') { + background-color: fn.color(--active --bg); + color: fn.color(--active --label); + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + @include iro.bem-elem('inside') { + background-color: fn.color(--hover --bg); + color: fn.color(--hover --label); + } + } + } + } + + @include iro.bem-is('selected') { + @include iro.bem-elem('inside') { + background-color: fn.color(--selected --bg); + } + + &:link, + &:visited, + &:enabled { + @include iro.bem-elem('inside') { + color: fn.color(--selected --label); + } + + &:hover, + &:active { + @include iro.bem-elem('inside') { + background-color: fn.color(--selected --hover --bg); + color: fn.color(--selected --hover --label); + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + @include iro.bem-elem('inside') { + background-color: fn.color(--selected --bg); + color: fn.color(--selected --hover --label); + } + } + } + } + } + + @each $color in 'red' 'blue' 'green' { + @include iro.bem-modifier($color) { + &:link, + &:visited, + &:enabled { + &:hover { + @include iro.bem-elem('inside') { + background-color: fn.color(--#{$color} --hover --bg); + color: fn.color(--#{$color} --hover --label); + } + } + + &:active { + @include iro.bem-elem('inside') { + background-color: fn.color(--#{$color} --active --bg); + color: fn.color(--#{$color} --active --label); + } + } + } + + @include iro.bem-is('selected') { + &:link, + &:visited, + &:enabled { + @include iro.bem-elem('inside') { + background-color: fn.color(--#{$color} --selected --bg); + color: fn.color(--#{$color} --selected --label); + } + + &:hover, + &:active { + @include iro.bem-elem('inside') { + background-color: fn.color(--#{$color} --selected --hover --bg); + color: fn.color(--#{$color} --selected --hover --label); + } + } + } + } + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + @include iro.bem-elem('inside') { + border-color: fn.color(--key-focus --border); + box-shadow: fn.color(--key-focus --shadow); + } + } + } + } +} diff --git a/src_old/_base.scss b/src_old/_base.scss new file mode 100644 index 0000000..8e4c1d9 --- /dev/null +++ b/src_old/_base.scss @@ -0,0 +1,145 @@ +@use 'sass:math'; +@use 'iro-sass/src/index' as iro; +@use 'functions' as fn; +@use 'mixins' as mx; +@use 'config'; + +html { + scrollbar-color: fn.color(--text-disabled) transparent; + accent-color: fn.color(--accent --600); +} + +html, +body { + block-size: 100%; +} + +body { + @include mx.set-font(--standard, (--size: fn.dim(--font-size --100))); + + margin: 0; + padding: 0; + background-color: fn.color(--bg-base); + color: fn.color(--text); +} + +pre, +code { + font-feature-settings: 'calt' 0, 'dlig' 1, 'ss09' 1; +} + +pre, +code { + @include mx.set-font(--mono, (--size: .93em)); +} + +pre { + margin: 0; + overflow-x: auto; + + code { + color: currentColor; + font-size: 1em; + } +} + +h1, +h2, +h3, +h4, +h5, +h6 { + @include mx.heading-medium(--md); + + margin-block: fn.dim(--heading --margin-bs) 0; + + & + & { + margin-block-start: fn.dim(--heading --margin-bs-sibling); + } +} + +p { + margin-block: fn.dim(--paragraph --margin-bs) 0; + + &:empty { + display: none; + } +} + +strong { + font-weight: bold; +} + +small { + font-size: fn.dim(--font-size --75); +} + +ul, +ol { + margin: 0; + padding: 0; + list-style: none; +} + +li { + margin: 0; + padding: 0; +} + +:focus, +:focus-visible { + outline: 0; +} + +:link, +:visited { + color: currentColor; + text-decoration: none; +} + + +button, +input, +textarea { + box-sizing: content-box; + margin: 0; + padding: 0; + border: 0; + background: none; + color: currentColor; + font-family: inherit; + font-size: 1em; + font-style: inherit; + font-weight: inherit; + line-height: inherit; + text-align: inherit; + text-transform: inherit; + appearance: none; + + &::-moz-focus-inner { + border: 0; + } +} + +input, +textarea { + &::placeholder { + opacity: 1; + color: fn.color(--text-mute); + } + + &:disabled { + color: fn.color(--text-disabled); + } +} + +textarea { + block-size: calc(1em * fn.dim(--font --standard --line-height)); +} + +hr { + block-size: fn.dim(--border --thin); + margin: 0; + border: 0; + background-color: fn.color(--border); +} diff --git a/src_old/_config.scss b/src_old/_config.scss new file mode 100644 index 0000000..62a1401 --- /dev/null +++ b/src_old/_config.scss @@ -0,0 +1,234 @@ +@use 'sass:list'; +@use 'sass:map'; +@use 'sass:math'; +@use 'iro-sass/src/index' as iro; +@use 'iro-sass/src/responsive' as res; +@use 'iro-sass/src/easing' as easing; +@use 'include-media/dist/include-media' as media; + +iro.$vars-root-size: 16px; + +media.$breakpoints: ( + lg: 1340px, + md: 900px, + sm: 620px, + xs: 400px, +); + +media.$unit-intervals: ( + 'px': 1, + 'em': .01, + 'rem': .01, + '': 0 +); + +res.$named-viewports: media.$breakpoints; + +$palette-precision: .01 !default; + +$palette-chroma-easing: 'ease' !default; + +$static-colors-override: () !default; +$static-colors: map.deep-merge(( + --base: hsl(0, 0%, 98%), + + --contrasts: ( + --100: math.div(0, 12) * 110 - 10, + --200: math.div(1, 12) * 110 - 10, + --300: math.div(2, 12) * 110 - 10, + --400: math.div(3, 12) * 110 - 10, + --500: math.div(4, 12) * 110 - 10, + --600: math.div(5, 12) * 110 - 10, + --700: math.div(6, 12) * 110 - 10, + --800: math.div(7, 12) * 110 - 10, + --900: math.div(8, 12) * 110 - 10, + --1000: math.div(9, 12) * 110 - 10, + --1100: math.div(10, 12) * 110 - 10, + --1200: math.div(11, 12) * 110 - 10, + --1300: math.div(12, 12) * 110 - 10, + ), + + --palettes: ( + --blue: oklch(56% .14 275.25), + --purple: oklch(56% .14 305.58), + --red: oklch(56% .14 14.69), + --green: oklch(56% .14 150.48), + --yellow: oklch(56% .14 84.08), + ), + + --transparents: ( + --100: 0, + --200: .1, + --300: .25, + --400: .4, + --500: .55, + --600: .7, + --700: .8, + --800: .9, + --900: 1, + ), +), $static-colors-override) !default; + +$semantic-colors-common-override: () !default; +$semantic-colors-common: map.deep-merge(( + --accent: --blue, + --accent-static: --blue-static, + --positive: --green, + --positive-static: --green-static, + --negative: --red, + --negative-static: --red-static, + --warning: --yellow, + --warning-static: --yellow-static, + + --focus-raw: --accent, + --focus-static: --accent-static, + + --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, + + --focus: ( + --outline: --focus-raw --400, + --border-mute: --focus-raw --900, + --border: --focus-raw --1000, + --border-text: --focus-raw --1000-text, + --border-strong: --focus-raw --1100, + --text: --focus-raw --1100, + ), +), $semantic-colors-common-override) !default; + +$theme-light-override: () !default; +$theme-light: map.deep-merge(( + --contrasts: ( + --grays: ( + --50: -8, + --75: -4, + --100: 0, + + --200: easing.cubic-bezier(.2, .1, .9, .9, math.div(1, 7)) * 98, + --300: easing.cubic-bezier(.2, .1, .9, .9, math.div(2, 7)) * 98, + --400: easing.cubic-bezier(.2, .1, .9, .9, math.div(3, 7)) * 98, + + --500: easing.cubic-bezier(.2, .1, .9, .9, math.div(4, 7)) * 98, + --600: easing.cubic-bezier(.2, .1, .9, .9, math.div(5, 7)) * 98, + --700: easing.cubic-bezier(.2, .1, .9, .9, math.div(6, 7)) * 98, + --800: easing.cubic-bezier(.2, .1, .9, .9, math.div(7, 7)) * 98, + --900: 106, + ), + + --colors: ( + --100: math.div(0, 12) * 96 + 5, + --200: math.div(1, 12) * 96 + 5, + --300: math.div(2, 12) * 96 + 5, + --400: math.div(3, 12) * 96 + 5, + --500: math.div(4, 12) * 96 + 5, + --600: math.div(5, 12) * 96 + 5, + --700: math.div(6, 12) * 96 + 5, + --800: math.div(7, 12) * 96 + 5, + --900: math.div(8, 12) * 96 + 5, + --1000: math.div(9, 12) * 96 + 5, + --1100: math.div(10, 12) * 96 + 5, + --1200: math.div(11, 12) * 96 + 5, + --1300: math.div(12, 12) * 96 + 5, + ), + ), + + --ranges: ( + --full: .3, + --muted: .1, + ), + + --palettes: ( + --base: hsl(260, 90%, 98%) --grays --full, + --blue: oklch(56% .16 275.25) --colors --muted, + --purple: oklch(56% .16 305.58) --colors --muted, + --red: oklch(56% .16 14.69) --colors --muted, + --green: oklch(56% .16 150.48) --colors --muted, + --yellow: oklch(56% .16 84.08) --colors --muted, + ), + + --semantic: map.merge($semantic-colors-common, ( + --bg-l2: --base --50, + --bg-l1: --base --100, + --bg-base: --base --200, + )), + + --constants: ( + --shadow: rgba(#000, .15), + ), +), $theme-light-override) !default; + +$theme-dark-override: () !default; +$theme-dark: map.deep-merge(( + --contrasts: ( + --grays: ( + --50: 4.4, + --75: 2.2, + --100: 0, + + --200: easing.cubic-bezier(.3, .1, .8, .8, math.div(1, 8)) * -108, + --300: easing.cubic-bezier(.3, .1, .8, .8, math.div(2, 8)) * -108, + --400: easing.cubic-bezier(.3, .1, .8, .8, math.div(3, 8)) * -108, + + --500: easing.cubic-bezier(.3, .1, .8, .8, math.div(4, 8)) * -108, + --600: easing.cubic-bezier(.3, .1, .8, .8, math.div(5, 8)) * -108, + --700: easing.cubic-bezier(.3, .1, .8, .8, math.div(6, 8)) * -108, + --800: easing.cubic-bezier(.3, .1, .8, .8, math.div(7, 8)) * -108, + --900: easing.cubic-bezier(.3, .1, .8, .8, math.div(8, 8)) * -108, + ), + + --colors: ( + --100: math.div(0, 12) * -100 - 5, + --200: math.div(1, 12) * -100 - 5, + --300: math.div(2, 12) * -100 - 5, + --400: math.div(3, 12) * -100 - 5, + --500: math.div(4, 12) * -100 - 5, + --600: math.div(5, 12) * -100 - 5, + --700: math.div(6, 12) * -100 - 5, + --800: math.div(7, 12) * -100 - 5, + --900: math.div(8, 12) * -100 - 5, + --1000: math.div(9, 12) * -100 - 5, + --1100: math.div(10, 12) * -100 - 5, + --1200: math.div(11, 12) * -100 - 5, + --1300: math.div(12, 12) * -100 - 5, + ), + ), + + --ranges: ( + --full: 1, + --muted: .3, + ), + + --palettes: ( + --base: hsl(257, 7%, 19%) --grays --full, + --blue: oklch(56% .16 275.25) --colors --muted, + --purple: oklch(56% .16 305.58) --colors --muted, + --red: oklch(56% .16 14.69) --colors --muted, + --green: oklch(56% .16 150.48) --colors --muted, + --yellow: oklch(56% .16 84.08) --colors --muted, + ), + + --semantic: map.merge($semantic-colors-common, ( + --bg-base: --base --50, + --bg-l1: --base --75, + --bg-l2: --base --100, + )), + + --constants: ( + --shadow: rgba(#000, .5), + ), +), $theme-dark-override) !default; + +$themes-override: () !default; +$themes: map.deep-merge(( + light: $theme-light, + dark: $theme-dark, +), $themes-override) !default; + +$theme-default: list.nth(map.keys($themes), 1) !default; diff --git a/src_old/_functions.scss b/src_old/_functions.scss new file mode 100644 index 0000000..523aa84 --- /dev/null +++ b/src_old/_functions.scss @@ -0,0 +1,135 @@ +@use 'sass:color'; +@use 'sass:math'; +@use 'sass:map'; +@use 'sass:list'; +@use 'sass:meta'; + +@use 'iro-sass/src/index' as iro; +@use 'iro-sass/src/easing' as easing; +@use 'functions/colors' as iro-colors; +@use 'config'; + +@function color($key, $tree: iro.$props-default-tree, $default: null, $global: false) { + @return iro.props-get(list.join(--colors, $key), $tree, $default, $global); +} + +@function global-color($key, $tree: iro.$props-default-tree, $default: null, $global: true) { + @return color($key, $tree, $default, $global); +} + +@function foreign-color($foreign-key, $key, $tree: iro.$props-default-tree, $default: null, $global: true) { + @return iro.props-get(list.join($foreign-key --colors, $key), $tree, $default, $global); +} + +@function dim($key, $tree: iro.$props-default-tree, $default: null, $global: false) { + @return iro.props-get(list.join(--dims, $key), $tree, $default, $global); +} + +@function global-dim($key, $tree: iro.$props-default-tree, $default: null, $global: true) { + @return dim($key, $tree, $default, $global); +} + +@function foreign-dim($foreign-key, $key, $tree: iro.$props-default-tree, $default: null, $global: true) { + @return iro.props-get(list.join($foreign-key --dims, $key), $tree, $default, $global); +} + +@function font-prop($data, $overrides, $key, $prop) { + @if (map.has-key($overrides, $prop)) { + @return map.get($overrides, $prop); + } @else if (map.has-key($data, $prop)) { + @return global-dim(--font $key $prop); + } + @return null; +} + +@function set-font($key, $overrides: ()) { + $font: iro.props-get-static(list.join(--dims --font, $key), $global: true); + + $map: ( + font-family: font-prop($font, $overrides, $key, --family), + font-size: font-prop($font, $overrides, $key, --size), + font-weight: font-prop($font, $overrides, $key, --weight), + font-style: font-prop($font, $overrides, $key, --style), + line-height: font-prop($font, $overrides, $key, --line-height), + text-transform: font-prop($font, $overrides, $key, --transform), + letter-spacing: font-prop($font, $overrides, $key, --spacing), + font-variant-alternates: font-prop($font, $overrides, $key, --variant-alternates), + font-feature-settings: font-prop($font, $overrides, $key, --feature-settings), + ); + + @return $map; +} + +@function lum($color) { + @return list.nth(blend-convert.lin_sRGB_to_XYZ(blend-convert.lin_sRGB(blend-convert.sassToRgb($color))), 2) + .05; +} + +@function palette($base-color, $contrasts, $chroma-range: 1, $ref-color: $base-color) { + $base-lch: color.to-space($base-color, oklch); + $ref-lch: color.to-space($ref-color, oklch); + + $ref-l: color.channel($ref-lch, 'lightness'); + $ref-y: iro-colors.apca_sRGB_to_Y($ref-lch); + + $cmax: math.max(map.values($contrasts)...); + $cmax: math.max($cmax, math.abs(math.min(map.values($contrasts)...))); + + $black-y: iro-colors.apca_sRGB_to_Y(#000); + $white-y: iro-colors.apca_sRGB_to_Y(#fff); + + $chroma-inv: false; + @if $chroma-range < 0 { + $chroma-inv: true; + $chroma-range: -1 * $chroma-range; + } + $chroma-easing: meta.get-function(config.$palette-chroma-easing, $module: easing); + + $palette: (); + + @each $key, $contrast in $contrasts { + $y: iro-colors.apcaReverse($contrast, $ref-y); + $l: color.channel($base-lch, 'lightness'); + $c: 1; + + @if $y != false { + $l: color.channel(iro-colors.apca_Y_to_sRGB($y), 'lightness', oklch); + } @else { + $y: $ref-y; + } + + @if $chroma-range != 1 { + $c: if($ref-l > 50%, math.clamp(0, math.div($contrast, $cmax), 1), -1 * math.clamp(-1, math.div($contrast, $cmax), 0)); + @if $chroma-inv { + $c: 1 - $c; + } + $c: meta.call($chroma-easing, $c); + $c: $chroma-range + (1 - $chroma-range) * $c; + } + + $color: oklch($l ($c * color.channel($base-lch, 'chroma')) color.channel($base-lch, 'hue')); + + $contrast-black: iro-colors.apcaContrast($black-y, $y); + $contrast-white: iro-colors.apcaContrast($white-y, $y); + + $palette: map.set($palette, $key, $color); + $palette: map.set($palette, #{$key}-text, if(math.abs($contrast-black) > math.abs($contrast-white), #000, #fff)); + } + + @return $palette; +} + +@function transparent-palette($color, $text, $alphas) { + $palette: ( + --text: $text, + ); + + @each $key, $alpha in $alphas { + $palette: map.set($palette, $key, rgba($color, $alpha)); + } + + @return $palette; +} + +@function px-to-em($size, $base: iro.$vars-root-size) { + @return math.div($size, $base) * 1em; +} diff --git a/src_old/_layouts.scss b/src_old/_layouts.scss new file mode 100644 index 0000000..572308d --- /dev/null +++ b/src_old/_layouts.scss @@ -0,0 +1,8 @@ +@use 'layouts/media'; +@use 'layouts/container'; +@use 'layouts/button-group'; +@use 'layouts/form'; +@use 'layouts/flex'; +@use 'layouts/overflow'; +@use 'layouts/card-list'; +//@use 'layouts/message-group'; diff --git a/src_old/_mixins.scss b/src_old/_mixins.scss new file mode 100644 index 0000000..dca6831 --- /dev/null +++ b/src_old/_mixins.scss @@ -0,0 +1,38 @@ +@use 'sass:list'; +@use 'functions' as fn; + +@mixin set-font($basis, $values: ()) { + $values: fn.set-font($basis, $values); + + @each $prop, $value in $values { + @if $value != null { + #{$prop}: $value; + } + } +} + +@mixin heading-strong($size) { + color: fn.global-color(--heading); + font-size: fn.global-dim(list.join(--heading, $size)); +} + +@mixin heading-medium($size) { + @include set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(list.join(--heading, $size)), + --weight: bold + )); + + color: fn.global-color(--heading); +} + +@mixin heading-faint($size) { + @include set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(list.join(--heading, $size)), + --weight: 500, + --spacing: 1px + )); + + color: fn.global-color(--text-mute); +} diff --git a/src_old/_objects.scss b/src_old/_objects.scss new file mode 100644 index 0000000..c5049cd --- /dev/null +++ b/src_old/_objects.scss @@ -0,0 +1,28 @@ +@use 'objects/icon'; +@use 'objects/emoji'; +@use 'objects/heading'; +@use 'objects/divider'; +@use 'objects/badge'; +@use 'objects/button'; +@use 'objects/text-field'; +@use 'objects/field-label'; +@use 'objects/radio'; +@use 'objects/checkbox'; +@use 'objects/switch'; +@use 'objects/action-button'; +// @use 'objects/overflow-button'; +@use 'objects/status-indicator'; +@use 'objects/avatar'; +// @use 'objects/message'; +@use 'objects/side-nav'; +@use 'objects/popover'; +@use 'objects/menu'; +@use 'objects/card'; +// @use 'objects/icon-nav'; +@use 'objects/backdrop'; +// @use 'objects/dialog'; +@use 'objects/lightbox'; +// @use 'objects/list-group'; +@use 'objects/table'; +@use 'objects/alert'; +@use 'objects/palette'; diff --git a/src_old/_scopes.scss b/src_old/_scopes.scss new file mode 100644 index 0000000..a3aeb6c --- /dev/null +++ b/src_old/_scopes.scss @@ -0,0 +1,6 @@ +@use 'scopes/links'; +@use 'scopes/code'; +@use 'scopes/blockquotes'; +@use 'scopes/lists'; +@use 'scopes/headings'; +@use 'scopes/tables'; diff --git a/src_old/_themes.scss b/src_old/_themes.scss new file mode 100644 index 0000000..2ca89cb --- /dev/null +++ b/src_old/_themes.scss @@ -0,0 +1,86 @@ +@use 'iro-sass/src/index' as iro; +@use 'functions' as fn; + +$static-themes: 'black' 'white' !default; + +@include iro.bem-theme('base') { + background-color: fn.global-color(--bg-base); + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + background-color: fn.global-color(--bg-base); + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + background-color: fn.global-color(--bg-base); + } + } +} + +@include iro.bem-theme('l1') { + background-color: fn.global-color(--bg-l1); + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + background-color: fn.global-color(--bg-l1); + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + background-color: fn.global-color(--bg-l1); + } + } +} + +@include iro.bem-theme('l2') { + background-color: fn.global-color(--bg-l2); + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + background-color: fn.global-color(--bg-l2); + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + background-color: fn.global-color(--bg-l2); + } + } +} + +@include iro.bem-theme('50') { + background-color: fn.global-color(--base --50); + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + background-color: fn.global-color(--base --50); + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + background-color: fn.global-color(--base --50); + } + } +} + +@each $theme in $static-themes { + @include iro.bem-theme(static-#{$theme}) { + color: fn.global-color(--#{$theme}-transparent --800); + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + background-color: fn.global-color(--base --50); + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + background-color: fn.global-color(--base --50); + } + } + } +} diff --git a/src_old/_utils.scss b/src_old/_utils.scss new file mode 100644 index 0000000..c0ce7a3 --- /dev/null +++ b/src_old/_utils.scss @@ -0,0 +1,233 @@ +@use 'sass:map'; +@use 'iro-sass/src/index' as iro; +@use 'functions' as fn; +@use 'include-media/dist/include-media' as media; + +$dirs: ( + '': '', + 'bs': '-block-start', + 'be': '-block-end', + 'b': '-block', + 'is': '-inline-start', + 'ie': '-inline-end', + 'i': '-inline', +) !default; + +$sizes: 0 10 50 75 100 125 200 400 700 800 !default; + +@include iro.bem-utility('d-block') { + display: block; +} + +@include iro.bem-utility('d-inline-block') { + display: inline-block; +} + +@include iro.bem-utility('d-contents') { + display: contents; +} + +@include iro.bem-utility('td-none') { + text-decoration: none; +} + +@include iro.bem-utility('d-none') { + display: none; + + @each $breakpoint in map.keys(media.$breakpoints) { + @include media.media('<=#{$breakpoint}') { + @include iro.bem-suffix('#{$breakpoint}-lo') { + display: none; + } + } + + @include media.media('>#{$breakpoint}') { + @include iro.bem-suffix('#{$breakpoint}-hi') { + display: none; + } + } + } + + @include iro.bem-at-theme('js') { + @include iro.bem-suffix('js') { + display: none; + } + } + + @include iro.bem-at-theme('no-js') { + @include iro.bem-suffix('no-js') { + display: none; + } + } + + @include iro.bem-suffix('empty') { + &:empty { + display: none; + } + } +} + +@include iro.bem-utility('ta-start') { + text-align: start; +} + +@include iro.bem-utility('ta-end') { + text-align: end; +} + +@include iro.bem-utility('ta-center') { + text-align: center; +} + +@include iro.bem-utility('fw-normal') { + font-weight: normal; +} + +@include iro.bem-utility('ai-center') { + align-items: center; +} + +@include iro.bem-utility('ai-start') { + align-items: flex-start; +} + +@include iro.bem-utility('ai-end') { + align-items: flex-end; +} + +@include iro.bem-utility('jc-center') { + justify-content: center; +} + +@include iro.bem-utility('jc-start') { + justify-content: flex-start; +} + +@include iro.bem-utility('jc-end') { + justify-content: flex-end; +} + +@include iro.bem-utility('c-heading') { + color: fn.color(--heading); +} + +@include iro.bem-utility('c-text') { + color: fn.color(--text); +} + +@include iro.bem-utility('c-mute') { + color: fn.color(--text-mute); +} + +@include iro.bem-utility('c-mute-more') { + color: fn.color(--text-mute-more); +} + +@each $dir, $prop in (is: inline-size, bs: block-size) { + @include iro.bem-utility('#{$dir}-100') { + #{$prop}: 100%; + } + + @include iro.bem-utility('#{$dir}-75') { + #{$prop}: 75%; + } + + @include iro.bem-utility('#{$dir}-50') { + #{$prop}: 50%; + } + + @include iro.bem-utility('#{$dir}-25') { + #{$prop}: 25%; + } + + @include iro.bem-utility('#{$dir}-1px') { + #{$prop}: 1px; + } + + @include iro.bem-utility('#{$dir}-0') { + #{$prop}: 0; + } +} + +@include iro.bem-utility('elp') { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +@include iro.bem-utility('p-static') { + position: static; +} + +@include iro.bem-utility('p-relative') { + position: relative; +} + +@include iro.bem-utility('p-fixed') { + position: fixed; +} + +@include iro.bem-utility('p-sticky-bs') { + position: sticky; + inset-block-start: 0; +} + +@each $dir, $suffix in $dirs { + @include iro.bem-utility('m#{$dir}-auto') { + margin#{$suffix}: auto; + } + + @include iro.bem-utility('p#{$dir}-auto') { + padding#{$suffix}: auto; + } + + @each $size in $sizes { + @include iro.bem-utility('m#{$dir}-#{$size}') { + margin#{$suffix}: fn.global-dim(--size --#{$size}); + } + + @include iro.bem-utility('p#{$dir}-#{$size}') { + padding#{$suffix}: fn.global-dim(--size --#{$size}); + } + } + + @include iro.bem-utility('b#{$dir}-0') { + border#{$suffix}: 0; + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + border#{$suffix}: 0; + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + border#{$suffix}: 0; + } + } + } + + @include iro.bem-utility('b#{$dir}-1') { + border#{$suffix}: fn.global-dim(--border --thin) solid fn.global-color(--border); + + @include iro.bem-suffix('light') { + @media (prefers-color-scheme: light) { + border#{$suffix}: fn.global-dim(--border --thin) solid fn.global-color(--border); + } + } + + @include iro.bem-suffix('dark') { + @media (prefers-color-scheme: dark) { + border#{$suffix}: fn.global-dim(--border --thin) solid fn.global-color(--border); + } + } + } +} + +@include iro.bem-utility('mbs-neutralize') { + &::before { + content: ''; + display: block; + margin-block: -100em 100em; + } +} diff --git a/src_old/_vars.scss b/src_old/_vars.scss new file mode 100644 index 0000000..6e2cbfc --- /dev/null +++ b/src_old/_vars.scss @@ -0,0 +1,298 @@ +@use 'sass:map'; +@use 'sass:meta'; +@use 'sass:list'; +@use 'iro-sass/src/index' as iro; +@use 'include-media/dist/include-media' as media; +@use 'functions' as fn; +@use 'config'; + +@include iro.props-store(( + --dims: ( + --size: ( + --0: 0, + --10: iro.fn-px-to-rem(1px), + --25: iro.fn-px-to-rem(2px), + --40: iro.fn-px-to-rem(3px), + --50: iro.fn-px-to-rem(4px), + --65: iro.fn-px-to-rem(5px), + --75: iro.fn-px-to-rem(6px), + --85: iro.fn-px-to-rem(7px), + --100: iro.fn-px-to-rem(8px), + --115: iro.fn-px-to-rem(9px), + --125: iro.fn-px-to-rem(10px), + --130: iro.fn-px-to-rem(11px), + --150: iro.fn-px-to-rem(12px), + --160: iro.fn-px-to-rem(13px), + --175: iro.fn-px-to-rem(14px), + --200: iro.fn-px-to-rem(16px), + --225: iro.fn-px-to-rem(18px), + --250: iro.fn-px-to-rem(20px), + --275: iro.fn-px-to-rem(22px), + --300: iro.fn-px-to-rem(24px), + --325: iro.fn-px-to-rem(26px), + --350: iro.fn-px-to-rem(28px), + --375: iro.fn-px-to-rem(30px), + --400: iro.fn-px-to-rem(32px), + --450: iro.fn-px-to-rem(36px), + --500: iro.fn-px-to-rem(40px), + --550: iro.fn-px-to-rem(44px), + --600: iro.fn-px-to-rem(48px), + --650: iro.fn-px-to-rem(52px), + --700: iro.fn-px-to-rem(56px), + --800: iro.fn-px-to-rem(64px), + --900: iro.fn-px-to-rem(72px), + --1000: iro.fn-px-to-rem(80px), + --1200: iro.fn-px-to-rem(96px), + --1600: iro.fn-px-to-rem(128px), + --2000: iro.fn-px-to-rem(160px), + --2400: iro.fn-px-to-rem(192px), + --2500: iro.fn-px-to-rem(200px), + --2600: iro.fn-px-to-rem(208px), + --2800: iro.fn-px-to-rem(224px), + --3200: iro.fn-px-to-rem(256px), + --3400: iro.fn-px-to-rem(272px), + --3500: iro.fn-px-to-rem(280px), + --3600: iro.fn-px-to-rem(288px), + --3800: iro.fn-px-to-rem(304px), + --4600: iro.fn-px-to-rem(368px), + --5000: iro.fn-px-to-rem(400px), + --6000: iro.fn-px-to-rem(480px), + ), + + --font: ( + --standard: ( + --family: ('Inter', 'Open Sans', 'Segoe UI', 'Droid Sans', Roboto, Oxygen, 'Helvetica Neue', Helvetica, Tahoma, Arial, sans-serif), + --line-height: 1.5, + --feature-settings: ('\'ss01\''), + ), + --headline: ( + --family: ('Inter', fn.dim(--font --standard --family, null)), + --line-height: 1.3, + --weight: 800, + --feature-settings: ('\'opsz\'' 32, '\'ss01\'', '\'cv06\''), + ), + --mono: ( + --family: ('Iosevka Term SS09', 'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace), + --line-height: 1.4, + ) + ), + + --font-size: ( + --50: iro.fn-px-to-rem(12px), + --75: iro.fn-px-to-rem(13px), + --100: iro.fn-px-to-rem(14px), + --150: iro.fn-px-to-rem(16px), + --200: iro.fn-px-to-rem(18px), + --300: iro.fn-px-to-rem(20px), + --400: iro.fn-px-to-rem(24px), + --500: iro.fn-px-to-rem(28px), + --600: iro.fn-px-to-rem(32px), + --700: iro.fn-px-to-rem(36px), + --800: iro.fn-px-to-rem(40px), + --900: iro.fn-px-to-rem(45px), + --1000: iro.fn-px-to-rem(50px), + --1100: iro.fn-px-to-rem(60px), + ), + + --border: ( + --thick: 4px, + --medium: 2px, + --thin: 1px, + ), + + --shadow: ( + --x: 0, + --y: 1px, + --blur: 4px, + ), + + --rounding: 4px, + + --key-focus: ( + --outline: fn.dim(--border --thick, null), + --border: fn.dim(--border --medium, null), + --border-offset: fn.dim(--border --medium, null), + ), + + --paragraph: ( + --margin-bs: fn.dim(--size --300, null), + ), + + --heading: ( + --margin-bs: fn.dim(--size --700, null), + --margin-bs-sibling: fn.dim(--size --325, null), + + --xxl: fn.dim(--font-size --300, null), + --xl: fn.dim(--font-size --200, null), + --lg: fn.dim(--font-size --150, null), + --md: fn.dim(--font-size --100, null), + --sm: fn.dim(--font-size --75, null), + --xs: fn.dim(--font-size --50, null), + + --display: ( + --xxl: fn.dim(--font-size --1100, null), + --xl: fn.dim(--font-size --700, null), + --lg: fn.dim(--font-size --300, null), + --md: fn.dim(--font-size --150, null), + --sm: fn.dim(--font-size --75, null), + --xs: fn.dim(--font-size --50, null), + ), + + --display-sm: ( + --xxl: fn.dim(--font-size --900, null), + --xl: fn.dim(--font-size --600, null), + --lg: fn.dim(--font-size --200, null), + --md: fn.dim(--font-size --100, null), + --sm: fn.dim(--font-size --75, null), + --xs: fn.dim(--font-size --50, null), + ) + ), + + --list: ( + --indent: fn.dim(--size --400, null), + --compact-indent: fn.dim(--size --250, null), + ), + ), +)); + +@each $breakpoint in map.keys(media.$breakpoints) { + @include media.media('<=#{$breakpoint}') { + @include iro.props-store((), $breakpoint); + } +} + +@include iro.props-store(( + --dims: ( + --heading: ( + --margin-bs: fn.dim(--size --600, null), + ), + + --list: ( + --indent: fn.dim(--size --300), + ), + ) +), 'sm'); + +@include iro.props-store(( + --dims: ( + --heading: ( + --margin-bs: fn.dim(--size --500, null), + ), + + --list: ( + --indent: fn.dim(--size --250), + ), + ) +), 'xs'); + +// + +@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, + map.get(config.$static-colors, --base), + ), + ), + )); +} + +@each $palette-name, $palette in (--black: #000 #fff, --white: #fff #000) { + $color: list.nth($palette, 1); + $text: list.nth($palette, 2); + + @include iro.props-store(( + --colors: ( + #{$palette-name}-transparent: fn.transparent-palette( + $color, + $text, + map.get(config.$static-colors, --transparents), + ), + ), + )); +} + +@each $theme-name, $theme in config.$themes { + $tree: if($theme-name == config.$theme-default, iro.$props-default-tree, $theme-name); + + @each $palette-name, $palette in map.get($theme, --palettes) { + $base-color: list.nth($palette, 1); + $contrasts: list.nth($palette, 2); + $ranges: list.nth($palette, 3); + + @include iro.props-store(( + --colors: ( + $palette-name: fn.palette( + $base-color, + map.get($theme, --contrasts, $contrasts), + map.get($theme, --ranges, $ranges), + list.nth(map.get($theme, --palettes, --base), 1), + ), + ), + ), $tree); + } + + @each $color, $value in map.get($theme, --constants) { + @include iro.props-store(( + --colors: ( + $color: $value, + ), + ), $tree); + } + + @each $color, $ref in map.get($theme, --semantic) { + $res: (); + + @if meta.type-of($ref) == 'map' { + @each $key, $r in $ref { + $res: map.set($res, $key, fn.color($r)); + } + } @else { + $res: fn.color($ref); + } + + @include iro.props-store(( + --colors: ( + $color: $res, + ), + ), $tree); + } +} + +@each $theme-name, $theme in config.$themes { + $tree: if($theme-name == config.$theme-default, iro.$props-default-tree, $theme-name); + + @include iro.props-store(( + --colors: ( + + ), + ), $tree); +} + +@mixin apply-vars { + :root { + @include iro.props-assign; + + @each $breakpoint in map.keys(media.$breakpoints) { + @include media.media('<=#{$breakpoint}') { + @include iro.props-assign($breakpoint); + } + } + + @media (prefers-color-scheme: dark) { + @include iro.props-assign('dark'); + } + } + + @each $theme-name, $theme in config.$themes { + $tree: if($theme-name == config.$theme-default, iro.$props-default-tree, $theme-name); + + @include iro.bem-theme($theme-name) { + @include iro.props-assign(); + @include iro.props-assign($tree, --colors); + } + } +} diff --git a/src_old/functions/colors/_apca.scss b/src_old/functions/colors/_apca.scss new file mode 100644 index 0000000..0c03529 --- /dev/null +++ b/src_old/functions/colors/_apca.scss @@ -0,0 +1,127 @@ +/* stylelint-disable scss/dollar-variable-pattern */ +/* stylelint-disable scss/at-function-pattern */ + +@use 'sass:color'; +@use 'sass:list'; +@use 'sass:map'; +@use 'sass:math'; + +$SA98G: ( + mainTRC: 2.4, + + sRco: .2126729, + sGco: .7151522, + sBco: .072175, + + normBG: .56, + normTXT: .57, + revTXT: .62, + revBG: .65, + + blkThrs: .022, + blkClmp: 1.414, + scaleBoW: 1.14, + scaleWoB: 1.14, + loBoWoffset: .027, + loWoBoffset: .027, + deltaYmin: .0005, + loClip: .0001, + + mFactor: 1.9468554433171, + mOffsetIn: .0387393816571401, + mExpAdj: .283343396420869, + mOffsetOut: .312865795870758, +); + +@function apca_sRGB_to_Y($color) { + $rgb: color.to-space($color, rgb); + + @return map.get($SA98G, sRco) * math.pow(math.div(color.channel($rgb, 'red'), 255), map.get($SA98G, mainTRC)) + + map.get($SA98G, sGco) * math.pow(math.div(color.channel($rgb, 'green'), 255), map.get($SA98G, mainTRC)) + + map.get($SA98G, sBco) * math.pow(math.div(color.channel($rgb, 'blue'), 255), map.get($SA98G, mainTRC)); +} + +@function apca_Y_to_sRGB($y) { + $c: math.round(math.pow($y, math.div(1, map.get($SA98G, mainTRC))) * 255); + @return rgb($c, $c, $c); +} + +@function apcaContrast($txtY, $bgY) { + /* stylelint-disable-next-line @stylistic/number-no-trailing-zeros */ + $icp: .0 1.1; + + @if math.min($txtY, $bgY) < list.nth($icp, 1) or math.max($txtY, $bgY) > list.nth($icp, 2) { + @return 0; + } + + @if $txtY <= map.get($SA98G, blkThrs) { + $txtY: $txtY + math.pow(map.get($SA98G, blkThrs) - $txtY, map.get($SA98G, blkClmp)); + } + @if $bgY <= map.get($SA98G, blkThrs) { + $bgY: $bgY + math.pow(map.get($SA98G, blkThrs) - $bgY, map.get($SA98G, blkClmp)); + } + + @if math.abs($bgY - $txtY) < map.get($SA98G, deltaYmin) { + @return 0; + } + + $outputContrast: 0; + + @if $bgY > $txtY { + $SAPC: map.get($SA98G, scaleBoW) * (math.pow($bgY, map.get($SA98G, normBG)) - math.pow($txtY, map.get($SA98G, normTXT))); + + @if $SAPC >= map.get($SA98G, loClip) { + $outputContrast: $SAPC - map.get($SA98G, loBoWoffset); + } + } @else { + $SAPC: map.get($SA98G, scaleWoB) * (math.pow($bgY, map.get($SA98G, revBG)) - math.pow($txtY, map.get($SA98G, revTXT))); + + @if $SAPC <= -1 * map.get($SA98G, loClip) { + $outputContrast: $SAPC + map.get($SA98G, loWoBoffset); + } + } + + @return $outputContrast * 100; +} + +@function apcaReverse($contrast, $knownY, $knownType: 'bg') { + $unknownY: $knownY; + + $knownExp: 0; + $unknownExp: 0; + + $scale: map.get($SA98G, if($contrast > 0, scaleBoW, scaleWoB)); + $offset: map.get($SA98G, if($contrast > 0, loBoWoffset, loWoBoffset)); + + $contrast: math.div($contrast * .01 + $offset, $scale); + + @if $knownY <= map.get($SA98G, blkThrs) { + $knownY: $knownY + math.pow(map.get($SA98G, blkThrs) - $knownY, map.get($SA98G, blkClmp)); + } + + @if $knownType == 'bg' { + $knownExp: map.get($SA98G, if($contrast > 0, normBG, revBG)); + $unknownExp: map.get($SA98G, if($contrast > 0, normTXT, revTXT)); + $unknownY: math.pow(math.pow($knownY, $knownExp) - $contrast, math.div(1, $unknownExp)); + } @else { + $knownExp: map.get($SA98G, if($contrast > 0, normTXT, revTXT)); + $unknownExp: map.get($SA98G, if($contrast > 0, normBG, revBG)); + $unknownY: math.pow($contrast + math.pow($knownY, $knownExp), math.div(1, $unknownExp)); + } + + @if '#{$unknownY}' == '#{math.sqrt(-1)}' { + @return false; + } + + @if $unknownY > 1.06 or $unknownY < 0 { + @return false; + } + + @if $unknownY <= map.get($SA98G, blkThrs) { + $unknownY: math.pow(($unknownY + map.get($SA98G, mOffsetIn)) * map.get($SA98G, mFactor), math.div(map.get($SA98G, mExpAdj), map.get($SA98G, blkClmp))) * math.div(1, map.get($SA98G, mFactor)) - map.get($SA98G, mOffsetOut); + } + + $unknownY: math.max(math.min($unknownY, 1), 0); + + @return $unknownY; +} diff --git a/src_old/functions/colors/_index.scss b/src_old/functions/colors/_index.scss new file mode 100644 index 0000000..9dad0f9 --- /dev/null +++ b/src_old/functions/colors/_index.scss @@ -0,0 +1 @@ +@forward 'apca'; diff --git a/src_old/index.scss b/src_old/index.scss new file mode 100644 index 0000000..a8d9c24 --- /dev/null +++ b/src_old/index.scss @@ -0,0 +1,10 @@ +@use 'vars' as vars; + +@use 'base'; +@use 'layouts'; +@use 'objects'; +@use 'scopes'; +@use 'themes'; +@use 'utils'; + +@include vars.apply-vars; diff --git a/src_old/layouts/_button-group.scss b/src_old/layouts/_button-group.scss new file mode 100644 index 0000000..a70d27a --- /dev/null +++ b/src_old/layouts/_button-group.scss @@ -0,0 +1,16 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('button-group') { + @include iro.props-store(( + --dims: ( + --spacing: fn.global-dim(--size --150), + ), + )); + + @include iro.bem-layout(iro.props-namespace()) { + display: flex; + gap: fn.dim(--spacing); + flex-wrap: wrap; + } +} diff --git a/src_old/layouts/_card-list.scss b/src_old/layouts/_card-list.scss new file mode 100644 index 0000000..65b6a66 --- /dev/null +++ b/src_old/layouts/_card-list.scss @@ -0,0 +1,96 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use 'include-media/dist/include-media' as media; + +@include iro.props-namespace('card-list') { + @include iro.props-store(( + --dims: ( + --row-gap: fn.global-dim(--size --800), + --col-gap: fn.global-dim(--size --400), + + --grid: ( + --row-gap: fn.global-dim(--size --800), + --col-gap: fn.global-dim(--size --400), + --col-width: fn.global-dim(--size --3200), + ), + --masonry: ( + --row-gap: fn.global-dim(--size --800), + --col-gap: fn.global-dim(--size --400), + --col-width: fn.global-dim(--size --3200), + ), + --masonry-h: ( + --row-gap: fn.global-dim(--size --800), + --col-gap: fn.global-dim(--size --400), + --row-height: fn.global-dim(--size --3200), + ) + ), + --colors: ( + --border: fn.global-color(--border), + ), + )); + + @include iro.bem-layout(iro.props-namespace()) { + display: flex; + flex-direction: column; + gap: fn.dim(--row-gap) fn.dim(--col-gap); + + @include iro.bem-modifier('grid') { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(fn.dim(--grid --col-width), 1fr)); + gap: fn.dim(--grid --col-gap); + + @include iro.bem-modifier('quiet') { + row-gap: fn.dim(--grid --row-gap); + } + } + + @include iro.bem-modifier('masonry') { + display: block; + columns: auto fn.dim(--masonry --col-width); + column-gap: fn.dim(--masonry --col-gap); + + @include iro.bem-elem('card') { + margin-block-end: fn.dim(--masonry --col-gap); + break-inside: avoid; + } + + @include iro.bem-modifier('quiet') { + @include iro.bem-elem('card') { + margin-block-end: fn.dim(--masonry --row-gap); + } + } + } + + @include iro.bem-modifier('masonry-h') { + flex-flow: row wrap; + gap: fn.dim(--masonry-h --col-gap); + + &::after { + content: ''; + display: block; + flex: 1 0 auto; + inline-size: fn.dim(--masonry-h --row-height); + block-size: 0; + } + + @include iro.bem-elem('card') { + flex: 1 0 auto; + max-inline-size: 100%; + } + + @include iro.bem-elem('card-image') { + block-size: fn.dim(--masonry-h --row-height); + } + + @include iro.bem-modifier('quiet') { + row-gap: fn.dim(--masonry-h --row-gap); + } + } + + @include iro.bem-modifier('aspect-5\\/4') { + @include iro.bem-elem('card-image') { + aspect-ratio: 5 / 4; + } + } + } +} diff --git a/src_old/layouts/_container.scss b/src_old/layouts/_container.scss new file mode 100644 index 0000000..d13c4f3 --- /dev/null +++ b/src_old/layouts/_container.scss @@ -0,0 +1,45 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('container') { + @include iro.props-store(( + --dims: ( + --narrow-125: iro.fn-px-to-rem(720px), + --narrow: iro.fn-px-to-rem(610px), + --narrow-75: iro.fn-px-to-rem(500px), + --pad-i: fn.global-dim(--size --400), + --pad-b: fn.global-dim(--size --800), + ) + )); + + @include iro.props-store(( + --dims: ( + --pad-i: fn.global-dim(--size --200), + --pad-b: fn.global-dim(--size --600), + ) + ), 'sm'); + + @include iro.props-store(( + --dims: ( + --pad-i: fn.global-dim(--size --150), + --pad-b: fn.global-dim(--size --450), + ) + ), 'xs'); + + @include iro.bem-layout(iro.props-namespace()) { + @each $size in 'narrow-125' 'narrow' 'narrow-75' { + @include iro.bem-modifier($size) { + max-inline-size: fn.dim(--#{$size}); + margin-inline: auto; + } + } + + @include iro.bem-modifier('pad-i') { + padding-inline: fn.dim(--pad-i); + } + + @include iro.bem-modifier('pad-b') { + padding-block: fn.dim(--pad-b); + } + } +} diff --git a/src_old/layouts/_flex.scss b/src_old/layouts/_flex.scss new file mode 100644 index 0000000..d3f4f9c --- /dev/null +++ b/src_old/layouts/_flex.scss @@ -0,0 +1,27 @@ +@use 'iro-sass/src/index' as iro; + +@include iro.props-namespace('flex') { + @include iro.bem-layout(iro.props-namespace()) { + display: flex; + + @include iro.bem-modifier('align-stretch') { + align-items: stretch; + } + + @include iro.bem-modifier('align-center') { + align-items: center; + } + + @include iro.bem-modifier('align-start') { + align-items: flex-start; + } + + @include iro.bem-modifier('align-end') { + align-items: flex-end; + } + + @include iro.bem-modifier('column') { + flex-direction: column; + } + } +} diff --git a/src_old/layouts/_form.scss b/src_old/layouts/_form.scss new file mode 100644 index 0000000..f6b60ea --- /dev/null +++ b/src_old/layouts/_form.scss @@ -0,0 +1,62 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +// @use '../objects/field-label'; + +@include iro.props-namespace('form') { + @include iro.props-store(( + --dims: ( + --item-spacing-b: fn.global-dim(--size --325), + --label-spacing-i: fn.global-dim(--size --325), + --hint-font-size: fn.global-dim(--font-size --75), + ), + )); + + @include iro.bem-layout(iro.props-namespace()) { + display: flex; + flex-direction: column; + gap: fn.dim(--item-spacing-b) fn.dim(--label-spacing-i); + + @include iro.bem-elem('item') { + display: block; + } + + @include iro.bem-elem('item-content') { + @include iro.bem-modifier('align-start') { + align-self: start; + } + } + + @include iro.bem-modifier('row') { + flex-direction: row; + align-items: flex-end; + } + + @include iro.bem-modifier('labels-start', 'labels-end') { + display: grid; + grid-template-columns: auto 1fr; + grid-template-rows: auto; + align-items: baseline; + + @include iro.bem-elem('item') { + display: contents; + } + + @include iro.bem-elem('item-label') { + grid-column: 1; + padding-inline-end: 0; + } + + @include iro.bem-elem('item-content') { + grid-column: 2; + margin-block-start: 0; + } + } + + @include iro.bem-modifier('labels-end') { + @include iro.bem-elem('item-label') { + text-align: end; + } + } + } +} diff --git a/src_old/layouts/_media.scss b/src_old/layouts/_media.scss new file mode 100644 index 0000000..c42aa3e --- /dev/null +++ b/src_old/layouts/_media.scss @@ -0,0 +1,47 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$sizes: 'gapless' 'sm' 'lg' 'xl' !default; + +@include iro.props-namespace('media') { + @include iro.props-store(( + --dims: ( + --gap: fn.global-dim(--size --150), + + --gapless: 0, + --sm: fn.global-dim(--size --100), + --lg: fn.global-dim(--size --300), + --xl: fn.global-dim(--size --450), + ) + )); + + @include iro.bem-layout(iro.props-namespace()) { + display: flex; + align-items: center; + gap: fn.dim(--gap); + line-height: 1.4; + + @each $size in $sizes { + @include iro.bem-modifier($size) { + gap: fn.dim(--#{$size}); + } + } + + @include iro.bem-modifier('wrap') { + flex-wrap: wrap; + } + + @include iro.bem-elem('block') { + flex: 0 0 auto; + + @include iro.bem-modifier('shrink', 'main') { + flex-shrink: 1; + min-inline-size: 0; + } + + @include iro.bem-modifier('main') { + inline-size: 100%; + } + } + } +} diff --git a/src_old/layouts/_overflow.scss b/src_old/layouts/_overflow.scss new file mode 100644 index 0000000..8643bbf --- /dev/null +++ b/src_old/layouts/_overflow.scss @@ -0,0 +1,9 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('overflow') { + @include iro.bem-layout(iro.props-namespace()) { + overflow: auto; + scrollbar-color: fn.global-color(--text-disabled) transparent; + } +} diff --git a/src_old/objects/_action-button.scss b/src_old/objects/_action-button.scss new file mode 100644 index 0000000..7fe9d44 --- /dev/null +++ b/src_old/objects/_action-button.scss @@ -0,0 +1,343 @@ +@use 'sass:list'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$sizes: 'sm' 'lg' 'xl' !default; +$static-themes: 'black' 'white' !default; + +@mixin static-theme($theme: ()) { + border-color: fn.color(list.join($theme, --disabled --border)); + background-color: fn.color(list.join($theme, --disabled --bg)); + color: fn.color(list.join($theme, --disabled --label)); + + &::after { + outline-color: fn.color(list.join($theme, --key-focus --border)); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(list.join($theme, --key-focus --outline)); + } + + &:link, + &:visited, + &:enabled { + border-color: fn.color(list.join($theme, --border)); + background-color: fn.color(list.join($theme, --bg)); + color: fn.color(list.join($theme, --label)); + + &:hover, + &:focus-visible { + border-color: fn.color(list.join($theme, --hover --border)); + background-color: fn.color(list.join($theme, --hover --bg)); + color: fn.color(list.join($theme, --hover --label)); + } + + &:active { + border-color: fn.color(list.join($theme, --active --border)); + background-color: fn.color(list.join($theme, --active --bg)); + color: fn.color(list.join($theme, --active --label)); + } + } + + @include iro.bem-modifier('quiet') { + border-color: transparent; + background-color: transparent; + color: fn.color(list.join($theme, --quiet --disabled --label)); + + &:link, + &:visited, + &:enabled { + border-color: transparent; + background-color: transparent; + color: fn.color(list.join($theme, --quiet --label)); + + &:hover, + &:focus-visible { + border-color: transparent; + background-color: fn.color(list.join($theme, --quiet --hover --bg)); + color: fn.color(list.join($theme, --quiet --hover --label)); + } + + &:active { + border-color: transparent; + background-color: fn.color(list.join($theme, --quiet --active --bg)); + color: fn.color(list.join($theme, --quiet --active --label)); + } + } + } + + @include iro.bem-is('selected') { + border-color: fn.color(list.join($theme, --selected --disabled --border)); + background-color: fn.color(list.join($theme, --selected --disabled --bg)); + color: fn.color(list.join($theme, --selected --disabled --label)); + + &:link, + &:visited, + &:enabled { + border-color: fn.color(list.join($theme, --selected --border)); + background-color: fn.color(list.join($theme, --selected --bg)); + color: fn.color(list.join($theme, --selected --label)); + + &:hover, + &:focus-visible { + border-color: fn.color(list.join($theme, --selected --hover --border)); + background-color: fn.color(list.join($theme, --selected --hover --bg)); + color: fn.color(list.join($theme, --selected --hover --label)); + } + + &:active { + border-color: fn.color(list.join($theme, --selected --active --border)); + background-color: fn.color(list.join($theme, --selected --active --bg)); + color: fn.color(list.join($theme, --selected --active --label)); + } + } + } +} + +@include iro.props-namespace('action-button') { + @include iro.props-store(( + --dims: ( + --line-height: 1.4, + --pad-i: fn.global-dim(--size --150), + --pad-i-pill: fn.global-dim(--size --200), + --pad-b: fn.global-dim(--size --85), + --border: fn.global-dim(--border --thin), + --rounding: fn.global-dim(--rounding), + --font-size: fn.global-dim(--font-size --100), + + --sm: ( + --pad-i: fn.global-dim(--size --100), + --pad-i-pill: fn.global-dim(--size --150), + --pad-b: fn.global-dim(--size --40), + --font-size: fn.global-dim(--font-size --75), + ), + --lg: ( + --pad-i: fn.global-dim(--size --175), + --pad-i-pill: fn.global-dim(--size --225), + --pad-b: fn.global-dim(--size --115), + --font-size: fn.global-dim(--font-size --150), + ), + --xl: ( + --pad-i: fn.global-dim(--size --225), + --pad-i-pill: fn.global-dim(--size --300), + --pad-b: fn.global-dim(--size --150), + --font-size: fn.global-dim(--font-size --200), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --bg: fn.global-color(--base --75), + --label: fn.global-color(--text), + --border: fn.global-color(--border-strong), + + --hover: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--heading), + --border: fn.global-color(--text-mute-more), + ), + --active: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--heading), + --border: fn.global-color(--text-mute), + ), + --disabled: ( + --bg: fn.global-color(--bg-l1), + --label: fn.global-color(--border-strong), + --border: fn.global-color(--border), + ), + --key-focus: ( + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + + --selected: ( + --bg: fn.global-color(--text-mute), + --label: fn.global-color(--base --50), + --border: fn.global-color(--text-mute), + + --hover: ( + --bg: fn.global-color(--text), + --label: fn.global-color(--base --50), + --border: fn.global-color(--text), + ), + --active: ( + --bg: fn.global-color(--heading), + --label: fn.global-color(--base --50), + --border: fn.global-color(--heading), + ), + --disabled: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--border-strong), + --border: fn.global-color(--border-mute), + ), + ), + + --quiet: ( + --label: fn.global-color(--text), + + --hover: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--heading), + ), + --active: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--heading), + ), + --disabled: ( + --label: fn.global-color(--border-strong), + ), + ), + ), + )); + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --bg: fn.global-color(--#{$theme}-transparent --100), + --label: fn.global-color(--#{$theme}-transparent --900), + --border: fn.global-color(--#{$theme}-transparent --400), + + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --900), + --border: fn.global-color(--#{$theme}-transparent --500), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --400), + --label: fn.global-color(--#{$theme}-transparent --900), + --border: fn.global-color(--#{$theme}-transparent --600), + ), + --disabled: ( + --bg: fn.global-color(--#{$theme}-transparent --100), + --label: fn.global-color(--#{$theme}-transparent --500), + --border: fn.global-color(--#{$theme}-transparent --300), + ), + --key-focus: ( + --border: fn.global-color(--#{$theme}-transparent --900), + --outline: fn.global-color(--#{$theme}-transparent --300), + ), + + --selected: ( + --bg: fn.global-color(--#{$theme}-transparent --800), + --label: fn.global-color(--#{$theme}-transparent --text), + --border: fn.global-color(--#{$theme}-transparent --100), + + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --900), + --label: fn.global-color(--#{$theme}-transparent --text), + --border: fn.global-color(--#{$theme}-transparent --100), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --900), + --label: fn.global-color(--#{$theme}-transparent --text), + --border: fn.global-color(--#{$theme}-transparent --100), + ), + --disabled: ( + --bg: fn.global-color(--#{$theme}-transparent --200), + --label: fn.global-color(--#{$theme}-transparent --500), + --border: fn.global-color(--#{$theme}-transparent --100), + ), + ), + + --quiet: ( + --label: fn.global-color(--#{$theme}-transparent --900), + + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --400), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + --disabled: ( + --label: fn.global-color(--#{$theme}-transparent --500), + ), + ), + ), + ) + )); + } + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border: fn.dim(--border) solid fn.color(--disabled --border); + border-radius: fn.dim(--rounding); + background-color: fn.color(--disabled --bg); + color: fn.color(--disabled --label); + line-height: fn.dim(--line-height); + text-align: center; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + + &::after { + content: ''; + display: none; + position: absolute; + z-index: 1; + inset: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); + border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + pointer-events: none; + } + + &:link, + &:visited, + &:enabled { + &:focus-visible { + &::after { + display: block; + } + } + } + + @include static-theme; + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + @include static-theme(--static-#{$theme}); + } + } + + @include iro.bem-modifier('pill') { + padding-inline: fn.dim(--pad-i-pill); + border-radius: 100em; + + &::after { + border-radius: 100em; + } + } + + @each $size in $sizes { + @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); + } + } + } + + @include iro.bem-modifier('icon') { + inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-b)); + padding-inline: 0; + + @each $size in $sizes { + @include iro.bem-modifier($size) { + inline-size: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--#{$size} --pad-b)); + padding-inline: 0; + } + } + } + } +} diff --git a/src_old/objects/_alert.scss b/src_old/objects/_alert.scss new file mode 100644 index 0000000..067c00c --- /dev/null +++ b/src_old/objects/_alert.scss @@ -0,0 +1,43 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$themes: 'accent' 'positive' 'negative' 'warning' !default; + +@include iro.props-namespace('alert') { + @include iro.props-store(( + --dims: ( + --border: fn.global-dim(--border --medium), + --pad-i: fn.global-dim(--size --250), + --pad-b: fn.global-dim(--size --200), + --rounding: fn.global-dim(--rounding), + ), + --colors: ( + --bg: fn.global-color(--bg-l2), + --border: fn.global-color(--text-mute-more), + ), + )); + + @each $theme in $themes { + @include iro.props-store(( + --colors: ( + --#{$theme}: ( + --border: fn.global-color(--#{$theme} --700), + ), + ), + )); + } + + @include iro.bem-object(iro.props-namespace()) { + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + + @each $theme in $themes { + @include iro.bem-modifier($theme) { + border-color: fn.color(--#{$theme} --border); + } + } + } +} diff --git a/src_old/objects/_avatar.scss b/src_old/objects/_avatar.scss new file mode 100644 index 0000000..19bff10 --- /dev/null +++ b/src_old/objects/_avatar.scss @@ -0,0 +1,167 @@ +@use 'sass:list'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$sizes: 'xs' 'sm' 'lg' 'xl' 'xxl' 'xxxl'; + +@mixin status($size: ()) { + @include iro.bem-elem('status') { + inline-size: fn.dim(list.join($size, --indicator-size)); + block-size: fn.dim(list.join($size, --indicator-size)); + + @include iro.bem-next-elem('content') { + mask-image: radial-gradient( + circle calc(.5 * fn.dim(list.join($size, --indicator-size)) + fn.dim(--indicator-spacing)) at + calc(100% - .5 * fn.dim(list.join($size, --indicator-size))) + calc(100% - .5 * fn.dim(list.join($size, --indicator-size))), + transparent 95%, + #fff + ); + } + } +} + +@include iro.props-namespace('avatar') { + @include iro.props-store(( + --dims: ( + --size: fn.global-dim(--size --500), + --font-size: fn.global-dim(--font-size --100), + --indicator-size: fn.global-dim(--size --150), + --indicator-spacing: fn.global-dim(--size --40), + --rounding: 25%, + + --xxxl: ( + --size: fn.global-dim(--size --1600), + --font-size: fn.global-dim(--font-size --800), + --indicator-size: fn.global-dim(--size --400), + ), + --xxl: ( + --size: fn.global-dim(--size --1200), + --font-size: fn.global-dim(--font-size --600), + --indicator-size: fn.global-dim(--size --300), + ), + --xl: ( + --size: fn.global-dim(--size --800), + --font-size: fn.global-dim(--font-size --300), + --indicator-size: fn.global-dim(--size --225), + ), + --lg: ( + --size: fn.global-dim(--size --650), + --font-size: fn.global-dim(--font-size --200), + --indicator-size: fn.global-dim(--size --175), + ), + --sm: ( + --size: fn.global-dim(--size --375), + --font-size: fn.global-dim(--font-size --75), + --indicator-size: fn.global-dim(--size --125), + ), + --xs: ( + --size: fn.global-dim(--size --250), + --font-size: fn.global-dim(--font-size --50), + --indicator-size: fn.global-dim(--size --100), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --h: 354, + --s: 44%, + --l: 45%, + + --key-focus: ( + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + border-radius: fn.dim(--rounding); + font-size: fn.dim(--font-size); + font-style: normal; + vertical-align: .05em; + + &::after { + content: ''; + display: none; + position: absolute; + z-index: 1; + inset: calc(-1 * fn.dim(--key-focus --border-offset)); + border: fn.dim(--key-focus --border-offset) solid transparent; + border-radius: fn.dim(--rounding); + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + pointer-events: none; + } + + @include iro.bem-elem('status') { + position: absolute; + inset-inline-end: 0; + inset-block-end: 0; + } + + @include status; + + @include iro.bem-elem('content') { + display: block; + inline-size: fn.dim(--size); + block-size: fn.dim(--size); + border-radius: fn.dim(--rounding); + line-height: fn.dim(--size); + text-align: center; + object-fit: cover; + object-position: center center; + } + + @include iro.bem-modifier('circle') { + border-radius: 100%; + + &::after { + border-radius: 100%; + } + + @include iro.bem-elem('content') { + border-radius: 100%; + } + } + + @include iro.bem-modifier('placeholder') { + @include iro.bem-elem('content') { + background-color: hsl(0, 0%, fn.color(--l)); + } + } + + @include iro.bem-modifier('colored') { + @include iro.bem-elem('content') { + background-color: hsl(fn.color(--h), fn.color(--s), fn.color(--l)); + color: #fff; + } + } + + @each $size in $sizes { + @include iro.bem-modifier($size) { + font-size: fn.dim(--#{$size} --font-size); + + @include status(--#{$size}); + + @include iro.bem-elem('content') { + inline-size: fn.dim(--#{$size} --size); + block-size: fn.dim(--#{$size} --size); + line-height: fn.dim(--#{$size} --size); + } + } + } + + &:focus-visible { + &::after { + display: block; + } + } + } +} diff --git a/src_old/objects/_backdrop.scss b/src_old/objects/_backdrop.scss new file mode 100644 index 0000000..d0eaf52 --- /dev/null +++ b/src_old/objects/_backdrop.scss @@ -0,0 +1,26 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('backdrop') { + @include iro.props-store(( + --dims: ( + --z-index: 10000, + --blur: 2em, + ), + --colors: ( + --bg: rgba(#000, .75), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + position: fixed; + z-index: fn.dim(--z-index); + inset: 0; + box-sizing: border-box; + flex-direction: column; + overflow: auto; + background-color: fn.color(--bg); + backdrop-filter: blur(fn.dim(--blur)); + } +} diff --git a/src_old/objects/_badge.scss b/src_old/objects/_badge.scss new file mode 100644 index 0000000..4e1662f --- /dev/null +++ b/src_old/objects/_badge.scss @@ -0,0 +1,300 @@ +@use 'sass:string'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$sizes: 'sm' 'lg' 'xl' !default; +$themes: 'accent' 'positive' 'negative' 'warning' !default; +$static-themes: 'black' 'white' !default; + +@mixin theme($theme) { + background-color: fn.color(--#{$theme} --bg); + color: fn.color(--#{$theme} --label); + + &:link, + &:visited, + &:enabled { + &:hover, + &:focus-visible { + background-color: fn.color(--#{$theme} --hover --bg); + color: fn.color(--#{$theme} --hover --label); + } + + &:active { + background-color: fn.color(--#{$theme} --active --bg); + color: fn.color(--#{$theme} --active --label); + } + } + + @include iro.bem-modifier('quiet') { + background-color: fn.color(--#{$theme}-quiet --bg); + color: fn.color(--#{$theme}-quiet --label); + + &:link, + &:visited, + &:enabled { + &:hover, + &:focus-visible { + background-color: fn.color(--#{$theme}-quiet --hover --bg); + color: fn.color(--#{$theme}-quiet --hover --label); + } + + &:active { + background-color: fn.color(--#{$theme}-quiet --active --bg); + color: fn.color(--#{$theme}-quiet --active --label); + } + } + } + + @if string.slice($theme, 1, 7) == 'static-' { + &::after { + outline: fn.color(--#{$theme} --key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--#{$theme} --key-focus --outline); + } + } +} + +@include iro.props-namespace('badge') { + @include iro.props-store(( + --dims: ( + --pad-b: fn.global-dim(--size --50), + --pad-i: fn.global-dim(--size --100), + --pad-i-pill: fn.global-dim(--size --150), + --pad-i-label: fn.global-dim(--size --50), + --rounding: fn.global-dim(--rounding), + --font-size: fn.global-dim(--font-size --75), + + --sm: ( + --pad-b: fn.global-dim(--size --25), + --pad-i: fn.global-dim(--size --75), + --pad-i-pill: fn.global-dim(--size --125), + --pad-i-label: fn.global-dim(--size --25), + --font-size: fn.global-dim(--font-size --50), + ), + --lg: ( + --pad-b: fn.global-dim(--size --75), + --pad-i: fn.global-dim(--size --125), + --pad-i-pill: fn.global-dim(--size --175), + --pad-i-label: fn.global-dim(--size --50), + --font-size: fn.global-dim(--font-size --100), + ), + --xl: ( + --pad-b: fn.global-dim(--size --100), + --pad-i: fn.global-dim(--size --150), + --pad-i-pill: fn.global-dim(--size --225), + --pad-i-label: fn.global-dim(--size --75), + --font-size: fn.global-dim(--font-size --150), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --bg: fn.global-color(--text-mute), + --label: fn.global-color(--bg-l2), + --hover: ( + --bg: fn.global-color(--text), + ), + --active: ( + --bg: fn.global-color(--heading), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + + --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}-static --900), + --label: fn.global-color(--#{$theme}-static --900-text), + --hover: ( + --bg: fn.global-color(--#{$theme}-static --1000), + --label: fn.global-color(--#{$theme}-static --1000-text), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-static --1100), + --label: fn.global-color(--#{$theme}-static --1000-text), + ), + ), + + --#{$theme}-quiet: ( + --bg: fn.global-color(--#{$theme} --200), + --label: fn.global-color(--#{$theme} --1100), + --hover: ( + --bg: fn.global-color(--#{$theme} --300), + --label: fn.global-color(--#{$theme} --1200), + ), + --active: ( + --bg: fn.global-color(--#{$theme} --400), + --label: fn.global-color(--#{$theme} --1300), + ), + ) + ), + )); + } + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --bg: fn.global-color(--#{$theme}-transparent --800), + --label: fn.global-color(--#{$theme}-transparent --text), + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --900), + --label: fn.global-color(--#{$theme}-transparent --text), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --900), + --label: fn.global-color(--#{$theme}-transparent --text), + ), + --key-focus: ( + --bg: fn.global-color(--#{$theme}-transparent --100), + --label: fn.global-color(--#{$theme}-transparent --900), + --border: fn.global-color(--#{$theme}-transparent --900), + --outline: fn.global-color(--#{$theme}-transparent --300), + ), + ), + + --static-#{$theme}-quiet: ( + --bg: fn.global-color(--#{$theme}-transparent --200), + --label: fn.global-color(--#{$theme}-transparent --900), + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --400), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + ) + ) + )); + } + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + background-clip: padding-box; + 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; + + &::after { + content: ''; + display: none; + position: absolute; + z-index: 1; + inset: calc(-1 * fn.dim(--key-focus --border-offset)); + border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + pointer-events: none; + } + + &:link, + &:visited, + &:enabled { + &:hover, + &:focus-visible { + background-color: fn.color(--hover --bg); + } + + &:active { + background-color: fn.color(--active --bg); + } + } + + @include iro.bem-elem('label') { + margin-inline: fn.dim(--pad-i-label); + } + + @include iro.bem-modifier('quiet') { + background-color: fn.color(--quiet --bg); + color: fn.color(--quiet --label); + + &:link, + &:visited, + &:enabled { + &:hover, + &:focus-visible { + background-color: fn.color(--quiet --hover --bg); + } + + &:active { + background-color: fn.color(--quiet --active --bg); + } + } + } + + @each $theme in $themes { + @include iro.bem-modifier($theme) { + @include theme($theme); + } + } + + &:link, + &:visited, + &:enabled { + &:focus-visible { + &::after { + display: block; + } + } + } + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + @include theme(static-#{$theme}); + } + } + + @include iro.bem-modifier('pill') { + padding-inline: fn.dim(--pad-i-pill); + border-radius: 10em; + + &::after { + border-radius: 10em; + } + } + + @each $size in $sizes { + @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-elem('label') { + margin-inline: fn.dim(--#{$size} --pad-i-label); + } + + @include iro.bem-modifier('pill') { + padding-inline: fn.dim(--#{$size} --pad-i-pill); + } + } + } + } +} diff --git a/src_old/objects/_button.scss b/src_old/objects/_button.scss new file mode 100644 index 0000000..3ef4813 --- /dev/null +++ b/src_old/objects/_button.scss @@ -0,0 +1,301 @@ +@use 'sass:list'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$sizes: 'sm' 'lg' 'xl' !default; +$themes: 'accent' 'negative' !default; +$static-themes: 'black' 'white' !default; + +@mixin theme($theme: ()) { + &:link, + &:visited, + &:enabled { + border-color: transparent; + background-color: fn.color(list.join($theme, --bg)); + color: fn.color(list.join($theme, --label)); + } + + @include iro.bem-modifier('outline') { + &:link, + &:visited, + &:enabled { + border-color: fn.color(list.join($theme, --outline-border)); + background-color: transparent; + color: fn.color(list.join($theme, --outline-label)); + } + } + + &:link, + &:visited, + &:enabled { + &:hover, + &:focus-visible { + border-color: transparent; + background-color: fn.color(list.join($theme, --hover --bg)); + color: fn.color(list.join($theme, --hover --label)); + } + + &:active { + border-color: transparent; + background-color: fn.color(list.join($theme, --active --bg)); + color: fn.color(list.join($theme, --active --label)); + } + } +} + +@mixin static-theme($theme: ()) { + border-color: transparent; + background-color: fn.color(list.join($theme, --disabled --bg)); + color: fn.color(list.join($theme, --disabled --label)); + + &::after { + outline: fn.color(list.join($theme, --key-focus --border)) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(list.join($theme, --key-focus --outline)); + } + + @include iro.bem-modifier('outline') { + border-color: fn.color(list.join($theme, --disabled --outline-border)); + background-color: transparent; + } + + @include theme($theme); + + @include iro.bem-modifier('primary') { + @include theme(list.join($theme, --primary)); + } +} + +@include iro.props-namespace('button') { + @include iro.props-store(( + --dims: ( + --line-height: 1.4, + --pad-i: fn.global-dim(--size --200), + --pad-i-label: fn.global-dim(--size --75), + --pad-b: fn.global-dim(--size --65), + --border: fn.global-dim(--border --medium), + --rounding: 10em, + --font-size: fn.global-dim(--font-size --100), + + --sm: ( + --pad-i: fn.global-dim(--size --150), + --pad-i-label: fn.global-dim(--size --50), + --pad-b: fn.global-dim(--size --25), + --font-size: fn.global-dim(--font-size --75), + ), + --lg: ( + --pad-i: fn.global-dim(--size --250), + --pad-i-label: fn.global-dim(--size --100), + --pad-b: fn.global-dim(--size --100), + --font-size: fn.global-dim(--font-size --150), + ), + --xl: ( + --pad-i: fn.global-dim(--size --300), + --pad-i-label: fn.global-dim(--size --150), + --pad-b: fn.global-dim(--size --150), + --font-size: fn.global-dim(--font-size --200), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--text), + --outline-border: fn.global-color(--border), + --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), + --outline-border: fn.global-color(--border), + --label: fn.global-color(--text-disabled), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + + --primary: ( + --bg: fn.global-color(--base --800), + --label: fn.global-color(--base --800-text), + --outline-border: fn.global-color(--base --800), + --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 { + @include iro.props-store(( + --colors: ( + --#{$theme}: ( + --bg: fn.global-color(--#{$theme}-static --900), + --label: fn.global-color(--#{$theme}-static --900-text), + --outline-border: fn.global-color(--#{$theme} --900), + --outline-label: fn.global-color(--#{$theme} --1000), + + --hover: ( + --bg: fn.global-color(--#{$theme}-static --1000), + --label: fn.global-color(--#{$theme}-static --1000-text), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-static --1100), + --label: fn.global-color(--#{$theme}-static --1100-text), + ), + ), + ), + )); + } + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --bg: fn.global-color(--#{$theme}-transparent --200), + --label: fn.global-color(--#{$theme}-transparent --900), + --outline-border: fn.global-color(--#{$theme}-transparent --300), + --outline-label: fn.global-color(--#{$theme}-transparent --900), + + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --400), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + --disabled: ( + --bg: fn.global-color(--#{$theme}-transparent --200), + --outline-border: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --500), + ), + --key-focus: ( + --bg: fn.global-color(--#{$theme}-transparent --100), + --label: fn.global-color(--#{$theme}-transparent --900), + --border: fn.global-color(--#{$theme}-transparent --900), + --outline: fn.global-color(--#{$theme}-transparent --300), + ), + + --primary: ( + --bg: fn.global-color(--#{$theme}-transparent --800), + --label: fn.global-color(--#{$theme}-transparent --text), + --outline-border: fn.global-color(--#{$theme}-transparent --800), + --outline-label: fn.global-color(--#{$theme}-transparent --900), + + --hover: ( + --bg: fn.global-color(--#{$theme}-transparent --900), + --label: fn.global-color(--#{$theme}-transparent --text), + ), + --active: ( + --bg: fn.global-color(--#{$theme}-transparent --900), + --label: fn.global-color(--#{$theme}-transparent --text), + ), + ), + ), + ), + )); + } + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border: fn.dim(--border) 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-size: fn.dim(--font-size); + font-weight: 500; + line-height: fn.dim(--line-height); + text-align: center; + text-decoration: none; + + &::after { + content: ''; + display: none; + position: absolute; + z-index: 1; + inset: calc(-1 * fn.dim(--border) - fn.dim(--key-focus --border-offset)); + border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + pointer-events: none; + } + + &:link, + &:visited, + &:enabled { + &:focus-visible { + &::after { + display: block; + } + } + } + + @include iro.bem-elem('label') { + margin-inline: fn.dim(--pad-i-label); + } + + @include iro.bem-modifier('block') { + display: block; + } + + @include iro.bem-modifier('outline') { + border-color: fn.color(--disabled --outline-border); + background-color: transparent; + } + + @each $size in $sizes { + @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-elem('label') { + margin-inline: fn.dim(--#{$size} --pad-i-label); + } + } + } + + @include static-theme; + + @each $theme in $themes { + @include iro.bem-modifier($theme) { + @include theme(--#{$theme}); + } + } + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + @include static-theme(--static-#{$theme}); + } + } + + @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_old/objects/_card.scss b/src_old/objects/_card.scss new file mode 100644 index 0000000..650ec3f --- /dev/null +++ b/src_old/objects/_card.scss @@ -0,0 +1,170 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('card') { + @include iro.props-store(( + --dims: ( + --divider: fn.global-dim(--border --thin), + --pad-i: fn.global-dim(--size --300), + --pad-b: fn.global-dim(--size --250), + --spacing: fn.global-dim(--size --200), + --rounding: fn.global-dim(--rounding), + + --hover: ( + --offset-b: calc(-1 * fn.global-dim(--size --65)), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --bg: fn.global-color(--bg-l2), + --divider: fn.global-color(--border-mute), + + --key-focus: ( + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + + --quiet: ( + --image: fn.global-color(--bg-base), + + --hover: ( + --image: fn.global-color(--border), + ), + ) + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: block; + margin: calc(-1 * fn.dim(--key-focus --border)); + transition: transform .2s; + border: fn.dim(--key-focus --border-offset) solid transparent; + border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); + background-color: fn.color(--bg); + background-clip: content-box; + + @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { + &:hover, + &:active, + &:focus-visible { + transform: translateY(fn.dim(--hover --offset-b)); + } + + &:focus-visible { + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + } + } + + @include iro.bem-elem('avatar') { + margin-block-start: fn.dim(--pad-b); + margin-inline-start: fn.dim(--pad-i); + } + + @include iro.bem-elem('image') { + display: block; + inline-size: 100%; + object-fit: cover; + transition: transform .2s, opacity .2s; + + &:first-child { + border-start-start-radius: fn.dim(--rounding); + border-start-end-radius: fn.dim(--rounding); + } + + &:last-child { + border-end-start-radius: fn.dim(--rounding); + border-end-end-radius: fn.dim(--rounding); + } + + @include iro.bem-next-elem('avatar') { + margin-block-start: calc(-.7 * fn.foreign-dim(--avatar, --xl --size)); + } + } + + @include iro.bem-elem('body') { + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + + &::before { + content: ''; + display: block; + margin-block: -100em 100em; + } + } + + @include iro.bem-elem('content') { + margin-block-start: fn.dim(--spacing); + } + + @include iro.bem-elem('footer') { + padding-block: 0 fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + margin-block-start: calc(-1 * fn.dim(--pad-b)); + + &::before { + content: ''; + display: block; + block-size: fn.dim(--divider); + margin-block: fn.dim(--spacing); + background-color: fn.color(--divider); + } + } + + @include iro.bem-modifier('quiet') { + position: relative; + border: 0; + background-color: transparent; + + @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { + &:hover, + &:active, + &:focus-visible { + transform: none; + + @include iro.bem-elem('image') { + transform: translateY(fn.dim(--hover --offset-b)); + opacity: .75; + background-color: fn.color(--quiet --hover --image); + } + } + + &:focus-visible { + outline: none; + box-shadow: none; + + @include iro.bem-elem('image') { + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + opacity: 1; + background-color: fn.color(--quiet --hover --image); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + } + } + } + + @include iro.bem-elem('image') { + position: relative; + margin: calc(-1 * fn.dim(--key-focus --border)); + border: fn.dim(--key-focus --border-offset) solid transparent; + border-radius: calc(fn.dim(--rounding) + fn.dim(--key-focus --border-offset)); + background-color: fn.color(--quiet --image); + background-clip: padding-box; + } + + @include iro.bem-elem('body') { + padding: 0; + padding-block-start: fn.dim(--spacing); + } + + @include iro.bem-elem('footer') { + padding-inline: 0; + } + } + } +} diff --git a/src_old/objects/_checkbox.scss b/src_old/objects/_checkbox.scss new file mode 100644 index 0000000..8527948 --- /dev/null +++ b/src_old/objects/_checkbox.scss @@ -0,0 +1,261 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('checkbox') { + @include iro.props-store(( + --dims: ( + --size: fn.global-dim(--size --175), + --label-gap: fn.global-dim(--size --125), + --border: fn.global-dim(--border --medium), + --pad-i: fn.global-dim(--size --65), + --pad-b: fn.global-dim(--size --65), + --rounding: fn.global-dim(--rounding), + --spacing-sibling: fn.global-dim(--size --300), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --box-border: fn.global-color(--text-mute-more), + --box-bg: fn.global-color(--base --75), + + --hover: ( + --label: fn.global-color(--heading), + --box-border: fn.global-color(--text-mute), + ), + --accent: ( + --box-border: fn.global-color(--accent --900), + + --hover: ( + --box-border: fn.global-color(--accent --1000), + ), + ), + --disabled: ( + --label: fn.global-color(--text-disabled), + --box-border: fn.global-color(--border-strong), + --box-bg: fn.global-color(--base --75), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + margin-inline: + calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) + calc(fn.dim(--spacing-sibling) - fn.dim(--pad-b) - fn.dim(--key-focus --border-offset)); + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + + @include iro.bem-elem('box') { + display: inline-block; + position: relative; + flex: 0 0 auto; + inline-size: fn.dim(--size); + block-size: fn.dim(--size); + margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--size) - fn.dim(--key-focus --border-offset)); + border: fn.dim(--key-focus --border-offset) solid transparent; + border-radius: calc(fn.dim(--border) + fn.dim(--key-focus --border-offset)); + background-color: fn.color(--box-border); + background-clip: padding-box; + vertical-align: top; + + &::before, + &::after { + content: ''; + display: block; + position: absolute; + } + + &::before { + z-index: 2; + inset-block-start: fn.dim(--border); + inset-inline-start: fn.dim(--border); + inline-size: calc(fn.dim(--size) - 2 * fn.dim(--border)); + block-size: calc(fn.dim(--size) - 2 * fn.dim(--border)); + transition: transform .2s ease; + background-color: fn.color(--box-bg); + } + + &::after { + z-index: 3; + inset-block-start: calc(.5 * fn.dim(--size) - 1px); + inset-inline-start: calc(1.5 * fn.dim(--border)); + box-sizing: border-box; + inline-size: calc(fn.dim(--size) - 3 * fn.dim(--border)); + block-size: 0; + transform: scale(0); + transition: transform .2s ease; + border-block-width: 0 2px; + border-inline-width: 0 2px; + border-style: solid; + border-radius: 2px; + border-color: fn.color(--box-bg); + } + } + + @include iro.bem-elem('check-icon') { + display: block; + position: absolute; + z-index: 2; + inset-block-start: calc(1 * fn.dim(--border)); + inset-inline-start: calc(1 * fn.dim(--border)); + inline-size: calc(100% - 2 * fn.dim(--border)); + block-size: calc(100% - 2 * fn.dim(--border)); + margin: 0; + transform: scale(0); + transform-origin: 40% 90%; + transition: transform .2s ease; + stroke-width: iro.fn-px-to-rem(3px); + color: fn.color(--box-bg); + } + + @include iro.bem-elem('label') { + margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset)); + } + + @include iro.bem-elem('native') { + appearance: none; + position: absolute; + z-index: -1; + inset-block-start: 0; + inset-inline-start: 0; + inline-size: 100%; + block-size: 100%; + margin: 0; + padding: 0; + overflow: hidden; + border-radius: fn.dim(--rounding); + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('label') { + color: fn.color(--hover --label); + } + + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--hover --box-border); + } + } + + &:checked { + @include iro.bem-sibling-elem('box') { + &::before { + transform: scale(0); + } + + @include iro.bem-elem('check-icon') { + transform: scale(1); + } + } + } + + &:indeterminate { + @include iro.bem-sibling-elem('box') { + &::before { + transform: scale(0); + } + + &::after { + transform: scale(1); + } + + @include iro.bem-elem('check-icon') { + transform: scale(0); + } + } + } + + &:disabled { + @include iro.bem-sibling-elem('label') { + color: fn.color(--disabled --label); + } + + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--disabled --box-border); + + &::before { + background-color: fn.color(--disabled --box-bg); + } + } + } + + &:focus-visible { + @include iro.bem-sibling-elem('label') { + color: fn.color(--key-focus --label); + } + + @include iro.bem-sibling-elem('box') { + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + } + } + } + + @include iro.bem-modifier('standalone') { + @include iro.bem-elem('box') { + margin-block-start: 0; + } + } + + @include iro.bem-modifier('accent') { + @include iro.bem-elem('native') { + &:checked { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--accent --box-border); + } + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--accent --hover --box-border); + } + } + } + + &:indeterminate { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--accent --box-border); + } + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--accent --hover --box-border); + } + } + } + + &:disabled { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--disabled --box-border); + + &::before { + background-color: fn.color(--disabled --box-bg); + } + } + + &:checked { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--disabled --box-border); + } + } + + &:indeterminate { + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--disabled --box-border); + } + } + } + } + } + } +} diff --git a/src_old/objects/_divider.scss b/src_old/objects/_divider.scss new file mode 100644 index 0000000..d1e2897 --- /dev/null +++ b/src_old/objects/_divider.scss @@ -0,0 +1,203 @@ +@use 'sass:map'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../config'; + +$static-themes: 'black' 'white' !default; + +@include iro.props-namespace('divider') { + @include iro.props-store(( + --dims: ( + --margin-b: fn.global-dim(--size --85), + + --strong: ( + --border: fn.global-dim(--border --thick), + --label-font-size: fn.global-dim(--font-size --100), + ), + --medium: ( + --border: fn.global-dim(--border --medium), + --label-font-size: fn.global-dim(--font-size --75), + ), + --faint: ( + --border: fn.global-dim(--border --thin), + --label-font-size: fn.global-dim(--font-size --50), + ), + ), + --colors: ( + --strong: ( + --bg: fn.global-color(--text), + --label: fn.global-color(--text), + ), + --medium: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--text-mute), + ), + --faint: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--text-mute-more), + ), + ), + )); + + @each $color in map.keys(map.get(config.$themes, config.$theme-default, --palettes)) { + @if $color != '--base' { + @include iro.props-store(( + --colors: ( + $color: ( + --bg: fn.global-color($color --800), + --label: fn.global-color($color --1000), + ) + ), + )); + } + } + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --strong: ( + --bg: fn.global-color(--#{$theme}-transparent --800), + --label: fn.global-color(--#{$theme}-transparent --900), + ), + --medium: ( + --bg: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --500), + ), + --faint: ( + --bg: fn.global-color(--#{$theme}-transparent --300), + --label: fn.global-color(--#{$theme}-transparent --500), + ), + ) + ), + )); + } + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + flex: 0 0 auto; + flex-direction: row; + align-items: center; + block-size: 1em; + margin-block: fn.dim(--margin-b); + color: fn.color(--strong --label); + font-size: fn.dim(--strong --label-font-size); + font-weight: 700; + letter-spacing: .5px; + line-height: 1; + text-transform: uppercase; + + &::before, + &::after { + content: ''; + flex: 1 1 auto; + inline-size: 100%; + block-size: fn.dim(--strong --border); + background-color: fn.color(--strong --bg); + } + + &::before { + display: block; + } + + @include iro.bem-elem('label') { + flex: 0 0 auto; + } + + @include iro.bem-modifier('vertical') { + align-self: stretch; + inline-size: 1px; + block-size: auto; + margin-block: 0; + background-color: fn.color(--faint --bg); + + &::before, + &::after { + display: none; + } + } + + @include iro.bem-modifier('medium') { + color: fn.color(--medium --label); + font-size: fn.dim(--medium --label-font-size); + font-weight: 500; + + &::before, + &::after { + block-size: fn.dim(--medium --border); + background-color: fn.color(--medium --bg); + } + } + + @include iro.bem-modifier('faint') { + color: fn.color(--faint --label); + font-size: fn.dim(--faint --label-font-size); + font-weight: 500; + + &::before, + &::after { + block-size: fn.dim(--faint --border); + background-color: fn.color(--faint --bg); + } + } + + @include iro.bem-modifier('labelled') { + &::before { + margin-inline-end: 1em; + } + + &::after { + display: block; + margin-inline-start: 1em; + } + } + + @each $color in 'blue' 'purple' 'red' 'green' 'yellow' { + @include iro.bem-modifier($color) { + &::before, + &::after { + background-color: fn.color(--#{$color} --bg); + } + + @include iro.bem-elem('label') { + color: fn.color(--#{$color} --label); + } + } + } + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + &::before, + &::after { + background-color: fn.color(--static-#{$theme} --strong --bg); + } + + @include iro.bem-elem('label') { + color: fn.color(--static-#{$theme} --strong --label); + } + + @include iro.bem-modifier('medium') { + &::before, + &::after { + background-color: fn.color(--static-#{$theme} --medium --bg); + } + + @include iro.bem-elem('label') { + color: fn.color(--static-#{$theme} --medium --label); + } + } + + @include iro.bem-modifier('faint') { + &::before, + &::after { + background-color: fn.color(--static-#{$theme} --faint --bg); + } + + @include iro.bem-elem('label') { + color: fn.color(--static-#{$theme} --faint --label); + } + } + } + } + } +} diff --git a/src_old/objects/_emoji.scss b/src_old/objects/_emoji.scss new file mode 100644 index 0000000..d8d1289 --- /dev/null +++ b/src_old/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_old/objects/_field-label.scss b/src_old/objects/_field-label.scss new file mode 100644 index 0000000..1518ea6 --- /dev/null +++ b/src_old/objects/_field-label.scss @@ -0,0 +1,86 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('field-label') { + @include iro.props-store(( + --dims: ( + --spacing-i: fn.global-dim(--size --150), + --spacing-b: fn.global-dim(--size --85), + --label-font-size: fn.global-dim(--font-size --75), + --hint-font-size: fn.global-dim(--font-size --75), + ), + --colors: ( + --label: fn.global-color(--text-mute), + --hint: fn.global-color(--text-mute), + --error-hint: fn.global-color(--negative --900), + --disabled: fn.global-color(--text-disabled), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: block; + + @include iro.bem-elem('label') { + display: block; + flex: 0 0 auto; + padding-inline-end: fn.dim(--spacing-i); + color: fn.color(--label); + font-size: fn.dim(--label-font-size); + font-weight: 400; + line-height: 1.3; + + @include iro.bem-next-elem('content') { + margin-block-start: fn.dim(--spacing-b); + } + } + + @include iro.bem-elem('content') { + display: block; + flex: 1 1 auto; + } + + @include iro.bem-elem('hint') { + display: block; + margin-block-start: fn.dim(--spacing-b); + color: fn.color(--hint); + font-size: fn.dim(--hint-font-size); + } + + @include iro.bem-is('invalid') { + @include iro.bem-elem('hint') { + color: fn.color(--error-hint); + } + } + + @include iro.bem-is('disabled') { + @include iro.bem-elem('label', 'hint') { + color: fn.color(--disabled); + } + } + + @include iro.bem-modifier('align-start', 'align-end') { + display: flex; + align-items: baseline; + + @include iro.bem-elem('label') { + display: inline-block; + + @include iro.bem-next-elem('content') { + margin-block-start: 0; + } + } + } + + @include iro.bem-modifier('align-start') { + @include iro.bem-elem('label') { + text-align: start; + } + } + + @include iro.bem-modifier('align-end') { + @include iro.bem-elem('label') { + text-align: end; + } + } + } +} diff --git a/src_old/objects/_heading.scss b/src_old/objects/_heading.scss new file mode 100644 index 0000000..7990a6b --- /dev/null +++ b/src_old/objects/_heading.scss @@ -0,0 +1,118 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../mixins' as mx; +@use '../config'; +@use 'include-media/dist/include-media' as media; + +$sizes: 'xxl' 'xl' 'lg' 'md' 'sm' 'xs'; + +@include iro.props-namespace('heading') { + @include iro.props-store(( + --dims: ( + --offset: -.02em, + ), + --colors: ( + --bg: fn.global-color(--base --50), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + @include mx.set-font(--headline); + + display: block; + margin-block-start: fn.global-dim(--heading --margin-bs); + transform: translateX(fn.dim(--offset)); + letter-spacing: normal; + text-transform: none; + + & + & { + margin-block-start: fn.global-dim(--heading --margin-bs-sibling); + } + + @include iro.bem-elem('highlight') { + background-image: linear-gradient( + to top, + transparent .05em, + fn.color(--bg) .05em, + fn.color(--bg) .5em, + transparent .5em + ); + } + + @include iro.bem-modifier('xxl') { + @include mx.heading-strong(--xxl); + } + + @include iro.bem-modifier('xl') { + @include mx.heading-strong(--xl); + } + + @include iro.bem-modifier('lg') { + @include mx.heading-medium(--lg); + } + + @include iro.bem-modifier('md') { + @include mx.heading-medium(--md); + } + + @include iro.bem-modifier('sm') { + @include mx.heading-faint(--sm); + } + + @include iro.bem-modifier('xs') { + @include mx.heading-faint(--xs); + } + + @include iro.bem-modifier('display') { + @include mx.set-font(--headline); + + @include iro.bem-modifier('xxl') { + @include mx.heading-strong(--display --xxl); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --xxl); + } + } + + @include iro.bem-modifier('xl') { + @include mx.heading-strong(--display --xl); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --xl); + } + } + + @include iro.bem-modifier('lg') { + @include mx.heading-strong(--display --lg); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --lg); + } + } + + @include iro.bem-modifier('md') { + @include mx.heading-strong(--display --md); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --md); + } + } + + @include iro.bem-modifier('sm') { + @include mx.heading-medium(--display --sm); + + @include media.media('<=md') { + @include mx.heading-medium(--display-sm --sm); + } + } + + @include iro.bem-modifier('xs') { + @include mx.heading-faint(--display --xs); + + @include media.media('<=md') { + @include mx.heading-faint(--display-sm --xs); + } + } + } + } +} diff --git a/src_old/objects/_icon.scss b/src_old/objects/_icon.scss new file mode 100644 index 0000000..1491dd9 --- /dev/null +++ b/src_old/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_old/objects/_lightbox.scss b/src_old/objects/_lightbox.scss new file mode 100644 index 0000000..8ad8584 --- /dev/null +++ b/src_old/objects/_lightbox.scss @@ -0,0 +1,313 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@use 'action-button'; + +$static-themes: 'black' 'white' !default; + +@include iro.props-namespace('lightbox') { + @include iro.props-store(( + --dims: ( + --pad: fn.global-dim(--size --150), + + --thumbnail: ( + --size: fn.global-dim(--size --700), + --rounding: fn.global-dim(--rounding), + --spacing: fn.global-dim(--size --100), + --border: fn.global-dim(--border --thin), + + --selected: ( + --border: fn.global-dim(--border --medium), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + + --close-button: ( + --font-size: fn.global-dim(--font-size --200), + ), + + --nav-button: ( + --width: fn.global-dim(--size --2000), + --height: fn.global-dim(--size --3800), + --font-size: fn.global-dim(--font-size --200), + ), + ), + --colors: ( + --thumbnail: ( + --border: fn.global-color(--border-strong), + + --hover: ( + --border: fn.global-color(--text-mute-more), + ), + + --selected: ( + --border: fn.global-color(--heading), + ), + + --key-focus: ( + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + ), + )); + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --text: fn.global-color(--white-transparent --800), + --thumbnail: ( + --border: fn.global-color(--white-transparent --400), + + --hover: ( + --border: fn.global-color(--white-transparent --500), + ), + + --selected: ( + --border: fn.global-color(--white-transparent --900), + ), + + --key-focus: ( + --border: fn.global-color(--#{$theme}-transparent --900), + --outline: fn.global-color(--#{$theme}-transparent --300), + ), + ), + ) + ) + )); + } + + @include iro.props-store(( + --dims: ( + --thumbnail: ( + --size: fn.global-dim(--size --600), + ), + --nav-button: ( + --width: fn.global-dim(--size --2500), + --height: fn.global-dim(--size --2500), + ), + ), + ), 'md'); + + @include iro.bem-object(iro.props-namespace()) { + display: grid; + grid-template-rows: auto minmax(0, 1fr) auto auto; + grid-template-columns: auto minmax(0, 1fr) auto; + grid-template-areas: + 'header header header' + 'prev content next' + 'thumbnails thumbnails thumbnails' + 'footer footer footer'; + box-sizing: border-box; + min-block-size: 0; + flex: 1 1 auto; + + @include iro.bem-elem('header') { + grid-area: header; + display: flex; + align-items: flex-start; + padding-block-start: fn.dim(--pad); + padding-inline: fn.dim(--pad); + } + + @include iro.bem-elem('img') { + display: none; + box-sizing: border-box; + grid-area: content; + max-inline-size: 100%; + max-block-size: 100%; + place-self: center; + padding: fn.dim(--pad); + + @include iro.bem-sibling-elem('img') { + @include iro.bem-modifier('default') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + } + } + } + } + + @include iro.bem-multi('&:target', 'is' 'visible') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + + @include iro.bem-next-elem('nav-btn') { + display: block; + } + } + + @include iro.bem-sibling-elem('img') { + @include iro.bem-modifier('default') { + display: none; + + @include iro.bem-next-elem('nav-btn') { + display: none; + + @include iro.bem-next-elem('nav-btn') { + display: none; + } + } + } + } + } + } + + @include iro.bem-elem('thumbnails') { + grid-area: thumbnails; + display: flex; + gap: fn.dim(--thumbnail --spacing); + padding: fn.dim(--pad); + margin-block-start: calc(-1 * fn.dim(--pad)); + overflow: auto; + } + + @include iro.bem-elem('footer') { + grid-area: footer; + display: flex; + align-items: flex-start; + padding-block: 0 fn.dim(--pad); + padding-inline: fn.dim(--pad); + } + + @include iro.bem-elem('thumbnail') { + position: relative; + flex: 0 0 auto; + inline-size: fn.dim(--thumbnail --size); + block-size: fn.dim(--thumbnail --size); + overflow: hidden; + border-radius: fn.dim(--thumbnail --rounding); + outline: fn.dim(--thumbnail --border) solid fn.color(--thumbnail --border); + outline-offset: calc(-1 * fn.dim(--thumbnail --border)); + opacity: .75; + + &:hover, + &:active, + &:focus-visible { + outline-color: fn.color(--thumbnail --hover --border); + opacity: 1; + } + + @include iro.bem-is('selected') { + $focus-border-offset: calc(-1 * fn.dim(--thumbnail --selected --border)); + + margin: $focus-border-offset; + border: fn.dim(--thumbnail --selected --border) solid fn.color(--thumbnail --selected --border); + border-radius: calc(fn.dim(--thumbnail --rounding) - $focus-border-offset); + outline: none; + opacity: 1; + } + + &:focus-visible { + $focus-border-offset: calc(-1 * fn.dim(--thumbnail --key-focus --border-offset)); + + margin: $focus-border-offset; + border: fn.dim(--thumbnail --key-focus --border-offset) solid transparent; + border-radius: calc(fn.dim(--thumbnail --rounding) - $focus-border-offset); + outline: fn.dim(--thumbnail --key-focus --border) solid fn.color(--thumbnail --key-focus --border); + outline-offset: 0; + box-shadow: 0 0 0 calc(fn.dim(--thumbnail --key-focus --outline) + fn.dim(--thumbnail --key-focus --border)) fn.color(--thumbnail --key-focus --outline); + } + } + + @include iro.bem-elem('thumbnail-img') { + display: block; + position: absolute; + inset-block-start: 0; + inset-inline-start: 0; + inline-size: 100%; + block-size: 100%; + object-fit: cover; + object-position: center center; + } + + @include iro.bem-elem('thumbnail-icon') { + position: absolute; + inset-block-start: 50%; + inset-inline-start: 50%; + transform: translate(-50%, -50%); + } + + @include iro.bem-elem('close-btn') { + flex: 0 0 auto; + margin-block-start: calc(-.5 * fn.dim(--pad)); + margin-inline: auto calc(-.5 * fn.dim(--pad)); + font-size: fn.dim(--close-button --font-size); + } + + @include iro.bem-elem('nav-btn') { + display: none; + position: relative; + align-self: center; + overflow: visible; + font-size: fn.dim(--nav-button --font-size); + + &::before { + content: ''; + display: block; + position: absolute; + inset-block-start: 50%; + inline-size: fn.dim(--nav-button --width); + block-size: fn.dim(--nav-button --height); + transform: translateY(-50%); + } + + @include iro.bem-modifier('prev') { + grid-area: prev; + margin-inline: calc(.5 * fn.dim(--pad)) calc(-1 * fn.dim(--pad)); + + &::before { + inset-inline-start: 0; + } + } + + @include iro.bem-modifier('next') { + grid-area: next; + margin-inline: calc(-1 * fn.dim(--pad)) calc(.5 * fn.dim(--pad)); + + &::before { + inset-inline-end: 0; + } + } + } + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + color: fn.color(--static-#{$theme} --text); + + @include iro.bem-elem('thumbnail') { + outline-color: fn.color(--static-#{$theme} --thumbnail --border); + + &:hover, + &:active, + &:focus-visible { + outline-color: fn.color(--static-#{$theme} --thumbnail --hover --border); + } + + @include iro.bem-is('selected') { + border-color: fn.color(--static-#{$theme} --thumbnail --selected --border); + } + + &:focus-visible { + border-color: transparent; + outline-color: fn.color(--static-#{$theme} --thumbnail --key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--thumbnail --key-focus --outline) + fn.dim(--thumbnail --key-focus --border)) fn.color(--static-#{$theme} --thumbnail --key-focus --outline); + } + } + } + } + } +} diff --git a/src_old/objects/_menu.scss b/src_old/objects/_menu.scss new file mode 100644 index 0000000..0f691a2 --- /dev/null +++ b/src_old/objects/_menu.scss @@ -0,0 +1,137 @@ +/* stylelint-disable length-zero-no-unit */ + +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@use './icon'; + +@include iro.props-namespace('menu') { + @include iro.props-store(( + --dims: ( + --spacing: 0em, + --header: ( + --font-size: fn.global-dim(--font-size --50), + ), + --separator: fn.global-dim(--size --100), + --item: ( + --pad-i: fn.global-dim(--size --150), + --pad-b: fn.global-dim(--size --100), + --rounding: 0em, + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + ), + --colors: ( + --separator: fn.global-color(--border), + --header: ( + --label: fn.global-color(--heading), + ), + --item: ( + --hover: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--heading), + ), + --active: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--heading), + ), + --disabled: ( + --label: fn.global-color(--text-disabled), + ), + --key-focus: ( + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + flex-direction: column; + gap: fn.dim(--spacing); + + @include iro.bem-elem('header') { + padding-block: fn.dim(--item --pad-b); + padding-inline: fn.dim(--item --pad-i); + color: fn.color(--header --label); + font-size: fn.dim(--header --font-size); + font-weight: 500; + letter-spacing: .5px; + text-transform: uppercase; + + @include iro.bem-next-twin-elem { + margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); + } + } + + @include iro.bem-elem('item') { + padding-block: fn.dim(--item --pad-b); + padding-inline: fn.dim(--item --pad-i); + margin: calc(-1 * fn.dim(--item --key-focus --outline)); + border: fn.dim(--item --key-focus --outline) solid transparent; + border-radius: calc(fn.dim(--item --rounding) + fn.dim(--item --key-focus --outline)); + color: fn.color(--item --disabled --label); + background-clip: padding-box; + + &:link, + &:visited, + &:enabled { + color: currentColor; + + @include iro.bem-multi('&:hover, &:focus-visible', 'is' 'selected') { + background-color: fn.color(--item --hover --bg); + color: fn.color(--item --hover --label); + } + + &:active { + background-color: fn.color(--item --active --bg); + color: fn.color(--item --active --label); + } + + &:focus-visible { + outline: fn.color(--item --key-focus --border) solid fn.dim(--item --key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--item --key-focus --border) + fn.dim(--item --key-focus --outline)) fn.color(--item --key-focus --outline); + } + } + + @include iro.bem-next-elem('header') { + margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); + } + } + + @include iro.bem-elem('header') { + &:link, + &:visited, + &:enabled { + color: fn.color(--header --label); + } + } + + @include iro.bem-elem('separator') { + block-size: 1px; + margin-block: fn.dim(--separator); + margin-inline: fn.dim(--item --pad-i); + background-color: fn.color(--separator); + } + + @include iro.bem-elem('slot') { + padding-block: fn.dim(--item --pad-b); + padding-inline: fn.dim(--item --pad-i); + } + + @include iro.bem-elem('icon-slot') { + display: flex; + justify-content: center; + inline-size: fn.foreign-dim(--icon, --size); + } + + @include iro.bem-modifier('pull') { + margin: calc(-1 * fn.dim(--item --pad-i)); + } + } +} diff --git a/src_old/objects/_palette.scss b/src_old/objects/_palette.scss new file mode 100644 index 0000000..19f282f --- /dev/null +++ b/src_old/objects/_palette.scss @@ -0,0 +1,62 @@ +@use 'sass:map'; +@use 'sass:list'; +@use 'sass:string'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../config'; + +@include iro.props-namespace('palette') { + @include iro.bem-object(iro.props-namespace()) { + display: flex; + block-size: 3em; + + @include iro.bem-elem('item') { + flex: 1 1 auto; + + $palette: map.get(config.$themes, config.$theme-default, --palettes, --base); + $contrasts: map.get(config.$themes, config.$theme-default, --contrasts, list.nth($palette, 2)); + + @for $i from 1 through list.length($contrasts) { + $key: list.nth(map.keys($contrasts), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color(--base $key); + } + } + } + + @each $palette-name, $palette in map.get(config.$themes, config.$theme-default, --palettes) { + $contrasts: map.get(config.$themes, config.$theme-default, --contrasts, list.nth($palette, 2)); + + @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 $key); + } + } + } + } + } + + @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_old/objects/_popover.scss b/src_old/objects/_popover.scss new file mode 100644 index 0000000..5ad58ec --- /dev/null +++ b/src_old/objects/_popover.scss @@ -0,0 +1,51 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('popover') { + @include iro.props-store(( + --dims: ( + --z-index: 10000, + --pad-i: 0, + --pad-b: fn.global-dim(--size --85), + --separator: fn.global-dim(--size --85), + --rounding: fn.global-dim(--rounding), + --border: fn.global-dim(--border --thin), + ), + --colors: ( + --bg: fn.global-color(--bg-l2), + --border: fn.global-color(--border), + --filter: drop-shadow( + fn.global-dim(--shadow --x) + fn.global-dim(--shadow --y) + fn.global-dim(--shadow --blur) + fn.global-color(--shadow) + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + position: absolute; + z-index: fn.dim(--z-index); + inset-block-start: 0; + inset-inline-start: 0; + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + transform: translate(var(--x), var(--y)); + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + filter: fn.color(--filter); + + @include iro.bem-modifier('up-left') { + transform: translate(var(--x), calc(var(--y) - 100%)); + } + + @include iro.bem-modifier('up-right') { + transform: translate(calc(var(--x) - 100%), calc(var(--y) - 100%)); + } + + @include iro.bem-modifier('down-right') { + transform: translate(calc(var(--x) - 100%), var(--y)); + } + } +} diff --git a/src_old/objects/_radio.scss b/src_old/objects/_radio.scss new file mode 100644 index 0000000..9fa937d --- /dev/null +++ b/src_old/objects/_radio.scss @@ -0,0 +1,185 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('radio') { + @include iro.props-store(( + --dims: ( + --diameter: fn.global-dim(--size --200), + --label-gap: fn.global-dim(--size --125), + --border: fn.global-dim(--border --medium), + --pad-i: fn.global-dim(--size --65), + --pad-b: fn.global-dim(--size --65), + --rounding: fn.global-dim(--rounding), + --spacing-sibling: fn.global-dim(--size --300), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --circle-border: fn.global-color(--text-mute-more), + --circle-bg: fn.global-color(--base --75), + + --hover: ( + --label: fn.global-color(--heading), + --circle-border: fn.global-color(--text-mute), + ), + --accent: ( + --circle-border: fn.global-color(--accent --900), + + --hover: ( + --circle-border: fn.global-color(--accent --1000), + ), + ), + --disabled: ( + --label: fn.global-color(--text-disabled), + --circle-border: fn.global-color(--border-strong), + --circle-bg: fn.global-color(--base --75), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + margin-inline: + calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) + calc(fn.dim(--spacing-sibling) - fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)); + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + + @include iro.bem-elem('circle') { + display: inline-block; + flex: 0 0 auto; + inline-size: fn.dim(--diameter); + block-size: fn.dim(--diameter); + margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--diameter) - fn.dim(--key-focus --border-offset)); + border: fn.dim(--key-focus --border-offset) solid transparent; + border-radius: 2em; + background-color: fn.color(--circle-border); + background-clip: padding-box; + vertical-align: top; + + &::after { + content: ''; + display: block; + position: relative; + inset-block-start: fn.dim(--border); + inset-inline-start: fn.dim(--border); + inline-size: calc(fn.dim(--diameter) - 2 * fn.dim(--border)); + block-size: calc(fn.dim(--diameter) - 2 * fn.dim(--border)); + transition: transform .2s ease; + border-radius: fn.dim(--diameter); + background-color: fn.color(--circle-bg); + } + } + + @include iro.bem-elem('label') { + margin-inline-start: calc(fn.dim(--label-gap) - fn.dim(--key-focus --border-offset)); + } + + @include iro.bem-elem('native') { + appearance: none; + position: absolute; + z-index: -1; + inset-block-start: 0; + inset-inline-start: 0; + inline-size: 100%; + block-size: 100%; + margin: 0; + padding: 0; + overflow: hidden; + border-radius: fn.dim(--rounding); + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('label') { + color: fn.color(--hover --label); + } + + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--hover --circle-border); + } + } + + &:checked { + @include iro.bem-sibling-elem('circle') { + &::after { + transform: scale(.44); + } + } + } + + &:disabled { + @include iro.bem-sibling-elem('label') { + color: fn.color(--disabled --label); + } + + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--disabled --circle-border); + + &::after { + background-color: fn.color(--disabled --circle-bg); + } + } + } + + &:focus-visible { + @include iro.bem-sibling-elem('label') { + color: fn.color(--key-focus --label); + } + + @include iro.bem-sibling-elem('circle') { + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + } + } + } + + @include iro.bem-modifier('standalone') { + @include iro.bem-elem('circle') { + margin-block-start: 0; + } + } + + @include iro.bem-modifier('accent') { + @include iro.bem-elem('native') { + &:checked { + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--accent --circle-border); + } + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--accent --hover --circle-border); + } + } + } + + &:disabled { + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--disabled --circle-border); + + &::after { + background-color: fn.color(--disabled --circle-bg); + } + } + + &:checked { + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--disabled --circle-border); + } + } + } + } + } + } +} diff --git a/src_old/objects/_side-nav.scss b/src_old/objects/_side-nav.scss new file mode 100644 index 0000000..8e4e131 --- /dev/null +++ b/src_old/objects/_side-nav.scss @@ -0,0 +1,122 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@use './icon'; + +@include iro.props-namespace('side-nav') { + @include iro.props-store(( + --dims: ( + --spacing: fn.global-dim(--size --50), + --header: ( + --font-size: fn.global-dim(--font-size --50), + ), + --separator: fn.global-dim(--size --200), + --item: ( + --pad-i: fn.global-dim(--size --150), + --pad-b: fn.global-dim(--size --100), + --rounding: fn.global-dim(--rounding), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + ), + --colors: ( + --header: ( + --label: fn.global-color(--text-mute-more), + ), + --item: ( + --hover: ( + --bg: fn.global-color(--border-mute), + --label: fn.global-color(--heading), + ), + --active: ( + --bg: fn.global-color(--border), + --label: fn.global-color(--heading), + ), + --disabled: ( + --label: fn.global-color(--text-disabled), + ), + --key-focus: ( + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + flex-direction: column; + gap: fn.dim(--spacing); + + @include iro.bem-elem('header') { + padding-block: fn.dim(--item --pad-b); + padding-inline: fn.dim(--item --pad-i); + color: fn.color(--header --label); + font-size: fn.dim(--header --font-size); + font-weight: 500; + letter-spacing: .5px; + text-transform: uppercase; + + @include iro.bem-next-twin-elem { + margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); + } + } + + @include iro.bem-elem('item') { + padding-block: fn.dim(--item --pad-b); + padding-inline: fn.dim(--item --pad-i); + margin: calc(-1 * fn.dim(--item --key-focus --border-offset)); + border: fn.dim(--item --key-focus --border-offset) solid transparent; + border-radius: calc(fn.dim(--item --rounding) + fn.dim(--item --key-focus --border-offset)); + color: fn.color(--item --disabled --label); + background-clip: padding-box; + + &:link, + &:visited, + &:enabled { + color: currentColor; + + @include iro.bem-multi('&:hover, &:focus-visible', 'is' 'selected') { + background-color: fn.color(--item --hover --bg); + color: fn.color(--item --hover --label); + } + + &:active { + background-color: fn.color(--item --active --bg); + color: fn.color(--item --active --label); + } + + &:focus-visible { + outline: fn.color(--item --key-focus --border) solid fn.dim(--item --key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--item --key-focus --border) + fn.dim(--item --key-focus --outline)) fn.color(--item --key-focus --outline); + } + } + + @include iro.bem-next-elem('header') { + margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing)); + } + } + + @include iro.bem-elem('header') { + &:link, + &:visited, + &:enabled { + color: fn.color(--header --label); + } + } + + @include iro.bem-elem('separator') { + block-size: fn.dim(--separator); + } + + @include iro.bem-elem('icon-slot') { + display: flex; + justify-content: center; + inline-size: fn.foreign-dim(--icon, --size); + } + } +} diff --git a/src_old/objects/_status-indicator.scss b/src_old/objects/_status-indicator.scss new file mode 100644 index 0000000..416e65e --- /dev/null +++ b/src_old/objects/_status-indicator.scss @@ -0,0 +1,39 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$themes: 'accent' 'positive' 'negative' 'warning' !default; + +@include iro.props-namespace('status-indicator') { + @include iro.props-store(( + --dims: ( + --size: fn.global-dim(--size --125), + ), + --colors: ( + --default: fn.global-color(--border-strong), + --primary: fn.global-color(--text), + ), + )); + + @each $theme in $themes { + @include iro.props-store(( + --colors: ( + --#{$theme}: fn.global-color(--#{$theme} --700), + ), + )); + } + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + inline-size: fn.dim(--size); + block-size: fn.dim(--size); + border-radius: 10em; + background-color: fn.color(--default); + vertical-align: middle; + + @each $theme in $themes { + @include iro.bem-is($theme) { + background-color: fn.color(--#{$theme}); + } + } + } +} diff --git a/src_old/objects/_switch.scss b/src_old/objects/_switch.scss new file mode 100644 index 0000000..e1f1132 --- /dev/null +++ b/src_old/objects/_switch.scss @@ -0,0 +1,222 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('switch') { + @include iro.props-store(( + --dims: ( + --width: fn.global-dim(--size --350), + --height: fn.global-dim(--size --200), + --label-gap: fn.global-dim(--size --125), + --border: fn.global-dim(--border --medium), + --pad-i: fn.global-dim(--size --65), + --pad-b: fn.global-dim(--size --65), + --rounding: fn.global-dim(--rounding), + --spacing-sibling: fn.global-dim(--size --300), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --track-bg: fn.global-color(--border), + --handle-border: fn.global-color(--text-mute-more), + --handle-bg: fn.global-color(--base --50), + + --hover: ( + --label: fn.global-color(--heading), + --handle-border: fn.global-color(--text-mute), + ), + --accent: ( + --handle-border: fn.global-color(--accent --900), + + --hover: ( + --handle-border: fn.global-color(--accent --1000), + ), + ), + --disabled: ( + --label: fn.global-color(--text-disabled), + --track-bg: fn.global-color(--border), + --handle-border: fn.global-color(--border-strong), + --handle-bg: fn.global-color(--base --50), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + margin-inline: + calc(-1 * fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)) + calc(fn.dim(--spacing-sibling) - fn.dim(--pad-i) - fn.dim(--key-focus --border-offset)); + padding-inline: fn.dim(--pad-i); + padding-block: fn.dim(--pad-b); + + @include iro.bem-elem('indicator') { + display: inline-block; + flex: 0 0 auto; + inline-size: fn.dim(--width); + block-size: fn.dim(--height); + margin-block-start: calc(.5em * fn.global-dim(--font --standard --line-height) - .5 * fn.dim(--height) - fn.dim(--key-focus --border-offset)); + transition: background-color .2s ease; + border: fn.dim(--key-focus --border-offset) solid transparent; + border-radius: 2em; + background-color: fn.color(--track-bg); + background-clip: padding-box; + vertical-align: top; + + &::after { + content: ''; + display: block; + inline-size: calc(fn.dim(--height) - 2 * fn.dim(--border)); + block-size: calc(fn.dim(--height) - 2 * fn.dim(--border)); + transition: transform .2s ease; + border: fn.dim(--border) solid fn.color(--handle-border); + border-radius: fn.dim(--width); + background-color: fn.color(--handle-bg); + } + } + + @include iro.bem-elem('label') { + margin-inline-start: fn.dim(--label-gap); + } + + @include iro.bem-elem('native') { + appearance: none; + position: absolute; + z-index: -1; + inset-block-start: 0; + inset-inline-start: 0; + inline-size: 100%; + block-size: 100%; + margin: 0; + padding: 0; + overflow: hidden; + border-radius: fn.dim(--rounding); + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('label') { + color: fn.color(--hover --label); + } + + @include iro.bem-sibling-elem('indicator') { + &::after { + border-color: fn.color(--hover --handle-border); + } + } + } + + &:checked { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--handle-border); + + &::after { + transform: translate(calc(fn.dim(--width) - fn.dim(--height) + .5px), 0); + border-color: fn.color(--handle-border); + } + } + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--hover --handle-border); + + &::after { + border-color: fn.color(--hover --handle-border); + } + } + } + } + + &:disabled { + @include iro.bem-sibling-elem('label') { + color: fn.color(--disabled --label); + } + + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--disabled --track-bg); + + &::after { + border-color: fn.color(--disabled --handle-border); + background-color: fn.color(--disabled --handle-bg); + } + } + + &:checked { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--disabled --handle-border); + + &::after { + border-color: fn.color(--disabled --handle-border); + } + } + } + } + + &:focus-visible { + @include iro.bem-sibling-elem('label') { + color: fn.color(--key-focus --label); + } + + @include iro.bem-sibling-elem('indicator') { + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + } + } + } + + @include iro.bem-modifier('standalone') { + @include iro.bem-elem('indicator') { + margin-block-start: 0; + } + } + + @include iro.bem-modifier('accent') { + @include iro.bem-elem('native') { + &:checked { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--accent --handle-border); + + &::after { + border-color: fn.color(--accent --handle-border); + } + } + + &:hover, + &:focus-visible { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--accent --hover --handle-border); + + &::after { + border-color: fn.color(--accent --hover --handle-border); + } + } + } + } + + &:disabled { + @include iro.bem-sibling-elem('label') { + color: fn.color(--disabled --label); + } + + &:checked { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--disabled --handle-border); + + &::after { + border-color: fn.color(--disabled --handle-border); + } + } + } + } + } + } + } +} diff --git a/src_old/objects/_table.scss b/src_old/objects/_table.scss new file mode 100644 index 0000000..2c9f65b --- /dev/null +++ b/src_old/objects/_table.scss @@ -0,0 +1,168 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../mixins' as mx; + +@include iro.props-namespace('table') { + @include iro.props-store(( + --dims: ( + --pad-i: fn.global-dim(--size --175), + --pad-b: fn.global-dim(--size --125), + --rounding: fn.global-dim(--rounding), + --border: fn.global-dim(--border --thin), + + --sm: ( + --pad-b: fn.global-dim(--size --75), + ) + ), + --colors: ( + --border: fn.global-color(--border), + --heading: fn.global-color(--heading), + --hover: fn.global-color(--border-mute), + --active: fn.global-color(--border), + --box: ( + --bg: fn.global-color(--base --50), + --hover: fn.global-color(--bg-base), + --active: fn.global-color(--border-mute), + ) + ) + )); + + @include iro.bem-object(iro.props-namespace()) { + border-spacing: 0; + border-collapse: separate; + + @include iro.bem-modifier('fixed') { + table-layout: fixed; + } + + @include iro.bem-elem('head-cell') { + @include mx.set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(--font-size --50), + --weight: bold, + --transform: uppercase, + --spacing: .5px + )); + + padding-inline: fn.dim(--pad-i); + padding-block: fn.dim(--pad-b); + color: fn.color(--heading); + text-align: start; + } + + @include iro.bem-elem('cell') { + padding-inline: fn.dim(--pad-i); + padding-block: fn.dim(--pad-b); + border-width: 0; + border-block-start-width: fn.dim(--border); + border-style: solid; + border-color: fn.color(--border); + + @include iro.bem-modifier('divider') { + border-inline-end-width: fn.dim(--border); + } + } + + @include iro.bem-elem('row') { + &:last-child { + @include iro.bem-elem('cell') { + border-block-end-width: fn.dim(--border); + } + } + } + + @include iro.bem-modifier('flush') { + @include iro.bem-elem('head-cell', 'cell') { + &:first-child { + padding-inline-start: 0; + } + + &:last-child { + padding-inline-end: 0; + } + } + } + + @include iro.bem-modifier('box') { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --bg); + + &:first-child { + border-inline-start-width: fn.dim(--border); + } + + &:last-child { + border-inline-end-width: fn.dim(--border); + } + } + + @include iro.bem-elem('row') { + &:first-child { + @include iro.bem-elem('cell') { + &:first-child { + border-start-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-start-end-radius: fn.dim(--rounding); + } + } + } + + &:last-child { + @include iro.bem-elem('cell') { + &:first-child { + border-end-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-end-end-radius: fn.dim(--rounding); + } + } + } + } + } + + @include iro.bem-modifier('interactive') { + @include iro.bem-elem('row') { + @include iro.bem-elem('cell') { + cursor: pointer; + } + + &:hover { + @include iro.bem-elem('cell') { + background-color: fn.color(--hover); + } + } + + &:active { + @include iro.bem-elem('cell') { + background-color: fn.color(--active); + } + } + } + + @include iro.bem-modifier('box') { + @include iro.bem-elem('row') { + &:hover { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --hover); + } + } + + &:active { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --active); + } + } + } + } + } + + @include iro.bem-modifier('sm') { + @include iro.bem-elem('head-cell', 'cell') { + padding-block: fn.dim(--sm --pad-b); + } + } + } +} diff --git a/src_old/objects/_text-field.scss b/src_old/objects/_text-field.scss new file mode 100644 index 0000000..6611ea6 --- /dev/null +++ b/src_old/objects/_text-field.scss @@ -0,0 +1,213 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@mixin invalid { + $focus-border-offset: calc(fn.dim(--border) - fn.dim(--focus --border)); + + @include iro.bem-sibling-elem('bg') { + inset-block: $focus-border-offset; + inset-inline: $focus-border-offset; + border: fn.dim(--focus --border) solid fn.color(--error --border); + border-radius: calc(fn.dim(--rounding) - $focus-border-offset); + } + + &:hover { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--error --hover --border); + } + } + + &:focus { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--error --focus --border); + } + } +} + +@mixin keyboard-focus { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--key-focus --border); + outline: fn.color(--key-focus --outline) solid fn.dim(--key-focus --border); + //outline-offset: fn.dim(--focus --border); + } +} + +@include iro.props-namespace('text-field') { + @include iro.props-store(( + --dims: ( + --line-height: 1.4, + --pad-i: fn.global-dim(--size --125), + --pad-b: fn.global-dim(--size --125), + --border: fn.global-dim(--border --thin), + --rounding: fn.global-dim(--rounding), + + --extended: ( + --pad: fn.global-dim(--size --50), + ), + + --focus: ( + --border: fn.global-dim(--border --medium), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --outline), + ), + ), + --colors: ( + --bg: fn.global-color(--base --50), + --placeholder: fn.global-color(--text-mute-more), + --text: fn.global-color(--text), + --border: fn.global-color(--border-strong), + + --hover: ( + --border: fn.global-color(--text-mute-more), + ), + --focus: ( + --border: fn.global-color(--focus --border), + ), + --key-focus: ( + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + --error: ( + --border: fn.global-color(--negative --700), + + --hover: ( + --border: fn.global-color(--negative --900), + ), + --focus: ( + --border: fn.global-color(--negative --900), + ), + ), + --disabled: ( + --bg: fn.global-color(--border-mute), + --placeholder: fn.global-color(--text-disabled), + --text: fn.global-color(--text-disabled), + --border: fn.global-color(--border-mute), + ), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + $focus-border-offset: calc(fn.dim(--border) - fn.dim(--focus --border)); + + position: relative; + min-inline-size: 0; + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + + @include iro.bem-elem('bg') { + display: block; + position: absolute; + inset-block: 0; + inset-inline: 0; + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + pointer-events: none; + } + + @include iro.bem-elem('native') { + box-sizing: border-box; + inline-size: 100%; + padding-block: calc(fn.dim(--pad-b) - .5em * (fn.dim(--line-height) - 1)); + padding-inline: fn.dim(--pad-i); + border: 1px solid transparent; + background-color: transparent; + color: fn.color(--text); + font: inherit; + line-height: fn.dim(--line-height); + resize: none; + appearance: none; + + &::placeholder { + opacity: 1; + color: fn.color(--placeholder); + font-style: italic; + } + + &:hover { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--hover --border); + } + } + + &:focus { + outline: 0; + + @include iro.bem-sibling-elem('bg') { + inset-block: $focus-border-offset; + inset-inline: $focus-border-offset; + border: fn.dim(--focus --border) solid fn.color(--focus --border); + border-radius: calc(fn.dim(--rounding) - $focus-border-offset); + } + } + + &:invalid { + @include invalid; + } + + &:focus-visible, + &:invalid:focus-visible { + @include keyboard-focus; + } + } + + @include iro.bem-modifier('extended') { + padding: fn.dim(--extended --pad); + + @include iro.bem-multi('&', 'elem' 'bg') { + border-radius: calc(fn.dim(--rounding) + fn.dim(--extended --pad)); + } + + @include iro.bem-elem('native') { + &:focus { + @include iro.bem-sibling-elem('bg') { + border-radius: calc(fn.dim(--rounding) + fn.dim(--extended --pad) - $focus-border-offset); + } + } + } + } + + @include iro.bem-is('invalid') { + @include iro.bem-elem('native') { + @include invalid; + + &:focus-visible { + @include keyboard-focus; + } + } + } + + @include iro.bem-is('disabled') { + background-color: fn.color(--disabled --bg); + + @include iro.bem-elem('native') { + color: fn.color(--disabled --text); + + &::placeholder { + color: fn.color(--disabled --placeholder); + } + } + + @include iro.bem-elem('bg') { + border-color: fn.color(--disabled --border); + } + + @include iro.bem-is('invalid') { + @include iro.bem-elem('native') { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--disabled --border); + } + } + } + + @include iro.bem-elem('native') { + &:invalid { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--disabled --border); + } + } + } + } + } +} diff --git a/src_old/scopes/_blockquotes.scss b/src_old/scopes/_blockquotes.scss new file mode 100644 index 0000000..f6a13fe --- /dev/null +++ b/src_old/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_old/scopes/_code.scss b/src_old/scopes/_code.scss new file mode 100644 index 0000000..4df711b --- /dev/null +++ b/src_old/scopes/_code.scss @@ -0,0 +1,59 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('code') { + @include iro.props-store(( + --dims: ( + --inline: ( + --pad-i: fn.global-dim(--size --50), + --pad-b: fn.global-dim(--size --10), + --rounding: fn.global-dim(--rounding), + ), + --block: ( + --pad-i: fn.global-dim(--size --150), + --pad-b: fn.global-dim(--size --85), + --margin-bs: fn.global-dim(--paragraph --margin-bs), + --rounding: fn.global-dim(--rounding), + ) + ), + --colors: ( + --inline: ( + --fg: fn.global-color(--red --1200), + --bg: fn.global-color(--red --200), + ), + --block: ( + --fg: fn.global-color(--text), + --bg: fn.global-color(--base --50), + ) + ) + )); + + @include iro.bem-scope(iro.props-namespace()) { + code { + padding-block: fn.dim(--inline --pad-b); + padding-inline: fn.dim(--inline --pad-i); + border-radius: fn.dim(--inline --rounding); + background-color: fn.color(--inline --bg); + color: fn.color(--inline --fg); + } + + pre { + margin-block: fn.dim(--block --margin-bs) 0; + margin-inline: 0; + padding-block: fn.dim(--block --pad-b); + padding-inline: fn.dim(--block --pad-i); + border-radius: fn.dim(--block --rounding); + background-color: fn.color(--block --bg); + color: fn.color(--block --fg); + + code { + display: inline-block; + margin-inline-end: fn.dim(--block --pad-i); + padding: 0; + border-radius: 0; + background-color: transparent; + color: currentColor; + } + } + } +} diff --git a/src_old/scopes/_headings.scss b/src_old/scopes/_headings.scss new file mode 100644 index 0000000..9593792 --- /dev/null +++ b/src_old/scopes/_headings.scss @@ -0,0 +1,116 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../mixins' as mx; +@use 'include-media/dist/include-media' as media; + +@include iro.props-namespace('headings') { + @include iro.bem-scope(iro.props-namespace()) { + h1, + h2, + h3, + h4, + h5, + h6 { + @include mx.set-font(--headline); + + display: block; + transform: translateX(-.06em); + letter-spacing: normal; + text-transform: none; + } + + + h1 { + @include mx.heading-strong(--xxl); + } + + h2 { + @include mx.heading-strong(--xl); + } + + h3 { + @include mx.heading-medium(--lg); + } + + h4 { + @include mx.heading-medium(--md); + } + + h5 { + @include mx.heading-faint(--sm); + } + + h6 { + @include mx.heading-faint(--xs); + } + + @include iro.bem-elem('highlight') { + background-image: linear-gradient( + to top, + transparent .15em, + fn.foreign-color(--heading, --bg) .15em, + fn.foreign-color(--heading, --bg) .6em, + transparent .6em + ); + } + + @include iro.bem-modifier('display') { + h1, + h2, + h3, + h4, + h5, + h6 { + @include mx.set-font(--headline); + } + + h1 { + @include mx.heading-strong(--display --xxl); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --xxl); + } + } + + h2 { + @include mx.heading-strong(--display --xl); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --xl); + } + } + + h3 { + @include mx.heading-strong(--display --lg); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --lg); + } + } + + h4 { + @include mx.heading-strong(--display --md); + + @include media.media('<=md') { + @include mx.heading-strong(--display-sm --md); + } + } + + h5 { + @include mx.heading-medium(--display --sm); + + @include media.media('<=md') { + @include mx.heading-medium(--display-sm --sm); + } + } + + h6 { + @include mx.heading-faint(--display --xs); + + @include media.media('<=md') { + @include mx.heading-faint(--display-sm --xs); + } + } + } + } +} diff --git a/src_old/scopes/_links.scss b/src_old/scopes/_links.scss new file mode 100644 index 0000000..d47c406 --- /dev/null +++ b/src_old/scopes/_links.scss @@ -0,0 +1,143 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +$static-themes: 'black' 'white' !default; + +@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), + ), + + --key-focus: ( + --border: fn.global-dim(--key-focus --border), + --border-offset: fn.global-dim(--key-focus --border-offset), + --outline: fn.global-dim(--key-focus --border), + ), + ), + --colors: ( + --underline: fn.global-color(--text-mute-more), + + --colored: ( + --text: fn.global-color(--accent --1100), + --underline: fn.global-color(--accent --600), + + --hover: ( + --text: fn.global-color(--accent --1300), + ), + + --visited: ( + --text: fn.global-color(--purple --1100), + --underline: fn.global-color(--purple --600), + + --hover: ( + --text: fn.global-color(--purple --1300), + ), + ), + ), + + --key-focus: ( + --text: fn.global-color(--focus --text), + --border: fn.global-color(--focus --border), + --outline: fn.global-color(--focus --outline), + ), + ), + )); + + @each $theme in $static-themes { + @include iro.props-store(( + --colors: ( + --static-#{$theme}: ( + --text: fn.global-color(--#{$theme}-transparent --800), + --underline: fn.global-color(--#{$theme}-transparent --500), + + --hover: ( + --text: fn.global-color(--#{$theme}-transparent --900), + ), + + --key-focus: ( + --text: fn.global-color(--#{$theme}-transparent --900), + --border: fn.global-color(--#{$theme}-transparent --900), + --outline: fn.global-color(--#{$theme}-transparent --300), + ), + ) + ) + )); + } + + @include iro.bem-scope(iro.props-namespace()) { + :link, + :visited { + border-radius: fn.dim(--rounding); + color: currentColor; + text-decoration: underline; + text-decoration-color: fn.color(--underline); + text-decoration-thickness: fn.dim(--underline); + box-decoration-break: clone; + + &:hover { + text-decoration: underline; + text-decoration-thickness: fn.dim(--hover --underline); + text-decoration-skip-ink: none; + } + + &:focus-visible { + outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); + color: fn.color(--key-focus --text); + text-decoration: none; + } + } + + @include iro.bem-modifier('invisible') { + :link, + :visited { + text-decoration: none; + } + } + + @include iro.bem-modifier('colored') { + :link { + color: fn.color(--colored --text); + text-decoration-color: fn.color(--colored --underline); + + &:hover { + color: fn.color(--colored --hover --text); + } + } + + :visited { + color: fn.color(--colored --visited --text); + text-decoration-color: fn.color(--colored --visited --underline); + + &:hover { + color: fn.color(--colored --visited --hover --text); + } + } + } + + @each $theme in $static-themes { + @include iro.bem-modifier(static-#{$theme}) { + :link, + :visited { + color: fn.color(--static-#{$theme} --text); + text-decoration-color: fn.color(--static-#{$theme} --underline); + + &:hover { + color: fn.color(--static-#{$theme} --hover --text); + } + + &:focus-visible { + outline-color: fn.color(--static-#{$theme} --key-focus --border); + box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--static-#{$theme} --key-focus --outline); + color: fn.color(--static-#{$theme} --key-focus --text); + } + } + } + } + } +} diff --git a/src_old/scopes/_lists.scss b/src_old/scopes/_lists.scss new file mode 100644 index 0000000..bad9731 --- /dev/null +++ b/src_old/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); + } + } + } +} diff --git a/src_old/scopes/_tables.scss b/src_old/scopes/_tables.scss new file mode 100644 index 0000000..9b2124d --- /dev/null +++ b/src_old/scopes/_tables.scss @@ -0,0 +1,115 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../mixins' as mx; + +@include iro.props-namespace('tables') { + @include iro.props-store(( + --dims: ( + --pad-i: fn.foreign-dim(--table, --pad-i), + --pad-b: fn.foreign-dim(--table, --pad-b), + --rounding: fn.foreign-dim(--table, --rounding), + --border: fn.foreign-dim(--table, --border), + --margin-bs: fn.global-dim(--paragraph --margin-bs), + ), + --colors: ( + --border: fn.foreign-color(--table, --border), + --heading: fn.foreign-color(--table, --heading), + --box: ( + --bg: fn.foreign-color(--table, --box --bg), + ) + ) + )); + + @include iro.bem-scope(iro.props-namespace()) { + table { + margin-block-start: fn.dim(--margin-bs); + border-spacing: 0; + border-collapse: separate; + } + + th { + @include mx.set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(--font-size --50), + --weight: bold, + --transform: uppercase, + --spacing: .5px + )); + + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + color: fn.color(--heading); + text-align: start; + } + + td { + padding-block: fn.dim(--pad-b); + padding-inline: fn.dim(--pad-i); + border-width: 0; + border-block-start-width: fn.dim(--border); + border-style: solid; + border-color: fn.color(--border); + } + + tr { + &:last-child { + td { + border-block-end-width: fn.dim(--border); + } + } + } + + @include iro.bem-modifier('flush') { + th, + td { + &:first-child { + padding-inline-start: 0; + } + + &:last-child { + padding-inline-end: 0; + } + } + } + + @include iro.bem-modifier('box') { + td { + background-color: fn.color(--box --bg); + + &:first-child { + border-inline-start-width: fn.dim(--border); + } + + &:last-child { + border-inline-end-width: fn.dim(--border); + } + } + + tr { + &:first-child { + td { + &:first-child { + border-start-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-start-end-radius: fn.dim(--rounding); + } + } + } + + &:last-child { + td { + &:first-child { + border-end-start-radius: fn.dim(--rounding); + } + + &:last-child { + border-end-end-radius: fn.dim(--rounding); + } + } + } + } + } + } +} -- cgit v1.2.3-70-g09d2