@nopon-web/styles 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/atomic/_flex.scss CHANGED
@@ -1,35 +1,85 @@
1
1
  @use "../mixin/index" as mx;
2
2
 
3
3
  $flex: (
4
- 1: 1 1 0%,
5
- auto: 1 1 auto,
6
- initial: 0 1 auto,
7
- none: none,
4
+ 1: (
5
+ flex: 1 1 0%,
6
+ ),
7
+ auto: (
8
+ flex: 1 1 auto,
9
+ ),
10
+ initial: (
11
+ flex: 0 1 auto,
12
+ ),
13
+ none: (
14
+ flex: none,
15
+ ),
8
16
  );
9
17
 
10
18
  $flex-justify: (
11
- normal: normal,
12
- start: flex-start,
13
- end: flex-end,
14
- center: center,
15
- between: space-between,
16
- around: space-around,
17
- evenly: space-evenly,
18
- stretch: stretch,
19
+ normal: (
20
+ justify-content: normal,
21
+ ),
22
+ start: (
23
+ justify-content: flex-start,
24
+ ),
25
+ end: (
26
+ justify-content: flex-end,
27
+ ),
28
+ center: (
29
+ justify-content: center,
30
+ ),
31
+ between: (
32
+ justify-content: space-between,
33
+ ),
34
+ around: (
35
+ justify-content: space-around,
36
+ ),
37
+ evenly: (
38
+ justify-content: space-evenly,
39
+ ),
40
+ stretch: (
41
+ justify-content: stretch,
42
+ ),
19
43
  );
20
44
 
21
45
  $flex-align: (
22
- start: flex-start,
23
- end: flex-end,
24
- center: center,
25
- baseline: baseline,
26
- stretch: stretch,
46
+ start: (
47
+ align-items: flex-start,
48
+ ),
49
+ end: (
50
+ align-items: flex-end,
51
+ ),
52
+ center: (
53
+ align-items: center,
54
+ ),
55
+ baseline: (
56
+ align-items: baseline,
57
+ ),
58
+ stretch: (
59
+ align-items: stretch,
60
+ ),
61
+ );
62
+
63
+ $flex-direction: (
64
+ row: (
65
+ flex-direction: row,
66
+ ),
67
+ row-reverse: (
68
+ flex-direction: row-reverse,
69
+ ),
70
+ col: (
71
+ flex-direction: column,
72
+ ),
73
+ col-reverse: (
74
+ flex-direction: column-reverse,
75
+ ),
27
76
  );
28
77
 
29
78
  .flex {
30
- display: flex;
79
+ display: flex;
31
80
  }
32
81
 
