@rimelight/ui 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -3
- package/src/components/Head.astro +199 -156
- package/src/components/ThemeToggle.astro +2 -2
- package/src/components/astro/RLAAccordion.astro +22 -0
- package/src/components/astro/RLAButton.astro +104 -118
- package/src/components/astro/RLAFooter.astro +17 -43
- package/src/components/astro/RLAHeader.astro +21 -80
- package/src/components/astro/RLAIcon.astro +14 -39
- package/src/components/astro/RLALogo.astro +14 -48
- package/src/components/astro/RLAPlaceholder.astro +11 -35
- package/src/components/astro/RLAQuote.astro +15 -0
- package/src/components/astro/RLAScrollToTop.astro +171 -221
- package/src/components/astro/RLASection.astro +210 -0
- package/src/components/vue/RLVButton.vue +166 -139
- package/src/components/vue/RLVFooter.vue +17 -54
- package/src/components/vue/RLVHeader.vue +22 -105
- package/src/components/vue/RLVIcon.vue +14 -45
- package/src/components/vue/RLVLogo.vue +11 -58
- package/src/components/vue/RLVPlaceholder.vue +14 -35
- package/src/components/vue/RLVScrollToTop.vue +18 -89
- package/src/components/vue/RLVSection.vue +166 -0
- package/src/composables/index.ts +0 -1
- package/src/env.d.ts +5 -0
- package/src/integrations/ui.ts +2 -6
- package/src/plugins/index.ts +5 -2
- package/src/plugins/starlightAddons/index.ts +3 -64
- package/src/plugins/starlightDocsApi/components/ApiEmits.astro +46 -0
- package/src/plugins/starlightDocsApi/components/ApiProps.astro +47 -0
- package/src/plugins/starlightDocsApi/components/ApiSlots.astro +50 -0
- package/src/plugins/starlightDocsApi/components/ApiTheme.astro +27 -0
- package/src/plugins/starlightDocsApi/extract-vue.ts +286 -0
- package/src/plugins/starlightDocsApi/index.ts +265 -0
- package/src/plugins/starlightDocsApi/types.ts +40 -0
- package/src/plugins/starlightDocsApi/utils.ts +45 -0
- package/src/themes/button.theme.ts +29 -14
- package/src/themes/footer.theme.ts +4 -6
- package/src/themes/header.theme.ts +4 -28
- package/src/themes/icon.theme.ts +4 -2
- package/src/themes/index.ts +15 -20
- package/src/themes/logo.theme.ts +4 -2
- package/src/themes/placeholder.theme.ts +4 -6
- package/src/themes/scroll-to-top.theme.ts +4 -6
- package/src/themes/section.theme.ts +187 -0
- package/src/types/componentVariant.ts +14 -0
- package/src/types/index.ts +1 -0
- package/src/utils/defineTheme.ts +11 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/resolveClasses.ts +21 -0
- package/src/utils/useUi.ts +19 -0
- package/src/composables/useUi.ts +0 -27
- package/src/plugins/starlightAddons/Sidebar.astro +0 -89
- package/src/plugins/starlightAddons/data.ts +0 -39
- package/src/plugins/starlightAddons/libs/config.ts +0 -107
- package/src/plugins/starlightAddons/libs/content.ts +0 -20
- package/src/plugins/starlightAddons/libs/i18n.ts +0 -51
- package/src/plugins/starlightAddons/libs/locals.ts +0 -12
- package/src/plugins/starlightAddons/libs/pathname.ts +0 -22
- package/src/plugins/starlightAddons/libs/plugin.ts +0 -9
- package/src/plugins/starlightAddons/libs/sidebar.ts +0 -183
- package/src/plugins/starlightAddons/libs/vite.ts +0 -46
- package/src/plugins/starlightAddons/locals.d.ts +0 -14
- package/src/plugins/starlightAddons/middleware.ts +0 -132
- package/src/plugins/starlightAddons/overrides/Sidebar.astro +0 -8
- package/src/plugins/starlightAddons/schema.ts +0 -13
- package/src/plugins/starlightAddons/virtual.d.ts +0 -13
|
@@ -1,52 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { scv
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getUIConfig } from "virtual:rimelight-ui"
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ComponentSlots } from "../../types"
|
|
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 RLAPlaceholderProps {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
ui?: Partial<Record<keyof typeof placeholderTheme.base, string>>
|
|
22
|
-
/**
|
|
23
|
-
* External class — applied to the root element.
|
|
24
|
-
*/
|
|
25
|
-
class?: string
|
|
26
|
-
/**
|
|
27
|
-
* Standard HTML attributes.
|
|
28
|
-
*/
|
|
10
|
+
ui?: ComponentSlots<typeof placeholderTheme>
|
|
11
|
+
class?: any
|
|
29
12
|
[key: string]: unknown
|
|
30
13
|
}
|
|
31
14
|
|
|
32
15
|
const {
|
|
33
|
-
class: className,
|
|
34
16
|
ui: uiProp,
|
|
17
|
+
class: className,
|
|
35
18
|
...rest
|
|
36
19
|
} = Astro.props as RLAPlaceholderProps
|
|
37
20
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const mergedUI = defu(
|
|
41
|
-
uiProp ?? {},
|
|
42
|
-
(globalConfig.placeholder as Record<string, unknown>) ?? {}
|
|
43
|
-
) as Record<keyof typeof placeholderTheme.base, string | undefined>
|
|
44
|
-
|
|
45
|
-
const { base, svg } = placeholder()
|
|
21
|
+
const classes = resolveClasses(placeholder, {}, useUi("placeholder", uiProp), className)
|
|
46
22
|
---
|
|
47
23
|
|
|
48
|
-
<div class={
|
|
49
|
-
<svg class={
|
|
24
|
+
<div class={classes.base} {...rest}>
|
|
25
|
+
<svg class={classes.svg}>
|
|
50
26
|
<defs>
|
|
51
27
|
<pattern
|
|
52
28
|
id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<figure class="relative my-8 border-y-[3px] border-astro-gray-500 py-4">
|
|
6
|
+
<span class="i-lucide-quote mb-2 s-10 md:absolute md:right-[calc(100%+1rem)] md:top-6" />
|
|
7
|
+
<blockquote
|
|
8
|
+
class="font-heading heading-3 text-xl font-medium text-white md:text-[32px] md:leading-[40px]"
|
|
9
|
+
>
|
|
10
|
+
<slot name="quote" />
|
|
11
|
+
</blockquote>
|
|
12
|
+
<figcaption class="font-mono mt-4 text-right text-astro-pink-light">
|
|
13
|
+
<slot name="caption" />
|
|
14
|
+
</figcaption>
|
|
15
|
+
</figure>
|
|
@@ -1,221 +1,171 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { scv
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const percentPx = circumference / 100
|
|
173
|
-
const duration = element.dataset.duration || '0.1'
|
|
174
|
-
progressCircle.style.setProperty('--stroke-percent', scrollPercentage.toString())
|
|
175
|
-
progressCircle.style.setProperty('--percent-to-px', `${percentPx}px`)
|
|
176
|
-
progressCircle.style.setProperty('--circumference', circumference.toString())
|
|
177
|
-
progressCircle.style.setProperty('--duration', `${duration}s`)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
button.addEventListener('click', () => {
|
|
182
|
-
window.scrollTo({ top: 0, behavior: 'smooth' })
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
window.addEventListener('scroll', updateScrollState, { passive: true })
|
|
186
|
-
updateScrollState()
|
|
187
|
-
})
|
|
188
|
-
</script>
|
|
189
|
-
|
|
190
|
-
<style>
|
|
191
|
-
.rla-scroll-to-top {
|
|
192
|
-
opacity: 0;
|
|
193
|
-
pointer-events: none;
|
|
194
|
-
transition: opacity 0.3s ease-in-out;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.rla-scroll-to-top.visible {
|
|
198
|
-
opacity: 1;
|
|
199
|
-
pointer-events: auto;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.progress-circle-base {
|
|
203
|
-
transform: translateZ(0);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.gauge-primary-stroke {
|
|
207
|
-
stroke: var(--color-primary-500);
|
|
208
|
-
stroke-dasharray: calc(var(--stroke-percent, 0) * var(--percent-to-px, 2.826px)) var(--circumference, 282.6);
|
|
209
|
-
transition: stroke-dasharray var(--duration, 0.1s) ease, stroke var(--duration, 0.1s) ease;
|
|
210
|
-
transform: rotate(-90deg);
|
|
211
|
-
transform-origin: center;
|
|
212
|
-
shape-rendering: geometricPrecision;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.gauge-secondary-stroke {
|
|
216
|
-
stroke: var(--color-primary-900);
|
|
217
|
-
stroke-dasharray: 282.6;
|
|
218
|
-
transform: rotate(-90deg);
|
|
219
|
-
transform-origin: center;
|
|
220
|
-
}
|
|
221
|
-
</style>
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ComponentVariants, ComponentSlots } from "../../types"
|
|
5
|
+
import scrollToTopTheme from "../../themes/scroll-to-top.theme"
|
|
6
|
+
|
|
7
|
+
const scrollToTop = scv(scrollToTopTheme)
|
|
8
|
+
type ScrollToTopVariants = ComponentVariants<typeof scrollToTopTheme>
|
|
9
|
+
|
|
10
|
+
export interface RLAScrollToTopProps {
|
|
11
|
+
color?: ScrollToTopVariants['color'];
|
|
12
|
+
progressWidth?: number;
|
|
13
|
+
duration?: number;
|
|
14
|
+
threshold?: number;
|
|
15
|
+
showProgress?: boolean;
|
|
16
|
+
ui?: ComponentSlots<typeof scrollToTopTheme>;
|
|
17
|
+
class?: any;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
color = "primary",
|
|
23
|
+
progressWidth = 6,
|
|
24
|
+
duration = 0.1,
|
|
25
|
+
threshold = 200,
|
|
26
|
+
showProgress = false,
|
|
27
|
+
ui: uiProp,
|
|
28
|
+
class: className,
|
|
29
|
+
...rest
|
|
30
|
+
} = Astro.props as RLAScrollToTopProps
|
|
31
|
+
|
|
32
|
+
const classes = resolveClasses(scrollToTop, { color }, useUi("scrollToTop", uiProp), className)
|
|
33
|
+
|
|
34
|
+
const circumference = 2 * Math.PI * 45
|
|
35
|
+
const percentPx = circumference / 100
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class:list={["rla-scroll-to-top", "fixed bottom-6 right-6 z-50", classes.root]}
|
|
40
|
+
data-threshold={threshold}
|
|
41
|
+
data-duration={duration}
|
|
42
|
+
data-circle-stroke-width={progressWidth}
|
|
43
|
+
{...rest}
|
|
44
|
+
>
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
class={classes.button}
|
|
48
|
+
aria-label="Scroll to top"
|
|
49
|
+
data-scroll-to-top-button
|
|
50
|
+
>
|
|
51
|
+
<div class={classes.progressBase}>
|
|
52
|
+
<svg class={classes.svg} viewBox="0 0 100 100" shape-rendering="geometricPrecision">
|
|
53
|
+
<circle
|
|
54
|
+
cx="50"
|
|
55
|
+
cy="50"
|
|
56
|
+
r="45"
|
|
57
|
+
fill="var(--color-primary-950)"
|
|
58
|
+
stroke-width={progressWidth}
|
|
59
|
+
stroke-dashoffset="0"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
class="gauge-secondary-stroke opacity-100"
|
|
62
|
+
/>
|
|
63
|
+
{showProgress && (
|
|
64
|
+
<circle
|
|
65
|
+
cx="50"
|
|
66
|
+
cy="50"
|
|
67
|
+
r="45"
|
|
68
|
+
fill="transparent"
|
|
69
|
+
stroke-width={progressWidth}
|
|
70
|
+
stroke-dashoffset="0"
|
|
71
|
+
stroke-linecap="round"
|
|
72
|
+
class="gauge-primary-stroke opacity-100"
|
|
73
|
+
data-progress-circle
|
|
74
|
+
style={`--stroke-percent: 0; --percent-to-px: ${percentPx}px; --circumference: ${circumference}; --duration: ${duration}s`}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
</svg>
|
|
78
|
+
<div class={classes.iconContainer}>
|
|
79
|
+
<svg
|
|
80
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
81
|
+
width="24"
|
|
82
|
+
height="24"
|
|
83
|
+
viewBox="0 0 24 24"
|
|
84
|
+
fill="none"
|
|
85
|
+
stroke="currentColor"
|
|
86
|
+
stroke-width="2"
|
|
87
|
+
stroke-linecap="round"
|
|
88
|
+
stroke-linejoin="round"
|
|
89
|
+
class={classes.icon}
|
|
90
|
+
>
|
|
91
|
+
<path d="m5 12 7-7 7 7" />
|
|
92
|
+
<path d="M12 19V5" />
|
|
93
|
+
</svg>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<script>
|
|
100
|
+
document.querySelectorAll('.rla-scroll-to-top').forEach((el) => {
|
|
101
|
+
const element = el as HTMLElement
|
|
102
|
+
const button = element.querySelector('[data-scroll-to-top-button]') as HTMLButtonElement | null
|
|
103
|
+
const progressCircle = element.querySelector('[data-progress-circle]') as SVGCircleElement | null
|
|
104
|
+
|
|
105
|
+
if (!button) return
|
|
106
|
+
|
|
107
|
+
const threshold = Number(element.dataset.threshold) || 200
|
|
108
|
+
|
|
109
|
+
function updateScrollState() {
|
|
110
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop
|
|
111
|
+
const scrollHeight = document.documentElement.scrollHeight - window.innerHeight
|
|
112
|
+
const scrollPercentage = scrollHeight > 0 ? (scrollTop / scrollHeight) * 100 : 0
|
|
113
|
+
|
|
114
|
+
if (scrollTop > threshold) {
|
|
115
|
+
element.classList.add('visible')
|
|
116
|
+
} else {
|
|
117
|
+
element.classList.remove('visible')
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (progressCircle) {
|
|
121
|
+
const circumference = 2 * Math.PI * 45
|
|
122
|
+
const percentPx = circumference / 100
|
|
123
|
+
const duration = element.dataset.duration || '0.1'
|
|
124
|
+
progressCircle.style.setProperty('--stroke-percent', scrollPercentage.toString())
|
|
125
|
+
progressCircle.style.setProperty('--percent-to-px', `${percentPx}px`)
|
|
126
|
+
progressCircle.style.setProperty('--circumference', circumference.toString())
|
|
127
|
+
progressCircle.style.setProperty('--duration', `${duration}s`)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
button.addEventListener('click', () => {
|
|
132
|
+
window.scrollTo({ top: 0, behavior: 'smooth' })
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
window.addEventListener('scroll', updateScrollState, { passive: true })
|
|
136
|
+
updateScrollState()
|
|
137
|
+
})
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<style>
|
|
141
|
+
.rla-scroll-to-top {
|
|
142
|
+
opacity: 0;
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
transition: opacity 0.3s ease-in-out;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.rla-scroll-to-top.visible {
|
|
148
|
+
opacity: 1;
|
|
149
|
+
pointer-events: auto;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.progress-circle-base {
|
|
153
|
+
transform: translateZ(0);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.gauge-primary-stroke {
|
|
157
|
+
stroke: var(--color-primary-500);
|
|
158
|
+
stroke-dasharray: calc(var(--stroke-percent, 0) * var(--percent-to-px, 2.826px)) var(--circumference, 282.6);
|
|
159
|
+
transition: stroke-dasharray var(--duration, 0.1s) ease, stroke var(--duration, 0.1s) ease;
|
|
160
|
+
transform: rotate(-90deg);
|
|
161
|
+
transform-origin: center;
|
|
162
|
+
shape-rendering: geometricPrecision;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.gauge-secondary-stroke {
|
|
166
|
+
stroke: var(--color-primary-900);
|
|
167
|
+
stroke-dasharray: 282.6;
|
|
168
|
+
transform: rotate(-90deg);
|
|
169
|
+
transform-origin: center;
|
|
170
|
+
}
|
|
171
|
+
</style>
|