@mezzanine-ui/system 0.15.3 → 1.0.0-alpha.0

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.
Files changed (58) hide show
  1. package/_system.scss +46 -7
  2. package/effect/_effect.scss +63 -0
  3. package/effect/_index.scss +1 -0
  4. package/effect/constants.d.ts +1 -0
  5. package/effect/constants.js +3 -0
  6. package/effect/index.d.ts +2 -0
  7. package/effect/index.js +1 -0
  8. package/effect/typings.d.ts +32 -0
  9. package/motion/_motion.scss +47 -11
  10. package/motion/duration.d.ts +1 -1
  11. package/motion/duration.js +6 -5
  12. package/motion/easing.d.ts +1 -1
  13. package/motion/easing.js +3 -4
  14. package/package.json +2 -2
  15. package/palette/_index.scss +3 -1
  16. package/palette/_palette.scss +3 -203
  17. package/palette/_primitives.scss +267 -0
  18. package/palette/_semantic.scss +537 -0
  19. package/palette/constants.d.ts +1 -1
  20. package/palette/constants.js +2 -2
  21. package/palette/index.js +1 -1
  22. package/palette/typings.d.ts +86 -0
  23. package/radius/_index.scss +1 -0
  24. package/radius/_radius.scss +71 -0
  25. package/radius/constants.d.ts +1 -0
  26. package/radius/constants.js +3 -0
  27. package/radius/index.d.ts +3 -0
  28. package/radius/index.js +2 -0
  29. package/radius/radius.d.ts +18 -0
  30. package/radius/radius.js +32 -0
  31. package/size/_size.scss +6 -1
  32. package/size/size.d.ts +2 -0
  33. package/spacing/_index.scss +3 -1
  34. package/spacing/_primitives.scss +137 -0
  35. package/spacing/_semantic.scss +566 -0
  36. package/spacing/_spacing.scss +2 -18
  37. package/spacing/constants.d.ts +1 -0
  38. package/spacing/constants.js +2 -1
  39. package/spacing/index.js +1 -1
  40. package/spacing/toSpacingCssVar.d.ts +1 -0
  41. package/spacing/toSpacingCssVar.js +1 -0
  42. package/spacing/typings.d.ts +81 -0
  43. package/transition/_transition.scss +25 -9
  44. package/typography/SF-Mono/SFMonoMedium.woff +0 -0
  45. package/typography/SF-Mono/SFMonoRegular.woff +0 -0
  46. package/typography/SF-Mono/SFMonoSemibold.woff +0 -0
  47. package/typography/_index.scss +4 -1
  48. package/typography/_primitives.scss +318 -0
  49. package/typography/_semantic.scss +237 -0
  50. package/typography/_sf-mono.scss +34 -0
  51. package/typography/_typography.scss +4 -248
  52. package/typography/_utils.scss +4 -0
  53. package/typography/index.js +1 -0
  54. package/typography/typings.d.ts +9 -1
  55. package/typography/typings.js +4 -0
  56. package/z-index/_z-index.scss +1 -1
  57. package/palette/_constants.scss +0 -267
  58. package/palette/_utils.scss +0 -47
