radiant-docs 0.1.64 → 0.1.66

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 (29) hide show
  1. package/dist/index.js +53 -10
  2. package/package.json +4 -3
  3. package/template/package-lock.json +1991 -4096
  4. package/template/package.json +7 -19
  5. package/template/src/components/OpenApiPage.astro +107 -18
  6. package/template/src/components/Sidebar.astro +1 -0
  7. package/template/src/components/endpoint/PlaygroundBar.astro +1 -1
  8. package/template/src/components/endpoint/PlaygroundField.astro +433 -71
  9. package/template/src/components/endpoint/PlaygroundForm.astro +470 -87
  10. package/template/src/components/endpoint/RequestSnippets.astro +6 -1
  11. package/template/src/components/endpoint/ResponseDisplay.astro +109 -2
  12. package/template/src/components/endpoint/ResponseFieldTree.astro +1 -1
  13. package/template/src/components/endpoint/ResponseFields.astro +97 -28
  14. package/template/src/components/endpoint/ResponseSnippets.astro +19 -7
  15. package/template/src/layouts/Layout.astro +94 -0
  16. package/template/src/lib/openapi/operation-doc.ts +308 -70
  17. package/template/src/lib/openapi/response-content.ts +133 -0
  18. package/template/src/lib/openapi/schema-variant-labels.ts +213 -0
  19. package/template/.vscode/extensions.json +0 -4
  20. package/template/.vscode/launch.json +0 -11
  21. package/template/scripts/generate-og-images.mjs +0 -667
  22. package/template/scripts/generate-og-metadata.mjs +0 -206
  23. package/template/scripts/generate-proxy-allowed-origins.mjs +0 -48
  24. package/template/scripts/generate-robots-txt.mjs +0 -47
  25. package/template/scripts/publish-shiki-platform-assets.mjs +0 -1177
  26. package/template/scripts/remove-assistant-for-non-pro.mjs +0 -28
  27. package/template/scripts/stamp-image-versions.mjs +0 -355
  28. package/template/scripts/stamp-og-image-versions.mjs +0 -199
  29. package/template/scripts/stamp-pagefind-runtime-version.mjs +0 -140
@@ -1,18 +1,10 @@
1
1
  {
2
- "name": "builder2",
2
+ "name": "radiant-docs-preview-template",
3
3
  "type": "module",
4
4
  "version": "0.0.1",
5
5
  "scripts": {
6
6
  "dev": "astro dev",
7
- "start": "tsx runner.ts",
8
- "prebuild": "rm -rf public/pagefind",
9
- "build": "astro build && node scripts/remove-assistant-for-non-pro.mjs && node scripts/generate-og-metadata.mjs && node scripts/generate-og-images.mjs && node scripts/stamp-og-image-versions.mjs && node scripts/stamp-image-versions.mjs && pagefind --site dist && node scripts/stamp-pagefind-runtime-version.mjs && node scripts/generate-proxy-allowed-origins.mjs && node scripts/generate-robots-txt.mjs",
10
- "preview": "astro preview",
11
- "astro": "astro",
12
- "search:index": "astro build && node scripts/remove-assistant-for-non-pro.mjs && node scripts/generate-og-metadata.mjs && node scripts/generate-og-images.mjs && node scripts/stamp-og-image-versions.mjs && node scripts/stamp-image-versions.mjs && pagefind --site dist && node scripts/stamp-pagefind-runtime-version.mjs && node scripts/generate-proxy-allowed-origins.mjs && node scripts/generate-robots-txt.mjs && cp -r dist/pagefind public/",
13
- "shiki:assets:update": "node scripts/publish-shiki-platform-assets.mjs --prepare-only --write-current",
14
- "shiki:assets:upload": "node scripts/publish-shiki-platform-assets.mjs --check-current",
15
- "shiki:assets:upload:dev": "node scripts/publish-shiki-platform-assets.mjs --env-file .env --check-current"
7
+ "astro": "astro"
16
8
  },
17
9
  "dependencies": {
18
10
  "@alpinejs/collapse": "^3.15.2",
@@ -23,7 +15,6 @@
23
15
  "@astrojs/mdx": "^7.0.0",
24
16
  "@astrojs/preact": "^6.0.0",
25
17
  "@astrojs/sitemap": "^3.7.3",
26
- "@aws-sdk/client-s3": "^3.964.0",
27
18
  "@fontsource-variable/geist": "^5.2.9",
28
19
  "@fontsource-variable/geist-mono": "^5.2.8",
29
20
  "@fontsource-variable/google-sans": "^5.2.1",
@@ -41,7 +32,6 @@
41
32
  "@paper-design/shaders": "^0.0.76",
42
33
  "@preact/preset-vite": "^2.10.3",
43
34
  "@readme/oas-to-snippet": "^29.3.0",
44
- "@resvg/resvg-js": "^2.6.2",
45
35
  "@shikijs/core": "4.2.0",
46
36
  "@shikijs/engine-javascript": "4.2.0",
47
37
  "@shikijs/langs": "4.2.0",
@@ -54,7 +44,6 @@
54
44
  "alpinejs": "^3.15.2",
55
45
  "astro": "^7.0.2",
56
46
  "astro-icon": "^1.1.5",
57
- "fontkit": "^2.0.4",
58
47
  "fs-extra": "^11.3.3",
59
48
  "mdast-util-gfm": "^3.1.0",
60
49
  "micromark-extension-gfm": "^3.0.0",
@@ -62,12 +51,11 @@
62
51
  "oas": "^28.7.0",
63
52
  "openapi-sampler": "^1.6.2",
64
53
  "preact": "^10.29.0",
65
- "radiant-docs-validator": "^0.1.29",
54
+ "radiant-docs-validator": "^0.1.30",
66
55
  "rehype-autolink-headings": "^7.1.0",
67
56
  "rehype-slug": "^6.0.0",
68
57
  "remark-gfm": "^4.0.1",
69
58
  "shiki": "4.2.0",
70
- "simple-git": "^3.30.0",
71
59
  "tailwindcss": "^4.2.2",
72
60
  "wawoff2": "^2.0.1",
73
61
  "yaml": "^2.8.2"
@@ -75,8 +63,8 @@
75
63
  "devDependencies": {
76
64
  "@types/fs-extra": "^11.0.4",
77
65
  "@types/mime-types": "^3.0.1",
78
- "esbuild": "^0.25.12",
79
- "pagefind": "^1.4.0",
80
- "tsx": "^4.21.0"
81
- }
66
+ "esbuild": "^0.25.12"
67
+ },
68
+ "private": true,
69
+ "license": "UNLICENSED"
82
70
  }
