@a-type/ui 1.8.10 → 1.8.12
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/dist/cjs/components/box/Box.js +3 -3
- package/dist/cjs/components/box/Box.js.map +1 -1
- package/dist/cjs/components/layouts/PageNowPlaying.js +3 -3
- package/dist/cjs/components/navBar/NavBar.js +1 -1
- package/dist/cjs/components/peek/Peek.js +2 -2
- package/dist/cjs/components/peek/Peek.js.map +1 -1
- package/dist/cjs/components/peek/Peek.stories.d.ts +15 -0
- package/dist/cjs/components/peek/Peek.stories.js +23 -0
- package/dist/cjs/components/peek/Peek.stories.js.map +1 -0
- package/dist/cjs/components/scrollArea/ScrollArea.js +8 -11
- package/dist/cjs/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/cjs/components/typography/typography.js +4 -4
- package/dist/cjs/components/typography/typography.js.map +1 -1
- package/dist/cjs/themes.stories.js +2 -2
- package/dist/cjs/themes.stories.js.map +1 -1
- package/dist/cjs/uno.preset.js +53 -27
- package/dist/cjs/uno.preset.js.map +1 -1
- package/dist/css/main.css +88 -8
- package/dist/esm/components/box/Box.js +3 -3
- package/dist/esm/components/box/Box.js.map +1 -1
- package/dist/esm/components/layouts/PageNowPlaying.js +3 -3
- package/dist/esm/components/navBar/NavBar.js +1 -1
- package/dist/esm/components/peek/Peek.js +3 -3
- package/dist/esm/components/peek/Peek.js.map +1 -1
- package/dist/esm/components/peek/Peek.stories.d.ts +15 -0
- package/dist/esm/components/peek/Peek.stories.js +20 -0
- package/dist/esm/components/peek/Peek.stories.js.map +1 -0
- package/dist/esm/components/scrollArea/ScrollArea.js +8 -11
- package/dist/esm/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/components/typography/typography.js +4 -4
- package/dist/esm/components/typography/typography.js.map +1 -1
- package/dist/esm/themes.stories.js +3 -3
- package/dist/esm/themes.stories.js.map +1 -1
- package/dist/esm/uno.preset.js +53 -27
- package/dist/esm/uno.preset.js.map +1 -1
- package/package.json +1 -1
- package/src/components/box/Box.tsx +3 -3
- package/src/components/layouts/PageNowPlaying.tsx +3 -3
- package/src/components/navBar/NavBar.tsx +1 -1
- package/src/components/peek/Peek.stories.tsx +55 -0
- package/src/components/peek/Peek.tsx +12 -5
- package/src/components/scrollArea/ScrollArea.tsx +8 -19
- package/src/components/typography/typography.tsx +4 -4
- package/src/themes.stories.tsx +72 -30
- package/src/uno.preset.ts +61 -25
package/package.json
CHANGED
|
@@ -172,11 +172,11 @@ export function Box({
|
|
|
172
172
|
'layer-components:(bg-white border-black)':
|
|
173
173
|
surface === true || surface === 'default',
|
|
174
174
|
'layer-components:(bg-wash border-black)': surface === 'wash',
|
|
175
|
-
'layer-components:(bg-primary-wash border-primary-dark color-primary-
|
|
175
|
+
'layer-components:(bg-primary-wash border-primary-dark color-primary-ink)':
|
|
176
176
|
surface === 'primary',
|
|
177
|
-
'layer-components:(bg-accent-wash border-accent-dark color-accent-
|
|
177
|
+
'layer-components:(bg-accent-wash border-accent-dark color-accent-ink)':
|
|
178
178
|
surface === 'accent',
|
|
179
|
-
'layer-components:(bg-attention-wash border-attention-dark color-attention-
|
|
179
|
+
'layer-components:(bg-attention-wash border-attention-dark color-attention-ink)':
|
|
180
180
|
surface === 'attention',
|
|
181
181
|
'layer-components:(border border-solid rounded-lg)': border,
|
|
182
182
|
'layer-components:w-full': full === true || full === 'width',
|
|
@@ -26,16 +26,16 @@ export function PageNowPlaying({
|
|
|
26
26
|
// or at minimum in the safe area
|
|
27
27
|
'layer-components:bottom-[var(--nav-height,env(safe-area-inset-bottom,0px))]',
|
|
28
28
|
'layer-components:transition-bottom',
|
|
29
|
-
'layer-components:
|
|
29
|
+
'layer-components:md:(fixed bottom-3 left-[var(--content-left,20%)] transition-opacity top-auto items-end w-[var(--content-width,100%)] max-w-80vw p-0 opacity-[var(--content-ready,0)])',
|
|
30
30
|
unstyled
|
|
31
31
|
? 'layer-variants:p-2'
|
|
32
32
|
: 'layer-components:(bg-wash p-2px rounded-xl border-light shadow-md min-w-32px items-center justify-center m-2 w-auto)',
|
|
33
33
|
keepAboveKeyboard &&
|
|
34
34
|
virtualKeyboardBehavior === 'overlay' &&
|
|
35
|
-
'layer-variants:lt-
|
|
35
|
+
'layer-variants:lt-md:bottom-[max(var(--mock-virtual-keyboard-height,env(keyboard-inset-height,0px),var(--nav-height,env(safe-area-inset-bottom,0px))))]',
|
|
36
36
|
keepAboveKeyboard &&
|
|
37
37
|
virtualKeyboardBehavior === 'displace' &&
|
|
38
|
-
'layer-variants:lt-
|
|
38
|
+
'layer-variants:lt-md:bottom-[max(var(--viewport-bottom-offset,0px),var(--nav-height,env(safe-area-inset-bottom,0px)))]',
|
|
39
39
|
className,
|
|
40
40
|
)}
|
|
41
41
|
/>
|
|
@@ -5,7 +5,7 @@ import { withClassName } from '../../hooks.js';
|
|
|
5
5
|
import { Icon, IconProps } from '../icon/index.js';
|
|
6
6
|
|
|
7
7
|
export const navBarItemClass = classNames(
|
|
8
|
-
'layer-components:(flex flex-col items-center justify-center whitespace-nowrap py-1 px-3 bg-transparent rounded-
|
|
8
|
+
'layer-components:(flex flex-col items-center justify-center whitespace-nowrap py-1 px-3 bg-transparent rounded-sm border-none cursor-pointer text-sm transition-colors h-full gap-6px relative color-black select-none)',
|
|
9
9
|
'layer-components:active:bg-darken-2',
|
|
10
10
|
'layer-components:hover:bg-darken-1',
|
|
11
11
|
'layer-components:focus-visible:(outline-none bg-darken-3)',
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Box } from '../box/Box.js';
|
|
3
|
+
import { P } from '../typography/typography.js';
|
|
4
|
+
import { Peek } from './Peek.js';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Peek',
|
|
8
|
+
component: Peek,
|
|
9
|
+
argTypes: {},
|
|
10
|
+
parameters: {
|
|
11
|
+
controls: { expanded: true },
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof Peek>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof Peek>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
render(args) {
|
|
21
|
+
return (
|
|
22
|
+
<Peek {...args}>
|
|
23
|
+
<Box d="col">
|
|
24
|
+
<P>
|
|
25
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
|
|
26
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
|
|
27
|
+
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
28
|
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
29
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
30
|
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
|
31
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
|
32
|
+
</P>
|
|
33
|
+
<P>
|
|
34
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
|
|
35
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
|
|
36
|
+
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
37
|
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
38
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
39
|
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
|
40
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
|
41
|
+
</P>
|
|
42
|
+
<P>
|
|
43
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
|
|
44
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
|
|
45
|
+
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
46
|
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
47
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
48
|
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
|
49
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
|
50
|
+
</P>
|
|
51
|
+
</Box>
|
|
52
|
+
</Peek>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { debounce } from '@a-type/utils';
|
|
2
2
|
import classNames from 'clsx';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ReactNode,
|
|
5
|
+
useId,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from 'react';
|
|
4
11
|
import { useSize } from '../../hooks/useSize.js';
|
|
5
12
|
import { useToggle } from '../../hooks/useToggle.js';
|
|
6
13
|
|
|
@@ -31,7 +38,7 @@ export function Peek({ peekHeight = 120, children, className }: PeekProps) {
|
|
|
31
38
|
|
|
32
39
|
const [open, toggle] = useToggle(false);
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
useLayoutEffect(() => {
|
|
35
42
|
if (containerRef.current) {
|
|
36
43
|
containerRef.current.style.setProperty(
|
|
37
44
|
'--peek-height',
|
|
@@ -45,7 +52,7 @@ export function Peek({ peekHeight = 120, children, className }: PeekProps) {
|
|
|
45
52
|
return (
|
|
46
53
|
<div
|
|
47
54
|
className={classNames(
|
|
48
|
-
'relative animate-ease-default animate-forwards overflow-hidden [&[data-state=closed]]:(animate-keyframes-peek-close animate-duration-300 max-h-[var(--peek-height,120px)]) [&[data-state=open]]:(animate-keyframes-peek-open animate-duration-600)',
|
|
55
|
+
'relative animate-ease-default animate-forwards overflow-hidden [&[data-state=closed]]:(animate-keyframes-peek-close animate-duration-300 max-h-[var(--peek-height,120px)]) [&[data-state=open]]:(animate-keyframes-peek-open animate-duration-600 animate-forwards)',
|
|
49
56
|
className,
|
|
50
57
|
)}
|
|
51
58
|
ref={containerRef}
|
|
@@ -58,8 +65,8 @@ export function Peek({ peekHeight = 120, children, className }: PeekProps) {
|
|
|
58
65
|
<button
|
|
59
66
|
data-state={open ? 'open' : 'closed'}
|
|
60
67
|
className={classNames(
|
|
61
|
-
'h-80px absolute bottom-0 z-1 bg-transparent border-none w-full cursor-pointer border-b border-solid border-white',
|
|
62
|
-
'focus-visible:(outline-none bg-gradient-to-b from-transparent to-primary-wash border-b border-solid border-primary',
|
|
68
|
+
'h-80px absolute bottom-0 z-1 bg-transparent border-none w-full cursor-pointer border-b border-b-solid border-white',
|
|
69
|
+
'focus-visible:(outline-none bg-gradient-to-b from-transparent to-primary-wash border-b border-b-solid border-primary',
|
|
63
70
|
'after:(content-["-_tap_to_expand_-"] p-3 color-gray-dark text-xs flex flex-col justify-end items-center absolute inset-0 top-auto h-80px bg-gradient-to-b from-transparent to-white)',
|
|
64
71
|
'after:[&[data-state=open]]:content-["-_tap_to_collapse_-"]',
|
|
65
72
|
)}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import * as Primitive from '@radix-ui/react-scroll-area';
|
|
2
|
-
import { Ref
|
|
2
|
+
import { Ref } from 'react';
|
|
3
3
|
import { withClassName } from '../../hooks.js';
|
|
4
4
|
|
|
5
|
-
const ScrollAreaRootImpl = withClassName(
|
|
6
|
-
Primitive.Root,
|
|
7
|
-
'overflow-hidden bg-[var(--scroll-bg)] rounded-lg',
|
|
8
|
-
'layer-components:([--scroll-bg:var(--color-wash)] [--scroll-shadow:var(--color-shadow-1))])',
|
|
9
|
-
);
|
|
5
|
+
const ScrollAreaRootImpl = withClassName(Primitive.Root, 'overflow-hidden');
|
|
10
6
|
|
|
11
7
|
export interface ScrollAreaRootProps extends Primitive.ScrollAreaProps {
|
|
12
8
|
background?: 'white' | 'wash' | 'primary-wash' | 'primary' | 'black';
|
|
@@ -15,38 +11,31 @@ export interface ScrollAreaRootProps extends Primitive.ScrollAreaProps {
|
|
|
15
11
|
|
|
16
12
|
export const ScrollAreaRoot = function ScrollAreaRoot({
|
|
17
13
|
ref,
|
|
18
|
-
background
|
|
14
|
+
background,
|
|
19
15
|
...props
|
|
20
16
|
}: ScrollAreaRootProps) {
|
|
21
|
-
|
|
22
|
-
() => ({
|
|
23
|
-
'--scroll-bg': `var(--color-${background})`,
|
|
24
|
-
'--scroll-shadow': `var(--color-${shadowMap[background]})`,
|
|
25
|
-
}),
|
|
26
|
-
[background],
|
|
27
|
-
);
|
|
28
|
-
return <ScrollAreaRootImpl ref={ref} style={bgStyle} {...props} />;
|
|
17
|
+
return <ScrollAreaRootImpl ref={ref} {...props} />;
|
|
29
18
|
};
|
|
30
19
|
|
|
31
20
|
export const ScrollAreaViewport = withClassName(
|
|
32
21
|
Primitive.Viewport,
|
|
33
22
|
'h-full w-full',
|
|
34
|
-
'[background:linear-gradient(var(--
|
|
23
|
+
'[background:linear-gradient(var(--v-bg)_30%,rgba(255,255,255,0))_center_top,linear-gradient(rgba(255,255,255,0),var(--v-bg)_70%)_center_bottom,radial-gradient(farthest-side_at_50%_0,hsl(from_var(--v-bg)_h_s_calc(l*0.9)),rgba(0,0,0,0))_center_top,radial-gradient(farthest-side_at_50%_100%,hsl(from_var(--v-bg)_h_s_calc(l*0.9)),rgba(0,0,0,0))_center_bottom]',
|
|
35
24
|
'![background-repeat:no-repeat] ![background-size:100%_40px,100%_40px,100%_14px,100%_14px]',
|
|
36
25
|
'![background-attachment:local,local,scroll,scroll]',
|
|
37
26
|
);
|
|
38
27
|
|
|
39
28
|
export const ScrollAreaScrollbarRoot = withClassName(
|
|
40
29
|
Primitive.Scrollbar,
|
|
41
|
-
'layer-components:(flex select-none touch-none p-0.5 bg-
|
|
42
|
-
'layer-components:hover:bg-lighten-
|
|
30
|
+
'layer-components:(flex select-none touch-none p-0.5 bg-inherit bg-lighten-4 transition-colors duration-160ms ease-out)',
|
|
31
|
+
// 'layer-components:hover:bg-lighten-4',
|
|
43
32
|
'layer-components:[&[data-orientation=vertical]]:w-2.5',
|
|
44
33
|
'layer-components:[&[data-orientation=horizontal]]:(flex-col h-2.5)',
|
|
45
34
|
);
|
|
46
35
|
|
|
47
36
|
export const ScrollAreaThumb = withClassName(
|
|
48
37
|
Primitive.Thumb,
|
|
49
|
-
'layer-components:(flex-1 rounded-lg relative bg-
|
|
38
|
+
'layer-components:(flex-1 rounded-lg relative bg-inherit bg-darken-8)',
|
|
50
39
|
'before:(content-[""] absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full min-w-44px min-h-44px)',
|
|
51
40
|
);
|
|
52
41
|
|
|
@@ -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-
|
|
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-
|
|
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-
|
|
22
|
+
'layer-components:(text-xs uppercase color-inherit color-lighten-6)',
|
|
23
23
|
);
|
|
24
24
|
export const H5 = withClassName('h5', baseHeadingClass);
|
|
25
25
|
|
package/src/themes.stories.tsx
CHANGED
|
@@ -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
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
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,
|
|
24
|
-
dark: [0,
|
|
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
|
-
|
|
423
|
-
|
|
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: -
|
|
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(
|
|
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) /
|
|
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({
|
|
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
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
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-${
|
|
1104
|
-
--color-${name}-wash:
|
|
1105
|
-
|
|
1106
|
-
|
|
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
|
}
|