@rimelight/ui 0.0.23 → 0.0.25

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 (65) hide show
  1. package/package.json +8 -3
  2. package/src/components/Head.astro +199 -156
  3. package/src/components/astro/RLAAccordion.astro +22 -0
  4. package/src/components/astro/RLAButton.astro +104 -85
  5. package/src/components/astro/RLAFooter.astro +14 -40
  6. package/src/components/astro/RLAHeader.astro +18 -78
  7. package/src/components/astro/RLAIcon.astro +11 -36
  8. package/src/components/astro/RLALogo.astro +9 -44
  9. package/src/components/astro/RLAPlaceholder.astro +8 -33
  10. package/src/components/astro/RLAQuote.astro +15 -0
  11. package/src/components/astro/RLAScrollToTop.astro +171 -221
  12. package/src/components/astro/RLASection.astro +181 -0
  13. package/src/components/vue/RLVButton.vue +125 -50
  14. package/src/components/vue/RLVFooter.vue +12 -49
  15. package/src/components/vue/RLVHeader.vue +15 -98
  16. package/src/components/vue/RLVIcon.vue +11 -37
  17. package/src/components/vue/RLVLogo.vue +8 -56
  18. package/src/components/vue/RLVPlaceholder.vue +11 -33
  19. package/src/components/vue/RLVScrollToTop.vue +17 -88
  20. package/src/components/vue/RLVSection.vue +98 -0
  21. package/src/composables/index.ts +0 -1
  22. package/src/env.d.ts +5 -0
  23. package/src/integrations/ui.ts +2 -6
  24. package/src/nuxt-types.ts +3 -0
  25. package/src/plugins/index.ts +5 -2
  26. package/src/plugins/starlightAddons/index.ts +3 -64
  27. package/src/plugins/starlightDocsApi/components/ApiEmits.astro +46 -0
  28. package/src/plugins/starlightDocsApi/components/ApiProps.astro +47 -0
  29. package/src/plugins/starlightDocsApi/components/ApiSlots.astro +50 -0
  30. package/src/plugins/starlightDocsApi/components/ApiTheme.astro +27 -0
  31. package/src/plugins/starlightDocsApi/extract-vue.ts +286 -0
  32. package/src/plugins/starlightDocsApi/index.ts +265 -0
  33. package/src/plugins/starlightDocsApi/types.ts +40 -0
  34. package/src/plugins/starlightDocsApi/utils.ts +45 -0
  35. package/src/themes/button.theme.ts +179 -23
  36. package/src/themes/footer.theme.ts +4 -6
  37. package/src/themes/header.theme.ts +4 -28
  38. package/src/themes/icon.theme.ts +4 -2
  39. package/src/themes/index.ts +15 -20
  40. package/src/themes/logo.theme.ts +4 -2
  41. package/src/themes/placeholder.theme.ts +4 -6
  42. package/src/themes/scroll-to-top.theme.ts +4 -6
  43. package/src/themes/section.theme.ts +185 -0
  44. package/src/types/componentVariant.ts +10 -0
  45. package/src/types/index.ts +1 -0
  46. package/src/utils/defineTheme.ts +11 -0
  47. package/src/utils/index.ts +3 -0
  48. package/src/utils/resolveClasses.ts +21 -0
  49. package/src/utils/useUi.ts +19 -0
  50. package/src/composables/useUi.ts +0 -27
  51. package/src/plugins/starlightAddons/Sidebar.astro +0 -89
  52. package/src/plugins/starlightAddons/data.ts +0 -39
  53. package/src/plugins/starlightAddons/libs/config.ts +0 -107
  54. package/src/plugins/starlightAddons/libs/content.ts +0 -20
  55. package/src/plugins/starlightAddons/libs/i18n.ts +0 -51
  56. package/src/plugins/starlightAddons/libs/locals.ts +0 -12
  57. package/src/plugins/starlightAddons/libs/pathname.ts +0 -22
  58. package/src/plugins/starlightAddons/libs/plugin.ts +0 -9
  59. package/src/plugins/starlightAddons/libs/sidebar.ts +0 -183
  60. package/src/plugins/starlightAddons/libs/vite.ts +0 -46
  61. package/src/plugins/starlightAddons/locals.d.ts +0 -14
  62. package/src/plugins/starlightAddons/middleware.ts +0 -132
  63. package/src/plugins/starlightAddons/overrides/Sidebar.astro +0 -8
  64. package/src/plugins/starlightAddons/schema.ts +0 -13
  65. package/src/plugins/starlightAddons/virtual.d.ts +0 -13
