From 48cb00040763459fc46d4aa108bf72c12f48f422 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 21 Jun 2024 23:07:50 +0200 Subject: WIP: Refactoring --- src/.old/objects/_action-button.scss | 222 ++++++++++++++++++++++++++++ src/.old/objects/_action-menu.scss | 122 ++++++++++++++++ src/.old/objects/_alert.scss | 55 +++++++ src/.old/objects/_avatar.scss | 146 +++++++++++++++++++ src/.old/objects/_backdrop.scss | 33 +++++ src/.old/objects/_badge.scss | 173 ++++++++++++++++++++++ src/.old/objects/_button.scss | 179 +++++++++++++++++++++++ src/.old/objects/_checkbox.scss | 249 ++++++++++++++++++++++++++++++++ src/.old/objects/_dialog.scss | 152 +++++++++++++++++++ src/.old/objects/_emoji.scss | 74 ++++++++++ src/.old/objects/_field-label.scss | 89 ++++++++++++ src/.old/objects/_icon-nav.scss | 20 +++ src/.old/objects/_icon.scss | 26 ++++ src/.old/objects/_lightbox.scss | 206 ++++++++++++++++++++++++++ src/.old/objects/_list-group.scss | 60 ++++++++ src/.old/objects/_menu.scss | 124 ++++++++++++++++ src/.old/objects/_message.scss | 51 +++++++ src/.old/objects/_overflow-button.scss | 243 +++++++++++++++++++++++++++++++ src/.old/objects/_radio.scss | 176 ++++++++++++++++++++++ src/.old/objects/_status-indicator.scss | 35 +++++ src/.old/objects/_switch.scss | 221 ++++++++++++++++++++++++++++ src/.old/objects/_table.scss | 167 +++++++++++++++++++++ src/.old/objects/_text-field.scss | 232 +++++++++++++++++++++++++++++ src/.old/scopes/_blockquotes.scss | 35 +++++ src/.old/scopes/_code.scss | 68 +++++++++ src/.old/scopes/_lists.scss | 67 +++++++++ src/.old/scopes/_tables.scss | 114 +++++++++++++++ src/_apply-vars.scss | 73 +--------- src/_base.scss | 38 ++--- src/_config.scss | 134 +++++++++++++++-- src/_declare-vars.scss | 225 +++++++---------------------- src/_functions.scss | 120 ++++++--------- src/_mixins.scss | 7 +- src/_objects.scss | 47 +++--- src/_scopes.scss | 8 +- src/_themes.scss | 14 ++ src/_utils.scss | 47 +++--- src/index.scss | 1 + src/layouts/_button-group.scss | 2 +- src/layouts/_container.scss | 2 +- src/layouts/_form.scss | 4 +- src/layouts/_media.scss | 2 +- src/layouts/_message-group.scss | 8 +- src/layouts/_overflow.scss | 2 +- src/objects/_action-button.scss | 222 ---------------------------- src/objects/_action-menu.scss | 122 ---------------- src/objects/_alert.scss | 55 ------- src/objects/_avatar.scss | 146 ------------------- src/objects/_backdrop.scss | 33 ----- src/objects/_badge.scss | 173 ---------------------- src/objects/_button.scss | 179 ----------------------- src/objects/_checkbox.scss | 249 -------------------------------- src/objects/_dialog.scss | 152 ------------------- src/objects/_divider.scss | 51 +++---- src/objects/_emoji.scss | 74 ---------- src/objects/_field-label.scss | 89 ------------ src/objects/_heading.scss | 29 ++-- src/objects/_icon-nav.scss | 20 --- src/objects/_icon.scss | 26 ---- src/objects/_lightbox.scss | 206 -------------------------- src/objects/_list-group.scss | 60 -------- src/objects/_menu.scss | 124 ---------------- src/objects/_message.scss | 51 ------- src/objects/_overflow-button.scss | 243 ------------------------------- src/objects/_palette.scss | 38 +++++ src/objects/_radio.scss | 176 ---------------------- src/objects/_status-indicator.scss | 35 ----- src/objects/_switch.scss | 221 ---------------------------- src/objects/_table.scss | 167 --------------------- src/objects/_text-field.scss | 232 ----------------------------- src/scopes/_blockquotes.scss | 35 ----- src/scopes/_code.scss | 68 --------- src/scopes/_links.scss | 75 +++++++--- src/scopes/_lists.scss | 67 --------- src/scopes/_tables.scss | 114 --------------- 75 files changed, 3776 insertions(+), 3829 deletions(-) create mode 100644 src/.old/objects/_action-button.scss create mode 100644 src/.old/objects/_action-menu.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/_checkbox.scss create mode 100644 src/.old/objects/_dialog.scss create mode 100644 src/.old/objects/_emoji.scss create mode 100644 src/.old/objects/_field-label.scss create mode 100644 src/.old/objects/_icon-nav.scss create mode 100644 src/.old/objects/_icon.scss create mode 100644 src/.old/objects/_lightbox.scss create mode 100644 src/.old/objects/_list-group.scss create mode 100644 src/.old/objects/_menu.scss create mode 100644 src/.old/objects/_message.scss create mode 100644 src/.old/objects/_overflow-button.scss create mode 100644 src/.old/objects/_radio.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/_lists.scss create mode 100644 src/.old/scopes/_tables.scss create mode 100644 src/_themes.scss delete mode 100644 src/objects/_action-button.scss delete mode 100644 src/objects/_action-menu.scss delete mode 100644 src/objects/_alert.scss delete mode 100644 src/objects/_avatar.scss delete mode 100644 src/objects/_backdrop.scss delete mode 100644 src/objects/_badge.scss delete mode 100644 src/objects/_button.scss delete mode 100644 src/objects/_checkbox.scss delete mode 100644 src/objects/_dialog.scss delete mode 100644 src/objects/_emoji.scss delete mode 100644 src/objects/_field-label.scss delete mode 100644 src/objects/_icon-nav.scss delete mode 100644 src/objects/_icon.scss delete mode 100644 src/objects/_lightbox.scss delete mode 100644 src/objects/_list-group.scss delete mode 100644 src/objects/_menu.scss delete mode 100644 src/objects/_message.scss delete mode 100644 src/objects/_overflow-button.scss create mode 100644 src/objects/_palette.scss delete mode 100644 src/objects/_radio.scss delete mode 100644 src/objects/_status-indicator.scss delete mode 100644 src/objects/_switch.scss delete mode 100644 src/objects/_table.scss delete mode 100644 src/objects/_text-field.scss delete mode 100644 src/scopes/_blockquotes.scss delete mode 100644 src/scopes/_code.scss delete mode 100644 src/scopes/_lists.scss delete mode 100644 src/scopes/_tables.scss (limited to 'src') diff --git a/src/.old/objects/_action-button.scss b/src/.old/objects/_action-button.scss new file mode 100644 index 0000000..48ac2a6 --- /dev/null +++ b/src/.old/objects/_action-button.scss @@ -0,0 +1,222 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('action-button') { + @include iro.props-store(( + --dims: ( + --line-height: 1.4, + --pad-x: fn.global-dim(--size --100), + --pad-y: fn.global-dim(--size --85), + --rounding: 3px, + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--bg-hi), + --label: fn.global-color(--fg), + --border: fn.global-color(--obj-lo), + + --hover: ( + --bg: fn.global-color(--bg-hi2), + --label: fn.global-color(--fg-lo), + --border: fn.global-color(--fg-hi2), + ), + --active: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-lo), + --border: fn.global-color(--fg-hi2), + ), + --selected: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg), + --border: fn.global-color(--fg-hi3), + + --hover: ( + --label: fn.global-color(--fg-lo), + --border: fn.global-color(--fg-hi2), + ), + ), + --disabled: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-hi3), + --border: fn.global-color(--obj-hi), + ), + --key-focus: ( + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + --quiet: ( + --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), + ), + ), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + padding: fn.dim(--pad-y) fn.dim(--pad-x); + overflow: hidden; + border: 1px 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; + vertical-align: top; + white-space: nowrap; + + &:link, + &:visited, + &:enabled { + border-color: fn.color(--border); + background-color: fn.color(--bg); + color: fn.color(--label); + + &:hover { + border-color: fn.color(--hover --border); + background-color: fn.color(--hover --bg); + color: fn.color(--hover --label); + } + + &:active { + border-color: fn.color(--active --border); + background-color: fn.color(--active --bg); + color: fn.color(--active --label); + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + background-color: fn.color(--hover --bg); + color: fn.color(--hover --label); + } + } + } + + @include iro.bem-is('selected') { + &:link, + &:visited, + &:enabled { + border-color: fn.color(--selected --border); + background-color: fn.color(--selected --bg); + color: fn.color(--selected --label); + + &:hover, + &:active { + border-color: fn.color(--selected --hover --border); + background-color: fn.color(--selected --bg); + color: fn.color(--selected --hover --label); + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + background-color: fn.color(--selected --bg); + color: fn.color(--selected --hover --label); + } + } + } + } + + @include iro.bem-modifier('quiet') { + border-color: transparent; + background-color: transparent; + box-shadow: none; + color: fn.color(--quiet --disabled --label); + + &:link, + &:visited, + &:enabled { + border-color: transparent; + background-color: transparent; + box-shadow: none; + color: fn.color(--quiet --label); + + &:hover { + border-color: transparent; + background-color: fn.color(--quiet --hover --bg); + box-shadow: none; + color: fn.color(--quiet --hover --label); + } + + &:active { + border-color: transparent; + background-color: fn.color(--quiet --active --bg); + box-shadow: none; + color: fn.color(--quiet --active --label); + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + background-color: fn.color(--quiet --hover --bg); + color: fn.color(--quiet --hover --label); + } + } + } + + @include iro.bem-is('selected') { + background-color: fn.color(--quiet --selected --bg); + color: fn.color(--quiet --disabled --label); + + &:link, + &:visited, + &:enabled { + border-color: transparent; + background-color: fn.color(--quiet --selected --bg); + box-shadow: none; + color: fn.color(--quiet --selected --label); + + &:hover, + &:active { + border-color: transparent; + background-color: fn.color(--quiet --selected --hover --bg); + box-shadow: none; + color: fn.color(--quiet --selected --hover --label); + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + background-color: fn.color(--quiet --selected --bg); + color: fn.color(--quiet --selected --hover --label); + } + } + } + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + border-color: fn.color(--key-focus --border); + box-shadow: inset 0 0 0 1px fn.color(--key-focus --border), fn.color(--key-focus --shadow); + } + } + + @include iro.bem-modifier('round') { + width: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-y)); + padding-right: 0; + padding-left: 0; + border-radius: 100em; + } + } +} diff --git a/src/.old/objects/_action-menu.scss b/src/.old/objects/_action-menu.scss new file mode 100644 index 0000000..12e3b5f --- /dev/null +++ b/src/.old/objects/_action-menu.scss @@ -0,0 +1,122 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('action-menu') { + @include iro.props-store(( + --dims: ( + --pad-x: 0, + --pad-y: fn.global-dim(--size --85), + --separator: fn.global-dim(--size --85), + --rounding: 3px, + --border: 1px, + --item: ( + --pad-x: fn.global-dim(--size --150), + --pad-y: fn.global-dim(--size --85), + ), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --shadow: 0 .2em .5em rgba(#000, .1), + --border: fn.global-color(--border --stable-lo), + --separator: fn.global-color(--obj), + --icon: fn.global-color(--fg-hi), + --item: ( + --hover: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-lo), + ), + --disabled: ( + --label: fn.global-color(--fg-hi3), + ), + --key-focus: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-lo), + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + ), + ), + ), 'colors'); + + @include iro.props-store(( + --colors: ( + --shadow: 0 .2em .5em rgba(#000, .5), + ), + ), 'colors-dark'); + + @include iro.bem-object(iro.props-namespace()) { + position: absolute; + z-index: 10000; + top: 0; + left: 0; + padding: fn.dim(--pad-y) fn.dim(--pad-x); + transform: translate(var(--x), var(--y)); + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + background-clip: padding-box; + background-color: fn.global-color(--bg); + box-shadow: fn.color(--shadow); + color: fn.global-color(--fg); + + @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)); + } + + @include iro.bem-elem('item') { + display: block; + box-sizing: border-box; + width: 100%; + padding: calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px); + border: 2px solid transparent; + color: fn.color(--item --disabled --label); + + &:link, + &:visited, + &:enabled { + color: currentColor; + + &:hover, + &:active { + background-color: fn.color(--item --hover --bg); + color: fn.color(--item --hover --label); + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + border-radius: calc(fn.dim(--rounding) - 1px); + border-color: fn.color(--item --key-focus --border); + background-color: fn.color(--item --key-focus --bg); + box-shadow: fn.color(--item --key-focus --shadow); + color: fn.color(--item --key-focus --label); + } + } + } + } + + @include iro.bem-elem('separator') { + height: 1px; + margin: fn.dim(--separator) 0; + background-color: fn.color(--separator); + } + + @include iro.bem-elem('slot') { + padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x); + } + + @include iro.bem-elem('icon-slot') { + display: flex; + justify-content: center; + width: fn.foreign-dim(--icon, --size); + } + } +} diff --git a/src/.old/objects/_alert.scss b/src/.old/objects/_alert.scss new file mode 100644 index 0000000..289ef10 --- /dev/null +++ b/src/.old/objects/_alert.scss @@ -0,0 +1,55 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('alert') { + @include iro.props-store(( + --dims: ( + --border: 1px, + --pad-x: fn.global-dim(--size --250), + --pad-y: fn.global-dim(--size --200), + --rounding: 4px, + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--bg-hi2), + --border: fn.global-color(--fg-hi2), + --border-primary: fn.global-color(--accent --primary --solid --bg-hi), + --border-error: fn.global-color(--accent --error --solid --bg-hi), + --border-success: fn.global-color(--accent --success --solid --bg-hi), + --border-warning: fn.global-color(--accent --warning --solid --bg-hi), + ), + ), 'colors'); + + @include iro.props-store(( + --dims: ( + --pad-x: fn.global-dim(--size --200), + --pad-y: fn.global-dim(--size --150), + ), + ), 'sm'); + + @include iro.bem-object(iro.props-namespace()) { + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + color: fn.global-color(--fg); + + @include iro.bem-modifier('primary') { + border-color: fn.color(--border-primary); + } + + @include iro.bem-modifier('error') { + border-color: fn.color(--border-error); + } + + @include iro.bem-modifier('success') { + border-color: fn.color(--border-success); + } + + @include iro.bem-modifier('warning') { + border-color: fn.color(--border-warning); + } + } +} diff --git a/src/.old/objects/_avatar.scss b/src/.old/objects/_avatar.scss new file mode 100644 index 0000000..4be780e --- /dev/null +++ b/src/.old/objects/_avatar.scss @@ -0,0 +1,146 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@mixin status($size) { + @include iro.bem-elem('status') { + width: fn.dim(--#{$size} --indicator-size); + height: fn.dim(--#{$size} --indicator-size); + + @include iro.bem-next-elem('content') { + mask-image: radial-gradient( + circle calc(.5 * fn.dim(--#{$size} --indicator-size) + fn.dim(--indicator-spacing)) at + calc(100% - .5 * fn.dim(--#{$size} --indicator-size)) + calc(100% - .5 * fn.dim(--#{$size} --indicator-size)), + transparent 95%, + #fff + ); + } + } +} + +@include iro.props-namespace('avatar') { + @include iro.props-store(( + --dims: ( + --400: ( + --size: fn.global-dim(--size --1600), + --font-size: fn.global-dim(--font-size --800), + --indicator-size: fn.global-dim(--size --400), + ), + --300: ( + --size: fn.global-dim(--size --1200), + --font-size: fn.global-dim(--font-size --600), + --indicator-size: fn.global-dim(--size --300), + ), + --200: ( + --size: fn.global-dim(--size --800), + --font-size: fn.global-dim(--font-size --300), + --indicator-size: fn.global-dim(--size --225), + ), + --150: ( + --size: fn.global-dim(--size --650), + --font-size: fn.global-dim(--font-size --200), + --indicator-size: fn.global-dim(--size --175), + ), + --100: ( + --size: fn.global-dim(--size --500), + --font-size: fn.global-dim(--font-size --100), + --indicator-size: fn.global-dim(--size --150), + ), + --75: ( + --size: fn.global-dim(--size --375), + --font-size: fn.global-dim(--font-size --75), + --indicator-size: fn.global-dim(--size --125), + ), + --50: ( + --size: fn.global-dim(--size --250), + --font-size: fn.global-dim(--font-size --50), + --indicator-size: fn.global-dim(--size --100), + ), + --indicator-spacing: fn.global-dim(--size --40), + --rounding: 25%, + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --h: 354, + --s: 44%, + --l: 45%, + + --key-focus: ( + --border: fn.global-color(--focus --fill), + --shadow: 0 0 0 calc(2px + fn.global-dim(--focus --outline-width)) fn.global-color(--accent --primary --quiet --obj-lo), + ), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + border-radius: fn.dim(--rounding); + font-size: fn.dim(--100 --font-size); + font-style: normal; + vertical-align: .05em; + + @include iro.bem-elem('status') { + position: absolute; + right: 0; + bottom: 0; + } + + @include status(100); + + @include iro.bem-elem('content') { + display: block; + width: fn.dim(--100 --size); + height: fn.dim(--100 --size); + border-radius: fn.dim(--rounding); + line-height: fn.dim(--100 --size); + text-align: center; + object-fit: cover; + object-position: center center; + } + + @include iro.bem-modifier('circle') { + 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 50 75 150 200 300 400 { + @include iro.bem-modifier($size) { + font-size: fn.dim(--#{$size} --font-size); + + @include status($size); + + @include iro.bem-elem('content') { + width: fn.dim(--#{$size} --size); + height: fn.dim(--#{$size} --size); + line-height: fn.dim(--#{$size} --size); + } + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + outline: 2px solid fn.color(--key-focus --border); + box-shadow: fn.color(--key-focus --shadow); + } + } + } +} diff --git a/src/.old/objects/_backdrop.scss b/src/.old/objects/_backdrop.scss new file mode 100644 index 0000000..ac23d63 --- /dev/null +++ b/src/.old/objects/_backdrop.scss @@ -0,0 +1,33 @@ +@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, + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: rgba(#000, .75), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + position: fixed; + z-index: fn.dim(--z-index); + top: 0; + right: 0; + bottom: 0; + left: 0; + box-sizing: border-box; + flex-direction: column; + overflow: auto; + background-color: fn.color(--bg); + color: fn.global-color(--fg); + 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..0f73382 --- /dev/null +++ b/src/.old/objects/_badge.scss @@ -0,0 +1,173 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('badge') { + @include iro.props-store(( + --dims: ( + --pad-x: fn.px-to-em(4px), + --pad-y: 0, + --rounding: 3px, + --fixed-100: 1em, + --fixed-200: 1.5em, + + --200: ( + --pad-x: fn.px-to-em(6px), + --pad-y: fn.px-to-em(2px), + ), + --300: ( + --pad-x: fn.px-to-em(10px), + --pad-y: fn.px-to-em(6px), + ), + + --pill: ( + --pad-x: fn.px-to-em(9px), + + --200: ( + --pad-x: fn.px-to-em(10px), + ), + --300: ( + --pad-x: fn.px-to-em(16px), + ), + ), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-lo), + --hover: ( + --bg: fn.global-color(--obj), + ), + --active: ( + --bg: fn.global-color(--obj-lo), + ), + --key-focus: ( + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + + --primary: ( + --bg: fn.global-color(--fg-lo), + --label: fn.global-color(--bg), + --hover: ( + --bg: fn.global-color(--fg), + ), + --active: ( + --bg: fn.global-color(--fg), + ), + ), + + --accent: ( + --bg: fn.global-color(--accent --primary --solid --bg), + --label: fn.global-color(--accent --primary --solid --fg), + --hover: ( + --bg: fn.global-color(--accent --primary --solid --obj), + ), + --active: ( + --bg: fn.global-color(--accent --primary --solid --obj-lo), + ), + ), + + --accent-quiet: ( + --bg: fn.global-color(--accent --primary --quiet --bg), + --label: fn.global-color(--accent --primary --quiet --fg), + --hover: ( + --bg: fn.global-color(--accent --primary --quiet --obj), + ), + --active: ( + --bg: fn.global-color(--accent --primary --quiet --obj-lo), + ), + ) + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + margin-top: -.5em; + margin-bottom: -.5em; + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + color: fn.color(--label); + line-height: fn.global-dim(--font --standard --line-height); + text-align: center; + text-decoration: none; + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--hover --bg); + } + + &:active { + background-color: fn.color(--active --bg); + } + } + + @each $variant in 'primary' 'accent' 'accent-quiet' { + @include iro.bem-modifier($variant) { + background-color: fn.color(--#{$variant} --bg); + color: fn.color(--#{$variant} --label); + + &:link, + &:visited, + &:enabled { + &:hover { + background-color: fn.color(--#{$variant} --hover --bg); + } + + &:active { + background-color: fn.color(--#{$variant} --active --bg); + } + } + } + } + + &:link, + &:visited, + &:enabled { + @include iro.bem-at-theme('keyboard') { + &:focus { + background-color: transparent; + box-shadow: inset 0 0 0 2px fn.color(--key-focus --border), fn.color(--key-focus --shadow); + color: currentColor; + } + } + } + + @include iro.bem-modifier('pill') { + padding-right: fn.dim(--pill --pad-x); + padding-left: fn.dim(--pill --pad-x); + border-radius: 10em; + } + + @each $size in '200' '300' { + @include iro.bem-modifier($size) { + padding: fn.dim(--#{$size} --pad-y) fn.dim(--#{$size} --pad-x); + + @include iro.bem-modifier('pill') { + padding-right: fn.dim(--pill --#{$size} --pad-x); + padding-left: fn.dim(--pill --#{$size} --pad-x); + } + } + } + + @include iro.bem-modifier('fixed-100') { + width: fn.dim(--fixed-100); + } + + @include iro.bem-modifier('fixed-200') { + width: fn.dim(--fixed-200); + } + + @include iro.bem-modifier('sm') { + font-size: fn.global-dim(--font-size --75); + } + + @include iro.bem-modifier('xs') { + font-size: fn.global-dim(--font-size --50); + } + } +} diff --git a/src/.old/objects/_button.scss b/src/.old/objects/_button.scss new file mode 100644 index 0000000..7cc24fa --- /dev/null +++ b/src/.old/objects/_button.scss @@ -0,0 +1,179 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@mixin button-variant($variant) { + &:link, + &:visited, + &:enabled { + border-color: fn.color(--#{$variant} --bg); + background-color: fn.color(--#{$variant} --bg); + box-shadow: fn.color(--#{$variant} --shadow); + color: fn.color(--#{$variant} --label); + } + + @include iro.bem-modifier('outline') { + &:link, + &:visited, + &:enabled { + background-color: transparent; + box-shadow: none; + color: fn.color(--#{$variant} --outline-label); + } + } + + &:link, + &:visited, + &:enabled { + &:hover { + border-color: fn.color(--#{$variant} --hover --bg); + background-color: fn.color(--#{$variant} --hover --bg); + box-shadow: fn.color(--#{$variant} --hover --shadow); + color: fn.color(--#{$variant} --hover --label); + } + + &:active { + border-color: fn.color(--#{$variant} --active --bg); + background-color: fn.color(--#{$variant} --active --bg); + box-shadow: fn.color(--#{$variant} --active --shadow); + color: fn.color(--#{$variant} --active --label); + } + } +} + +@include iro.props-namespace('button') { + @include iro.props-store(( + --dims: ( + --line-height: 1.4, + --pad-x: fn.global-dim(--size --225), + --pad-y: fn.global-dim(--size --65), + --rounding: 10em, + + --lg: ( + --pad-x: fn.global-dim(--size --300), + --pad-y: fn.global-dim(--size --100), + ), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --any: ( + --disabled: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg-hi3), + --shadow: 0 0 0 0 transparent, + ), + --key-focus: ( + --bg: transparent, + --label: fn.global-color(--focus --text), + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + ), + --accent: ( + --bg: fn.global-color(--accent --primary --solid --bg), + --label: fn.global-color(--accent --primary --solid --fg), + --outline-label: fn.global-color(--accent --primary --solid --obj), + --shadow: 0 0 0 0 transparent, + + --hover: ( + --bg: fn.global-color(--accent --primary --solid --obj), + --label: fn.global-color(--accent --primary --solid --fg), + --shadow: 0 0 0 0 transparent, + ), + --active: ( + --bg: fn.global-color(--accent --primary --solid --obj-lo), + --label: fn.global-color(--accent --primary --solid --fg), + --shadow: 0 0 0 0 transparent, + ), + ), + --primary: ( + --bg: fn.global-color(--fg), + --label: fn.global-color(--bg-hi2), + --outline-label: fn.global-color(--fg), + --shadow: 0 0 0 0 transparent, + + --hover: ( + --bg: fn.global-color(--fg-lo), + --label: fn.global-color(--bg-hi2), + --shadow: 0 0 0 0 transparent, + ), + --active: ( + --bg: fn.global-color(--fg-lo), + --label: fn.global-color(--bg-hi2), + --shadow: 0 0 0 0 transparent, + ), + ), + --secondary: ( + --bg: fn.global-color(--obj-hi), + --label: fn.global-color(--fg), + --outline-label: fn.global-color(--fg), + --shadow: 0 0 0 0 transparent, + + --hover: ( + --bg: fn.global-color(--obj), + --label: fn.global-color(--fg-lo), + --shadow: 0 0 0 0 transparent, + ), + --active: ( + --bg: fn.global-color(--obj-lo), + --label: fn.global-color(--fg-lo), + --shadow: 0 0 0 0 transparent, + ), + ), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border: 2px solid transparent; + border-radius: fn.dim(--rounding); + border-color: fn.color(--any --disabled --bg); + background-color: fn.color(--any --disabled --bg); + box-shadow: fn.color(--any --disabled --shadow); + color: fn.color(--any --disabled --label); + font-weight: 500; + line-height: fn.dim(--line-height); + text-align: center; + text-decoration: none; + vertical-align: top; + + @include iro.bem-modifier('block') { + display: block; + } + + @include iro.bem-modifier('outline') { + background-color: transparent; + box-shadow: none; + } + + @include iro.bem-modifier('lg') { + padding: fn.dim(--lg --pad-y) fn.dim(--lg --pad-x); + } + + @include button-variant('secondary'); + + @each $mod in 'accent' 'primary' { + @include iro.bem-modifier($mod) { + @include button-variant($mod); + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + border-color: fn.color(--any --key-focus --border); + background-color: fn.color(--any --key-focus --bg); + box-shadow: fn.color(--any --key-focus --shadow); + color: fn.color(--any --key-focus --label); + } + } + + @include iro.bem-modifier('round') { + width: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-y)); + padding-right: 0; + padding-left: 0; + border-radius: 100em; + } + } +} diff --git a/src/.old/objects/_checkbox.scss b/src/.old/objects/_checkbox.scss new file mode 100644 index 0000000..b3bb34d --- /dev/null +++ b/src/.old/objects/_checkbox.scss @@ -0,0 +1,249 @@ +@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-x: fn.global-dim(--size --65), + --pad-y: fn.global-dim(--size --65), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --box-border: fn.global-color(--fg-hi), + --box-bg: fn.global-color(--bg-hi), + + --hover: ( + --label: fn.global-color(--fg-lo), + --box-border: fn.global-color(--fg), + ), + --accent: ( + --box-border: fn.global-color(--accent --primary --solid --bg), + + --hover: ( + --box-border: fn.global-color(--accent --primary --solid --obj), + ), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --box-border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + --disabled: ( + --label: fn.global-color(--fg-hi3), + --box-border: fn.global-color(--obj-lo), + --box-bg: fn.global-color(--bg-hi), + ) + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-flex; + position: relative; + align-items: flex-start; + margin-right: calc(-1 * fn.dim(--pad-x)); + margin-left: calc(-1 * fn.dim(--pad-x)); + padding: fn.dim(--pad-y) fn.dim(--pad-x); + + @include iro.bem-elem('box') { + display: block; + position: relative; + flex: 0 0 auto; + width: fn.dim(--size); + height: fn.dim(--size); + margin-top: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--size))); + border-radius: fn.dim(--border); + background-color: fn.color(--box-border); + + &::before, + &::after { + content: ''; + display: block; + position: absolute; + } + + &::before { + z-index: 2; + top: fn.dim(--border); + left: fn.dim(--border); + width: calc(fn.dim(--size) - 2 * fn.dim(--border)); + height: calc(fn.dim(--size) - 2 * fn.dim(--border)); + transition: transform .2s ease; + background-color: fn.color(--box-bg); + } + + &::after { + z-index: 3; + top: calc(.5 * fn.dim(--size) - 1px); + left: calc(1.5 * fn.dim(--border)); + box-sizing: border-box; + width: calc(fn.dim(--size) - 3 * fn.dim(--border)); + height: 0; + transform: scale(0); + transition: transform .2s ease; + border-width: 0 2px 2px 0; + 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; + top: calc(1 * fn.dim(--border)); + left: calc(1 * fn.dim(--border)); + width: calc(100% - 2 * fn.dim(--border)); + height: 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') { + align-self: baseline; + margin-left: fn.dim(--label-gap); + } + + @include iro.bem-elem('native') { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + margin: 0; + padding: 0; + overflow: hidden; + opacity: .0001; + + &:hover { + @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); + } + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + @include iro.bem-sibling-elem('label') { + color: fn.color(--key-focus --label); + } + + @include iro.bem-sibling-elem('box') { + background-color: fn.color(--key-focus --box-border); + box-shadow: fn.color(--key-focus --shadow); + } + } + } + } + + @include iro.bem-modifier('standalone') { + @include iro.bem-elem('box') { + margin-top: 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 { + @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 { + @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/_dialog.scss b/src/.old/objects/_dialog.scss new file mode 100644 index 0000000..9333ce6 --- /dev/null +++ b/src/.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/objects/_emoji.scss b/src/.old/objects/_emoji.scss new file mode 100644 index 0000000..8d17212 --- /dev/null +++ b/src/.old/objects/_emoji.scss @@ -0,0 +1,74 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use 'sass:math'; + +@include iro.props-namespace('emoji') { + @include iro.props-store(( + --dims: ( + --size: calc(1 / 14 * 18em), + --pad: .3em, + --rounding: 3px, + --zoom: 3, + --valign: -.25em, + + --125: ( + --size: calc(1 / 14 * 23em), + --valign: -.45em, + ), + + --150: ( + --size: calc(1 / 14 * 28em), + --valign: -.65em, + ), + + --200: ( + --size: calc(1 / 14 * 38em), + --valign: -1em, + ) + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--obj-hi), + ) + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + position: relative; + width: calc(fn.dim(--size)); + height: calc(fn.dim(--size)); + margin: calc(-1 * fn.dim(--pad)); + padding: calc(fn.dim(--pad)); + vertical-align: fn.dim(--valign); + object-fit: contain; + + @include iro.bem-modifier('icon') { + margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--size) - fn.foreign-dim(--icon, --size))); + vertical-align: fn.foreign-dim(--icon, --valign); + } + + @each $size in '125' '150' '200' { + @include iro.bem-modifier($size) { + width: fn.dim(--#{$size} --size); + height: fn.dim(--#{$size} --size); + vertical-align: fn.dim(--#{$size} --valign); + + @include iro.bem-modifier('icon') { + margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--#{$size} --size) - fn.foreign-dim(--icon, --size))); + } + } + } + + @include iro.bem-modifier('zoomable') { + transition: transform .2s ease, background-color .2s ease; + border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom)); + + &:hover { + transform: scale(fn.dim(--zoom)); + background-color: fn.color(--bg); + } + } + } +} diff --git a/src/.old/objects/_field-label.scss b/src/.old/objects/_field-label.scss new file mode 100644 index 0000000..2127a09 --- /dev/null +++ b/src/.old/objects/_field-label.scss @@ -0,0 +1,89 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('field-label') { + @include iro.props-store(( + --dims: ( + --spacing-x: fn.global-dim(--size --150), + --spacing-y: fn.global-dim(--size --85), + --label-font-size: fn.global-dim(--font-size --75), + --hint-font-size: fn.global-dim(--font-size --75), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --label: fn.global-color(--fg-hi), + --hint: fn.global-color(--fg-hi), + --error-hint: fn.global-color(--accent --error --quiet --fg), + --disabled: fn.global-color(--fg-hi3), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: block; + + @include iro.bem-elem('label') { + display: block; + flex: 0 0 auto; + padding-right: fn.dim(--spacing-x); + 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-top: fn.dim(--spacing-y); + } + } + + @include iro.bem-elem('content') { + display: block; + width: 100%; + } + + @include iro.bem-elem('hint') { + display: block; + margin-top: fn.dim(--spacing-y); + 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('left', 'right') { + display: flex; + align-items: baseline; + + @include iro.bem-elem('label') { + display: inline-block; + + @include iro.bem-next-elem('content') { + margin-top: 0; + } + } + } + + @include iro.bem-modifier('left') { + @include iro.bem-elem('label') { + text-align: left; + } + } + + @include iro.bem-modifier('right') { + @include iro.bem-elem('label') { + text-align: right; + } + } + } +} diff --git a/src/.old/objects/_icon-nav.scss b/src/.old/objects/_icon-nav.scss new file mode 100644 index 0000000..d1c6539 --- /dev/null +++ b/src/.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/objects/_icon.scss b/src/.old/objects/_icon.scss new file mode 100644 index 0000000..5c4bfab --- /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, + ) + ), 'dims'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline; + width: fn.dim(--size); + height: fn.dim(--size); + stroke-width: fn.dim(--stroke); + stroke-linecap: round; + stroke-linejoin: round; + vertical-align: fn.dim(--valign); + + @include iro.bem-modifier('block') { + display: block; + } + } +} diff --git a/src/.old/objects/_lightbox.scss b/src/.old/objects/_lightbox.scss new file mode 100644 index 0000000..31d3398 --- /dev/null +++ b/src/.old/objects/_lightbox.scss @@ -0,0 +1,206 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@use 'action-button'; + +@include iro.props-namespace('lightbox') { + @include iro.props-store(( + --dims: ( + --pad: fn.global-dim(--size --150), + --thumbnail: ( + --size: fn.global-dim(--size --700), + --spacing: fn.global-dim(--size --100), + --idle: 1px, + --selected: 2px, + ), + --close-button: ( + --font-size: fn.global-dim(--font-size --200), + ), + --nav-button: ( + --width: fn.global-dim(--size --3800), + --height: fn.global-dim(--size --3800), + --font-size: fn.global-dim(--font-size --200), + ), + ), + ), 'dims'); + + @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.props-store(( + --colors: ( + --thumbnail: ( + --idle: fn.global-color(--fg-hi2), + --selected: fn.global-color(--fg-lo), + ), + ), + ), 'colors'); + + @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; + height: 100%; + overflow: hidden; + + @include iro.bem-elem('header') { + grid-area: header; + display: flex; + align-items: flex-start; + padding: fn.dim(--pad) fn.dim(--pad) 0; + } + + @include iro.bem-elem('img') { + display: none; + box-sizing: border-box; + grid-area: content; + width: 100%; + height: 100%; + padding: fn.dim(--pad); + object-fit: scale-down; + + @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(--thumbnail --selected) fn.dim(--pad) fn.dim(--pad); + overflow: auto; + } + + @include iro.bem-elem('footer') { + grid-area: footer; + display: flex; + align-items: flex-start; + padding: 0 fn.dim(--pad) fn.dim(--pad); + } + + @include iro.bem-elem('thumbnail') { + position: relative; + flex: 0 0 auto; + width: fn.dim(--thumbnail --size); + height: fn.dim(--thumbnail --size); + opacity: .75; + box-shadow: 0 0 0 fn.dim(--thumbnail --idle) fn.color(--thumbnail --idle) inset; + + &:hover { + opacity: 1; + } + + @include iro.bem-is('selected') { + opacity: 1; + box-shadow: 0 0 0 fn.dim(--thumbnail --selected) fn.color(--thumbnail --selected); + } + } + + @include iro.bem-elem('thumbnail-img') { + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + object-fit: cover; + object-position: center center; + } + + @include iro.bem-elem('thumbnail-icon') { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + + @include iro.bem-elem('close-btn') { + flex: 0 0 auto; + margin: calc(-.5 * fn.dim(--pad)) calc(-.5 * fn.dim(--pad)) 0 auto; + 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); + + &::after { + content: ''; + display: block; + position: absolute; + top: 50%; + left: 50%; + width: fn.dim(--nav-button --width); + height: fn.dim(--nav-button --height); + transform: translate(-50%, -50%); + } + + @include iro.bem-modifier('prev') { + grid-area: prev; + margin-right: calc(-1 * fn.dim(--pad)); + margin-left: calc(.5 * fn.dim(--pad)); + } + + @include iro.bem-modifier('next') { + grid-area: next; + margin-right: calc(.5 * fn.dim(--pad)); + margin-left: calc(-1 * fn.dim(--pad)); + } + } + } +} diff --git a/src/.old/objects/_list-group.scss b/src/.old/objects/_list-group.scss new file mode 100644 index 0000000..d46722e --- /dev/null +++ b/src/.old/objects/_list-group.scss @@ -0,0 +1,60 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('list-group') { + @include iro.props-store(( + --dims: ( + --pad-x: fn.global-dim(--size --175), + --pad-y: fn.global-dim(--size --125), + --rounding: 3px, + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--bg-hi2), + --border: fn.global-color(--obj), + --hover: fn.global-color(--bg), + --press: fn.global-color(--obj-hi), + ) + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + border: 1px solid fn.color(--border); + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + + @include iro.bem-elem('item') { + padding: fn.dim(--pad-y) fn.dim(--pad-x); + + @include iro.bem-next-twin-elem { + border-width: 1px 0 0; + border-style: solid; + border-color: fn.color(--border); + } + + @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { + &:hover { + background-color: fn.color(--hover); + } + + &:active { + background-color: fn.color(--press); + } + } + } + + @include iro.bem-modifier('horizontal') { + display: flex; + + @include iro.bem-elem('item') { + flex: 1 0 auto; + + @include iro.bem-next-twin-elem { + border-top-width: 0; + border-left-width: 1px; + } + } + } + } +} diff --git a/src/.old/objects/_menu.scss b/src/.old/objects/_menu.scss new file mode 100644 index 0000000..7db4896 --- /dev/null +++ b/src/.old/objects/_menu.scss @@ -0,0 +1,124 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@use './icon'; + +@include iro.props-namespace('menu') { + @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-x: fn.global-dim(--size --150), + --pad-y: fn.global-dim(--size --100), + --rounding: 3px, + ), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --header: ( + --label: fn.global-color(--fg-hi), + ), + --item: ( + --hover: ( + --bg: fn.global-color(--obj-hi), + --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), + ), + --badge: ( + --bg: fn.global-color(--bg), + --label: fn.global-color(--fg-lo), + ) + ), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: flex; + flex-direction: column; + gap: fn.dim(--spacing); + + @include iro.bem-elem('header') { + padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x); + 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-top: calc(fn.dim(--separator) + fn.dim(--spacing)); + } + } + + @include iro.bem-elem('item') { + padding: calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px); + border: 2px solid transparent; + border-radius: fn.dim(--item --rounding); + color: fn.color(--item --disabled --label); + + &:link, + &:visited, + &:enabled { + color: currentColor; + + @include iro.bem-multi('&:hover, &:active', 'is' 'selected') { + background-color: fn.color(--item --hover --bg); + color: fn.color(--item --hover --label); + + @include iro.bem-elem('badge') { + background-color: fn.color(--item --badge --bg); + color: fn.color(--item --badge --label); + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + border-radius: calc(fn.dim(--item --rounding) - 1px); + border-color: fn.color(--item --key-focus --border); + background-color: fn.color(--item --hover --bg); + box-shadow: fn.color(--item --key-focus --shadow); + color: fn.color(--item --hover --label); + } + } + } + + @include iro.bem-next-elem('header') { + margin-top: 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') { + height: fn.dim(--separator); + } + + @include iro.bem-elem('icon-slot') { + display: flex; + justify-content: center; + width: fn.foreign-dim(--icon, --size); + } + + @include iro.bem-modifier('pull') { + margin: calc(-1 * fn.dim(--item --pad-x)); + } + } +} diff --git a/src/.old/objects/_message.scss b/src/.old/objects/_message.scss new file mode 100644 index 0000000..283ce26 --- /dev/null +++ b/src/.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/objects/_overflow-button.scss b/src/.old/objects/_overflow-button.scss new file mode 100644 index 0000000..b15ea1f --- /dev/null +++ b/src/.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/objects/_radio.scss b/src/.old/objects/_radio.scss new file mode 100644 index 0000000..5af7a12 --- /dev/null +++ b/src/.old/objects/_radio.scss @@ -0,0 +1,176 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('radio') { + @include iro.props-store(( + --dims: ( + --diameter: calc(fn.global-dim(--size --175) + 1px), + --label-gap: fn.global-dim(--size --125), + --border: fn.global-dim(--border --medium), + --pad-x: fn.global-dim(--size --65), + --pad-y: fn.global-dim(--size --65), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --circle-border: fn.global-color(--fg-hi), + --circle-bg: fn.global-color(--bg-hi), + + --hover: ( + --label: fn.global-color(--fg-lo), + --circle-border: fn.global-color(--fg), + ), + --accent: ( + --circle-border: fn.global-color(--accent --primary --solid --bg), + + --hover: ( + --circle-border: fn.global-color(--accent --primary --solid --obj), + ), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --circle-border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + --disabled: ( + --label: fn.global-color(--fg-hi3), + --circle-border: fn.global-color(--obj-lo), + --circle-bg: fn.global-color(--bg-hi), + ) + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-flex; + position: relative; + align-items: flex-start; + margin-right: calc(-1 * fn.dim(--pad-x)); + margin-left: calc(-1 * fn.dim(--pad-x)); + padding: fn.dim(--pad-y) fn.dim(--pad-x); + + @include iro.bem-elem('circle') { + display: block; + box-sizing: border-box; + flex: 0 0 auto; + width: fn.dim(--diameter); + height: fn.dim(--diameter); + margin-top: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--diameter))); + border-radius: 2em; + background-color: fn.color(--circle-border); + + &::after { + content: ''; + display: block; + position: relative; + top: fn.dim(--border); + left: fn.dim(--border); + width: calc(fn.dim(--diameter) - 2 * fn.dim(--border)); + height: 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') { + align-self: baseline; + margin-left: fn.dim(--label-gap); + } + + @include iro.bem-elem('native') { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + margin: 0; + padding: 0; + overflow: hidden; + opacity: .0001; + + &:hover { + @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); + } + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + @include iro.bem-sibling-elem('label') { + color: fn.color(--key-focus --label); + } + + @include iro.bem-sibling-elem('circle') { + background-color: fn.color(--key-focus --circle-border); + box-shadow: fn.color(--key-focus --shadow); + } + } + } + } + + @include iro.bem-modifier('standalone') { + @include iro.bem-elem('circle') { + margin-top: 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 { + @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/_status-indicator.scss b/src/.old/objects/_status-indicator.scss new file mode 100644 index 0000000..d8ea9ef --- /dev/null +++ b/src/.old/objects/_status-indicator.scss @@ -0,0 +1,35 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('status-indicator') { + @include iro.props-store(( + --dims: ( + --size: fn.global-dim(--size --125), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --default: fn.global-color(--obj-lo), + --primary: fn.global-color(--fg), + --green: fn.global-color(--green --solid --bg-hi), + --yellow: fn.global-color(--yellow --solid --bg-hi), + --red: fn.global-color(--red --solid --bg-hi), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-block; + width: fn.dim(--size); + height: fn.dim(--size); + border-radius: 10em; + background-color: fn.color(--default); + vertical-align: middle; + + @each $color in 'primary' 'green' 'yellow' 'red' { + @include iro.bem-is($color) { + background-color: fn.color(--#{$color}); + } + } + } +} diff --git a/src/.old/objects/_switch.scss b/src/.old/objects/_switch.scss new file mode 100644 index 0000000..cbbb9b7 --- /dev/null +++ b/src/.old/objects/_switch.scss @@ -0,0 +1,221 @@ +@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 --325), + --height: calc(fn.global-dim(--size --175) + 1px), + --label-gap: fn.global-dim(--size --125), + --border: fn.global-dim(--border --medium), + --pad-x: fn.global-dim(--size --65), + --pad-y: fn.global-dim(--size --65), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --track-bg: fn.global-color(--obj), + --handle-border: fn.global-color(--fg-hi), + --handle-bg: fn.global-color(--bg-hi), + + --hover: ( + --label: fn.global-color(--fg-lo), + --handle-border: fn.global-color(--fg), + ), + --accent: ( + --handle-border: fn.global-color(--accent --primary --solid --bg), + + --hover: ( + --handle-border: fn.global-color(--accent --primary --solid --obj), + ), + ), + --key-focus: ( + --label: fn.global-color(--focus --text), + --track-bg: fn.global-color(--focus --fill), + --handle-border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + --disabled: ( + --label: fn.global-color(--fg-hi3), + --track-bg: fn.global-color(--obj), + --handle-border: fn.global-color(--obj-lo), + --handle-bg: fn.global-color(--bg-hi), + ) + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline-flex; + position: relative; + align-items: flex-start; + margin-right: calc(-1 * fn.dim(--pad-x)); + margin-left: calc(-1 * fn.dim(--pad-x)); + padding: fn.dim(--pad-y) fn.dim(--pad-x); + + @include iro.bem-elem('indicator') { + display: block; + box-sizing: border-box; + flex: 0 0 auto; + width: fn.dim(--width); + height: fn.dim(--height); + margin-top: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--height))); + transition: background-color .2s ease; + border-radius: 2em; + background-color: fn.color(--track-bg); + + &::after { + content: ''; + display: block; + width: calc(fn.dim(--height) - 2 * fn.dim(--border)); + height: 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') { + align-self: baseline; + margin-left: fn.dim(--label-gap); + } + + @include iro.bem-elem('native') { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + margin: 0; + padding: 0; + overflow: hidden; + opacity: .0001; + + &:hover { + @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 { + @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); + } + } + } + } + + @include iro.bem-at-theme('keyboard') { + &:focus { + @include iro.bem-sibling-elem('label') { + color: fn.color(--key-focus --label); + } + + @include iro.bem-sibling-elem('indicator') { + &::after { + border-color: fn.color(--key-focus --handle-border); + box-shadow: fn.color(--key-focus --shadow); + } + } + + &:checked { + @include iro.bem-sibling-elem('indicator') { + background-color: fn.color(--key-focus --track-bg); + } + } + } + } + } + + @include iro.bem-modifier('standalone') { + @include iro.bem-elem('indicator') { + margin-top: 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 { + @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..34512cb --- /dev/null +++ b/src/.old/objects/_table.scss @@ -0,0 +1,167 @@ +@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-x: fn.global-dim(--size --175), + --pad-y: fn.global-dim(--size --125), + --rounding: 3px, + --50: ( + --pad-y: fn.global-dim(--size --75), + ) + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --border: fn.global-color(--obj), + --heading: fn.global-color(--fg-hi), + --hover: fn.global-color(--obj-hi), + --press: fn.global-color(--obj), + --box: ( + --bg: fn.global-color(--bg-hi2), + --hover: fn.global-color(--bg), + --press: fn.global-color(--obj-hi), + ) + ) + ), 'colors'); + + @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: 500, + --transform: uppercase, + --spacing: .5px + )); + + padding: fn.dim(--pad-y) fn.dim(--pad-x); + color: fn.color(--heading); + text-align: left; + } + + @include iro.bem-elem('cell') { + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border-width: 1px 0 0; + border-style: solid; + border-color: fn.color(--border); + + @include iro.bem-modifier('divider') { + border-right-width: 1px; + } + } + + @include iro.bem-elem('row') { + &:last-child { + @include iro.bem-elem('cell') { + border-bottom-width: 1px; + } + } + } + + @include iro.bem-modifier('flush') { + @include iro.bem-elem('head-cell', 'cell') { + &:first-child { + padding-left: 0; + } + + &:last-child { + padding-right: 0; + } + } + } + + @include iro.bem-modifier('box') { + @include iro.bem-elem('cell') { + background-color: fn.color(--box --bg); + + &:first-child { + border-left-width: 1px; + } + + &:last-child { + border-right-width: 1px; + } + } + + @include iro.bem-elem('row') { + &:first-child { + @include iro.bem-elem('cell') { + &:first-child { + border-top-left-radius: fn.dim(--rounding); + } + + &:last-child { + border-top-right-radius: fn.dim(--rounding); + } + } + } + + &:last-child { + @include iro.bem-elem('cell') { + &:first-child { + border-bottom-left-radius: fn.dim(--rounding); + } + + &:last-child { + border-bottom-right-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(--press); + } + } + } + + @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 --press); + } + } + } + } + } + + @include iro.bem-modifier('50') { + @include iro.bem-elem('head-cell', 'cell') { + padding-top: fn.dim(--50 --pad-y); + padding-bottom: fn.dim(--50 --pad-y); + } + } + } +} diff --git a/src/.old/objects/_text-field.scss b/src/.old/objects/_text-field.scss new file mode 100644 index 0000000..88c4535 --- /dev/null +++ b/src/.old/objects/_text-field.scss @@ -0,0 +1,232 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@mixin invalid { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--error --border); + box-shadow: fn.color(--error --shadow); + } + + &:hover { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--error --hover --border); + box-shadow: fn.color(--error --hover --shadow); + } + } + + &:focus { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--error --focus --border); + box-shadow: fn.color(--error --focus --shadow); + } + } +} + +@mixin keyboard-focus { + @include iro.bem-sibling-elem('bg') { + border-color: fn.color(--key-focus --border); + box-shadow: fn.color(--key-focus --shadow); + } +} + +@include iro.props-namespace('text-field') { + @include iro.props-store(( + --dims: ( + --pad-x: fn.global-dim(--size --125), + --pad-y: fn.global-dim(--size --125), + --border: fn.global-dim(--border --thin), + --rounding: 2px, + + --extended: ( + --pad: fn.global-dim(--size --50), + --rounding: 6px, + ), + + --focus: ( + --border: fn.global-dim(--border --medium), + ) + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--bg-hi2), + --placeholder: fn.global-color(--fg-hi2), + --text: fn.global-color(--fg), + --border: fn.global-color(--obj-lo), + --shadow: 0 0 0 0 transparent, + + --hover: ( + --border: fn.global-color(--fg-hi2), + --shadow: 0 0 0 0 transparent, + ), + --focus: ( + --border: fn.global-color(--accent --primary --solid --bg), + --shadow: 0 0 0 0 transparent, + ), + --key-focus: ( + --border: fn.global-color(--focus --fill), + --shadow: fn.global-color(--focus --shadow), + ), + --error: ( + --border: fn.global-color(--accent --error --solid --bg-hi), + --shadow: 0 0 0 0 transparent, + + --hover: ( + --border: fn.global-color(--accent --error --solid --bg), + --shadow: 0 0 0 0 transparent, + ), + --focus: ( + --border: fn.global-color(--accent --error --solid --bg), + --shadow: 0 0 0 0 transparent, + ), + ), + --disabled: ( + --bg: fn.global-color(--obj-hi), + --placeholder: fn.global-color(--fg-hi3), + --text: fn.global-color(--fg-hi3), + --border: fn.global-color(--obj-hi), + --shadow: 0 0 0 0 transparent, + ), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + $line-height: 1.4; + $focus-border-offset: calc(fn.dim(--border) - fn.dim(--focus --border)); + + position: relative; + min-width: 0; + border-radius: fn.dim(--rounding); + background-color: fn.color(--bg); + + @include iro.bem-elem('bg') { + display: block; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border: fn.dim(--border) solid fn.color(--border); + border-radius: fn.dim(--rounding); + box-shadow: fn.color(--shadow); + pointer-events: none; + } + + @include iro.bem-elem('native') { + box-sizing: border-box; + width: 100%; + padding: calc(fn.dim(--pad-y) - .5em * ($line-height - 1)) fn.dim(--pad-x); + border: 1px solid transparent; + background-color: transparent; + color: fn.color(--text); + font: inherit; + line-height: $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); + box-shadow: fn.color(--hover --shadow); + } + } + + &:focus { + outline: 0; + + @include iro.bem-sibling-elem('bg') { + top: $focus-border-offset; + right: $focus-border-offset; + bottom: $focus-border-offset; + left: $focus-border-offset; + border: fn.dim(--focus --border) solid fn.color(--focus --border); + border-radius: calc(fn.dim(--rounding) - $focus-border-offset); + box-shadow: fn.color(--focus --shadow); + } + } + + &:invalid { + @include invalid; + } + } + + @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(--extended --rounding) - $focus-border-offset); + } + } + } + } + + @include iro.bem-is('invalid') { + @include iro.bem-elem('native') { + @include invalid; + } + } + + @include iro.bem-at-theme('keyboard') { + @include iro.bem-elem('native') { + &:focus, + &:invalid:focus { + @include keyboard-focus; + } + } + + @include iro.bem-is('invalid') { + @include iro.bem-elem('native') { + &:focus { + @include keyboard-focus; + } + } + } + } + + @include iro.bem-is('disabled') { + background-color: fn.color(--disabled --bg); + box-shadow: fn.color(--disabled --shadow); + + @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..5383bd7 --- /dev/null +++ b/src/.old/scopes/_blockquotes.scss @@ -0,0 +1,35 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('blockquotes') { + @include iro.props-store(( + --dims: ( + --indent: fn.global-dim(--list --indent), + --margin-top: fn.global-dim(--paragraph --margin-top), + + --compact: ( + --indent: fn.global-dim(--list --compact-indent), + ), + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --border: fn.global-color(--obj), + ) + ), 'colors'); + + @include iro.bem-scope(iro.props-namespace()) { + blockquote { + margin: fn.dim(--margin-top) 0 0 1px; + padding-left: calc(fn.dim(--indent) - 3px); + border-left: 3px solid fn.color(--border); + } + + @include iro.bem-modifier('compact') { + blockquote { + padding-left: calc(fn.dim(--compact --indent) - 3px); + } + } + } +} diff --git a/src/.old/scopes/_code.scss b/src/.old/scopes/_code.scss new file mode 100644 index 0000000..4eb9458 --- /dev/null +++ b/src/.old/scopes/_code.scss @@ -0,0 +1,68 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('code') { + @include iro.props-store(( + --dims: ( + --inline: ( + --pad-x: fn.global-dim(--size --50), + --pad-y: fn.global-dim(--size --10), + --rounding: 3px, + ), + --block: ( + --pad-x: fn.global-dim(--size --150), + --pad-y: fn.global-dim(--size --85), + --margin-top: fn.global-dim(--paragraph --margin-top), + --rounding: 3px, + ) + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --inline: ( + --fg: fn.global-color(--red --quiet --fg), + --bg: fn.global-color(--red --quiet --bg), + ), + --block: ( + --fg: fn.global-color(--fg), + --bg: fn.global-color(--bg-hi2), + ) + ) + ), 'colors'); + + @include iro.props-store(( + --colors: ( + --block: ( + --fg: fn.global-color(--fg-lo), + --bg: fn.global-color(--obj-hi), + ) + ) + ), 'palette-light-hi'); + + @include iro.bem-scope(iro.props-namespace()) { + code { + padding: fn.dim(--inline --pad-y) fn.dim(--inline --pad-x); + border-radius: fn.dim(--inline --rounding); + background-color: fn.color(--inline --bg); + color: fn.color(--inline --fg); + } + + pre { + margin: fn.dim(--block --margin-top) 0 0 0; + padding: fn.dim(--block --pad-y) fn.dim(--block --pad-x); + border-radius: fn.dim(--block --rounding); + background-color: fn.color(--block --bg); + color: fn.color(--block --fg); + + code { + display: inline-block; + margin-right: fn.dim(--block --pad-x); + padding: 0; + border-radius: 0; + background-color: transparent; + color: currentColor; + } + } + } +} diff --git a/src/.old/scopes/_lists.scss b/src/.old/scopes/_lists.scss new file mode 100644 index 0000000..1322f2d --- /dev/null +++ b/src/.old/scopes/_lists.scss @@ -0,0 +1,67 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('lists') { + @include iro.props-store(( + --dims: ( + --indent: calc(fn.global-dim(--list --indent) + 1em), + --margin-top: fn.global-dim(--paragraph --margin-top), + + --compact: ( + --indent: fn.global-dim(--list --compact-indent), + ), + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --border: fn.global-color(--obj-hi), + ) + ), 'colors'); + + @include iro.bem-scope(iro.props-namespace()) { + ul, + ol { + margin-top: fn.dim(--margin-top); + padding-left: fn.dim(--indent); + + ul, + ol { + margin-top: 0; + } + } + + ul { + list-style: disc; + } + + ol { + list-style: decimal; + } + + dl { + margin: fn.dim(--margin-top) 0 0; + padding: 0; + } + + dt { + color: fn.global-color(--fg-lo); + font-weight: bold; + } + + dd { + margin: 0 0 0 fn.dim(--indent); + } + + @include iro.bem-modifier('compact') { + ul, + ol { + padding-left: calc(fn.dim(--compact --indent) - 3px); + } + + dd { + margin-left: calc(fn.dim(--compact --indent) - 3px); + } + } + } +} diff --git a/src/.old/scopes/_tables.scss b/src/.old/scopes/_tables.scss new file mode 100644 index 0000000..f78e81b --- /dev/null +++ b/src/.old/scopes/_tables.scss @@ -0,0 +1,114 @@ +@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-x: fn.global-dim(--size --175), + --pad-y: fn.global-dim(--size --125), + --rounding: 3px, + --margin-top: fn.global-dim(--paragraph --margin-top), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --border: fn.global-color(--obj), + --heading: fn.global-color(--fg-hi), + --box: ( + --bg: fn.global-color(--bg-hi2), + ) + ) + ), 'colors'); + + @include iro.bem-scope(iro.props-namespace()) { + table { + margin-top: fn.dim(--margin-top); + border-spacing: 0; + border-collapse: separate; + } + + th { + @include mx.set-font(--standard, ( + --line-height: null, + --size: fn.global-dim(--font-size --50), + --weight: 500, + --transform: uppercase, + --spacing: .5px + )); + + padding: fn.dim(--pad-y) fn.dim(--pad-x); + color: fn.color(--heading); + text-align: left; + } + + td { + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border-width: 1px 0 0; + border-style: solid; + border-color: fn.color(--border); + } + + tr { + &:last-child { + td { + border-bottom-width: 1px; + } + } + } + + @include iro.bem-modifier('flush') { + th, + td { + &:first-child { + padding-left: 0; + } + + &:last-child { + padding-right: 0; + } + } + } + + @include iro.bem-modifier('box') { + td { + background-color: fn.color(--box --bg); + + &:first-child { + border-left-width: 1px; + } + + &:last-child { + border-right-width: 1px; + } + } + + tr { + &:first-child { + td { + &:first-child { + border-top-left-radius: fn.dim(--rounding); + } + + &:last-child { + border-top-right-radius: fn.dim(--rounding); + } + } + } + + &:last-child { + td { + &:first-child { + border-bottom-left-radius: fn.dim(--rounding); + } + + &:last-child { + border-bottom-right-radius: fn.dim(--rounding); + } + } + } + } + } + } +} diff --git a/src/_apply-vars.scss b/src/_apply-vars.scss index bee2ff3..a2ee404 100644 --- a/src/_apply-vars.scss +++ b/src/_apply-vars.scss @@ -1,82 +1,17 @@ +@use 'sass:map'; @use 'iro-sass/src/index' as iro; @use 'include-media/dist/include-media' as media; :root { - @include iro.props-assign('dims'); + @include iro.props-assign; - @each $breakpoint in map-keys(media.$breakpoints) { + @each $breakpoint in map.keys(media.$breakpoints) { @include media.media('<=#{$breakpoint}') { @include iro.props-assign($breakpoint); } } - @include iro.props-assign('colors'); - @include iro.props-assign('palette-light'); - - @media (prefers-color-scheme: dark) { - @include iro.props-assign('colors-dark'); - @include iro.props-assign('palette-dark'); - } -} - -@include iro.bem-theme('media') { - @include iro.props-assign('colors'); - @include iro.props-assign('colors-media'); - @include iro.props-assign('palette-media-dark'); -} - -@include iro.bem-theme('media-light') { - @include iro.props-assign('colors'); - @include iro.props-assign('colors-media-light'); - @include iro.props-assign('palette-media-light'); -} - -@include iro.bem-theme('def') { - @include iro.props-assign('colors'); - @include iro.props-assign('palette-light'); - - @media (prefers-color-scheme: dark) { - @include iro.props-assign('colors-dark'); - @include iro.props-assign('palette-dark'); - } -} - -@include iro.bem-theme('hi') { - @include iro.props-assign('colors'); - @include iro.props-assign('palette-light-hi'); - - @media (prefers-color-scheme: dark) { - @include iro.props-assign('colors-dark'); - @include iro.props-assign('palette-dark-hi'); - } -} - -@include iro.bem-theme('lo') { - @include iro.props-assign('colors'); - @include iro.props-assign('palette-light-lo'); - - @media (prefers-color-scheme: dark) { - @include iro.props-assign('colors-dark'); - @include iro.props-assign('palette-dark-lo'); - } -} - -@include iro.bem-theme('up') { - @include iro.props-assign('colors'); - @include iro.props-assign('palette-light-hi'); - - @media (prefers-color-scheme: dark) { - @include iro.props-assign('colors-dark'); - @include iro.props-assign('palette-dark-lo'); - } -} - -@include iro.bem-theme('down') { - @include iro.props-assign('colors'); - @include iro.props-assign('palette-light-lo'); - @media (prefers-color-scheme: dark) { - @include iro.props-assign('colors-dark'); - @include iro.props-assign('palette-dark-hi'); + @include iro.props-assign('dark'); } } diff --git a/src/_base.scss b/src/_base.scss index 740fe3f..b4ce1ae 100644 --- a/src/_base.scss +++ b/src/_base.scss @@ -5,7 +5,7 @@ @use 'config'; html { - scrollbar-color: fn.color(--fg-hi3) fn.color(--bg); + scrollbar-color: fn.color(--text-disabled) transparent; } html, @@ -18,8 +18,8 @@ body { margin: 0; padding: 0; - background-color: fn.color(--bg); - color: fn.color(--fg); + background-color: fn.color(--bg-base); + color: fn.color(--text); } pre, @@ -48,21 +48,20 @@ h3, h4, h5, h6 { - margin: fn.dim(--heading --margin-top) 0 0; - color: fn.color(--fg-lo); + margin-block: fn.dim(--heading --margin-bs) 0; + color: fn.color(--heading); font-size: fn.dim(--font-size --75); font-weight: bold; letter-spacing: 1px; text-transform: uppercase; & + & { - margin-top: fn.dim(--heading --margin-top-sibling); + margin-block-start: fn.dim(--heading --margin-bs-sibling); } } p { - margin-top: fn.dim(--paragraph --margin-top); - margin-bottom: 0; + margin-block: fn.dim(--paragraph --margin-bs) 0; &:empty { display: none; @@ -70,12 +69,12 @@ p { } strong { - color: fn.color(--fg-lo); + color: fn.color(--heading); font-weight: bold; } small { - color: fn.color(--fg-hi); + color: fn.color(--text-mute); font-size: fn.dim(--font-size --75); } @@ -129,11 +128,11 @@ input, textarea { &::placeholder { opacity: 1; - color: fn.color(--obj); + color: fn.color(--text-mute); } &:disabled { - color: fn.color(--fg-hi); + color: fn.color(--text-disabled); } } @@ -141,20 +140,9 @@ textarea { height: calc(1em * fn.dim(--font --standard --line-height)); } -::selection { - background: fn.color(--selection --bg); - color: fn.color(--selection --fg); -} - -img { - &::selection { - background: fn.color(--selection --bg-img); - } -} - hr { height: fn.dim(--border --thin); - margin: calc(.5 * (fn.dim(--heading --margin-top) + fn.dim(--paragraph --margin-top))) 0; + margin-block: calc(.5 * (fn.dim(--heading --margin-bs) + fn.dim(--paragraph --margin-bs))) 0; border: 0; - background-color: fn.color(--obj); + background-color: fn.color(--border); } diff --git a/src/_config.scss b/src/_config.scss index c42ad97..08374fb 100644 --- a/src/_config.scss +++ b/src/_config.scss @@ -1,6 +1,9 @@ +@use 'sass:list'; +@use 'sass:map'; @use 'iro-sass/src/index' as iro; @use 'iro-sass/src/responsive' as res; @use 'include-media/dist/include-media' as media; +@use '@oddbird/blend'; iro.$vars-root-size: 16px; @@ -20,18 +23,123 @@ media.$unit-intervals: ( res.$named-viewports: media.$breakpoints; -$wanted-grays: ( - --1: -1.3, - --2: -1.15, - --3: 1, +$palette-precision: 5 !default; - --4: 1.15, - --5: 1.35, - --6: 1.7, +$theme-light: ( + --base: hsl(0, 0%, 97%), + --blue: blend.lch(48% 50 279), + --purple: blend.lch(48% 50 308), + --red: blend.lch(48% 50 23), + --green: blend.lch(63% 50 147), + --yellow: blend.lch(68% 50 70), - --7: 2.4, - --8: 3.3, - --9: 6, - --10: 13, - --11: 20, -); + --grays: ( + --50: 1.1, + --75: 1.04, + --100: 1, + + --200: -1.15, + --300: -1.35, + --400: -1.7, + + --500: -2.4, + --600: -3.3, + --700: -6, + --800: -13, + --900: -20, + ), + --colors: ( + --100: -1.08, + --200: -1.20, + --300: -1.33, + --400: -1.58, + --500: -1.92, + --600: -2.39, + --700: -3.01, + --800: -3.87, + --900: -5.07, + --1000: -6.72, + --1100: -8.84, + --1200: -11.31, + --1300: -13.94, + ), + + --accent: --blue, + + --bg-l2: --50, + --bg-l1: --100, + --bg-base: --200, + + --border-mute: --200, + --border: --300, + --border-strong: --400, + + --text-disabled: --500, + --text-mute-more: --600, + --text-mute: --700, + --text: --800, + --heading: --900, +) !default; + +$theme-dark: ( + --base: hsl(0, 0%, 19%), + --blue: blend.lch(48% 50 279), + --purple: blend.lch(48% 50 308), + --red: blend.lch(48% 50 23), + --green: blend.lch(63% 50 147), + --yellow: blend.lch(68% 50 70), + + --grays: ( + --50: -1.31, + --75: -1.18, + --100: 1, + + --200: 1.15, + --300: 1.35, + --400: 1.7, + + --500: 2.4, + --600: 3.3, + --700: 6, + --800: 13, + --900: 20, + ), + --colors: ( + --100: 1.12, + --200: 1.30, + --300: 1.58, + --400: 1.96, + --500: 2.45, + --600: 3.09, + --700: 3.90, + --800: 4.85, + --900: 6.02, + --1000: 7.34, + --1100: 8.77, + --1200: 10.18, + --1300: 11.64, + ), + + --accent: --blue, + + --bg-base: --50, + --bg-l1: --75, + --bg-l2: --100, + + --border-mute: --200, + --border: --300, + --border-strong: --400, + + --text-disabled: --500, + --text-mute-more: --600, + --text-mute: --700, + --text: --800, + --heading: --900, +) !default; + +$themes: ( + light: $theme-light, + dark: $theme-dark, +) !default; + +$theme-default: list.nth(map.keys($themes), 1) !default; diff --git a/src/_declare-vars.scss b/src/_declare-vars.scss index bf7e955..37d9cae 100644 --- a/src/_declare-vars.scss +++ b/src/_declare-vars.scss @@ -1,7 +1,9 @@ +@use 'sass:map'; @use 'iro-sass/src/index' as iro; @use 'include-media/dist/include-media' as media; @use '@oddbird/blend'; @use 'functions' as fn; +@use 'config'; @include iro.props-store(( --dims: ( @@ -102,12 +104,12 @@ ), --paragraph: ( - --margin-top: fn.dim(--size --300, null), + --margin-bs: fn.dim(--size --300, null), ), --heading: ( - --margin-top: fn.dim(--size --700, null), - --margin-top-sibling: fn.dim(--size --325, null), + --margin-bs: fn.dim(--size --700, null), + --margin-bs-sibling: fn.dim(--size --325, null), --lg: fn.dim(--font-size --400, null), --md: fn.dim(--font-size --75, null), @@ -137,12 +139,18 @@ --compact-indent: fn.dim(--size --250, null), ), ), -), 'dims'); +)); + +@each $breakpoint in map.keys(media.$breakpoints) { + @include media.media('<=#{$breakpoint}') { + @include iro.props-store((), $breakpoint); + } +} @include iro.props-store(( --dims: ( --heading: ( - --margin-top: fn.dim(--size --600, null), + --margin-bs: fn.dim(--size --600, null), ), --list: ( @@ -154,7 +162,7 @@ @include iro.props-store(( --dims: ( --heading: ( - --margin-top: fn.dim(--size --500, null), + --margin-bs: fn.dim(--size --500, null), ), --list: ( @@ -167,185 +175,56 @@ @include iro.props-store(( --colors: ( - --gray: fn.gray-palette(100%), - ), -), 'palette-light-hi'); - -@include iro.props-store(( - --colors: ( - --gray: fn.gray-palette(97%), - ), -), 'palette-light'); - -@include iro.props-store(( - --colors: ( - --gray: fn.gray-palette(93%), - ), -), 'palette-light-lo'); - -// @include iro.props-store(( -// --colors: ( -// --gray: fn.gray-palette(88%), -// ), -// ), 'palette-light-lo2'); - -@include iro.props-store(( - --colors: ( - --bg-hi2: fn.color(--gray --1, null), // Lightest background - --bg-hi: fn.color(--gray --2, null), // Lighter background - --bg: fn.color(--gray --3, null), // Background - - --obj-hi: fn.color(--gray --4, null), - --obj: fn.color(--gray --5, null), - --obj-lo: fn.color(--gray --6, null), - - --fg-hi3: fn.color(--gray --7, null), // Disabled text - --fg-hi2: fn.color(--gray --8, null), // Placeholder text - --fg-hi: fn.color(--gray --9, null), // Faint text - --fg: fn.color(--gray --10, null), // Text - --fg-lo: fn.color(--gray --11, null), // Strong text - - --border: ( - --regular: fn.color(--obj, null), - --stable: iro.props-get-static(--colors --gray --5, 'palette-light'), - --stable-lo: iro.props-get-static(--colors --gray --6, 'palette-light'), - ), - - --blue: fn.color-palette(blend.lch(48% 50 279)), - --purple: fn.color-palette(blend.lch(48% 50 308)), - --red: fn.color-palette(blend.lch(48% 50 23)), - --green: fn.color-palette(blend.lch(63% 50 147)), - --yellow: fn.color-palette(blend.lch(68% 50 70)), - - --accent: ( - --primary: iro.props-ref('colors', --colors --blue), - --error: iro.props-ref('colors', --colors --red), - --success: iro.props-ref('colors', --colors --green), - --warning: iro.props-ref('colors', --colors --yellow), - --link-idle: iro.props-ref('colors', --colors --blue), - --link-visited: iro.props-ref('colors', --colors --purple), - ), - - --selection: ( - --bg: fn.color(--accent --primary --selection, null), - --bg-img: fn.color(--accent --primary --quiet --obj-lo, null), - --fg: fn.color(--accent --primary --solid --fg, null), + --base: fn.palette( + map.get(config.$theme-light, --base), + map.get(config.$theme-light, --grays), ), - - --focus: ( - --shadow: 0 0 0 fn.dim(--focus --outline-width, null) fn.color(--accent --primary --quiet --obj-lo, null), - --fill: fn.color(--accent --primary --solid --bg, null), - --text: fn.color(--accent --primary --solid --obj, null), - --fill-text: fn.color(--accent --primary --solid --fg, null), - ), - ), -), 'colors'); - -// - -// @include iro.props-store(( -// --colors: ( -// --gray: fn.gray-palette(1%), -// ), -// ), 'palette-dark-hi2'); - -@include iro.props-store(( - --colors: ( - --gray: fn.gray-palette(7%), - ), -), 'palette-dark-hi'); - -@include iro.props-store(( - --colors: ( - --gray: fn.gray-palette(12%), ), -), 'palette-dark'); +)); @include iro.props-store(( --colors: ( - --gray: fn.gray-palette(17%), - ), -), 'palette-dark-lo'); - -@include iro.props-store(( - --colors: ( - --border: ( - --stable: iro.props-get-static(--colors --gray --5, 'palette-dark-lo'), - --stable-lo: iro.props-get-static(--colors --gray --6, 'palette-dark-lo'), + --base: fn.palette( + map.get(config.$theme-dark, --base), + map.get(config.$theme-dark, --grays), ), - - --blue: fn.color-palette(blend.lch(63% 50 279), -1), - --purple: fn.color-palette(blend.lch(63% 50 308), -1), - --red: fn.color-palette(blend.lch(63% 50 23), -1), - --green: fn.color-palette(blend.lch(78% 50 147), -1), - --yellow: fn.color-palette(blend.lch(88% 50 70), -1), - - --accent: ( - --primary: iro.props-ref('colors-dark', --colors --blue), - --error: iro.props-ref('colors-dark', --colors --red), - --success: iro.props-ref('colors-dark', --colors --green), - --warning: iro.props-ref('colors-dark', --colors --yellow), - --link-idle: iro.props-ref('colors-dark', --colors --blue), - --link-visited: iro.props-ref('colors-dark', --colors --purple), - ), - ) -), 'colors-dark'); - -// - -@include iro.props-store(( - --colors: ( - --gray: fn.gray-palette(97%, true), ), -), 'palette-media-light'); - -@include iro.props-store(( - --colors: ( - --border: ( - --stable: iro.props-get-static(--colors --gray --5, 'palette-media-light'), - --stable-lo: iro.props-get-static(--colors --gray --6, 'palette-media-light'), - ), - ) -), 'colors-media-light'); +), 'dark'); -// +@each $name, $theme in config.$themes { + $props-name: if($name == config.$theme-default, iro.$props-default-tree, $name); -@include iro.props-store(( - --colors: ( - --gray: fn.gray-palette(12%, true), - ), -), 'palette-media-dark'); + @each $color in 'blue' 'purple' 'red' 'green' 'yellow' { + @include iro.props-store(( + --colors: ( + --#{$color}: fn.palette( + map.get($theme, --#{$color}), + map.get($theme, --colors), + map.get($theme, --base), + ), + ), + ), $props-name); + } -@include iro.props-store(( - --colors: ( - --border: ( - --stable: iro.props-get-static(--colors --gray --5, 'palette-media-dark'), - --stable-lo: iro.props-get-static(--colors --gray --6, 'palette-media-dark'), + @include iro.props-store(( + --colors: ( + --accent: iro.props-get-static(--colors map.get($theme, --accent), $props-name), ), + ), $props-name); - --blue: iro.props-get-static(--colors --blue, 'colors-dark'), - --purple: iro.props-get-static(--colors --purple, 'colors-dark'), - --red: iro.props-get-static(--colors --red, 'colors-dark'), - --green: iro.props-get-static(--colors --green, 'colors-dark'), - --yellow: iro.props-get-static(--colors --yellow, 'colors-dark'), + @each $color in 'bg-l2' 'bg-l1' 'bg-base' 'border-mute' 'border' 'border-strong' 'text-disabled' 'text-mute-more' 'text-mute' 'text' 'heading' { + @include iro.props-store(( + --colors: ( + --#{$color}: fn.color(--base map.get($theme, --#{$color})), + ), + ), $props-name); + } +} - --accent: ( - --primary: iro.props-ref('colors-media', --colors --blue), - --error: iro.props-ref('colors-media', --colors --red), - --success: iro.props-ref('colors-media', --colors --green), - --warning: iro.props-ref('colors-media', --colors --yellow), - --link-idle: iro.props-ref('colors-media', --colors --blue), - --link-visited: iro.props-ref('colors-media', --colors --purple), +@each $color in 'blue' 'purple' 'red' 'green' 'yellow' { + @include iro.props-store(( + --colors: ( + --#{$color}-static: iro.props-get-static(--colors --#{$color}), ), - ) -), 'colors-media'); - -// - -@each $breakpoint in map-keys(media.$breakpoints) { - @include media.media('<=#{$breakpoint}') { - @include iro.props-store(( - --colors: () - ), $breakpoint); - } + )); } diff --git a/src/_functions.scss b/src/_functions.scss index 148a28c..aaa8ac9 100644 --- a/src/_functions.scss +++ b/src/_functions.scss @@ -1,46 +1,47 @@ @use 'sass:color'; @use 'sass:math'; @use 'sass:map'; +@use 'sass:list'; @use 'iro-sass/src/index' as iro; @use 'config'; @use '@oddbird/blend'; @use '@oddbird/blend/sass/convert' as blend-convert; -@function color($key, $tree: 'colors', $default: null, $global: false) { - @return iro.props-get(join(--colors, $key), $tree, $default, $global); +@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: 'colors', $default: null, $global: true) { +@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: 'colors', $default: null, $global: true) { - @return iro.props-get(join($foreign-key --colors, $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: 'dims', $default: null, $global: false) { - @return iro.props-get(join(--dims, $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: 'dims', $default: null, $global: true) { +@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: 'dims', $default: null, $global: true) { - @return iro.props-get(join($foreign-key --dims, $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)) { + @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(join(--dims --font, $key), 'dims', $global: true); + $font: iro.props-get-static(list.join(--dims --font, $key), $global: true); $map: ( font-family: font-prop($font, $overrides, $key, --family), @@ -57,47 +58,48 @@ @return $map; } -@function multi-contrast($base-color, $colors, $wanted-contrasts) { - $dir: if(lightness($base-color) >= 50%, -1, 1); - $base-lum: nth(blend-convert.lin_sRGB_to_XYZ(blend-convert.lin_sRGB(blend-convert.sassToRgb($base-color))), 2) + .05; +@function lum($color) { + @return list.nth(blend-convert.lin_sRGB_to_XYZ(blend-convert.lin_sRGB(blend-convert.sassToRgb($color))), 2) + .05; +} + +@function multi-contrast($base-color, $colors, $wanted-contrasts, $reference-color: $base-color) { + $ref-lum: lum($reference-color); $result: (); - $colors-len: length($colors); - $colors-idx: if($dir == -1, $colors-len, 1); - $wanted-len: length($wanted-contrasts); + $colors-len: list.length($colors); + $colors-idx: 1; + $wanted-len: list.length($wanted-contrasts); $wanted-idx: 1; - @while $colors-idx >= 1 and $colors-idx <= $colors-len and $wanted-idx <= $wanted-len { - $color: nth($colors, $colors-idx); - $lum: nth(blend-convert.lin_sRGB_to_XYZ(blend-convert.lin_sRGB(blend-convert.sassToRgb($color))), 2) + .05; - $contrast: math.div(math.max($base-lum, $lum), math.min($lum, $base-lum)); + @while $colors-idx <= $colors-len and $wanted-idx <= $wanted-len { + $color: list.nth($colors, $colors-idx); + $lum: lum($color); + $contrast: math.div(math.max($ref-lum, $lum), math.min($lum, $ref-lum)); @if $contrast != 1 { - $contrast: $dir * $contrast; - - @if $lum <= $base-lum { + @if $lum <= $ref-lum { $contrast: -1 * $contrast; } } - $wanted: nth($wanted-contrasts, $wanted-idx); - $wanted-key: nth($wanted, 1); - $wanted-contrast: nth($wanted, 2); + $wanted: list.nth($wanted-contrasts, $wanted-idx); + $wanted-key: list.nth($wanted, 1); + $wanted-contrast: list.nth($wanted, 2); @if $contrast >= $wanted-contrast { $result: map.set($result, $wanted-key, $color); $wanted-idx: $wanted-idx + 1; } @else { - $colors-idx: $colors-idx + $dir * 1; + $colors-idx: $colors-idx + 1; } } - $last-color: nth($colors, if($dir == -1, 1, $colors-len)); + $last-color: list.nth($colors, $colors-len); @if $wanted-idx <= $wanted-len { @for $i from $wanted-idx through $wanted-len { - $wanted: nth($wanted-contrasts, $i); - $wanted-key: nth($wanted, 1); + $wanted: list.nth($wanted-contrasts, $i); + $wanted-key: list.nth($wanted, 1); $result: map.set($result, $wanted-key, $last-color); } } @@ -105,53 +107,21 @@ @return $result; } -@function gray-to-alpha($lightness, $color) { - @if $lightness >= 50% { - @return rgba(#000, color.blackness($color)); - } @else { - @return rgba(#fff, color.whiteness($color)); - } -} +@function palette($base-color, $contrasts, $reference-color: $base-color) { + $palette: (); -@function color-palette($base, $dir: 1) { - @return ( - --solid: ( - --bg-hi: blend.scale($base, $lightness: $dir * 15%, $chroma: $dir * 7.5%), - --bg: $base, - --obj: blend.scale($base, $lightness: $dir * -15%, $chroma: $dir * -7.5%), - --obj-lo: blend.scale($base, $lightness: $dir * -30%, $chroma: $dir * -15%), - --fg: blend.contrast($base), - ), - --quiet: ( - --bg: rgba($base, .1), - --obj: rgba($base, .2), - --obj-lo: rgba($base, .4), - --fg-hi: rgba($base, .7), - --fg: blend.scale($base, $lightness: $dir * -30%, $chroma: $dir * -15%), - --fg-lo: blend.scale($base, $lightness: $dir * -45%, $chroma: $dir * -22.5%), - ), - --selection: rgba($base, .99), - ); -} - -@function gray-palette($lightness, $alpha: false) { - $grays: (); - - @for $i from 0 through 100 { - $grays: append($grays, blend.lch($i * 1% 0 0)); + @if list.nth(list.nth($contrasts, 1), 2) > list.nth(list.nth($contrasts, list.length($contrasts)), 2) { + $contrasts: iro.fn-list-reverse($contrasts); } - $colors: multi-contrast(blend.lch($lightness * 1% 0 0), $grays, config.$wanted-grays); + $i: -100%; - @each $key, $color in $colors { - @if $alpha { - $colors: map.set($colors, $key, gray-to-alpha($lightness, $color)); - } @else { - $colors: map.set($colors, $key, $color); - } + @while $i <= 100% { + $palette: list.append($palette, blend.scale($base-color, $l: $i)); + $i: $i + config.$palette-precision; } - @return $colors; + @return multi-contrast($base-color, $palette, $contrasts, $reference-color); } @function px-to-em($size, $base: iro.$vars-root-size) { diff --git a/src/_mixins.scss b/src/_mixins.scss index 4eeb1ad..dc62870 100644 --- a/src/_mixins.scss +++ b/src/_mixins.scss @@ -1,3 +1,4 @@ +@use 'sass:list'; @use 'functions' as fn; @mixin set-font($basis, $values: ()) { @@ -12,13 +13,13 @@ @mixin heading-strong($size) { color: fn.foreign-color(--heading, --strong); - font-size: fn.global-dim(join(--heading, $size)); + font-size: fn.global-dim(list.join(--heading, $size)); } @mixin heading-medium($size) { @include set-font(--standard, ( --line-height: null, - --size: fn.global-dim(join(--heading, $size)), + --size: fn.global-dim(list.join(--heading, $size)), --weight: bold, --transform: uppercase, --spacing: 1px @@ -31,7 +32,7 @@ @mixin heading-faint($size) { @include set-font(--standard, ( --line-height: null, - --size: fn.global-dim(join(--heading, $size)), + --size: fn.global-dim(list.join(--heading, $size)), --weight: 500, --transform: uppercase, --spacing: 1px diff --git a/src/_objects.scss b/src/_objects.scss index 578de0c..aaace92 100644 --- a/src/_objects.scss +++ b/src/_objects.scss @@ -1,25 +1,26 @@ -@use 'objects/icon'; -@use 'objects/emoji'; +// @use 'objects/icon'; +// @use 'objects/emoji'; @use 'objects/heading'; @use 'objects/divider'; -@use 'objects/badge'; -@use 'objects/button'; -@use 'objects/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/action-menu'; -@use 'objects/menu'; -@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/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/action-menu'; +// @use 'objects/menu'; +// @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/_scopes.scss b/src/_scopes.scss index a3aeb6c..eb28177 100644 --- a/src/_scopes.scss +++ b/src/_scopes.scss @@ -1,6 +1,6 @@ @use 'scopes/links'; -@use 'scopes/code'; -@use 'scopes/blockquotes'; -@use 'scopes/lists'; +// @use 'scopes/code'; +// @use 'scopes/blockquotes'; +// @use 'scopes/lists'; @use 'scopes/headings'; -@use 'scopes/tables'; +// @use 'scopes/tables'; diff --git a/src/_themes.scss b/src/_themes.scss new file mode 100644 index 0000000..72562c0 --- /dev/null +++ b/src/_themes.scss @@ -0,0 +1,14 @@ +@use 'iro-sass/src/index' as iro; +@use 'functions' as fn; + +@include iro.bem-theme('base') { + background-color: fn.global-color(--bg-base); +} + +@include iro.bem-theme('l1') { + background-color: fn.global-color(--bg-l1); +} + +@include iro.bem-theme('l2') { + background-color: fn.global-color(--bg-l2); +} diff --git a/src/_utils.scss b/src/_utils.scss index d11a42c..e551136 100644 --- a/src/_utils.scss +++ b/src/_utils.scss @@ -1,13 +1,16 @@ +@use 'sass:map'; @use 'iro-sass/src/index' as iro; @use 'functions' as fn; @use 'include-media/dist/include-media' as media; $dirs: ( '': '', - 't': '-top', - 'r': '-right', - 'b': '-bottom', - 'l': '-left', + 'bs': '-block-start', + 'be': '-block-end', + 'b': '-block', + 'is': '-inline-start', + 'ie': '-inline-end', + 'i': '-inline', ); @include iro.bem-utility('d-block') { @@ -29,7 +32,7 @@ $dirs: ( @include iro.bem-utility('d-none') { display: none; - @each $breakpoint in map-keys(media.$breakpoints) { + @each $breakpoint in map.keys(media.$breakpoints) { @include media.media('<=#{$breakpoint}') { @include iro.bem-suffix('#{$breakpoint}-lo') { display: none; @@ -62,12 +65,12 @@ $dirs: ( } } -@include iro.bem-utility('ta-left') { - text-align: left; +@include iro.bem-utility('ta-start') { + text-align: start; } -@include iro.bem-utility('ta-right') { - text-align: right; +@include iro.bem-utility('ta-end') { + text-align: end; } @include iro.bem-utility('ta-center') { @@ -102,28 +105,23 @@ $dirs: ( justify-content: flex-end; } -@include iro.bem-utility('c-strong') { - color: fn.color(--fg-lo); +@include iro.bem-utility('c-heading') { + color: fn.color(--heading); } -@include iro.bem-utility('c-fg') { - color: fn.color(--fg); +@include iro.bem-utility('c-text') { + color: fn.color(--text); } -@include iro.bem-utility('c-muted') { - color: fn.color(--fg-hi); -} - -@include iro.bem-utility('c-muted-hi') { - color: fn.color(--fg-hi2); +@include iro.bem-utility('c-mute') { + color: fn.color(--text-mute); } @include iro.bem-utility('mt-neutralize') { &::before { content: ''; display: block; - margin-top: -100em; - margin-bottom: 100em; + margin-block: -100em 100em; } } @@ -170,11 +168,6 @@ $dirs: ( top: 0; } -@include iro.bem-utility('themed') { - background-color: fn.global-color(--bg); - color: fn.global-color(--fg); -} - @each $dir, $suffix in $dirs { @include iro.bem-utility('m#{$dir}-auto') { margin#{$suffix}: auto; @@ -199,6 +192,6 @@ $dirs: ( } @include iro.bem-utility('b#{$dir}-1') { - border#{$suffix}: 1px solid fn.global-color(--border --stable); + border#{$suffix}: 1px solid fn.global-color(--border); } } diff --git a/src/index.scss b/src/index.scss index 9e6c838..50927e2 100644 --- a/src/index.scss +++ b/src/index.scss @@ -4,6 +4,7 @@ @use 'layouts'; @use 'objects'; @use 'scopes'; +@use 'themes'; @use 'utils'; @use 'apply-vars'; diff --git a/src/layouts/_button-group.scss b/src/layouts/_button-group.scss index 5f2cbe7..a70d27a 100644 --- a/src/layouts/_button-group.scss +++ b/src/layouts/_button-group.scss @@ -6,7 +6,7 @@ --dims: ( --spacing: fn.global-dim(--size --150), ), - ), 'dims'); + )); @include iro.bem-layout(iro.props-namespace()) { display: flex; diff --git a/src/layouts/_container.scss b/src/layouts/_container.scss index b567119..b28eea2 100644 --- a/src/layouts/_container.scss +++ b/src/layouts/_container.scss @@ -10,7 +10,7 @@ --pad-x: fn.global-dim(--size --400), --pad-y: fn.global-dim(--size --800), ) - ), 'dims'); + )); @include iro.props-store(( --dims: ( diff --git a/src/layouts/_form.scss b/src/layouts/_form.scss index 901f613..9c741ec 100644 --- a/src/layouts/_form.scss +++ b/src/layouts/_form.scss @@ -1,7 +1,7 @@ @use 'iro-sass/src/index' as iro; @use '../functions' as fn; -@use '../objects/field-label'; +// @use '../objects/field-label'; @include iro.props-namespace('form') { @include iro.props-store(( @@ -10,7 +10,7 @@ --label-spacing-x: fn.global-dim(--size --325), --hint-font-size: fn.global-dim(--font-size --75), ), - ), 'dims'); + )); @include iro.bem-layout(iro.props-namespace()) { display: flex; diff --git a/src/layouts/_media.scss b/src/layouts/_media.scss index d276d33..fa90975 100644 --- a/src/layouts/_media.scss +++ b/src/layouts/_media.scss @@ -22,7 +22,7 @@ --pad-y: fn.global-dim(--size --225), ) ) - ), 'dims'); + )); @include iro.bem-layout(iro.props-namespace()) { display: flex; diff --git a/src/layouts/_message-group.scss b/src/layouts/_message-group.scss index 125c215..f977b61 100644 --- a/src/layouts/_message-group.scss +++ b/src/layouts/_message-group.scss @@ -1,7 +1,7 @@ @use 'iro-sass/src/index' as iro; @use '../functions' as fn; -@use '../objects/message'; +// @use '../objects/message'; @include iro.props-namespace('message-group') { @include iro.props-store(( @@ -15,7 +15,7 @@ --spacing-y: fn.global-dim(--size --50), ) ) - ), 'dims'); + )); @include iro.bem-layout(iro.props-namespace()) { display: grid; @@ -43,7 +43,7 @@ position: absolute; top: 0; left: calc(-1 * fn.dim(--arrow-size)); - border: fn.dim(--arrow-size) solid fn.global-color(--bg); + border: fn.dim(--arrow-size) solid fn.global-color(--bg-l2); border-bottom-color: transparent; border-left-color: transparent; } @@ -59,7 +59,7 @@ right: calc(-1 * fn.dim(--arrow-size)); left: auto; border-right-color: transparent; - border-left-color: fn.global-color(--bg); + border-left-color: fn.global-color(--bg-l2); } } } diff --git a/src/layouts/_overflow.scss b/src/layouts/_overflow.scss index d3af570..8643bbf 100644 --- a/src/layouts/_overflow.scss +++ b/src/layouts/_overflow.scss @@ -4,6 +4,6 @@ @include iro.props-namespace('overflow') { @include iro.bem-layout(iro.props-namespace()) { overflow: auto; - scrollbar-color: fn.global-color(--obj-lo) transparent; + scrollbar-color: fn.global-color(--text-disabled) transparent; } } diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss deleted file mode 100644 index 48ac2a6..0000000 --- a/src/objects/_action-button.scss +++ /dev/null @@ -1,222 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('action-button') { - @include iro.props-store(( - --dims: ( - --line-height: 1.4, - --pad-x: fn.global-dim(--size --100), - --pad-y: fn.global-dim(--size --85), - --rounding: 3px, - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--bg-hi), - --label: fn.global-color(--fg), - --border: fn.global-color(--obj-lo), - - --hover: ( - --bg: fn.global-color(--bg-hi2), - --label: fn.global-color(--fg-lo), - --border: fn.global-color(--fg-hi2), - ), - --active: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-lo), - --border: fn.global-color(--fg-hi2), - ), - --selected: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg), - --border: fn.global-color(--fg-hi3), - - --hover: ( - --label: fn.global-color(--fg-lo), - --border: fn.global-color(--fg-hi2), - ), - ), - --disabled: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-hi3), - --border: fn.global-color(--obj-hi), - ), - --key-focus: ( - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - --quiet: ( - --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), - ), - ), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - overflow: hidden; - border: 1px 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; - vertical-align: top; - white-space: nowrap; - - &:link, - &:visited, - &:enabled { - border-color: fn.color(--border); - background-color: fn.color(--bg); - color: fn.color(--label); - - &:hover { - border-color: fn.color(--hover --border); - background-color: fn.color(--hover --bg); - color: fn.color(--hover --label); - } - - &:active { - border-color: fn.color(--active --border); - background-color: fn.color(--active --bg); - color: fn.color(--active --label); - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: fn.color(--hover --bg); - color: fn.color(--hover --label); - } - } - } - - @include iro.bem-is('selected') { - &:link, - &:visited, - &:enabled { - border-color: fn.color(--selected --border); - background-color: fn.color(--selected --bg); - color: fn.color(--selected --label); - - &:hover, - &:active { - border-color: fn.color(--selected --hover --border); - background-color: fn.color(--selected --bg); - color: fn.color(--selected --hover --label); - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: fn.color(--selected --bg); - color: fn.color(--selected --hover --label); - } - } - } - } - - @include iro.bem-modifier('quiet') { - border-color: transparent; - background-color: transparent; - box-shadow: none; - color: fn.color(--quiet --disabled --label); - - &:link, - &:visited, - &:enabled { - border-color: transparent; - background-color: transparent; - box-shadow: none; - color: fn.color(--quiet --label); - - &:hover { - border-color: transparent; - background-color: fn.color(--quiet --hover --bg); - box-shadow: none; - color: fn.color(--quiet --hover --label); - } - - &:active { - border-color: transparent; - background-color: fn.color(--quiet --active --bg); - box-shadow: none; - color: fn.color(--quiet --active --label); - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: fn.color(--quiet --hover --bg); - color: fn.color(--quiet --hover --label); - } - } - } - - @include iro.bem-is('selected') { - background-color: fn.color(--quiet --selected --bg); - color: fn.color(--quiet --disabled --label); - - &:link, - &:visited, - &:enabled { - border-color: transparent; - background-color: fn.color(--quiet --selected --bg); - box-shadow: none; - color: fn.color(--quiet --selected --label); - - &:hover, - &:active { - border-color: transparent; - background-color: fn.color(--quiet --selected --hover --bg); - box-shadow: none; - color: fn.color(--quiet --selected --hover --label); - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: fn.color(--quiet --selected --bg); - color: fn.color(--quiet --selected --hover --label); - } - } - } - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - border-color: fn.color(--key-focus --border); - box-shadow: inset 0 0 0 1px fn.color(--key-focus --border), fn.color(--key-focus --shadow); - } - } - - @include iro.bem-modifier('round') { - width: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-y)); - padding-right: 0; - padding-left: 0; - border-radius: 100em; - } - } -} diff --git a/src/objects/_action-menu.scss b/src/objects/_action-menu.scss deleted file mode 100644 index 12e3b5f..0000000 --- a/src/objects/_action-menu.scss +++ /dev/null @@ -1,122 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('action-menu') { - @include iro.props-store(( - --dims: ( - --pad-x: 0, - --pad-y: fn.global-dim(--size --85), - --separator: fn.global-dim(--size --85), - --rounding: 3px, - --border: 1px, - --item: ( - --pad-x: fn.global-dim(--size --150), - --pad-y: fn.global-dim(--size --85), - ), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --shadow: 0 .2em .5em rgba(#000, .1), - --border: fn.global-color(--border --stable-lo), - --separator: fn.global-color(--obj), - --icon: fn.global-color(--fg-hi), - --item: ( - --hover: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-lo), - ), - --disabled: ( - --label: fn.global-color(--fg-hi3), - ), - --key-focus: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-lo), - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - ), - ), - ), 'colors'); - - @include iro.props-store(( - --colors: ( - --shadow: 0 .2em .5em rgba(#000, .5), - ), - ), 'colors-dark'); - - @include iro.bem-object(iro.props-namespace()) { - position: absolute; - z-index: 10000; - top: 0; - left: 0; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - transform: translate(var(--x), var(--y)); - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - background-clip: padding-box; - background-color: fn.global-color(--bg); - box-shadow: fn.color(--shadow); - color: fn.global-color(--fg); - - @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)); - } - - @include iro.bem-elem('item') { - display: block; - box-sizing: border-box; - width: 100%; - padding: calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px); - border: 2px solid transparent; - color: fn.color(--item --disabled --label); - - &:link, - &:visited, - &:enabled { - color: currentColor; - - &:hover, - &:active { - background-color: fn.color(--item --hover --bg); - color: fn.color(--item --hover --label); - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - border-radius: calc(fn.dim(--rounding) - 1px); - border-color: fn.color(--item --key-focus --border); - background-color: fn.color(--item --key-focus --bg); - box-shadow: fn.color(--item --key-focus --shadow); - color: fn.color(--item --key-focus --label); - } - } - } - } - - @include iro.bem-elem('separator') { - height: 1px; - margin: fn.dim(--separator) 0; - background-color: fn.color(--separator); - } - - @include iro.bem-elem('slot') { - padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x); - } - - @include iro.bem-elem('icon-slot') { - display: flex; - justify-content: center; - width: fn.foreign-dim(--icon, --size); - } - } -} diff --git a/src/objects/_alert.scss b/src/objects/_alert.scss deleted file mode 100644 index 289ef10..0000000 --- a/src/objects/_alert.scss +++ /dev/null @@ -1,55 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('alert') { - @include iro.props-store(( - --dims: ( - --border: 1px, - --pad-x: fn.global-dim(--size --250), - --pad-y: fn.global-dim(--size --200), - --rounding: 4px, - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--bg-hi2), - --border: fn.global-color(--fg-hi2), - --border-primary: fn.global-color(--accent --primary --solid --bg-hi), - --border-error: fn.global-color(--accent --error --solid --bg-hi), - --border-success: fn.global-color(--accent --success --solid --bg-hi), - --border-warning: fn.global-color(--accent --warning --solid --bg-hi), - ), - ), 'colors'); - - @include iro.props-store(( - --dims: ( - --pad-x: fn.global-dim(--size --200), - --pad-y: fn.global-dim(--size --150), - ), - ), 'sm'); - - @include iro.bem-object(iro.props-namespace()) { - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - color: fn.global-color(--fg); - - @include iro.bem-modifier('primary') { - border-color: fn.color(--border-primary); - } - - @include iro.bem-modifier('error') { - border-color: fn.color(--border-error); - } - - @include iro.bem-modifier('success') { - border-color: fn.color(--border-success); - } - - @include iro.bem-modifier('warning') { - border-color: fn.color(--border-warning); - } - } -} diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss deleted file mode 100644 index 4be780e..0000000 --- a/src/objects/_avatar.scss +++ /dev/null @@ -1,146 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@mixin status($size) { - @include iro.bem-elem('status') { - width: fn.dim(--#{$size} --indicator-size); - height: fn.dim(--#{$size} --indicator-size); - - @include iro.bem-next-elem('content') { - mask-image: radial-gradient( - circle calc(.5 * fn.dim(--#{$size} --indicator-size) + fn.dim(--indicator-spacing)) at - calc(100% - .5 * fn.dim(--#{$size} --indicator-size)) - calc(100% - .5 * fn.dim(--#{$size} --indicator-size)), - transparent 95%, - #fff - ); - } - } -} - -@include iro.props-namespace('avatar') { - @include iro.props-store(( - --dims: ( - --400: ( - --size: fn.global-dim(--size --1600), - --font-size: fn.global-dim(--font-size --800), - --indicator-size: fn.global-dim(--size --400), - ), - --300: ( - --size: fn.global-dim(--size --1200), - --font-size: fn.global-dim(--font-size --600), - --indicator-size: fn.global-dim(--size --300), - ), - --200: ( - --size: fn.global-dim(--size --800), - --font-size: fn.global-dim(--font-size --300), - --indicator-size: fn.global-dim(--size --225), - ), - --150: ( - --size: fn.global-dim(--size --650), - --font-size: fn.global-dim(--font-size --200), - --indicator-size: fn.global-dim(--size --175), - ), - --100: ( - --size: fn.global-dim(--size --500), - --font-size: fn.global-dim(--font-size --100), - --indicator-size: fn.global-dim(--size --150), - ), - --75: ( - --size: fn.global-dim(--size --375), - --font-size: fn.global-dim(--font-size --75), - --indicator-size: fn.global-dim(--size --125), - ), - --50: ( - --size: fn.global-dim(--size --250), - --font-size: fn.global-dim(--font-size --50), - --indicator-size: fn.global-dim(--size --100), - ), - --indicator-spacing: fn.global-dim(--size --40), - --rounding: 25%, - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --h: 354, - --s: 44%, - --l: 45%, - - --key-focus: ( - --border: fn.global-color(--focus --fill), - --shadow: 0 0 0 calc(2px + fn.global-dim(--focus --outline-width)) fn.global-color(--accent --primary --quiet --obj-lo), - ), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - border-radius: fn.dim(--rounding); - font-size: fn.dim(--100 --font-size); - font-style: normal; - vertical-align: .05em; - - @include iro.bem-elem('status') { - position: absolute; - right: 0; - bottom: 0; - } - - @include status(100); - - @include iro.bem-elem('content') { - display: block; - width: fn.dim(--100 --size); - height: fn.dim(--100 --size); - border-radius: fn.dim(--rounding); - line-height: fn.dim(--100 --size); - text-align: center; - object-fit: cover; - object-position: center center; - } - - @include iro.bem-modifier('circle') { - 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 50 75 150 200 300 400 { - @include iro.bem-modifier($size) { - font-size: fn.dim(--#{$size} --font-size); - - @include status($size); - - @include iro.bem-elem('content') { - width: fn.dim(--#{$size} --size); - height: fn.dim(--#{$size} --size); - line-height: fn.dim(--#{$size} --size); - } - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - outline: 2px solid fn.color(--key-focus --border); - box-shadow: fn.color(--key-focus --shadow); - } - } - } -} diff --git a/src/objects/_backdrop.scss b/src/objects/_backdrop.scss deleted file mode 100644 index ac23d63..0000000 --- a/src/objects/_backdrop.scss +++ /dev/null @@ -1,33 +0,0 @@ -@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, - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: rgba(#000, .75), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: flex; - position: fixed; - z-index: fn.dim(--z-index); - top: 0; - right: 0; - bottom: 0; - left: 0; - box-sizing: border-box; - flex-direction: column; - overflow: auto; - background-color: fn.color(--bg); - color: fn.global-color(--fg); - backdrop-filter: blur(fn.dim(--blur)); - } -} diff --git a/src/objects/_badge.scss b/src/objects/_badge.scss deleted file mode 100644 index 0f73382..0000000 --- a/src/objects/_badge.scss +++ /dev/null @@ -1,173 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('badge') { - @include iro.props-store(( - --dims: ( - --pad-x: fn.px-to-em(4px), - --pad-y: 0, - --rounding: 3px, - --fixed-100: 1em, - --fixed-200: 1.5em, - - --200: ( - --pad-x: fn.px-to-em(6px), - --pad-y: fn.px-to-em(2px), - ), - --300: ( - --pad-x: fn.px-to-em(10px), - --pad-y: fn.px-to-em(6px), - ), - - --pill: ( - --pad-x: fn.px-to-em(9px), - - --200: ( - --pad-x: fn.px-to-em(10px), - ), - --300: ( - --pad-x: fn.px-to-em(16px), - ), - ), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-lo), - --hover: ( - --bg: fn.global-color(--obj), - ), - --active: ( - --bg: fn.global-color(--obj-lo), - ), - --key-focus: ( - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - - --primary: ( - --bg: fn.global-color(--fg-lo), - --label: fn.global-color(--bg), - --hover: ( - --bg: fn.global-color(--fg), - ), - --active: ( - --bg: fn.global-color(--fg), - ), - ), - - --accent: ( - --bg: fn.global-color(--accent --primary --solid --bg), - --label: fn.global-color(--accent --primary --solid --fg), - --hover: ( - --bg: fn.global-color(--accent --primary --solid --obj), - ), - --active: ( - --bg: fn.global-color(--accent --primary --solid --obj-lo), - ), - ), - - --accent-quiet: ( - --bg: fn.global-color(--accent --primary --quiet --bg), - --label: fn.global-color(--accent --primary --quiet --fg), - --hover: ( - --bg: fn.global-color(--accent --primary --quiet --obj), - ), - --active: ( - --bg: fn.global-color(--accent --primary --quiet --obj-lo), - ), - ) - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - margin-top: -.5em; - margin-bottom: -.5em; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - color: fn.color(--label); - line-height: fn.global-dim(--font --standard --line-height); - text-align: center; - text-decoration: none; - - &:link, - &:visited, - &:enabled { - &:hover { - background-color: fn.color(--hover --bg); - } - - &:active { - background-color: fn.color(--active --bg); - } - } - - @each $variant in 'primary' 'accent' 'accent-quiet' { - @include iro.bem-modifier($variant) { - background-color: fn.color(--#{$variant} --bg); - color: fn.color(--#{$variant} --label); - - &:link, - &:visited, - &:enabled { - &:hover { - background-color: fn.color(--#{$variant} --hover --bg); - } - - &:active { - background-color: fn.color(--#{$variant} --active --bg); - } - } - } - } - - &:link, - &:visited, - &:enabled { - @include iro.bem-at-theme('keyboard') { - &:focus { - background-color: transparent; - box-shadow: inset 0 0 0 2px fn.color(--key-focus --border), fn.color(--key-focus --shadow); - color: currentColor; - } - } - } - - @include iro.bem-modifier('pill') { - padding-right: fn.dim(--pill --pad-x); - padding-left: fn.dim(--pill --pad-x); - border-radius: 10em; - } - - @each $size in '200' '300' { - @include iro.bem-modifier($size) { - padding: fn.dim(--#{$size} --pad-y) fn.dim(--#{$size} --pad-x); - - @include iro.bem-modifier('pill') { - padding-right: fn.dim(--pill --#{$size} --pad-x); - padding-left: fn.dim(--pill --#{$size} --pad-x); - } - } - } - - @include iro.bem-modifier('fixed-100') { - width: fn.dim(--fixed-100); - } - - @include iro.bem-modifier('fixed-200') { - width: fn.dim(--fixed-200); - } - - @include iro.bem-modifier('sm') { - font-size: fn.global-dim(--font-size --75); - } - - @include iro.bem-modifier('xs') { - font-size: fn.global-dim(--font-size --50); - } - } -} diff --git a/src/objects/_button.scss b/src/objects/_button.scss deleted file mode 100644 index 7cc24fa..0000000 --- a/src/objects/_button.scss +++ /dev/null @@ -1,179 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@mixin button-variant($variant) { - &:link, - &:visited, - &:enabled { - border-color: fn.color(--#{$variant} --bg); - background-color: fn.color(--#{$variant} --bg); - box-shadow: fn.color(--#{$variant} --shadow); - color: fn.color(--#{$variant} --label); - } - - @include iro.bem-modifier('outline') { - &:link, - &:visited, - &:enabled { - background-color: transparent; - box-shadow: none; - color: fn.color(--#{$variant} --outline-label); - } - } - - &:link, - &:visited, - &:enabled { - &:hover { - border-color: fn.color(--#{$variant} --hover --bg); - background-color: fn.color(--#{$variant} --hover --bg); - box-shadow: fn.color(--#{$variant} --hover --shadow); - color: fn.color(--#{$variant} --hover --label); - } - - &:active { - border-color: fn.color(--#{$variant} --active --bg); - background-color: fn.color(--#{$variant} --active --bg); - box-shadow: fn.color(--#{$variant} --active --shadow); - color: fn.color(--#{$variant} --active --label); - } - } -} - -@include iro.props-namespace('button') { - @include iro.props-store(( - --dims: ( - --line-height: 1.4, - --pad-x: fn.global-dim(--size --225), - --pad-y: fn.global-dim(--size --65), - --rounding: 10em, - - --lg: ( - --pad-x: fn.global-dim(--size --300), - --pad-y: fn.global-dim(--size --100), - ), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --any: ( - --disabled: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg-hi3), - --shadow: 0 0 0 0 transparent, - ), - --key-focus: ( - --bg: transparent, - --label: fn.global-color(--focus --text), - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - ), - --accent: ( - --bg: fn.global-color(--accent --primary --solid --bg), - --label: fn.global-color(--accent --primary --solid --fg), - --outline-label: fn.global-color(--accent --primary --solid --obj), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --bg: fn.global-color(--accent --primary --solid --obj), - --label: fn.global-color(--accent --primary --solid --fg), - --shadow: 0 0 0 0 transparent, - ), - --active: ( - --bg: fn.global-color(--accent --primary --solid --obj-lo), - --label: fn.global-color(--accent --primary --solid --fg), - --shadow: 0 0 0 0 transparent, - ), - ), - --primary: ( - --bg: fn.global-color(--fg), - --label: fn.global-color(--bg-hi2), - --outline-label: fn.global-color(--fg), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --bg: fn.global-color(--fg-lo), - --label: fn.global-color(--bg-hi2), - --shadow: 0 0 0 0 transparent, - ), - --active: ( - --bg: fn.global-color(--fg-lo), - --label: fn.global-color(--bg-hi2), - --shadow: 0 0 0 0 transparent, - ), - ), - --secondary: ( - --bg: fn.global-color(--obj-hi), - --label: fn.global-color(--fg), - --outline-label: fn.global-color(--fg), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --bg: fn.global-color(--obj), - --label: fn.global-color(--fg-lo), - --shadow: 0 0 0 0 transparent, - ), - --active: ( - --bg: fn.global-color(--obj-lo), - --label: fn.global-color(--fg-lo), - --shadow: 0 0 0 0 transparent, - ), - ), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border: 2px solid transparent; - border-radius: fn.dim(--rounding); - border-color: fn.color(--any --disabled --bg); - background-color: fn.color(--any --disabled --bg); - box-shadow: fn.color(--any --disabled --shadow); - color: fn.color(--any --disabled --label); - font-weight: 500; - line-height: fn.dim(--line-height); - text-align: center; - text-decoration: none; - vertical-align: top; - - @include iro.bem-modifier('block') { - display: block; - } - - @include iro.bem-modifier('outline') { - background-color: transparent; - box-shadow: none; - } - - @include iro.bem-modifier('lg') { - padding: fn.dim(--lg --pad-y) fn.dim(--lg --pad-x); - } - - @include button-variant('secondary'); - - @each $mod in 'accent' 'primary' { - @include iro.bem-modifier($mod) { - @include button-variant($mod); - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - border-color: fn.color(--any --key-focus --border); - background-color: fn.color(--any --key-focus --bg); - box-shadow: fn.color(--any --key-focus --shadow); - color: fn.color(--any --key-focus --label); - } - } - - @include iro.bem-modifier('round') { - width: calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-y)); - padding-right: 0; - padding-left: 0; - border-radius: 100em; - } - } -} diff --git a/src/objects/_checkbox.scss b/src/objects/_checkbox.scss deleted file mode 100644 index b3bb34d..0000000 --- a/src/objects/_checkbox.scss +++ /dev/null @@ -1,249 +0,0 @@ -@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-x: fn.global-dim(--size --65), - --pad-y: fn.global-dim(--size --65), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --box-border: fn.global-color(--fg-hi), - --box-bg: fn.global-color(--bg-hi), - - --hover: ( - --label: fn.global-color(--fg-lo), - --box-border: fn.global-color(--fg), - ), - --accent: ( - --box-border: fn.global-color(--accent --primary --solid --bg), - - --hover: ( - --box-border: fn.global-color(--accent --primary --solid --obj), - ), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --box-border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - --disabled: ( - --label: fn.global-color(--fg-hi3), - --box-border: fn.global-color(--obj-lo), - --box-bg: fn.global-color(--bg-hi), - ) - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-flex; - position: relative; - align-items: flex-start; - margin-right: calc(-1 * fn.dim(--pad-x)); - margin-left: calc(-1 * fn.dim(--pad-x)); - padding: fn.dim(--pad-y) fn.dim(--pad-x); - - @include iro.bem-elem('box') { - display: block; - position: relative; - flex: 0 0 auto; - width: fn.dim(--size); - height: fn.dim(--size); - margin-top: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--size))); - border-radius: fn.dim(--border); - background-color: fn.color(--box-border); - - &::before, - &::after { - content: ''; - display: block; - position: absolute; - } - - &::before { - z-index: 2; - top: fn.dim(--border); - left: fn.dim(--border); - width: calc(fn.dim(--size) - 2 * fn.dim(--border)); - height: calc(fn.dim(--size) - 2 * fn.dim(--border)); - transition: transform .2s ease; - background-color: fn.color(--box-bg); - } - - &::after { - z-index: 3; - top: calc(.5 * fn.dim(--size) - 1px); - left: calc(1.5 * fn.dim(--border)); - box-sizing: border-box; - width: calc(fn.dim(--size) - 3 * fn.dim(--border)); - height: 0; - transform: scale(0); - transition: transform .2s ease; - border-width: 0 2px 2px 0; - 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; - top: calc(1 * fn.dim(--border)); - left: calc(1 * fn.dim(--border)); - width: calc(100% - 2 * fn.dim(--border)); - height: 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') { - align-self: baseline; - margin-left: fn.dim(--label-gap); - } - - @include iro.bem-elem('native') { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow: hidden; - opacity: .0001; - - &:hover { - @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); - } - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - @include iro.bem-sibling-elem('label') { - color: fn.color(--key-focus --label); - } - - @include iro.bem-sibling-elem('box') { - background-color: fn.color(--key-focus --box-border); - box-shadow: fn.color(--key-focus --shadow); - } - } - } - } - - @include iro.bem-modifier('standalone') { - @include iro.bem-elem('box') { - margin-top: 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 { - @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 { - @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/objects/_dialog.scss b/src/objects/_dialog.scss deleted file mode 100644 index 9333ce6..0000000 --- a/src/objects/_dialog.scss +++ /dev/null @@ -1,152 +0,0 @@ -@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/objects/_divider.scss b/src/objects/_divider.scss index 655080f..465bbcf 100644 --- a/src/objects/_divider.scss +++ b/src/objects/_divider.scss @@ -4,7 +4,7 @@ @include iro.props-namespace('divider') { @include iro.props-store(( --dims: ( - --margin-y: fn.global-dim(--size --85), + --margin-b: fn.global-dim(--size --85), --strong: ( --border: fn.global-dim(--border --thick), @@ -19,52 +19,48 @@ --label-font-size: fn.global-dim(--font-size --50), ), ), - ), 'dims'); - - @include iro.props-store(( --colors: ( --strong: ( - --bg: fn.global-color(--fg), - --label: fn.global-color(--fg), + --bg: fn.global-color(--text), + --label: fn.global-color(--text), ), --medium: ( - --bg: fn.global-color(--obj), - --label: fn.global-color(--fg-hi), + --bg: fn.global-color(--border), + --label: fn.global-color(--text-mute), ), --faint: ( - --bg: fn.global-color(--obj), - --label: fn.global-color(--fg-hi2), + --bg: fn.global-color(--border), + --label: fn.global-color(--text-mute-more), ), --blue: ( - --bg: fn.global-color(--blue --solid --bg), - --label: fn.global-color(--blue --solid --obj), + --bg: fn.global-color(--blue --700), + --label: fn.global-color(--blue --1000), ), --purple: ( - --bg: fn.global-color(--purple --solid --bg), - --label: fn.global-color(--purple --solid --obj), + --bg: fn.global-color(--purple --700), + --label: fn.global-color(--purple --1000), ), --red: ( - --bg: fn.global-color(--red --solid --bg), - --label: fn.global-color(--red --solid --obj), + --bg: fn.global-color(--red --700), + --label: fn.global-color(--red --1000), ), --green: ( - --bg: fn.global-color(--green --solid --bg), - --label: fn.global-color(--green --solid --obj), + --bg: fn.global-color(--green --700), + --label: fn.global-color(--green --1000), ), --yellow: ( - --bg: fn.global-color(--yellow --solid --bg), - --label: fn.global-color(--yellow --solid --obj), + --bg: fn.global-color(--yellow --700), + --label: fn.global-color(--yellow --1000), ), ), - ), 'colors'); + )); @include iro.bem-object(iro.props-namespace()) { display: flex; flex-direction: row; align-items: center; height: 1em; - margin-top: fn.dim(--margin-y); - margin-bottom: fn.dim(--margin-y); + margin-block: fn.dim(--margin-b); color: fn.color(--strong --label); font-size: fn.dim(--strong --label-font-size); font-weight: 700; @@ -93,8 +89,7 @@ align-self: stretch; width: 1px; height: auto; - margin-top: 0; - margin-bottom: 0; + margin-block: 0; background-color: fn.color(--faint --bg); &::before, @@ -129,12 +124,12 @@ @include iro.bem-modifier('labelled') { &::before { - margin-right: 1em; + margin-inline-end: 1em; } &::after { - display: block; - margin-left: 1em; + display: block; + margin-inline-start: 1em; } } diff --git a/src/objects/_emoji.scss b/src/objects/_emoji.scss deleted file mode 100644 index 8d17212..0000000 --- a/src/objects/_emoji.scss +++ /dev/null @@ -1,74 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; -@use 'sass:math'; - -@include iro.props-namespace('emoji') { - @include iro.props-store(( - --dims: ( - --size: calc(1 / 14 * 18em), - --pad: .3em, - --rounding: 3px, - --zoom: 3, - --valign: -.25em, - - --125: ( - --size: calc(1 / 14 * 23em), - --valign: -.45em, - ), - - --150: ( - --size: calc(1 / 14 * 28em), - --valign: -.65em, - ), - - --200: ( - --size: calc(1 / 14 * 38em), - --valign: -1em, - ) - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--obj-hi), - ) - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - position: relative; - width: calc(fn.dim(--size)); - height: calc(fn.dim(--size)); - margin: calc(-1 * fn.dim(--pad)); - padding: calc(fn.dim(--pad)); - vertical-align: fn.dim(--valign); - object-fit: contain; - - @include iro.bem-modifier('icon') { - margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--size) - fn.foreign-dim(--icon, --size))); - vertical-align: fn.foreign-dim(--icon, --valign); - } - - @each $size in '125' '150' '200' { - @include iro.bem-modifier($size) { - width: fn.dim(--#{$size} --size); - height: fn.dim(--#{$size} --size); - vertical-align: fn.dim(--#{$size} --valign); - - @include iro.bem-modifier('icon') { - margin: calc(-1 * fn.dim(--pad) - .5 * (fn.dim(--#{$size} --size) - fn.foreign-dim(--icon, --size))); - } - } - } - - @include iro.bem-modifier('zoomable') { - transition: transform .2s ease, background-color .2s ease; - border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom)); - - &:hover { - transform: scale(fn.dim(--zoom)); - background-color: fn.color(--bg); - } - } - } -} diff --git a/src/objects/_field-label.scss b/src/objects/_field-label.scss deleted file mode 100644 index 2127a09..0000000 --- a/src/objects/_field-label.scss +++ /dev/null @@ -1,89 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('field-label') { - @include iro.props-store(( - --dims: ( - --spacing-x: fn.global-dim(--size --150), - --spacing-y: fn.global-dim(--size --85), - --label-font-size: fn.global-dim(--font-size --75), - --hint-font-size: fn.global-dim(--font-size --75), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --label: fn.global-color(--fg-hi), - --hint: fn.global-color(--fg-hi), - --error-hint: fn.global-color(--accent --error --quiet --fg), - --disabled: fn.global-color(--fg-hi3), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: block; - - @include iro.bem-elem('label') { - display: block; - flex: 0 0 auto; - padding-right: fn.dim(--spacing-x); - 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-top: fn.dim(--spacing-y); - } - } - - @include iro.bem-elem('content') { - display: block; - width: 100%; - } - - @include iro.bem-elem('hint') { - display: block; - margin-top: fn.dim(--spacing-y); - 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('left', 'right') { - display: flex; - align-items: baseline; - - @include iro.bem-elem('label') { - display: inline-block; - - @include iro.bem-next-elem('content') { - margin-top: 0; - } - } - } - - @include iro.bem-modifier('left') { - @include iro.bem-elem('label') { - text-align: left; - } - } - - @include iro.bem-modifier('right') { - @include iro.bem-elem('label') { - text-align: right; - } - } - } -} diff --git a/src/objects/_heading.scss b/src/objects/_heading.scss index 5d84e61..6dcf7e9 100644 --- a/src/objects/_heading.scss +++ b/src/objects/_heading.scss @@ -8,37 +8,34 @@ @include iro.props-store(( --dims: ( --offset: -.02em, - ) - ), 'dims'); - - @include iro.props-store(( + ), --colors: ( - --light: fn.global-color(--fg-hi), - --strong: fn.global-color(--fg-lo), - --bg: fn.global-color(--bg-hi2), + --light: fn.global-color(--text-mute), + --strong: fn.global-color(--heading), + --bg: fn.global-color(--bg-l2), ), - ), 'colors'); + )); @include iro.bem-object(iro.props-namespace()) { @include mx.set-font(--headline); - display: block; - margin-top: fn.global-dim(--heading --margin-top); - transform: translateX(fn.dim(--offset)); - letter-spacing: normal; - text-transform: none; + display: block; + margin-block-start: fn.global-dim(--heading --margin-bs); + transform: translateX(fn.dim(--offset)); + letter-spacing: normal; + text-transform: none; & + & { - margin-top: fn.global-dim(--heading --margin-top-sibling); + margin-block-start: fn.global-dim(--heading --margin-bs-sibling); } @include iro.bem-elem('highlight') { background-image: linear-gradient( to top, - transparent .05em, + transparent .05em, fn.color(--bg) .05em, fn.color(--bg) .5em, - transparent .5em + transparent .5em ); } diff --git a/src/objects/_icon-nav.scss b/src/objects/_icon-nav.scss deleted file mode 100644 index d1c6539..0000000 --- a/src/objects/_icon-nav.scss +++ /dev/null @@ -1,20 +0,0 @@ -@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/objects/_icon.scss b/src/objects/_icon.scss deleted file mode 100644 index 5c4bfab..0000000 --- a/src/objects/_icon.scss +++ /dev/null @@ -1,26 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('icon') { - @include iro.props-store(( - --dims: ( - --stroke: 1.5px, - --size: calc(1 / 14 * 16em), - --valign: -.2em, - ) - ), 'dims'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline; - width: fn.dim(--size); - height: fn.dim(--size); - stroke-width: fn.dim(--stroke); - stroke-linecap: round; - stroke-linejoin: round; - vertical-align: fn.dim(--valign); - - @include iro.bem-modifier('block') { - display: block; - } - } -} diff --git a/src/objects/_lightbox.scss b/src/objects/_lightbox.scss deleted file mode 100644 index 31d3398..0000000 --- a/src/objects/_lightbox.scss +++ /dev/null @@ -1,206 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@use 'action-button'; - -@include iro.props-namespace('lightbox') { - @include iro.props-store(( - --dims: ( - --pad: fn.global-dim(--size --150), - --thumbnail: ( - --size: fn.global-dim(--size --700), - --spacing: fn.global-dim(--size --100), - --idle: 1px, - --selected: 2px, - ), - --close-button: ( - --font-size: fn.global-dim(--font-size --200), - ), - --nav-button: ( - --width: fn.global-dim(--size --3800), - --height: fn.global-dim(--size --3800), - --font-size: fn.global-dim(--font-size --200), - ), - ), - ), 'dims'); - - @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.props-store(( - --colors: ( - --thumbnail: ( - --idle: fn.global-color(--fg-hi2), - --selected: fn.global-color(--fg-lo), - ), - ), - ), 'colors'); - - @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; - height: 100%; - overflow: hidden; - - @include iro.bem-elem('header') { - grid-area: header; - display: flex; - align-items: flex-start; - padding: fn.dim(--pad) fn.dim(--pad) 0; - } - - @include iro.bem-elem('img') { - display: none; - box-sizing: border-box; - grid-area: content; - width: 100%; - height: 100%; - padding: fn.dim(--pad); - object-fit: scale-down; - - @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(--thumbnail --selected) fn.dim(--pad) fn.dim(--pad); - overflow: auto; - } - - @include iro.bem-elem('footer') { - grid-area: footer; - display: flex; - align-items: flex-start; - padding: 0 fn.dim(--pad) fn.dim(--pad); - } - - @include iro.bem-elem('thumbnail') { - position: relative; - flex: 0 0 auto; - width: fn.dim(--thumbnail --size); - height: fn.dim(--thumbnail --size); - opacity: .75; - box-shadow: 0 0 0 fn.dim(--thumbnail --idle) fn.color(--thumbnail --idle) inset; - - &:hover { - opacity: 1; - } - - @include iro.bem-is('selected') { - opacity: 1; - box-shadow: 0 0 0 fn.dim(--thumbnail --selected) fn.color(--thumbnail --selected); - } - } - - @include iro.bem-elem('thumbnail-img') { - display: block; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - object-fit: cover; - object-position: center center; - } - - @include iro.bem-elem('thumbnail-icon') { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - } - - @include iro.bem-elem('close-btn') { - flex: 0 0 auto; - margin: calc(-.5 * fn.dim(--pad)) calc(-.5 * fn.dim(--pad)) 0 auto; - 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); - - &::after { - content: ''; - display: block; - position: absolute; - top: 50%; - left: 50%; - width: fn.dim(--nav-button --width); - height: fn.dim(--nav-button --height); - transform: translate(-50%, -50%); - } - - @include iro.bem-modifier('prev') { - grid-area: prev; - margin-right: calc(-1 * fn.dim(--pad)); - margin-left: calc(.5 * fn.dim(--pad)); - } - - @include iro.bem-modifier('next') { - grid-area: next; - margin-right: calc(.5 * fn.dim(--pad)); - margin-left: calc(-1 * fn.dim(--pad)); - } - } - } -} diff --git a/src/objects/_list-group.scss b/src/objects/_list-group.scss deleted file mode 100644 index d46722e..0000000 --- a/src/objects/_list-group.scss +++ /dev/null @@ -1,60 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('list-group') { - @include iro.props-store(( - --dims: ( - --pad-x: fn.global-dim(--size --175), - --pad-y: fn.global-dim(--size --125), - --rounding: 3px, - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--bg-hi2), - --border: fn.global-color(--obj), - --hover: fn.global-color(--bg), - --press: fn.global-color(--obj-hi), - ) - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - border: 1px solid fn.color(--border); - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - - @include iro.bem-elem('item') { - padding: fn.dim(--pad-y) fn.dim(--pad-x); - - @include iro.bem-next-twin-elem { - border-width: 1px 0 0; - border-style: solid; - border-color: fn.color(--border); - } - - @include iro.bem-multi('&:link, &:visited, &:enabled', 'modifier' 'interactive') { - &:hover { - background-color: fn.color(--hover); - } - - &:active { - background-color: fn.color(--press); - } - } - } - - @include iro.bem-modifier('horizontal') { - display: flex; - - @include iro.bem-elem('item') { - flex: 1 0 auto; - - @include iro.bem-next-twin-elem { - border-top-width: 0; - border-left-width: 1px; - } - } - } - } -} diff --git a/src/objects/_menu.scss b/src/objects/_menu.scss deleted file mode 100644 index 7db4896..0000000 --- a/src/objects/_menu.scss +++ /dev/null @@ -1,124 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@use './icon'; - -@include iro.props-namespace('menu') { - @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-x: fn.global-dim(--size --150), - --pad-y: fn.global-dim(--size --100), - --rounding: 3px, - ), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --header: ( - --label: fn.global-color(--fg-hi), - ), - --item: ( - --hover: ( - --bg: fn.global-color(--obj-hi), - --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), - ), - --badge: ( - --bg: fn.global-color(--bg), - --label: fn.global-color(--fg-lo), - ) - ), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: flex; - flex-direction: column; - gap: fn.dim(--spacing); - - @include iro.bem-elem('header') { - padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x); - 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-top: calc(fn.dim(--separator) + fn.dim(--spacing)); - } - } - - @include iro.bem-elem('item') { - padding: calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px); - border: 2px solid transparent; - border-radius: fn.dim(--item --rounding); - color: fn.color(--item --disabled --label); - - &:link, - &:visited, - &:enabled { - color: currentColor; - - @include iro.bem-multi('&:hover, &:active', 'is' 'selected') { - background-color: fn.color(--item --hover --bg); - color: fn.color(--item --hover --label); - - @include iro.bem-elem('badge') { - background-color: fn.color(--item --badge --bg); - color: fn.color(--item --badge --label); - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - border-radius: calc(fn.dim(--item --rounding) - 1px); - border-color: fn.color(--item --key-focus --border); - background-color: fn.color(--item --hover --bg); - box-shadow: fn.color(--item --key-focus --shadow); - color: fn.color(--item --hover --label); - } - } - } - - @include iro.bem-next-elem('header') { - margin-top: 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') { - height: fn.dim(--separator); - } - - @include iro.bem-elem('icon-slot') { - display: flex; - justify-content: center; - width: fn.foreign-dim(--icon, --size); - } - - @include iro.bem-modifier('pull') { - margin: calc(-1 * fn.dim(--item --pad-x)); - } - } -} diff --git a/src/objects/_message.scss b/src/objects/_message.scss deleted file mode 100644 index 283ce26..0000000 --- a/src/objects/_message.scss +++ /dev/null @@ -1,51 +0,0 @@ -@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/objects/_overflow-button.scss b/src/objects/_overflow-button.scss deleted file mode 100644 index b15ea1f..0000000 --- a/src/objects/_overflow-button.scss +++ /dev/null @@ -1,243 +0,0 @@ -@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/objects/_palette.scss b/src/objects/_palette.scss new file mode 100644 index 0000000..a86c026 --- /dev/null +++ b/src/objects/_palette.scss @@ -0,0 +1,38 @@ +@use 'sass:map'; +@use 'sass:list'; +@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; + height: 3em; + + @include iro.bem-elem('item') { + flex: 1 1 auto; + + @for $i from 1 through list.length(map.get(config.$theme-light, --grays)) { + $key: list.nth(map.keys(map.get(config.$theme-light, --grays)), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color(--base $key); + } + } + } + + @each $palette in 'blue' 'purple' 'red' 'green' 'yellow' { + @include iro.bem-modifier($palette) { + @include iro.bem-elem('item') { + @for $i from 1 through list.length(map.get(config.$theme-light, --colors)) { + $key: list.nth(map.keys(map.get(config.$theme-light, --colors)), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color(--#{$palette} $key); + } + } + } + } + } + } +} diff --git a/src/objects/_radio.scss b/src/objects/_radio.scss deleted file mode 100644 index 5af7a12..0000000 --- a/src/objects/_radio.scss +++ /dev/null @@ -1,176 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('radio') { - @include iro.props-store(( - --dims: ( - --diameter: calc(fn.global-dim(--size --175) + 1px), - --label-gap: fn.global-dim(--size --125), - --border: fn.global-dim(--border --medium), - --pad-x: fn.global-dim(--size --65), - --pad-y: fn.global-dim(--size --65), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --circle-border: fn.global-color(--fg-hi), - --circle-bg: fn.global-color(--bg-hi), - - --hover: ( - --label: fn.global-color(--fg-lo), - --circle-border: fn.global-color(--fg), - ), - --accent: ( - --circle-border: fn.global-color(--accent --primary --solid --bg), - - --hover: ( - --circle-border: fn.global-color(--accent --primary --solid --obj), - ), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --circle-border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - --disabled: ( - --label: fn.global-color(--fg-hi3), - --circle-border: fn.global-color(--obj-lo), - --circle-bg: fn.global-color(--bg-hi), - ) - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-flex; - position: relative; - align-items: flex-start; - margin-right: calc(-1 * fn.dim(--pad-x)); - margin-left: calc(-1 * fn.dim(--pad-x)); - padding: fn.dim(--pad-y) fn.dim(--pad-x); - - @include iro.bem-elem('circle') { - display: block; - box-sizing: border-box; - flex: 0 0 auto; - width: fn.dim(--diameter); - height: fn.dim(--diameter); - margin-top: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--diameter))); - border-radius: 2em; - background-color: fn.color(--circle-border); - - &::after { - content: ''; - display: block; - position: relative; - top: fn.dim(--border); - left: fn.dim(--border); - width: calc(fn.dim(--diameter) - 2 * fn.dim(--border)); - height: 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') { - align-self: baseline; - margin-left: fn.dim(--label-gap); - } - - @include iro.bem-elem('native') { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow: hidden; - opacity: .0001; - - &:hover { - @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); - } - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - @include iro.bem-sibling-elem('label') { - color: fn.color(--key-focus --label); - } - - @include iro.bem-sibling-elem('circle') { - background-color: fn.color(--key-focus --circle-border); - box-shadow: fn.color(--key-focus --shadow); - } - } - } - } - - @include iro.bem-modifier('standalone') { - @include iro.bem-elem('circle') { - margin-top: 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 { - @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/objects/_status-indicator.scss b/src/objects/_status-indicator.scss deleted file mode 100644 index d8ea9ef..0000000 --- a/src/objects/_status-indicator.scss +++ /dev/null @@ -1,35 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('status-indicator') { - @include iro.props-store(( - --dims: ( - --size: fn.global-dim(--size --125), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --default: fn.global-color(--obj-lo), - --primary: fn.global-color(--fg), - --green: fn.global-color(--green --solid --bg-hi), - --yellow: fn.global-color(--yellow --solid --bg-hi), - --red: fn.global-color(--red --solid --bg-hi), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-block; - width: fn.dim(--size); - height: fn.dim(--size); - border-radius: 10em; - background-color: fn.color(--default); - vertical-align: middle; - - @each $color in 'primary' 'green' 'yellow' 'red' { - @include iro.bem-is($color) { - background-color: fn.color(--#{$color}); - } - } - } -} diff --git a/src/objects/_switch.scss b/src/objects/_switch.scss deleted file mode 100644 index cbbb9b7..0000000 --- a/src/objects/_switch.scss +++ /dev/null @@ -1,221 +0,0 @@ -@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 --325), - --height: calc(fn.global-dim(--size --175) + 1px), - --label-gap: fn.global-dim(--size --125), - --border: fn.global-dim(--border --medium), - --pad-x: fn.global-dim(--size --65), - --pad-y: fn.global-dim(--size --65), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --track-bg: fn.global-color(--obj), - --handle-border: fn.global-color(--fg-hi), - --handle-bg: fn.global-color(--bg-hi), - - --hover: ( - --label: fn.global-color(--fg-lo), - --handle-border: fn.global-color(--fg), - ), - --accent: ( - --handle-border: fn.global-color(--accent --primary --solid --bg), - - --hover: ( - --handle-border: fn.global-color(--accent --primary --solid --obj), - ), - ), - --key-focus: ( - --label: fn.global-color(--focus --text), - --track-bg: fn.global-color(--focus --fill), - --handle-border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - --disabled: ( - --label: fn.global-color(--fg-hi3), - --track-bg: fn.global-color(--obj), - --handle-border: fn.global-color(--obj-lo), - --handle-bg: fn.global-color(--bg-hi), - ) - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - display: inline-flex; - position: relative; - align-items: flex-start; - margin-right: calc(-1 * fn.dim(--pad-x)); - margin-left: calc(-1 * fn.dim(--pad-x)); - padding: fn.dim(--pad-y) fn.dim(--pad-x); - - @include iro.bem-elem('indicator') { - display: block; - box-sizing: border-box; - flex: 0 0 auto; - width: fn.dim(--width); - height: fn.dim(--height); - margin-top: calc(.5 * (fn.global-dim(--font --standard --line-height) * 1em - fn.dim(--height))); - transition: background-color .2s ease; - border-radius: 2em; - background-color: fn.color(--track-bg); - - &::after { - content: ''; - display: block; - width: calc(fn.dim(--height) - 2 * fn.dim(--border)); - height: 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') { - align-self: baseline; - margin-left: fn.dim(--label-gap); - } - - @include iro.bem-elem('native') { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow: hidden; - opacity: .0001; - - &:hover { - @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 { - @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); - } - } - } - } - - @include iro.bem-at-theme('keyboard') { - &:focus { - @include iro.bem-sibling-elem('label') { - color: fn.color(--key-focus --label); - } - - @include iro.bem-sibling-elem('indicator') { - &::after { - border-color: fn.color(--key-focus --handle-border); - box-shadow: fn.color(--key-focus --shadow); - } - } - - &:checked { - @include iro.bem-sibling-elem('indicator') { - background-color: fn.color(--key-focus --track-bg); - } - } - } - } - } - - @include iro.bem-modifier('standalone') { - @include iro.bem-elem('indicator') { - margin-top: 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 { - @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/objects/_table.scss b/src/objects/_table.scss deleted file mode 100644 index 34512cb..0000000 --- a/src/objects/_table.scss +++ /dev/null @@ -1,167 +0,0 @@ -@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-x: fn.global-dim(--size --175), - --pad-y: fn.global-dim(--size --125), - --rounding: 3px, - --50: ( - --pad-y: fn.global-dim(--size --75), - ) - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --border: fn.global-color(--obj), - --heading: fn.global-color(--fg-hi), - --hover: fn.global-color(--obj-hi), - --press: fn.global-color(--obj), - --box: ( - --bg: fn.global-color(--bg-hi2), - --hover: fn.global-color(--bg), - --press: fn.global-color(--obj-hi), - ) - ) - ), 'colors'); - - @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: 500, - --transform: uppercase, - --spacing: .5px - )); - - padding: fn.dim(--pad-y) fn.dim(--pad-x); - color: fn.color(--heading); - text-align: left; - } - - @include iro.bem-elem('cell') { - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border-width: 1px 0 0; - border-style: solid; - border-color: fn.color(--border); - - @include iro.bem-modifier('divider') { - border-right-width: 1px; - } - } - - @include iro.bem-elem('row') { - &:last-child { - @include iro.bem-elem('cell') { - border-bottom-width: 1px; - } - } - } - - @include iro.bem-modifier('flush') { - @include iro.bem-elem('head-cell', 'cell') { - &:first-child { - padding-left: 0; - } - - &:last-child { - padding-right: 0; - } - } - } - - @include iro.bem-modifier('box') { - @include iro.bem-elem('cell') { - background-color: fn.color(--box --bg); - - &:first-child { - border-left-width: 1px; - } - - &:last-child { - border-right-width: 1px; - } - } - - @include iro.bem-elem('row') { - &:first-child { - @include iro.bem-elem('cell') { - &:first-child { - border-top-left-radius: fn.dim(--rounding); - } - - &:last-child { - border-top-right-radius: fn.dim(--rounding); - } - } - } - - &:last-child { - @include iro.bem-elem('cell') { - &:first-child { - border-bottom-left-radius: fn.dim(--rounding); - } - - &:last-child { - border-bottom-right-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(--press); - } - } - } - - @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 --press); - } - } - } - } - } - - @include iro.bem-modifier('50') { - @include iro.bem-elem('head-cell', 'cell') { - padding-top: fn.dim(--50 --pad-y); - padding-bottom: fn.dim(--50 --pad-y); - } - } - } -} diff --git a/src/objects/_text-field.scss b/src/objects/_text-field.scss deleted file mode 100644 index 88c4535..0000000 --- a/src/objects/_text-field.scss +++ /dev/null @@ -1,232 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@mixin invalid { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--error --border); - box-shadow: fn.color(--error --shadow); - } - - &:hover { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--error --hover --border); - box-shadow: fn.color(--error --hover --shadow); - } - } - - &:focus { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--error --focus --border); - box-shadow: fn.color(--error --focus --shadow); - } - } -} - -@mixin keyboard-focus { - @include iro.bem-sibling-elem('bg') { - border-color: fn.color(--key-focus --border); - box-shadow: fn.color(--key-focus --shadow); - } -} - -@include iro.props-namespace('text-field') { - @include iro.props-store(( - --dims: ( - --pad-x: fn.global-dim(--size --125), - --pad-y: fn.global-dim(--size --125), - --border: fn.global-dim(--border --thin), - --rounding: 2px, - - --extended: ( - --pad: fn.global-dim(--size --50), - --rounding: 6px, - ), - - --focus: ( - --border: fn.global-dim(--border --medium), - ) - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --bg: fn.global-color(--bg-hi2), - --placeholder: fn.global-color(--fg-hi2), - --text: fn.global-color(--fg), - --border: fn.global-color(--obj-lo), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --border: fn.global-color(--fg-hi2), - --shadow: 0 0 0 0 transparent, - ), - --focus: ( - --border: fn.global-color(--accent --primary --solid --bg), - --shadow: 0 0 0 0 transparent, - ), - --key-focus: ( - --border: fn.global-color(--focus --fill), - --shadow: fn.global-color(--focus --shadow), - ), - --error: ( - --border: fn.global-color(--accent --error --solid --bg-hi), - --shadow: 0 0 0 0 transparent, - - --hover: ( - --border: fn.global-color(--accent --error --solid --bg), - --shadow: 0 0 0 0 transparent, - ), - --focus: ( - --border: fn.global-color(--accent --error --solid --bg), - --shadow: 0 0 0 0 transparent, - ), - ), - --disabled: ( - --bg: fn.global-color(--obj-hi), - --placeholder: fn.global-color(--fg-hi3), - --text: fn.global-color(--fg-hi3), - --border: fn.global-color(--obj-hi), - --shadow: 0 0 0 0 transparent, - ), - ), - ), 'colors'); - - @include iro.bem-object(iro.props-namespace()) { - $line-height: 1.4; - $focus-border-offset: calc(fn.dim(--border) - fn.dim(--focus --border)); - - position: relative; - min-width: 0; - border-radius: fn.dim(--rounding); - background-color: fn.color(--bg); - - @include iro.bem-elem('bg') { - display: block; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: fn.dim(--border) solid fn.color(--border); - border-radius: fn.dim(--rounding); - box-shadow: fn.color(--shadow); - pointer-events: none; - } - - @include iro.bem-elem('native') { - box-sizing: border-box; - width: 100%; - padding: calc(fn.dim(--pad-y) - .5em * ($line-height - 1)) fn.dim(--pad-x); - border: 1px solid transparent; - background-color: transparent; - color: fn.color(--text); - font: inherit; - line-height: $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); - box-shadow: fn.color(--hover --shadow); - } - } - - &:focus { - outline: 0; - - @include iro.bem-sibling-elem('bg') { - top: $focus-border-offset; - right: $focus-border-offset; - bottom: $focus-border-offset; - left: $focus-border-offset; - border: fn.dim(--focus --border) solid fn.color(--focus --border); - border-radius: calc(fn.dim(--rounding) - $focus-border-offset); - box-shadow: fn.color(--focus --shadow); - } - } - - &:invalid { - @include invalid; - } - } - - @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(--extended --rounding) - $focus-border-offset); - } - } - } - } - - @include iro.bem-is('invalid') { - @include iro.bem-elem('native') { - @include invalid; - } - } - - @include iro.bem-at-theme('keyboard') { - @include iro.bem-elem('native') { - &:focus, - &:invalid:focus { - @include keyboard-focus; - } - } - - @include iro.bem-is('invalid') { - @include iro.bem-elem('native') { - &:focus { - @include keyboard-focus; - } - } - } - } - - @include iro.bem-is('disabled') { - background-color: fn.color(--disabled --bg); - box-shadow: fn.color(--disabled --shadow); - - @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/scopes/_blockquotes.scss b/src/scopes/_blockquotes.scss deleted file mode 100644 index 5383bd7..0000000 --- a/src/scopes/_blockquotes.scss +++ /dev/null @@ -1,35 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('blockquotes') { - @include iro.props-store(( - --dims: ( - --indent: fn.global-dim(--list --indent), - --margin-top: fn.global-dim(--paragraph --margin-top), - - --compact: ( - --indent: fn.global-dim(--list --compact-indent), - ), - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --border: fn.global-color(--obj), - ) - ), 'colors'); - - @include iro.bem-scope(iro.props-namespace()) { - blockquote { - margin: fn.dim(--margin-top) 0 0 1px; - padding-left: calc(fn.dim(--indent) - 3px); - border-left: 3px solid fn.color(--border); - } - - @include iro.bem-modifier('compact') { - blockquote { - padding-left: calc(fn.dim(--compact --indent) - 3px); - } - } - } -} diff --git a/src/scopes/_code.scss b/src/scopes/_code.scss deleted file mode 100644 index 4eb9458..0000000 --- a/src/scopes/_code.scss +++ /dev/null @@ -1,68 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('code') { - @include iro.props-store(( - --dims: ( - --inline: ( - --pad-x: fn.global-dim(--size --50), - --pad-y: fn.global-dim(--size --10), - --rounding: 3px, - ), - --block: ( - --pad-x: fn.global-dim(--size --150), - --pad-y: fn.global-dim(--size --85), - --margin-top: fn.global-dim(--paragraph --margin-top), - --rounding: 3px, - ) - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --inline: ( - --fg: fn.global-color(--red --quiet --fg), - --bg: fn.global-color(--red --quiet --bg), - ), - --block: ( - --fg: fn.global-color(--fg), - --bg: fn.global-color(--bg-hi2), - ) - ) - ), 'colors'); - - @include iro.props-store(( - --colors: ( - --block: ( - --fg: fn.global-color(--fg-lo), - --bg: fn.global-color(--obj-hi), - ) - ) - ), 'palette-light-hi'); - - @include iro.bem-scope(iro.props-namespace()) { - code { - padding: fn.dim(--inline --pad-y) fn.dim(--inline --pad-x); - border-radius: fn.dim(--inline --rounding); - background-color: fn.color(--inline --bg); - color: fn.color(--inline --fg); - } - - pre { - margin: fn.dim(--block --margin-top) 0 0 0; - padding: fn.dim(--block --pad-y) fn.dim(--block --pad-x); - border-radius: fn.dim(--block --rounding); - background-color: fn.color(--block --bg); - color: fn.color(--block --fg); - - code { - display: inline-block; - margin-right: fn.dim(--block --pad-x); - padding: 0; - border-radius: 0; - background-color: transparent; - color: currentColor; - } - } - } -} diff --git a/src/scopes/_links.scss b/src/scopes/_links.scss index 2e68952..115b199 100644 --- a/src/scopes/_links.scss +++ b/src/scopes/_links.scss @@ -3,42 +3,61 @@ @include iro.props-namespace('links') { @include iro.props-store(( + --dims: ( + --underline: fn.global-dim(--border --thin), + + --hover: ( + --underline: fn.global-dim(--border --medium), + ) + ), --colors: ( - --underline: fn.global-color(--fg-hi2), + --underline: fn.global-color(--text-mute-more), - --idle: fn.global-color(--accent --link-idle --quiet --fg), - --visited: fn.global-color(--accent --link-visited --quiet --fg), - --idle-underline: fn.global-color(--accent --link-idle --quiet --fg-hi), - --visited-underline: fn.global-color(--accent --link-visited --quiet --fg-hi), + --idle: ( + --text: fn.global-color(--accent --1000), + --underline: fn.global-color(--accent --700), - --key-focus: ( - --border: fn.global-color(--focus --fill), - --shadow: 0 0 0 calc(fn.global-dim(--focus --outline-width) + 2px) fn.global-color(--accent --primary --quiet --obj-lo), + --hover: ( + --text: fn.global-color(--accent --1200), + ), ), - ) - ), 'colors'); - @include iro.props-store(( - --colors: ( - --underline: fn.global-color(--fg-hi), + --visited: ( + --text: fn.global-color(--purple --1000), + --underline: fn.global-color(--purple --700), + + --hover: ( + --text: fn.global-color(--purple --1200), + ), + ), + + --focus: ( + --bg: fn.global-color(--yellow-static --400), + --text: #000, + ) ) - ), 'colors-dark'); + )); @include iro.bem-scope(iro.props-namespace()) { :link, :visited { - border-radius: .5px; - color: currentColor; - text-decoration: underline; - text-decoration-color: fn.color(--underline); + border-radius: .5px; + color: currentColor; + text-decoration: underline; + text-decoration-color: fn.color(--underline); + text-decoration-thickness: fn.dim(--underline); &:hover { - text-decoration: underline; + text-decoration: underline; + text-decoration-thickness: fn.dim(--hover --underline); } @include iro.bem-at-theme('keyboard') { &:focus { - box-shadow: 0 0 0 2px fn.color(--key-focus --border), fn.color(--key-focus --shadow); + background-color: fn.color(--focus --bg); + color: fn.color(--focus --text); + text-decoration: none; + border-block-end: fn.dim(--hover --underline) solid currentColor; } } } @@ -52,13 +71,21 @@ @include iro.bem-modifier('colored') { :link { - color: fn.color(--idle); - text-decoration-color: fn.color(--idle-underline); + color: fn.color(--idle --text); + text-decoration-color: fn.color(--idle --underline); + + &:hover { + color: fn.color(--idle --hover --text); + } } :visited { - color: fn.color(--visited); - text-decoration-color: fn.color(--visited-underline); + color: fn.color(--visited --text); + text-decoration-color: fn.color(--visited --underline); + + &:hover { + color: fn.color(--visited --hover --text); + } } } } diff --git a/src/scopes/_lists.scss b/src/scopes/_lists.scss deleted file mode 100644 index 1322f2d..0000000 --- a/src/scopes/_lists.scss +++ /dev/null @@ -1,67 +0,0 @@ -@use 'iro-sass/src/index' as iro; -@use '../functions' as fn; - -@include iro.props-namespace('lists') { - @include iro.props-store(( - --dims: ( - --indent: calc(fn.global-dim(--list --indent) + 1em), - --margin-top: fn.global-dim(--paragraph --margin-top), - - --compact: ( - --indent: fn.global-dim(--list --compact-indent), - ), - ) - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --border: fn.global-color(--obj-hi), - ) - ), 'colors'); - - @include iro.bem-scope(iro.props-namespace()) { - ul, - ol { - margin-top: fn.dim(--margin-top); - padding-left: fn.dim(--indent); - - ul, - ol { - margin-top: 0; - } - } - - ul { - list-style: disc; - } - - ol { - list-style: decimal; - } - - dl { - margin: fn.dim(--margin-top) 0 0; - padding: 0; - } - - dt { - color: fn.global-color(--fg-lo); - font-weight: bold; - } - - dd { - margin: 0 0 0 fn.dim(--indent); - } - - @include iro.bem-modifier('compact') { - ul, - ol { - padding-left: calc(fn.dim(--compact --indent) - 3px); - } - - dd { - margin-left: calc(fn.dim(--compact --indent) - 3px); - } - } - } -} diff --git a/src/scopes/_tables.scss b/src/scopes/_tables.scss deleted file mode 100644 index f78e81b..0000000 --- a/src/scopes/_tables.scss +++ /dev/null @@ -1,114 +0,0 @@ -@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-x: fn.global-dim(--size --175), - --pad-y: fn.global-dim(--size --125), - --rounding: 3px, - --margin-top: fn.global-dim(--paragraph --margin-top), - ), - ), 'dims'); - - @include iro.props-store(( - --colors: ( - --border: fn.global-color(--obj), - --heading: fn.global-color(--fg-hi), - --box: ( - --bg: fn.global-color(--bg-hi2), - ) - ) - ), 'colors'); - - @include iro.bem-scope(iro.props-namespace()) { - table { - margin-top: fn.dim(--margin-top); - border-spacing: 0; - border-collapse: separate; - } - - th { - @include mx.set-font(--standard, ( - --line-height: null, - --size: fn.global-dim(--font-size --50), - --weight: 500, - --transform: uppercase, - --spacing: .5px - )); - - padding: fn.dim(--pad-y) fn.dim(--pad-x); - color: fn.color(--heading); - text-align: left; - } - - td { - padding: fn.dim(--pad-y) fn.dim(--pad-x); - border-width: 1px 0 0; - border-style: solid; - border-color: fn.color(--border); - } - - tr { - &:last-child { - td { - border-bottom-width: 1px; - } - } - } - - @include iro.bem-modifier('flush') { - th, - td { - &:first-child { - padding-left: 0; - } - - &:last-child { - padding-right: 0; - } - } - } - - @include iro.bem-modifier('box') { - td { - background-color: fn.color(--box --bg); - - &:first-child { - border-left-width: 1px; - } - - &:last-child { - border-right-width: 1px; - } - } - - tr { - &:first-child { - td { - &:first-child { - border-top-left-radius: fn.dim(--rounding); - } - - &:last-child { - border-top-right-radius: fn.dim(--rounding); - } - } - } - - &:last-child { - td { - &:first-child { - border-bottom-left-radius: fn.dim(--rounding); - } - - &:last-child { - border-bottom-right-radius: fn.dim(--rounding); - } - } - } - } - } - } -} -- cgit v1.2.3-70-g09d2