33
- @include mx.generate-atomic("flex", flex, $flex);
34
- @include mx.generate-atomic("justify", justify-content, $flex-justify);
35
- @include mx.generate-atomic("items", align-items, $flex-align);
82
+ @include mx.generate-atomic("flex", $flex);
83
+ @include mx.generate-atomic("justify", $flex-justify);
84
+ @include mx.generate-atomic("items", $flex-align);
85
+ @include mx.generate-atomic("flex", $flex-direction);
@@ -0,0 +1,13 @@
1
+ @use "../mixin/index" as mx;
2
+
3
+ $font-weight: (
4
+ thin: (font-weight: 100),
5
+ extralight: (font-weight: 200),
6
+ light: (font-weight: 300),
7
+ normal: (font-weight: 400),
8
+ medium: (font-weight: 500),
9
+ semibold: (font-weight: 600),
10
+ bold: (font-weight: 700),
11
+ );
12
+
13
+ @include mx.generate-atomic("font", $font-weight);
@@ -0,0 +1,10 @@
1
+ @use "../mixin/index" as mx;
2
+
3
+ $text-decoration-line: (
4
+ underline: (text-decoration-line: underline),
5
+ overline: (text-decoration-line: overline),
6
+ line-through: (text-decoration-line: line-through),
7
+ no-underline: (text-decoration-line: none),
8
+ );
9
+
10
+ @include mx.generate-atomic(null, $text-decoration-line);
package/atomic/index.scss CHANGED
@@ -1 +1,3 @@
1
- @use "./flex";
1
+ @use "./flex";
2
+ @use "./font";
3
+ @use "./text";
@@ -0,0 +1,134 @@
1
+ @use '../function/index' as fn;
2
+ @use '../mixin/index' as mx;
3
+
4
+ @include mx.b(button) {
5
+ @include mx.var-register(button);
6
+ position: relative;
7
+ display: inline-block;
8
+ padding: fn.var-get(button, padding);
9
+ line-height: 1;
10
+ border: none;
11
+ border-radius: fn.var-get(button, radius, base);
12
+ font-size: fn.var-get(button, size, text);
13
+ color: fn.var-get(button, color, text, base);
14
+ background-color: transparent;
15
+ box-sizing: border-box;
16
+ overflow: hidden;
17
+ cursor: pointer;
18
+
19
+ + .#{fn.bem(button)} {
20
+ margin-left: fn.var-get(button, gap);
21
+ }
22
+
23
+ &::after {
24
+ content: '';
25
+ position: absolute;
26
+ top: 0;
27
+ left: 0;
28
+ z-index: 0;
29
+ display: block;
30
+ width: 100%;
31
+ height: 100%;
32
+ background-color: fn.var-get(button, color, bg, base);
33
+ }
34
+
35
+ // 内容
36
+ @include mx.e(content) {
37
+ position: relative;
38
+ z-index: 1;
39
+ }
40
+
41
+ &:hover,
42
+ &:active,
43
+ &:focus {
44
+ color: fn.var-get(button, color, text, hover);
45
+
46
+ &::after {
47
+ background-color: fn.var-get(button, color, bg, hover);
48
+ }
49
+ }
50
+
51
+ // 类型
52
+ @include mx.m(primary) {
53
+ --#{fn.var-get-name(button, color, text, base)}: #{fn.var-get(color, text, inverse, 500)};
54
+ --#{fn.var-get-name(button, color, bg, base)}: #{fn.var-get(button, color, theme, 500)};
55
+
56
+ &:active,
57
+ &:focus {
58
+ --#{fn.var-get-name(button, color, text,hover)}: #{fn.var-get(color, text, inverse, 500)};
59
+ --#{fn.var-get-name(button, color, bg, hover)}: #{fn.var-get(button, color, theme, 500)};
60
+ }
61
+ }
62
+
63
+ // 大小
64
+ @include mx.m(small) {
65
+ --#{fn.var-get-name(button, size, base)}: #{fn.var-get(text, 2xl)};
66
+ --#{fn.var-get-name(button, size, text)}: #{fn.var-get(text, xs)};
67
+ --#{fn.var-get-name(button, padding)}: #{fn.var-get(text, 4xs)} #{fn.var-get(text, xs)};
68
+ }
69
+
70
+ @include mx.m(large) {
71
+ --#{fn.var-get-name(button, size, base)}: #{fn.var-get(text, 4xl)};
72
+ --#{fn.var-get-name(button, padding)}: #{fn.var-get(text, sm)} #{fn.var-get(text, lg)};
73
+ }
74
+
75
+ // 朴素
76
+ @include mx.when(plain) {
77
+ --#{fn.var-get-name(button, color, bg, base)}: transparent;
78
+ --#{fn.var-get-name(button, color, bg, hover)}: transparent;
79
+ border-width: fn.var-get(button, border, width);
80
+ border-style: fn.var-get(button, border, style);
81
+ border-color: fn.var-get(button, border, color, base);
82
+
83
+ &:hover,
84
+ &:active,
85
+ &:focus {
86
+ border-color: fn.var-get(button, border, color, hover);
87
+ }
88
+
89
+ &.#{fn.bem(button, '', primary)} {
90
+ --#{fn.var-get-name(button, color, text, base)}: #{fn.var-get(button, color, theme, 500)};
91
+ --#{fn.var-get-name(button, border, color, base)}: #{fn.var-get(button, color, theme, 500)};
92
+
93
+ &:hover,
94
+ &:active,
95
+ &:focus {
96
+ --#{fn.var-get-name(button, color, text, hover)}: #{fn.var-get(button, color, theme, 500)};
97
+ --#{fn.var-get-name(button, color, bg, hover)}: #{fn.var-get(button, color, theme, 50)};
98
+ }
99
+ }
100
+ }
101
+
102
+ // 椭圆
103
+ @include mx.when(round) {
104
+ border-radius: fn.var-get(button, radius, round);
105
+ }
106
+
107
+ // 圆型
108
+ @include mx.when(circle) {
109
+ width: #{fn.var-get(button, size, base)};
110
+ height: #{fn.var-get(button, size, base)};
111
+ border-radius: fn.var-get(button, radius, circle);
112
+ padding: 0;
113
+ }
114
+
115
+ // 文本
116
+ @include mx.when(text) {
117
+ --#{fn.var-get-name(button, color, bg, base)}: transparent;
118
+
119
+ &.#{fn.bem(button, '', primary)} {
120
+ --#{fn.var-get-name(button, color, text, base)}: #{fn.var-get(button, color, theme, 500)};
121
+ }
122
+ }
123
+
124
+ // 背景
125
+ @include mx.when(no-bg) {
126
+ --#{fn.var-get-name(button, color, bg, base)}: transparent;
127
+ --#{fn.var-get-name(button, color, bg, hover)}: transparent;
128
+ --#{fn.var-get-name(button, color, text, hover)}: #{fn.var-get(button, color, theme, 500)};
129
+
130
+ &.#{fn.bem(button, '', primary)} {
131
+ --#{fn.var-get-name(button, color, text, base)}: #{fn.var-get(button, color, theme, 500)};
132
+ }
133
+ }
134
+ }
@@ -1,7 +1,14 @@
1
+ @use "../function/index" as fn;
1
2
  @use "../mixin/index" as mx;
