summaryrefslogtreecommitdiffstats
path: root/src/_vars.vars.scss
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2024-10-18 18:08:24 +0200
committerVolpeon <git@volpeon.ink>2024-10-18 18:08:24 +0200
commit365c56edcc36b5b92902bac01ce44b43d01e8685 (patch)
tree644611792591a76e605068d0c9e230fad6a633e7 /src/_vars.vars.scss
parentRevamped variable management (diff)
downloadiro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.tar.gz
iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.tar.bz2
iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.zip
Refactoring
Diffstat (limited to 'src/_vars.vars.scss')
-rw-r--r--src/_vars.vars.scss203
1 files changed, 203 insertions, 0 deletions
diff --git a/src/_vars.vars.scss b/src/_vars.vars.scss
new file mode 100644
index 0000000..cc11b89
--- /dev/null
+++ b/src/_vars.vars.scss
@@ -0,0 +1,203 @@
1@use 'sass:map';
2@use 'sass:meta';
3@use 'sass:list';
4@use 'iro-sass/src/iro-sass' as iro;
5@use 'functions' as fn;
6@use 'themes';
7@use 'props';
8
9$size--0: props.def(--size--0, 0) !default;
10$size--10: props.def(--size--10, iro.fn-px-to-rem(1px)) !default;
11$size--25: props.def(--size--25, iro.fn-px-to-rem(2px)) !default;
12$size--40: props.def(--size--40, iro.fn-px-to-rem(3px)) !default;
13$size--50: props.def(--size--50, iro.fn-px-to-rem(4px)) !default;
14$size--65: props.def(--size--65, iro.fn-px-to-rem(5px)) !default;
15$size--75: props.def(--size--75, iro.fn-px-to-rem(6px)) !default;
16$size--85: props.def(--size--85, iro.fn-px-to-rem(7px)) !default;
17$size--100: props.def(--size--100, iro.fn-px-to-rem(8px)) !default;
18$size--115: props.def(--size--115, iro.fn-px-to-rem(9px)) !default;
19$size--125: props.def(--size--125, iro.fn-px-to-rem(10px)) !default;
20$size--130: props.def(--size--130, iro.fn-px-to-rem(11px)) !default;
21$size--150: props.def(--size--150, iro.fn-px-to-rem(12px)) !default;
22$size--160: props.def(--size--160, iro.fn-px-to-rem(13px)) !default;
23$size--175: props.def(--size--175, iro.fn-px-to-rem(14px)) !default;
24$size--200: props.def(--size--200, iro.fn-px-to-rem(16px)) !default;
25$size--225: props.def(--size--225, iro.fn-px-to-rem(18px)) !default;
26$size--250: props.def(--size--250, iro.fn-px-to-rem(20px)) !default;
27$size--275: props.def(--size--275, iro.fn-px-to-rem(22px)) !default;
28$size--300: props.def(--size--300, iro.fn-px-to-rem(24px)) !default;
29$size--325: props.def(--size--325, iro.fn-px-to-rem(26px)) !default;
30$size--350: props.def(--size--350, iro.fn-px-to-rem(28px)) !default;
31$size--375: props.def(--size--375, iro.fn-px-to-rem(30px)) !default;
32$size--400: props.def(--size--400, iro.fn-px-to-rem(32px)) !default;
33$size--450: props.def(--size--450, iro.fn-px-to-rem(36px)) !default;
34$size--500: props.def(--size--500, iro.fn-px-to-rem(40px)) !default;
35$size--550: props.def(--size--550, iro.fn-px-to-rem(44px)) !default;
36$size--600: props.def(--size--600, iro.fn-px-to-rem(48px)) !default;
37$size--650: props.def(--size--650, iro.fn-px-to-rem(52px)) !default;
38$size--700: props.def(--size--700, iro.fn-px-to-rem(56px)) !default;
39$size--800: props.def(--size--800, iro.fn-px-to-rem(64px)) !default;
40$size--900: props.def(--size--900, iro.fn-px-to-rem(72px)) !default;
41$size--1000: props.def(--size--1000, iro.fn-px-to-rem(80px)) !default;
42$size--1200: props.def(--size--1200, iro.fn-px-to-rem(96px)) !default;
43$size--1600: props.def(--size--1600, iro.fn-px-to-rem(128px)) !default;
44$size--2000: props.def(--size--2000, iro.fn-px-to-rem(160px)) !default;
45$size--2400: props.def(--size--2400, iro.fn-px-to-rem(192px)) !default;
46$size--2500: props.def(--size--2500, iro.fn-px-to-rem(200px)) !default;
47$size--2600: props.def(--size--2600, iro.fn-px-to-rem(208px)) !default;
48$size--2800: props.def(--size--2800, iro.fn-px-to-rem(224px)) !default;
49$size--3200: props.def(--size--3200, iro.fn-px-to-rem(256px)) !default;
50$size--3400: props.def(--size--3400, iro.fn-px-to-rem(272px)) !default;
51$size--3500: props.def(--size--3500, iro.fn-px-to-rem(280px)) !default;
52$size--3600: props.def(--size--3600, iro.fn-px-to-rem(288px)) !default;
53$size--3800: props.def(--size--3800, iro.fn-px-to-rem(304px)) !default;
54$size--4600: props.def(--size--4600, iro.fn-px-to-rem(368px)) !default;
55$size--5000: props.def(--size--5000, iro.fn-px-to-rem(400px)) !default;
56$size--6000: props.def(--size--6000, iro.fn-px-to-rem(480px)) !default;
57
58$font--standard--family: props.def(--font--standard--family, ('Inter', 'Open Sans', 'Segoe UI', 'Droid Sans', Roboto, Oxygen, 'Helvetica Neue', Helvetica, Tahoma, Arial, sans-serif)) !default;
59$font--standard--line-height: props.def(--font--standard--line-height, 1.5) !default;
60$font--standard--feature-settings: props.def(--font--standard--feature-settings, ('\'ss01\'')) !default;
61
62$font--headline--family: props.def(--font--headline--family, ('Inter', props.get($font--standard--family))) !default;
63$font--headline--line-height: props.def(--font--headline--line-height, 1.3) !default;
64$font--headline--weight: props.def(--font--headline--weight, 800) !default;
65$font--headline--feature-settings: props.def(--font--headline--feature-settings, ('\'opsz\'' 32, '\'ss01\'', '\'cv06\'')) !default;
66
67$font--mono--family: props.def(--font--mono--family, ('Iosevka Term SS09', 'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace)) !default;
68$font--mono--line-height: props.def(--font--mono--line-height, 1.4) !default;
69
70$font-size--50: props.def(--font-size--50, iro.fn-px-to-rem(12px)) !default;
71$font-size--75: props.def(--font-size--75 , iro.fn-px-to-rem(13px)) !default;
72$font-size--100: props.def(--font-size--100, iro.fn-px-to-rem(14px)) !default;
73$font-size--150: props.def(--font-size--150, iro.fn-px-to-rem(16px)) !default;
74$font-size--200: props.def(--font-size--200, iro.fn-px-to-rem(18px)) !default;
75$font-size--300: props.def(--font-size--300, iro.fn-px-to-rem(20px)) !default;
76$font-size--400: props.def(--font-size--400, iro.fn-px-to-rem(24px)) !default;
77$font-size--500: props.def(--font-size--500, iro.fn-px-to-rem(28px)) !default;
78$font-size--600: props.def(--font-size--600, iro.fn-px-to-rem(32px)) !default;
79$font-size--700: props.def(--font-size--700, iro.fn-px-to-rem(36px)) !default;
80$font-size--800: props.def(--font-size--800, iro.fn-px-to-rem(40px)) !default;
81$font-size--900: props.def(--font-size--900, iro.fn-px-to-rem(45px)) !default;
82$font-size--1000: props.def(--font-size--1000, iro.fn-px-to-rem(50px)) !default;
83$font-size--1100: props.def(--font-size--1100, iro.fn-px-to-rem(60px)) !default;
84
85$border-width--thick: props.def(--border-width--thick, 4px) !default;
86$border-width--medium: props.def(--border-width--medium, 2px) !default;
87$border-width--thin: props.def(--border-width--thin, 1px) !default;
88
89$shadow--x: props.def(--shadow--x, 0) !default;
90$shadow--y: props.def(--shadow--y, 1px) !default;
91$shadow--blur: props.def(--shadow--blur, 4px) !default;
92
93$rounding: props.def(--rounding, 4px) !default;
94
95$key-focus--outline-width: props.def(--key-focus--outline-width, props.get($border-width--thick)) !default;
96$key-focus--border-width: props.def(--key-focus--border-width, props.get($border-width--medium)) !default;
97$key-focus--border-offset: props.def(--key-focus--border-offset, props.get($border-width--medium)) !default;
98
99$heading--xxl: props.def(--heading--xxl, props.get($font-size--300)) !default;
100$heading--xl: props.def(--heading--xl, props.get($font-size--200)) !default;
101$heading--lg: props.def(--heading--lg, props.get($font-size--150)) !default;
102$heading--md: props.def(--heading--md, props.get($font-size--100)) !default;
103$heading--sm: props.def(--heading--sm, props.get($font-size--75)) !default;
104$heading--xs: props.def(--heading--xs, props.get($font-size--50)) !default;
105$heading--display--xxl: props.def(--heading--display--xxl, props.get($font-size--1100)) !default;
106$heading--display--xl: props.def(--heading--display--xl, props.get($font-size--700)) !default;
107$heading--display--lg: props.def(--heading--display--lg, props.get($font-size--300)) !default;
108$heading--display--md: props.def(--heading--display--md, props.get($font-size--150)) !default;
109$heading--display--sm: props.def(--heading--display--sm, props.get($font-size--75)) !default;
110$heading--display--xs: props.def(--heading--display--xs, props.get($font-size--50)) !default;
111$heading--display-sm--xxl: props.def(--heading--display-sm--xxl, props.get($font-size--900)) !default;
112$heading--display-sm--xl: props.def(--heading--display-sm--xl, props.get($font-size--600)) !default;
113$heading--display-sm--lg: props.def(--heading--display-sm--lg, props.get($font-size--200)) !default;
114$heading--display-sm--md: props.def(--heading--display-sm--md, props.get($font-size--100)) !default;
115$heading--display-sm--sm: props.def(--heading--display-sm--sm, props.get($font-size--75)) !default;
116$heading--display-sm--xs: props.def(--heading--display-sm--xs, props.get($font-size--50)) !default;
117
118$list--indent: props.def(--list--indent, props.get($size--400)) !default;
119$list--compact-indent: props.def(--list--indent, props.get($size--250)) !default;
120
121//
122
123$static-colors: props.def(--static-colors);
124
125@each $palette-name, $palette in map.get(themes.$static-colors, --palettes) {
126 $palette: fn.palette($palette, map.get(themes.$static-colors, --contrasts), 1, map.get(themes.$static-colors, --base));
127 $static-colors: props.merge($static-colors, ( $palette-name: $palette ));
128}
129
130//
131
132$transparent-colors: props.def(--transparent-colors);
133
134@each $palette-name, $palette in (--black: #000 #fff, --white: #fff #000) {
135 $color: list.nth($palette, 1);
136 $text: list.nth($palette, 2);
137
138 $palette: fn.transparent-palette($color, $text, map.get(themes.$static-colors, --transparents));
139 $transparent-colors: props.merge($transparent-colors, ( $palette-name: $palette ));
140}
141
142//
143
144$themes: ();
145
146@each $theme-name, $theme in themes.$themes {
147 @each $variant-name, $variant in $theme {
148 $compiled: props.def(--colors);
149
150 @each $palette-name, $palette in map.get($variant, --palettes) {
151 $base-color: list.nth($palette, 1);
152 $contrasts: list.nth($palette, 2);
153 $ranges: list.nth($palette, 3);
154
155 $palette: fn.palette($base-color, map.get($variant, --contrasts, $contrasts), map.get($variant, --ranges, $ranges), list.nth(map.get($variant, --palettes, --base), 1));
156 $compiled: props.merge($compiled, ( $palette-name: $palette ));
157 }
158
159 @each $color, $value in map.get($variant, --constants) {
160 $compiled: props.merge($compiled, ( $color: $value ));
161 }
162
163 @each $color, $ref in map.get($variant, --semantic) {
164 $res: ();
165
166 @if meta.type-of($ref) == 'map' {
167 @each $key, $r in $ref {
168 $repo-name: list.nth($r, 1);
169 $re1: list.nth($r, 2);
170 $re2: iro.fn-list-slice($r, 3);
171
172 $res2: null;
173
174 @if $repo-name == --static {
175 $res2: props.get($static-colors, $re1, $re2...);
176 } @else {
177 $res2: props.get($compiled, $re1, $re2...);
178 }
179
180 $res: map.merge($res, ($key: $res2));
181 }
182 } @else {
183 $repo-name: list.nth($ref, 1);
184 $ref1: list.nth($ref, 2);
185 $ref2: iro.fn-list-slice($ref, 3);
186
187 $res: null;
188
189 @if $repo-name == --static {
190 $res: props.get($static-colors, $ref1, $ref2...);
191 } @else {
192 $res: props.get($compiled, $ref1, $ref2...);
193 }
194 }
195
196 $compiled: props.merge($compiled, ( $color: $res ));
197 }
198
199 $themes: map.set($themes, $theme-name, $variant-name, $compiled);
200 }
201}
202
203$theme: map.get($themes, themes.$theme-default, light) !default;