radiant-docs 0.1.39 → 0.1.41
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 +1 -1
- package/template/astro.config.mjs +38 -7
- package/template/package-lock.json +19 -7
- package/template/package.json +3 -3
- package/template/public/favicon.svg +16 -8
- package/template/scripts/generate-robots-txt.mjs +29 -1
- package/template/scripts/remove-assistant-for-non-pro.mjs +28 -0
- package/template/scripts/stamp-image-versions.mjs +59 -33
- package/template/src/components/Footer.astro +2 -1
- package/template/src/components/Header.astro +10 -8
- package/template/src/components/LogoLink.astro +2 -1
- package/template/src/components/MdxPage.astro +15 -4
- package/template/src/components/PagePagination.astro +61 -0
- package/template/src/components/SidebarDropdown.astro +12 -8
- package/template/src/components/SidebarGroup.astro +1 -1
- package/template/src/components/SidebarMenu.astro +1 -1
- package/template/src/components/SidebarSegmented.astro +6 -5
- package/template/src/components/TableOfContents.astro +4 -13
- package/template/src/components/chat/AskAiWidget.tsx +274 -39
- package/template/src/components/chat/AssistantDocsWidget.astro +16 -0
- package/template/src/components/chat/AssistantDocsWidget.tsx +402 -0
- package/template/src/components/chat/AssistantEmbedPanel.tsx +1693 -0
- package/template/src/components/chat/AssistantEmbedPanelPage.astro +95 -0
- package/template/src/components/endpoint/PlaygroundForm.astro +2 -1
- package/template/src/components/user/Callout.astro +10 -4
- package/template/src/components/user/CodeBlock.astro +1 -1
- package/template/src/components/user/CodeGroup.astro +16 -1
- package/template/src/components/user/ComponentPreviewBlock.astro +1 -0
- package/template/src/components/user/Image.astro +43 -53
- package/template/src/layouts/Layout.astro +104 -35
- package/template/src/lib/assistant-chrome-defaults.ts +74 -0
- package/template/src/lib/assistant-chrome.ts +39 -0
- package/template/src/lib/assistant-embed-script.ts +897 -0
- package/template/src/lib/assistant-panel-config.ts +80 -0
- package/template/src/lib/base-path.ts +98 -0
- package/template/src/lib/component-error.ts +49 -10
- package/template/src/lib/favicon.ts +31 -0
- package/template/src/lib/mdx/remark-resolve-internal-links.ts +128 -18
- package/template/src/lib/pagefind.ts +62 -14
- package/template/src/lib/routes.ts +49 -1
- package/template/src/lib/static-asset-url.ts +3 -1
- package/template/src/lib/theme-css.ts +176 -0
- package/template/src/lib/utils.ts +12 -4
- package/template/src/lib/validation.ts +754 -37
- package/template/src/pages/-/assistant/embed.js.ts +15 -0
- package/template/src/pages/-/assistant/panel.astro +5 -0
- package/template/src/pages/404.astro +6 -5
- package/template/src/pages/[...slug].astro +68 -6
- package/template/src/styles/global.css +62 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { renderAssistantEmbedScript } from "../../../lib/assistant-embed-script";
|
|
2
|
+
import { getConfig } from "../../../lib/validation";
|
|
3
|
+
|
|
4
|
+
export const prerender = true;
|
|
5
|
+
|
|
6
|
+
export async function GET(): Promise<Response> {
|
|
7
|
+
const config = await getConfig();
|
|
8
|
+
|
|
9
|
+
return new Response(renderAssistantEmbedScript(config), {
|
|
10
|
+
headers: {
|
|
11
|
+
"Content-Type": "application/javascript; charset=utf-8",
|
|
12
|
+
"Cache-Control": "no-cache, max-age=0, must-revalidate",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { Icon } from "astro-icon/components";
|
|
3
|
+
import { withBasePath } from "../lib/base-path";
|
|
3
4
|
import Layout from "../layouts/Layout.astro";
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -8,10 +9,10 @@ import Layout from "../layouts/Layout.astro";
|
|
|
8
9
|
pageDescription="The page you requested could not be found."
|
|
9
10
|
>
|
|
10
11
|
<section
|
|
11
|
-
class="mx-auto mt-
|
|
12
|
+
class="mx-auto mt-20 h-full my-auto flex max-w-xl flex-col items-center gap-5 rounded-2xl text-center"
|
|
12
13
|
>
|
|
13
14
|
<p
|
|
14
|
-
class="font-mono text-sm font-medium tracking-[0.22em] text-neutral-500 uppercase dark:
|
|
15
|
+
class="rounded border border-neutral-200 bg-neutral-50 px-1 py-px pr-0.5 font-mono text-sm font-medium tracking-[0.22em] text-neutral-500 uppercase dark:border-neutral-800 dark:bg-neutral-900/60 dark:text-neutral-400"
|
|
15
16
|
>
|
|
16
17
|
404
|
|
17
18
|
</p>
|
|
@@ -26,15 +27,15 @@ import Layout from "../layouts/Layout.astro";
|
|
|
26
27
|
<div class="flex flex-wrap items-center justify-center gap-3">
|
|
27
28
|
<button
|
|
28
29
|
type="button"
|
|
29
|
-
class="inline-flex items-center justify-center gap-1.5 rounded-lg [corner-shape:superellipse(1.2)] border
|
|
30
|
+
class="inline-flex items-center justify-center gap-1.5 rounded-lg [corner-shape:superellipse(1.2)] border border-neutral-200 bg-white px-4 py-2 text-sm font-medium text-neutral-700/85 shadow-xs transition hover:bg-neutral-50 hover:text-neutral-700 dark:border-neutral-800 dark:bg-neutral-900/60 dark:text-neutral-300 dark:hover:bg-neutral-800/70 dark:hover:text-neutral-100 cursor-pointer"
|
|
30
31
|
onclick="history.back()"
|
|
31
32
|
>
|
|
32
33
|
<Icon name="lucide:arrow-big-left-dash" class="size-4" />
|
|
33
34
|
Go back
|
|
34
35
|
</button>
|
|
35
36
|
<a
|
|
36
|
-
href="/"
|
|
37
|
-
class="inline-flex items-center justify-center gap-2 rounded-lg [corner-shape:superellipse(1.2)] border border-border px-4 py-2 text-sm font-[350]
|
|
37
|
+
href={withBasePath("/")}
|
|
38
|
+
class="inline-flex items-center justify-center gap-2 rounded-lg [corner-shape:superellipse(1.2)] border border-border bg-linear-to-b from-neutral-900/85 to-neutral-900 px-4 py-2 text-sm font-[350] text-white shadow-sm transition hover:opacity-95 dark:from-neutral-100 dark:to-neutral-200 dark:font-[450] dark:text-neutral-950"
|
|
38
39
|
>
|
|
39
40
|
<Icon name="lucide:house" class="size-4" />
|
|
40
41
|
Take me home
|
|
@@ -1,16 +1,48 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { getCollection } from "astro:content";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getAllRoutes,
|
|
5
|
+
resolveMdxPageTitle,
|
|
6
|
+
type Route,
|
|
7
|
+
} from "../lib/routes";
|
|
4
8
|
import { getConfig, validateMdxContent } from "../lib/validation";
|
|
5
9
|
import MdxPage from "../components/MdxPage.astro";
|
|
6
10
|
import OpenApiPage from "../components/OpenApiPage.astro";
|
|
7
11
|
import type { GetStaticPathsResult } from "astro";
|
|
8
12
|
|
|
9
13
|
export async function getStaticPaths(): Promise<GetStaticPathsResult> {
|
|
14
|
+
const buildAdjacentRouteMap = (routes: Route[]): Map<
|
|
15
|
+
string,
|
|
16
|
+
{
|
|
17
|
+
previousRoute?: Route;
|
|
18
|
+
nextRoute?: Route;
|
|
19
|
+
}
|
|
20
|
+
> => {
|
|
21
|
+
const adjacentBySlug = new Map<
|
|
22
|
+
string,
|
|
23
|
+
{
|
|
24
|
+
previousRoute?: Route;
|
|
25
|
+
nextRoute?: Route;
|
|
26
|
+
}
|
|
27
|
+
>();
|
|
28
|
+
|
|
29
|
+
for (let index = 0; index < routes.length; index++) {
|
|
30
|
+
const currentRoute = routes[index];
|
|
31
|
+
adjacentBySlug.set(currentRoute.slug, {
|
|
32
|
+
previousRoute: routes[index - 1],
|
|
33
|
+
nextRoute: routes[index + 1],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return adjacentBySlug;
|
|
38
|
+
};
|
|
39
|
+
|
|
10
40
|
await validateMdxContent();
|
|
11
41
|
const routes = await getAllRoutes();
|
|
42
|
+
const visibleRoutes = routes.filter((route) => !route.hidden);
|
|
12
43
|
const docs = await getCollection("docs");
|
|
13
44
|
const config = await getConfig();
|
|
45
|
+
const adjacentRoutesBySlug = buildAdjacentRouteMap(visibleRoutes);
|
|
14
46
|
|
|
15
47
|
// console.log("routes", routes);
|
|
16
48
|
|
|
@@ -31,9 +63,16 @@ export async function getStaticPaths(): Promise<GetStaticPathsResult> {
|
|
|
31
63
|
`Could not find content collection entry for path: ${route.filePath}`,
|
|
32
64
|
);
|
|
33
65
|
}
|
|
66
|
+
const adjacentRoutes = adjacentRoutesBySlug.get(route.slug);
|
|
34
67
|
return {
|
|
35
68
|
params: { slug: route.slug },
|
|
36
|
-
props: {
|
|
69
|
+
props: {
|
|
70
|
+
route,
|
|
71
|
+
entry,
|
|
72
|
+
previousRoute: adjacentRoutes?.previousRoute,
|
|
73
|
+
nextRoute: adjacentRoutes?.nextRoute,
|
|
74
|
+
homePath: config.home,
|
|
75
|
+
},
|
|
37
76
|
};
|
|
38
77
|
} else {
|
|
39
78
|
return {
|
|
@@ -68,22 +107,45 @@ export async function getStaticPaths(): Promise<GetStaticPathsResult> {
|
|
|
68
107
|
filePath: config.home,
|
|
69
108
|
}),
|
|
70
109
|
};
|
|
110
|
+
|
|
111
|
+
const homeAdjacentRoutes = existingHomeRoute
|
|
112
|
+
? adjacentRoutesBySlug.get(existingHomeRoute.slug)
|
|
113
|
+
: undefined;
|
|
114
|
+
|
|
71
115
|
paths.push({
|
|
72
116
|
params: { slug: "/" },
|
|
73
|
-
props: {
|
|
117
|
+
props: {
|
|
118
|
+
route: homeRoute,
|
|
119
|
+
entry: homeEntry,
|
|
120
|
+
previousRoute: homeAdjacentRoutes?.previousRoute,
|
|
121
|
+
nextRoute: homeAdjacentRoutes?.nextRoute,
|
|
122
|
+
homePath: config.home,
|
|
123
|
+
},
|
|
74
124
|
});
|
|
75
125
|
}
|
|
76
126
|
|
|
77
127
|
return paths;
|
|
78
128
|
}
|
|
79
129
|
|
|
80
|
-
const props = Astro.props as {
|
|
81
|
-
|
|
130
|
+
const props = Astro.props as {
|
|
131
|
+
route: Route;
|
|
132
|
+
entry?: any;
|
|
133
|
+
previousRoute?: Route;
|
|
134
|
+
nextRoute?: Route;
|
|
135
|
+
homePath?: string;
|
|
136
|
+
};
|
|
137
|
+
const { route, entry, previousRoute, nextRoute, homePath } = props;
|
|
82
138
|
---
|
|
83
139
|
|
|
84
140
|
{
|
|
85
141
|
route.type === "mdx" ? (
|
|
86
|
-
<MdxPage
|
|
142
|
+
<MdxPage
|
|
143
|
+
entry={entry!}
|
|
144
|
+
route={route}
|
|
145
|
+
previousRoute={previousRoute}
|
|
146
|
+
nextRoute={nextRoute}
|
|
147
|
+
homePath={homePath}
|
|
148
|
+
/>
|
|
87
149
|
) : (
|
|
88
150
|
<OpenApiPage route={route} />
|
|
89
151
|
)
|
|
@@ -111,7 +111,68 @@
|
|
|
111
111
|
|
|
112
112
|
/* Prose styling */
|
|
113
113
|
.prose-rules {
|
|
114
|
-
@apply *:max-w-2xl prose
|
|
114
|
+
@apply *:max-w-2xl prose *:first:mt-0 *:last:mb-0 prose-h2:scroll-mt-28 prose-h3:scroll-mt-24 prose-headings:font-semibold;
|
|
115
|
+
--tw-prose-body: var(--color-neutral-700);
|
|
116
|
+
--tw-prose-headings: var(--color-neutral-900);
|
|
117
|
+
--tw-prose-lead: var(--color-neutral-600);
|
|
118
|
+
--tw-prose-links: var(--color-neutral-900);
|
|
119
|
+
--tw-prose-bold: var(--color-neutral-900);
|
|
120
|
+
--tw-prose-counters: var(--color-neutral-500);
|
|
121
|
+
--tw-prose-bullets: inherit;
|
|
122
|
+
--tw-prose-hr: var(--color-neutral-200);
|
|
123
|
+
--tw-prose-quotes: var(--color-neutral-900);
|
|
124
|
+
--tw-prose-quote-borders: var(--color-neutral-200);
|
|
125
|
+
--tw-prose-captions: var(--color-neutral-500);
|
|
126
|
+
--tw-prose-kbd: var(--color-neutral-900);
|
|
127
|
+
--tw-prose-kbd-shadows: color-mix(
|
|
128
|
+
in oklab,
|
|
129
|
+
var(--color-neutral-900) 10%,
|
|
130
|
+
transparent
|
|
131
|
+
);
|
|
132
|
+
--tw-prose-code: var(--color-neutral-900);
|
|
133
|
+
--tw-prose-pre-code: var(--color-neutral-200);
|
|
134
|
+
--tw-prose-pre-bg: var(--color-neutral-800);
|
|
135
|
+
--tw-prose-th-borders: var(--color-neutral-300);
|
|
136
|
+
--tw-prose-td-borders: var(--color-neutral-200);
|
|
137
|
+
--tw-prose-invert-body: var(--color-neutral-300);
|
|
138
|
+
--tw-prose-invert-headings: white;
|
|
139
|
+
--tw-prose-invert-lead: var(--color-neutral-400);
|
|
140
|
+
--tw-prose-invert-links: white;
|
|
141
|
+
--tw-prose-invert-bold: white;
|
|
142
|
+
--tw-prose-invert-counters: var(--color-neutral-400);
|
|
143
|
+
--tw-prose-invert-bullets: var(--color-neutral-600);
|
|
144
|
+
--tw-prose-invert-hr: var(--color-neutral-700);
|
|
145
|
+
--tw-prose-invert-quotes: var(--color-neutral-100);
|
|
146
|
+
--tw-prose-invert-quote-borders: var(--color-neutral-700);
|
|
147
|
+
--tw-prose-invert-captions: var(--color-neutral-400);
|
|
148
|
+
--tw-prose-invert-kbd: white;
|
|
149
|
+
--tw-prose-invert-kbd-shadows: color-mix(in oklab, white 10%, transparent);
|
|
150
|
+
--tw-prose-invert-code: white;
|
|
151
|
+
--tw-prose-invert-pre-code: var(--color-neutral-300);
|
|
152
|
+
--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);
|
|
153
|
+
--tw-prose-invert-th-borders: var(--color-neutral-600);
|
|
154
|
+
--tw-prose-invert-td-borders: var(--color-neutral-700);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.dark .prose-rules {
|
|
158
|
+
--tw-prose-body: var(--tw-prose-invert-body);
|
|
159
|
+
--tw-prose-headings: var(--tw-prose-invert-headings);
|
|
160
|
+
--tw-prose-lead: var(--tw-prose-invert-lead);
|
|
161
|
+
--tw-prose-links: var(--tw-prose-invert-links);
|
|
162
|
+
--tw-prose-bold: var(--tw-prose-invert-bold);
|
|
163
|
+
--tw-prose-counters: var(--tw-prose-invert-counters);
|
|
164
|
+
--tw-prose-bullets: var(--tw-prose-invert-bullets);
|
|
165
|
+
--tw-prose-hr: var(--tw-prose-invert-hr);
|
|
166
|
+
--tw-prose-quotes: var(--tw-prose-invert-quotes);
|
|
167
|
+
--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);
|
|
168
|
+
--tw-prose-captions: var(--tw-prose-invert-captions);
|
|
169
|
+
--tw-prose-kbd: var(--tw-prose-invert-kbd);
|
|
170
|
+
--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);
|
|
171
|
+
--tw-prose-code: var(--tw-prose-invert-code);
|
|
172
|
+
--tw-prose-pre-code: var(--tw-prose-invert-pre-code);
|
|
173
|
+
--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);
|
|
174
|
+
--tw-prose-th-borders: var(--tw-prose-invert-th-borders);
|
|
175
|
+
--tw-prose-td-borders: var(--tw-prose-invert-td-borders);
|
|
115
176
|
}
|
|
116
177
|
|
|
117
178
|
.prose-rules :is(h2, h3, h4, h5, h6) {
|