@rimelight/ui 0.0.24 → 0.0.26
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/package.json +7 -3
- package/src/components/Head.astro +199 -156
- package/src/components/ThemeToggle.astro +2 -2
- package/src/components/astro/RLAAccordion.astro +22 -0
- package/src/components/astro/RLAButton.astro +104 -118
- package/src/components/astro/RLAFooter.astro +17 -43
- package/src/components/astro/RLAHeader.astro +21 -80
- package/src/components/astro/RLAIcon.astro +14 -39
- package/src/components/astro/RLALogo.astro +14 -48
- package/src/components/astro/RLAPlaceholder.astro +11 -35
- package/src/components/astro/RLAQuote.astro +15 -0
- package/src/components/astro/RLAScrollToTop.astro +171 -221
- package/src/components/astro/RLASection.astro +210 -0
- package/src/components/vue/RLVButton.vue +166 -139
- package/src/components/vue/RLVFooter.vue +17 -54
- package/src/components/vue/RLVHeader.vue +22 -105
- package/src/components/vue/RLVIcon.vue +14 -45
- package/src/components/vue/RLVLogo.vue +11 -58
- package/src/components/vue/RLVPlaceholder.vue +14 -35
- package/src/components/vue/RLVScrollToTop.vue +18 -89
- package/src/components/vue/RLVSection.vue +166 -0
- package/src/composables/index.ts +0 -1
- package/src/env.d.ts +5 -0
- package/src/integrations/ui.ts +2 -6
- package/src/plugins/index.ts +5 -2
- package/src/plugins/starlightAddons/index.ts +3 -64
- package/src/plugins/starlightDocsApi/components/ApiEmits.astro +46 -0
- package/src/plugins/starlightDocsApi/components/ApiProps.astro +47 -0
- package/src/plugins/starlightDocsApi/components/ApiSlots.astro +50 -0
- package/src/plugins/starlightDocsApi/components/ApiTheme.astro +27 -0
- package/src/plugins/starlightDocsApi/extract-vue.ts +286 -0
- package/src/plugins/starlightDocsApi/index.ts +265 -0
- package/src/plugins/starlightDocsApi/types.ts +40 -0
- package/src/plugins/starlightDocsApi/utils.ts +45 -0
- package/src/themes/button.theme.ts +29 -14
- package/src/themes/footer.theme.ts +4 -6
- package/src/themes/header.theme.ts +4 -28
- package/src/themes/icon.theme.ts +4 -2
- package/src/themes/index.ts +15 -20
- package/src/themes/logo.theme.ts +4 -2
- package/src/themes/placeholder.theme.ts +4 -6
- package/src/themes/scroll-to-top.theme.ts +4 -6
- package/src/themes/section.theme.ts +187 -0
- package/src/types/componentVariant.ts +14 -0
- package/src/types/index.ts +1 -0
- package/src/utils/defineTheme.ts +11 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/resolveClasses.ts +21 -0
- package/src/utils/useUi.ts +19 -0
- package/src/composables/useUi.ts +0 -27
- package/src/plugins/starlightAddons/Sidebar.astro +0 -89
- package/src/plugins/starlightAddons/data.ts +0 -39
- package/src/plugins/starlightAddons/libs/config.ts +0 -107
- package/src/plugins/starlightAddons/libs/content.ts +0 -20
- package/src/plugins/starlightAddons/libs/i18n.ts +0 -51
- package/src/plugins/starlightAddons/libs/locals.ts +0 -12
- package/src/plugins/starlightAddons/libs/pathname.ts +0 -22
- package/src/plugins/starlightAddons/libs/plugin.ts +0 -9
- package/src/plugins/starlightAddons/libs/sidebar.ts +0 -183
- package/src/plugins/starlightAddons/libs/vite.ts +0 -46
- package/src/plugins/starlightAddons/locals.d.ts +0 -14
- package/src/plugins/starlightAddons/middleware.ts +0 -132
- package/src/plugins/starlightAddons/overrides/Sidebar.astro +0 -8
- package/src/plugins/starlightAddons/schema.ts +0 -13
- package/src/plugins/starlightAddons/virtual.d.ts +0 -13
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export const buttonTheme = {
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
6
4
|
slots: ["root", "label", "leadingIcon", "trailingIcon"],
|
|
7
5
|
base: {
|
|
8
6
|
root: [
|
|
@@ -37,11 +35,31 @@ export const buttonTheme = {
|
|
|
37
35
|
source: { root: "" }
|
|
38
36
|
},
|
|
39
37
|
size: {
|
|
40
|
-
xs: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
xs: {
|
|
39
|
+
root: "h-7 px-2xs text-xs [&_svg]:size-3.5",
|
|
40
|
+
leadingIcon: "[&_svg]:size-3.5",
|
|
41
|
+
trailingIcon: "[&_svg]:size-3.5"
|
|
42
|
+
},
|
|
43
|
+
sm: {
|
|
44
|
+
root: "h-8 px-xs text-sm [&_svg]:size-4",
|
|
45
|
+
leadingIcon: "[&_svg]:size-4",
|
|
46
|
+
trailingIcon: "[&_svg]:size-4"
|
|
47
|
+
},
|
|
48
|
+
md: {
|
|
49
|
+
root: "h-9 px-sm text-sm [&_svg]:size-4",
|
|
50
|
+
leadingIcon: "[&_svg]:size-4",
|
|
51
|
+
trailingIcon: "[&_svg]:size-4"
|
|
52
|
+
},
|
|
53
|
+
lg: {
|
|
54
|
+
root: "h-10 px-md text-base [&_svg]:size-4.5",
|
|
55
|
+
leadingIcon: "[&_svg]:size-4.5",
|
|
56
|
+
trailingIcon: "[&_svg]:size-4.5"
|
|
57
|
+
},
|
|
58
|
+
xl: {
|
|
59
|
+
root: "h-11 px-lg text-base [&_svg]:size-5",
|
|
60
|
+
leadingIcon: "[&_svg]:size-5",
|
|
61
|
+
trailingIcon: "[&_svg]:size-5"
|
|
62
|
+
}
|
|
45
63
|
},
|
|
46
64
|
block: {
|
|
47
65
|
true: { root: "w-full justify-center", trailingIcon: "ms-auto" }
|
|
@@ -373,7 +391,6 @@ export const buttonTheme = {
|
|
|
373
391
|
root: "text-source-600 hover:underline hover:decoration-source/30"
|
|
374
392
|
}
|
|
375
393
|
},
|
|
376
|
-
// soft variant compound variants
|
|
377
394
|
{
|
|
378
395
|
variant: "soft",
|
|
379
396
|
color: "primary",
|
|
@@ -437,7 +454,6 @@ export const buttonTheme = {
|
|
|
437
454
|
root: "text-source-600 bg-source/10 hover:bg-source/20 focus-visible:ring-source/40"
|
|
438
455
|
}
|
|
439
456
|
},
|
|
440
|
-
// square + size compound variants (explicit width to match height)
|
|
441
457
|
{
|
|
442
458
|
square: true,
|
|
443
459
|
size: "xs",
|
|
@@ -473,7 +489,6 @@ export const buttonTheme = {
|
|
|
473
489
|
root: "p-2 w-11"
|
|
474
490
|
}
|
|
475
491
|
},
|
|
476
|
-
// loading compound variants
|
|
477
492
|
{
|
|
478
493
|
loading: true,
|
|
479
494
|
leading: true,
|
|
@@ -503,4 +518,4 @@ export const buttonTheme = {
|
|
|
503
518
|
color: "primary",
|
|
504
519
|
size: "md"
|
|
505
520
|
}
|
|
506
|
-
}
|
|
521
|
+
})
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export const footerTheme = {
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
6
4
|
slots: ["root", "container", "left", "center", "right"],
|
|
7
5
|
base: {
|
|
8
6
|
root: "py-8 lg:py-12",
|
|
@@ -26,4 +24,4 @@ export const footerTheme = {
|
|
|
26
24
|
defaultVariants: {
|
|
27
25
|
contain: false
|
|
28
26
|
}
|
|
29
|
-
}
|
|
27
|
+
})
|
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Slots:
|
|
6
|
-
*
|
|
7
|
-
* - `root` — the `<header>` element
|
|
8
|
-
* - `content` — inner wrapper div used for height measurement (fixed/hideOnScroll mode)
|
|
9
|
-
* - `container` — max-width flex row
|
|
10
|
-
* - `left` — left region
|
|
11
|
-
* - `center` — center region
|
|
12
|
-
* - `right` — right region
|
|
13
|
-
*
|
|
14
|
-
* Variants:
|
|
15
|
-
*
|
|
16
|
-
* - `contain` — constrains container to max-w-7xl
|
|
17
|
-
* - `sticky` — sticky positioning (ignored when `fixed` variant is true)
|
|
18
|
-
* - `fixed` — position: fixed with left/right 0 and smooth top/opacity transition; used for stacked
|
|
19
|
-
* header layers. Top offset and z-index are applied via inline style (top prop + stackIndex prop)
|
|
20
|
-
* rather than theme classes.
|
|
21
|
-
*/
|
|
22
|
-
export const headerTheme = {
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
23
4
|
slots: ["root", "content", "container", "left", "center", "right"],
|
|
24
5
|
base: {
|
|
25
6
|
root: "w-full",
|
|
@@ -47,11 +28,6 @@ export const headerTheme = {
|
|
|
47
28
|
root: "relative"
|
|
48
29
|
}
|
|
49
30
|
},
|
|
50
|
-
/**
|
|
51
|
-
* Fixed-layer mode. When true, overrides sticky/relative positioning with `position: fixed` and
|
|
52
|
-
* enables smooth transitions. `top` and `z-index` are applied via inline `:style` on the
|
|
53
|
-
* component.
|
|
54
|
-
*/
|
|
55
31
|
fixed: {
|
|
56
32
|
true: {
|
|
57
33
|
root: "fixed left-0 right-0 transition-[top,opacity] duration-200 ease-in-out"
|
|
@@ -64,4 +40,4 @@ export const headerTheme = {
|
|
|
64
40
|
sticky: true,
|
|
65
41
|
fixed: false
|
|
66
42
|
}
|
|
67
|
-
}
|
|
43
|
+
})
|
package/src/themes/icon.theme.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
2
4
|
slots: ["root"],
|
|
3
5
|
base: {
|
|
4
6
|
root: ["inline-block", "align-middle"]
|
|
@@ -15,4 +17,4 @@ export const iconTheme = {
|
|
|
15
17
|
defaultVariants: {
|
|
16
18
|
size: "md"
|
|
17
19
|
}
|
|
18
|
-
}
|
|
20
|
+
})
|
package/src/themes/index.ts
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { footerTheme } from "./footer.theme"
|
|
3
|
-
import { scrollToTopTheme } from "./scroll-to-top.theme"
|
|
4
|
-
import { buttonTheme } from "./button.theme"
|
|
5
|
-
import { logoTheme } from "./logo.theme"
|
|
6
|
-
import { iconTheme } from "./icon.theme"
|
|
7
|
-
import { placeholderTheme } from "./placeholder.theme"
|
|
1
|
+
import type { ComponentTheme } from "../utils/defineTheme"
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
const themeModules = import.meta.glob<{ default: ComponentTheme }>("./*.theme.ts", { eager: true })
|
|
4
|
+
|
|
5
|
+
function kebabToCamel(str: string): string {
|
|
6
|
+
return str.replace(/-([a-z])/g, (_, char) => char.toUpperCase())
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function themeNameFromFile(path: string): string {
|
|
10
|
+
const fileName = path.replace(/^\.\/|\.theme\.ts$/g, "")
|
|
11
|
+
return kebabToCamel(fileName)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const defaultUIConfig: Record<string, ComponentTheme> = Object.fromEntries(
|
|
15
|
+
Object.entries(themeModules).map(([path, module]) => [themeNameFromFile(path), module.default])
|
|
16
|
+
)
|
|
22
17
|
|
|
23
18
|
export type DefaultUIConfig = typeof defaultUIConfig
|
package/src/themes/logo.theme.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
2
4
|
slots: ["root"],
|
|
3
5
|
base: {
|
|
4
6
|
root: "flex items-center justify-center transition-opacity hover:opacity-80 shrink-0 select-none overflow-hidden"
|
|
5
7
|
},
|
|
6
8
|
variants: {},
|
|
7
9
|
defaultVariants: {}
|
|
8
|
-
}
|
|
10
|
+
})
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export const placeholderTheme = {
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
6
4
|
slots: ["base", "svg"],
|
|
7
5
|
base: {
|
|
8
6
|
base: "relative flex items-center justify-center overflow-hidden rounded-sm border-1 border-dashed border-primary px-4 opacity-75",
|
|
@@ -11,4 +9,4 @@ export const placeholderTheme = {
|
|
|
11
9
|
variants: {},
|
|
12
10
|
compoundVariants: [],
|
|
13
11
|
defaultVariants: {}
|
|
14
|
-
}
|
|
12
|
+
})
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export const scrollToTopTheme = {
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
6
4
|
slots: ["root", "button", "progressBase", "svg", "iconContainer", "icon"],
|
|
7
5
|
base: {
|
|
8
6
|
root: "fixed bottom-6 right-6 z-50",
|
|
@@ -45,4 +43,4 @@ export const scrollToTopTheme = {
|
|
|
45
43
|
defaultVariants: {
|
|
46
44
|
color: "primary"
|
|
47
45
|
}
|
|
48
|
-
}
|
|
46
|
+
})
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { defineTheme } from "../utils/defineTheme"
|
|
2
|
+
|
|
3
|
+
export default defineTheme({
|
|
4
|
+
slots: [
|
|
5
|
+
"root",
|
|
6
|
+
"background",
|
|
7
|
+
"container",
|
|
8
|
+
"wrapper",
|
|
9
|
+
"header",
|
|
10
|
+
"leading",
|
|
11
|
+
"leadingIcon",
|
|
12
|
+
"headline",
|
|
13
|
+
"title",
|
|
14
|
+
"description",
|
|
15
|
+
"body",
|
|
16
|
+
"footer",
|
|
17
|
+
"links"
|
|
18
|
+
],
|
|
19
|
+
base: {
|
|
20
|
+
root: "relative isolate",
|
|
21
|
+
background: "absolute inset-0 -z-1 overflow-hidden",
|
|
22
|
+
container: "flex flex-col lg:grid",
|
|
23
|
+
wrapper: "",
|
|
24
|
+
header: "",
|
|
25
|
+
leading: "flex items-center mb-6",
|
|
26
|
+
leadingIcon: "size-10 shrink-0 text-primary",
|
|
27
|
+
headline: "",
|
|
28
|
+
title: "text-pretty tracking-tight font-bold text-highlighted",
|
|
29
|
+
description: "text-muted",
|
|
30
|
+
body: "",
|
|
31
|
+
footer: "",
|
|
32
|
+
links: "flex flex-wrap"
|
|
33
|
+
},
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
default: {
|
|
37
|
+
container: "py-16 sm:py-24 lg:py-32 gap-8 sm:gap-16",
|
|
38
|
+
headline: "mb-3",
|
|
39
|
+
title: "text-3xl sm:text-4xl lg:text-5xl",
|
|
40
|
+
description: "text-base sm:text-lg",
|
|
41
|
+
body: "mt-8",
|
|
42
|
+
footer: "mt-8",
|
|
43
|
+
links: "gap-x-6 gap-y-3"
|
|
44
|
+
},
|
|
45
|
+
hero: {
|
|
46
|
+
container: "py-24 sm:py-32 lg:py-40 gap-16 sm:gap-y-24",
|
|
47
|
+
headline: "mb-4",
|
|
48
|
+
title: "text-5xl sm:text-7xl",
|
|
49
|
+
description: "text-lg sm:text-xl/8",
|
|
50
|
+
leading: "mb-6",
|
|
51
|
+
body: "mt-10",
|
|
52
|
+
footer: "mt-10",
|
|
53
|
+
links: "gap-x-6 gap-y-3"
|
|
54
|
+
},
|
|
55
|
+
cta: {
|
|
56
|
+
root: "rounded-xl overflow-hidden",
|
|
57
|
+
container: "lg:grid px-6 py-12 sm:px-12 sm:py-24 lg:px-16 lg:py-24 gap-8 sm:gap-16",
|
|
58
|
+
title: "text-3xl sm:text-4xl",
|
|
59
|
+
description: "text-base sm:text-lg text-muted",
|
|
60
|
+
body: "mt-8",
|
|
61
|
+
footer: "mt-8",
|
|
62
|
+
links: "gap-x-6 gap-y-3"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
ctaVariant: {
|
|
66
|
+
solid: {
|
|
67
|
+
root: "bg-inverted text-inverted",
|
|
68
|
+
title: "text-inverted",
|
|
69
|
+
description: "text-dimmed"
|
|
70
|
+
},
|
|
71
|
+
outline: {
|
|
72
|
+
root: "bg-default ring ring-default",
|
|
73
|
+
description: "text-muted"
|
|
74
|
+
},
|
|
75
|
+
soft: {
|
|
76
|
+
root: "bg-elevated/50",
|
|
77
|
+
description: "text-toned"
|
|
78
|
+
},
|
|
79
|
+
subtle: {
|
|
80
|
+
root: "bg-elevated/50 ring ring-default",
|
|
81
|
+
description: "text-toned"
|
|
82
|
+
},
|
|
83
|
+
naked: {
|
|
84
|
+
description: "text-muted"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
orientation: {
|
|
88
|
+
horizontal: {
|
|
89
|
+
container: "lg:grid-cols-2 lg:items-center",
|
|
90
|
+
description: "text-pretty"
|
|
91
|
+
},
|
|
92
|
+
vertical: {
|
|
93
|
+
container: "",
|
|
94
|
+
headline: "justify-center",
|
|
95
|
+
leading: "justify-center",
|
|
96
|
+
title: "text-center",
|
|
97
|
+
description: "text-center text-balance",
|
|
98
|
+
links: "justify-center"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
reverse: {
|
|
102
|
+
true: {
|
|
103
|
+
wrapper: "order-last"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
headline: {
|
|
107
|
+
true: {
|
|
108
|
+
headline: "font-semibold text-primary flex items-center gap-1.5"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
title: {
|
|
112
|
+
true: {
|
|
113
|
+
description: "mt-6"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
description: {
|
|
117
|
+
true: {}
|
|
118
|
+
},
|
|
119
|
+
body: {
|
|
120
|
+
true: {}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
compoundVariants: [
|
|
124
|
+
{
|
|
125
|
+
variant: "default",
|
|
126
|
+
orientation: "vertical",
|
|
127
|
+
title: true,
|
|
128
|
+
classNames: {
|
|
129
|
+
body: "mt-16"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
variant: "default",
|
|
134
|
+
orientation: "vertical",
|
|
135
|
+
description: true,
|
|
136
|
+
classNames: {
|
|
137
|
+
body: "mt-16"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
variant: "default",
|
|
142
|
+
orientation: "vertical",
|
|
143
|
+
body: true,
|
|
144
|
+
classNames: {
|
|
145
|
+
footer: "mt-16"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
variant: "cta",
|
|
150
|
+
ctaVariant: "outline",
|
|
151
|
+
classNames: {
|
|
152
|
+
root: "bg-default ring ring-default",
|
|
153
|
+
description: "text-muted"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
variant: "cta",
|
|
158
|
+
ctaVariant: "solid",
|
|
159
|
+
classNames: {
|
|
160
|
+
root: "bg-inverted text-inverted",
|
|
161
|
+
title: "text-inverted",
|
|
162
|
+
description: "text-dimmed"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
variant: "cta",
|
|
167
|
+
ctaVariant: "soft",
|
|
168
|
+
classNames: {
|
|
169
|
+
root: "bg-elevated/50",
|
|
170
|
+
description: "text-toned"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
variant: "cta",
|
|
175
|
+
ctaVariant: "subtle",
|
|
176
|
+
classNames: {
|
|
177
|
+
root: "bg-elevated/50 ring ring-default",
|
|
178
|
+
description: "text-toned"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
defaultVariants: {
|
|
183
|
+
variant: "default",
|
|
184
|
+
orientation: "vertical",
|
|
185
|
+
ctaVariant: "solid"
|
|
186
|
+
}
|
|
187
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ComponentVariants<T extends { variants?: Record<string, Record<string, unknown>> }> =
|
|
2
|
+
T["variants"] extends Record<string, Record<string, unknown>>
|
|
3
|
+
? {
|
|
4
|
+
[K in keyof T["variants"]]?: T["variants"][K] extends { true: unknown; false: unknown }
|
|
5
|
+
? boolean
|
|
6
|
+
: T["variants"][K] extends { true: unknown }
|
|
7
|
+
? boolean
|
|
8
|
+
: keyof T["variants"][K]
|
|
9
|
+
}
|
|
10
|
+
: never
|
|
11
|
+
|
|
12
|
+
export type ComponentSlots<T extends { slots: readonly string[] }> = Partial<
|
|
13
|
+
Record<T["slots"][number], string>
|
|
14
|
+
>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./componentVariant"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ComponentTheme {
|
|
2
|
+
slots: string[]
|
|
3
|
+
base: Record<string, string | string[]>
|
|
4
|
+
variants?: Record<string, Record<string, Record<string, string | string[]>>>
|
|
5
|
+
compoundVariants?: Record<string, unknown>[]
|
|
6
|
+
defaultVariants?: Record<string, unknown>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function defineTheme<const T extends ComponentTheme>(theme: T): T {
|
|
10
|
+
return theme
|
|
11
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cx } from "css-variants"
|
|
2
|
+
|
|
3
|
+
export function resolveClasses<T extends (...args: never[]) => Record<string, string>>(
|
|
4
|
+
themeFn: T,
|
|
5
|
+
variants: Parameters<T>[0],
|
|
6
|
+
mergedUI: Record<string, string | undefined>,
|
|
7
|
+
rootClass?: string
|
|
8
|
+
): Record<string, string> {
|
|
9
|
+
const resolved = themeFn(variants)
|
|
10
|
+
const result: Record<string, string> = {}
|
|
11
|
+
|
|
12
|
+
for (const [slot, value] of Object.entries(resolved)) {
|
|
13
|
+
result[slot] = cx(value, mergedUI[slot])
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (rootClass) {
|
|
17
|
+
result.root = cx(result.root ?? "", rootClass)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return result
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import defu from "defu"
|
|
2
|
+
import { getUIConfig } from "virtual:rimelight-ui"
|
|
3
|
+
import type { DefaultUIConfig } from "../themes"
|
|
4
|
+
|
|
5
|
+
export function useUi(
|
|
6
|
+
componentName: keyof DefaultUIConfig,
|
|
7
|
+
uiProp?: Record<string, string | undefined>
|
|
8
|
+
): Record<string, string | undefined> {
|
|
9
|
+
const globalConfig = getUIConfig()
|
|
10
|
+
const defaults = globalConfig[componentName] ?? {}
|
|
11
|
+
const merged = defu(uiProp ?? {}, defaults)
|
|
12
|
+
|
|
13
|
+
return Object.fromEntries(
|
|
14
|
+
Object.entries(merged).map(([key, value]) => [
|
|
15
|
+
key,
|
|
16
|
+
typeof value === "string" ? value : undefined
|
|
17
|
+
])
|
|
18
|
+
)
|
|
19
|
+
}
|
package/src/composables/useUi.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { computed, type ComputedRef } from "vue"
|
|
2
|
-
import defu from "defu"
|
|
3
|
-
import { getUIConfig } from "virtual:rimelight-ui"
|
|
4
|
-
import type { DefaultUIConfig } from "@/themes"
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Reactive UI config merge composable for Vue components.
|
|
8
|
-
*
|
|
9
|
-
* Merges (highest priority first): 1. Local `ui` prop override 2. Global config from integration
|
|
10
|
-
* (virtual:rimelight-ui)
|
|
11
|
-
*
|
|
12
|
-
* @param componentName - The component key in the config (e.g. 'button')
|
|
13
|
-
* @param uiProp - The local `ui` prop from defineProps
|
|
14
|
-
* @returns ComputedRef of merged UI overrides
|
|
15
|
-
*/
|
|
16
|
-
export function useUi(
|
|
17
|
-
componentName: keyof DefaultUIConfig,
|
|
18
|
-
uiProp: Record<string, unknown> | undefined
|
|
19
|
-
): ComputedRef<Record<string, unknown>> {
|
|
20
|
-
const globalConfig = getUIConfig()
|
|
21
|
-
|
|
22
|
-
return computed(() => {
|
|
23
|
-
const componentConfig = globalConfig[componentName]
|
|
24
|
-
|
|
25
|
-
return defu(uiProp ?? {}, componentConfig ?? {})
|
|
26
|
-
})
|
|
27
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { Badge, Icon } from '@astrojs/starlight/components'
|
|
3
|
-
|
|
4
|
-
const { hasSidebar } = Astro.locals.starlightRoute
|
|
5
|
-
const { isPageWithTopic, topics } = Astro.locals.starlightSidebarTopics
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
{hasSidebar && isPageWithTopic && (
|
|
9
|
-
<ul class="starlight-sidebar-topics">
|
|
10
|
-
{topics.map((topic, index) => (
|
|
11
|
-
<li key={index}>
|
|
12
|
-
<a href={topic.link} class:list={{ 'starlight-sidebar-topics-current': topic.isCurrent }}>
|
|
13
|
-
{topic.icon && (
|
|
14
|
-
<div class="starlight-sidebar-topics-icon">
|
|
15
|
-
<Icon name={topic.icon} />
|
|
16
|
-
</div>
|
|
17
|
-
)}
|
|
18
|
-
<div>
|
|
19
|
-
{topic.label}
|
|
20
|
-
{topic.badge && (
|
|
21
|
-
<Badge class="starlight-sidebar-topics-badge" text={topic.badge.text} variant={topic.badge.variant} />
|
|
22
|
-
)}
|
|
23
|
-
</div>
|
|
24
|
-
</a>
|
|
25
|
-
</li>
|
|
26
|
-
))}
|
|
27
|
-
</ul>
|
|
28
|
-
)}
|
|
29
|
-
<style>
|
|
30
|
-
ul {
|
|
31
|
-
list-style: none;
|
|
32
|
-
padding: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
ul::after {
|
|
36
|
-
content: '';
|
|
37
|
-
display: block;
|
|
38
|
-
margin-top: 1rem;
|
|
39
|
-
height: 1px;
|
|
40
|
-
border-top: 1px solid var(--sl-color-hairline-light);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
li {
|
|
44
|
-
overflow-wrap: anywhere;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
li + li {
|
|
48
|
-
margin-top: 0.25rem;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
a {
|
|
52
|
-
align-items: center;
|
|
53
|
-
color: var(--sl-color-white);
|
|
54
|
-
display: flex;
|
|
55
|
-
font-size: var(--sl-text-base);
|
|
56
|
-
font-weight: 600;
|
|
57
|
-
gap: 0.5rem;
|
|
58
|
-
line-height: 1.5;
|
|
59
|
-
padding: 0.3em 0.5rem;
|
|
60
|
-
text-decoration: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
a:is(.starlight-sidebar-topics-current, :hover, :focus-visible) {
|
|
64
|
-
color: var(--sl-color-accent-high);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:global([data-theme='light']) a.starlight-sidebar-topics-current {
|
|
68
|
-
color: var(--sl-color-accent);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.starlight-sidebar-topics-icon {
|
|
72
|
-
align-items: center;
|
|
73
|
-
border-radius: 0.25rem;
|
|
74
|
-
border: 1px solid var(--sl-color-gray-4);
|
|
75
|
-
display: flex;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
padding: 0.25rem;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
a:is(.starlight-sidebar-topics-current, :hover, :focus-visible) .starlight-sidebar-topics-icon {
|
|
81
|
-
background-color: var(--sl-color-text-accent);
|
|
82
|
-
border-color: var(--sl-color-text-accent);
|
|
83
|
-
color: var(--sl-color-text-invert);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.starlight-sidebar-topics-badge {
|
|
87
|
-
margin-inline-start: 0.25em;
|
|
88
|
-
}
|
|
89
|
-
</style>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { StarlightIcon } from "@astrojs/starlight/types"
|
|
2
|
-
|
|
3
|
-
import type { SidebarTopicBadge } from "./libs/config"
|
|
4
|
-
|
|
5
|
-
export interface StarlightSidebarTopicsRouteData {
|
|
6
|
-
/**
|
|
7
|
-
* Indicates if the current page is associated with a topic or not.
|
|
8
|
-
*/
|
|
9
|
-
isPageWithTopic: boolean
|
|
10
|
-
/**
|
|
11
|
-
* A list of all configured topics.
|
|
12
|
-
*/
|
|
13
|
-
topics: {
|
|
14
|
-
/**
|
|
15
|
-
* The optional badge associated with the topic.
|
|
16
|
-
*/
|
|
17
|
-
badge?: {
|
|
18
|
-
text: string
|
|
19
|
-
variant: SidebarTopicBadge["variant"]
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The name of an optional icon associated with the topic set to one of Starlight’s built-in
|
|
23
|
-
* icons.
|
|
24
|
-
*/
|
|
25
|
-
icon?: StarlightIcon
|
|
26
|
-
/**
|
|
27
|
-
* Indicates if the current page is part of the topic.
|
|
28
|
-
*/
|
|
29
|
-
isCurrent: boolean
|
|
30
|
-
/**
|
|
31
|
-
* The label of the topic.
|
|
32
|
-
*/
|
|
33
|
-
label: string
|
|
34
|
-
/**
|
|
35
|
-
* The link to the topic’s content.
|
|
36
|
-
*/
|
|
37
|
-
link: string
|
|
38
|
-
}[]
|
|
39
|
-
}
|