@@ -34,6 +34,7 @@ const {
34
34
  requestSectionVariants,
35
35
  bodyDescription,
36
36
  bodyDefaultKind,
37
+ requestBodyContentType,
37
38
  serverUrl,
38
39
  } = operationDoc;
39
40
  const title = operationDoc.title;
@@ -113,6 +114,7 @@ const snippetStickyClass = hasTopbarNavigationTabs
113
114
  requestSectionVariants={requestSectionVariants}
114
115
  bodyDescription={bodyDescription}
115
116
  bodyDefaultKind={bodyDefaultKind}
117
+ requestBodyContentType={requestBodyContentType}
116
118
  />
117
119
  </PlaygroundButton>
118
120
  )
@@ -190,9 +192,7 @@ const snippetStickyClass = hasTopbarNavigationTabs
190
192
  )}
191
193
  {hasCommonFields && (
192
194
  <div x-data="{ expanded: true }" class="mt-4">
193
- <div
194
- class="w-full overflow-hidden rounded-xl border-[0.5px] border-neutral-900/8 bg-white shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] transition-colors duration-200 dark:border-white/6 dark:bg-(--rd-code-surface) dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]"
195
- >
195
+ <div class="w-full overflow-hidden rounded-xl border-[0.5px] border-neutral-900/12 bg-neutral-50/50 shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] transition-colors duration-200 dark:border-white/6 dark:bg-(--rd-code-surface) dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]">
196
196
  <button
197
197
  type="button"
198
198
  x-on:click="expanded = !expanded"
@@ -233,9 +233,7 @@ const snippetStickyClass = hasTopbarNavigationTabs
233
233
  {variant.label}
234
234
  </div>
235
235
  <div x-data="{ expanded: true }">
236
- <div
237
- class="w-full overflow-hidden rounded-lg border-[0.5px] border-neutral-900/8 bg-white shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] transition-colors duration-200 dark:border-white/6 dark:bg-(--rd-code-surface) dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]"
238
- >
236
+ <div class="w-full overflow-hidden rounded-lg border-[0.5px] border-neutral-900/8 bg-white shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] transition-colors duration-200 dark:border-white/6 dark:bg-(--rd-code-surface) dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]">
239
237
  <button
240
238
  type="button"
241
239
  x-on:click="expanded = !expanded"
@@ -289,7 +287,35 @@ const snippetStickyClass = hasTopbarNavigationTabs
289
287
  </article>
290
288
  </Layout>
291
289
 
292
- <script is:inline>
290
+ <script is:inline data-astro-rerun>
291
+ (() => {
292
+ const cleanupCallbacks = [];
293
+ let didCleanup = false;
294
+
295
+ const addCleanup = (callback) => {
296
+ cleanupCallbacks.push(callback);
297
+ };
298
+
299
+ const cleanup = () => {
300
+ if (didCleanup) return;
301
+ didCleanup = true;
302
+
303
+ for (const callback of cleanupCallbacks.splice(0)) {
304
+ try {
305
+ callback();
306
+ } catch {
307
+ // Ignore cleanup failures during route swaps.
308
+ }
309
+ }
310
+ };
311
+
312
+ document.addEventListener("astro:before-swap", cleanup, { once: true });
313
+ window.addEventListener("pagehide", cleanup, { once: true });
314
+ addCleanup(() => {
315
+ document.removeEventListener("astro:before-swap", cleanup);
316
+ window.removeEventListener("pagehide", cleanup);
317
+ });
318
+
293
319
  const stack = document.querySelector("[data-snippet-stack]");
294
320
 
295
321
  if (stack instanceof HTMLElement) {
@@ -324,6 +350,8 @@ const snippetStickyClass = hasTopbarNavigationTabs
324
350
  const slotHeightTransitionMs = 360;
325
351
  let isAnimatingSlotHeights = false;
326
352
  let slotHeightAnimationTimeoutId = null;
353
+ let slotHeightAnimationFrameId = null;
354
+ let slotHeightSecondAnimationFrameId = null;
327
355
 
328
356
  const applySlotHeights = ({ animate = false } = {}) => {
329
357
  if (!slots.length) return;
@@ -490,8 +518,19 @@ const snippetStickyClass = hasTopbarNavigationTabs
490
518
  };
491
519
 
492
520
  const scheduleApplySlotHeights = (options = {}) => {
493
- window.requestAnimationFrame(() => {
494
- window.requestAnimationFrame(() => applySlotHeights(options));
521
+ if (slotHeightAnimationFrameId) {
522
+ window.cancelAnimationFrame(slotHeightAnimationFrameId);
523
+ }
524
+ if (slotHeightSecondAnimationFrameId) {
525
+ window.cancelAnimationFrame(slotHeightSecondAnimationFrameId);
526
+ }
527
+
528
+ slotHeightAnimationFrameId = window.requestAnimationFrame(() => {
529
+ slotHeightAnimationFrameId = null;
530
+ slotHeightSecondAnimationFrameId = window.requestAnimationFrame(() => {
531
+ slotHeightSecondAnimationFrameId = null;
532
+ applySlotHeights(options);
533
+ });
495
534
  });
496
535
  };
497
536
 
@@ -509,10 +548,28 @@ const snippetStickyClass = hasTopbarNavigationTabs
509
548
  window.addEventListener("scroll", scheduleApplySlotHeights, {
510
549
  passive: true,
511
550
  });
512
- window.addEventListener(
513
- "rd:snippet-content-change",
514
- () => scheduleApplySlotHeights({ animate: true }),
515
- );
551
+ const handleSnippetContentChange = () =>
552
+ scheduleApplySlotHeights({ animate: true });
553
+ window.addEventListener("rd:snippet-content-change", handleSnippetContentChange);
554
+ addCleanup(() => {
555
+ resizeObserver.disconnect();
556
+ window.removeEventListener("resize", applySlotHeights);
557
+ window.visualViewport?.removeEventListener("resize", applySlotHeights);
558
+ window.removeEventListener("scroll", scheduleApplySlotHeights);
559
+ window.removeEventListener(
560
+ "rd:snippet-content-change",
561
+ handleSnippetContentChange,
562
+ );
563
+ if (slotHeightAnimationTimeoutId) {
564
+ window.clearTimeout(slotHeightAnimationTimeoutId);
565
+ }
566
+ if (slotHeightAnimationFrameId) {
567
+ window.cancelAnimationFrame(slotHeightAnimationFrameId);
568
+ }
569
+ if (slotHeightSecondAnimationFrameId) {
570
+ window.cancelAnimationFrame(slotHeightSecondAnimationFrameId);
571
+ }
572
+ });
516
573
  applySlotHeights();
517
574
  }
518
575
 
@@ -541,6 +598,8 @@ const snippetStickyClass = hasTopbarNavigationTabs
541
598
  const inlineSlotHeightTransitionMs = 360;
542
599
  let isAnimatingInlineSlotHeights = false;
543
600
  let inlineSlotHeightAnimationTimeoutId = null;
601
+ let inlineSlotAnimationFrameId = null;
602
+ let inlineSlotSecondAnimationFrameId = null;
544
603
 
545
604
  const resetInlineSlotHeights = () => {
546
605
  for (const slot of inlineSlots) {
@@ -624,15 +683,18 @@ const snippetStickyClass = hasTopbarNavigationTabs
624
683
  }, inlineSlotHeightTransitionMs + 80);
625
684
  };
626
685
 
627
- let inlineSlotAnimationFrameId = null;
628
686
  const scheduleInlineSlotHeights = (options = {}) => {
629
687
  if (inlineSlotAnimationFrameId) {
630
688
  window.cancelAnimationFrame(inlineSlotAnimationFrameId);
631
689
  }
690
+ if (inlineSlotSecondAnimationFrameId) {
691
+ window.cancelAnimationFrame(inlineSlotSecondAnimationFrameId);
692
+ }
632
693
 
633
694
  inlineSlotAnimationFrameId = window.requestAnimationFrame(() => {
634
- inlineSlotAnimationFrameId = window.requestAnimationFrame(() => {
635
- inlineSlotAnimationFrameId = null;
695
+ inlineSlotAnimationFrameId = null;
696
+ inlineSlotSecondAnimationFrameId = window.requestAnimationFrame(() => {
697
+ inlineSlotSecondAnimationFrameId = null;
636
698
  applyInlineSlotHeights(options);
637
699
  });
638
700
  });
@@ -642,11 +704,38 @@ const snippetStickyClass = hasTopbarNavigationTabs
642
704
  inlineResizeObserver.observe(inlineStack);
643
705
 
644
706
  window.addEventListener("resize", scheduleInlineSlotHeights);
645
- window.visualViewport?.addEventListener("resize", scheduleInlineSlotHeights);
707
+ window.visualViewport?.addEventListener(
708
+ "resize",
709
+ scheduleInlineSlotHeights,
710
+ );
711
+ const handleInlineSnippetContentChange = () =>
712
+ scheduleInlineSlotHeights({ animate: true });
646
713
  window.addEventListener(
647
714
  "rd:snippet-content-change",
648
- () => scheduleInlineSlotHeights({ animate: true }),
715
+ handleInlineSnippetContentChange,
649
716
  );
717
+ addCleanup(() => {
718
+ inlineResizeObserver.disconnect();
719
+ window.removeEventListener("resize", scheduleInlineSlotHeights);
720
+ window.visualViewport?.removeEventListener(
721
+ "resize",
722
+ scheduleInlineSlotHeights,
723
+ );
724
+ window.removeEventListener(
725
+ "rd:snippet-content-change",
726
+ handleInlineSnippetContentChange,
727
+ );
728
+ if (inlineSlotHeightAnimationTimeoutId) {
729
+ window.clearTimeout(inlineSlotHeightAnimationTimeoutId);
730
+ }
731
+ if (inlineSlotAnimationFrameId) {
732
+ window.cancelAnimationFrame(inlineSlotAnimationFrameId);
733
+ }
734
+ if (inlineSlotSecondAnimationFrameId) {
735
+ window.cancelAnimationFrame(inlineSlotSecondAnimationFrameId);
736
+ }
737
+ });
650
738
  scheduleInlineSlotHeights();
651
739
  }
740
+ })();
652
741
  </script>
@@ -14,6 +14,7 @@ const config: DocsConfig = await getConfig();
14
14
 
15
15
  <aside class="flex flex-col h-full">
16
16
  <nav
17
+ data-rd-sidebar-scroll-container
17
18
  class="min-h-0 flex-1 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
18
19
  >
19
20
  <SidebarMenu navigation={config.navigation} />
@@ -22,7 +22,7 @@ const pathParts = route.openApiPath
22
22
  ---
23
23
 
24
24
  <div
25
- class="min-w-0 flex-1 flex items-center p-1 border-[0.5px] border-neutral-900/8 bg-white rounded-xl shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] overflow-hidden dark:border-white/6 dark:bg-(--rd-code-surface) dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]"
25
+ class="min-w-0 flex-1 flex items-center p-1 border-[0.5px] border-neutral-900/12 bg-neutral-50/50 rounded-xl shadow-[0_.5px_1px_rgba(0,0,0,0.15),0_5px_12px_-6px_rgba(0,0,0,0.08)] overflow-hidden dark:border-white/6 dark:bg-(--rd-code-surface) dark:shadow-[0_-.5px_1px_rgba(255,255,255,0.15),0_5px_12px_-6px_rgba(0,0,0,0.2)]"
26
26
  >
27
27
  <span
28
28
  class="rd-endpoint-method-tag shrink-0 inline-block px-1.5 ml-1 text-sm font-semibold rounded-md uppercase border"