@a-type/ui 1.8.10 → 1.8.11

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.
@@ -4,22 +4,22 @@ const baseHeadingClass = 'layer-components:my-0';
4
4
  export const H1 = withClassName(
5
5
  'h1',
6
6
  baseHeadingClass,
7
- 'layer-components:(font-title text-2xl font-semibold)',
7
+ 'layer-components:(font-title text-2xl font-semibold color-inherit color-darken-1)',
8
8
  );
9
9
  export const H2 = withClassName(
10
10
  'h2',
11
11
  baseHeadingClass,
12
- 'layer-components:(text-lg font-title font-bold color-gray-dark color-darken-7)',
12
+ 'layer-components:(text-lg font-title font-bold color-inherit color-lighten-2)',
13
13
  );
14
14
  export const H3 = withClassName(
15
15
  'h3',
16
16
  baseHeadingClass,
17
- 'layer-components:(font-title text-md font-500 color-gray-dark color-darken-5)',
17
+ 'layer-components:(font-title text-md font-500 color-inherit color-lighten-4)',
18
18
  );
19
19
  export const H4 = withClassName(
20
20
  'h4',
21
21
  baseHeadingClass,
22
- 'layer-components:(text-xs uppercase color-gray-dark color-darken-3)',
22
+ 'layer-components:(text-xs uppercase color-inherit color-lighten-6)',
23
23
  );
24
24
  export const H5 = withClassName('h5', baseHeadingClass);
25
25
 