@@ -1,31 +1,14 @@
1
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 { placeholderTheme } from "../../themes/placeholder.theme.ts"
6
- import { getUIConfig } from "virtual:rimelight-ui"
2
+ import { computed } from "vue"
3
+ import { scv } from "css-variants"
4
+ import { useUi, resolveClasses } from "../../utils"
5
+ import placeholderTheme from "../../themes/placeholder.theme"
7
6
 
8
- const placeholder = scv({
9
- slots: [...placeholderTheme.slots],
10
- base: placeholderTheme.base,
11
- variants: placeholderTheme.variants,
12
- compoundVariants: [...placeholderTheme.compoundVariants],
13
- defaultVariants: placeholderTheme.defaultVariants,
14
- classNameResolver: (...args) => twMerge(cx(...args))
15
- })
7
+ const placeholder = scv(placeholderTheme)
16
8
 
17
9
  export interface RLVPlaceholderProps {
18
- /**
19
- * UI overrides for individual slots, derived from the placeholder theme.
20
- */
21
- ui?: Partial<Record<keyof typeof placeholderTheme.base, string>>
22
- /**
23
- * External class — applied to the root element.
24
- */
10
+ ui?: Partial<Record<string, string>>
25
11
  class?: string
26
- /**
27
- * Standard HTML attributes.
28
- */
29
12
  [key: string]: unknown
30
13
  }
31
14
 
@@ -38,19 +21,14 @@ defineSlots<{
38
21
  default(props: {}): any
39
22
  }>()
40
23
 
41
- const globalConfig = getUIConfig()
42
-
43
- const mergedUI = defu(
44
- uiProp ?? {},
45
- (globalConfig.placeholder as Record<string, unknown>) ?? {}
46
- ) as Record<keyof typeof placeholderTheme.base, string | undefined>
47
-
48
- const { base, svg } = placeholder()
24
+ const resolvedClasses = computed(() =>
25
+ resolveClasses(placeholder, {}, useUi("placeholder", uiProp), className)
26
+ )
49
27
  </script>
50
28
 
51
29
  <template>
52
- <div :class="twMerge(base, mergedUI.base, className)" v-bind="$attrs">
53
- <svg :class="twMerge(svg, mergedUI.svg)">
30
+ <div :class="resolvedClasses.base" v-bind="$attrs">
31
+ <svg :class="resolvedClasses.svg">
54
32
  <defs>
55
33
  <pattern
56
34
  id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"
@@ -1,66 +1,24 @@
1
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 { scrollToTopTheme } from "../../themes/scroll-to-top.theme.ts"
2
+ import { scv } from "css-variants"
3
+ import { useUi, resolveClasses } from "../../utils"
4
+ import type { ComponentVariants } from "../../types"
5
+ import scrollToTopTheme from "../../themes/scroll-to-top.theme"
6
6
  import { useScrollToTop } from "../../composables/useScrollToTop"
7
7
  import { computed } from "vue"
8
- import { getUIConfig } from "virtual:rimelight-ui"
8
+
9
+ const scrollToTop = scv(scrollToTopTheme)
10
+ type ScrollToTopVariants = ComponentVariants<typeof scrollToTopTheme>
9
11
 
