@ggml/llama-ui 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +17 -2
- package/dist/components/ui/button/button.svelte +92 -0
- package/dist/components/ui/button/button.svelte.d.ts +67 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/index.js +4 -0
- package/dist/components/ui/chat-message/chat-message.svelte +34 -0
- package/dist/components/ui/chat-message/chat-message.svelte.d.ts +9 -0
- package/dist/components/ui/chat-message/index.d.ts +3 -0
- package/dist/components/ui/chat-message/index.js +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/styles/tokens.css +74 -0
- package/dist/tokens.css +9 -0
- package/dist/tokens.d.ts +4 -0
- package/dist/tokens.js +48 -0
- package/dist/utils.d.ts +12 -0
- package/dist/utils.js +5 -0
- package/package.json +81 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) ggml
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ggml/llama-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared UI library for llama.cpp frontend apps.
|
|
4
|
+
|
|
5
|
+
Planned layers, extracted along real duplication between consumers:
|
|
6
|
+
|
|
7
|
+
1. design tokens (as data + css) - consumable by Tailwind themes and GPUI set_css_vars
|
|
8
|
+
2. primitives (shadcn-svelte based)
|
|
9
|
+
3. domain widgets (model badges/avatars, markdown renderer, capabilities)
|
|
10
|
+
4. chat logic core (services, stores, branching model)
|
|
11
|
+
|
|
12
|
+
First consumers: llama-chat (tools/ui in llama.cpp) and llama.pages.
|
|
13
|
+
|
|
14
|
+
## Development
|
|
15
|
+
|
|
16
|
+
- `npm run dev` - demo/showcase site (src/routes)
|
|
17
|
+
- `npm run check` - svelte-check
|
|
18
|
+
- `npm run prepack` - build the library into dist/ and run publint
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { cn, type WithElementRef } from '../../../utils.js';
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = tv({
|
|
7
|
+
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
8
|
+
defaultVariants: {
|
|
9
|
+
size: 'default',
|
|
10
|
+
variant: 'default'
|
|
11
|
+
},
|
|
12
|
+
variants: {
|
|
13
|
+
size: {
|
|
14
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
15
|
+
icon: 'size-9',
|
|
16
|
+
'icon-lg': 'size-10',
|
|
17
|
+
'icon-sm': 'size-5 rounded-sm',
|
|
18
|
+
lg: 'h-10 rounded-lg px-6 has-[>svg]:px-4',
|
|
19
|
+
sm: 'h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5'
|
|
20
|
+
},
|
|
21
|
+
variant: {
|
|
22
|
+
default: 'bg-primary text-primary-foreground shadow-sm hover:bg-primary/90',
|
|
23
|
+
destructive:
|
|
24
|
+
'bg-destructive shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white!',
|
|
25
|
+
ghost: 'hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm',
|
|
26
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
27
|
+
outline:
|
|
28
|
+
'shadow-sm hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm dark:border-input border',
|
|
29
|
+
secondary:
|
|
30
|
+
'bg-muted/30 dark:bg-muted-foreground/15 dark:text-secondary-foreground shadow-sm border-muted border text-foreground hover:bg-muted dark:hover:bg-muted-foreground/25',
|
|
31
|
+
tertiary:
|
|
32
|
+
'bg-muted/60 dark:bg-muted/75 shadow-sm border border-border/30 text-foreground hover:bg-muted/80 dark:border-border/20 dark:hover:bg-muted'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>['variant'];
|
|
38
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>['size'];
|
|
39
|
+
|
|
40
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
41
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
42
|
+
variant?: ButtonVariant;
|
|
43
|
+
size?: ButtonSize;
|
|
44
|
+
};
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script lang="ts">
|
|
48
|
+
let {
|
|
49
|
+
children,
|
|
50
|
+
class: className,
|
|
51
|
+
disabled,
|
|
52
|
+
href = undefined,
|
|
53
|
+
ref = $bindable(null),
|
|
54
|
+
size = 'default',
|
|
55
|
+
type = 'button',
|
|
56
|
+
variant = 'default',
|
|
57
|
+
...restProps
|
|
58
|
+
}: ButtonProps = $props();
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
{#if href}
|
|
62
|
+
<a
|
|
63
|
+
bind:this={ref}
|
|
64
|
+
aria-disabled={disabled}
|
|
65
|
+
class={cn(buttonVariants({ size, variant }), className)}
|
|
66
|
+
data-slot="button"
|
|
67
|
+
href={disabled ? undefined : href}
|
|
68
|
+
role={disabled ? 'link' : undefined}
|
|
69
|
+
tabindex={disabled ? -1 : undefined}
|
|
70
|
+
{...restProps}
|
|
71
|
+
>
|
|
72
|
+
{@render children?.()}
|
|
73
|
+
</a>
|
|
74
|
+
{:else}
|
|
75
|
+
<button
|
|
76
|
+
bind:this={ref}
|
|
77
|
+
class={cn(buttonVariants({ size, variant }), className)}
|
|
78
|
+
data-slot="button"
|
|
79
|
+
{disabled}
|
|
80
|
+
{type}
|
|
81
|
+
{...restProps}
|
|
82
|
+
>
|
|
83
|
+
{@render children?.()}
|
|
84
|
+
</button>
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
a,
|
|
89
|
+
button {
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../utils.js';
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
4
|
+
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3";
|
|
7
|
+
icon: "size-9";
|
|
8
|
+
'icon-lg': "size-10";
|
|
9
|
+
'icon-sm': "size-5 rounded-sm";
|
|
10
|
+
lg: "h-10 rounded-lg px-6 has-[>svg]:px-4";
|
|
11
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5";
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90";
|
|
15
|
+
destructive: "bg-destructive shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white!";
|
|
16
|
+
ghost: "hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm";
|
|
17
|
+
link: "text-primary underline-offset-4 hover:underline";
|
|
18
|
+
outline: "shadow-sm hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm dark:border-input border";
|
|
19
|
+
secondary: "bg-muted/30 dark:bg-muted-foreground/15 dark:text-secondary-foreground shadow-sm border-muted border text-foreground hover:bg-muted dark:hover:bg-muted-foreground/25";
|
|
20
|
+
tertiary: "bg-muted/60 dark:bg-muted/75 shadow-sm border border-border/30 text-foreground hover:bg-muted/80 dark:border-border/20 dark:hover:bg-muted";
|
|
21
|
+
};
|
|
22
|
+
}, undefined, "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3";
|
|
25
|
+
icon: "size-9";
|
|
26
|
+
'icon-lg': "size-10";
|
|
27
|
+
'icon-sm': "size-5 rounded-sm";
|
|
28
|
+
lg: "h-10 rounded-lg px-6 has-[>svg]:px-4";
|
|
29
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5";
|
|
30
|
+
};
|
|
31
|
+
variant: {
|
|
32
|
+
default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90";
|
|
33
|
+
destructive: "bg-destructive shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white!";
|
|
34
|
+
ghost: "hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm";
|
|
35
|
+
link: "text-primary underline-offset-4 hover:underline";
|
|
36
|
+
outline: "shadow-sm hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm dark:border-input border";
|
|
37
|
+
secondary: "bg-muted/30 dark:bg-muted-foreground/15 dark:text-secondary-foreground shadow-sm border-muted border text-foreground hover:bg-muted dark:hover:bg-muted-foreground/25";
|
|
38
|
+
tertiary: "bg-muted/60 dark:bg-muted/75 shadow-sm border border-border/30 text-foreground hover:bg-muted/80 dark:border-border/20 dark:hover:bg-muted";
|
|
39
|
+
};
|
|
40
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
41
|
+
size: {
|
|
42
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3";
|
|
43
|
+
icon: "size-9";
|
|
44
|
+
'icon-lg': "size-10";
|
|
45
|
+
'icon-sm': "size-5 rounded-sm";
|
|
46
|
+
lg: "h-10 rounded-lg px-6 has-[>svg]:px-4";
|
|
47
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5";
|
|
48
|
+
};
|
|
49
|
+
variant: {
|
|
50
|
+
default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90";
|
|
51
|
+
destructive: "bg-destructive shadow-sm hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white!";
|
|
52
|
+
ghost: "hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm";
|
|
53
|
+
link: "text-primary underline-offset-4 hover:underline";
|
|
54
|
+
outline: "shadow-sm hover:text-accent-foreground hover:bg-muted-foreground/10 backdrop-blur-sm dark:border-input border";
|
|
55
|
+
secondary: "bg-muted/30 dark:bg-muted-foreground/15 dark:text-secondary-foreground shadow-sm border-muted border text-foreground hover:bg-muted dark:hover:bg-muted-foreground/25";
|
|
56
|
+
tertiary: "bg-muted/60 dark:bg-muted/75 shadow-sm border border-border/30 text-foreground hover:bg-muted/80 dark:border-border/20 dark:hover:bg-muted";
|
|
57
|
+
};
|
|
58
|
+
}, undefined>>;
|
|
59
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>['variant'];
|
|
60
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>['size'];
|
|
61
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
|
|
62
|
+
variant?: ButtonVariant;
|
|
63
|
+
size?: ButtonSize;
|
|
64
|
+
};
|
|
65
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
|
|
66
|
+
type Button = ReturnType<typeof Button>;
|
|
67
|
+
export default Button;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ChatMessageRole } from './index.js';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
role?: ChatMessageRole;
|
|
6
|
+
content?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { role = 'user', content = '', class: className = '' }: Props = $props();
|
|
11
|
+
|
|
12
|
+
const bubbleClassByRole = {
|
|
13
|
+
// mirrors the tools/ui user bubble: faint primary tint, borderless, backdrop blur
|
|
14
|
+
user: 'bg-primary/5 dark:bg-primary/15 backdrop-blur-md',
|
|
15
|
+
assistant: 'bg-transparent',
|
|
16
|
+
// mirrors the tools/ui system card: dashed border on a muted card
|
|
17
|
+
system: 'bg-muted border-2 border-dashed border-border/50'
|
|
18
|
+
} as const;
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class="flex flex-col {role === 'user' ? 'items-end' : 'items-start'} {role === 'system'
|
|
23
|
+
? 'mx-auto'
|
|
24
|
+
: ''} {className}"
|
|
25
|
+
>
|
|
26
|
+
{#if content.trim()}
|
|
27
|
+
<div
|
|
28
|
+
class="w-full max-w-[80%] rounded-[1.125rem] px-3.75 py-1.5 text-md text-foreground {bubbleClassByRole[role]}"
|
|
29
|
+
style="overflow-wrap: anywhere; word-break: break-word;"
|
|
30
|
+
>
|
|
31
|
+
<span class="whitespace-pre-wrap">{content}</span>
|
|
32
|
+
</div>
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatMessageRole } from './index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
role?: ChatMessageRole;
|
|
4
|
+
content?: string;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const ChatMessage: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type ChatMessage = ReturnType<typeof ChatMessage>;
|
|
9
|
+
export default ChatMessage;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* Design tokens for llama-ui components.
|
|
2
|
+
* Light values on :root, dark overrides on .dark (toggle with a .dark class on <html>).
|
|
3
|
+
* The @theme inline block maps them to the Tailwind color names the components use.
|
|
4
|
+
* Consumers: @import '@ggml/llama-ui/tokens.css' after 'tailwindcss'.
|
|
5
|
+
*/
|
|
6
|
+
@custom-variant dark (&:is(.dark *));
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
--radius: 0.625rem;
|
|
10
|
+
--background: oklch(1 0 0);
|
|
11
|
+
--foreground: oklch(0.145 0 0);
|
|
12
|
+
--card: oklch(1 0 0);
|
|
13
|
+
--card-foreground: oklch(0.145 0 0);
|
|
14
|
+
--popover: oklch(1 0 0);
|
|
15
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
16
|
+
--primary: oklch(0.205 0 0);
|
|
17
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
18
|
+
--secondary: oklch(0.95 0 0);
|
|
19
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
20
|
+
--muted: oklch(0.97 0 0);
|
|
21
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
22
|
+
--accent: oklch(0.95 0 0);
|
|
23
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
24
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
25
|
+
--border: oklch(0.875 0 0);
|
|
26
|
+
--input: oklch(0.92 0 0);
|
|
27
|
+
--ring: oklch(0.708 0 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.dark {
|
|
31
|
+
--background: oklch(0.16 0 0);
|
|
32
|
+
--foreground: oklch(0.985 0 0);
|
|
33
|
+
--card: oklch(0.205 0 0);
|
|
34
|
+
--card-foreground: oklch(0.985 0 0);
|
|
35
|
+
--popover: oklch(0.205 0 0);
|
|
36
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
37
|
+
--primary: oklch(0.922 0 0);
|
|
38
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
39
|
+
--secondary: oklch(0.29 0 0);
|
|
40
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
41
|
+
--muted: oklch(0.269 0 0);
|
|
42
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
43
|
+
--accent: oklch(0.269 0 0);
|
|
44
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
45
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
46
|
+
--border: oklch(1 0 0 / 30%);
|
|
47
|
+
--input: oklch(1 0 0 / 30%);
|
|
48
|
+
--ring: oklch(0.556 0 0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@theme inline {
|
|
52
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
53
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
54
|
+
--radius-lg: var(--radius);
|
|
55
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
56
|
+
--color-background: var(--background);
|
|
57
|
+
--color-foreground: var(--foreground);
|
|
58
|
+
--color-card: var(--card);
|
|
59
|
+
--color-card-foreground: var(--card-foreground);
|
|
60
|
+
--color-popover: var(--popover);
|
|
61
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
62
|
+
--color-primary: var(--primary);
|
|
63
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
64
|
+
--color-secondary: var(--secondary);
|
|
65
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
66
|
+
--color-muted: var(--muted);
|
|
67
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
68
|
+
--color-accent: var(--accent);
|
|
69
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
70
|
+
--color-destructive: var(--destructive);
|
|
71
|
+
--color-border: var(--border);
|
|
72
|
+
--color-input: var(--input);
|
|
73
|
+
--color-ring: var(--ring);
|
|
74
|
+
}
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* default (light) theme variables; consumers override or generate from tokens.js */
|
|
2
|
+
:root {
|
|
3
|
+
--llama-ui-background: #ffffff;
|
|
4
|
+
--llama-ui-foreground: #111111;
|
|
5
|
+
--llama-ui-primary: #0f6b3f;
|
|
6
|
+
--llama-ui-primary-foreground: #ffffff;
|
|
7
|
+
--llama-ui-border: #e5e5e5;
|
|
8
|
+
--llama-ui-radius: 8px;
|
|
9
|
+
}
|
package/dist/tokens.d.ts
ADDED
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const theme = {
|
|
2
|
+
light: {
|
|
3
|
+
'--radius': '0.625rem',
|
|
4
|
+
'--background': 'oklch(1 0 0)',
|
|
5
|
+
'--foreground': 'oklch(0.145 0 0)',
|
|
6
|
+
'--card': 'oklch(1 0 0)',
|
|
7
|
+
'--card-foreground': 'oklch(0.145 0 0)',
|
|
8
|
+
'--popover': 'oklch(1 0 0)',
|
|
9
|
+
'--popover-foreground': 'oklch(0.145 0 0)',
|
|
10
|
+
'--primary': 'oklch(0.205 0 0)',
|
|
11
|
+
'--primary-foreground': 'oklch(0.985 0 0)',
|
|
12
|
+
'--secondary': 'oklch(0.95 0 0)',
|
|
13
|
+
'--secondary-foreground': 'oklch(0.205 0 0)',
|
|
14
|
+
'--muted': 'oklch(0.97 0 0)',
|
|
15
|
+
'--muted-foreground': 'oklch(0.556 0 0)',
|
|
16
|
+
'--accent': 'oklch(0.95 0 0)',
|
|
17
|
+
'--accent-foreground': 'oklch(0.205 0 0)',
|
|
18
|
+
'--destructive': 'oklch(0.577 0.245 27.325)',
|
|
19
|
+
'--border': 'oklch(0.875 0 0)',
|
|
20
|
+
'--input': 'oklch(0.92 0 0)',
|
|
21
|
+
'--ring': 'oklch(0.708 0 0)'
|
|
22
|
+
},
|
|
23
|
+
dark: {
|
|
24
|
+
'--radius': '0.625rem',
|
|
25
|
+
'--background': 'oklch(0.16 0 0)',
|
|
26
|
+
'--foreground': 'oklch(0.985 0 0)',
|
|
27
|
+
'--card': 'oklch(0.205 0 0)',
|
|
28
|
+
'--card-foreground': 'oklch(0.985 0 0)',
|
|
29
|
+
'--popover': 'oklch(0.205 0 0)',
|
|
30
|
+
'--popover-foreground': 'oklch(0.985 0 0)',
|
|
31
|
+
'--primary': 'oklch(0.922 0 0)',
|
|
32
|
+
'--primary-foreground': 'oklch(0.205 0 0)',
|
|
33
|
+
'--secondary': 'oklch(0.29 0 0)',
|
|
34
|
+
'--secondary-foreground': 'oklch(0.985 0 0)',
|
|
35
|
+
'--muted': 'oklch(0.269 0 0)',
|
|
36
|
+
'--muted-foreground': 'oklch(0.708 0 0)',
|
|
37
|
+
'--accent': 'oklch(0.269 0 0)',
|
|
38
|
+
'--accent-foreground': 'oklch(0.985 0 0)',
|
|
39
|
+
'--destructive': 'oklch(0.704 0.191 22.216)',
|
|
40
|
+
'--border': 'oklch(1 0 0 / 30%)',
|
|
41
|
+
'--input': 'oklch(1 0 0 / 30%)',
|
|
42
|
+
'--ring': 'oklch(0.556 0 0)'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// flattened map for set_css_vars() style consumers, e.g. set_css_vars(theme.dark)
|
|
46
|
+
export function tokensFor(name) {
|
|
47
|
+
return theme[name];
|
|
48
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
export type WithoutChild<T> = T extends {
|
|
4
|
+
child?: any;
|
|
5
|
+
} ? Omit<T, 'child'> : T;
|
|
6
|
+
export type WithoutChildren<T> = T extends {
|
|
7
|
+
children?: any;
|
|
8
|
+
} ? Omit<T, 'children'> : T;
|
|
9
|
+
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
|
|
10
|
+
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
|
|
11
|
+
ref?: U | null;
|
|
12
|
+
};
|
package/dist/utils.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,82 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@ggml/llama-ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"!dist/**/*.test.*",
|
|
8
|
+
"!dist/**/*.spec.*",
|
|
9
|
+
"!dist/**/*.stories.*"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"**/*.css"
|
|
14
|
+
],
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"svelte": "./dist/index.js",
|
|
17
|
+
"imports": {
|
|
18
|
+
"#lib": "./src/lib/index.js",
|
|
19
|
+
"#lib/*": "./src/lib/*"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"svelte": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./tokens.css": "./dist/styles/tokens.css"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "bash scripts/dev.sh",
|
|
30
|
+
"build": "vp build && npm run prepack",
|
|
31
|
+
"preview": "vp preview",
|
|
32
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
33
|
+
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
34
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
35
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
36
|
+
"test:unit": "vp test",
|
|
37
|
+
"test": "npm run test:unit -- --run",
|
|
38
|
+
"storybook": "storybook dev -p 6006",
|
|
39
|
+
"build-storybook": "storybook build",
|
|
40
|
+
"watch:package": "svelte-kit sync && svelte-package -w"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@chromatic-com/storybook": "latest",
|
|
44
|
+
"@storybook/addon-a11y": "^10.6.2",
|
|
45
|
+
"@storybook/addon-docs": "^10.6.2",
|
|
46
|
+
"@storybook/addon-svelte-csf": "latest",
|
|
47
|
+
"@storybook/addon-vitest": "^10.6.2",
|
|
48
|
+
"@storybook/sveltekit": "^10.6.2",
|
|
49
|
+
"@sveltejs/adapter-auto": "^8.0.0",
|
|
50
|
+
"@sveltejs/kit": "^3.0.0",
|
|
51
|
+
"@sveltejs/package": "^2.5.8",
|
|
52
|
+
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
53
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
54
|
+
"@types/node": "^24",
|
|
55
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
56
|
+
"@vitest/coverage-v8": "5.0.5",
|
|
57
|
+
"mode-watcher": "^1.1.0",
|
|
58
|
+
"playwright": "^1.60.0",
|
|
59
|
+
"publint": "^0.3.21",
|
|
60
|
+
"storybook": "^10.6.2",
|
|
61
|
+
"svelte": "^5.57.1",
|
|
62
|
+
"svelte-check": "^4.6.0",
|
|
63
|
+
"tailwindcss": "^4.3.3",
|
|
64
|
+
"typescript": "^6.0.3",
|
|
65
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
66
|
+
"vite-plus": "1.3.0",
|
|
67
|
+
"vitest": "5.0.5",
|
|
68
|
+
"vitest-browser-svelte": "^2.1.1"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"svelte": "^5.0.0"
|
|
72
|
+
},
|
|
73
|
+
"overrides": {
|
|
74
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
75
|
+
"vitest": "5.0.5"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"clsx": "^2.1.1",
|
|
79
|
+
"tailwind-merge": "^3.7.0",
|
|
80
|
+
"tailwind-variants": "^3.3.1"
|
|
81
|
+
}
|
|
82
|
+
}
|