radiant-docs 0.1.61 → 0.1.63
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 -27
- package/template/package-lock.json +2858 -1140
- package/template/package.json +18 -13
- package/template/scripts/generate-proxy-allowed-origins.mjs +10 -179
- package/template/scripts/publish-shiki-platform-assets.mjs +1177 -0
- package/template/src/components/Header.astro +6 -1
- package/template/src/components/NavigationTabList.astro +65 -0
- package/template/src/components/NavigationTabs.astro +109 -0
- package/template/src/components/OpenApiPage.astro +17 -1
- package/template/src/components/Sidebar.astro +2 -2
- package/template/src/components/SidebarDropdown.astro +105 -44
- package/template/src/components/SidebarMenu.astro +3 -0
- package/template/src/components/SidebarSegmented.astro +87 -52
- package/template/src/components/SidebarTabs.astro +86 -0
- package/template/src/components/chat/AssistantDocsWidget.tsx +127 -2
- package/template/src/components/chat/AssistantEmbedPanel.tsx +401 -283
- package/template/src/components/endpoint/PlaygroundForm.astro +69 -55
- package/template/src/components/endpoint/ResponseDisplay.astro +2 -2
- package/template/src/components/user/Accordion.astro +1 -1
- package/template/src/components/user/Callout.astro +2 -2
- package/template/src/components/user/CodeBlock.astro +58 -7
- package/template/src/components/user/CodeGroup.astro +52 -1
- package/template/src/components/user/Column.astro +1 -1
- package/template/src/components/user/Step.astro +1 -1
- package/template/src/components/user/Tabs.astro +1 -1
- package/template/src/generated/shiki-platform-assets.json +24 -0
- package/template/src/layouts/Layout.astro +111 -8
- package/template/src/lib/assistant-panel-config.ts +4 -0
- package/template/src/lib/assistant-shiki-client.ts +522 -0
- package/template/src/lib/client-shiki-config.ts +60 -0
- package/template/src/lib/dev-playground-proxy.mjs +597 -0
- package/template/src/lib/mdx/remark-resolve-internal-links.ts +334 -17
- package/template/src/lib/proxy-allowed-origins.mjs +189 -0
- package/template/src/lib/routes.ts +66 -24
- package/template/src/styles/global.css +16 -4
- package/template/src/components/ui/demo/CodeDemo.astro +0 -15
- package/template/src/components/ui/demo/Demo.astro +0 -3
- package/template/src/components/ui/demo/UiDisplay.astro +0 -13
|
@@ -3,7 +3,9 @@ import {
|
|
|
3
3
|
type NavGroup,
|
|
4
4
|
type NavPage,
|
|
5
5
|
type NavOpenApiPage,
|
|
6
|
+
type NavMenu,
|
|
6
7
|
type NavMenuItem,
|
|
8
|
+
type NavTabItem,
|
|
7
9
|
type NavOpenApi,
|
|
8
10
|
type DocsConfig,
|
|
9
11
|
loadOpenApiSpec,
|
|
@@ -22,6 +24,11 @@ import { prependBasePath, withBasePath } from "./base-path";
|
|
|
22
24
|
import { getCollection } from "astro:content";
|
|
23
25
|
|
|
24
26
|
type MdxNavPageItem = string | NavPage;
|
|
27
|
+
type NavigationContentContainer = {
|
|
28
|
+
pages?: (string | NavPage | NavGroup | NavOpenApiPage)[];
|
|
29
|
+
menu?: NavMenu;
|
|
30
|
+
openapi?: string | NavOpenApi;
|
|
31
|
+
};
|
|
25
32
|
|
|
26
33
|
// Base route interface
|
|
27
34
|
export interface BaseRoute {
|
|
@@ -420,30 +427,66 @@ async function processMenuItem(
|
|
|
420
427
|
? `${parentSlug}/${menuItemSlug}`
|
|
421
428
|
: menuItemSlug;
|
|
422
429
|
|
|
423
|
-
|
|
430
|
+
routes = routes.concat(
|
|
431
|
+
await processNavigationContent(menuItem, currentPrefix, docs),
|
|
432
|
+
);
|
|
424
433
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
434
|
+
return routes;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
async function processMenu(
|
|
438
|
+
menu: NavMenu,
|
|
439
|
+
parentSlug: string = "",
|
|
440
|
+
docs: any[],
|
|
441
|
+
): Promise<Route[]> {
|
|
442
|
+
let routes: Route[] = [];
|
|
443
|
+
|
|
444
|
+
for (const menuItem of menu.items) {
|
|
445
|
+
const menuItemRoutes = await processMenuItem(menuItem, parentSlug, docs);
|
|
446
|
+
routes = routes.concat(menuItemRoutes);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return routes;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
async function processTabItem(
|
|
453
|
+
tabItem: NavTabItem,
|
|
454
|
+
parentSlug: string = "",
|
|
455
|
+
docs: any[],
|
|
456
|
+
): Promise<Route[]> {
|
|
457
|
+
const tabSlug = slugify(tabItem.slug || tabItem.label);
|
|
458
|
+
const currentPrefix = parentSlug ? `${parentSlug}/${tabSlug}` : tabSlug;
|
|
459
|
+
|
|
460
|
+
return processNavigationContent(tabItem, currentPrefix, docs);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
async function processNavigationContent(
|
|
464
|
+
item: NavigationContentContainer,
|
|
465
|
+
parentSlug: string,
|
|
466
|
+
docs: any[],
|
|
467
|
+
): Promise<Route[]> {
|
|
468
|
+
let routes: Route[] = [];
|
|
469
|
+
|
|
470
|
+
if (item.pages) {
|
|
471
|
+
for (const pageItem of item.pages) {
|
|
472
|
+
if (typeof pageItem === "string" || "page" in pageItem) {
|
|
473
|
+
routes.push(processPageItem(pageItem, parentSlug, docs));
|
|
474
|
+
} else if ("group" in pageItem) {
|
|
431
475
|
routes = routes.concat(
|
|
432
|
-
await processGroup(
|
|
476
|
+
await processGroup(pageItem as NavGroup, parentSlug, docs),
|
|
433
477
|
);
|
|
434
|
-
} else if ("openapi" in
|
|
435
|
-
routes.push(await processOpenApiPageItem(
|
|
478
|
+
} else if ("openapi" in pageItem) {
|
|
479
|
+
routes.push(await processOpenApiPageItem(pageItem, parentSlug));
|
|
436
480
|
}
|
|
437
481
|
}
|
|
438
482
|
}
|
|
439
483
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
);
|
|
446
|
-
routes = routes.concat(openApiRoutes);
|
|
484
|
+
if (item.menu) {
|
|
485
|
+
routes = routes.concat(await processMenu(item.menu, parentSlug, docs));
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (item.openapi) {
|
|
489
|
+
routes = routes.concat(await processOpenApiFile(item.openapi, parentSlug));
|
|
447
490
|
}
|
|
448
491
|
|
|
449
492
|
return routes;
|
|
@@ -483,7 +526,7 @@ export async function getAllRoutes(): Promise<Route[]> {
|
|
|
483
526
|
|
|
484
527
|
let allRoutes: Route[] = [];
|
|
485
528
|
|
|
486
|
-
// 3. Identify the active navigation container
|
|
529
|
+
// 3. Identify the active navigation container
|
|
487
530
|
// We use the XOR guarantee from validateNavigation (only one key exists)
|
|
488
531
|
if (navigation.pages) {
|
|
489
532
|
// Case 1: Pages array at the top level (can contain pages and groups)
|
|
@@ -499,15 +542,14 @@ export async function getAllRoutes(): Promise<Route[]> {
|
|
|
499
542
|
}
|
|
500
543
|
}
|
|
501
544
|
} else if (navigation.menu) {
|
|
502
|
-
|
|
503
|
-
// Need to await all menu items since processMenuItem is now async
|
|
504
|
-
for (const menuItem of navigation.menu.items) {
|
|
505
|
-
const menuItemRoutes = await processMenuItem(menuItem, "", docs);
|
|
506
|
-
allRoutes = allRoutes.concat(menuItemRoutes);
|
|
507
|
-
}
|
|
545
|
+
allRoutes = allRoutes.concat(await processMenu(navigation.menu, "", docs));
|
|
508
546
|
} else if (navigation.openapi) {
|
|
509
547
|
const openApiRoutes = await processOpenApiFile(navigation.openapi, "");
|
|
510
548
|
allRoutes = allRoutes.concat(openApiRoutes);
|
|
549
|
+
} else if (navigation.tabs) {
|
|
550
|
+
for (const tabItem of navigation.tabs.items) {
|
|
551
|
+
allRoutes = allRoutes.concat(await processTabItem(tabItem, "", docs));
|
|
552
|
+
}
|
|
511
553
|
}
|
|
512
554
|
|
|
513
555
|
for (const auxiliaryPageRef of getAuxiliaryPageRefs(config)) {
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
--rd-panel-transition-easing: cubic-bezier(0.22, 1, 0.36, 1);
|
|
76
76
|
--rd-code-surface: color-mix(
|
|
77
77
|
in srgb,
|
|
78
|
-
var(--color-neutral-100)
|
|
79
|
-
var(--background)
|
|
78
|
+
var(--color-neutral-100) 70%,
|
|
79
|
+
var(--background) 30%
|
|
80
80
|
);
|
|
81
81
|
--rd-code-tab-edge-bg: var(--rd-code-surface);
|
|
82
82
|
--rd-code-tab-edge-border: color-mix(
|
|
83
83
|
in oklab,
|
|
84
|
-
var(--color-neutral-900)
|
|
85
|
-
var(--color-white)
|
|
84
|
+
var(--color-neutral-900) 6%,
|
|
85
|
+
var(--color-white) 94%
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -139,6 +139,18 @@
|
|
|
139
139
|
display: none !important;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/* Disable route transition animation while preserving Astro client navigation. */
|
|
143
|
+
::view-transition,
|
|
144
|
+
::view-transition-group(*),
|
|
145
|
+
::view-transition-image-pair(*),
|
|
146
|
+
::view-transition-old(*),
|
|
147
|
+
::view-transition-new(*) {
|
|
148
|
+
animation: none !important;
|
|
149
|
+
animation-delay: 0s !important;
|
|
150
|
+
animation-duration: 0s !important;
|
|
151
|
+
mix-blend-mode: normal !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
142
154
|
/* Prose styling */
|
|
143
155
|
.prose-rules {
|
|
144
156
|
@apply prose max-w-none *:my-6 *:first:mt-0 *:last:mb-0 prose-h2:mt-12 prose-h2:mb-2 prose-h2:scroll-mt-24 prose-h3:mt-8 prose-h3:mb-2 prose-h3:scroll-mt-20 prose-headings:font-semibold prose-p:mt-0 prose-p:mb-4 prose-ol:mt-0 prose-ol:mb-5 prose-ul:mt-0 prose-ul:mb-5 prose-a:decoration-(--color-theme) prose-a:decoration-from-font prose-blockquote:border-(--color-theme)/30 dark:prose-blockquote:border-(--color-theme)/30;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<span class="demo-component">
|
|
2
|
-
<slot />
|
|
3
|
-
</span>
|
|
4
|
-
|
|
5
|
-
<style>
|
|
6
|
-
@reference "../../../styles/global.css";
|
|
7
|
-
|
|
8
|
-
:global(.demo-component .frame) {
|
|
9
|
-
@apply shadow-none! my-0!;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:global(.demo-component .frame pre) {
|
|
13
|
-
@apply border-none! rounded-none rounded-b-xl bg-neutral-50! inset-shadow-xs;
|
|
14
|
-
}
|
|
15
|
-
</style>
|