10
12
  export interface RLVScrollToTopProps {
11
- /**
12
- * Button color.
13
- *
14
- * @default "primary"
15
- */
16
- color?: keyof typeof scrollToTopTheme.variants.color
17
- /**
18
- * Transition duration for the progress circle (in seconds).
19
- *
20
- * @default 0.1
21
- */
13
+ color?: ScrollToTopVariants["color"]
14
+ progressWidth?: number
22
15
  duration?: number
23
- /**
24
- * Scroll threshold (in pixels) before the button becomes visible.
25
- *
26
- * @default 200
27
- */
28
16
  threshold?: number
29
- /**
30
- * Whether to show the scroll progress indicator.
31
- *
32
- * @default false
33
- */
34
17
  showProgress?: boolean
35
- /**
36
- * Stroke width of the progress circle.
37
- *
38
- * @default 6
39
- */
40
- progressWidth?: number
41
- /**
42
- * UI overrides for individual slots, derived from the scroll-to-top theme.
43
- */
44
- ui?: Partial<Record<keyof typeof scrollToTopTheme.base, string>>
45
- /**
46
- * External class — applied to the root element.
47
- */
18
+ ui?: Partial<Record<string, string>>
48
19
  class?: string
49
- /**
50
- * Standard HTML attributes.
51
- */
52
- [key: string]: unknown
53
20
  }
54
21
 
55
- const scrollToTop = scv({
56
- slots: [...scrollToTopTheme.slots],
57
- base: scrollToTopTheme.base,
58
- variants: scrollToTopTheme.variants,
59
- compoundVariants: [...scrollToTopTheme.compoundVariants],
60
- defaultVariants: scrollToTopTheme.defaultVariants,
61
- classNameResolver: (...args) => twMerge(cx(...args))
62
- })
63
-
64
22
  const {
65
23
  color = "primary",
66
24
  progressWidth = 6,
@@ -71,23 +29,7 @@ const {
71
29
  class: className
72
30
  } = defineProps<RLVScrollToTopProps>()
73
31
 
74
- const globalConfig = getUIConfig()
75
-
76
- const mergedUI = defu(
77
- uiProp ?? {},
78
- (globalConfig["scroll-to-top"] as Record<string, unknown>) ?? {}
79
- ) as Record<keyof typeof scrollToTopTheme.base, string | undefined>
80
-
81
- const {
82
- root,
83
- button,
84
- progressBase,
85
- svg: svgClass,
86
- iconContainer,
87
- icon
88
- } = scrollToTop({
89
- color
90
- })
32
+ const classes = resolveClasses(scrollToTop, { color }, useUi("scrollToTop", uiProp), className)
91
33
 
92
34
  const {
93
35
  isVisible,
@@ -107,25 +49,12 @@ const durationInSeconds = computed(() => `${duration}s`)
107
49
 
108
50
  <template>
109
51
  <div
110
- :class="[
111
- 'rla-scroll-to-top fixed bottom-6 right-6 z-50',
112
- { visible: isVisible },
113
- twMerge(root, mergedUI.root, className)
114
- ]"
52
+ :class="['rla-scroll-to-top fixed bottom-6 right-6 z-50', { visible: isVisible }, classes.root]"
115
53
  v-bind="$attrs"
116
54
  >
117
- <button
118
- type="button"
119
- :class="twMerge(button, mergedUI.button)"
120
- aria-label="Scroll to top"
121
- @click="scrollToTopFn"
122
- >
123
- <div :class="twMerge(progressBase, mergedUI.progressBase)">
124
- <svg
125
- :class="twMerge(svgClass, mergedUI.svg)"
126
- viewBox="0 0 100 100"
127
- shape-rendering="geometricPrecision"
128
- >
55
+ <button type="button" :class="classes.button" aria-label="Scroll to top" @click="scrollToTopFn">
56
+ <div :class="classes.progressBase">
57
+ <svg :class="classes.svg" viewBox="0 0 100 100" shape-rendering="geometricPrecision">
129
58
  <circle
130
59
  cx="50"
131
60
  cy="50"
@@ -153,7 +82,7 @@ const durationInSeconds = computed(() => `${duration}s`)
153
82
  }"
154
83
  />
155
84
  </svg>
156
- <div :class="twMerge(iconContainer, mergedUI.iconContainer)">
85
+ <div :class="classes.iconContainer">
157
86
  <svg
158
87
  xmlns="http://www.w3.org/2000/svg"
159
88
  width="24"
@@ -164,7 +93,7 @@ const durationInSeconds = computed(() => `${duration}s`)
164
93
  stroke-width="2"