2
3
 
3
4
  @include mx.b("icon") {
4
- display: inline-block;
5
- vertical-align: middle;
6
- color: inherit;
7
- }
5
+ display: inline-block;
6
+ vertical-align: middle;
7
+ color: inherit;
8
+
9
+ &.#{fn.bem(image)} {
10
+ .#{fn.bem(image, content)} {
11
+ display: block;
12
+ }
13
+ }
14
+ }
@@ -1,6 +1,6 @@
1
1
  @use "sass:map";
2
2
  @use "../_config"as cfg;
3
- @use "../_variables" as vars;
3
+ @use "../variables/index" as vars;
4
4
  @use "../function/index" as fn;
5
5
  @use "../mixin/index" as mx;
6
6
 
@@ -4,8 +4,8 @@
4
4
  @use "sass:math";
5
5
  @use "sass:string";
6
6
 
7
- @use "../_config"as cfg;
8
- @use "../variables" as vars;
7
+ @use "../_config" as cfg;
8
+ @use "../variables/index" as vars;
9
9
 
10
10
  /* ===================================================== */
11
11
  /* 1️⃣ 类型判断 */
@@ -65,16 +65,38 @@
65
65
  }
66
66
  }
67
67
 
68
- // 递归解析
68
+ $result: $value;
69
+
70
+ // ref
69
71
  @if var-value-is-ref($value) {
70
- @return var-get-ref($value, cfg.$var-runtime-mode);
72
+ $result: var-get-ref($value, cfg.$var-runtime-mode);
71
73
  }
72
74
 
73
- @if var-value-is-calc($value) {
74
- @return var-get-calc($value, cfg.$var-runtime-mode);
75
+ // calc
76
+ @else if var-value-is-calc($value) {
77
+ $result: var-get-calc($value, cfg.$var-runtime-mode);
75
78
  }
76
79
 
77
- @return $value;
80
+ // list
81
+ @else if meta.type-of($value) == "list" {
82
+ $list-result: ();
83
+
84
+ @each $item in $value {
85
+ $resolved: $item;
86
+
87
+ @if var-value-is-ref($item) {
88
+ $resolved: var-get-ref($item, cfg.$var-runtime-mode);
89
+ } @else if var-value-is-calc($item) {
90
+ $resolved: var-get-calc($item, cfg.$var-runtime-mode);
91
+ }
92
+
93
+ $list-result: list.append($list-result, $resolved, space);
94
+ }
95
+
96
+ $result: $list-result;
97
+ }
98
+
99
+ @return $result;
78
100
  }
79
101
 
80
102
  /* ===================================================== */
@@ -82,38 +104,38 @@
82
104
  /* ===================================================== */
83
105
 
