@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,132 +0,0 @@
1
- import { defineRouteMiddleware } from "@astrojs/starlight/route-data"
2
- import type { APIContext } from "astro"
3
- import { getRelativeLocaleUrl } from "astro:i18n"
4
- import picomatch from "picomatch"
5
- import config from "virtual:starlight-sidebar-topics/config"
6
- import options from "virtual:starlight-sidebar-topics/options"
7
- import type { StarlightSidebarTopicsSharedConfig } from "./libs/config"
8
- import type { StarlightSidebarTopicsSharedOptions } from "./libs/config"
9
- import type { StarlightEntry } from "./libs/content"
10
-
11
- import type { StarlightSidebarTopicsRouteData } from "./data"
12
- import { getTranslation } from "./libs/i18n"
13
- import { ensureLeadingSlash } from "./libs/pathname"
14
- import { throwPluginError } from "./libs/plugin"
15
- import {
16
- getCurrentTopic,
17
- getTopicById,
18
- isTopicFirstPage,
19
- isTopicLastPage,
20
- type Topic
21
- } from "./libs/sidebar"
22
-
23
- type StarlightRouteLike = {
24
- entry: StarlightEntry
25
- hasSidebar: boolean
26
- id: string
27
- pagination: { prev?: unknown; next?: unknown }
28
- sidebar: any[]
29
- }
30
-
31
- export const onRequest = defineRouteMiddleware((context) => {
32
- // Locals are augmented to include starlightRoute for typing without casts
33
- const { starlightRoute } = context.locals
34
- const { entry, hasSidebar, id, pagination, sidebar } = starlightRoute
35
-
36
- const topicsConfig = config as unknown as StarlightSidebarTopicsSharedConfig
37
- const topicsOptions = options as unknown as StarlightSidebarTopicsSharedOptions
38
-
39
- let currentTopic: Topic | undefined
40
-
41
- if (hasSidebar) {
42
- currentTopic = getCurrentTopic(topicsConfig, sidebar, id, entry)
43
-
44
- if (!currentTopic) {
45
- const normalizedId = ensureLeadingSlash(id)
46
-
47
- for (const [topicId, patterns] of Object.entries(topicsOptions.topics)) {
48
- if (!picomatch(patterns)(normalizedId)) continue
49
- currentTopic = getTopicById(topicsConfig, sidebar, topicId)
50
- break
51
- }
52
- }
53
-
54
- if (!currentTopic) {
55
- if (picomatch(options.exclude)(ensureLeadingSlash(id))) {
56
- attachRouteData(context, currentTopic)
57
- return
58
- }
59
-
60
- throwPluginError(
61
- `Failed to find the topic for the \`${id}\` page.`,
62
- `Either include this page in the sidebar configuration of the desired topic using the \`items\` property, associate an unlisted page with a topic using the \`topic\` frontmatter property or the \`topics\` option, or exclude this page from any topic using the \`exclude\` option.
63
-
64
- Learn more in the following guides:
65
-
66
- - [Unlisted pages](https://starlight-sidebar-topics.netlify.app/docs/guides/unlisted-pages/)
67
- - [Excluded pages](https://starlight-sidebar-topics.netlify.app/docs/guides/excluded-pages/)`
68
- )
69
- }
70
-
71
- starlightRoute.sidebar = currentTopic.sidebar
72
-
73
- if (isTopicFirstPage(sidebar, id)) {
74
- pagination.prev = undefined
75
- }
76
-
77
- if (isTopicLastPage(sidebar, id)) {
78
- pagination.next = undefined
79
- }
80
- }
81
-
82
- attachRouteData(context, currentTopic)
83
- })
84
-
85
- function attachRouteData(context: APIContext, currentTopic: Topic | undefined) {
86
- context.locals.starlightSidebarTopics = getRouteData(context.currentLocale, currentTopic)
87
- }
88
-
89
- function getRouteData(
90
- currentLocale: APIContext["currentLocale"],
91
- currentTopic: Topic | undefined
92
- ): StarlightSidebarTopicsRouteData {
93
- // Build route data with strongly typed config
94
- const topicConfigs = config as unknown as StarlightSidebarTopicsSharedConfig
95
- return {
96
- isPageWithTopic: currentTopic !== undefined,
97
- topics: topicConfigs.map((topic) => {
98
- const isLinkTopic = topic.type === "link"
99
-
100
- const topicRouteData: StarlightSidebarTopicsRouteData["topics"][number] = {
101
- isCurrent:
102
- isLinkTopic || !currentTopic
103
- ? false
104
- : topic.label === currentTopic.config.label && topic.link === currentTopic.config.link,
105
- label:
106
- typeof topic.label === "string"
107
- ? topic.label
108
- : getTranslation(currentLocale, topic.label, topic.link, "topic label"),
109
- link:
110
- !isLinkTopic && currentLocale
111
- ? getRelativeLocaleUrl(currentLocale, topic.link)
112
- : topic.link
113
- }
114
-
115
- if (topic.badge) {
116
- topicRouteData.badge = {
117
- text:
118
- typeof topic.badge.text === "string"
119
- ? topic.badge.text
120
- : getTranslation(currentLocale, topic.badge.text, topic.link, "topic badge text"),
121
- variant: topic.badge.variant
122
- }
123
- }
124
-
125
- if (topic.icon) {
126
- topicRouteData.icon = topic.icon
127
- }
128
-
129
- return topicRouteData
130
- })
131
- }
132
- }
@@ -1,8 +0,0 @@
1
- ---
2
- import Default from '@astrojs/starlight/components/Sidebar.astro'
3
-
4
- import StarlightSidebarTopicsSidebar from './Sidebar.astro'
5
- ---
6
-
7
- <StarlightSidebarTopicsSidebar />
8
- <Default><slot /></Default>
@@ -1,13 +0,0 @@
1
- import { z } from "astro/zod"
2
-
3
- export const topicSchema = z.object({
4
- /**
5
- * ID of the topic to associate with the current page if the page is not listed in any topic
6
- * sidebar configuration.
7
- *
8
- * @see https://starlight-sidebar-topics.netlify.app/docs/guides/unlisted-pages/
9
- */
10
- topic: z.string().optional()
11
- })
12
-
13
- export type TopicFrontmatterSchema = z.input<typeof topicSchema>
@@ -1,13 +0,0 @@
1
- declare module "virtual:starlight-sidebar-topics/config" {
2
- import type { StarlightSidebarTopicsSharedConfig } from "./libs/config"
3
- const StarlightSidebarTopicsConfig: StarlightSidebarTopicsSharedConfig
4
-
5
- export default StarlightSidebarTopicsConfig
6
- }
7
-
8
- declare module "virtual:starlight-sidebar-topics/options" {
9
- import type { StarlightSidebarTopicsSharedOptions } from "./libs/config"
10
- const StarlightSidebarTopicsOptions: StarlightSidebarTopicsSharedOptions
11
-
12
- export default StarlightSidebarTopicsOptions
13
- }