165
94
  stroke-linecap="round"
166
95
  stroke-linejoin="round"
167
- :class="twMerge(icon, mergedUI.icon)"
96
+ :class="classes.icon"
168
97
  >
169
98
  <path d="m5 12 7-7 7 7" />
170
99
  <path d="M12 19V5" />
@@ -0,0 +1,98 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue"
3
+ import { scv } from "css-variants"
4
+ import { useUi, resolveClasses } from "../../utils"
5
+ import type { ComponentVariants } from "../../types"
6
+ import sectionTheme from "../../themes/section.theme"
7
+
8
+ const section = scv(sectionTheme)
9
+ type SectionVariants = ComponentVariants<typeof sectionTheme>
10
+
11
+ export interface RLVSectionProps {
12
+ variant?: SectionVariants["variant"]
13
+ headline?: string
14
+ icon?: string
15
+ title?: string
16
+ description?: string
17
+ orientation?: SectionVariants["orientation"]
18
+ reverse?: boolean
19
+ ctaVariant?: SectionVariants["ctaVariant"]
20
+ ui?: Partial<Record<string, string>>
21
+ class?: string
22
+ }
23
+
24
+ const {
25
+ variant = "default",
26
+ orientation = "vertical",
27
+ reverse = false,
28
+ ctaVariant = "outline",
29
+ class: className,
30
+ ui: uiProp
31
+ } = defineProps<RLVSectionProps>()
32
+
33
+ const resolvedClasses = computed(() =>
34
+ resolveClasses(
35
+ section,
36
+ {
37
+ variant,
38
+ orientation,
39
+ reverse,
40
+ ...(variant === "cta" && { ctaVariant }),
41
+ headline: false,
42
+ title: false,
43
+ description: false,
44
+ body: false
45
+ },
46
+ useUi("section", uiProp),
47
+ className
48
+ )
49
+ )
50
+ </script>
51
+
52
+ <template>
53
+ <div data-slot="rlv-section" :class="[resolvedClasses.root]" v-bind="$attrs">
54
+ <slot name="background">
55
+ <div :class="resolvedClasses.background" data-slot="background">
56
+ <slot name="background" />
57
+ </div>
58
+ </slot>
59
+
60
+ <slot name="top" />
61
+
62
+ <div :class="resolvedClasses.container">
63
+ <div :class="resolvedClasses.wrapper">
64
+ <div :class="resolvedClasses.header">
65
+ <slot name="leading">
66
+ <span v-if="icon" :class="resolvedClasses.leadingIcon" data-slot="leading-icon">
67
+ <span :class="icon" aria-hidden="true" />
68
+ </span>
69
+ </slot>
70
+
71
+ <div v-if="headline" :class="resolvedClasses.headline">
72
+ {{ headline }}
73
+ </div>
74
+
75
+ <h2 v-if="title" :class="resolvedClasses.title">
76
+ {{ title }}
77
+ </h2>
78
+
79
+ <div v-if="description" :class="resolvedClasses.description">
80
+ {{ description }}
81
+ </div>
82
+ </div>
83
+
84
+ <div :class="resolvedClasses.body">
85
+ <slot name="body" />
86
+ </div>
87
+
88
+ <div :class="resolvedClasses.footer">
89
+ <slot name="links" />
90
+ </div>
91
+ </div>
92
+
93
+ <slot />
94
+ </div>
95
+
96
+ <slot name="bottom" />
97
+ </div>
98
+ </template>
@@ -1,2 +1 @@
1
- export { useUi } from "./useUi"
2
1
  export { useScrollToTop } from "./useScrollToTop"
package/src/env.d.ts CHANGED
@@ -22,6 +22,11 @@ declare module "virtual:rimelight-starlight-addons-config" {
22
22
  export default config
23
23
  }
24
24
 