84
106
  @function var-get-ref($ref-value, $mode: value) {
85
- $path: map.get($ref-value, ref);
107
+ $path: map.get($ref-value, ref);
86
108
 
87
- // 先拿真实值(永远可用)
88
- $fallback: var-get-value($path...);
109
+ // 先拿真实值(永远可用)
110
+ $fallback: var-get-value($path...);
89
111
 
90
- @if $fallback == null {
91
- @error "Ref path not found: #{$path}";
92
- }
112
+ @if $fallback == null {
113
+ @error "Ref path not found: #{$path}";
114
+ }
93
115
 
94
- /* =========================
116
+ /* =========================
95
117
  未注册 CSS 变量
96
118
  强制返回真实值
97
119
  ========================= */
98
120
 
99
- @if cfg.$var-css-registered == false {
100
- @return $fallback;
101
- }
121
+ @if cfg.$var-css-registered == false {
122
+ @return $fallback;
123
+ }
102
124
 
103
- /* =========================
125
+ /* =========================
104
126
  CSS 模式
105
127
  ========================= */
106
128
 
107
- @if $mode == css {
108
- $name: var-get-name($path...);
109
- @return string.unquote("var(--#{$name}, #{$fallback})");
110
- }
129
+ @if $mode == css {
130
+ $name: var-get-name($path...);
131
+ @return string.unquote("var(--#{$name}, #{$fallback})");
132
+ }
111
133
 
112
- /* =========================
134
+ /* =========================
113
135
  value 模式
114
136
  ========================= */
115
137
 
116
- @return $fallback;
138
+ @return $fallback;
117
139
  }
118
140
 
119
141
  /* ===================================================== */
