radiant-docs 0.1.0
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/dist/index.js +312 -0
- package/package.json +38 -0
- package/template/.vscode/extensions.json +4 -0
- package/template/.vscode/launch.json +11 -0
- package/template/astro.config.mjs +216 -0
- package/template/ec.config.mjs +51 -0
- package/template/package-lock.json +12546 -0
- package/template/package.json +51 -0
- package/template/public/favicon.svg +9 -0
- package/template/src/assets/icons/check.svg +33 -0
- package/template/src/assets/icons/danger.svg +37 -0
- package/template/src/assets/icons/info.svg +36 -0
- package/template/src/assets/icons/lightbulb.svg +74 -0
- package/template/src/assets/icons/warning.svg +37 -0
- package/template/src/components/Header.astro +176 -0
- package/template/src/components/MdxPage.astro +49 -0
- package/template/src/components/OpenApiPage.astro +270 -0
- package/template/src/components/Search.astro +362 -0
- package/template/src/components/Sidebar.astro +19 -0
- package/template/src/components/SidebarDropdown.astro +149 -0
- package/template/src/components/SidebarGroup.astro +51 -0
- package/template/src/components/SidebarLink.astro +56 -0
- package/template/src/components/SidebarMenu.astro +46 -0
- package/template/src/components/SidebarSubgroup.astro +136 -0
- package/template/src/components/TableOfContents.astro +480 -0
- package/template/src/components/ThemeSwitcher.astro +84 -0
- package/template/src/components/endpoint/PlaygroundBar.astro +68 -0
- package/template/src/components/endpoint/PlaygroundButton.astro +44 -0
- package/template/src/components/endpoint/PlaygroundField.astro +54 -0
- package/template/src/components/endpoint/PlaygroundForm.astro +203 -0
- package/template/src/components/endpoint/RequestSnippets.astro +308 -0
- package/template/src/components/endpoint/ResponseDisplay.astro +177 -0
- package/template/src/components/endpoint/ResponseFields.astro +224 -0
- package/template/src/components/endpoint/ResponseSnippets.astro +247 -0
- package/template/src/components/sidebar/SidebarEndpointLink.astro +51 -0
- package/template/src/components/sidebar/SidebarOpenApi.astro +207 -0
- package/template/src/components/ui/Field.astro +69 -0
- package/template/src/components/ui/Tag.astro +5 -0
- package/template/src/components/ui/demo/CodeDemo.astro +15 -0
- package/template/src/components/ui/demo/Demo.astro +3 -0
- package/template/src/components/ui/demo/UiDisplay.astro +13 -0
- package/template/src/components/user/Accordian.astro +69 -0
- package/template/src/components/user/AccordianGroup.astro +13 -0
- package/template/src/components/user/Callout.astro +101 -0
- package/template/src/components/user/Step.astro +51 -0
- package/template/src/components/user/Steps.astro +9 -0
- package/template/src/components/user/Tab.astro +25 -0
- package/template/src/components/user/Tabs.astro +122 -0
- package/template/src/content.config.ts +11 -0
- package/template/src/entrypoint.ts +9 -0
- package/template/src/layouts/Layout.astro +92 -0
- package/template/src/lib/component-error.ts +163 -0
- package/template/src/lib/frontmatter-schema.ts +9 -0
- package/template/src/lib/oas.ts +24 -0
- package/template/src/lib/pagefind.ts +88 -0
- package/template/src/lib/routes.ts +316 -0
- package/template/src/lib/utils.ts +59 -0
- package/template/src/lib/validation.ts +1097 -0
- package/template/src/pages/[...slug].astro +77 -0
- package/template/src/styles/global.css +209 -0
- package/template/tsconfig.json +5 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getCollection } from "astro:content";
|
|
3
|
+
import { getAllRoutes, type Route } from "../lib/routes";
|
|
4
|
+
import { getConfig, validateMdxContent } from "../lib/validation";
|
|
5
|
+
import MdxPage from "../components/MdxPage.astro";
|
|
6
|
+
import OpenApiPage from "../components/OpenApiPage.astro";
|
|
7
|
+
import type { GetStaticPathsResult } from "astro";
|
|
8
|
+
|
|
9
|
+
export async function getStaticPaths(): Promise<GetStaticPathsResult> {
|
|
10
|
+
await validateMdxContent();
|
|
11
|
+
const routes = await getAllRoutes();
|
|
12
|
+
const docs = await getCollection("docs");
|
|
13
|
+
const config = await getConfig();
|
|
14
|
+
|
|
15
|
+
// console.log("routes", routes);
|
|
16
|
+
|
|
17
|
+
// Helper to find entry
|
|
18
|
+
const findEntry = (filePath: string) => {
|
|
19
|
+
return docs.find((doc: any) => {
|
|
20
|
+
const docPath = doc.id.replace(/\.mdx$/, "");
|
|
21
|
+
return docPath === filePath;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Map existing routes
|
|
26
|
+
const paths = routes.map((route) => {
|
|
27
|
+
if (route.type === "mdx") {
|
|
28
|
+
const entry = findEntry(route.filePath);
|
|
29
|
+
if (!entry) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Could not find content collection entry for path: ${route.filePath}`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
params: { slug: route.slug },
|
|
36
|
+
props: { route, entry },
|
|
37
|
+
};
|
|
38
|
+
} else {
|
|
39
|
+
return {
|
|
40
|
+
params: { slug: route.slug },
|
|
41
|
+
props: { route },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Add the home page route
|
|
47
|
+
if (config.home) {
|
|
48
|
+
const homeEntry = findEntry(config.home);
|
|
49
|
+
if (!homeEntry) {
|
|
50
|
+
throw new Error(`Home page content not found for path: ${config.home}`);
|
|
51
|
+
}
|
|
52
|
+
const homeRoute: Route = {
|
|
53
|
+
type: "mdx",
|
|
54
|
+
slug: "/",
|
|
55
|
+
filePath: config.home,
|
|
56
|
+
title: homeEntry.data.title,
|
|
57
|
+
};
|
|
58
|
+
paths.push({
|
|
59
|
+
params: { slug: "/" },
|
|
60
|
+
props: { route: homeRoute, entry: homeEntry },
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return paths;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const props = Astro.props as { route: Route; entry?: any };
|
|
68
|
+
const { route, entry } = props;
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
route.type === "mdx" ? (
|
|
73
|
+
<MdxPage entry={entry!} />
|
|
74
|
+
) : (
|
|
75
|
+
<OpenApiPage route={route} />
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@plugin "@tailwindcss/typography";
|
|
3
|
+
|
|
4
|
+
@theme {
|
|
5
|
+
/* This maps the 'background' utility to our CSS variable */
|
|
6
|
+
--color-background: var(--background);
|
|
7
|
+
--color-background-dark: var(--background-dark);
|
|
8
|
+
|
|
9
|
+
--color-border: var(--border);
|
|
10
|
+
--color-border-light: var(--border-light);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* 2. Light Mode (Default) */
|
|
14
|
+
:root {
|
|
15
|
+
--background: #ffffff;
|
|
16
|
+
--background-dark: var(--color-neutral-100);
|
|
17
|
+
|
|
18
|
+
--border: var(--color-neutral-200);
|
|
19
|
+
--border-light: var(--color-neutral-100);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* 3. Dark Mode */
|
|
23
|
+
.dark {
|
|
24
|
+
--background: var(--color-neutral-900);
|
|
25
|
+
--background-dark: var(--color-neutral-950);
|
|
26
|
+
|
|
27
|
+
--border: color-mix(in srgb, var(--color-neutral-800) 100%, transparent);
|
|
28
|
+
--border-light: color-mix(in srgb, var(--color-neutral-800) 50%, transparent);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@variant dark (&:where(.dark, .dark *));
|
|
32
|
+
|
|
33
|
+
@theme {
|
|
34
|
+
--breakpoint-xs: 30rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[x-cloak] {
|
|
38
|
+
display: none !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Prose styling */
|
|
42
|
+
.prose-rules {
|
|
43
|
+
@apply *:max-w-2xl max-w-none prose prose-neutral *:my-5 *:first:mt-0 *:last:mb-0 dark:prose-invert prose-h2:scroll-mt-28 prose-h3:scroll-mt-24 prose-headings:font-semibold [--tw-prose-bullets:inherit] [--tw-prose-counters:text-neutral-95s0];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Code block styling */
|
|
47
|
+
.expressive-code .ec-line .code {
|
|
48
|
+
border-inline-start-width: 0 !important;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.expressive-code .has-title .copy button,
|
|
52
|
+
.expressive-code .is-terminal .copy button {
|
|
53
|
+
@apply opacity-100!;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.expressive-code .copy button {
|
|
57
|
+
@apply rounded-md!;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Hide the tooltip text */
|
|
61
|
+
.expressive-code .copy .feedback {
|
|
62
|
+
@apply hidden!;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.expressive-code .frame:not(.has-title):hover .copy button {
|
|
66
|
+
@apply bg-white/50! opacity-100! backdrop-blur-xs shadow-xs;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Copy icon color */
|
|
70
|
+
.expressive-code .copy button:after {
|
|
71
|
+
@apply bg-neutral-500/80! duration-200;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.expressive-code .copy button:hover:after {
|
|
75
|
+
@apply bg-neutral-500!;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Copy button animation */
|
|
79
|
+
.expressive-code .copy button div {
|
|
80
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") !important;
|
|
81
|
+
@apply transition-all! duration-200! scale-0! opacity-0! bg-green-600! mask-no-repeat mask-center;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.expressive-code .copy button:hover div {
|
|
85
|
+
@apply opacity-100 bg-green-600!;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.expressive-code .copy:has(.feedback) button div {
|
|
89
|
+
@apply scale-100! opacity-100!;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.expressive-code .copy button:after {
|
|
93
|
+
@apply transition-all duration-200;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.expressive-code .copy:has(.feedback) button:after {
|
|
97
|
+
@apply scale-0 opacity-0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Copy button with code block title */
|
|
101
|
+
.expressive-code .has-title .copy,
|
|
102
|
+
.expressive-code .is-terminal .copy {
|
|
103
|
+
@apply top-px!;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.expressive-code .has-title .copy button,
|
|
107
|
+
.expressive-code .is-terminal .copy button {
|
|
108
|
+
@apply bg-transparent!;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.expressive-code .has-title .copy button:before,
|
|
112
|
+
.expressive-code .is-terminal .copy button:before {
|
|
113
|
+
@apply border-none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.expressive-code .is-terminal .title {
|
|
117
|
+
@apply text-neutral-400 font-normal! text-[13px];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Code single-line styling */
|
|
121
|
+
.prose :not(pre) > code {
|
|
122
|
+
@apply px-1 py-0.5 bg-neutral-100/90 text-neutral-950 rounded-md font-mono font-medium border border-neutral-200/80 shadow-xs after:hidden before:hidden;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* <ol> numbers */
|
|
126
|
+
.prose :where(ol > li)::marker {
|
|
127
|
+
@apply font-medium;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Code line collapse issue */
|
|
131
|
+
.expressive-code .ec-line .code {
|
|
132
|
+
@apply min-w-0 w-fit;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Collapse icon */
|
|
136
|
+
.expressive-code .ec-section summary :is(.expand, .collapse) {
|
|
137
|
+
@apply opacity-100!;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Tab shadows */
|
|
141
|
+
.expressive-code .frame.has-title:not(.is-terminal) .title {
|
|
142
|
+
@apply shadow-[1px_0px_2px_0px_rgba(0,0,0,0.01)];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.expressive-code .frame.has-title:not(.is-terminal) .header {
|
|
146
|
+
@apply shadow-[inset_0px_0.5px_2px_2px_rgba(0,0,0,0.01)];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Animations */
|
|
150
|
+
@keyframes scaleIn {
|
|
151
|
+
from {
|
|
152
|
+
transform: scale(0);
|
|
153
|
+
opacity: 0;
|
|
154
|
+
}
|
|
155
|
+
to {
|
|
156
|
+
transform: scale(1);
|
|
157
|
+
opacity: 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@keyframes loading-sweep {
|
|
162
|
+
0% {
|
|
163
|
+
background-position: 130% 0;
|
|
164
|
+
}
|
|
165
|
+
100% {
|
|
166
|
+
background-position: -130% 0;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.animate-loading {
|
|
171
|
+
background-image: linear-gradient(
|
|
172
|
+
90deg,
|
|
173
|
+
transparent 30%,
|
|
174
|
+
rgba(255, 255, 255, 0.4) 50%,
|
|
175
|
+
transparent 70%
|
|
176
|
+
);
|
|
177
|
+
background-size: 200% 100%;
|
|
178
|
+
background-repeat: no-repeat;
|
|
179
|
+
animation: loading-sweep 1.3s ease-in-out infinite;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Dark mode variant */
|
|
183
|
+
.dark .animate-loading {
|
|
184
|
+
background-image: linear-gradient(
|
|
185
|
+
90deg,
|
|
186
|
+
transparent 0%,
|
|
187
|
+
rgba(255, 255, 255, 0.1) 50%,
|
|
188
|
+
transparent 100%
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:root {
|
|
193
|
+
--theme-transition: 0ms; /* Default is instant */
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* When the switching class is active, force ALL transitions
|
|
197
|
+
to use our synchronized duration */
|
|
198
|
+
.is-switching-theme * {
|
|
199
|
+
--theme-transition: 200ms; /* Set your desired sync speed */
|
|
200
|
+
|
|
201
|
+
transition-duration: var(--theme-transition) !important;
|
|
202
|
+
transition-property: background-color, border-color, color, fill, stroke !important;
|
|
203
|
+
}
|
|
204
|
+
/* Ensure the pill slider is NOT affected by the forced color duration
|
|
205
|
+
so its movement remains independent */
|
|
206
|
+
.is-switching-theme .anchor-pill {
|
|
207
|
+
transition-duration: 200ms !important;
|
|
208
|
+
transition-property: left, width, background-color !important;
|
|
209
|
+
}
|