sve-ui 0.1.1 → 0.2.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.
- package/dist/ThemeProvider.svelte +46 -0
- package/dist/ThemeProvider.svelte.d.ts +12 -0
- package/dist/ThemeProvider.svelte.d.ts.map +1 -0
- package/dist/components/Alert/AlertDescription.svelte +31 -0
- package/dist/components/Alert/AlertDescription.svelte.d.ts +10 -0
- package/dist/components/Alert/AlertDescription.svelte.d.ts.map +1 -0
- package/dist/components/Alert/AlertRoot.svelte +103 -0
- package/dist/components/Alert/AlertRoot.svelte.d.ts +29 -0
- package/dist/components/Alert/AlertRoot.svelte.d.ts.map +1 -0
- package/dist/components/Alert/AlertTitle.svelte +34 -0
- package/dist/components/Alert/AlertTitle.svelte.d.ts +12 -0
- package/dist/components/Alert/AlertTitle.svelte.d.ts.map +1 -0
- package/dist/components/Alert/index.d.ts +11 -0
- package/dist/components/Alert/index.d.ts.map +1 -0
- package/dist/components/Alert/index.js +10 -0
- package/dist/components/Avatar/AvatarFallback.svelte +33 -0
- package/dist/components/Avatar/AvatarFallback.svelte.d.ts +12 -0
- package/dist/components/Avatar/AvatarFallback.svelte.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarImage.svelte +27 -0
- package/dist/components/Avatar/AvatarImage.svelte.d.ts +12 -0
- package/dist/components/Avatar/AvatarImage.svelte.d.ts.map +1 -0
- package/dist/components/Avatar/AvatarRoot.svelte +67 -0
- package/dist/components/Avatar/AvatarRoot.svelte.d.ts +16 -0
- package/dist/components/Avatar/AvatarRoot.svelte.d.ts.map +1 -0
- package/dist/components/Avatar/index.d.ts +15 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Avatar/index.js +14 -0
- package/dist/components/Badge/Badge.svelte +125 -0
- package/dist/components/Badge/Badge.svelte.d.ts +37 -0
- package/dist/components/Badge/Badge.svelte.d.ts.map +1 -0
- package/dist/components/Button/Button.svelte +296 -112
- package/dist/components/Button/Button.svelte.d.ts +34 -48
- package/dist/components/Button/Button.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardContent.svelte +33 -0
- package/dist/components/Card/CardContent.svelte.d.ts +10 -0
- package/dist/components/Card/CardContent.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardFooter.svelte +33 -0
- package/dist/components/Card/CardFooter.svelte.d.ts +10 -0
- package/dist/components/Card/CardFooter.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardHeader.svelte +33 -0
- package/dist/components/Card/CardHeader.svelte.d.ts +10 -0
- package/dist/components/Card/CardHeader.svelte.d.ts.map +1 -0
- package/dist/components/Card/CardRoot.svelte +91 -0
- package/dist/components/Card/CardRoot.svelte.d.ts +28 -0
- package/dist/components/Card/CardRoot.svelte.d.ts.map +1 -0
- package/dist/components/Card/index.d.ts +13 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Card/index.js +12 -0
- package/dist/components/Dialog/DialogContent.svelte +47 -0
- package/dist/components/Dialog/DialogContent.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogContent.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/DialogDescription.svelte +29 -0
- package/dist/components/Dialog/DialogDescription.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogDescription.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/DialogOverlay.svelte +32 -0
- package/dist/components/Dialog/DialogOverlay.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogOverlay.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/DialogTitle.svelte +30 -0
- package/dist/components/Dialog/DialogTitle.svelte.d.ts +10 -0
- package/dist/components/Dialog/DialogTitle.svelte.d.ts.map +1 -0
- package/dist/components/Dialog/index.d.ts +21 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Dialog/index.js +22 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.svelte +40 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuGroup.svelte +18 -0
- package/dist/components/DropdownMenu/DropdownMenuGroup.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuGroup.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.svelte +40 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.svelte +34 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuLabel.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.svelte +25 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.svelte.d.ts +10 -0
- package/dist/components/DropdownMenu/DropdownMenuSeparator.svelte.d.ts.map +1 -0
- package/dist/components/DropdownMenu/index.d.ts +31 -0
- package/dist/components/DropdownMenu/index.d.ts.map +1 -0
- package/dist/components/DropdownMenu/index.js +33 -0
- package/dist/components/Heading/Heading.svelte +72 -0
- package/dist/components/Heading/Heading.svelte.d.ts +18 -0
- package/dist/components/Heading/Heading.svelte.d.ts.map +1 -0
- package/dist/components/Input/Input.svelte +151 -0
- package/dist/components/Input/Input.svelte.d.ts +25 -0
- package/dist/components/Input/Input.svelte.d.ts.map +1 -0
- package/dist/components/Popover/PopoverContent.svelte +40 -0
- package/dist/components/Popover/PopoverContent.svelte.d.ts +10 -0
- package/dist/components/Popover/PopoverContent.svelte.d.ts.map +1 -0
- package/dist/components/Popover/index.d.ts +20 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +21 -0
- package/dist/components/Spinner/Spinner.svelte +82 -0
- package/dist/components/Spinner/Spinner.svelte.d.ts +13 -0
- package/dist/components/Spinner/Spinner.svelte.d.ts.map +1 -0
- package/dist/components/Text/Text.svelte +84 -45
- package/dist/components/Text/Text.svelte.d.ts +20 -44
- package/dist/components/Text/Text.svelte.d.ts.map +1 -0
- package/dist/components/Tooltip/TooltipContent.svelte +41 -0
- package/dist/components/Tooltip/TooltipContent.svelte.d.ts +10 -0
- package/dist/components/Tooltip/TooltipContent.svelte.d.ts.map +1 -0
- package/dist/components/Tooltip/index.d.ts +19 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/index.js +20 -0
- package/dist/context.d.ts +14 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +16 -0
- package/dist/index.d.ts +29 -19
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -10
- package/dist/internal/variants.d.ts +44 -0
- package/dist/internal/variants.d.ts.map +1 -0
- package/dist/internal/variants.js +54 -0
- package/dist/theme/breakpoints.d.ts +1 -0
- package/dist/theme/breakpoints.d.ts.map +1 -0
- package/dist/theme/index.d.ts +12 -182
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +13 -19
- package/dist/theme/palette.d.ts +153 -0
- package/dist/theme/palette.d.ts.map +1 -0
- package/dist/theme/palette.js +85 -0
- package/dist/theme/radius.d.ts +1 -0
- package/dist/theme/radius.d.ts.map +1 -0
- package/dist/theme/sizes.d.ts +1 -0
- package/dist/theme/sizes.d.ts.map +1 -0
- package/dist/theme/spacing.d.ts +1 -0
- package/dist/theme/spacing.d.ts.map +1 -0
- package/dist/theme/theme.css +268 -0
- package/dist/theme/tokens.d.ts +108 -0
- package/dist/theme/tokens.d.ts.map +1 -0
- package/dist/theme/tokens.js +236 -0
- package/dist/theme/typography.d.ts +1 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/package.json +74 -67
- package/README.md +0 -94
- package/dist/components/Box/Box.svelte +0 -48
- package/dist/components/Box/Box.svelte.d.ts +0 -160
- package/dist/components/Center/Center.svelte +0 -15
- package/dist/components/Center/Center.svelte.d.ts +0 -25
- package/dist/components/Circle/Circle.svelte +0 -9
- package/dist/components/Circle/Circle.svelte.d.ts +0 -34
- package/dist/components/CodeExample/CodeExample.svelte +0 -128
- package/dist/components/CodeExample/CodeExample.svelte.d.ts +0 -46
- package/dist/components/Flex/Flex.svelte +0 -26
- package/dist/components/Flex/Flex.svelte.d.ts +0 -34
- package/dist/components/Grid/Grid.svelte +0 -16
- package/dist/components/Grid/Grid.svelte.d.ts +0 -44
- package/dist/components/GridItem/GridItem.svelte +0 -22
- package/dist/components/GridItem/GridItem.svelte.d.ts +0 -29
- package/dist/components/Loaders/DotPulse.svelte +0 -62
- package/dist/components/Loaders/DotPulse.svelte.d.ts +0 -40
- package/dist/components/Loaders/DotSpinner.svelte +0 -121
- package/dist/components/Loaders/DotSpinner.svelte.d.ts +0 -40
- package/dist/components/Loaders/DotWave.svelte +0 -67
- package/dist/components/Loaders/DotWave.svelte.d.ts +0 -40
- package/dist/components/Spacer/Spacer.svelte +0 -5
- package/dist/components/Spacer/Spacer.svelte.d.ts +0 -21
- package/dist/components/Square/Square.svelte +0 -17
- package/dist/components/Square/Square.svelte.d.ts +0 -34
- /package/{LICENCE → LICENSE} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
5
|
+
type Color = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'default';
|
|
6
|
+
|
|
7
|
+
interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'class' | 'role'> {
|
|
8
|
+
size?: Size;
|
|
9
|
+
color?: Color;
|
|
10
|
+
label?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
size = 'md',
|
|
16
|
+
color = 'default',
|
|
17
|
+
label = 'Loading',
|
|
18
|
+
class: cls,
|
|
19
|
+
...rest
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
const className = $derived(
|
|
23
|
+
[
|
|
24
|
+
'sve-spinner',
|
|
25
|
+
`sve-spinner--${size}`,
|
|
26
|
+
`sve-c-${color}`,
|
|
27
|
+
cls ?? '',
|
|
28
|
+
]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(' ')
|
|
31
|
+
);
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<span role="status" class={className} aria-label={label} {...rest}>
|
|
35
|
+
<span class="sve-spinner__track" aria-hidden="true"></span>
|
|
36
|
+
</span>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
.sve-spinner {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
position: relative;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* --- Sizes --- */
|
|
47
|
+
.sve-spinner--sm { width: 1rem; height: 1rem; }
|
|
48
|
+
.sve-spinner--md { width: 1.5rem; height: 1.5rem; }
|
|
49
|
+
.sve-spinner--lg { width: 2.5rem; height: 2.5rem; }
|
|
50
|
+
|
|
51
|
+
/* --- Track (the spinning ring) --- */
|
|
52
|
+
.sve-spinner__track {
|
|
53
|
+
display: block;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
border-radius: var(--sve-radius-full);
|
|
57
|
+
border: 2px solid transparent;
|
|
58
|
+
border-top-color: currentColor;
|
|
59
|
+
border-right-color: currentColor;
|
|
60
|
+
animation: sve-spin 0.7s linear infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* --- Colors via currentColor --- */
|
|
64
|
+
.sve-c-primary { color: var(--sve-color-primary); }
|
|
65
|
+
.sve-c-secondary { color: var(--sve-color-secondary); }
|
|
66
|
+
.sve-c-success { color: var(--sve-color-success); }
|
|
67
|
+
.sve-c-warning { color: var(--sve-color-warning); }
|
|
68
|
+
.sve-c-danger { color: var(--sve-color-danger); }
|
|
69
|
+
.sve-c-default { color: var(--sve-color-default-foreground); }
|
|
70
|
+
|
|
71
|
+
/* Respect the user's motion preference */
|
|
72
|
+
@media (prefers-reduced-motion: reduce) {
|
|
73
|
+
.sve-spinner__track {
|
|
74
|
+
animation: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes sve-spin {
|
|
79
|
+
from { transform: rotate(0deg); }
|
|
80
|
+
to { transform: rotate(360deg); }
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
3
|
+
type Color = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'default';
|
|
4
|
+
interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'class' | 'role'> {
|
|
5
|
+
size?: Size;
|
|
6
|
+
color?: Color;
|
|
7
|
+
label?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Spinner: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Spinner = ReturnType<typeof Spinner>;
|
|
12
|
+
export default Spinner;
|
|
13
|
+
//# sourceMappingURL=Spinner.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Spinner/Spinner.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/B,KAAK,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpF,UAAU,KAAM,SAAQ,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7E,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmCH,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -1,51 +1,90 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type As = 'p' | 'span' | 'div' | 'label' | 'strong' | 'em' | 'small' | 'li' | 'dt' | 'dd' | 'figcaption' | 'address' | 'cite' | 'code' | 'abbr' | 'time' | 'q' | 'blockquote' | 'pre';
|
|
6
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
7
|
+
type Weight = 'normal' | 'medium' | 'bold';
|
|
8
|
+
type Align = 'left' | 'center' | 'right' | 'justify';
|
|
9
|
+
type Color = 'inherit' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'default';
|
|
10
|
+
|
|
11
|
+
interface Props extends Omit<HTMLAttributes<HTMLElement>, 'class'> {
|
|
12
|
+
as?: As;
|
|
13
|
+
size?: Size;
|
|
14
|
+
weight?: Weight;
|
|
15
|
+
color?: Color;
|
|
16
|
+
align?: Align;
|
|
17
|
+
truncate?: boolean;
|
|
18
|
+
class?: string;
|
|
19
|
+
children?: Snippet;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
as = 'p',
|
|
24
|
+
size,
|
|
25
|
+
weight,
|
|
26
|
+
color = 'inherit',
|
|
27
|
+
align,
|
|
28
|
+
truncate = false,
|
|
29
|
+
class: cls,
|
|
30
|
+
children,
|
|
31
|
+
...rest
|
|
32
|
+
}: Props = $props();
|
|
33
|
+
|
|
34
|
+
const className = $derived(
|
|
35
|
+
[
|
|
36
|
+
'sve-text',
|
|
37
|
+
size ? `sve-text--${size}` : '',
|
|
38
|
+
weight ? `sve-text--${weight}` : '',
|
|
39
|
+
color !== 'inherit' ? `sve-c-${color}` : '',
|
|
40
|
+
align ? `sve-text--${align}` : '',
|
|
41
|
+
truncate ? 'sve-text--truncate' : '',
|
|
42
|
+
cls ?? '',
|
|
43
|
+
]
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.join(' ')
|
|
46
|
+
);
|
|
11
47
|
</script>
|
|
12
48
|
|
|
13
|
-
<svelte:element
|
|
14
|
-
|
|
15
|
-
style={`
|
|
16
|
-
font-size: ${theme.fontSizes[fontSize]};
|
|
17
|
-
color: ${color};
|
|
18
|
-
font-weight: ${theme.fontWeights[fontWeight]};
|
|
19
|
-
font-style: ${fontStyle};
|
|
20
|
-
text-decoration: ${textDecoration};
|
|
21
|
-
letter-spacing: ${theme.letterSpacings[letterSpacing]};
|
|
22
|
-
line-height: ${lineHeight};
|
|
23
|
-
text-align: ${textAlign};
|
|
24
|
-
`}
|
|
25
|
-
>
|
|
26
|
-
<slot />
|
|
49
|
+
<svelte:element this={as} class={className} {...rest}>
|
|
50
|
+
{@render children?.()}
|
|
27
51
|
</svelte:element>
|
|
28
52
|
|
|
29
53
|
<style>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
.sve-text {
|
|
55
|
+
font-family: var(--sve-font-family-sans);
|
|
56
|
+
line-height: var(--sve-line-height-normal);
|
|
57
|
+
margin: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* --- Sizes --- */
|
|
61
|
+
.sve-text--sm { font-size: var(--sve-font-size-sm); }
|
|
62
|
+
.sve-text--md { font-size: var(--sve-font-size-md); }
|
|
63
|
+
.sve-text--lg { font-size: var(--sve-font-size-lg); }
|
|
64
|
+
|
|
65
|
+
/* --- Weights --- */
|
|
66
|
+
.sve-text--normal { font-weight: var(--sve-font-weight-normal); }
|
|
67
|
+
.sve-text--medium { font-weight: var(--sve-font-weight-medium); }
|
|
68
|
+
.sve-text--bold { font-weight: var(--sve-font-weight-bold); }
|
|
69
|
+
|
|
70
|
+
/* --- Alignment --- */
|
|
71
|
+
.sve-text--left { text-align: left; }
|
|
72
|
+
.sve-text--center { text-align: center; }
|
|
73
|
+
.sve-text--right { text-align: right; }
|
|
74
|
+
.sve-text--justify { text-align: justify; }
|
|
75
|
+
|
|
76
|
+
/* --- Truncate --- */
|
|
77
|
+
.sve-text--truncate {
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* --- Semantic colors --- */
|
|
84
|
+
.sve-c-primary { color: var(--sve-color-primary); }
|
|
85
|
+
.sve-c-secondary { color: var(--sve-color-secondary); }
|
|
86
|
+
.sve-c-success { color: var(--sve-color-success); }
|
|
87
|
+
.sve-c-warning { color: var(--sve-color-warning-foreground); }
|
|
88
|
+
.sve-c-danger { color: var(--sve-color-danger); }
|
|
89
|
+
.sve-c-default { color: var(--sve-color-default-foreground); }
|
|
51
90
|
</style>
|
|
@@ -1,45 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fontStyle?: string | undefined;
|
|
18
|
-
textDecoration?: string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* @default "normal"
|
|
21
|
-
*/
|
|
22
|
-
letterSpacing?: "normal" | "tighter" | "tight" | "wide" | "wider" | "widest" | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* @default "normal"
|
|
25
|
-
*/
|
|
26
|
-
lineHeight?: string | undefined;
|
|
27
|
-
textAlign?: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
events: {
|
|
30
|
-
[evt: string]: CustomEvent<any>;
|
|
31
|
-
};
|
|
32
|
-
slots: {
|
|
33
|
-
default: {};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export type TextProps = typeof __propDef.props;
|
|
37
|
-
export type TextEvents = typeof __propDef.events;
|
|
38
|
-
export type TextSlots = typeof __propDef.slots;
|
|
39
|
-
/**
|
|
40
|
-
* Text is the used to render text and paragraphs of text.
|
|
41
|
-
* @see Docs https://sveui.org/components/text
|
|
42
|
-
*/
|
|
43
|
-
export default class Text extends SvelteComponentTyped<TextProps, TextEvents, TextSlots> {
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type As = 'p' | 'span' | 'div' | 'label' | 'strong' | 'em' | 'small' | 'li' | 'dt' | 'dd' | 'figcaption' | 'address' | 'cite' | 'code' | 'abbr' | 'time' | 'q' | 'blockquote' | 'pre';
|
|
4
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
5
|
+
type Weight = 'normal' | 'medium' | 'bold';
|
|
6
|
+
type Align = 'left' | 'center' | 'right' | 'justify';
|
|
7
|
+
type Color = 'inherit' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'default';
|
|
8
|
+
interface Props extends Omit<HTMLAttributes<HTMLElement>, 'class'> {
|
|
9
|
+
as?: As;
|
|
10
|
+
size?: Size;
|
|
11
|
+
weight?: Weight;
|
|
12
|
+
color?: Color;
|
|
13
|
+
align?: Align;
|
|
14
|
+
truncate?: boolean;
|
|
15
|
+
class?: string;
|
|
16
|
+
children?: Snippet;
|
|
44
17
|
}
|
|
45
|
-
|
|
18
|
+
declare const Text: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type Text = ReturnType<typeof Text>;
|
|
20
|
+
export default Text;
|
|
21
|
+
//# sourceMappingURL=Text.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Text/Text.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGpC,KAAK,EAAE,GAAG,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,GAAG,YAAY,GAAG,KAAK,CAAC;AACtL,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/B,KAAK,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC3C,KAAK,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AACrD,KAAK,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhG,UAAU,KAAM,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAChE,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA8CH,QAAA,MAAM,IAAI,2CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip } from 'bits-ui';
|
|
3
|
+
import type { ComponentProps } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type BitsContentProps = ComponentProps<typeof Tooltip.Content>;
|
|
6
|
+
|
|
7
|
+
interface Props extends Omit<BitsContentProps, 'class'> {
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: cls, children, ...rest }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<!--
|
|
15
|
+
TooltipContent renders via a Portal (managed by bits-ui) that wraps:
|
|
16
|
+
Tooltip.Content — the floating content element with ARIA and positioning via Bits UI.
|
|
17
|
+
|
|
18
|
+
Portal defaults to document.body, keeping z-index stacking clean.
|
|
19
|
+
-->
|
|
20
|
+
<Tooltip.Portal>
|
|
21
|
+
<Tooltip.Content
|
|
22
|
+
class={['sve-tooltip-content', cls].filter(Boolean).join(' ')}
|
|
23
|
+
{children}
|
|
24
|
+
{...rest}
|
|
25
|
+
/>
|
|
26
|
+
</Tooltip.Portal>
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
:global(.sve-tooltip-content) {
|
|
30
|
+
background-color: var(--sve-color-default-foreground, #1a202c);
|
|
31
|
+
color: var(--sve-color-default-surface, #f7fafc);
|
|
32
|
+
border-radius: var(--sve-radius-sm);
|
|
33
|
+
padding: var(--sve-space-1) var(--sve-space-2);
|
|
34
|
+
font-size: var(--sve-font-size-xs);
|
|
35
|
+
box-shadow: var(--sve-shadow-md);
|
|
36
|
+
/* z-index convention: Dialog overlay=50/content=51, Dropdown/Popover=60, Tooltip=70 */
|
|
37
|
+
z-index: 70;
|
|
38
|
+
max-width: 20rem;
|
|
39
|
+
word-break: break-word;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Tooltip } from 'bits-ui';
|
|
2
|
+
import type { ComponentProps } from 'svelte';
|
|
3
|
+
type BitsContentProps = ComponentProps<typeof Tooltip.Content>;
|
|
4
|
+
interface Props extends Omit<BitsContentProps, 'class'> {
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const TooltipContent: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type TooltipContent = ReturnType<typeof TooltipContent>;
|
|
9
|
+
export default TooltipContent;
|
|
10
|
+
//# sourceMappingURL=TooltipContent.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipContent.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Tooltip/TooltipContent.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG3C,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/D,UAAU,KAAM,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmBH,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip namespace — sve-ui styled wrappers over bits-ui Tooltip primitives.
|
|
3
|
+
*
|
|
4
|
+
* Provider, Root, Trigger: re-exported as-is (behavior-only, Bits UI owns ARIA + timing).
|
|
5
|
+
* Content: styled wrapper adding --sve-* token styles.
|
|
6
|
+
* Content wraps Portal + Bits Content internally (consumers don't manage portaling).
|
|
7
|
+
*
|
|
8
|
+
* Confirmed Bits UI 2.x API:
|
|
9
|
+
* import { Tooltip } from 'bits-ui'
|
|
10
|
+
* Tooltip.Provider / Root / Trigger / Content / Portal
|
|
11
|
+
*/
|
|
12
|
+
import type { Component } from 'svelte';
|
|
13
|
+
import type { TooltipProviderProps, TooltipRootProps, TooltipTriggerProps, TooltipArrowProps } from 'bits-ui';
|
|
14
|
+
export declare const Provider: Component<TooltipProviderProps>;
|
|
15
|
+
export declare const Root: Component<TooltipRootProps>;
|
|
16
|
+
export declare const Trigger: Component<TooltipTriggerProps>;
|
|
17
|
+
export declare const Arrow: Component<TooltipArrowProps>;
|
|
18
|
+
export { default as Content } from './TooltipContent.svelte';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,QAAQ,EAAE,SAAS,CAAC,oBAAoB,CAA2D,CAAC;AACjH,eAAO,MAAM,IAAI,EAAE,SAAS,CAAC,gBAAgB,CAAmD,CAAC;AACjG,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,mBAAmB,CAAyD,CAAC;AAE7G,eAAO,MAAM,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAqD,CAAC;AAErG,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip namespace — sve-ui styled wrappers over bits-ui Tooltip primitives.
|
|
3
|
+
*
|
|
4
|
+
* Provider, Root, Trigger: re-exported as-is (behavior-only, Bits UI owns ARIA + timing).
|
|
5
|
+
* Content: styled wrapper adding --sve-* token styles.
|
|
6
|
+
* Content wraps Portal + Bits Content internally (consumers don't manage portaling).
|
|
7
|
+
*
|
|
8
|
+
* Confirmed Bits UI 2.x API:
|
|
9
|
+
* import { Tooltip } from 'bits-ui'
|
|
10
|
+
* Tooltip.Provider / Root / Trigger / Content / Portal
|
|
11
|
+
*/
|
|
12
|
+
import { Tooltip as BitsTooltip } from 'bits-ui';
|
|
13
|
+
// Behavior re-exports — cast to portable Component types to avoid referencing
|
|
14
|
+
// bits-ui internal $$IsomorphicComponent (Svelte 4 generic pattern) in the exported declaration.
|
|
15
|
+
export const Provider = BitsTooltip.Provider;
|
|
16
|
+
export const Root = BitsTooltip.Root;
|
|
17
|
+
export const Trigger = BitsTooltip.Trigger;
|
|
18
|
+
// Arrow: bits-ui floating-ui arrow for visual pointer; positioning is automatic.
|
|
19
|
+
export const Arrow = BitsTooltip.Arrow;
|
|
20
|
+
export { default as Content } from './TooltipContent.svelte';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ThemeContext {
|
|
2
|
+
readonly colorScheme: 'light' | 'dark' | 'system';
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Sets the theme context for the current component tree.
|
|
6
|
+
* Call this in the ThemeProvider component's script section.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setThemeContext(ctx: ThemeContext): void;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the theme context set by a parent ThemeProvider.
|
|
11
|
+
* Returns undefined if no ThemeProvider is in the tree.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useTheme(): ThemeContext | undefined;
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/lib/context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CACnD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAEvD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,YAAY,GAAG,SAAS,CAEnD"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { setContext, getContext } from 'svelte';
|
|
2
|
+
const THEME_CONTEXT_KEY = Symbol('sve-ui:theme');
|
|
3
|
+
/**
|
|
4
|
+
* Sets the theme context for the current component tree.
|
|
5
|
+
* Call this in the ThemeProvider component's script section.
|
|
6
|
+
*/
|
|
7
|
+
export function setThemeContext(ctx) {
|
|
8
|
+
setContext(THEME_CONTEXT_KEY, ctx);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves the theme context set by a parent ThemeProvider.
|
|
12
|
+
* Returns undefined if no ThemeProvider is in the tree.
|
|
13
|
+
*/
|
|
14
|
+
export function useTheme() {
|
|
15
|
+
return getContext(THEME_CONTEXT_KEY);
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sve-ui main entry point.
|
|
3
|
+
*
|
|
4
|
+
* Exports: ThemeProvider, Button, Dialog namespace, Text, Heading, Badge, Avatar, Spinner,
|
|
5
|
+
* Card namespace, Alert namespace, Input,
|
|
6
|
+
* variant helper + types, theme types.
|
|
7
|
+
*/
|
|
8
|
+
export { default as ThemeProvider } from './ThemeProvider.svelte';
|
|
1
9
|
export { default as Button } from './components/Button/Button.svelte';
|
|
2
|
-
export
|
|
3
|
-
export { default as
|
|
4
|
-
export
|
|
5
|
-
export { default as
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export {
|
|
16
|
-
export type
|
|
17
|
-
export {
|
|
18
|
-
export type
|
|
19
|
-
export {
|
|
20
|
-
export type
|
|
10
|
+
export { default as Text } from './components/Text/Text.svelte';
|
|
11
|
+
export { default as Heading } from './components/Heading/Heading.svelte';
|
|
12
|
+
export { default as Badge } from './components/Badge/Badge.svelte';
|
|
13
|
+
export { default as Spinner } from './components/Spinner/Spinner.svelte';
|
|
14
|
+
export { default as Input } from './components/Input/Input.svelte';
|
|
15
|
+
export * as Dialog from './components/Dialog/index.js';
|
|
16
|
+
export * as DropdownMenu from './components/DropdownMenu/index.js';
|
|
17
|
+
export * as Tooltip from './components/Tooltip/index.js';
|
|
18
|
+
export * as Popover from './components/Popover/index.js';
|
|
19
|
+
export * as Avatar from './components/Avatar/index.js';
|
|
20
|
+
export * as Card from './components/Card/index.js';
|
|
21
|
+
export * as Alert from './components/Alert/index.js';
|
|
22
|
+
export { buttonVariants } from './components/Button/Button.svelte';
|
|
23
|
+
export { badgeVariants, type Variant as BadgeVariant, type Color as BadgeColor, type Size as BadgeSize } from './components/Badge/Badge.svelte';
|
|
24
|
+
export { cardVariants, type Variant as CardVariant, type Padding as CardPadding } from './components/Card/CardRoot.svelte';
|
|
25
|
+
export { alertVariants, type Color as AlertColor, type Variant as AlertVariant } from './components/Alert/AlertRoot.svelte';
|
|
26
|
+
export { inputVariants, type Size as InputSize, type Variant as InputVariant } from './components/Input/Input.svelte';
|
|
27
|
+
export { defineVariants, type VariantSchema, type VariantConfig, type VariantProps, } from './internal/variants';
|
|
28
|
+
export { useTheme, type ThemeContext } from './context';
|
|
29
|
+
export { lightTokens, darkTokens, themeToVars, type SveTheme, type PartialSveTheme, type SveColors, type SveColorRole, type SveSpacing, type SveRadius, type SveTypography, } from './theme/tokens';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AAGvD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAC;AAGnE,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAGzD,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAGzD,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AAGvD,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,IAAI,YAAY,EAAE,KAAK,KAAK,IAAI,UAAU,EAAE,KAAK,IAAI,IAAI,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGhJ,OAAO,EAAE,YAAY,EAAE,KAAK,OAAO,IAAI,WAAW,EAAE,KAAK,OAAO,IAAI,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAG3H,OAAO,EAAE,aAAa,EAAE,KAAK,KAAK,IAAI,UAAU,EAAE,KAAK,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAG5H,OAAO,EAAE,aAAa,EAAE,KAAK,IAAI,IAAI,SAAS,EAAE,KAAK,OAAO,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGtH,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* sve-ui main entry point.
|
|
3
|
+
*
|
|
4
|
+
* Exports: ThemeProvider, Button, Dialog namespace, Text, Heading, Badge, Avatar, Spinner,
|
|
5
|
+
* Card namespace, Alert namespace, Input,
|
|
6
|
+
* variant helper + types, theme types.
|
|
7
|
+
*/
|
|
8
|
+
// Components
|
|
9
|
+
export { default as ThemeProvider } from './ThemeProvider.svelte';
|
|
2
10
|
export { default as Button } from './components/Button/Button.svelte';
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export
|
|
11
|
+
export { default as Text } from './components/Text/Text.svelte';
|
|
12
|
+
export { default as Heading } from './components/Heading/Heading.svelte';
|
|
13
|
+
export { default as Badge } from './components/Badge/Badge.svelte';
|
|
14
|
+
export { default as Spinner } from './components/Spinner/Spinner.svelte';
|
|
15
|
+
export { default as Input } from './components/Input/Input.svelte';
|
|
16
|
+
// Dialog namespace (composed over bits-ui)
|
|
17
|
+
export * as Dialog from './components/Dialog/index.js';
|
|
18
|
+
// DropdownMenu namespace (composed over bits-ui)
|
|
19
|
+
export * as DropdownMenu from './components/DropdownMenu/index.js';
|
|
20
|
+
// Tooltip namespace (composed over bits-ui)
|
|
21
|
+
export * as Tooltip from './components/Tooltip/index.js';
|
|
22
|
+
// Popover namespace (composed over bits-ui)
|
|
23
|
+
export * as Popover from './components/Popover/index.js';
|
|
24
|
+
// Avatar namespace (composed over bits-ui)
|
|
25
|
+
export * as Avatar from './components/Avatar/index.js';
|
|
26
|
+
// Card namespace
|
|
27
|
+
export * as Card from './components/Card/index.js';
|
|
28
|
+
// Alert namespace
|
|
29
|
+
export * as Alert from './components/Alert/index.js';
|
|
30
|
+
// Button variant types
|
|
31
|
+
export { buttonVariants } from './components/Button/Button.svelte';
|
|
32
|
+
// Badge variant types
|
|
33
|
+
export { badgeVariants } from './components/Badge/Badge.svelte';
|
|
34
|
+
// Card variant types
|
|
35
|
+
export { cardVariants } from './components/Card/CardRoot.svelte';
|
|
36
|
+
// Alert variant types
|
|
37
|
+
export { alertVariants } from './components/Alert/AlertRoot.svelte';
|
|
38
|
+
// Input variant types
|
|
39
|
+
export { inputVariants } from './components/Input/Input.svelte';
|
|
40
|
+
// Variant helper and types
|
|
41
|
+
export { defineVariants, } from './internal/variants';
|
|
42
|
+
// Theme context utilities
|
|
43
|
+
export { useTheme } from './context';
|
|
44
|
+
// Theme types and token maps (re-export from theme subpath for convenience)
|
|
45
|
+
export { lightTokens, darkTokens, themeToVars, } from './theme/tokens';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineVariants — typed CVA-like variant resolver.
|
|
3
|
+
*
|
|
4
|
+
* Returns a resolver function that maps variant × color × size props to a
|
|
5
|
+
* merged CSS class string. No external dependencies. No `any` in the public
|
|
6
|
+
* surface. Visual values live in scoped CSS keyed by the emitted class names.
|
|
7
|
+
*/
|
|
8
|
+
/** Maps axis value names to CSS class strings */
|
|
9
|
+
export type VariantSchema = Record<string, Record<string, string>>;
|
|
10
|
+
export interface VariantConfig<S extends VariantSchema> {
|
|
11
|
+
/** Base class always included in the output */
|
|
12
|
+
base?: string;
|
|
13
|
+
/** Per-axis variant definitions: axis → value → class */
|
|
14
|
+
variants: S;
|
|
15
|
+
/** Default value for each axis (used when props are omitted) */
|
|
16
|
+
defaultVariants?: {
|
|
17
|
+
[K in keyof S]?: keyof S[K];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Props accepted by the resolver (each axis is optional + extra class string) */
|
|
21
|
+
export type VariantProps<S extends VariantSchema> = {
|
|
22
|
+
[K in keyof S]?: keyof S[K];
|
|
23
|
+
} & {
|
|
24
|
+
class?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create a variant resolver function from a config.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const button = defineVariants({
|
|
31
|
+
* base: 'btn',
|
|
32
|
+
* variants: {
|
|
33
|
+
* variant: { solid: 'btn--solid', ghost: 'btn--ghost' },
|
|
34
|
+
* size: { sm: 'btn--sm', md: 'btn--md' },
|
|
35
|
+
* },
|
|
36
|
+
* defaultVariants: { variant: 'solid', size: 'md' },
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* button() // → 'btn btn--solid btn--md'
|
|
40
|
+
* button({ variant: 'ghost' }) // → 'btn btn--ghost btn--md'
|
|
41
|
+
* button({ class: 'extra' }) // → 'btn btn--solid btn--md extra'
|
|
42
|
+
*/
|
|
43
|
+
export declare function defineVariants<S extends VariantSchema>(config: VariantConfig<S>): (props?: VariantProps<S>) => string;
|
|
44
|
+
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../src/lib/internal/variants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,iDAAiD;AACjD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnE,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,aAAa;IACpD,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,QAAQ,EAAE,CAAC,CAAC;IACZ,gEAAgE;IAChE,eAAe,CAAC,EAAE;SACf,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;KAC5B,CAAC;CACH;AAED,kFAAkF;AAClF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,IAAI;KACjD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC5B,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAMvB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GACvB,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,CAgCrC"}
|