@@ -187,14 +209,14 @@
187
209
  @function var-get($path...) {
188
210
  $name: var-get-name($path...);
189
211
  $fallback: var-get-value($path...);
190
-
191
- // 如果未注册 CSS 变量 → 直接返回真实值
192
- @if cfg.$var-css-registered == false {
193
- @if $fallback == null {
194
- @return null;
195
- }
196
- @return $fallback;
197
- }
212
+
213
+ // 如果未注册 CSS 变量 → 直接返回真实值
214
+ @if cfg.$var-css-registered == false {
215
+ @if $fallback == null {
216
+ @return null;
217
+ }
218
+ @return $fallback;
219
+ }
198
220
 
199
221
  @if $fallback == null {
200
222
  @return string.unquote("var(--#{$name})");
@@ -1,9 +1,13 @@
1
1
 
2
2
  // atomic
3
- @mixin generate-atomic($prefix, $property, $map) {
4
- @each $key, $value in $map {
5
- .#{$prefix}-#{$key} {
6
- #{$property}: $value;
7
- }
8
- }
3
+ @mixin generate-atomic($prefix, $map) {
4
+ @each $key, $declarations in $map {
5
+ $class-name: if($prefix ==null, $key, "#{$prefix}-#{$key}");
6
+
7
+ .#{$class-name} {
8
+ @each $prop, $val in $declarations {
9
+ #{$prop}: $val;
10
+ }
11
+ }
12
+ }
9
13
  }
@@ -1,18 +1,19 @@
1
- @use "sass:map";
2
- @use "sass:meta";
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use "sass:list";
3
4
 
4
- @use "../variables" as vars;
5
- @use "../function/index" as fn;
5
+ @use '../variables/index' as vars;
6
+ @use '../function/index' as fn;
6
7
 
7
8
  /* ===================================================== */
8
9
  /* 递归输出 CSS 变量 */
9
10
  /* ===================================================== */
10
11
 
11
12
  @mixin var-emit($name, $value) {
12
- // 如果是普通嵌套 map(不是 ref / calc)
13
- @if meta.type-of($value) == "map" and not fn.var-value-is-ref($value) and not fn.var-value-is-calc($value) {
13
+ // map 递归
14
+ @if meta.type-of($value) == 'map' and not fn.var-value-is-ref($value) and not fn.var-value-is-calc($value) {
14
15
  @each $k, $v in $value {
15
- @include var-emit("#{$name}-#{$k}", $v);
16
+ @include var-emit('#{$name}-#{$k}', $v);
16
17
  }
17
18
  } @else {
18
19
  $final-value: null;
@@ -27,6 +28,25 @@
27
28
  $final-value: fn.var-get-calc($value, css);
28
29
  }
29
30
 
31
+ // list
32
+ @else if meta.type-of($value) == 'list' {
33
+ $result: ();
34
+
35
+ @each $item in $value {
36
+ $resolved: $item;
37
+
38
+ @if fn.var-value-is-ref($item) {
39
+ $resolved: fn.var-get-ref($item, css);
40
+ } @else if fn.var-value-is-calc($item) {
41
+ $resolved: fn.var-get-calc($item, css);
42
+ }
43
+
44
+ $result: list.append($result, $resolved, space);
45
+ }
46
+
47
+ $final-value: $result;
48
+ }
49
+
30
50
  // 普通值
31
51
  @else {
32
52
  $final-value: $value;
@@ -36,14 +56,16 @@
36
56
  }
37
57
  }
38
58
 
39
- /* ===================================================== */
40
- /* 注册所有变量 */
41
- /* ===================================================== */
59
+ @mixin var-register($names...) {
60
+ $all: meta.module-variables('vars');
61
+
62
+ @each $name in $names {
63
+ @if not map.has-key($all, $name) {
64
+ @error "Variable `#{$name}` not found in vars module.";
65
+ }
42
66
 
43
- @mixin var-register() {
44
- $all: meta.module-variables("vars");
67
+ $value: map.get($all, $name);
45
68
 
46
- @each $name, $value in $all {
47
69
  @include var-emit($name, $value);
48
70
  }
49
71
  }
package/mixin/index.scss CHANGED
@@ -1,7 +1,7 @@
1
1
  @use "sass:map";
2
2
 
3
3
  @use "../_config"as cfg;
4
- @use "../_variables" as vars;
4
+ @use "../variables/index" as vars;
5
5
  @use "../function/index" as fn;
6
6
 
7
7
  @use "./_atomic" as *;
@@ -9,6 +9,8 @@
9
9
  @use "./_variables" as *;
10
10
 
11
11
  @forward "../_config";
12
+
13
+ @forward "./_atomic";
12
14
  @forward "./_namespace";
13
15
  @forward "./_variables";
14
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nopon-web/styles",
3
- "version": "0.2.00",
3
+ "version": "0.2.01",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/theme.scss CHANGED
@@ -1,9 +1,9 @@
1
1
  @use "./function/index" as fn;
2
2
  @use "./mixin/index" as mx;
3
3
 
4
- @mixin vars() {
4
+ @mixin root-vars() {
5
5
  font-size: calc(#{fn.var-get(size, root)} * 1px);
6
- @include mx.var-register();
6
+ @include mx.var-register(size, text-base, text, color, z-index-base);
7
7
 
8
8
  &.dark {
9
9
  --color-base-50: #{fn.var-get-value(color, base, inverse, 500)};
@@ -0,0 +1,42 @@
1
+ @use 'sass:map';
2
+ @use '../helper/expression' as expr;
3
+
4
+ $button: () !default;
5
+ $button: map.deep-merge(
6
+ (
7
+ color: (
8
+ theme: (
9
+ 50: expr.ref(color, theme, 50),
10
+ 500: expr.ref(color, theme, 500),
11
+ ),
12
+ text: (
13
+ base: expr.ref(color, text, 500),
14
+ hover: expr.ref(button, color, theme, 500),
15
+ ),
16
+ bg: (
17
+ base: expr.ref(color, base, 250),
18
+ hover: expr.ref(button, color, theme, 50),
19
+ ),
20
+ ),
21
+ size: (
22
+ base: expr.math(30, '*', expr.ref(size, unit)),
23
+ text: expr.ref(text, sm),
24
+ ),
25
+ border: (
26
+ width: expr.math(1, '*', expr.ref(size, unit)),
27
+ style: solid,
28
+ color: (
29
+ base: expr.ref(color, base, 250),
30
+ hover: expr.ref(button, color, theme, 500),
31
+ ),
32
+ ),
33
+ radius: (
34
+ base: expr.math(4, '*', expr.ref(size, unit)),
35
+ round: expr.math(20, '*', expr.ref(size, unit)),
36
+ circle: 100%,
37
+ ),
38
+ padding: expr.math(12, '*', expr.ref(size, unit)) expr.math(14, '*', expr.ref(size, unit)),
39
+ gap: expr.math(10, '*', expr.ref(size, unit)),
40
+ ),
41
+ $button
42
+ );
@@ -0,0 +1,100 @@
1
+ @use "sass:map";
2
+ @use "../helper/expression" as expr;
3
+
4
+ @forward "./button.scss";
5
+
6
+ /* =======================================================
7
+ Size System
8
+ root : 设计基准(px), 需通过 JS 动态设置 size-root = 当前视口宽度(px)
9
+ context : 根尺寸表达(1rem / 100vw)
10
+ unit : 1px 折算单位
11
+ -------------------------------------------------------
12
+ rem 模式 : root = 16 → 1rem = 16px
13
+ vw 模式 : root = 设计稿宽度 → 100vw
14
+ -------------------------------------------------------
15
+ 设计参考: https://tailwindcss.com/docs/font-size
16
+ 参考标准: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size#values
17
+ ======================================================= */
18
+
19
+ $size: () !default;
20
+ $size: map.deep-merge(
21
+ (
22
+ root: 16,
23
+ // 设计基准(px)
24
+ context: 1rem,
25
+ // 尺寸上下文(1rem / 100vw)
26
+ unit: expr.math(1, "/", expr.ref(size, root), "*", expr.ref(size, context)),
27
+ ),
28
+ $size
29
+ );
30
+
31
+ /* ================= Typography ================= */
32
+ $text-base: expr.math(16, "*", expr.ref(size, unit)) !default; // 基准字号(md)
33
+ $text: () !default;
34
+ $text: map.deep-merge(
35
+ (
36
+ 6xs: expr.math(expr.ref(text-base), "*", 0.125),
37
+ 5xs: expr.math(expr.ref(text-base), "*", 0.25),
38
+ 4xs: expr.math(expr.ref(text-base), "*", 0.375),
39
+ 3xs: expr.math(expr.ref(text-base), "*", 0.5),
40
+ 2xs: expr.math(expr.ref(text-base), "*", 0.625),
41
+ xs: expr.math(expr.ref(text-base), "*", 0.75),
42
+ sm: expr.math(expr.ref(text-base), "*", 0.875),
43
+ md: expr.math(expr.ref(text-base), "*", 1),
44
+ lg: expr.math(expr.ref(text-base), "*", 1.125),
45
+ xl: expr.math(expr.ref(text-base), "*", 1.25),
46
+ 2xl: expr.math(expr.ref(text-base), "*", 1.5),
47
+ 3xl: expr.math(expr.ref(text-base), "*", 1.875),
48
+ 4xl: expr.math(expr.ref(text-base), "*", 2.25),
49
+ 5xl: expr.math(expr.ref(text-base), "*", 3),
50
+ 6xl: expr.math(expr.ref(text-base), "*", 3.75),
51
+ 7xl: expr.math(expr.ref(text-base), "*", 4.5),
52
+ 8xl: expr.math(expr.ref(text-base), "*", 6),
53
+ 9xl: expr.math(expr.ref(text-base), "*", 8),
54
+ ),
55
+ $text
56
+ );
57
+
58
+ /* =======================================================
59
+ Color System
60
+ scale: 50(浅) → 950(深),500 为主色
61
+ 500 : 主色
62
+ 支持 ref / 主题切换
63
+ -------------------------------------------------------
64
+ 设计参考: https://tailwindcss.com/docs/colors
65
+ ======================================================= */
66
+ $color: () !default;
67
+ $color: map.deep-merge(
68
+ (
69
+ theme: (
70
+ 50: #ede6ff,
71
+ 500: #6e64c8,
72
+ ),
73
+ base: (
74
+ 50: #fff,
75
+ 250: #f5f6f7,
76
+ 500: #eee,
77
+ inverse: (
78
+ 50: #777777,
79
+ 250: #333333,
80
+ 500: #000000,
81
+ ),
82
+ ),
83
+ danger: (
84
+ 500: #ff7b7b,
85
+ ),
86
+ text: (
87
+ 500: expr.ref(color, base, inverse, 500),
88
+ inverse: (
89
+ 500: expr.ref(color, base, 50),
90
+ ),
91
+ ),
92
+ icon: (
93
+ 500: expr.ref(color, base, inverse, 50),
94
+ ),
95
+ ),
96
+ $color
97
+ );
98
+
99
+ /* ================= Layer ================= */
100
+ $z-index-base: 1000;
package/_variables.scss DELETED
@@ -1,98 +0,0 @@
1
- @use 'sass:map';
2
-
3
- @use "./helper/expression" as expr;
4
-
5
- // Size System
6
- // --size-root : 设计基准(px)
7
- // --size-unit : 等效 1px 抽象单位
8
- // 设计参考: https://tailwindcss.com/docs/font-size
9
- // 参考标准: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size#values
10
- // ============================================
11
- //
12
- // rem 模式:
13
- // 基于 root font-size(等价 Flexible)
14
- //
15
- // vw 模式:
16
- // 基于视口宽度比例
17
- // 需通过 JS 动态设置 size-root = 当前视口宽度(px)
18
- //
19
- // ============================================
20
- $size: () !default;
21
- $size: map.deep-merge(
22
- (
23
- root: 16, // 尺寸基准(16 = 1rem 基准)
24
- mode: 1rem, // Flexible 模式: 1rem; Viewport 模式: 100vw;
25
- unit: expr.math(1, "/", expr.ref(size, root), "*", expr.ref(size, mode))
26
- ),
27
- $size
28
- );
29
-
30
- $text-base: expr.math(16, "*", expr.ref(size, unit)) !default; // 字号基准(md 等级)
31
- $text: () !default; // 字号比例阶梯(基于 md = 1)
32
- $text: map.deep-merge(
33
- (
34
- 6xs: expr.math(expr.ref(text-base), "*", 0.125),
35
- 5xs: expr.math(expr.ref(text-base), "*", 0.25),
36
- 4xs: expr.math(expr.ref(text-base), "*", 0.375),
37
- 3xs: expr.math(expr.ref(text-base), "*", 0.5),
38
- 2xs: expr.math(expr.ref(text-base), "*", 0.625),
39
- xs: expr.math(expr.ref(text-base), "*", 0.75),
40
- sm: expr.math(expr.ref(text-base), "*", 0.875),
41
- md: expr.math(expr.ref(text-base), "*", 1),
42
- lg: expr.math(expr.ref(text-base), "*", 1.125),
43
- xl: expr.math(expr.ref(text-base), "*", 1.25),
44
- 2xl: expr.math(expr.ref(text-base), "*", 1.5),
45
- 3xl: expr.math(expr.ref(text-base), "*", 1.875),
46
- 4xl: expr.math(expr.ref(text-base), "*", 2.25),
47
- 5xl: expr.math(expr.ref(text-base), "*", 3),
48
- 6xl: expr.math(expr.ref(text-base), "*", 3.75),
49
- 7xl: expr.math(expr.ref(text-base), "*", 4.5),
50
- 8xl: expr.math(expr.ref(text-base), "*", 6),
51
- 9xl: expr.math(expr.ref(text-base), "*", 8)
52
- ),
53
- $text
54
- );
55
-
56
- // ============================================
57
- // Color
58
- // 设计参考: https://tailwindcss.com/docs/colors
59
- // ============================================
60
- // 命名: $<name>-<scale>
61
- // scale: 50(浅) → 950(深),500 为主色
62
- // 可映射为 CSS 变量支持主题切换
63
- // ============================================
64
- $color: () !default;
65
- $color: map.deep-merge(
66
- (
67
- theme: (
68
- 50: #ede6ff,
69
- 500: #6e64c8,
70
- ),
71
- base: (
72
- 50: #fff,
73
- 250: #f5f6f7,
74
- 500: #eee,
75
- inverse: (
76
- 50: #777777,
77
- 250: #333333,
78
- 500: #000000,
79
- ),
80
- ),
81
- danger: (
82
- 500: #ff7b7b,
83
- ),
84
- text: (
85
- 500: expr.ref(color, base, inverse, 500),
86
- inverse: (
87
- 500: expr.ref(color, base, 50)
88
- )
89
- ),
90
- icon: (
91
- 500: expr.ref(color, base, inverse, 50)
92
- )
93
- ),
94
- $color
95
- );
96
-
97
- // 层级
98
- $z-index-base: 1000;