@@ -33,6 +33,7 @@ import {
33
33
  PageRoot,
34
34
  Progress,
35
35
  Provider,
36
+ ScrollArea,
36
37
  TextSkeleton,
37
38
  ThemeName,
38
39
  ToggleGroup,
@@ -90,32 +91,50 @@ function DemoUI({ className }: { className?: string }) {
90
91
  <ToggleGroup.Item value="2">Toggle 2</ToggleGroup.Item>
91
92
  </ToggleGroup>
92
93
  </Box>
93
- <Box layout="start center" d="col" gap p>
94
- <H1>Heading 1</H1>
95
- <H2>Heading 2</H2>
96
- <H3>Heading 3</H3>
97
- <H4>Heading 4</H4>
98
- <P>
99
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
100
- eiusmod tempor incididunt ut labore et dolore magna aliqua.
101
- </P>
102
- <TextSkeleton maxLength={30} />
103
- <TextSkeleton maxLength={10} />
94
+ <Box layout="start center" d="col" gap p className="max-h-200px">
95
+ <ScrollArea>
96
+ <H1>Heading 1</H1>
97
+ <H2>Heading 2</H2>
98
+ <H3>Heading 3</H3>
99
+ <H4>Heading 4</H4>
100
+ <P>
101
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
102
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.
103
+ </P>
104
+ <TextSkeleton maxLength={30} />
105
+ <TextSkeleton maxLength={10} />
106
+ </ScrollArea>
107
+ </Box>
108
+ <Box d="col" gap>
109
+ <Card>
110
+ <Card.Main onClick={() => {}}>
111
+ <Card.Title>Card Title</Card.Title>
112
+ <Card.Content>Card Content</Card.Content>
113
+ </Card.Main>
114
+ <Card.Footer>
115
+ <Card.Actions>
116
+ <Button size="small">Action 1</Button>
117
+ <Button size="icon-small" color="ghost">
118
+ <Icon name="placeholder" />
119
+ </Button>
120
+ </Card.Actions>
121
+ </Card.Footer>
122
+ </Card>
123
+ <Card>
124
+ <Card.Main compact onClick={() => {}}>
125
+ <Card.Title>Card Title</Card.Title>
126
+ <Card.Content>Card Content</Card.Content>
127
+ </Card.Main>
128
+ <Card.Footer>
129
+ <Card.Actions>
130
+ <Button size="small">Action 1</Button>
131
+ <Button size="icon-small" color="ghost">
132
+ <Icon name="placeholder" />
133
+ </Button>
134
+ </Card.Actions>
135
+ </Card.Footer>
136
+ </Card>
104
137
  </Box>
105
- <Card>
106
- <Card.Main onClick={() => {}}>
107
- <Card.Title>Card Title</Card.Title>
108
- <Card.Content>Card Content</Card.Content>
109
- </Card.Main>
110
- <Card.Footer>
111
- <Card.Actions>
112
- <Button size="small">Action 1</Button>
113
- <Button size="icon-small" color="ghost">
114
- <Icon name="placeholder" />
115
- </Button>
116
- </Card.Actions>
117
- </Card.Footer>
118
- </Card>
119
138
  <Tabs defaultValue="tab1">
120
139
  <Tabs.List>
121
140
  <Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
@@ -177,17 +196,40 @@ function DemoUI({ className }: { className?: string }) {
177
196
  onChange={() => {}}
178
197
  />
179
198
  <Progress value={50} className="m-auto" />
180
- <Box surface="primary" p gap>
199
+ <Box surface="primary" p gap d="col">
200
+ <H1>Primary surface</H1>
201
+ <H2>Primary surface</H2>
202
+ <H3>Primary surface</H3>
181
203
  <div>Primary surface</div>
182
204
  <Button color="ghost">Ghost</Button>
183
205
  </Box>
184
- <Box surface="accent" p>
185
- Accent surface
206
+ <Box surface="accent" p d="col" className="max-h-200px">
207
+ <ScrollArea>
208
+ <H2>Accent surface</H2>
209
+ <H3>Accent surface</H3>
210
+ <P>
211
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
212
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.
213
+ </P>
214
+ <P>
215
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
216
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.
217
+ </P>
218
+ <P>
219
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
220
+ eiusmod tempor incididunt ut labore et dolore magna aliqua.
221
+ </P>
222
+ <TextSkeleton maxLength={30} />
223
+ <TextSkeleton maxLength={10} />
224
+ Accent surface
225
+ </ScrollArea>
186
226
  </Box>
187
- <Box surface="default" p>
227
+ <Box surface="default" p d="col">
188
228
  Default surface
189
229
  </Box>
190
- <Box surface="attention" p>
230
+ <Box surface="attention" p d="col">
231
+ <H2>Attention surface</H2>
232
+ <H3>Attention surface</H3>
191
233
  Attention surface
192
234
  </Box>
193
235
  <Box>
package/src/uno.preset.ts CHANGED
@@ -20,8 +20,8 @@ export default function presetAglio({
20
20
  scale = 'md',
21
21
  interFontLocation = 'https://resources.biscuits.club/fonts/Inter-VariableFont_slnt,wght.ttf',
22
22
  colorRanges = {
23
- light: [90, 40],
24
- dark: [0, 60],
23
+ light: [90, 20],
24
+ dark: [0, 80],
25
25
  },
26
26
  borderScale = 1,
27
27
  roundedness = 1,
@@ -70,12 +70,14 @@ export default function presetAglio({
70
70
  light: 'var(--color-attention-light)',
71
71
  dark: 'var(--color-attention-dark)',
72
72
  wash: 'var(--color-attention-wash)',
73
+ ink: 'var(--color-attention-ink)',
73
74
  },
74
75
  accent: {
75
76
  DEFAULT: 'var(--color-accent)',
76
77
  light: 'var(--color-accent-light)',
77
78
  dark: 'var(--color-accent-dark)',
78
79
  wash: 'var(--color-accent-wash)',
80
+ ink: 'var(--color-accent-ink)',
79
81
  },
80
82
  accentWash: 'var(--color-accent-wash)',
81
83
  'accent-wash': 'var(--color-accent-wash)',
@@ -88,6 +90,7 @@ export default function presetAglio({
88
90
  light: 'var(--color-primary-light)',
89
91
  dark: 'var(--color-primary-dark)',
90
92
  wash: 'var(--color-primary-wash)',
93
+ ink: 'var(--color-primary-ink)',
91
94
  },
92
95
  primaryLight: 'var(--color-primary-light)',
93
96
  'primary-light': 'var(--color-primary-light)',
@@ -100,6 +103,7 @@ export default function presetAglio({
100
103
  wash: 'var(--color-gray-wash)',
101
104
  light: 'var(--color-gray-light)',
102
105
  dark: 'var(--color-gray-dark)',
106
+ ink: 'var(--color-gray-ink)',
103
107
  blend: 'var(--color-gray-blend)',
104
108
  },
105
109
  grayBlend: 'var(--color-gray-blend)',
@@ -135,11 +139,11 @@ export default function presetAglio({
135
139
  },
136
140
  spacing: makeSpacing(spacingIncrement),
137
141
  borderRadius: {
138
- xs: `calc(0.25rem * var(--local-corner-scale, var(--global-corner-scale,1)))`,
139
- sm: `calc(0.5rem * var(--local-corner-scale, var(--global-corner-scale,1)))`,
140
- md: `calc(1rem * var(--local-corner-scale, var(--global-corner-scale,1)))`,
141
- lg: `calc(1.25rem * var(--local-corner-scale, var(--global-corner-scale,1)))`,
142
- xl: `calc(1.5rem * var(--local-corner-scale, var(--global-corner-scale,1)))`,
142
+ xs: `calc(0.25rem * var(--local-corner-scale,1) * var(--global-corner-scale,1))`,
143
+ sm: `calc(0.5rem * var(--local-corner-scale,1) * var(--global-corner-scale,1))`,
144
+ md: `calc(1rem * var(--local-corner-scale,1) * var(--global-corner-scale,1))`,
145
+ lg: `calc(1.25rem * var(--local-corner-scale,1) * var(--global-corner-scale,1))`,
146
+ xl: `calc(1.5rem * var(--local-corner-scale,1) * var(--global-corner-scale,1))`,
143
147
  full: cornerScale === 0 ? '0px' : '9999px',
144
148
  },
145
149
  lineWidth: {
@@ -418,10 +422,15 @@ export default function presetAglio({
418
422
 
419
423
  [
420
424
  /^color-(.*)$/,
421
- (match, { theme }) => ({
422
- color: 'var(--v-color-altered,var(--v-color))',
423
- '--v-color': resolveThemeColor(match[1], theme),
424
- }),
425
+ (match, { theme }) => {
426
+ if (match[1] === 'inherit') {
427
+ return { color: 'var(--v-color-altered,var(--v-color))' };
428
+ }
429
+ return {
430
+ color: 'var(--v-color-altered,var(--v-color))',
431
+ '--v-color': resolveThemeColor(match[1], theme),
432
+ };
433
+ },
425
434
  ],
426
435
  [
427
436
  /^color-lighten-(\d+\.?\d*)$/,
@@ -439,6 +448,9 @@ export default function presetAglio({
439
448
  /^bg-(.*)$/,
440
449
  (match, ctx) => {
441
450
  const { theme } = ctx;
451
+ if (match[1] === 'inherit') {
452
+ return { 'background-color': 'var(--v-bg-altered,var(--v-bg))' };
453
+ }
442
454
  const resolvedColor = resolveThemeColor(match[1], theme);
443
455
  if (resolvedColor === null) {
444
456
  return baseBgRule[1](match, ctx);
@@ -607,12 +619,13 @@ export default function presetAglio({
607
619
  const lemon = themeVars({
608
620
  primary: 'yellow',
609
621
  accent: 'green',
610
- grayTweak: -20,
622
+ grayTweak: -10,
611
623
  });
612
624
  const leek = themeVars({
613
625
  primary: 'green',
614
626
  accent: 'blue',
615
627
  grayTweak: 20,
628
+ primaryWashSaturation: 0.95,
616
629
  });
617
630
  const tomato = themeVars({
618
631
  primary: 'magenta',
@@ -636,6 +649,7 @@ export default function presetAglio({
636
649
  wash: 'white',
637
650
  light: 'true-gray-wash',
638
651
  dark: 'true-gray',
652
+ ink: 'true-gray-dark',
639
653
  },
640
654
  globalSaturation: 0,
641
655
  });
@@ -650,6 +664,7 @@ export default function presetAglio({
650
664
  --color-gray: var(--palette-gray);
651
665
  --color-gray-dark: var(--palette-gray-dark);
652
666
  --color-gray-light: var(--palette-gray-light);
667
+ --color-gray-ink: var(--color-black);
653
668
  --palette-gray-1: var(--color-gray-wash);
654
669
  --palette-gray-2: var(--color-gray-light);
655
670
  --palette-gray-3: var(--color-gray-light);
@@ -691,7 +706,7 @@ export default function presetAglio({
691
706
  --palette-magenta-20: hsl(from #804020 calc(h - 20) s l);
692
707
  --palette-magenta-10: hsl(from #702604 calc(h - 20) s l);
693
708
  --palette-magenta-00: hsl(from rgb(37, 28, 25) calc(h - 20) s l);
694
- --palette-green-90:rgb(242, 251, 247);
709
+ --palette-green-90:rgb(240, 255, 248);
695
710
  --palette-green-80: #c2ffe9;
696
711
  --palette-green-70: #92f2d1;
697
712
  --palette-green-60: #86efc8;
@@ -963,7 +978,7 @@ function asPaletteValue(num: number) {
963
978
  return roundTens(num).toString().padStart(2, '0');
964
979
  }
965
980
  function generateColors(from: number, to: number) {
966
- const increment = (to - from) / 3;
981
+ const increment = (to - from) / 4;
967
982
  const map = themeColors.reduce(
968
983
  (acc, color) => {
969
984
  acc[`--color-${color}-wash`] = `var(--palette-${color}-${asPaletteValue(
@@ -978,6 +993,9 @@ function generateColors(from: number, to: number) {
978
993
  acc[`--color-${color}-dark`] = `var(--palette-${color}-${asPaletteValue(
979
994
  from + roundTens(increment * 3),
980
995
  )})`;
996
+ acc[`--color-${color}-ink`] = `var(--palette-${color}-${asPaletteValue(
997
+ from + roundTens(increment * 4),
998
+ )})`;
981
999
  return acc;
982
1000
  },
983
1001
  {} as Record<string, string>,
@@ -1060,16 +1078,22 @@ function themeVars({
1060
1078
  accent,
1061
1079
  grayTweak,
1062
1080
  globalSaturation,
1081
+ primaryWashSaturation,
1063
1082
  }: {
1064
1083
  primary: string | ExplicitColorRange;
1065
1084
  accent: string | ExplicitColorRange;
1066
1085
  grayTweak?: number;
1067
1086
  globalSaturation?: number;
1087
+ primaryWashSaturation?: number;
1068
1088
  }) {
1069
1089
  return `
1070
1090
  ${themeVarRange({ name: 'attention', range: 'red' })}
1071
1091
  ${themeVarRange({ name: 'accent', range: accent })}
1072
- ${themeVarRange({ name: 'primary', range: primary })}
1092
+ ${themeVarRange({
1093
+ name: 'primary',
1094
+ range: primary,
1095
+ washSaturation: primaryWashSaturation,
1096
+ })}
1073
1097
 
1074
1098
  --gray-hue-tweak: ${grayTweak ?? 0};
1075
1099
  ${
@@ -1085,23 +1109,35 @@ type ExplicitColorRange = {
1085
1109
  wash: string;
1086
1110
  light: string;
1087
1111
  dark: string;
1112
+ ink: string;
1088
1113
  };
1089
1114
  function themeVarRange({
1090
1115
  name,
1091
1116
  range,
1117
+ washSaturation = 1,
1092
1118
  }: {
1093
1119
  name: string;
1094
1120
  range: string | ExplicitColorRange;
1121
+ washSaturation?: number;
1095
1122
  }) {
1096
- if (typeof range === 'string') {
1097
- return `--color-${name}: var(--color-${range});
1098
- --color-${name}-wash: var(--color-${range}-wash);
1099
- --color-${name}-light: var(--color-${range}-light);
1100
- --color-${name}-dark: var(--color-${range}-dark);`;
1101
- }
1123
+ const realRange =
1124
+ typeof range === 'string'
1125
+ ? {
1126
+ default: range,
1127
+ wash: `${range}-wash`,
1128
+ light: `${range}-light`,
1129
+ dark: `${range}-dark`,
1130
+ ink: `${range}-ink`,
1131
+ }
1132
+ : range;
1102
1133
 
1103
- return `--color-${name}: var(--color-${range.default});
1104
- --color-${name}-wash: var(--color-${range.wash});
1105
- --color-${name}-light: var(--color-${range.light});
1106
- --color-${name}-dark: var(--color-${range.dark});`;
1134
+ return `--color-${name}: var(--color-${realRange.default});
1135
+ --color-${name}-wash: ${
1136
+ washSaturation !== 1
1137
+ ? `hsl(from var(--color-${realRange.wash}) h calc(s * ${washSaturation}) l)`
1138
+ : `var(--color-${realRange.wash})`
1139
+ };
1140
+ --color-${name}-light: var(--color-${realRange.light});
1141
+ --color-${name}-dark: var(--color-${realRange.dark});
1142
+ --color-${name}-ink: var(--color-${realRange.ink});`;
1107
1143
  }