@reddb-io/ui-kit 0.1.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 +17 -0
- package/package.json +49 -0
- package/src/lib/Badge.svelte +30 -0
- package/src/lib/Button.svelte +42 -0
- package/src/lib/Card.svelte +24 -0
- package/src/lib/Kbd.svelte +8 -0
- package/src/lib/NodeBadge.svelte +18 -0
- package/src/lib/index.ts +5 -0
- package/src/tokens/index.ts +21 -0
- package/src/tokens/tokens.css +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 reddb-io
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reddb-io/ui-kit",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Low-level RedDB UI design-system primitives.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"svelte": "./src/lib/index.ts",
|
|
10
|
+
"types": "./src/lib/index.ts"
|
|
11
|
+
},
|
|
12
|
+
"./tokens": "./src/tokens/index.ts",
|
|
13
|
+
"./tokens.css": "./src/tokens/tokens.css"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src/lib",
|
|
17
|
+
"src/tokens"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"svelte": "^5.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"svelte": "^5.20.0",
|
|
27
|
+
"svelte-check": "^4.1.4",
|
|
28
|
+
"typescript": "^5.7.2"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"tailwind-variants": "^2.1.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
36
|
+
"license": "Apache-2.0",
|
|
37
|
+
"homepage": "https://github.com/reddb-io/red-ui",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/reddb-io/red-ui.git",
|
|
41
|
+
"directory": "packages/ui-kit"
|
|
42
|
+
},
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/reddb-io/red-ui/issues"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"check": "svelte-check --tsconfig ./tsconfig.json"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
export const badge = tv({
|
|
4
|
+
base:
|
|
5
|
+
'inline-flex items-center px-1.5 py-px rounded-full text-[10px] font-medium ' +
|
|
6
|
+
'font-mono uppercase tracking-[0.06em] border',
|
|
7
|
+
variants: {
|
|
8
|
+
tone: {
|
|
9
|
+
neutral: 'bg-bg-2 text-fg-2 border-line-2',
|
|
10
|
+
ok: 'bg-ok/15 text-ok border-ok/30',
|
|
11
|
+
warn: 'bg-warn/15 text-warn border-warn/30',
|
|
12
|
+
danger: 'bg-danger/15 text-danger border-danger/30',
|
|
13
|
+
info: 'bg-info/15 text-info border-info/30',
|
|
14
|
+
accent: 'bg-accent/15 text-accent border-accent/30',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { tone: 'neutral' },
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
interface Props {
|
|
23
|
+
tone?: 'neutral' | 'ok' | 'warn' | 'danger' | 'info' | 'accent'
|
|
24
|
+
class?: string
|
|
25
|
+
children?: import('svelte').Snippet
|
|
26
|
+
}
|
|
27
|
+
let { tone = 'neutral', class: klass = '', children }: Props = $props()
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<span class={badge({ tone, class: klass })}>{@render children?.()}</span>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
export const button = tv({
|
|
4
|
+
base:
|
|
5
|
+
'inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-medium tracking-tight ' +
|
|
6
|
+
'border border-transparent cursor-pointer transition-[background,border-color,color,box-shadow] duration-150 ' +
|
|
7
|
+
'active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed disabled:active:scale-100 ' +
|
|
8
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40',
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
primary:
|
|
12
|
+
'bg-accent text-white shadow-[0_0_0_1px_var(--color-accent),0_4px_14px_-4px_var(--color-accent-glow)] hover:bg-[#ff3868] hover:shadow-[0_0_0_1px_#ff3868,0_6px_18px_-4px_var(--color-accent-glow)]',
|
|
13
|
+
ghost:
|
|
14
|
+
'bg-bg-2 text-fg-1 border-line-2 hover:bg-bg-3 hover:text-fg-0 hover:border-line-3',
|
|
15
|
+
danger:
|
|
16
|
+
'bg-danger text-white hover:bg-[#ff6f88]',
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
sm: 'h-6 px-2.5 text-[11px]',
|
|
20
|
+
md: 'h-7 px-3 text-[12px]',
|
|
21
|
+
lg: 'h-8 px-4 text-[13px]',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: { variant: 'ghost', size: 'md' },
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
interface Props {
|
|
30
|
+
variant?: 'primary' | 'ghost' | 'danger'
|
|
31
|
+
size?: 'sm' | 'md' | 'lg'
|
|
32
|
+
disabled?: boolean
|
|
33
|
+
onclick?: (e: MouseEvent) => void
|
|
34
|
+
class?: string
|
|
35
|
+
children?: import('svelte').Snippet
|
|
36
|
+
}
|
|
37
|
+
let { variant = 'ghost', size = 'md', disabled, onclick, class: klass = '', children }: Props = $props()
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<button class={button({ variant, size, class: klass })} {disabled} {onclick}>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</button>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string
|
|
4
|
+
floating?: boolean
|
|
5
|
+
class?: string
|
|
6
|
+
children?: import('svelte').Snippet
|
|
7
|
+
}
|
|
8
|
+
let { title, floating = false, class: klass = '', children }: Props = $props()
|
|
9
|
+
|
|
10
|
+
const cardClass = $derived(
|
|
11
|
+
floating
|
|
12
|
+
? 'bg-bg-1/[0.92] border-line-2 shadow-[0_16px_48px_rgba(0,0,0,0.6)]'
|
|
13
|
+
: 'bg-bg-1 border-line-1'
|
|
14
|
+
)
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<section class="rounded-lg border overflow-hidden backdrop-blur-md {cardClass} {klass}">
|
|
18
|
+
{#if title}
|
|
19
|
+
<header class="px-4 h-9 flex items-center font-mono text-[10px] uppercase tracking-[0.1em] text-fg-2 border-b border-line-1 bg-bg-1">
|
|
20
|
+
{title}
|
|
21
|
+
</header>
|
|
22
|
+
{/if}
|
|
23
|
+
<div class="p-4">{@render children?.()}</div>
|
|
24
|
+
</section>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props { children?: import('svelte').Snippet }
|
|
3
|
+
let { children }: Props = $props()
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<kbd class="inline-flex items-center justify-center min-w-[18px] h-[18px] px-1.5 font-mono text-[10px] text-fg-1 bg-bg-2 border border-line-2 border-b-2 rounded-sm">
|
|
7
|
+
{@render children?.()}
|
|
8
|
+
</kbd>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
type Role = 'primary' | 'replica' | 'embedded'
|
|
3
|
+
interface Props { role: Role; label?: string }
|
|
4
|
+
let { role, label }: Props = $props()
|
|
5
|
+
|
|
6
|
+
const dotColor = $derived(
|
|
7
|
+
({
|
|
8
|
+
primary: 'bg-role-primary text-role-primary',
|
|
9
|
+
replica: 'bg-role-replica text-role-replica',
|
|
10
|
+
embedded: 'bg-role-embedded text-role-embedded',
|
|
11
|
+
} as const)[role]
|
|
12
|
+
)
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<span class="inline-flex items-center gap-1.5 font-mono text-[11px] text-fg-1 uppercase tracking-[0.06em]">
|
|
16
|
+
<span class="w-1.5 h-1.5 rounded-full {dotColor} shadow-[0_0_0_3px_currentColor]/20"></span>
|
|
17
|
+
<span>{label ?? role}</span>
|
|
18
|
+
</span>
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
bg: { 0: '#07080a', 1: '#0c0e11', 2: '#14171c', 3: '#1c2027' },
|
|
3
|
+
fg: { 0: '#f7f8fa', 1: '#c8ccd4', 2: '#9ca1a9', 3: '#7a7f87' },
|
|
4
|
+
line: { 1: '#1a1d22', 2: '#262a31', 3: '#353a42' },
|
|
5
|
+
accent: '#ff2056',
|
|
6
|
+
ok: '#4ade80',
|
|
7
|
+
warn: '#fbbf24',
|
|
8
|
+
danger: '#ff5470',
|
|
9
|
+
info: '#60a5fa',
|
|
10
|
+
role: { primary: '#ff2056', replica: '#60a5fa', embedded: '#4ade80' },
|
|
11
|
+
} as const
|
|
12
|
+
|
|
13
|
+
export const radius = { sm: '4px', md: '6px', lg: '10px', xl: '14px' } as const
|
|
14
|
+
export const font = {
|
|
15
|
+
sans: "'InterVariable', 'Inter Tight', 'Inter', system-ui, sans-serif",
|
|
16
|
+
mono: "'JetBrains Mono', 'Berkeley Mono', ui-monospace, monospace",
|
|
17
|
+
} as const
|
|
18
|
+
export const ease = {
|
|
19
|
+
out: 'cubic-bezier(0.16, 1, 0.3, 1)', // ease-out-expo, ambient
|
|
20
|
+
snap: 'cubic-bezier(0.25, 1, 0.5, 1)', // ease-out-quart, snappier UI
|
|
21
|
+
} as const
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@import url('https://rsms.me/inter/inter.css');
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
/* Surfaces — near-black with cool tint, Linear/Vercel territory */
|
|
5
|
+
--bg-0: #07080a;
|
|
6
|
+
--bg-1: #0c0e11;
|
|
7
|
+
--bg-2: #14171c;
|
|
8
|
+
--bg-3: #1c2027;
|
|
9
|
+
|
|
10
|
+
/* Foreground */
|
|
11
|
+
--fg-0: #f4f5f7;
|
|
12
|
+
--fg-1: #c8ccd4;
|
|
13
|
+
--fg-2: #7a8088;
|
|
14
|
+
--fg-3: #4a4f57;
|
|
15
|
+
|
|
16
|
+
/* Borders */
|
|
17
|
+
--line-1: #1a1d22;
|
|
18
|
+
--line-2: #262a31;
|
|
19
|
+
--line-3: #353a42;
|
|
20
|
+
|
|
21
|
+
/* Surgical accent — red of reddb, used sparingly */
|
|
22
|
+
--accent: #ff2056;
|
|
23
|
+
--accent-soft: rgba(255, 32, 86, 0.12);
|
|
24
|
+
--accent-glow: rgba(255, 32, 86, 0.45);
|
|
25
|
+
|
|
26
|
+
/* Semantic */
|
|
27
|
+
--ok: #4ade80;
|
|
28
|
+
--warn: #fbbf24;
|
|
29
|
+
--danger: #ff5470;
|
|
30
|
+
--info: #60a5fa;
|
|
31
|
+
|
|
32
|
+
/* Node roles */
|
|
33
|
+
--role-primary: #ff2056;
|
|
34
|
+
--role-replica: #60a5fa;
|
|
35
|
+
--role-embedded: #4ade80;
|
|
36
|
+
|
|
37
|
+
/* Geometry */
|
|
38
|
+
--r-sm: 4px;
|
|
39
|
+
--r-md: 6px;
|
|
40
|
+
--r-lg: 10px;
|
|
41
|
+
--r-xl: 14px;
|
|
42
|
+
|
|
43
|
+
/* Typography */
|
|
44
|
+
--font-sans: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
|
|
45
|
+
--font-mono: 'JetBrains Mono', 'Berkeley Mono', ui-monospace, monospace;
|
|
46
|
+
|
|
47
|
+
/* Motion */
|
|
48
|
+
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
49
|
+
--ease-snap: cubic-bezier(0.25, 1, 0.5, 1);
|
|
50
|
+
|
|
51
|
+
/* Shadows */
|
|
52
|
+
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--line-2);
|
|
53
|
+
--shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--line-2);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@supports (font-variation-settings: normal) {
|
|
57
|
+
:root { --font-sans: 'InterVariable', 'Inter Tight', 'Inter', system-ui, sans-serif; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
* { box-sizing: border-box; }
|
|
61
|
+
|
|
62
|
+
html, body {
|
|
63
|
+
background: var(--bg-0);
|
|
64
|
+
color: var(--fg-0);
|
|
65
|
+
font-family: var(--font-sans);
|
|
66
|
+
font-feature-settings: 'cv11', 'ss01', 'ss03';
|
|
67
|
+
letter-spacing: -0.005em;
|
|
68
|
+
margin: 0;
|
|
69
|
+
-webkit-font-smoothing: antialiased;
|
|
70
|
+
text-rendering: optimizeLegibility;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Subtle ambient grid — Linear-style background texture */
|
|
74
|
+
body::before {
|
|
75
|
+
content: '';
|
|
76
|
+
position: fixed;
|
|
77
|
+
inset: 0;
|
|
78
|
+
background-image:
|
|
79
|
+
radial-gradient(circle at 50% 0%, rgba(255, 32, 86, 0.04), transparent 60%),
|
|
80
|
+
linear-gradient(var(--line-1) 1px, transparent 1px),
|
|
81
|
+
linear-gradient(90deg, var(--line-1) 1px, transparent 1px);
|
|
82
|
+
background-size: 100% 100%, 32px 32px, 32px 32px;
|
|
83
|
+
opacity: 0.6;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
z-index: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
button, input, select { font-family: inherit; color: inherit; }
|
|
89
|
+
|
|
90
|
+
::selection { background: var(--accent-soft); color: var(--fg-0); }
|