@rimelight/ui 0.0.5 → 0.0.7

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.
Files changed (315) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +22 -14
  3. package/src/components/BlogPost.astro +195 -0
  4. package/src/components/DynamicShowcase.astro +681 -0
  5. package/src/components/ExtendedCarousel.astro +107 -0
  6. package/src/components/FormattedDate.astro +6 -2
  7. package/src/components/Head.astro +153 -0
  8. package/src/components/ProjectPost.astro +197 -0
  9. package/src/components/RLHead.astro +3 -0
  10. package/src/components/ThemeToggle.astro +30 -42
  11. package/src/components/astro/RLAButton.astro +32 -42
  12. package/src/components/astro/RLAHeader.astro +75 -0
  13. package/src/components/nuxt/index.ts +1 -0
  14. package/src/components/vue/RLVButton.vue +50 -37
  15. package/src/components/vue/RLVHeader.vue +78 -0
  16. package/src/composables/index.ts +1 -1
  17. package/src/composables/{useComponentUI.ts → useUi.ts} +3 -3
  18. package/src/config/index.ts +0 -2
  19. package/src/config/site.config.ts +1 -1
  20. package/src/env.d.ts +13 -16
  21. package/src/integrations/ui.ts +106 -81
  22. package/src/integrations/vue-entrypoint.ts +6 -0
  23. package/src/middleware/sri.ts +2 -2
  24. package/src/styles/index.css +2 -0
  25. package/src/themes/button.theme.ts +350 -34
  26. package/src/themes/header.theme.ts +33 -0
  27. package/src/themes/index.ts +3 -1
  28. package/src/utils/index.ts +1 -2
  29. package/i18n-data.json +0 -186
  30. package/src/components/MissingTranslationBanner.astro +0 -39
  31. package/src/components/accordion/Accordion.astro +0 -257
  32. package/src/components/accordion/AccordionContent.astro +0 -34
  33. package/src/components/accordion/AccordionItem.astro +0 -29
  34. package/src/components/accordion/AccordionTrigger.astro +0 -33
  35. package/src/components/alert/Alert.astro +0 -34
  36. package/src/components/alert/AlertDescription.astro +0 -15
  37. package/src/components/alert/AlertTitle.astro +0 -17
  38. package/src/components/alert-dialog/AlertDialog.astro +0 -275
  39. package/src/components/alert-dialog/AlertDialogAction.astro +0 -46
  40. package/src/components/alert-dialog/AlertDialogCancel.astro +0 -46
  41. package/src/components/alert-dialog/AlertDialogContent.astro +0 -52
  42. package/src/components/alert-dialog/AlertDialogDescription.astro +0 -18
  43. package/src/components/alert-dialog/AlertDialogFooter.astro +0 -16
  44. package/src/components/alert-dialog/AlertDialogHeader.astro +0 -14
  45. package/src/components/alert-dialog/AlertDialogTitle.astro +0 -20
  46. package/src/components/alert-dialog/AlertDialogTrigger.astro +0 -47
  47. package/src/components/aspect-ratio/AspectRatio.astro +0 -32
  48. package/src/components/avatar/Avatar.astro +0 -29
  49. package/src/components/avatar/AvatarFallback.astro +0 -18
  50. package/src/components/avatar/AvatarImage.astro +0 -66
  51. package/src/components/badge/Badge.astro +0 -57
  52. package/src/components/breadcrumb/Breadcrumb.astro +0 -12
  53. package/src/components/breadcrumb/BreadcrumbEllipsis.astro +0 -29
  54. package/src/components/breadcrumb/BreadcrumbItem.astro +0 -15
  55. package/src/components/breadcrumb/BreadcrumbLink.astro +0 -24
  56. package/src/components/breadcrumb/BreadcrumbList.astro +0 -17
  57. package/src/components/breadcrumb/BreadcrumbPage.astro +0 -22
  58. package/src/components/breadcrumb/BreadcrumbSeparator.astro +0 -24
  59. package/src/components/button/Button.astro +0 -58
  60. package/src/components/button-group/ButtonGroup.astro +0 -64
  61. package/src/components/button-group/ButtonGroupSeparator.astro +0 -20
  62. package/src/components/button-group/ButtonGroupText.astro +0 -19
  63. package/src/components/card/Card.astro +0 -36
  64. package/src/components/card/CardAction.astro +0 -16
  65. package/src/components/card/CardContent.astro +0 -16
  66. package/src/components/card/CardDescription.astro +0 -16
  67. package/src/components/card/CardFooter.astro +0 -16
  68. package/src/components/card/CardHeader.astro +0 -19
  69. package/src/components/card/CardTitle.astro +0 -16
  70. package/src/components/carousel/Carousel.astro +0 -55
  71. package/src/components/carousel/CarouselContent.astro +0 -26
  72. package/src/components/carousel/CarouselItem.astro +0 -26
  73. package/src/components/carousel/CarouselNext.astro +0 -39
  74. package/src/components/carousel/CarouselPrevious.astro +0 -41
  75. package/src/components/carousel/carousel-script.ts +0 -188
  76. package/src/components/carousel/index.ts +0 -1
  77. package/src/components/checkbox/Checkbox.astro +0 -133
  78. package/src/components/collapsible/Collapsible.astro +0 -161
  79. package/src/components/collapsible/CollapsibleContent.astro +0 -22
  80. package/src/components/collapsible/CollapsibleTrigger.astro +0 -44
  81. package/src/components/dialog/Dialog.astro +0 -389
  82. package/src/components/dialog/DialogClose.astro +0 -35
  83. package/src/components/dialog/DialogContent.astro +0 -78
  84. package/src/components/dialog/DialogDescription.astro +0 -14
  85. package/src/components/dialog/DialogFooter.astro +0 -14
  86. package/src/components/dialog/DialogHeader.astro +0 -14
  87. package/src/components/dialog/DialogTitle.astro +0 -18
  88. package/src/components/dialog/DialogTrigger.astro +0 -47
  89. package/src/components/dropdown/Dropdown.astro +0 -604
  90. package/src/components/dropdown/DropdownContent.astro +0 -118
  91. package/src/components/dropdown/DropdownItem.astro +0 -48
  92. package/src/components/dropdown/DropdownLabel.astro +0 -29
  93. package/src/components/dropdown/DropdownSeparator.astro +0 -21
  94. package/src/components/dropdown/DropdownShortcut.astro +0 -17
  95. package/src/components/dropdown/DropdownSub.astro +0 -15
  96. package/src/components/dropdown/DropdownSubContent.astro +0 -39
  97. package/src/components/dropdown/DropdownSubTrigger.astro +0 -34
  98. package/src/components/dropdown/DropdownTrigger.astro +0 -52
  99. package/src/components/dropzone/Dropzone.astro +0 -236
  100. package/src/components/dropzone/DropzoneFilesList.astro +0 -26
  101. package/src/components/dropzone/DropzoneLoadingIndicator.astro +0 -10
  102. package/src/components/dropzone/DropzoneUploadIndicator.astro +0 -10
  103. package/src/components/embeds/YoutubeEmbed.astro +0 -94
  104. package/src/components/hero/Hero.astro +0 -166
  105. package/src/components/icons/Flag.astro +0 -62
  106. package/src/components/image/ExtendedImage.astro +0 -46
  107. package/src/components/image/Image.astro +0 -25
  108. package/src/components/input/Input.astro +0 -27
  109. package/src/components/input-group/InputGroup.astro +0 -28
  110. package/src/components/input-group/InputGroupAddon.astro +0 -76
  111. package/src/components/input-group/InputGroupButton.astro +0 -36
  112. package/src/components/input-group/InputGroupInput.astro +0 -18
  113. package/src/components/input-group/InputGroupText.astro +0 -17
  114. package/src/components/input-group/InputGroupTextarea.astro +0 -22
  115. package/src/components/input-otp/InputOtp.astro +0 -352
  116. package/src/components/input-otp/InputOtpGroup.astro +0 -16
  117. package/src/components/input-otp/InputOtpSeparator.astro +0 -25
  118. package/src/components/input-otp/InputOtpSlot.astro +0 -50
  119. package/src/components/input-otp/InputOtpTypes.ts +0 -6
  120. package/src/components/item/Item.astro +0 -52
  121. package/src/components/item/ItemActions.astro +0 -16
  122. package/src/components/item/ItemContent.astro +0 -16
  123. package/src/components/item/ItemDescription.astro +0 -19
  124. package/src/components/item/ItemFooter.astro +0 -16
  125. package/src/components/item/ItemGroup.astro +0 -16
  126. package/src/components/item/ItemHeader.astro +0 -16
  127. package/src/components/item/ItemMedia.astro +0 -40
  128. package/src/components/item/ItemSeparator.astro +0 -23
  129. package/src/components/item/ItemTitle.astro +0 -16
  130. package/src/components/kbd/Kbd.astro +0 -21
  131. package/src/components/kbd/KbdGroup.astro +0 -16
  132. package/src/components/label/Label.astro +0 -24
  133. package/src/components/marquee/Marquee.astro +0 -73
  134. package/src/components/native-select/NativeSelect.astro +0 -68
  135. package/src/components/native-select/NativeSelectOptGroup.astro +0 -15
  136. package/src/components/native-select/NativeSelectOption.astro +0 -15
  137. package/src/components/pagination/Pagination.astro +0 -20
  138. package/src/components/pagination/PaginationContent.astro +0 -16
  139. package/src/components/pagination/PaginationEllipsis.astro +0 -37
  140. package/src/components/pagination/PaginationItem.astro +0 -16
  141. package/src/components/pagination/PaginationLink.astro +0 -27
  142. package/src/components/pagination/PaginationNext.astro +0 -33
  143. package/src/components/pagination/PaginationPrevious.astro +0 -33
  144. package/src/components/popover/Popover.astro +0 -717
  145. package/src/components/popover/PopoverContent.astro +0 -102
  146. package/src/components/popover/PopoverDescription.astro +0 -14
  147. package/src/components/popover/PopoverHeader.astro +0 -14
  148. package/src/components/popover/PopoverTitle.astro +0 -14
  149. package/src/components/popover/PopoverTrigger.astro +0 -51
  150. package/src/components/progress/Progress.astro +0 -154
  151. package/src/components/prose/Prose.astro +0 -619
  152. package/src/components/radio-group/RadioGroup.astro +0 -162
  153. package/src/components/radio-group/RadioGroupItem.astro +0 -133
  154. package/src/components/radio-group/RadioGroupTypes.ts +0 -6
  155. package/src/components/section/Section.astro +0 -167
  156. package/src/components/select/Select.astro +0 -752
  157. package/src/components/select/SelectContent.astro +0 -94
  158. package/src/components/select/SelectGroup.astro +0 -9
  159. package/src/components/select/SelectItem.astro +0 -51
  160. package/src/components/select/SelectLabel.astro +0 -14
  161. package/src/components/select/SelectSearch.astro +0 -49
  162. package/src/components/select/SelectSeparator.astro +0 -12
  163. package/src/components/select/SelectTrigger.astro +0 -56
  164. package/src/components/select/SelectTypes.ts +0 -13
  165. package/src/components/select/SelectValue.astro +0 -19
  166. package/src/components/separator/Separator.astro +0 -36
  167. package/src/components/sheet/Sheet.astro +0 -15
  168. package/src/components/sheet/SheetClose.astro +0 -15
  169. package/src/components/sheet/SheetContent.astro +0 -89
  170. package/src/components/sheet/SheetDescription.astro +0 -16
  171. package/src/components/sheet/SheetFooter.astro +0 -16
  172. package/src/components/sheet/SheetHeader.astro +0 -16
  173. package/src/components/sheet/SheetTitle.astro +0 -16
  174. package/src/components/sheet/SheetTrigger.astro +0 -15
  175. package/src/components/sidebar/Sidebar.astro +0 -231
  176. package/src/components/sidebar/SidebarContent.astro +0 -25
  177. package/src/components/sidebar/SidebarFooter.astro +0 -22
  178. package/src/components/sidebar/SidebarGroup.astro +0 -22
  179. package/src/components/sidebar/SidebarGroupContent.astro +0 -22
  180. package/src/components/sidebar/SidebarGroupLabel.astro +0 -53
  181. package/src/components/sidebar/SidebarHeader.astro +0 -22
  182. package/src/components/sidebar/SidebarInput.astro +0 -24
  183. package/src/components/sidebar/SidebarInset.astro +0 -22
  184. package/src/components/sidebar/SidebarMenu.astro +0 -22
  185. package/src/components/sidebar/SidebarMenuAction.astro +0 -63
  186. package/src/components/sidebar/SidebarMenuBadge.astro +0 -31
  187. package/src/components/sidebar/SidebarMenuButton.astro +0 -124
  188. package/src/components/sidebar/SidebarMenuItem.astro +0 -22
  189. package/src/components/sidebar/SidebarMenuSkeleton.astro +0 -43
  190. package/src/components/sidebar/SidebarMenuSub.astro +0 -25
  191. package/src/components/sidebar/SidebarMenuSubButton.astro +0 -52
  192. package/src/components/sidebar/SidebarMenuSubItem.astro +0 -17
  193. package/src/components/sidebar/SidebarProvider.astro +0 -215
  194. package/src/components/sidebar/SidebarRail.astro +0 -72
  195. package/src/components/sidebar/SidebarSeparator.astro +0 -25
  196. package/src/components/sidebar/SidebarTrigger.astro +0 -69
  197. package/src/components/skeleton/Skeleton.astro +0 -14
  198. package/src/components/slider/Slider.astro +0 -425
  199. package/src/components/spinner/Spinner.astro +0 -23
  200. package/src/components/switch/Switch.astro +0 -192
  201. package/src/components/switch/SwitchTypes.ts +0 -6
  202. package/src/components/table/Table.astro +0 -20
  203. package/src/components/table/TableBody.astro +0 -18
  204. package/src/components/table/TableCaption.astro +0 -18
  205. package/src/components/table/TableCell.astro +0 -18
  206. package/src/components/table/TableFoot.astro +0 -18
  207. package/src/components/table/TableHead.astro +0 -18
  208. package/src/components/table/TableHeader.astro +0 -18
  209. package/src/components/table/TableRow.astro +0 -17
  210. package/src/components/tabs/Tabs.astro +0 -270
  211. package/src/components/tabs/TabsContent.astro +0 -28
  212. package/src/components/tabs/TabsList.astro +0 -23
  213. package/src/components/tabs/TabsTrigger.astro +0 -34
  214. package/src/components/textarea/Textarea.astro +0 -31
  215. package/src/components/toast/ToastDescription.astro +0 -22
  216. package/src/components/toast/ToastItem.astro +0 -56
  217. package/src/components/toast/ToastTemplate.astro +0 -27
  218. package/src/components/toast/ToastTitle.astro +0 -59
  219. package/src/components/toast/Toaster.astro +0 -981
  220. package/src/components/toast/index.ts +0 -1
  221. package/src/components/toast/toast-manager.ts +0 -234
  222. package/src/components/toggle/Toggle.astro +0 -174
  223. package/src/components/toggle/ToggleTypes.ts +0 -14
  224. package/src/components/tooltip/Tooltip.astro +0 -422
  225. package/src/components/tooltip/TooltipContent.astro +0 -83
  226. package/src/components/tooltip/TooltipTrigger.astro +0 -13
  227. package/src/components/video/Video.astro +0 -121
  228. package/src/config/cookies.ts +0 -5
  229. package/src/config/links.ts +0 -4
  230. package/src/domain/cms/index.ts +0 -1
  231. package/src/domain/cms/types.ts +0 -20
  232. package/src/domain/i18n/constants.ts +0 -21
  233. package/src/domain/i18n/cookie-storage.ts +0 -13
  234. package/src/domain/i18n/country-to-locale-map.ts +0 -67
  235. package/src/domain/i18n/fallbacks.generated.ts +0 -230
  236. package/src/domain/i18n/fetcher.ts +0 -278
  237. package/src/domain/i18n/flags.ts +0 -16
  238. package/src/domain/i18n/format.ts +0 -90
  239. package/src/domain/i18n/index.ts +0 -10
  240. package/src/domain/i18n/middleware/i18n.ts +0 -161
  241. package/src/domain/i18n/resolve-locale.ts +0 -55
  242. package/src/domain/i18n/runtime-constants.ts +0 -14
  243. package/src/domain/i18n/schema.ts +0 -29
  244. package/src/domain/index.ts +0 -4
  245. package/src/domain/seo/constants.ts +0 -6
  246. package/src/domain/seo/index.ts +0 -3
  247. package/src/domain/seo/services/index.ts +0 -3
  248. package/src/domain/seo/services/llms.ts +0 -56
  249. package/src/domain/seo/services/robots.ts +0 -12
  250. package/src/domain/seo/services/sitemap.ts +0 -56
  251. package/src/domain/seo/utils.ts +0 -36
  252. package/src/domain/theme/constants.ts +0 -6
  253. package/src/domain/theme/index.ts +0 -2
  254. package/src/domain/theme/schema.ts +0 -10
  255. package/src/i18n.generated.d.ts +0 -202
  256. package/src/lib/component-preview.ts +0 -73
  257. package/src/lib/index.ts +0 -6
  258. package/src/lib/remark/remark-modified-time.ts +0 -13
  259. package/src/lib/showcase-preview-elements.ts +0 -408
  260. package/src/lib/showcase-renderer.ts +0 -218
  261. package/src/lib/showcase-utils.ts +0 -189
  262. package/src/lib/turnstile.ts +0 -35
  263. package/src/lib/utils/starwind/positioning.ts +0 -318
  264. package/src/locales/de/blog.json +0 -9
  265. package/src/locales/de/common.json +0 -19
  266. package/src/locales/de/errors.json +0 -6
  267. package/src/locales/de/home.json +0 -20
  268. package/src/locales/de/messages.json +0 -8
  269. package/src/locales/de/nav.json +0 -13
  270. package/src/locales/de/projects.json +0 -9
  271. package/src/locales/de/services.json +0 -43
  272. package/src/locales/en/blog.json +0 -9
  273. package/src/locales/en/chat.json +0 -29
  274. package/src/locales/en/common.json +0 -19
  275. package/src/locales/en/cookie_notice.json +0 -11
  276. package/src/locales/en/editor.json +0 -24
  277. package/src/locales/en/errors.json +0 -6
  278. package/src/locales/en/home.json +0 -20
  279. package/src/locales/en/messages.json +0 -8
  280. package/src/locales/en/nav.json +0 -13
  281. package/src/locales/en/projects.json +0 -9
  282. package/src/locales/en/services.json +0 -43
  283. package/src/locales/es/blog.json +0 -9
  284. package/src/locales/es/common.json +0 -19
  285. package/src/locales/es/errors.json +0 -6
  286. package/src/locales/es/home.json +0 -20
  287. package/src/locales/es/messages.json +0 -8
  288. package/src/locales/es/nav.json +0 -13
  289. package/src/locales/es/projects.json +0 -9
  290. package/src/locales/es/services.json +0 -43
  291. package/src/locales/ja/blog.json +0 -9
  292. package/src/locales/ja/common.json +0 -19
  293. package/src/locales/ja/errors.json +0 -6
  294. package/src/locales/ja/home.json +0 -20
  295. package/src/locales/ja/messages.json +0 -8
  296. package/src/locales/ja/nav.json +0 -13
  297. package/src/locales/ja/projects.json +0 -9
  298. package/src/locales/ja/services.json +0 -43
  299. package/src/locales/pt/blog.json +0 -9
  300. package/src/locales/pt/chat.json +0 -29
  301. package/src/locales/pt/common.json +0 -19
  302. package/src/locales/pt/cookie_notice.json +0 -11
  303. package/src/locales/pt/editor.json +0 -24
  304. package/src/locales/pt/errors.json +0 -6
  305. package/src/locales/pt/home.json +0 -20
  306. package/src/locales/pt/messages.json +0 -8
  307. package/src/locales/pt/nav.json +0 -13
  308. package/src/locales/pt/projects.json +0 -9
  309. package/src/locales/pt/services.json +0 -43
  310. package/src/utils/server/cookies.ts +0 -98
  311. package/src/utils/server/index.ts +0 -1
  312. package/src/utils/shared/deep-merge.ts +0 -36
  313. package/src/utils/shared/index.ts +0 -3
  314. package/src/utils/shared/parse-boolean.ts +0 -14
  315. /package/src/utils/{shared/embed.ts → embed.ts} +0 -0
