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.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/template/astro.config.mjs +38 -27
  3. package/template/package-lock.json +2858 -1140
  4. package/template/package.json +18 -13
  5. package/template/scripts/generate-proxy-allowed-origins.mjs +10 -179
  6. package/template/scripts/publish-shiki-platform-assets.mjs +1177 -0
  7. package/template/src/components/Header.astro +6 -1
  8. package/template/src/components/NavigationTabList.astro +65 -0
  9. package/template/src/components/NavigationTabs.astro +109 -0
  10. package/template/src/components/OpenApiPage.astro +17 -1
  11. package/template/src/components/Sidebar.astro +2 -2
  12. package/template/src/components/SidebarDropdown.astro +105 -44
  13. package/template/src/components/SidebarMenu.astro +3 -0
  14. package/template/src/components/SidebarSegmented.astro +87 -52
  15. package/template/src/components/SidebarTabs.astro +86 -0
  16. package/template/src/components/chat/AssistantDocsWidget.tsx +127 -2
  17. package/template/src/components/chat/AssistantEmbedPanel.tsx +401 -283
  18. package/template/src/components/endpoint/PlaygroundForm.astro +69 -55
  19. package/template/src/components/endpoint/ResponseDisplay.astro +2 -2
  20. package/template/src/components/user/Accordion.astro +1 -1
  21. package/template/src/components/user/Callout.astro +2 -2
  22. package/template/src/components/user/CodeBlock.astro +58 -7
  23. package/template/src/components/user/CodeGroup.astro +52 -1
  24. package/template/src/components/user/Column.astro +1 -1
  25. package/template/src/components/user/Step.astro +1 -1
  26. package/template/src/components/user/Tabs.astro +1 -1
  27. package/template/src/generated/shiki-platform-assets.json +24 -0
  28. package/template/src/layouts/Layout.astro +111 -8
  29. package/template/src/lib/assistant-panel-config.ts +4 -0
  30. package/template/src/lib/assistant-shiki-client.ts +522 -0
  31. package/template/src/lib/client-shiki-config.ts +60 -0
  32. package/template/src/lib/dev-playground-proxy.mjs +597 -0
  33. package/template/src/lib/mdx/remark-resolve-internal-links.ts +334 -17
  34. package/template/src/lib/proxy-allowed-origins.mjs +189 -0
  35. package/template/src/lib/routes.ts +66 -24
  36. package/template/src/styles/global.css +16 -4
  37. package/template/src/components/ui/demo/CodeDemo.astro +0 -15
  38. package/template/src/components/ui/demo/Demo.astro +0 -3
  39. 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
- const submenu = menuItem.submenu;
430
+ routes = routes.concat(
431
+ await processNavigationContent(menuItem, currentPrefix, docs),
432
+ );
424
433
 
425
- // Process pages if they exist (pages array can contain pages and groups)
426
- if (submenu.pages) {
427
- for (const item of submenu.pages) {
428
- if (typeof item === "string" || "page" in item) {
429
- routes.push(processPageItem(item, currentPrefix, docs));
430
- } else if ("group" in item) {
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(item as NavGroup, currentPrefix, docs),
476
+ await processGroup(pageItem as NavGroup, parentSlug, docs),
433
477
  );
434
- } else if ("openapi" in item) {
435
- routes.push(await processOpenApiPageItem(item, currentPrefix));
478
+ } else if ("openapi" in pageItem) {
479
+ routes.push(await processOpenApiPageItem(pageItem, parentSlug));
436
480
  }
437
481
  }
438
482
  }
439
483
 
440
- // Process OpenAPI file if it exists
441
- if (submenu.openapi) {
442
- const openApiRoutes = await processOpenApiFile(
443
- submenu.openapi,
444
- currentPrefix,
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 (pages or menu)
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
- // Case 3: Menu object at the top level
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) 60%,
79
- var(--background) 40%
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) 4%,
85
- var(--color-white) 96%
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>
@@ -1,3 +0,0 @@
1
- <div class="border rounded-xl shadow-xs my-5!">
2
- <slot />
3
- </div>
@@ -1,13 +0,0 @@
1
- ---
2
- interface Props {
3
- centerUi?: boolean;
4
- }
5
-
6
- const { centerUi } = Astro.props;
7
- ---
8
-
9
- <div
10
- class:list={["px-8 flex justify-center", centerUi && "items-center min-h-96"]}
11
- >
12
- <slot />
13
- </div>