25
+ declare module "virtual:rimelight-ui-docs-meta" {
26
+ const meta: Record<string, unknown>
27
+ export default meta
28
+ }
29
+
25
30
  declare module "turndown" {
26
31
  class TurndownService {
27
32
  constructor(options?: Record<string, unknown>)
@@ -5,16 +5,12 @@ import uiPlugin from "@nuxt/ui/vite"
5
5
  import defu from "defu"
6
6
  import tailwindcss from "@tailwindcss/vite"
7
7
  import { defaultUIConfig } from "../themes"
8
+ import type { ComponentTheme } from "../utils/defineTheme"
8
9
 
9
10
  /**
10
11
  * Shape of the `ui` config that can be passed to the integration.
11
12
  */
12
- export type UIConfigOverrides = {
13
- "button"?: Partial<(typeof defaultUIConfig)["button"]>
14
- "header"?: Partial<(typeof defaultUIConfig)["header"]>
15
- "scroll-to-top"?: Partial<(typeof defaultUIConfig)["scroll-to-top"]>
16
- "logo"?: Partial<(typeof defaultUIConfig)["logo"]>
17
- }
13
+ export type UIConfigOverrides = Record<string, Partial<ComponentTheme>>
18
14
 
19
15
  export interface UIOptions {
20
16
  /**
@@ -0,0 +1,3 @@
1
+ export type * from "@nuxt/ui/runtime/types"
2
+ export type * from "@nuxt/ui/runtime/composables"
3
+ export type * from "@nuxt/ui/runtime/utils"
@@ -1,2 +1,5 @@
1
- export { default as starlightAddons } from "../plugins/starlightAddons"
2
- export type { StarlightAddonsConfig } from "../plugins/starlightAddons"
1
+ export { default as starlightAddons } from "./starlightAddons"
2
+ export type { StarlightAddonsConfig } from "./starlightAddons"
3
+
4
+ export { default as starlightDocsApi } from "./starlightDocsApi"
5
+ export type { StarlightDocsApiConfig } from "./starlightDocsApi"
@@ -1,34 +1,13 @@
1
- /// <reference path="./locals.d.ts" />
2
- import type { StarlightPlugin, StarlightUserConfig } from "@astrojs/starlight/types"
1
+ import type { StarlightPlugin } from "@astrojs/starlight/types"
3
2
  import virtual from "vite-plugin-virtual"
4
3
  import path from "node:path"
5
4
  import { fileURLToPath } from "node:url"
6
- import { z } from "astro/zod"
7
-
8
- import {
9
- StarlightSidebarTopicsConfigSchema,
10
- StarlightSidebarTopicsOptionsSchema,
11
- type StarlightSidebarTopicsUserConfig,
12
- type StarlightSidebarTopicsUserOptions
13
- } from "./libs/config"
14
- import { throwPluginError } from "./libs/plugin"
15
- import { vitePluginStarlightSidebarTopics } from "./libs/vite"
16
-
17
- export type {
18
- StarlightSidebarTopicsConfig,
19
- StarlightSidebarTopicsUserConfig,
20
- StarlightSidebarTopicsOptions,
21
- StarlightSidebarTopicsUserOptions
22
- } from "./libs/config"
23
5
 
24
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url))
25
7
 
26
8
  export interface StarlightAddonsConfig {
27
9
  copy?: boolean
28
10
  share?: boolean
29
- // Merged config for Topics
30
- topics?: StarlightSidebarTopicsUserConfig
31
- topicOptions?: StarlightSidebarTopicsUserOptions
32
11
  }
33
12
 
34
13
  export default function starlightAddons(userConfig?: StarlightAddonsConfig): StarlightPlugin {
@@ -40,48 +19,10 @@ export default function starlightAddons(userConfig?: StarlightAddonsConfig): Sta
40
19
 
41
20
  const addonConfig = { ...defaultAddonConfig, ...userConfig }
42
21
 
43
- // 2. Validate Sidebar Topics configurations if they exist
44
- const parsedTopics = StarlightSidebarTopicsConfigSchema.safeParse(addonConfig.topics || [])
45
- if (!parsedTopics.success) {
46
- throwPluginError(
47
- `Invalid topics config: ${parsedTopics.error.issues.map((i) => i.message).join("\n")}`
48
- )
49
- }
50
-
51
- const parsedOptions = StarlightSidebarTopicsOptionsSchema.safeParse(addonConfig.topicOptions)
52
- if (!parsedOptions.success) {
53
- throwPluginError(`Invalid topic options: ${z.prettifyError(parsedOptions.error)}`)
54
- }
55
-
56
- const topicsData = parsedTopics.data
57
- const optionsData = parsedOptions.data
58
-
59
22
  return {
60
23
  name: "rimelight-ui-starlight-addons",
61
24
  hooks: {
62
- "config:setup"({ addIntegration, updateConfig, logger, command, config: starlightConfig }) {
63
- // --- Sidebar Topics Logic ---
64
- if ((command === "dev" || command === "build") && topicsData.length > 0) {
65
- if (starlightConfig.sidebar) {
66
- throwPluginError(
67
- "Sidebar detected. To use topics, move your sidebar items into the topics config."
68
- )
69
- }
70
-
71
- const topicSidebar: StarlightUserConfig["sidebar"] = topicsData.map((topic, index) => {
72
- return "items" in topic
73
- ? { label: String(index), items: topic.items }
74
- : { label: String(index), items: [] }
75
- })
76
-
77
- updateConfig({
78
- sidebar: topicSidebar,
79
- components: {
80
- Sidebar: `starlight-sidebar-topics/overrides/Sidebar.astro`
81
- }
82
- })
83
- }
84
-
25
+ "config:setup"({ addIntegration, updateConfig, logger }) {
85
26
  // --- Addons Logic ---
86
27
  if (!addonConfig.copy && !addonConfig.share) {
87
28
  logger.warn("StarlightAddons: No features enabled.")
@@ -104,9 +45,7 @@ export default function starlightAddons(userConfig?: StarlightAddonsConfig): Sta
104
45
  plugins: [
105
46
  virtual({
106
47
  "virtual:rimelight-starlight-addons-config": `export default ${JSON.stringify(addonConfig)}`
107
- }),
108
- // Pass the validated topic data to the vite plugin
109
- vitePluginStarlightSidebarTopics(topicsData, optionsData)
48
+ })
110
49
  ]
111
50
  }
112
51
  } as Record<string, unknown>)
@@ -0,0 +1,46 @@
1
+ ---
2
+ import type { ComponentMetaMap, EmitMeta } from "../types"
3
+ import meta from "virtual:rimelight-ui-docs-meta"
4
+
5
+ interface Props {
6
+ component: string
7
+ }
8
+
9
+ const { component } = Astro.props
10
+
11
+ const allMeta = meta as unknown as ComponentMetaMap
12
+ const compMeta = allMeta[component]
13
+
14
+ const emits = compMeta?.emits ?? []
15
+ ---
16
+
17
+ {emits.length === 0 ? (
18
+ <p class="text-sm italic text-gray-500">No events emitted by this component.</p>
19
+ ) : (
20
+ <div class="overflow-x-auto">
21
+ <table class="w-full text-sm border-collapse">
22
+ <thead>
23
+ <tr class="border-b border-gray-200 dark:border-gray-700">
24
+ <th class="text-left py-2 px-3 font-semibold">Event</th>
25
+ <th class="text-left py-2 px-3 font-semibold">Payload</th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ {emits.map((emit: EmitMeta) => (
30
+ <tr class="border-b border-gray-100 dark:border-gray-800">
31
+ <td class="py-2 px-3">
32
+ <code class="text-sm bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded">
33
+ {emit.name}
34
+ </code>
35
+ </td>
36
+ <td class="py-2 px-3">
37
+ <code class="text-xs bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded font-mono">
38
+ {emit.type}
39
+ </code>
40
+ </td>
41
+ </tr>
42
+ ))}
43
+ </tbody>
44
+ </table>
45
+ </div>
46
+ )}
@@ -0,0 +1,47 @@
1
+ ---
2
+ import type { ComponentMetaMap, PropMeta } from "../types"
3
+ import { filterProps } from "../utils"
4
+ import meta from "virtual:rimelight-ui-docs-meta"
5
+
6
+ interface Props {
7
+ component: string
8
+ hide?: string[]
9
+ show?: string[]
10
+ }
11
+
12
+ const { component, hide = ["class"], show } = Astro.props
13
+
14
+ const allMeta = meta as unknown as ComponentMetaMap
15
+ const compMeta = allMeta[component]
16
+
17
+ const filterOpts: { hide?: string[]; show?: string[] } = { hide }
18
+ if (show !== undefined) filterOpts.show = show
19
+ const props = filterProps(compMeta?.props ?? [], filterOpts)
20
+ ---
21
+
22
+ {props.length > 0 ? (
23
+ <table>
24
+ <thead>
25
+ <tr>
26
+ <th>Name</th>
27
+ <th>Type</th>
28
+ <th>Required</th>
29
+ <th>Default</th>
30
+ <th>Description</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ {props.map((prop: PropMeta) => (
35
+ <tr>
36
+ <td><code>{prop.name}</code></td>
37
+ <td><code>{prop.type}</code></td>
38
+ <td>{prop.required ? "Yes" : "No"}</td>
39
+ <td>{prop.default !== undefined ? <code>{prop.default}</code> : "—"}</td>
40
+ <td>{prop.description || "—"}</td>
41
+ </tr>
42
+ ))}
43
+ </tbody>
44
+ </table>
45
+ ) : (
46
+ <p>No props to display.</p>
47
+ )}
@@ -0,0 +1,50 @@
1
+ ---
2
+ import type { ComponentMetaMap, SlotMeta } from "../types"
3
+ import meta from "virtual:rimelight-ui-docs-meta"
4
+
5
+ interface Props {
6
+ component: string
7
+ }
8
+
9
+ const { component } = Astro.props
10
+
11
+ const allMeta = meta as unknown as ComponentMetaMap
12
+ const compMeta = allMeta[component]
13
+
14
+ const slots = compMeta?.slots ?? []
15
+ ---
16
+
17
+ {slots.length === 0 ? (
18
+ <p class="text-sm italic text-gray-500">No slots to display.</p>
19
+ ) : (
20
+ <div class="overflow-x-auto">
21
+ <table class="w-full text-sm border-collapse">
22
+ <thead>
23
+ <tr class="border-b border-gray-200 dark:border-gray-700">
24
+ <th class="text-left py-2 px-3 font-semibold">Slot</th>
25
+ <th class="text-left py-2 px-3 font-semibold">Type</th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ {slots.map((slot: SlotMeta) => (
30
+ <tr class="border-b border-gray-100 dark:border-gray-800">
31
+ <td class="py-2 px-3">
32
+ <code class="text-sm bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded">
33
+ {slot.name}
34
+ </code>
35
+ </td>
36
+ <td class="py-2 px-3">
37
+ {Object.keys(slot.bindings).length > 0 ? (
38
+ <code class="text-xs bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded font-mono">
39
+ {Object.values(slot.bindings)[0]}
40
+ </code>
41
+ ) : (
42
+ <span class="text-gray-400">-</span>
43
+ )}
44
+ </td>
45
+ </tr>
46
+ ))}
47
+ </tbody>
48
+ </table>
49
+ </div>
50
+ )}
@@ -0,0 +1,27 @@
1
+ ---
2
+ import type { ComponentMetaMap } from "../types"
3
+ import { generateThemeCode } from "../utils"
4
+ import meta from "virtual:rimelight-ui-docs-meta"
5
+
6
+ interface Props {
7
+ component: string
8
+ }
9
+
10
+ const { component } = Astro.props
11
+
12
+ const allMeta = meta as unknown as ComponentMetaMap
13
+ const compMeta = allMeta[component]
14
+
15
+ const theme = compMeta?.theme ?? null
16
+ const themeCode = theme ? generateThemeCode(component, theme) : null
17
+ ---
18
+
19
+ {themeCode ? (
20
+ <div class="expressive-code">
21
+ <figure class="frame">
22
+ <pre class="language-ts overflow-x-auto"><code class="language-ts">{themeCode}</code></pre>
23
+ </figure>
24
+ </div>
25
+ ) : (
26
+ <p class="text-sm italic text-gray-500">No theme data available.</p>
27
+ )}