@@ -1,84 +1,74 @@
1
1
  ---
2
- import type { HTMLAttributes } from "astro/types";
3
- import { cv, cx } from "css-variants";
4
- import { twMerge } from "tailwind-merge";
5
- import defu from "defu";
6
- import { buttonTheme } from "../../themes/button.theme";
7
- import { getUIConfig } from "virtual:rimelight-ui";
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"
8
7
 
9
- // Create the variant resolver with tailwind-merge for conflict resolution
10
- const button = cv({
11
- ...buttonTheme,
8
+ const button = scv({
9
+ slots: [...buttonTheme.slots],
10
+ base: buttonTheme.base,
11
+ variants: buttonTheme.variants,
12
+ compoundVariants: [...buttonTheme.compoundVariants],
13
+ defaultVariants: buttonTheme.defaultVariants,
12
14
  classNameResolver: (...args) => twMerge(cx(...args)),
13
15
  });
14
16
 
15
- /**
16
- * UI prop interface for overriding the base class.
17
- * For multi-slot components (scv), this would have keys per slot.
18
- */
19
- export interface RLAButtonUI {
20
- base?: string;
21
- }
22
-
23
- /**
24
- * Button props — uses indexed access types on the theme config
25
- * (same pattern as Nuxt UI's Button['variants']['color'])
26
- */
27
17
  export interface RLAButtonProps {
28
18
  /**
29
19
  * Button variant style.
30
- * @default "default"
20
+ * @default "solid"
31
21
  */
32
22
  variant?: keyof typeof buttonTheme.variants.variant;
23
+ /**
24
+ * Button color.
25
+ * @default "primary"
26
+ */
27
+ color?: keyof typeof buttonTheme.variants.color;
33
28
  /**
34
29
  * Button size.
35
30
  * @default "md"
36
31
  */
37
32
  size?: keyof typeof buttonTheme.variants.size;
38
33
  /**
39
- * Per-instance UI override. Merged with global config via `defu`.
40
- * Higher priority than integration-level config.
34
+ * When provided, renders as <a> instead of <button>.
41
35
  */
42
- ui?: RLAButtonUI;
36
+ href?: string;
43
37
  /**
44
- * External class applied after all internal classes.
38
+ * UI overrides for individual slots, derived from the button theme.
45
39
  */
46
- class?: string;
40
+ ui?: Partial<Record<keyof typeof buttonTheme.base, string>>;
47
41
  /**
48
- * When provided, renders as <a> instead of <button>.
42
+ * External class applied to the root element.
49
43
  */
50
- href?: string;
44
+ class?: string;
51
45
  /**
52
46
  * Standard HTML attributes for <button>
53
47
  */
54
48
  [key: string]: unknown;
55
49
  }
56
50
 
57
- type Props = RLAButtonProps;
58
-
59
51
  const {
60
- variant,
61
- size,
52
+ variant = "solid",
53
+ color = "primary",
54
+ size = "md",
62
55
  class: className,
63
56
  ui: uiProp,
64
57
  href,
65
58
  ...rest
66
- } = Astro.props;
59
+ } = Astro.props as RLAButtonProps
67
60
 
68
- // Get global config from the virtual module (populated by the Astro integration)
69
61
  const globalConfig = getUIConfig();
70
62
 
71
- // Merge: uiProp > globalConfig.button (uiProp wins)
72
- const mergedUI = defu<Record<string, unknown>[], [Record<string, unknown>]>(
63
+ const mergedUI = defu(
73
64
  uiProp ?? {},
74
65
  (globalConfig.button as Record<string, unknown>) ?? {},
75
- );
66
+ ) as Record<keyof typeof buttonTheme.base, string | undefined>;
76
67
 
77
- // Resolve classes: cv() returns a string, className prop merges overrides
78
- const classes = button({
68
+ const { root } = button({
79
69
  variant,
70
+ color,
80
71
  size,
81
- className: mergedUI.base as string | undefined,
82
72
  });
83
73
 
84
74
  // Determine whether to render <a> or <button>
@@ -86,7 +76,7 @@ const Tag = href ? "a" : "button";
86
76
  ---
87
77
 
88
78
  <Tag
89
- class:list={[classes, className]}
79
+ class={twMerge(root, mergedUI.root, className)}
90
80
  data-slot="rla-button"
91
81
  {...(Tag === "a" ? { href } : {})}
92
82
  {...rest}
@@ -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 @@
1
+ export * from "@nuxt/ui"
@@ -1,26 +1,32 @@
1
1
  <script setup lang="ts">
2
- import { computed } from "vue"
3
- import { cv, cx } from "css-variants"
2
+ import { scv, cx } from "css-variants"
4
3
  import { twMerge } from "tailwind-merge"
5
- import { buttonTheme } from "../../themes/button.theme"
4
+ import defu from "defu"
5
+ import { buttonTheme } from "@/themes/button.theme.ts"
6
+ import { getUIConfig } from "virtual:rimelight-ui"
6
7
 
7
- // Create the variant resolver with tailwind-merge for conflict resolution
8
- const button = cv({
9
- ...buttonTheme,
8
+ const button = scv({
9
+ slots: [...buttonTheme.slots],
10
+ base: buttonTheme.base,
11
+ variants: buttonTheme.variants,
12
+ compoundVariants: [...buttonTheme.compoundVariants],
13
+ defaultVariants: buttonTheme.defaultVariants,
10
14
  classNameResolver: (...args) => twMerge(cx(...args))
11
15
  })
12
16
 
13
- /**
14
- * Button props — uses indexed access types on the theme config (same pattern as Nuxt UI's
15
- * Button['variants']['color'])
16
- */
17
17
  export interface RLVButtonProps {
18
18
  /**
19
- * Button variant style.
19
+ * Button variant.
20
20
  *
21
- * @default "default"
21
+ * @default "solid"
22
22
  */
23
23
  variant?: keyof typeof buttonTheme.variants.variant
24
+ /**
25
+ * Button color.
26
+ *
27
+ * @default "primary"
28
+ */
29
+ color?: keyof typeof buttonTheme.variants.color
24
30
  /**
25
31
  * Button size.
26
32
  *
@@ -28,49 +34,56 @@ export interface RLVButtonProps {
28
34
  */
29
35
  size?: keyof typeof buttonTheme.variants.size
30
36
  /**
31
- * Per-instance UI override for the base class string. Merged with variant/size classes via
32
- * css-variants.
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.
33
42
  */
34
- ui?: { base?: string }
43
+ ui?: Partial<Record<keyof typeof buttonTheme.base, string>>
35
44
  /**
36
- * External class — applied after all internal classes.
45
+ * External class — applied to the root element.
37
46
  */
38
47
  class?: string
39
48
  /**
40
- * When provided, renders as <a> instead of <button>.
49
+ * Standard HTML attributes for <button>
41
50
  */
42
- href?: string
51
+ [key: string]: unknown
43
52
  }
44
53
 
45
- const props = withDefaults(defineProps<RLVButtonProps>(), {
46
- variant: "default",
47
- size: "md",
48
- class: undefined,
49
- ui: undefined,
50
- href: undefined
51
- })
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()
52
64
 
53
- // Resolve classes — exactly like Astro: cv() with className param
54
- const resolvedClasses = computed(() => {
55
- const classes = button({
56
- variant: props.variant,
57
- size: props.size,
58
- className: props.ui?.base
59
- })
60
- return classes
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
61
74
  })
62
75
 
63
76
  // Determine whether to render <a> or <button>
64
- const tag = computed(() => (props.href ? "a" : "button"))
77
+ const Tag = href ? "a" : "button"
65
78
  </script>
66
79
 
67
80
  <template>
68
81
  <component
69
- :is="tag"
82
+ v-bind="$attrs"
83
+ :is="Tag"
70
84
  :href="href"
71
- :class="[resolvedClasses, props.class]"
85
+ :class="twMerge(root, mergedUI.root, className)"
72
86
  data-slot="rlv-button"
73
- v-bind="$attrs"
74
87
  >
75
88
  <slot />
76
89
  </component>
@@ -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>
@@ -1 +1 @@
1
- export { useComponentUI } from "./useComponentUI"
1
+ export { useUi } from "./useUi"
@@ -1,7 +1,7 @@
1
1
  import { computed, type ComputedRef } from "vue"
2
2
  import defu from "defu"
3
3
  import { getUIConfig } from "virtual:rimelight-ui"
4
- import type { DefaultUIConfig } from "../themes"
4
+ import type { DefaultUIConfig } from "@/themes"
5
5
 
6
6
  /**
7
7
  * Reactive UI config merge composable for Vue components.
@@ -13,8 +13,8 @@ import type { DefaultUIConfig } from "../themes"
13
13
  * @param uiProp - The local `ui` prop from defineProps
14
14
  * @returns ComputedRef of merged UI overrides
15
15
  */
16
- export function useComponentUI<T extends keyof DefaultUIConfig>(
17
- componentName: T,
16
+ export function useUi(
17
+ componentName: keyof DefaultUIConfig,
18
18
  uiProp: Record<string, unknown> | undefined
19
19
  ): ComputedRef<Record<string, unknown>> {
20
20
  const globalConfig = getUIConfig()
@@ -1,3 +1 @@
1
1
  export * from "./site.config"
2
- export * from "./links"
3
- export * from "./cookies"
@@ -22,6 +22,6 @@ export interface SiteConfig {
22
22
  titleTemplate: string
23
23
  ogImageFallback: string
24
24
  maxDescriptionLength: number
25
- authorHandle?: string // e.g., @danielmarchi
25
+ authorHandle?: string
26
26
  }
27
27
  }
package/src/env.d.ts CHANGED
@@ -1,16 +1,13 @@
1
- /// <reference types="astro/client" />
2
-
3
- declare module "virtual:rimelight-ui" {
4
- import type { DefaultUIConfig } from "../themes"
5
-
6
- export function getUIConfig(): DefaultUIConfig
7
- }
8
-
9
- declare namespace App {
10
- interface Locals {
11
- uiLocale?: string
12
- translationLocale?: string
13
- isMissingContent?: boolean
14
- cfContext?: Record<string, unknown>
15
- }
16
- }
1
+ /// <reference types="astro/client" />
2
+
3
+ declare module "virtual:rimelight-ui" {
4
+ import type { DefaultUIConfig } from "../themes"
5
+
6
+ export function getUIConfig(): DefaultUIConfig
7
+ }
8
+
9
+ declare namespace App {
10
+ interface Locals {
11
+ cfContext?: Record<string, unknown>
12
+ }
13
+ }
@@ -1,81 +1,106 @@
1
- import type { AstroIntegration } from "astro"
2
- import defu from "defu"
3
- import { defaultUIConfig } from "../themes"
4
-
5
- /**
6
- * Shape of the `ui` config that can be passed to the integration. Keys are component names, values
7
- * are partial theme configs.
8
- */
9
- export type UIConfigOverrides = {
10
- button?: Partial<(typeof defaultUIConfig)["button"]>
11
- }
12
-
13
- export interface UIOptions {
14
- /**
15
- * Global UI overrides applied to all components. Merged with defaults via `defu` (first arg
16
- * wins).
17
- */
18
- ui?: UIConfigOverrides
19
- }
20
-
21
- /**
22
- * Astro integration for `@rimelight/ui`.
23
- *
24
- * Provides global UI configuration via a virtual module. Components import `virtual:rimelight-ui`
25
- * to access the merged config.
26
- *
27
- * @example
28
- * // astro.config.mjs
29
- * import { ui } from "@rimelight/ui/integrations"
30
- *
31
- * export default defineConfig({
32
- * integrations: [
33
- * ui({
34
- * ui: {
35
- * button: {
36
- * defaultVariants: { variant: "primary" }
37
- * }
38
- * }
39
- * })
40
- * ]
41
- * })
42
- */
43
- export function ui(options: UIOptions = {}): AstroIntegration {
44
- // Merge user overrides with defaults (user-provided values win)
45
- const resolvedConfig = defu(options.ui ?? {}, defaultUIConfig)
46
-
47
- const virtualModuleId = "virtual:rimelight-ui"
48
- const resolvedVirtualModuleId = "\0" + virtualModuleId
49
-
50
- return {
51
- name: "@rimelight/ui",
52
- hooks: {
53
- "astro:config:setup": ({ updateConfig, logger }) => {
54
- logger.info("Initializing @rimelight/ui configuration")
55
-
56
- updateConfig({
57
- vite: {
58
- plugins: [
59
- {
60
- name: "vite-plugin-rimelight-ui-config",
61
- enforce: "pre",
62
- resolveId(id: string) {
63
- if (id === virtualModuleId) {
64
- return resolvedVirtualModuleId
65
- }
66
- return null
67
- },
68
- load(id: string) {
69
- if (id === resolvedVirtualModuleId) {
70
- return `export const getUIConfig = () => (${JSON.stringify(resolvedConfig)});`
71
- }
72
- return null
73
- }
74
- }
75
- ]
76
- }
77
- })
78
- }
79
- }
80
- }
81
- }
1
+ import path from "node:path"
2
+ import { fileURLToPath } from "node:url"
3
+ import type { AstroIntegration } from "astro"
4
+ import vue from "@astrojs/vue"
5
+ import uiPlugin from "@nuxt/ui/vite"
6
+ import defu from "defu"
7
+ import Icons from "unplugin-icons/vite"
8
+ import { defaultUIConfig } from "../themes"
9
+
10
+ const nuxtUIEntry = fileURLToPath(import.meta.resolve("@nuxt/ui"))
11
+ const nuxtUIComponentsPath = path.join(path.dirname(nuxtUIEntry), "runtime/components")
12
+
13
+ /**
14
+ * Shape of the `ui` config that can be passed to the integration.
15
+ */
16
+ export type UIConfigOverrides = {
17
+ button?: Partial<(typeof defaultUIConfig)["button"]>
18
+ header?: Partial<(typeof defaultUIConfig)["header"]>
19
+ }
20
+
21
+ export interface UIOptions {
22
+ /**
23
+ * Global UI overrides applied to all components. Merged with defaults via `defu` (first arg
24
+ * wins).
25
+ */
26
+ ui?: UIConfigOverrides
27
+ }
28
+
29
+ /**
30
+ * Astro integration for `@rimelight/ui`.
31
+ *
32
+ * Provides global UI configuration via a virtual module. Components import `virtual:rimelight-ui`
33
+ * to access the merged config.
34
+ *
35
+ * @example
36
+ * // astro.config.mjs
37
+ * import { ui } from "@rimelight/ui/integrations"
38
+ *
39
+ * export default defineConfig({
40
+ * integrations: [
41
+ * ui({
42
+ * ui: {
43
+ * button: {
44
+ * defaultVariants: { variant: "primary" }
45
+ * }
46
+ * }
47
+ * })
48
+ * ]
49
+ * })
50
+ */
51
+ export function ui(options: UIOptions = {}): AstroIntegration[] {
52
+ const resolvedConfig = defu(options.ui ?? {}, defaultUIConfig)
53
+
54
+ const virtualModuleId = "virtual:rimelight-ui"
55
+ const resolvedVirtualModuleId = "\0" + virtualModuleId
56
+
57
+ const rimelightUIIntegration: AstroIntegration = {
58
+ name: "@rimelight/ui",
59
+ hooks: {
60
+ "astro:config:setup": ({ updateConfig, logger }) => {
61
+ logger.info("Initializing @rimelight/ui core")
62
+
63
+ updateConfig({
64
+ vite: {
65
+ resolve: {
66
+ alias: {
67
+ "@rimelight/ui/components/nuxt/": `${nuxtUIComponentsPath}/`
68
+ }
69
+ },
70
+ plugins: [
71
+ uiPlugin({
72
+ router: false,
73
+ scanPackages: ["@rimelight/ui"]
74
+ }),
75
+ Icons({
76
+ compiler: "astro",
77
+ autoInstall: true
78
+ }),
79
+ {
80
+ name: "vite-plugin-rimelight-ui-config",
81
+ enforce: "pre",
82
+ resolveId(id: string) {
83
+ if (id === virtualModuleId) return resolvedVirtualModuleId
84
+ return null
85
+ },
86
+ load(id: string) {
87
+ if (id === resolvedVirtualModuleId) {
88
+ return `export const getUIConfig = () => (${JSON.stringify(resolvedConfig)});`
89
+ }
90
+ return null
91
+ }
92
+ }
93
+ ]
94
+ }
95
+ })
96
+ }
97
+ }
98
+ }
99
+
100
+ return [
101
+ vue({
102
+ appEntrypoint: "@rimelight/ui/integrations/vue-entrypoint"
103
+ }),
104
+ rimelightUIIntegration
105
+ ]
106
+ }
@@ -0,0 +1,6 @@
1
+ import type { App } from "vue"
2
+ import ui from "@nuxt/ui/vue-plugin"
3
+
4
+ export default (app: App) => {
5
+ app.use(ui)
6
+ }