@rimelight/ui 0.0.4 → 0.0.6
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 +36 -6
- package/src/components/BlogPost.astro +181 -0
- package/src/components/DynamicShowcase.astro +681 -0
- package/src/components/ExtendedCarousel.astro +107 -0
- package/src/components/Head.astro +150 -0
- package/src/components/LanguageSwitcher.astro +128 -0
- package/src/components/ProjectPost.astro +183 -0
- package/src/components/RLHead.astro +3 -0
- package/src/components/ThemeToggle.astro +30 -42
- package/src/components/astro/RLAButton.astro +85 -0
- package/src/components/astro/RLAHeader.astro +75 -0
- package/src/components/vue/RLVButton.vue +90 -0
- package/src/components/vue/RLVHeader.vue +78 -0
- package/src/composables/index.ts +1 -0
- package/src/composables/useUi.ts +27 -0
- package/src/config/index.ts +0 -2
- package/src/config/site.config.ts +1 -1
- package/src/env.d.ts +9 -42
- package/src/integrations/index.ts +2 -0
- package/src/integrations/ui.ts +87 -0
- package/src/themes/button.theme.ts +361 -0
- package/src/themes/header.theme.ts +33 -0
- package/src/themes/index.ts +13 -0
- package/src/utils/index.ts +3 -2
- package/i18n-data.json +0 -186
- package/src/components/accordion/Accordion.astro +0 -257
- package/src/components/accordion/AccordionContent.astro +0 -34
- package/src/components/accordion/AccordionItem.astro +0 -29
- package/src/components/accordion/AccordionTrigger.astro +0 -33
- package/src/components/alert/Alert.astro +0 -34
- package/src/components/alert/AlertDescription.astro +0 -15
- package/src/components/alert/AlertTitle.astro +0 -17
- package/src/components/alert-dialog/AlertDialog.astro +0 -275
- package/src/components/alert-dialog/AlertDialogAction.astro +0 -46
- package/src/components/alert-dialog/AlertDialogCancel.astro +0 -46
- package/src/components/alert-dialog/AlertDialogContent.astro +0 -52
- package/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
- package/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
- package/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
- package/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
- package/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
- package/src/components/aspect-ratio/AspectRatio.astro +0 -32
- package/src/components/avatar/Avatar.astro +0 -29
- package/src/components/avatar/AvatarFallback.astro +0 -18
- package/src/components/avatar/AvatarImage.astro +0 -66
- package/src/components/badge/Badge.astro +0 -57
- package/src/components/breadcrumb/Breadcrumb.astro +0 -12
- package/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -29
- package/src/components/breadcrumb/BreadcrumbItem.astro +0 -15
- package/src/components/breadcrumb/BreadcrumbLink.astro +0 -24
- package/src/components/breadcrumb/BreadcrumbList.astro +0 -17
- package/src/components/breadcrumb/BreadcrumbPage.astro +0 -22
- package/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -24
- package/src/components/button/Button.astro +0 -58
- package/src/components/button-group/ButtonGroup.astro +0 -64
- package/src/components/button-group/ButtonGroupSeparator.astro +0 -20
- package/src/components/button-group/ButtonGroupText.astro +0 -19
- package/src/components/card/Card.astro +0 -36
- package/src/components/card/CardAction.astro +0 -16
- package/src/components/card/CardContent.astro +0 -16
- package/src/components/card/CardDescription.astro +0 -16
- package/src/components/card/CardFooter.astro +0 -16
- package/src/components/card/CardHeader.astro +0 -19
- package/src/components/card/CardTitle.astro +0 -16
- package/src/components/carousel/Carousel.astro +0 -55
- package/src/components/carousel/CarouselContent.astro +0 -26
- package/src/components/carousel/CarouselItem.astro +0 -26
- package/src/components/carousel/CarouselNext.astro +0 -39
- package/src/components/carousel/CarouselPrevious.astro +0 -41
- package/src/components/carousel/carousel-script.ts +0 -188
- package/src/components/carousel/index.ts +0 -1
- package/src/components/checkbox/Checkbox.astro +0 -133
- package/src/components/collapsible/Collapsible.astro +0 -161
- package/src/components/collapsible/CollapsibleContent.astro +0 -22
- package/src/components/collapsible/CollapsibleTrigger.astro +0 -44
- package/src/components/dialog/Dialog.astro +0 -389
- package/src/components/dialog/DialogClose.astro +0 -35
- package/src/components/dialog/DialogContent.astro +0 -78
- package/src/components/dialog/DialogDescription.astro +0 -14
- package/src/components/dialog/DialogFooter.astro +0 -14
- package/src/components/dialog/DialogHeader.astro +0 -14
- package/src/components/dialog/DialogTitle.astro +0 -18
- package/src/components/dialog/DialogTrigger.astro +0 -47
- package/src/components/dropdown/Dropdown.astro +0 -604
- package/src/components/dropdown/DropdownContent.astro +0 -118
- package/src/components/dropdown/DropdownItem.astro +0 -48
- package/src/components/dropdown/DropdownLabel.astro +0 -29
- package/src/components/dropdown/DropdownSeparator.astro +0 -21
- package/src/components/dropdown/DropdownShortcut.astro +0 -17
- package/src/components/dropdown/DropdownSub.astro +0 -15
- package/src/components/dropdown/DropdownSubContent.astro +0 -39
- package/src/components/dropdown/DropdownSubTrigger.astro +0 -34
- package/src/components/dropdown/DropdownTrigger.astro +0 -52
- package/src/components/dropzone/Dropzone.astro +0 -236
- package/src/components/dropzone/DropzoneFilesList.astro +0 -26
- package/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
- package/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
- package/src/components/embeds/YoutubeEmbed.astro +0 -94
- package/src/components/hero/Hero.astro +0 -166
- package/src/components/icons/Flag.astro +0 -62
- package/src/components/image/ExtendedImage.astro +0 -46
- package/src/components/image/Image.astro +0 -25
- package/src/components/input/Input.astro +0 -27
- package/src/components/input-group/InputGroup.astro +0 -28
- package/src/components/input-group/InputGroupAddon.astro +0 -76
- package/src/components/input-group/InputGroupButton.astro +0 -36
- package/src/components/input-group/InputGroupInput.astro +0 -18
- package/src/components/input-group/InputGroupText.astro +0 -17
- package/src/components/input-group/InputGroupTextarea.astro +0 -22
- package/src/components/input-otp/InputOtp.astro +0 -352
- package/src/components/input-otp/InputOtpGroup.astro +0 -16
- package/src/components/input-otp/InputOtpSeparator.astro +0 -25
- package/src/components/input-otp/InputOtpSlot.astro +0 -50
- package/src/components/input-otp/InputOtpTypes.ts +0 -6
- package/src/components/item/Item.astro +0 -52
- package/src/components/item/ItemActions.astro +0 -16
- package/src/components/item/ItemContent.astro +0 -16
- package/src/components/item/ItemDescription.astro +0 -19
- package/src/components/item/ItemFooter.astro +0 -16
- package/src/components/item/ItemGroup.astro +0 -16
- package/src/components/item/ItemHeader.astro +0 -16
- package/src/components/item/ItemMedia.astro +0 -40
- package/src/components/item/ItemSeparator.astro +0 -23
- package/src/components/item/ItemTitle.astro +0 -16
- package/src/components/kbd/Kbd.astro +0 -21
- package/src/components/kbd/KbdGroup.astro +0 -16
- package/src/components/label/Label.astro +0 -24
- package/src/components/marquee/Marquee.astro +0 -73
- package/src/components/native-select/NativeSelect.astro +0 -68
- package/src/components/native-select/NativeSelectOptGroup.astro +0 -15
- package/src/components/native-select/NativeSelectOption.astro +0 -15
- package/src/components/pagination/Pagination.astro +0 -20
- package/src/components/pagination/PaginationContent.astro +0 -16
- package/src/components/pagination/PaginationEllipsis.astro +0 -37
- package/src/components/pagination/PaginationItem.astro +0 -16
- package/src/components/pagination/PaginationLink.astro +0 -27
- package/src/components/pagination/PaginationNext.astro +0 -33
- package/src/components/pagination/PaginationPrevious.astro +0 -33
- package/src/components/popover/Popover.astro +0 -717
- package/src/components/popover/PopoverContent.astro +0 -102
- package/src/components/popover/PopoverDescription.astro +0 -14
- package/src/components/popover/PopoverHeader.astro +0 -14
- package/src/components/popover/PopoverTitle.astro +0 -14
- package/src/components/popover/PopoverTrigger.astro +0 -51
- package/src/components/progress/Progress.astro +0 -154
- package/src/components/prose/Prose.astro +0 -619
- package/src/components/radio-group/RadioGroup.astro +0 -162
- package/src/components/radio-group/RadioGroupItem.astro +0 -133
- package/src/components/radio-group/RadioGroupTypes.ts +0 -6
- package/src/components/section/Section.astro +0 -167
- package/src/components/select/Select.astro +0 -752
- package/src/components/select/SelectContent.astro +0 -94
- package/src/components/select/SelectGroup.astro +0 -9
- package/src/components/select/SelectItem.astro +0 -51
- package/src/components/select/SelectLabel.astro +0 -14
- package/src/components/select/SelectSearch.astro +0 -49
- package/src/components/select/SelectSeparator.astro +0 -12
- package/src/components/select/SelectTrigger.astro +0 -56
- package/src/components/select/SelectTypes.ts +0 -13
- package/src/components/select/SelectValue.astro +0 -19
- package/src/components/separator/Separator.astro +0 -36
- package/src/components/sheet/Sheet.astro +0 -15
- package/src/components/sheet/SheetClose.astro +0 -15
- package/src/components/sheet/SheetContent.astro +0 -89
- package/src/components/sheet/SheetDescription.astro +0 -16
- package/src/components/sheet/SheetFooter.astro +0 -16
- package/src/components/sheet/SheetHeader.astro +0 -16
- package/src/components/sheet/SheetTitle.astro +0 -16
- package/src/components/sheet/SheetTrigger.astro +0 -15
- package/src/components/sidebar/Sidebar.astro +0 -231
- package/src/components/sidebar/SidebarContent.astro +0 -25
- package/src/components/sidebar/SidebarFooter.astro +0 -22
- package/src/components/sidebar/SidebarGroup.astro +0 -22
- package/src/components/sidebar/SidebarGroupContent.astro +0 -22
- package/src/components/sidebar/SidebarGroupLabel.astro +0 -53
- package/src/components/sidebar/SidebarHeader.astro +0 -22
- package/src/components/sidebar/SidebarInput.astro +0 -24
- package/src/components/sidebar/SidebarInset.astro +0 -22
- package/src/components/sidebar/SidebarMenu.astro +0 -22
- package/src/components/sidebar/SidebarMenuAction.astro +0 -63
- package/src/components/sidebar/SidebarMenuBadge.astro +0 -31
- package/src/components/sidebar/SidebarMenuButton.astro +0 -124
- package/src/components/sidebar/SidebarMenuItem.astro +0 -22
- package/src/components/sidebar/SidebarMenuSkeleton.astro +0 -43
- package/src/components/sidebar/SidebarMenuSub.astro +0 -25
- package/src/components/sidebar/SidebarMenuSubButton.astro +0 -52
- package/src/components/sidebar/SidebarMenuSubItem.astro +0 -17
- package/src/components/sidebar/SidebarProvider.astro +0 -215
- package/src/components/sidebar/SidebarRail.astro +0 -72
- package/src/components/sidebar/SidebarSeparator.astro +0 -25
- package/src/components/sidebar/SidebarTrigger.astro +0 -69
- package/src/components/skeleton/Skeleton.astro +0 -14
- package/src/components/slider/Slider.astro +0 -425
- package/src/components/spinner/Spinner.astro +0 -23
- package/src/components/switch/Switch.astro +0 -192
- package/src/components/switch/SwitchTypes.ts +0 -6
- package/src/components/table/Table.astro +0 -20
- package/src/components/table/TableBody.astro +0 -18
- package/src/components/table/TableCaption.astro +0 -18
- package/src/components/table/TableCell.astro +0 -18
- package/src/components/table/TableFoot.astro +0 -18
- package/src/components/table/TableHead.astro +0 -18
- package/src/components/table/TableHeader.astro +0 -18
- package/src/components/table/TableRow.astro +0 -17
- package/src/components/tabs/Tabs.astro +0 -270
- package/src/components/tabs/TabsContent.astro +0 -28
- package/src/components/tabs/TabsList.astro +0 -23
- package/src/components/tabs/TabsTrigger.astro +0 -34
- package/src/components/textarea/Textarea.astro +0 -31
- package/src/components/toast/ToastDescription.astro +0 -22
- package/src/components/toast/ToastItem.astro +0 -56
- package/src/components/toast/ToastTemplate.astro +0 -27
- package/src/components/toast/ToastTitle.astro +0 -59
- package/src/components/toast/Toaster.astro +0 -981
- package/src/components/toast/index.ts +0 -1
- package/src/components/toast/toast-manager.ts +0 -234
- package/src/components/toggle/Toggle.astro +0 -174
- package/src/components/toggle/ToggleTypes.ts +0 -14
- package/src/components/tooltip/Tooltip.astro +0 -422
- package/src/components/tooltip/TooltipContent.astro +0 -83
- package/src/components/tooltip/TooltipTrigger.astro +0 -13
- package/src/components/video/Video.astro +0 -121
- package/src/config/cookies.ts +0 -5
- package/src/config/links.ts +0 -4
- package/src/domain/cms/index.ts +0 -1
- package/src/domain/cms/types.ts +0 -20
- package/src/domain/i18n/constants.ts +0 -21
- package/src/domain/i18n/cookie-storage.ts +0 -13
- package/src/domain/i18n/country-to-locale-map.ts +0 -67
- package/src/domain/i18n/fallbacks.generated.ts +0 -230
- package/src/domain/i18n/fetcher.ts +0 -278
- package/src/domain/i18n/flags.ts +0 -16
- package/src/domain/i18n/format.ts +0 -90
- package/src/domain/i18n/index.ts +0 -10
- package/src/domain/i18n/middleware/i18n.ts +0 -161
- package/src/domain/i18n/resolve-locale.ts +0 -55
- package/src/domain/i18n/runtime-constants.ts +0 -14
- package/src/domain/i18n/schema.ts +0 -29
- package/src/domain/index.ts +0 -4
- package/src/domain/seo/constants.ts +0 -6
- package/src/domain/seo/index.ts +0 -3
- package/src/domain/seo/services/index.ts +0 -3
- package/src/domain/seo/services/llms.ts +0 -56
- package/src/domain/seo/services/robots.ts +0 -12
- package/src/domain/seo/services/sitemap.ts +0 -56
- package/src/domain/seo/utils.ts +0 -36
- package/src/domain/theme/constants.ts +0 -6
- package/src/domain/theme/index.ts +0 -2
- package/src/domain/theme/schema.ts +0 -10
- package/src/i18n.generated.d.ts +0 -202
- package/src/lib/component-preview.ts +0 -73
- package/src/lib/index.ts +0 -6
- package/src/lib/remark/remark-modified-time.ts +0 -13
- package/src/lib/showcase-preview-elements.ts +0 -408
- package/src/lib/showcase-renderer.ts +0 -218
- package/src/lib/showcase-utils.ts +0 -189
- package/src/lib/turnstile.ts +0 -35
- package/src/lib/utils/starwind/positioning.ts +0 -318
- package/src/locales/de/blog.json +0 -9
- package/src/locales/de/common.json +0 -19
- package/src/locales/de/errors.json +0 -6
- package/src/locales/de/home.json +0 -20
- package/src/locales/de/messages.json +0 -8
- package/src/locales/de/nav.json +0 -13
- package/src/locales/de/projects.json +0 -9
- package/src/locales/de/services.json +0 -43
- package/src/locales/en/blog.json +0 -9
- package/src/locales/en/chat.json +0 -29
- package/src/locales/en/common.json +0 -19
- package/src/locales/en/cookie_notice.json +0 -11
- package/src/locales/en/editor.json +0 -24
- package/src/locales/en/errors.json +0 -6
- package/src/locales/en/home.json +0 -20
- package/src/locales/en/messages.json +0 -8
- package/src/locales/en/nav.json +0 -13
- package/src/locales/en/projects.json +0 -9
- package/src/locales/en/services.json +0 -43
- package/src/locales/es/blog.json +0 -9
- package/src/locales/es/common.json +0 -19
- package/src/locales/es/errors.json +0 -6
- package/src/locales/es/home.json +0 -20
- package/src/locales/es/messages.json +0 -8
- package/src/locales/es/nav.json +0 -13
- package/src/locales/es/projects.json +0 -9
- package/src/locales/es/services.json +0 -43
- package/src/locales/ja/blog.json +0 -9
- package/src/locales/ja/common.json +0 -19
- package/src/locales/ja/errors.json +0 -6
- package/src/locales/ja/home.json +0 -20
- package/src/locales/ja/messages.json +0 -8
- package/src/locales/ja/nav.json +0 -13
- package/src/locales/ja/projects.json +0 -9
- package/src/locales/ja/services.json +0 -43
- package/src/locales/pt/blog.json +0 -9
- package/src/locales/pt/chat.json +0 -29
- package/src/locales/pt/common.json +0 -19
- package/src/locales/pt/cookie_notice.json +0 -11
- package/src/locales/pt/editor.json +0 -24
- package/src/locales/pt/errors.json +0 -6
- package/src/locales/pt/home.json +0 -20
- package/src/locales/pt/messages.json +0 -8
- package/src/locales/pt/nav.json +0 -13
- package/src/locales/pt/projects.json +0 -9
- package/src/locales/pt/services.json +0 -43
- package/src/utils/server/cookies.ts +0 -98
- package/src/utils/server/index.ts +0 -1
- package/src/utils/shared/index.ts +0 -3
- /package/src/utils/{shared/deep-merge.ts → deep-merge.ts} +0 -0
- /package/src/utils/{shared/embed.ts → embed.ts} +0 -0
- /package/src/utils/{shared/parse-boolean.ts → parse-boolean.ts} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv, cx } from "css-variants"
|
|
3
|
+
import { twMerge } from "tailwind-merge"
|
|
4
|
+
import defu from "defu"
|
|
5
|
+
import { buttonTheme } from "@/themes/button.theme.ts"
|
|
6
|
+
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
+
|
|
8
|
+
const button = scv({
|
|
9
|
+
slots: [...buttonTheme.slots],
|
|
10
|
+
base: buttonTheme.base,
|
|
11
|
+
variants: buttonTheme.variants,
|
|
12
|
+
compoundVariants: [...buttonTheme.compoundVariants],
|
|
13
|
+
defaultVariants: buttonTheme.defaultVariants,
|
|
14
|
+
classNameResolver: (...args) => twMerge(cx(...args)),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export interface RLAButtonProps {
|
|
18
|
+
/**
|
|
19
|
+
* Button variant style.
|
|
20
|
+
* @default "solid"
|
|
21
|
+
*/
|
|
22
|
+
variant?: keyof typeof buttonTheme.variants.variant;
|
|
23
|
+
/**
|
|
24
|
+
* Button color.
|
|
25
|
+
* @default "primary"
|
|
26
|
+
*/
|
|
27
|
+
color?: keyof typeof buttonTheme.variants.color;
|
|
28
|
+
/**
|
|
29
|
+
* Button size.
|
|
30
|
+
* @default "md"
|
|
31
|
+
*/
|
|
32
|
+
size?: keyof typeof buttonTheme.variants.size;
|
|
33
|
+
/**
|
|
34
|
+
* When provided, renders as <a> instead of <button>.
|
|
35
|
+
*/
|
|
36
|
+
href?: string;
|
|
37
|
+
/**
|
|
38
|
+
* UI overrides for individual slots, derived from the button theme.
|
|
39
|
+
*/
|
|
40
|
+
ui?: Partial<Record<keyof typeof buttonTheme.base, string>>;
|
|
41
|
+
/**
|
|
42
|
+
* External class — applied to the root element.
|
|
43
|
+
*/
|
|
44
|
+
class?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Standard HTML attributes for <button>
|
|
47
|
+
*/
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
variant = "solid",
|
|
53
|
+
color = "primary",
|
|
54
|
+
size = "md",
|
|
55
|
+
class: className,
|
|
56
|
+
ui: uiProp,
|
|
57
|
+
href,
|
|
58
|
+
...rest
|
|
59
|
+
} = Astro.props as RLAButtonProps
|
|
60
|
+
|
|
61
|
+
const globalConfig = getUIConfig();
|
|
62
|
+
|
|
63
|
+
const mergedUI = defu(
|
|
64
|
+
uiProp ?? {},
|
|
65
|
+
(globalConfig.button as Record<string, unknown>) ?? {},
|
|
66
|
+
) as Record<keyof typeof buttonTheme.base, string | undefined>;
|
|
67
|
+
|
|
68
|
+
const { root } = button({
|
|
69
|
+
variant,
|
|
70
|
+
color,
|
|
71
|
+
size,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Determine whether to render <a> or <button>
|
|
75
|
+
const Tag = href ? "a" : "button";
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
<Tag
|
|
79
|
+
class={twMerge(root, mergedUI.root, className)}
|
|
80
|
+
data-slot="rla-button"
|
|
81
|
+
{...(Tag === "a" ? { href } : {})}
|
|
82
|
+
{...rest}
|
|
83
|
+
>
|
|
84
|
+
<slot />
|
|
85
|
+
</Tag>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv, cx } from "css-variants";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import defu from "defu";
|
|
5
|
+
import { headerTheme } from "@/themes/header.theme.ts";
|
|
6
|
+
import { getUIConfig } from "virtual:rimelight-ui";
|
|
7
|
+
|
|
8
|
+
const header = scv({
|
|
9
|
+
slots: [...headerTheme.slots],
|
|
10
|
+
base: headerTheme.base,
|
|
11
|
+
variants: headerTheme.variants,
|
|
12
|
+
defaultVariants: headerTheme.defaultVariants,
|
|
13
|
+
classNameResolver: (...args) => twMerge(cx(...args)),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export interface RLAHeaderProps {
|
|
17
|
+
/**
|
|
18
|
+
* Whether to contain the header content in a max-width container.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
contain?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the header should be sticky at the top.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
sticky?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* UI overrides for individual slots, derived from the header theme.
|
|
29
|
+
*/
|
|
30
|
+
ui?: Partial<Record<keyof typeof headerTheme.base, string>>;
|
|
31
|
+
/**
|
|
32
|
+
* External class — applied to the root element.
|
|
33
|
+
*/
|
|
34
|
+
class?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Standard HTML attributes for <header>
|
|
37
|
+
*/
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
contain = true,
|
|
43
|
+
sticky = true,
|
|
44
|
+
class: className,
|
|
45
|
+
ui: uiProp,
|
|
46
|
+
...rest
|
|
47
|
+
} = Astro.props as RLAHeaderProps
|
|
48
|
+
|
|
49
|
+
const globalConfig = getUIConfig();
|
|
50
|
+
|
|
51
|
+
const mergedUI = defu(
|
|
52
|
+
uiProp ?? {},
|
|
53
|
+
(globalConfig.header as Record<string, unknown>) ?? {},
|
|
54
|
+
) as Record<keyof typeof headerTheme.base, string | undefined>;
|
|
55
|
+
|
|
56
|
+
const { root, container, left, center, right } = header({ contain, sticky });
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
<header
|
|
60
|
+
class:list={[twMerge(root, mergedUI.root, className)]}
|
|
61
|
+
data-slot="rla-header"
|
|
62
|
+
{...rest}
|
|
63
|
+
>
|
|
64
|
+
<div class:list={[twMerge(container, mergedUI.container)]}>
|
|
65
|
+
<div class:list={[twMerge(left, mergedUI.left)]} data-slot="header-left">
|
|
66
|
+
<slot name="left" />
|
|
67
|
+
</div>
|
|
68
|
+
<div class:list={[twMerge(center, mergedUI.center)]} data-slot="header-center">
|
|
69
|
+
<slot name="center" />
|
|
70
|
+
</div>
|
|
71
|
+
<div class:list={[twMerge(right, mergedUI.right)]} data-slot="header-right">
|
|
72
|
+
<slot name="right" />
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</header>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { scv, cx } from "css-variants"
|
|
3
|
+
import { twMerge } from "tailwind-merge"
|
|
4
|
+
import defu from "defu"
|
|
5
|
+
import { buttonTheme } from "@/themes/button.theme.ts"
|
|
6
|
+
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
+
|
|
8
|
+
const button = scv({
|
|
9
|
+
slots: [...buttonTheme.slots],
|
|
10
|
+
base: buttonTheme.base,
|
|
11
|
+
variants: buttonTheme.variants,
|
|
12
|
+
compoundVariants: [...buttonTheme.compoundVariants],
|
|
13
|
+
defaultVariants: buttonTheme.defaultVariants,
|
|
14
|
+
classNameResolver: (...args) => twMerge(cx(...args))
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export interface RLVButtonProps {
|
|
18
|
+
/**
|
|
19
|
+
* Button variant.
|
|
20
|
+
*
|
|
21
|
+
* @default "solid"
|
|
22
|
+
*/
|
|
23
|
+
variant?: keyof typeof buttonTheme.variants.variant
|
|
24
|
+
/**
|
|
25
|
+
* Button color.
|
|
26
|
+
*
|
|
27
|
+
* @default "primary"
|
|
28
|
+
*/
|
|
29
|
+
color?: keyof typeof buttonTheme.variants.color
|
|
30
|
+
/**
|
|
31
|
+
* Button size.
|
|
32
|
+
*
|
|
33
|
+
* @default "md"
|
|
34
|
+
*/
|
|
35
|
+
size?: keyof typeof buttonTheme.variants.size
|
|
36
|
+
/**
|
|
37
|
+
* When provided, renders as <a> instead of <button>.
|
|
38
|
+
*/
|
|
39
|
+
href?: string
|
|
40
|
+
/**
|
|
41
|
+
* UI overrides for individual slots, derived from the button theme.
|
|
42
|
+
*/
|
|
43
|
+
ui?: Partial<Record<keyof typeof buttonTheme.base, string>>
|
|
44
|
+
/**
|
|
45
|
+
* External class — applied to the root element.
|
|
46
|
+
*/
|
|
47
|
+
class?: string
|
|
48
|
+
/**
|
|
49
|
+
* Standard HTML attributes for <button>
|
|
50
|
+
*/
|
|
51
|
+
[key: string]: unknown
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
variant = "solid",
|
|
56
|
+
color = "primary",
|
|
57
|
+
size = "md",
|
|
58
|
+
class: className,
|
|
59
|
+
ui: uiProp,
|
|
60
|
+
href
|
|
61
|
+
} = defineProps<RLVButtonProps>()
|
|
62
|
+
|
|
63
|
+
const globalConfig = getUIConfig()
|
|
64
|
+
|
|
65
|
+
const mergedUI = defu(
|
|
66
|
+
uiProp ?? {},
|
|
67
|
+
(globalConfig.button as Record<string, unknown>) ?? {}
|
|
68
|
+
) as Record<keyof typeof buttonTheme.base, string | undefined>
|
|
69
|
+
|
|
70
|
+
const { root } = button({
|
|
71
|
+
variant,
|
|
72
|
+
color,
|
|
73
|
+
size
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// Determine whether to render <a> or <button>
|
|
77
|
+
const Tag = href ? "a" : "button"
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<component
|
|
82
|
+
v-bind="$attrs"
|
|
83
|
+
:is="Tag"
|
|
84
|
+
:href="href"
|
|
85
|
+
:class="twMerge(root, mergedUI.root, className)"
|
|
86
|
+
data-slot="rlv-button"
|
|
87
|
+
>
|
|
88
|
+
<slot />
|
|
89
|
+
</component>
|
|
90
|
+
</template>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
import { scv, cx } from "css-variants"
|
|
4
|
+
import { twMerge } from "tailwind-merge"
|
|
5
|
+
import { useUi } from "../../composables"
|
|
6
|
+
import { headerTheme } from "@/themes/header.theme.ts"
|
|
7
|
+
|
|
8
|
+
const header = scv({
|
|
9
|
+
slots: [...headerTheme.slots],
|
|
10
|
+
base: headerTheme.base,
|
|
11
|
+
variants: headerTheme.variants,
|
|
12
|
+
defaultVariants: headerTheme.defaultVariants,
|
|
13
|
+
classNameResolver: (...args) => twMerge(cx(...args))
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export interface RLVHeaderProps {
|
|
17
|
+
/**
|
|
18
|
+
* Whether to contain the header content in a max-width container.
|
|
19
|
+
*
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
contain?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* Whether the header should be sticky at the top.
|
|
25
|
+
*
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
sticky?: boolean
|
|
29
|
+
/**
|
|
30
|
+
* UI overrides for individual slots, derived from the header theme.
|
|
31
|
+
*/
|
|
32
|
+
ui?: Partial<Record<keyof typeof headerTheme.base, string>>
|
|
33
|
+
/**
|
|
34
|
+
* External class — applied to the root element.
|
|
35
|
+
*/
|
|
36
|
+
class?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
contain = true,
|
|
41
|
+
sticky = true,
|
|
42
|
+
class: className,
|
|
43
|
+
ui: uiProp
|
|
44
|
+
} = defineProps<RLVHeaderProps>()
|
|
45
|
+
|
|
46
|
+
const mergedUI = useUi("header", uiProp as Record<string, unknown> | undefined)
|
|
47
|
+
|
|
48
|
+
const resolvedClasses = computed(() => {
|
|
49
|
+
const classes = header({
|
|
50
|
+
contain,
|
|
51
|
+
sticky
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
root: twMerge(classes.root, mergedUI.value.root as string | undefined),
|
|
56
|
+
container: twMerge(classes.container, mergedUI.value.container as string | undefined),
|
|
57
|
+
left: twMerge(classes.left, mergedUI.value.left as string | undefined),
|
|
58
|
+
center: twMerge(classes.center, mergedUI.value.center as string | undefined),
|
|
59
|
+
right: twMerge(classes.right, mergedUI.value.right as string | undefined)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<header :class="[resolvedClasses.root, className]" data-slot="rlv-header" v-bind="$attrs">
|
|
66
|
+
<div :class="resolvedClasses.container">
|
|
67
|
+
<div :class="resolvedClasses.left" data-slot="header-left">
|
|
68
|
+
<slot name="left" />
|
|
69
|
+
</div>
|
|
70
|
+
<div :class="resolvedClasses.center" data-slot="header-center">
|
|
71
|
+
<slot name="center" />
|
|
72
|
+
</div>
|
|
73
|
+
<div :class="resolvedClasses.right" data-slot="header-right">
|
|
74
|
+
<slot name="right" />
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</header>
|
|
78
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useUi } from "./useUi"
|
|
@@ -0,0 +1,27 @@
|
|
|
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<T extends keyof DefaultUIConfig>(
|
|
17
|
+
componentName: T,
|
|
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
|
+
}
|
package/src/config/index.ts
CHANGED
package/src/env.d.ts
CHANGED
|
@@ -1,49 +1,16 @@
|
|
|
1
1
|
/// <reference types="astro/client" />
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
readonly DEV: boolean
|
|
6
|
-
// add other env vars here...
|
|
7
|
-
}
|
|
3
|
+
declare module "virtual:rimelight-ui" {
|
|
4
|
+
import type { DefaultUIConfig } from "../themes"
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
readonly env: ImportMetaEnv
|
|
6
|
+
export function getUIConfig(): DefaultUIConfig
|
|
11
7
|
}
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
translationLocale: Locale
|
|
20
|
-
cfContext: any
|
|
21
|
-
isMissingContent?: boolean
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
declare module "astro:content" {
|
|
26
|
-
export interface CollectionEntry<T extends string = any> {
|
|
27
|
-
id: string
|
|
28
|
-
data: any
|
|
29
|
-
slug: string
|
|
30
|
-
body: string
|
|
31
|
-
collection: T
|
|
32
|
-
}
|
|
33
|
-
export const getCollection: (
|
|
34
|
-
collection: string,
|
|
35
|
-
filter?: (entry: CollectionEntry) => boolean
|
|
36
|
-
) => Promise<CollectionEntry[]>
|
|
37
|
-
export const getEntry: (collection: string, id: string) => Promise<CollectionEntry>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare module "cloudflare:workers" {
|
|
41
|
-
export const env: Env
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare module "~icons/*" {
|
|
45
|
-
import type { AstroComponentFactory } from "astro/runtime/server/index.js"
|
|
46
|
-
const component: AstroComponentFactory
|
|
47
|
-
export default component
|
|
9
|
+
declare namespace App {
|
|
10
|
+
interface Locals {
|
|
11
|
+
uiLocale?: string
|
|
12
|
+
translationLocale?: string
|
|
13
|
+
isMissingContent?: boolean
|
|
14
|
+
cfContext?: Record<string, unknown>
|
|
48
15
|
}
|
|
49
16
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AstroIntegration } from "astro"
|
|
2
|
+
import defu from "defu"
|
|
3
|
+
import Icons from "unplugin-icons/vite"
|
|
4
|
+
import { defaultUIConfig } from "../themes"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shape of the `ui` config that can be passed to the integration. Keys are component names, values
|
|
8
|
+
* are partial theme configs.
|
|
9
|
+
*/
|
|
10
|
+
export type UIConfigOverrides = {
|
|
11
|
+
button?: Partial<(typeof defaultUIConfig)["button"]>
|
|
12
|
+
header?: Partial<(typeof defaultUIConfig)["header"]>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface UIOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Global UI overrides applied to all components. Merged with defaults via `defu` (first arg
|
|
18
|
+
* wins).
|
|
19
|
+
*/
|
|
20
|
+
ui?: UIConfigOverrides
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Astro integration for `@rimelight/ui`.
|
|
25
|
+
*
|
|
26
|
+
* Provides global UI configuration via a virtual module. Components import `virtual:rimelight-ui`
|
|
27
|
+
* to access the merged config.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // astro.config.mjs
|
|
31
|
+
* import { ui } from "@rimelight/ui/integrations"
|
|
32
|
+
*
|
|
33
|
+
* export default defineConfig({
|
|
34
|
+
* integrations: [
|
|
35
|
+
* ui({
|
|
36
|
+
* ui: {
|
|
37
|
+
* button: {
|
|
38
|
+
* defaultVariants: { variant: "primary" }
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* })
|
|
42
|
+
* ]
|
|
43
|
+
* })
|
|
44
|
+
*/
|
|
45
|
+
export function ui(options: UIOptions = {}): AstroIntegration {
|
|
46
|
+
// Merge user overrides with defaults (user-provided values win)
|
|
47
|
+
const resolvedConfig = defu(options.ui ?? {}, defaultUIConfig)
|
|
48
|
+
|
|
49
|
+
const virtualModuleId = "virtual:rimelight-ui"
|
|
50
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
name: "@rimelight/ui",
|
|
54
|
+
hooks: {
|
|
55
|
+
"astro:config:setup": ({ updateConfig, logger }) => {
|
|
56
|
+
logger.info("Initializing @rimelight/ui configuration")
|
|
57
|
+
|
|
58
|
+
updateConfig({
|
|
59
|
+
vite: {
|
|
60
|
+
plugins: [
|
|
61
|
+
Icons({
|
|
62
|
+
compiler: "astro",
|
|
63
|
+
autoInstall: true
|
|
64
|
+
}),
|
|
65
|
+
{
|
|
66
|
+
name: "vite-plugin-rimelight-ui-config",
|
|
67
|
+
enforce: "pre",
|
|
68
|
+
resolveId(id: string) {
|
|
69
|
+
if (id === virtualModuleId) {
|
|
70
|
+
return resolvedVirtualModuleId
|
|
71
|
+
}
|
|
72
|
+
return null
|
|
73
|
+
},
|
|
74
|
+
load(id: string) {
|
|
75
|
+
if (id === resolvedVirtualModuleId) {
|
|
76
|
+
return `export const getUIConfig = () => (${JSON.stringify(resolvedConfig)});`
|
|
77
|
+
}
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|