@@ -0,0 +1,267 @@
1
+ @use 'sass:meta';
2
+ @use '../utils/list';
3
+ @use '../utils/map';
4
+
5
+ // 定義所有可用的級距
6
+ $primitive-scales: (25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950);
7
+
8
+ // 定義所有可用的分類
9
+ $primitive-categories: (
10
+ brand,
11
+ red,
12
+ yellow,
13
+ green,
14
+ blue,
15
+ gray,
16
+ white-base,
17
+ black-base,
18
+ brand-base
19
+ );
20
+
21
+ // CSS 變數前綴
22
+ $primitive-prefix: mzn-color-primitive;
23
+
24
+ // 預設色票定義
25
+ $default-primitives: (
26
+ // 品牌色 - 數字級距: 25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
27
+ brand: (
28
+ 25: #FAFAFF,
29
+ 50: #F2F4FE,
30
+ 100: #E2E6FD,
31
+ 200: #C2CCFA,
32
+ 300: #9DAAF5,
33
+ 400: #7689EF,
34
+ 500: #5D74E9,
35
+ 600: #5265E1,
36
+ 700: #4353D6,
37
+ 800: #3340C2,
38
+ 900: #24318F,
39
+ 950: #1A2558,
40
+ ),
41
+ // 錯誤色 - 數字級距: 25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
42
+ red: (
43
+ 25: #FFFAFA,
44
+ 50: #FFF1F1,
45
+ 100: #FDDDDD,
46
+ 200: #FAB6B9,
47
+ 300: #F88B91,
48
+ 400: #F45D65,
49
+ 500: #F03740,
50
+ 600: #D03335,
51
+ 700: #B22B2D,
52
+ 800: #911F22,
53
+ 900: #6D1518,
54
+ 950: #4B0B0B,
55
+ ),
56
+ // 警告色 - 數字級距: 25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
57
+ yellow: (
58
+ 25: #FFFCF5,
59
+ 50: #FFFAEB,
60
+ 100: #FEF0C7,
61
+ 200: #FEDF89,
62
+ 300: #FEC84B,
63
+ 400: #FEB022,
64
+ 500: #F7900A,
65
+ 600: #DC6803,
66
+ 700: #B54708,
67
+ 800: #93370D,
68
+ 900: #7A2E0E,
69
+ 950: #4E1D09,
70
+ ),
71
+ // 成功色 - 數字級距: 25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
72
+ green: (
73
+ 25: #F3FCF7,
74
+ 50: #E5F9EE,
75
+ 100: #C5F0D8,
76
+ 200: #94DFB8,
77
+ 300: #57C78F,
78
+ 400: #2BB26D,
79
+ 500: #139F62,
80
+ 600: #11985A,
81
+ 700: #0E754D,
82
+ 800: #0A5C41,
83
+ 900: #064130,
84
+ 950: #042B1B,
85
+ ),
86
+ // 一般 - 數字級距: 25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
87
+ blue: (
88
+ 25: #F5FAFF,
89
+ 50: #EFF8FF,
90
+ 100: #D1E9FF,
91
+ 200: #B2DDFF,
92
+ 300: #84CAFF,
93
+ 400: #53B1FD,
94
+ 500: #2E90FA,
95
+ 600: #1570EF,
96
+ 700: #175CD3,
97
+ 800: #1849A9,
98
+ 900: #194185,
99
+ 950: #102A56,
100
+ ),
101
+ // 中性灰階 - 數字級距: 25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
102
+ gray: (
103
+ 25: #FBFBFC,
104
+ 50: #F9FAFB,
105
+ 100: #F3F4F6,
106
+ 200: #E5E7EB,
107
+ 300: #C9CBD4,
108
+ 400: #9DA4AE,
109
+ 500: #6C737F,
110
+ 600: #525A61,
111
+ 700: #404750,
112
+ 800: #29313B,
113
+ 900: #191E26,
114
+ 950: #101319,
115
+ ),
116
+ // 白色系 - 特殊級距: white, white-alpha-10/20/.../90
117
+ white-base: (
118
+ white: #FFF,
119
+ white-alpha-5: rgb(255 255 255 / 5%),
120
+ white-alpha-10: rgb(255 255 255 / 10%),
121
+ white-alpha-20: rgb(255 255 255 / 20%),
122
+ white-alpha-30: rgb(255 255 255 / 30%),
123
+ white-alpha-40: rgb(255 255 255 / 40%),
124
+ white-alpha-50: rgb(255 255 255 / 50%),
125
+ white-alpha-60: rgb(255 255 255 / 60%),
126
+ white-alpha-70: rgb(255 255 255 / 70%),
127
+ white-alpha-80: rgb(255 255 255 / 80%),
128
+ white-alpha-90: rgb(255 255 255 / 90%),
129
+ ),
130
+ // 黑色系 - 特殊級距: black, black-alpha-3/5/8/10/20/.../90
131
+ black-base: (
132
+ black: #000,
133
+ black-alpha-3: rgb(0 0 0 / 3%),
134
+ black-alpha-5: rgb(0 0 0 / 5%),
135
+ black-alpha-8: rgb(0 0 0 / 8%),
136
+ black-alpha-10: rgb(0 0 0 / 10%),
137
+ black-alpha-20: rgb(0 0 0 / 20%),
138
+ black-alpha-30: rgb(0 0 0 / 30%),
139
+ black-alpha-40: rgb(0 0 0 / 40%),
140
+ black-alpha-50: rgb(0 0 0 / 50%),
141
+ black-alpha-60: rgb(0 0 0 / 60%),
142
+ black-alpha-70: rgb(0 0 0 / 70%),
143
+ black-alpha-80: rgb(0 0 0 / 80%),
144
+ black-alpha-90: rgb(0 0 0 / 90%),
145
+ ),
146
+ // 品牌色透明度 - 特殊級距: brand-alpha-10/20/.../90
147
+ brand-base: (
148
+ brand-alpha-10: rgb(93 116 233 / 10%),
149
+ brand-alpha-20: rgb(93 116 233 / 20%),
150
+ brand-alpha-30: rgb(93 116 233 / 30%),
151
+ brand-alpha-40: rgb(93 116 233 / 40%),
152
+ brand-alpha-50: rgb(93 116 233 / 50%),
153
+ brand-alpha-60: rgb(93 116 233 / 60%),
154
+ brand-alpha-70: rgb(93 116 233 / 70%),
155
+ brand-alpha-80: rgb(93 116 233 / 80%),
156
+ brand-alpha-90: rgb(93 116 233 / 90%),
157
+ ),
158
+ );
159
+
160
+ // 驗證分類名稱是否有效
161
+ @function is-valid-category($category) {
162
+ @return list.index($primitive-categories, $category) != null;
163
+ }
164
+
165
+ // 驗證顏色值是否已定義
166
+ @function is-color-defined($color) {
167
+ @return $color != null;
168
+ }
169
+
170
+ // 取得特定分類的所有有效 scale 名稱
171
+ @function get-valid-scales($category, $primitives: $default-primitives) {
172
+ $category-colors: map.get($primitives, $category);
173
+
174
+ @if not $category-colors {
175
+ @return ();
176
+ }
177
+
178
+ @return map.keys($category-colors);
179
+ }
180
+
181
+ // 驗證 scale 是否對該分類有效
182
+ @function is-valid-scale-for-category($category, $scale, $primitives: $default-primitives) {
183
+ $valid-scales: get-valid-scales($category, $primitives);
184
+
185
+ @return list.index($valid-scales, $scale) != null;
186
+ }
187
+
188
+ // 取得特定分類的所有顏色
189
+ @function get-category-colors($category, $primitives: $default-primitives) {
190
+ @if not is-valid-category($category) {
191
+ @error 'Invalid category "#{$category}". Valid categories are: #{$primitive-categories}';
192
+ }
193
+
194
+ @return map.get($primitives, $category);
195
+ }
196
+
197
+ // 取得特定分類和級距的顏色值
198
+ @function get-color($category, $scale, $primitives: $default-primitives) {
199
+ @if not is-valid-category($category) {
200
+ @error 'Invalid category "#{$category}". Valid categories are: #{$primitive-categories}';
201
+ }
202
+
203
+ @if not is-valid-scale-for-category($category, $scale, $primitives) {
204
+ $valid-scales: get-valid-scales($category, $primitives);
205
+
206
+ @error 'Invalid scale "#{$scale}" for category "#{$category}". Valid scales are: #{$valid-scales}';
207
+ }
208
+
209
+ $category-colors: map.get($primitives, $category);
210
+ $color: map.get($category-colors, $scale);
211
+
212
+ @if not is-color-defined($color) {
213
+ @error 'Color not defined for #{$category}-#{$scale}';
214
+ }
215
+
216
+ @return $color;
217
+ }
218
+
219
+ // 取得 CSS 變數名稱
220
+ // e.g: --mzn-color-primitive-brand-500
221
+ @function get-var-name($category, $scale) {
222
+ @if $primitive-prefix == '' {
223
+ @return --#{$category}-#{$scale};
224
+ }
225
+
226
+ @return --#{$primitive-prefix}-#{$category}-#{$scale};
227
+ }
228
+
229
+ // 使用 CSS 變數引用顏色
230
+ @function variable($category, $scale) {
231
+ @if not is-valid-category($category) {
232
+ @error 'Invalid category "#{$category}". Valid categories are: #{$primitive-categories}';
233
+ }
234
+
235
+ @if not is-valid-scale-for-category($category, $scale) {
236
+ $valid-scales: get-valid-scales($category);
237
+
238
+ @error 'Invalid scale "#{$scale}" for category "#{$category}". Valid scales are: #{$valid-scales}';
239
+ }
240
+
241
+ @return var(#{get-var-name($category, $scale)});
242
+ }
243
+
244
+ // 生成所有 CSS 變數
245
+ @mixin variables($primitives: (), $skip-undefined: true) {
246
+ $primitives: map.deep-merge($default-primitives, $primitives);
247
+
248
+ @each $category, $colors in $primitives {
249
+ @if not is-valid-category($category) {
250
+ @error 'Invalid category "#{$category}" in primitives map. Valid categories are: #{$primitive-categories}';
251
+ }
252
+
253
+ @each $scale, $color in $colors {
254
+ @if not is-valid-scale-for-category($category, $scale, $primitives) {
255
+ $valid-scales: get-valid-scales($category, $primitives);
256
+
257
+ @error 'Invalid scale "#{$scale}" for category "#{$category}". Valid scales are: #{$valid-scales}';
258
+ }
259
+
260
+ @if is-color-defined($color) {
261
+ #{get-var-name($category, $scale)}: #{$color};
262
+ } @else if not $skip-undefined {
263
+ @error 'Color not defined for #{$category}-#{$scale}';
264
+ }
265
+ }
266
+ }
267
+ }